Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int2(int *a1, int *a2) {
  scanf("%d %d", a1, a2);
  return 0;
}

#define PREF_MAX 100000
#define CITY_MAX 100000

struct city {
    int pref;
    int year;
};

int asc_by_year(const void *a1, const void *a2) {
    struct city *ca1 = (struct city*)a1;
    struct city *ca2 = (struct city*)a2;
    return ca1->year - ca2->year;
}

struct list {
    int num;
    int idx;
    struct list *next;
};

#define HASH_SIZE 65536
struct list *create_htable(void) {
    static struct list htable[HASH_SIZE];
    int i;
    for(i = 0; i < HASH_SIZE; i++) {
        htable[i].next = &htable[i];
    }
    return htable;
}

int get_key(int num) {
    return num & (HASH_SIZE-1);
}

int find_idx(struct list *htable, struct city *c) {
    struct list *head = &htable[get_key(c->year)];
    struct list *elem;
    for(elem = head->next; elem != head; elem = elem->next) {
        if(elem->num == c->year) {
            return elem->idx;
        }
    }
    return -1;
}

void add_elem(struct list *htable, int num, int idx) {
    struct list *elem = malloc(sizeof(struct list));
    struct list *head = &htable[get_key(num)];
    elem->next = head->next;
    elem->num = num;
    elem->idx = idx;
    head->next = elem;
}

void zip(struct list *htable, struct city *cities, int size) {
    qsort(cities, size, sizeof(struct city), asc_by_year);
    int prev = 0;
    int i;
    static int idx[PREF_MAX+1];
    for(i = 0; i <= PREF_MAX; i++) idx[i] = 1;

    for(i = 0; i < size; i++) {
        int y = cities[i].year;
        int pref = cities[i].pref;
        // There are no multiple cities that are established in the same year.
        if(prev == y) continue;
        add_elem(htable, y, idx[pref]);
        prev = y;
        idx[pref]++;
    }
    return;
}

int main(void) {
    int num, cs;
    get_int2(&num, &cs);
    static struct city cities[CITY_MAX];

    int i;
    for(i = 0; i < cs; i++) {
        get_int2(&cities[i].pref, &cities[i].year);
    }
    static struct city sorted[CITY_MAX];
    memcpy(sorted, cities, sizeof(struct city)*cs);

    struct list *htable = create_htable();
    zip(htable, sorted, cs);

    for(i = 0; i < cs; i++) {
        struct city c = cities[i];
        printf("%06d%06d\n", c.pref, find_idx(htable, &c));
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
	.text
	.globl	get_int2
	.type	get_int2, @function
get_int2:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	get_int2, .-get_int2
	.globl	asc_by_year
	.type	asc_by_year, @function
asc_by_year:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movl	4(%rax), %edx
	movq	-8(%rbp), %rax
	movl	4(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	asc_by_year, .-asc_by_year
	.globl	create_htable
	.type	create_htable, @function
create_htable:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L6
.L7:
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	htable.3(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+htable.3(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L6:
	cmpl	$65535, -4(%rbp)
	jle	.L7
	leaq	htable.3(%rip), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	create_htable, .-create_htable
	.globl	get_key
	.type	get_key, @function
get_key:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	movzwl	%ax, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	get_key, .-get_key
	.globl	find_idx
	.type	find_idx, @function
find_idx:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	4(%rax), %eax
	movl	%eax, %edi
	call	get_key
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -16(%rbp)
	jmp	.L12
.L15:
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-32(%rbp), %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jne	.L13
	movq	-16(%rbp), %rax
	movl	4(%rax), %eax
	jmp	.L14
.L13:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -16(%rbp)
.L12:
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jne	.L15
	movl	$-1, %eax
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	find_idx, .-find_idx
	.globl	add_elem
	.type	add_elem, @function
add_elem:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	get_key
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	%rdx, 8(%rax)
	movq	-16(%rbp), %rax
	movl	-28(%rbp), %edx
	movl	%edx, (%rax)
	movq	-16(%rbp), %rax
	movl	-32(%rbp), %edx
	movl	%edx, 4(%rax)
	movq	-8(%rbp), %rax
	movq	-16(%rbp), %rdx
	movq	%rdx, 8(%rax)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	add_elem, .-add_elem
	.globl	zip
	.type	zip, @function
zip:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	%edx, -36(%rbp)
	movl	-36(%rbp), %eax
	movslq	%eax, %rsi
	movq	-32(%rbp), %rax
	leaq	asc_by_year(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L18
.L19:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	idx.2(%rip), %rax
	movl	$1, (%rdx,%rax)
	addl	$1, -12(%rbp)
.L18:
	cmpl	$100000, -12(%rbp)
	jle	.L19
	movl	$0, -12(%rbp)
	jmp	.L20
.L23:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	movl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-16(%rbp), %eax
	cmpl	-8(%rbp), %eax
	je	.L25
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	idx.2(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	add_elem
	movl	-8(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	idx.2(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	idx.2(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L22
.L25:
	nop
.L22:
	addl	$1, -12(%rbp)
.L20:
	movl	-12(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L23
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	zip, .-zip
	.section	.rodata
.LC1:
	.string	"%06d%06d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB13:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	movl	$0, -28(%rbp)
	jmp	.L27
.L28:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	cities.1(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	cities.1(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	addl	$1, -28(%rbp)
.L27:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L28
	movl	-32(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdx
	leaq	cities.1(%rip), %rax
	movq	%rax, %rsi
	leaq	sorted.0(%rip), %rax
	movq	%rax, %rdi
	call	memcpy@PLT
	call	create_htable
	movq	%rax, -24(%rbp)
	movl	-32(%rbp), %edx
	movq	-24(%rbp), %rax
	leaq	sorted.0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	zip
	movl	$0, -28(%rbp)
	jmp	.L29
.L30:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	cities.1(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -16(%rbp)
	leaq	-16(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	find_idx
	movl	%eax, %edx
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -28(%rbp)
.L29:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L30
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	main, .-main
	.local	htable.3
	.comm	htable.3,1048576,32
	.local	idx.2
	.comm	idx.2,400004,32
	.local	cities.1
	.comm	cities.1,800000,32
	.local	sorted.0
	.comm	sorted.0,800000,32
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	asc_by_year
	.type	asc_by_year, @function
asc_by_year:
.LFB52:
	.cfi_startproc
	endbr64
	movl	4(%rdi), %eax
	subl	4(%rsi), %eax
	ret
	.cfi_endproc
.LFE52:
	.size	asc_by_year, .-asc_by_year
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
	.text
	.p2align 4
	.globl	get_int2
	.type	get_int2, @function
get_int2:
.LFB51:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movq	%rsi, %rdx
	xorl	%eax, %eax
	movq	%rdi, %rsi
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE51:
	.size	get_int2, .-get_int2
	.p2align 4
	.globl	create_htable
	.type	create_htable, @function
create_htable:
.LFB53:
	.cfi_startproc
	endbr64
	movdqa	.LC3(%rip), %xmm3
	pxor	%xmm5, %xmm5
	leaq	htable.3(%rip), %r8
	movdqa	.LC1(%rip), %xmm4
	movdqa	%xmm5, %xmm6
	movq	%r8, %xmm7
	leaq	8(%r8), %rax
	movdqa	.LC2(%rip), %xmm8
	pcmpgtd	%xmm3, %xmm6
	punpcklqdq	%xmm7, %xmm7
	leaq	1048584(%r8), %rdx
	.p2align 4,,10
	.p2align 3
.L6:
	movdqa	%xmm4, %xmm0
	movdqa	%xmm5, %xmm2
	movdqa	%xmm6, %xmm9
	addq	$64, %rax
	movdqa	%xmm0, %xmm1
	paddd	%xmm8, %xmm4
	punpckldq	%xmm0, %xmm1
	punpckhdq	%xmm0, %xmm0
	pcmpgtd	%xmm1, %xmm2
	pmuludq	%xmm1, %xmm9
	pmuludq	%xmm3, %xmm1
	pmuludq	%xmm3, %xmm2
	paddq	%xmm9, %xmm2
	movdqa	%xmm6, %xmm9
	psllq	$32, %xmm2
	pmuludq	%xmm0, %xmm9
	paddq	%xmm2, %xmm1
	movdqa	%xmm5, %xmm2
	pcmpgtd	%xmm0, %xmm2
	pmuludq	%xmm3, %xmm0
	paddq	%xmm7, %xmm1
	movq	%xmm1, -64(%rax)
	movhps	%xmm1, -48(%rax)
	pmuludq	%xmm3, %xmm2
	paddq	%xmm9, %xmm2
	psllq	$32, %xmm2
	paddq	%xmm2, %xmm0
	paddq	%xmm7, %xmm0
	movq	%xmm0, -32(%rax)
	movhps	%xmm0, -16(%rax)
	cmpq	%rax, %rdx
	jne	.L6
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE53:
	.size	create_htable, .-create_htable
	.p2align 4
	.globl	get_key
	.type	get_key, @function
get_key:
.LFB54:
	.cfi_startproc
	endbr64
	movzwl	%di, %eax
	ret
	.cfi_endproc
.LFE54:
	.size	get_key, .-get_key
	.p2align 4
	.globl	find_idx
	.type	find_idx, @function
find_idx:
.LFB55:
	.cfi_startproc
	endbr64
	movl	4(%rsi), %edx
	movzwl	%dx, %eax
	salq	$4, %rax
	addq	%rax, %rdi
	movq	8(%rdi), %rax
	cmpq	%rax, %rdi
	jne	.L12
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L11:
	movq	8(%rax), %rax
	cmpq	%rax, %rdi
	je	.L13
.L12:
	cmpl	(%rax), %edx
	jne	.L11
	movl	4(%rax), %eax
	ret
	.p2align 4,,10
	.p2align 3
.L13:
	movl	$-1, %eax
	ret
	.cfi_endproc
.LFE55:
	.size	find_idx, .-find_idx
	.p2align 4
	.globl	add_elem
	.type	add_elem, @function
add_elem:
.LFB56:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rdi, %rbx
	movl	$16, %edi
	call	malloc@PLT
	movzwl	%bp, %edx
	movd	%ebp, %xmm0
	movd	%r12d, %xmm1
	salq	$4, %rdx
	punpckldq	%xmm1, %xmm0
	addq	%rbx, %rdx
	movq	%xmm0, (%rax)
	movq	8(%rdx), %rcx
	movq	%rax, 8(%rdx)
	movq	%rcx, 8(%rax)
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE56:
	.size	add_elem, .-add_elem
	.p2align 4
	.globl	zip
	.type	zip, @function
zip:
.LFB57:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	asc_by_year(%rip), %rcx
	leaq	idx.2(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rsi, %rbp
	movslq	%edx, %rsi
	movl	$8, %edx
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%rdi, 8(%rsp)
	movq	%rbp, %rdi
	call	qsort@PLT
	movdqa	.LC4(%rip), %xmm0
	movq	%r15, %rax
	leaq	400000(%r15), %rdx
	.p2align 4,,10
	.p2align 3
.L18:
	movaps	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L18
	movl	$1, 400000+idx.2(%rip)
	testl	%ebx, %ebx
	jle	.L17
	leal	-1(%rbx), %eax
	xorl	%r14d, %r14d
	leaq	8(%rbp,%rax,8), %r13
	.p2align 4,,10
	.p2align 3
.L21:
	movl	%r14d, %eax
	movl	4(%rbp), %r14d
	cmpl	%eax, %r14d
	je	.L20
	movslq	0(%rbp), %r12
	movl	$16, %edi
	movl	(%r15,%r12,4), %ebx
	call	malloc@PLT
	movzwl	%r14w, %edx
	movd	%r14d, %xmm0
	salq	$4, %rdx
	addq	8(%rsp), %rdx
	movd	%ebx, %xmm1
	addl	$1, %ebx
	movq	8(%rdx), %rsi
	movq	%rax, 8(%rdx)
	punpckldq	%xmm1, %xmm0
	movl	%ebx, (%r15,%r12,4)
	movq	%rsi, 8(%rax)
	movq	%xmm0, (%rax)
.L20:
	addq	$8, %rbp
	cmpq	%r13, %rbp
	jne	.L21
.L17:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE57:
	.size	zip, .-zip
	.section	.rodata.str1.1
.LC5:
	.string	"%06d%06d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB58:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%r14, %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	cities.1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r13d
	testl	%r13d, %r13d
	jle	.L26
	movq	%rbp, %rbx
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L27:
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r13d
	addl	$1, %r12d
	addq	$8, %rbx
	cmpl	%r12d, %r13d
	jg	.L27
.L26:
	leaq	sorted.0(%rip), %r8
	movslq	%r13d, %rdx
	movl	$800000, %ecx
	movq	%rbp, %rsi
	salq	$3, %rdx
	movq	%r8, %rdi
	leaq	htable.3(%rip), %rbx
	call	__memcpy_chk@PLT
	pxor	%xmm5, %xmm5
	movdqa	.LC3(%rip), %xmm3
	movq	%rbx, %xmm7
	movdqa	%xmm5, %xmm6
	movdqa	.LC1(%rip), %xmm4
	movq	%rax, %r8
	movdqa	.LC2(%rip), %xmm8
	pcmpgtd	%xmm3, %xmm6
	punpcklqdq	%xmm7, %xmm7
	leaq	8(%rbx), %rax
	leaq	1048584(%rbx), %rdx
	.p2align 4,,10
	.p2align 3
.L28:
	movdqa	%xmm4, %xmm0
	movdqa	%xmm5, %xmm2
	movdqa	%xmm6, %xmm9
	addq	$64, %rax
	movdqa	%xmm0, %xmm1
	paddd	%xmm8, %xmm4
	punpckldq	%xmm0, %xmm1
	punpckhdq	%xmm0, %xmm0
	pcmpgtd	%xmm1, %xmm2
	pmuludq	%xmm1, %xmm9
	pmuludq	%xmm3, %xmm1
	pmuludq	%xmm3, %xmm2
	paddq	%xmm9, %xmm2
	movdqa	%xmm6, %xmm9
	psllq	$32, %xmm2
	pmuludq	%xmm0, %xmm9
	paddq	%xmm2, %xmm1
	movdqa	%xmm5, %xmm2
	pcmpgtd	%xmm0, %xmm2
	pmuludq	%xmm3, %xmm0
	paddq	%xmm7, %xmm1
	movq	%xmm1, -64(%rax)
	movhps	%xmm1, -48(%rax)
	pmuludq	%xmm3, %xmm2
	paddq	%xmm9, %xmm2
	psllq	$32, %xmm2
	paddq	%xmm2, %xmm0
	paddq	%xmm7, %xmm0
	movq	%xmm0, -32(%rax)
	movhps	%xmm0, -16(%rax)
	cmpq	%rdx, %rax
	jne	.L28
	movl	%r13d, %edx
	movq	%r8, %rsi
	movq	%rbx, %rdi
	xorl	%r14d, %r14d
	call	zip
	movl	4(%rsp), %eax
	leaq	4+cities.1(%rip), %r13
	leaq	.LC5(%rip), %r12
	testl	%eax, %eax
	jle	.L33
	.p2align 4,,10
	.p2align 3
.L29:
	movl	0(%r13,%r14,8), %ecx
	movl	0(%rbp,%r14,8), %r8d
	movzwl	%cx, %edx
	salq	$4, %rdx
	addq	%rbx, %rdx
	movq	8(%rdx), %rax
	cmpq	%rax, %rdx
	jne	.L32
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L31:
	movq	8(%rax), %rax
	cmpq	%rax, %rdx
	je	.L36
.L32:
	cmpl	(%rax), %ecx
	jne	.L31
	movl	4(%rax), %ecx
.L30:
	movl	%r8d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$1, %r14
	cmpl	%r14d, 4(%rsp)
	jg	.L29
.L33:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L45
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L36:
	.cfi_restore_state
	movl	$-1, %ecx
	jmp	.L30
.L45:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE58:
	.size	main, .-main
	.local	sorted.0
	.comm	sorted.0,800000,32
	.local	cities.1
	.comm	cities.1,800000,32
	.local	idx.2
	.comm	idx.2,400004,32
	.local	htable.3
	.comm	htable.3,1048576,32
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC3:
	.long	16
	.long	16
	.long	16
	.long	16
	.align 16
.LC4:
	.long	1
	.long	1
	.long	1
	.long	1
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	asc_by_year
	.type	asc_by_year, @function
asc_by_year:
.LFB52:
	.cfi_startproc
	endbr64
	movl	4(%rdi), %eax
	subl	4(%rsi), %eax
	ret
	.cfi_endproc
.LFE52:
	.size	asc_by_year, .-asc_by_year
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
	.text
	.p2align 4
	.globl	get_int2
	.type	get_int2, @function
get_int2:
.LFB51:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movq	%rsi, %rdx
	xorl	%eax, %eax
	movq	%rdi, %rsi
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE51:
	.size	get_int2, .-get_int2
	.p2align 4
	.globl	create_htable
	.type	create_htable, @function
create_htable:
.LFB53:
	.cfi_startproc
	endbr64
	movdqa	.LC3(%rip), %xmm3
	pxor	%xmm5, %xmm5
	leaq	htable.3(%rip), %r8
	movdqa	.LC1(%rip), %xmm4
	movdqa	%xmm5, %xmm6
	movq	%r8, %xmm7
	leaq	8(%r8), %rax
	movdqa	.LC2(%rip), %xmm8
	pcmpgtd	%xmm3, %xmm6
	punpcklqdq	%xmm7, %xmm7
	leaq	1048584(%r8), %rdx
	.p2align 4,,10
	.p2align 3
.L6:
	movdqa	%xmm4, %xmm0
	movdqa	%xmm5, %xmm2
	movdqa	%xmm6, %xmm9
	addq	$64, %rax
	movdqa	%xmm0, %xmm1
	paddd	%xmm8, %xmm4
	punpckldq	%xmm0, %xmm1
	punpckhdq	%xmm0, %xmm0
	pcmpgtd	%xmm1, %xmm2
	pmuludq	%xmm1, %xmm9
	pmuludq	%xmm3, %xmm1
	pmuludq	%xmm3, %xmm2
	paddq	%xmm9, %xmm2
	movdqa	%xmm6, %xmm9
	psllq	$32, %xmm2
	pmuludq	%xmm0, %xmm9
	paddq	%xmm2, %xmm1
	movdqa	%xmm5, %xmm2
	pcmpgtd	%xmm0, %xmm2
	pmuludq	%xmm3, %xmm0
	paddq	%xmm7, %xmm1
	movq	%xmm1, -64(%rax)
	movhps	%xmm1, -48(%rax)
	pmuludq	%xmm3, %xmm2
	paddq	%xmm9, %xmm2
	psllq	$32, %xmm2
	paddq	%xmm2, %xmm0
	paddq	%xmm7, %xmm0
	movq	%xmm0, -32(%rax)
	movhps	%xmm0, -16(%rax)
	cmpq	%rax, %rdx
	jne	.L6
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE53:
	.size	create_htable, .-create_htable
	.p2align 4
	.globl	get_key
	.type	get_key, @function
get_key:
.LFB54:
	.cfi_startproc
	endbr64
	movzwl	%di, %eax
	ret
	.cfi_endproc
.LFE54:
	.size	get_key, .-get_key
	.p2align 4
	.globl	find_idx
	.type	find_idx, @function
find_idx:
.LFB55:
	.cfi_startproc
	endbr64
	movl	4(%rsi), %edx
	movzwl	%dx, %eax
	salq	$4, %rax
	addq	%rax, %rdi
	movq	8(%rdi), %rax
	cmpq	%rax, %rdi
	jne	.L12
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L11:
	movq	8(%rax), %rax
	cmpq	%rax, %rdi
	je	.L13
.L12:
	cmpl	(%rax), %edx
	jne	.L11
	movl	4(%rax), %eax
	ret
	.p2align 4,,10
	.p2align 3
.L13:
	movl	$-1, %eax
	ret
	.cfi_endproc
.LFE55:
	.size	find_idx, .-find_idx
	.p2align 4
	.globl	add_elem
	.type	add_elem, @function
add_elem:
.LFB56:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rdi, %rbx
	movl	$16, %edi
	call	malloc@PLT
	movzwl	%bp, %edx
	movd	%ebp, %xmm0
	movd	%r12d, %xmm1
	salq	$4, %rdx
	punpckldq	%xmm1, %xmm0
	addq	%rbx, %rdx
	movq	%xmm0, (%rax)
	movq	8(%rdx), %rcx
	movq	%rax, 8(%rdx)
	movq	%rcx, 8(%rax)
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE56:
	.size	add_elem, .-add_elem
	.p2align 4
	.globl	zip
	.type	zip, @function
zip:
.LFB57:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	asc_by_year(%rip), %rcx
	leaq	idx.2(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rsi, %rbp
	movslq	%edx, %rsi
	movl	$8, %edx
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%rdi, 8(%rsp)
	movq	%rbp, %rdi
	call	qsort@PLT
	movdqa	.LC4(%rip), %xmm0
	movq	%r15, %rax
	leaq	400000(%r15), %rdx
	.p2align 4,,10
	.p2align 3
.L18:
	movaps	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L18
	movl	$1, 400000+idx.2(%rip)
	testl	%ebx, %ebx
	jle	.L17
	leal	-1(%rbx), %eax
	xorl	%r14d, %r14d
	leaq	8(%rbp,%rax,8), %r13
	.p2align 4,,10
	.p2align 3
.L21:
	movl	%r14d, %eax
	movl	4(%rbp), %r14d
	cmpl	%eax, %r14d
	je	.L20
	movslq	0(%rbp), %r12
	movl	$16, %edi
	movl	(%r15,%r12,4), %ebx
	call	malloc@PLT
	movzwl	%r14w, %edx
	movd	%r14d, %xmm0
	salq	$4, %rdx
	addq	8(%rsp), %rdx
	movd	%ebx, %xmm1
	addl	$1, %ebx
	movq	8(%rdx), %rsi
	movq	%rax, 8(%rdx)
	punpckldq	%xmm1, %xmm0
	movl	%ebx, (%r15,%r12,4)
	movq	%rsi, 8(%rax)
	movq	%xmm0, (%rax)
.L20:
	addq	$8, %rbp
	cmpq	%r13, %rbp
	jne	.L21
.L17:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE57:
	.size	zip, .-zip
	.section	.rodata.str1.1
.LC5:
	.string	"%06d%06d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB58:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%r14, %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	cities.1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r13d
	testl	%r13d, %r13d
	jle	.L26
	movq	%rbp, %rbx
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L27:
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r13d
	addl	$1, %r12d
	addq	$8, %rbx
	cmpl	%r12d, %r13d
	jg	.L27
.L26:
	leaq	sorted.0(%rip), %r8
	movslq	%r13d, %rdx
	movl	$800000, %ecx
	movq	%rbp, %rsi
	salq	$3, %rdx
	movq	%r8, %rdi
	leaq	htable.3(%rip), %rbx
	call	__memcpy_chk@PLT
	pxor	%xmm5, %xmm5
	movdqa	.LC3(%rip), %xmm3
	movq	%rbx, %xmm7
	movdqa	%xmm5, %xmm6
	movdqa	.LC1(%rip), %xmm4
	movq	%rax, %r8
	movdqa	.LC2(%rip), %xmm8
	pcmpgtd	%xmm3, %xmm6
	punpcklqdq	%xmm7, %xmm7
	leaq	8(%rbx), %rax
	leaq	1048584(%rbx), %rdx
	.p2align 4,,10
	.p2align 3
.L28:
	movdqa	%xmm4, %xmm0
	movdqa	%xmm5, %xmm2
	movdqa	%xmm6, %xmm9
	addq	$64, %rax
	movdqa	%xmm0, %xmm1
	paddd	%xmm8, %xmm4
	punpckldq	%xmm0, %xmm1
	punpckhdq	%xmm0, %xmm0
	pcmpgtd	%xmm1, %xmm2
	pmuludq	%xmm1, %xmm9
	pmuludq	%xmm3, %xmm1
	pmuludq	%xmm3, %xmm2
	paddq	%xmm9, %xmm2
	movdqa	%xmm6, %xmm9
	psllq	$32, %xmm2
	pmuludq	%xmm0, %xmm9
	paddq	%xmm2, %xmm1
	movdqa	%xmm5, %xmm2
	pcmpgtd	%xmm0, %xmm2
	pmuludq	%xmm3, %xmm0
	paddq	%xmm7, %xmm1
	movq	%xmm1, -64(%rax)
	movhps	%xmm1, -48(%rax)
	pmuludq	%xmm3, %xmm2
	paddq	%xmm9, %xmm2
	psllq	$32, %xmm2
	paddq	%xmm2, %xmm0
	paddq	%xmm7, %xmm0
	movq	%xmm0, -32(%rax)
	movhps	%xmm0, -16(%rax)
	cmpq	%rdx, %rax
	jne	.L28
	movl	%r13d, %edx
	movq	%r8, %rsi
	movq	%rbx, %rdi
	xorl	%r14d, %r14d
	call	zip
	movl	4(%rsp), %eax
	leaq	4+cities.1(%rip), %r13
	leaq	.LC5(%rip), %r12
	testl	%eax, %eax
	jle	.L33
	.p2align 4,,10
	.p2align 3
.L29:
	movl	0(%r13,%r14,8), %ecx
	movl	0(%rbp,%r14,8), %r8d
	movzwl	%cx, %edx
	salq	$4, %rdx
	addq	%rbx, %rdx
	movq	8(%rdx), %rax
	cmpq	%rax, %rdx
	jne	.L32
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L31:
	movq	8(%rax), %rax
	cmpq	%rax, %rdx
	je	.L36
.L32:
	cmpl	(%rax), %ecx
	jne	.L31
	movl	4(%rax), %ecx
.L30:
	movl	%r8d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$1, %r14
	cmpl	%r14d, 4(%rsp)
	jg	.L29
.L33:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L45
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L36:
	.cfi_restore_state
	movl	$-1, %ecx
	jmp	.L30
.L45:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE58:
	.size	main, .-main
	.local	sorted.0
	.comm	sorted.0,800000,32
	.local	cities.1
	.comm	cities.1,800000,32
	.local	idx.2
	.comm	idx.2,400004,32
	.local	htable.3
	.comm	htable.3,1048576,32
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC3:
	.long	16
	.long	16
	.long	16
	.long	16
	.align 16
.LC4:
	.long	1
	.long	1
	.long	1
	.long	1
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int2(int *a1, int *a2) {
  scanf("%d %d", a1, a2);
  return 0;
}

#define PREF_MAX 100000
#define CITY_MAX 100000

struct city {
    int pref;
    int year;
};

int asc_by_year(const void *a1, const void *a2) {
    struct city *ca1 = (struct city*)a1;
    struct city *ca2 = (struct city*)a2;
    return ca1->year - ca2->year;
}

struct list {
    int num;
    int idx;
    struct list *next;
};

#define HASH_SIZE 65536
struct list *create_htable(void) {
    static struct list htable[HASH_SIZE];
    int i;
    for(i = 0; i < HASH_SIZE; i++) {
        htable[i].next = &htable[i];
    }
    return htable;
}

int get_key(int num) {
    return num & (HASH_SIZE-1);
}

int find_idx(struct list *htable, struct city *c) {
    struct list *head = &htable[get_key(c->year)];
    struct list *elem;
    for(elem = head->next; elem != head; elem = elem->next) {
        if(elem->num == c->year) {
            return elem->idx;
        }
    }
    return -1;
}

void add_elem(struct list *htable, int num, int idx) {
    struct list *elem = malloc(sizeof(struct list));
    struct list *head = &htable[get_key(num)];
    elem->next = head->next;
    elem->num = num;
    elem->idx = idx;
    head->next = elem;
}

void zip(struct list *htable, struct city *cities, int size) {
    qsort(cities, size, sizeof(struct city), asc_by_year);
    int prev = 0;
    int i;
    static int idx[PREF_MAX+1];
    for(i = 0; i <= PREF_MAX; i++) idx[i] = 1;

    for(i = 0; i < size; i++) {
        int y = cities[i].year;
        int pref = cities[i].pref;
        // There are no multiple cities that are established in the same year.
        if(prev == y) continue;
        add_elem(htable, y, idx[pref]);
        prev = y;
        idx[pref]++;
    }
    return;
}

int main(void) {
    int num, cs;
    get_int2(&num, &cs);
    static struct city cities[CITY_MAX];

    int i;
    for(i = 0; i < cs; i++) {
        get_int2(&cities[i].pref, &cities[i].year);
    }
    static struct city sorted[CITY_MAX];
    memcpy(sorted, cities, sizeof(struct city)*cs);

    struct list *htable = create_htable();
    zip(htable, sorted, cs);

    for(i = 0; i < cs; i++) {
        struct city c = cities[i];
        printf("%06d%06d\n", c.pref, find_idx(htable, &c));
    }
    return 0;
}
2 3
1 55
2 77
2 99
 2 3
2 32
2 63
1 12
 2 1
2 55
2 77
2 99
 2 2
2 55
2 77
2 99
 2 3
2 55
2 77
2 195
 2 3
1 32
2 63
1 6
 2 3
2 39
2 16
1 12
 2 2
2 55
2 29
2 195
 2 3
2 96
2 77
2 195
 2 1
1 16
2 77
2 195

000001000001
000002000001
000002000002
 000002000001
000002000002
000001000001
 000002000001
 000002000001
000002000002
 000002000001
000002000002
000002000003
 000001000002
000002000001
000001000001
 000002000002
000002000001
000001000001
 000002000002
000002000001
 000002000002
000002000001
000002000003
 000001000001

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int2(int *a1, int *a2) {
  scanf("%d %d", a1, a2);
  return 0;
}

#define PREF_MAX 100000
#define CITY_MAX 100000

struct city {
    int pref;
    int year;
};

int asc_by_year(const void *a1, const void *a2) {
    struct city *ca1 = (struct city*)a1;
    struct city *ca2 = (struct city*)a2;
    return ca1->year - ca2->year;
}

struct list {
    int num;
    int idx;
    struct list *next;
};

#define HASH_SIZE 65536
struct list *create_htable(void) {
    static struct list htable[HASH_SIZE];
    int i;
    for(i = 0; i < HASH_SIZE; i++) {
        htable[i].next = &htable[i];
    }
    return htable;
}

int get_key(int num) {
    return num & (HASH_SIZE-1);
}

int find_idx(struct list *htable, struct city *c) {
    struct list *head = &htable[get_key(c->year)];
    struct list *elem;
    for(elem = head->next; elem != head; elem = elem->next) {
        if(elem->num == c->year) {
            return elem->idx;
        }
    }
    return -1;
}

void add_elem(struct list *htable, int num, int idx) {
    struct list *elem = malloc(sizeof(struct list));
    struct list *head = &htable[get_key(num)];
    elem->next = head->next;
    elem->num = num;
    elem->idx = idx;
    head->next = elem;
}

void zip(struct list *htable, struct city *cities, int size) {
    qsort(cities, size, sizeof(struct city), asc_by_year);
    int prev = 0;
    int i;
    static int idx[PREF_MAX+1];
    for(i = 0; i <= PREF_MAX; i++) idx[i] = 1;

    for(i = 0; i < size; i++) {
        int y = cities[i].year;
        int pref = cities[i].pref;
        // There are no multiple cities that are established in the same year.
        if(prev == y) continue;
        add_elem(htable, y, idx[pref]);
        prev = y;
        idx[pref]++;
    }
    return;
}

int main(void) {
    int num, cs;
    get_int2(&num, &cs);
    static struct city cities[CITY_MAX];

    int i;
    for(i = 0; i < cs; i++) {
        get_int2(&cities[i].pref, &cities[i].year);
    }
    static struct city sorted[CITY_MAX];
    memcpy(sorted, cities, sizeof(struct city)*cs);

    struct list *htable = create_htable();
    zip(htable, sorted, cs);

    for(i = 0; i < cs; i++) {
        struct city c = cities[i];
        printf("%06d%06d\n", c.pref, find_idx(htable, &c));
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
	.text
	.globl	get_int2
	.type	get_int2, @function
get_int2:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	get_int2, .-get_int2
	.globl	asc_by_year
	.type	asc_by_year, @function
asc_by_year:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movl	4(%rax), %edx
	movq	-8(%rbp), %rax
	movl	4(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	asc_by_year, .-asc_by_year
	.globl	create_htable
	.type	create_htable, @function
create_htable:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L6
.L7:
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	htable.3(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+htable.3(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L6:
	cmpl	$65535, -4(%rbp)
	jle	.L7
	leaq	htable.3(%rip), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	create_htable, .-create_htable
	.globl	get_key
	.type	get_key, @function
get_key:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	movzwl	%ax, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	get_key, .-get_key
	.globl	find_idx
	.type	find_idx, @function
find_idx:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	4(%rax), %eax
	movl	%eax, %edi
	call	get_key
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -16(%rbp)
	jmp	.L12
.L15:
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-32(%rbp), %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jne	.L13
	movq	-16(%rbp), %rax
	movl	4(%rax), %eax
	jmp	.L14
.L13:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -16(%rbp)
.L12:
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jne	.L15
	movl	$-1, %eax
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	find_idx, .-find_idx
	.globl	add_elem
	.type	add_elem, @function
add_elem:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	get_key
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	%rdx, 8(%rax)
	movq	-16(%rbp), %rax
	movl	-28(%rbp), %edx
	movl	%edx, (%rax)
	movq	-16(%rbp), %rax
	movl	-32(%rbp), %edx
	movl	%edx, 4(%rax)
	movq	-8(%rbp), %rax
	movq	-16(%rbp), %rdx
	movq	%rdx, 8(%rax)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	add_elem, .-add_elem
	.globl	zip
	.type	zip, @function
zip:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	%edx, -36(%rbp)
	movl	-36(%rbp), %eax
	movslq	%eax, %rsi
	movq	-32(%rbp), %rax
	leaq	asc_by_year(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L18
.L19:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	idx.2(%rip), %rax
	movl	$1, (%rdx,%rax)
	addl	$1, -12(%rbp)
.L18:
	cmpl	$100000, -12(%rbp)
	jle	.L19
	movl	$0, -12(%rbp)
	jmp	.L20
.L23:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	movl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-16(%rbp), %eax
	cmpl	-8(%rbp), %eax
	je	.L25
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	idx.2(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	add_elem
	movl	-8(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	idx.2(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	idx.2(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L22
.L25:
	nop
.L22:
	addl	$1, -12(%rbp)
.L20:
	movl	-12(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L23
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	zip, .-zip
	.section	.rodata
.LC1:
	.string	"%06d%06d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB13:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	movl	$0, -28(%rbp)
	jmp	.L27
.L28:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	cities.1(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	cities.1(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	addl	$1, -28(%rbp)
.L27:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L28
	movl	-32(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdx
	leaq	cities.1(%rip), %rax
	movq	%rax, %rsi
	leaq	sorted.0(%rip), %rax
	movq	%rax, %rdi
	call	memcpy@PLT
	call	create_htable
	movq	%rax, -24(%rbp)
	movl	-32(%rbp), %edx
	movq	-24(%rbp), %rax
	leaq	sorted.0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	zip
	movl	$0, -28(%rbp)
	jmp	.L29
.L30:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	cities.1(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -16(%rbp)
	leaq	-16(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	find_idx
	movl	%eax, %edx
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -28(%rbp)
.L29:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L30
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	main, .-main
	.local	htable.3
	.comm	htable.3,1048576,32
	.local	idx.2
	.comm	idx.2,400004,32
	.local	cities.1
	.comm	cities.1,800000,32
	.local	sorted.0
	.comm	sorted.0,800000,32
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
	.text
	.globl	get_int2
	.type	get_int2, @function
get_int2:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	get_int2, .-get_int2
	.globl	asc_by_year
	.type	asc_by_year, @function
asc_by_year:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movl	4(%rax), %edx
	movq	-8(%rbp), %rax
	movl	4(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	asc_by_year, .-asc_by_year
	.globl	create_htable
	.type	create_htable, @function
create_htable:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L6
.L7:
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	htable.3(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+htable.3(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L6:
	cmpl	$65535, -4(%rbp)
	jle	.L7
	leaq	htable.3(%rip), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	create_htable, .-create_htable
	.globl	get_key
	.type	get_key, @function
get_key:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	movzwl	%ax, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	get_key, .-get_key
	.globl	find_idx
	.type	find_idx, @function
find_idx:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	4(%rax), %eax
	movl	%eax, %edi
	call	get_key
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -16(%rbp)
	jmp	.L12
.L15:
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-32(%rbp), %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jne	.L13
	movq	-16(%rbp), %rax
	movl	4(%rax), %eax
	jmp	.L14
.L13:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -16(%rbp)
.L12:
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jne	.L15
	movl	$-1, %eax
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	find_idx, .-find_idx
	.globl	add_elem
	.type	add_elem, @function
add_elem:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	get_key
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	%rdx, 8(%rax)
	movq	-16(%rbp), %rax
	movl	-28(%rbp), %edx
	movl	%edx, (%rax)
	movq	-16(%rbp), %rax
	movl	-32(%rbp), %edx
	movl	%edx, 4(%rax)
	movq	-8(%rbp), %rax
	movq	-16(%rbp), %rdx
	movq	%rdx, 8(%rax)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	add_elem, .-add_elem
	.globl	zip
	.type	zip, @function
zip:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	%edx, -36(%rbp)
	movl	-36(%rbp), %eax
	movslq	%eax, %rsi
	movq	-32(%rbp), %rax
	leaq	asc_by_year(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L18
.L19:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	idx.2(%rip), %rax
	movl	$1, (%rdx,%rax)
	addl	$1, -12(%rbp)
.L18:
	cmpl	$100000, -12(%rbp)
	jle	.L19
	movl	$0, -12(%rbp)
	jmp	.L20
.L23:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	movl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-16(%rbp), %eax
	cmpl	-8(%rbp), %eax
	je	.L25
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	idx.2(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	add_elem
	movl	-8(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	idx.2(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	idx.2(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L22
.L25:
	nop
.L22:
	addl	$1, -12(%rbp)
.L20:
	movl	-12(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L23
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	zip, .-zip
	.section	.rodata
.LC1:
	.string	"%06d%06d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB13:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	movl	$0, -28(%rbp)
	jmp	.L27
.L28:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	cities.1(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	cities.1(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	addl	$1, -28(%rbp)
.L27:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L28
	movl	-32(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdx
	leaq	cities.1(%rip), %rax
	movq	%rax, %rsi
	leaq	sorted.0(%rip), %rax
	movq	%rax, %rdi
	call	memcpy@PLT
	call	create_htable
	movq	%rax, -24(%rbp)
	movl	-32(%rbp), %edx
	movq	-24(%rbp), %rax
	leaq	sorted.0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	zip
	movl	$0, -28(%rbp)
	jmp	.L29
.L30:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	cities.1(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -16(%rbp)
	leaq	-16(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	find_idx
	movl	%eax, %edx
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -28(%rbp)
.L29:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L30
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	main, .-main
	.local	htable.3
	.comm	htable.3,1048576,32
	.local	idx.2
	.comm	idx.2,400004,32
	.local	cities.1
	.comm	cities.1,800000,32
	.local	sorted.0
	.comm	sorted.0,800000,32
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
