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<stdlib.h>
#include<string.h>
#include<math.h>
#define  SIZE 300000
#define max(a,b) ((a>b) ? (a) : (b))

int cmp1(const void *p,const void *q)//昇順
{
    return *(int *)p - *(int *)q;
}

typedef long long int int64;

int tate[SIZE]={0};
int yoko[SIZE]={0};

int tatemax[SIZE]={0};
int yokomax[SIZE]={0};
int tatemaxnum=0;
int yokomaxnum=0;
int bombh[SIZE]={0};
int bombw[SIZE]={0};

int main()
{
    int h,w,m;
    int x,y;
    int i,j,k;
    int hmaxcand=-1;
    int wmaxcand=-1;
    int64 ans=0;
    //printf("a");
    scanf("%d %d %d",&h,&w,&m);
    for(i=0;i<m;i++)
    {
        scanf("%d %d",&x,&y);
        bombh[i]=x-1;
        bombw[i]=y-1;
        tate[x-1]++;
        yoko[y-1]++;
    }
    //printf("b");
    for(i=0;i<h;i++)
    {
        if(hmaxcand<tate[i])
        {
            hmaxcand=tate[i];
            tatemaxnum=0;
            tatemax[tatemaxnum]=i;
            tatemaxnum++;
        }
        else if(hmaxcand==tate[i])
        {
            tatemax[tatemaxnum]=i;
            tatemaxnum++;
        }
    }
    for(j=0;j<w;j++)
    {
        if(wmaxcand<yoko[j])
        {
            wmaxcand=yoko[j];
            yokomaxnum=0;
            yokomax[yokomaxnum]=j;
            yokomaxnum++;
        }
        else if(wmaxcand==yoko[j])
        {
            yokomax[yokomaxnum]=j;
            yokomaxnum++;
        }
    }
    //printf("c");
    //暫定の答え
    ans=(int64)(hmaxcand)+(int64)(wmaxcand);
    //printf("zantei = %lld\n",ans);

    //tatemax,yokomaxをソート
    qsort(tatemax,tatemaxnum,sizeof(int),cmp1);
    qsort(yokomax,yokomaxnum,sizeof(int),cmp1);


    void *result1;
    void *result2;

    int64 flag=0;
    for(i=0;i<m;i++)
    {
        //各爆弾について、tatemax中、yokomax中にあるかにぶたん
        //printf("searching %d %d\n",bombh[i],bombw[i]);
        result1 = bsearch(bombh+i,tatemax,tatemaxnum,sizeof(int),cmp1);
        result2 = bsearch(bombw+i,yokomax,yokomaxnum,sizeof(int),cmp1);
        if(result1!=NULL && result2!=NULL)
        {
            flag++;
        }
    }
    //printf("%lld ",((int64)(hmaxcand)*(int64)(wmaxcand)));
    if(flag==((int64)(tatemaxnum)*(int64)(yokomaxnum)))ans--;

    printf("%lld",ans);
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	cmp1
	.type	cmp1, @function
cmp1:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cmp1, .-cmp1
	.globl	tate
	.bss
	.align 32
	.type	tate, @object
	.size	tate, 1200000
tate:
	.zero	1200000
	.globl	yoko
	.align 32
	.type	yoko, @object
	.size	yoko, 1200000
yoko:
	.zero	1200000
	.globl	tatemax
	.align 32
	.type	tatemax, @object
	.size	tatemax, 1200000
tatemax:
	.zero	1200000
	.globl	yokomax
	.align 32
	.type	yokomax, @object
	.size	yokomax, 1200000
yokomax:
	.zero	1200000
	.globl	tatemaxnum
	.align 4
	.type	tatemaxnum, @object
	.size	tatemaxnum, 4
tatemaxnum:
	.zero	4
	.globl	yokomaxnum
	.align 4
	.type	yokomaxnum, @object
	.size	yokomaxnum, 4
yokomaxnum:
	.zero	4
	.globl	bombh
	.align 32
	.type	bombh, @object
	.size	bombh, 1200000
bombh:
	.zero	1200000
	.globl	bombw
	.align 32
	.type	bombw, @object
	.size	bombw, 1200000
bombw:
	.zero	1200000
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$-1, -48(%rbp)
	movl	$-1, -44(%rbp)
	movq	$0, -40(%rbp)
	leaq	-68(%rbp), %rcx
	leaq	-72(%rbp), %rdx
	leaq	-76(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -56(%rbp)
	jmp	.L4
.L5:
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	bombh(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-60(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	bombw(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-64(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tate(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tate(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-60(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	yoko(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	yoko(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -56(%rbp)
.L4:
	movl	-68(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L5
	movl	$0, -56(%rbp)
	jmp	.L6
.L9:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tate(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -48(%rbp)
	jge	.L7
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tate(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -48(%rbp)
	movl	$0, tatemaxnum(%rip)
	movl	tatemaxnum(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	tatemax(%rip), %rdx
	movl	-56(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	tatemaxnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, tatemaxnum(%rip)
	jmp	.L8
.L7:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tate(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -48(%rbp)
	jne	.L8
	movl	tatemaxnum(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	tatemax(%rip), %rdx
	movl	-56(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	tatemaxnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, tatemaxnum(%rip)
.L8:
	addl	$1, -56(%rbp)
.L6:
	movl	-76(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L9
	movl	$0, -52(%rbp)
	jmp	.L10
.L13:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	yoko(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -44(%rbp)
	jge	.L11
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	yoko(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -44(%rbp)
	movl	$0, yokomaxnum(%rip)
	movl	yokomaxnum(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	yokomax(%rip), %rdx
	movl	-52(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	yokomaxnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, yokomaxnum(%rip)
	jmp	.L12
.L11:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	yoko(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -44(%rbp)
	jne	.L12
	movl	yokomaxnum(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	yokomax(%rip), %rdx
	movl	-52(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	yokomaxnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, yokomaxnum(%rip)
.L12:
	addl	$1, -52(%rbp)
.L10:
	movl	-72(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L13
	movl	-48(%rbp), %eax
	movslq	%eax, %rdx
	movl	-44(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movq	%rax, -40(%rbp)
	movl	tatemaxnum(%rip), %eax
	cltq
	leaq	cmp1(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	tatemax(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	yokomaxnum(%rip), %eax
	cltq
	leaq	cmp1(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	yokomax(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movq	$0, -32(%rbp)
	movl	$0, -56(%rbp)
	jmp	.L14
.L16:
	movl	tatemaxnum(%rip), %eax
	cltq
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	bombh(%rip), %rdx
	leaq	(%rcx,%rdx), %rdi
	leaq	cmp1(%rip), %r8
	movl	$4, %ecx
	movq	%rax, %rdx
	leaq	tatemax(%rip), %rax
	movq	%rax, %rsi
	call	bsearch@PLT
	movq	%rax, -24(%rbp)
	movl	yokomaxnum(%rip), %eax
	cltq
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	bombw(%rip), %rdx
	leaq	(%rcx,%rdx), %rdi
	leaq	cmp1(%rip), %r8
	movl	$4, %ecx
	movq	%rax, %rdx
	leaq	yokomax(%rip), %rax
	movq	%rax, %rsi
	call	bsearch@PLT
	movq	%rax, -16(%rbp)
	cmpq	$0, -24(%rbp)
	je	.L15
	cmpq	$0, -16(%rbp)
	je	.L15
	addq	$1, -32(%rbp)
.L15:
	addl	$1, -56(%rbp)
.L14:
	movl	-68(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L16
	movl	tatemaxnum(%rip), %eax
	movslq	%eax, %rdx
	movl	yokomaxnum(%rip), %eax
	cltq
	imulq	%rdx, %rax
	cmpq	%rax, -32(%rbp)
	jne	.L17
	subq	$1, -40(%rbp)
.L17:
	movq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	main, .-main
	.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	cmp1
	.type	cmp1, @function
cmp1:
.LFB51:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE51:
	.size	cmp1, .-cmp1
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rcx
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L7
	xorl	%ebp, %ebp
	leaq	20(%rsp), %r14
	leaq	16(%rsp), %r13
	leaq	.LC1(%rip), %r12
	leaq	tate(%rip), %rbx
	leaq	yoko(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r14, %rdx
	movq	%r12, %rdi
	movq	%r13, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %eax
	leaq	bombw(%rip), %rdi
	leal	-1(%rax), %edx
	leaq	bombh(%rip), %rax
	movl	%edx, (%rax,%rbp,4)
	movl	20(%rsp), %eax
	movslq	%edx, %rdx
	addl	$1, (%rbx,%rdx,4)
	subl	$1, %eax
	movl	%eax, (%rdi,%rbp,4)
	cltq
	addq	$1, %rbp
	addl	$1, (%r15,%rax,4)
	cmpl	%ebp, 12(%rsp)
	jg	.L4
.L7:
	movl	tatemaxnum(%rip), %r8d
	movslq	4(%rsp), %rdi
	orq	$-1, %rsi
	leaq	tatemax(%rip), %rbp
	movl	%r8d, %r9d
	testl	%edi, %edi
	jle	.L6
	xorl	%eax, %eax
	xorl	%r10d, %r10d
	movq	$-1, %rsi
	leaq	tate(%rip), %rbx
	leaq	tatemax(%rip), %rbp
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L52:
	movl	%eax, 0(%rbp)
	movslq	%edx, %rsi
	movl	$1, %r10d
	movl	$1, %r9d
.L9:
	addq	$1, %rax
	cmpq	%rax, %rdi
	je	.L51
.L10:
	movl	(%rbx,%rax,4), %edx
	cmpl	%esi, %edx
	jg	.L52
	jne	.L9
	movslq	%r9d, %rdx
	movl	$1, %r10d
	addl	$1, %r9d
	movl	%eax, 0(%rbp,%rdx,4)
	addq	$1, %rax
	cmpq	%rax, %rdi
	jne	.L10
.L51:
	testb	%r10b, %r10b
	je	.L6
	movl	%r9d, tatemaxnum(%rip)
	movl	%r9d, %r8d
.L6:
	movslq	8(%rsp), %rdi
	testl	%edi, %edi
	jle	.L32
	movl	yokomaxnum(%rip), %r9d
	xorl	%eax, %eax
	xorl	%r10d, %r10d
	movq	$-1, %rcx
	leaq	yoko(%rip), %r15
	leaq	yokomax(%rip), %rbx
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L54:
	movl	%eax, (%rbx)
	movslq	%edx, %rcx
	movl	$1, %r10d
	movl	$1, %r9d
.L14:
	addq	$1, %rax
	cmpq	%rax, %rdi
	je	.L53
.L15:
	movl	(%r15,%rax,4), %edx
	cmpl	%ecx, %edx
	jg	.L54
	jne	.L14
	movslq	%r9d, %rdx
	movl	$1, %r10d
	addl	$1, %r9d
	movl	%eax, (%rbx,%rdx,4)
	addq	$1, %rax
	cmpq	%rax, %rdi
	jne	.L15
.L53:
	testb	%r10b, %r10b
	je	.L12
	movl	%r9d, yokomaxnum(%rip)
.L12:
	leaq	cmp1(%rip), %r13
	leaq	(%rsi,%rcx), %r12
	movl	$4, %edx
	movslq	%r8d, %rsi
	movq	%r13, %rcx
	movq	%rbp, %rdi
	call	qsort@PLT
	movq	%r13, %rcx
	movl	$4, %edx
	movq	%rbx, %rdi
	movslq	yokomaxnum(%rip), %rsi
	call	qsort@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L17
	leaq	bombw(%rip), %rcx
	leal	-1(%rax), %edx
	movslq	tatemaxnum(%rip), %rdi
	movslq	yokomaxnum(%rip), %r8
	leaq	4(%rcx), %rax
	leaq	bombh(%rip), %rsi
	xorl	%r9d, %r9d
	leaq	(%rax,%rdx,4), %r10
	.p2align 4,,10
	.p2align 3
.L27:
	movq	%rdi, %r13
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L19:
	cmpq	%rdx, %r13
	jbe	.L55
.L21:
	leaq	0(%r13,%rdx), %rax
	shrq	%rax
	leaq	0(%rbp,%rax,4), %r11
	movl	(%r11), %r14d
	cmpl	%r14d, (%rsi)
	js	.L33
	je	.L20
	leaq	1(%rax), %rdx
	cmpq	%rdx, %r13
	ja	.L21
.L55:
	xorl	%r11d, %r11d
.L20:
	movq	%r8, %r13
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L23:
	cmpq	%r13, %rdx
	jnb	.L26
.L25:
	leaq	(%rdx,%r13), %rax
	shrq	%rax
	movl	(%rbx,%rax,4), %r15d
	cmpl	%r15d, (%rcx)
	js	.L34
	je	.L24
	leaq	1(%rax), %rdx
	cmpq	%r13, %rdx
	jb	.L25
.L26:
	addq	$4, %rcx
	addq	$4, %rsi
	cmpq	%r10, %rcx
	jne	.L27
.L28:
	imulq	%r8, %rdi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	cmpq	%r9, %rdi
	movl	$1, %edi
	sete	%al
	subq	%rax, %r12
	xorl	%eax, %eax
	movq	%r12, %rdx
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L56
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	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
	.p2align 4,,10
	.p2align 3
.L33:
	.cfi_restore_state
	movq	%rax, %r13
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L34:
	movq	%rax, %r13
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L24:
	cmpq	$1, %r11
	sbbq	$-1, %r9
	addq	$4, %rcx
	addq	$4, %rsi
	cmpq	%r10, %rcx
	jne	.L27
	jmp	.L28
.L32:
	orq	$-1, %rcx
	leaq	yokomax(%rip), %rbx
	jmp	.L12
.L17:
	movslq	tatemaxnum(%rip), %rdi
	movslq	yokomaxnum(%rip), %r8
	xorl	%r9d, %r9d
	jmp	.L28
.L56:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.size	main, .-main
	.globl	bombw
	.bss
	.align 32
	.type	bombw, @object
	.size	bombw, 1200000
bombw:
	.zero	1200000
	.globl	bombh
	.align 32
	.type	bombh, @object
	.size	bombh, 1200000
bombh:
	.zero	1200000
	.globl	yokomaxnum
	.align 4
	.type	yokomaxnum, @object
	.size	yokomaxnum, 4
yokomaxnum:
	.zero	4
	.globl	tatemaxnum
	.align 4
	.type	tatemaxnum, @object
	.size	tatemaxnum, 4
tatemaxnum:
	.zero	4
	.globl	yokomax
	.align 32
	.type	yokomax, @object
	.size	yokomax, 1200000
yokomax:
	.zero	1200000
	.globl	tatemax
	.align 32
	.type	tatemax, @object
	.size	tatemax, 1200000
tatemax:
	.zero	1200000
	.globl	yoko
	.align 32
	.type	yoko, @object
	.size	yoko, 1200000
yoko:
	.zero	1200000
	.globl	tate
	.align 32
	.type	tate, @object
	.size	tate, 1200000
tate:
	.zero	1200000
	.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	cmp1
	.type	cmp1, @function
cmp1:
.LFB51:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE51:
	.size	cmp1, .-cmp1
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rcx
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L7
	xorl	%ebp, %ebp
	leaq	20(%rsp), %r14
	leaq	16(%rsp), %r13
	leaq	.LC1(%rip), %r12
	leaq	tate(%rip), %rbx
	leaq	yoko(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r14, %rdx
	movq	%r12, %rdi
	movq	%r13, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %eax
	leaq	bombw(%rip), %rdi
	leal	-1(%rax), %edx
	leaq	bombh(%rip), %rax
	movl	%edx, (%rax,%rbp,4)
	movl	20(%rsp), %eax
	movslq	%edx, %rdx
	addl	$1, (%rbx,%rdx,4)
	subl	$1, %eax
	movl	%eax, (%rdi,%rbp,4)
	cltq
	addq	$1, %rbp
	addl	$1, (%r15,%rax,4)
	cmpl	%ebp, 12(%rsp)
	jg	.L4
.L7:
	movl	tatemaxnum(%rip), %r8d
	movslq	4(%rsp), %rdi
	orq	$-1, %rsi
	leaq	tatemax(%rip), %rbp
	movl	%r8d, %r9d
	testl	%edi, %edi
	jle	.L6
	xorl	%eax, %eax
	xorl	%r10d, %r10d
	movq	$-1, %rsi
	leaq	tate(%rip), %rbx
	leaq	tatemax(%rip), %rbp
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L52:
	movl	%eax, 0(%rbp)
	movslq	%edx, %rsi
	movl	$1, %r10d
	movl	$1, %r9d
.L9:
	addq	$1, %rax
	cmpq	%rax, %rdi
	je	.L51
.L10:
	movl	(%rbx,%rax,4), %edx
	cmpl	%esi, %edx
	jg	.L52
	jne	.L9
	movslq	%r9d, %rdx
	movl	$1, %r10d
	addl	$1, %r9d
	movl	%eax, 0(%rbp,%rdx,4)
	addq	$1, %rax
	cmpq	%rax, %rdi
	jne	.L10
.L51:
	testb	%r10b, %r10b
	je	.L6
	movl	%r9d, tatemaxnum(%rip)
	movl	%r9d, %r8d
.L6:
	movslq	8(%rsp), %rdi
	testl	%edi, %edi
	jle	.L32
	movl	yokomaxnum(%rip), %r9d
	xorl	%eax, %eax
	xorl	%r10d, %r10d
	movq	$-1, %rcx
	leaq	yoko(%rip), %r15
	leaq	yokomax(%rip), %rbx
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L54:
	movl	%eax, (%rbx)
	movslq	%edx, %rcx
	movl	$1, %r10d
	movl	$1, %r9d
.L14:
	addq	$1, %rax
	cmpq	%rax, %rdi
	je	.L53
.L15:
	movl	(%r15,%rax,4), %edx
	cmpl	%ecx, %edx
	jg	.L54
	jne	.L14
	movslq	%r9d, %rdx
	movl	$1, %r10d
	addl	$1, %r9d
	movl	%eax, (%rbx,%rdx,4)
	addq	$1, %rax
	cmpq	%rax, %rdi
	jne	.L15
.L53:
	testb	%r10b, %r10b
	je	.L12
	movl	%r9d, yokomaxnum(%rip)
.L12:
	leaq	cmp1(%rip), %r13
	leaq	(%rsi,%rcx), %r12
	movl	$4, %edx
	movslq	%r8d, %rsi
	movq	%r13, %rcx
	movq	%rbp, %rdi
	call	qsort@PLT
	movq	%r13, %rcx
	movl	$4, %edx
	movq	%rbx, %rdi
	movslq	yokomaxnum(%rip), %rsi
	call	qsort@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L17
	leaq	bombw(%rip), %rcx
	leal	-1(%rax), %edx
	movslq	tatemaxnum(%rip), %rdi
	movslq	yokomaxnum(%rip), %r8
	leaq	4(%rcx), %rax
	leaq	bombh(%rip), %rsi
	xorl	%r9d, %r9d
	leaq	(%rax,%rdx,4), %r10
	.p2align 4,,10
	.p2align 3
.L27:
	movq	%rdi, %r13
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L19:
	cmpq	%rdx, %r13
	jbe	.L55
.L21:
	leaq	0(%r13,%rdx), %rax
	shrq	%rax
	leaq	0(%rbp,%rax,4), %r11
	movl	(%r11), %r14d
	cmpl	%r14d, (%rsi)
	js	.L33
	je	.L20
	leaq	1(%rax), %rdx
	cmpq	%rdx, %r13
	ja	.L21
.L55:
	xorl	%r11d, %r11d
.L20:
	movq	%r8, %r13
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L23:
	cmpq	%r13, %rdx
	jnb	.L26
.L25:
	leaq	(%rdx,%r13), %rax
	shrq	%rax
	movl	(%rbx,%rax,4), %r15d
	cmpl	%r15d, (%rcx)
	js	.L34
	je	.L24
	leaq	1(%rax), %rdx
	cmpq	%r13, %rdx
	jb	.L25
.L26:
	addq	$4, %rcx
	addq	$4, %rsi
	cmpq	%r10, %rcx
	jne	.L27
.L28:
	imulq	%r8, %rdi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	cmpq	%r9, %rdi
	movl	$1, %edi
	sete	%al
	subq	%rax, %r12
	xorl	%eax, %eax
	movq	%r12, %rdx
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L56
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	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
	.p2align 4,,10
	.p2align 3
.L33:
	.cfi_restore_state
	movq	%rax, %r13
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L34:
	movq	%rax, %r13
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L24:
	cmpq	$1, %r11
	sbbq	$-1, %r9
	addq	$4, %rcx
	addq	$4, %rsi
	cmpq	%r10, %rcx
	jne	.L27
	jmp	.L28
.L32:
	orq	$-1, %rcx
	leaq	yokomax(%rip), %rbx
	jmp	.L12
.L17:
	movslq	tatemaxnum(%rip), %rdi
	movslq	yokomaxnum(%rip), %r8
	xorl	%r9d, %r9d
	jmp	.L28
.L56:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.size	main, .-main
	.globl	bombw
	.bss
	.align 32
	.type	bombw, @object
	.size	bombw, 1200000
bombw:
	.zero	1200000
	.globl	bombh
	.align 32
	.type	bombh, @object
	.size	bombh, 1200000
bombh:
	.zero	1200000
	.globl	yokomaxnum
	.align 4
	.type	yokomaxnum, @object
	.size	yokomaxnum, 4
yokomaxnum:
	.zero	4
	.globl	tatemaxnum
	.align 4
	.type	tatemaxnum, @object
	.size	tatemaxnum, 4
tatemaxnum:
	.zero	4
	.globl	yokomax
	.align 32
	.type	yokomax, @object
	.size	yokomax, 1200000
yokomax:
	.zero	1200000
	.globl	tatemax
	.align 32
	.type	tatemax, @object
	.size	tatemax, 1200000
tatemax:
	.zero	1200000
	.globl	yoko
	.align 32
	.type	yoko, @object
	.size	yoko, 1200000
yoko:
	.zero	1200000
	.globl	tate
	.align 32
	.type	tate, @object
	.size	tate, 1200000
tate:
	.zero	1200000
	.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<stdlib.h>
#include<string.h>
#include<math.h>
#define  SIZE 300000
#define max(a,b) ((a>b) ? (a) : (b))

int cmp1(const void *p,const void *q)//昇順
{
    return *(int *)p - *(int *)q;
}

typedef long long int int64;

int tate[SIZE]={0};
int yoko[SIZE]={0};

int tatemax[SIZE]={0};
int yokomax[SIZE]={0};
int tatemaxnum=0;
int yokomaxnum=0;
int bombh[SIZE]={0};
int bombw[SIZE]={0};

int main()
{
    int h,w,m;
    int x,y;
    int i,j,k;
    int hmaxcand=-1;
    int wmaxcand=-1;
    int64 ans=0;
    //printf("a");
    scanf("%d %d %d",&h,&w,&m);
    for(i=0;i<m;i++)
    {
        scanf("%d %d",&x,&y);
        bombh[i]=x-1;
        bombw[i]=y-1;
        tate[x-1]++;
        yoko[y-1]++;
    }
    //printf("b");
    for(i=0;i<h;i++)
    {
        if(hmaxcand<tate[i])
        {
            hmaxcand=tate[i];
            tatemaxnum=0;
            tatemax[tatemaxnum]=i;
            tatemaxnum++;
        }
        else if(hmaxcand==tate[i])
        {
            tatemax[tatemaxnum]=i;
            tatemaxnum++;
        }
    }
    for(j=0;j<w;j++)
    {
        if(wmaxcand<yoko[j])
        {
            wmaxcand=yoko[j];
            yokomaxnum=0;
            yokomax[yokomaxnum]=j;
            yokomaxnum++;
        }
        else if(wmaxcand==yoko[j])
        {
            yokomax[yokomaxnum]=j;
            yokomaxnum++;
        }
    }
    //printf("c");
    //暫定の答え
    ans=(int64)(hmaxcand)+(int64)(wmaxcand);
    //printf("zantei = %lld\n",ans);

    //tatemax,yokomaxをソート
    qsort(tatemax,tatemaxnum,sizeof(int),cmp1);
    qsort(yokomax,yokomaxnum,sizeof(int),cmp1);


    void *result1;
    void *result2;

    int64 flag=0;
    for(i=0;i<m;i++)
    {
        //各爆弾について、tatemax中、yokomax中にあるかにぶたん
        //printf("searching %d %d\n",bombh[i],bombw[i]);
        result1 = bsearch(bombh+i,tatemax,tatemaxnum,sizeof(int),cmp1);
        result2 = bsearch(bombw+i,yokomax,yokomaxnum,sizeof(int),cmp1);
        if(result1!=NULL && result2!=NULL)
        {
            flag++;
        }
    }
    //printf("%lld ",((int64)(hmaxcand)*(int64)(wmaxcand)));
    if(flag==((int64)(tatemaxnum)*(int64)(yokomaxnum)))ans--;

    printf("%lld",ans);
}


2 3 3
2 2
1 1
1 2
 5 5 10
2 5
4 5
2 3
5 5
2 2
5 4
5 3
5 1
3 5
1 4
 5 5 10
2 5
4 5
2 3
5 5
2 4
5 4
5 1
1 1
4 5
1 4
 5 5 10
2 5
4 2
2 3
5 5
2 3
5 4
5 1
1 1
4 5
1 4
 6 3 4
1 3
3 1
1 1
1 2
 5 5 10
2 5
4 5
2 1
5 5
2 2
5 4
5 1
5 2
3 5
1 5
 5 5 10
2 5
4 5
2 3
5 5
2 2
5 4
5 1
5 1
3 5
1 4
 5 5 10
2 5
4 5
2 3
5 5
2 4
5 4
5 1
5 1
3 5
1 4
 5 5 10
2 5
4 5
2 3
5 5
2 4
5 4
5 1
5 1
4 5
1 4
 2 3 3
2 1
1 1
1 3

3 7 6 5 4 8 7 7 7 3
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<stdlib.h>
#include<string.h>
#include<math.h>
#define  SIZE 300000
#define max(a,b) ((a>b) ? (a) : (b))

int cmp1(const void *p,const void *q)//昇順
{
    return *(int *)p - *(int *)q;
}

typedef long long int int64;

int tate[SIZE]={0};
int yoko[SIZE]={0};

int tatemax[SIZE]={0};
int yokomax[SIZE]={0};
int tatemaxnum=0;
int yokomaxnum=0;
int bombh[SIZE]={0};
int bombw[SIZE]={0};

int main()
{
    int h,w,m;
    int x,y;
    int i,j,k;
    int hmaxcand=-1;
    int wmaxcand=-1;
    int64 ans=0;
    //printf("a");
    scanf("%d %d %d",&h,&w,&m);
    for(i=0;i<m;i++)
    {
        scanf("%d %d",&x,&y);
        bombh[i]=x-1;
        bombw[i]=y-1;
        tate[x-1]++;
        yoko[y-1]++;
    }
    //printf("b");
    for(i=0;i<h;i++)
    {
        if(hmaxcand<tate[i])
        {
            hmaxcand=tate[i];
            tatemaxnum=0;
            tatemax[tatemaxnum]=i;
            tatemaxnum++;
        }
        else if(hmaxcand==tate[i])
        {
            tatemax[tatemaxnum]=i;
            tatemaxnum++;
        }
    }
    for(j=0;j<w;j++)
    {
        if(wmaxcand<yoko[j])
        {
            wmaxcand=yoko[j];
            yokomaxnum=0;
            yokomax[yokomaxnum]=j;
            yokomaxnum++;
        }
        else if(wmaxcand==yoko[j])
        {
            yokomax[yokomaxnum]=j;
            yokomaxnum++;
        }
    }
    //printf("c");
    //暫定の答え
    ans=(int64)(hmaxcand)+(int64)(wmaxcand);
    //printf("zantei = %lld\n",ans);

    //tatemax,yokomaxをソート
    qsort(tatemax,tatemaxnum,sizeof(int),cmp1);
    qsort(yokomax,yokomaxnum,sizeof(int),cmp1);


    void *result1;
    void *result2;

    int64 flag=0;
    for(i=0;i<m;i++)
    {
        //各爆弾について、tatemax中、yokomax中にあるかにぶたん
        //printf("searching %d %d\n",bombh[i],bombw[i]);
        result1 = bsearch(bombh+i,tatemax,tatemaxnum,sizeof(int),cmp1);
        result2 = bsearch(bombw+i,yokomax,yokomaxnum,sizeof(int),cmp1);
        if(result1!=NULL && result2!=NULL)
        {
            flag++;
        }
    }
    //printf("%lld ",((int64)(hmaxcand)*(int64)(wmaxcand)));
    if(flag==((int64)(tatemaxnum)*(int64)(yokomaxnum)))ans--;

    printf("%lld",ans);
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	cmp1
	.type	cmp1, @function
cmp1:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cmp1, .-cmp1
	.globl	tate
	.bss
	.align 32
	.type	tate, @object
	.size	tate, 1200000
tate:
	.zero	1200000
	.globl	yoko
	.align 32
	.type	yoko, @object
	.size	yoko, 1200000
yoko:
	.zero	1200000
	.globl	tatemax
	.align 32
	.type	tatemax, @object
	.size	tatemax, 1200000
tatemax:
	.zero	1200000
	.globl	yokomax
	.align 32
	.type	yokomax, @object
	.size	yokomax, 1200000
yokomax:
	.zero	1200000
	.globl	tatemaxnum
	.align 4
	.type	tatemaxnum, @object
	.size	tatemaxnum, 4
tatemaxnum:
	.zero	4
	.globl	yokomaxnum
	.align 4
	.type	yokomaxnum, @object
	.size	yokomaxnum, 4
yokomaxnum:
	.zero	4
	.globl	bombh
	.align 32
	.type	bombh, @object
	.size	bombh, 1200000
bombh:
	.zero	1200000
	.globl	bombw
	.align 32
	.type	bombw, @object
	.size	bombw, 1200000
bombw:
	.zero	1200000
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$-1, -48(%rbp)
	movl	$-1, -44(%rbp)
	movq	$0, -40(%rbp)
	leaq	-68(%rbp), %rcx
	leaq	-72(%rbp), %rdx
	leaq	-76(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -56(%rbp)
	jmp	.L4
.L5:
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	bombh(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-60(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	bombw(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-64(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tate(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tate(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-60(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	yoko(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	yoko(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -56(%rbp)
.L4:
	movl	-68(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L5
	movl	$0, -56(%rbp)
	jmp	.L6
.L9:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tate(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -48(%rbp)
	jge	.L7
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tate(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -48(%rbp)
	movl	$0, tatemaxnum(%rip)
	movl	tatemaxnum(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	tatemax(%rip), %rdx
	movl	-56(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	tatemaxnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, tatemaxnum(%rip)
	jmp	.L8
.L7:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tate(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -48(%rbp)
	jne	.L8
	movl	tatemaxnum(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	tatemax(%rip), %rdx
	movl	-56(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	tatemaxnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, tatemaxnum(%rip)
.L8:
	addl	$1, -56(%rbp)
.L6:
	movl	-76(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L9
	movl	$0, -52(%rbp)
	jmp	.L10
.L13:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	yoko(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -44(%rbp)
	jge	.L11
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	yoko(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -44(%rbp)
	movl	$0, yokomaxnum(%rip)
	movl	yokomaxnum(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	yokomax(%rip), %rdx
	movl	-52(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	yokomaxnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, yokomaxnum(%rip)
	jmp	.L12
.L11:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	yoko(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -44(%rbp)
	jne	.L12
	movl	yokomaxnum(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	yokomax(%rip), %rdx
	movl	-52(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	yokomaxnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, yokomaxnum(%rip)
.L12:
	addl	$1, -52(%rbp)
.L10:
	movl	-72(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L13
	movl	-48(%rbp), %eax
	movslq	%eax, %rdx
	movl	-44(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movq	%rax, -40(%rbp)
	movl	tatemaxnum(%rip), %eax
	cltq
	leaq	cmp1(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	tatemax(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	yokomaxnum(%rip), %eax
	cltq
	leaq	cmp1(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	yokomax(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movq	$0, -32(%rbp)
	movl	$0, -56(%rbp)
	jmp	.L14
.L16:
	movl	tatemaxnum(%rip), %eax
	cltq
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	bombh(%rip), %rdx
	leaq	(%rcx,%rdx), %rdi
	leaq	cmp1(%rip), %r8
	movl	$4, %ecx
	movq	%rax, %rdx
	leaq	tatemax(%rip), %rax
	movq	%rax, %rsi
	call	bsearch@PLT
	movq	%rax, -24(%rbp)
	movl	yokomaxnum(%rip), %eax
	cltq
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	bombw(%rip), %rdx
	leaq	(%rcx,%rdx), %rdi
	leaq	cmp1(%rip), %r8
	movl	$4, %ecx
	movq	%rax, %rdx
	leaq	yokomax(%rip), %rax
	movq	%rax, %rsi
	call	bsearch@PLT
	movq	%rax, -16(%rbp)
	cmpq	$0, -24(%rbp)
	je	.L15
	cmpq	$0, -16(%rbp)
	je	.L15
	addq	$1, -32(%rbp)
.L15:
	addl	$1, -56(%rbp)
.L14:
	movl	-68(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L16
	movl	tatemaxnum(%rip), %eax
	movslq	%eax, %rdx
	movl	yokomaxnum(%rip), %eax
	cltq
	imulq	%rdx, %rax
	cmpq	%rax, -32(%rbp)
	jne	.L17
	subq	$1, -40(%rbp)
.L17:
	movq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	main, .-main
	.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
	.globl	cmp1
	.type	cmp1, @function
cmp1:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cmp1, .-cmp1
	.globl	tate
	.bss
	.align 32
	.type	tate, @object
	.size	tate, 1200000
tate:
	.zero	1200000
	.globl	yoko
	.align 32
	.type	yoko, @object
	.size	yoko, 1200000
yoko:
	.zero	1200000
	.globl	tatemax
	.align 32
	.type	tatemax, @object
	.size	tatemax, 1200000
tatemax:
	.zero	1200000
	.globl	yokomax
	.align 32
	.type	yokomax, @object
	.size	yokomax, 1200000
yokomax:
	.zero	1200000
	.globl	tatemaxnum
	.align 4
	.type	tatemaxnum, @object
	.size	tatemaxnum, 4
tatemaxnum:
	.zero	4
	.globl	yokomaxnum
	.align 4
	.type	yokomaxnum, @object
	.size	yokomaxnum, 4
yokomaxnum:
	.zero	4
	.globl	bombh
	.align 32
	.type	bombh, @object
	.size	bombh, 1200000
bombh:
	.zero	1200000
	.globl	bombw
	.align 32
	.type	bombw, @object
	.size	bombw, 1200000
bombw:
	.zero	1200000
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$-1, -48(%rbp)
	movl	$-1, -44(%rbp)
	movq	$0, -40(%rbp)
	leaq	-68(%rbp), %rcx
	leaq	-72(%rbp), %rdx
	leaq	-76(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -56(%rbp)
	jmp	.L4
.L5:
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	bombh(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-60(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	bombw(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-64(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tate(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tate(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-60(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	yoko(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	yoko(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -56(%rbp)
.L4:
	movl	-68(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L5
	movl	$0, -56(%rbp)
	jmp	.L6
.L9:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tate(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -48(%rbp)
	jge	.L7
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tate(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -48(%rbp)
	movl	$0, tatemaxnum(%rip)
	movl	tatemaxnum(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	tatemax(%rip), %rdx
	movl	-56(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	tatemaxnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, tatemaxnum(%rip)
	jmp	.L8
.L7:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tate(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -48(%rbp)
	jne	.L8
	movl	tatemaxnum(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	tatemax(%rip), %rdx
	movl	-56(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	tatemaxnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, tatemaxnum(%rip)
.L8:
	addl	$1, -56(%rbp)
.L6:
	movl	-76(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L9
	movl	$0, -52(%rbp)
	jmp	.L10
.L13:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	yoko(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -44(%rbp)
	jge	.L11
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	yoko(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -44(%rbp)
	movl	$0, yokomaxnum(%rip)
	movl	yokomaxnum(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	yokomax(%rip), %rdx
	movl	-52(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	yokomaxnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, yokomaxnum(%rip)
	jmp	.L12
.L11:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	yoko(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -44(%rbp)
	jne	.L12
	movl	yokomaxnum(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	yokomax(%rip), %rdx
	movl	-52(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	yokomaxnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, yokomaxnum(%rip)
.L12:
	addl	$1, -52(%rbp)
.L10:
	movl	-72(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L13
	movl	-48(%rbp), %eax
	movslq	%eax, %rdx
	movl	-44(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movq	%rax, -40(%rbp)
	movl	tatemaxnum(%rip), %eax
	cltq
	leaq	cmp1(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	tatemax(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	yokomaxnum(%rip), %eax
	cltq
	leaq	cmp1(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	yokomax(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movq	$0, -32(%rbp)
	movl	$0, -56(%rbp)
	jmp	.L14
.L16:
	movl	tatemaxnum(%rip), %eax
	cltq
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	bombh(%rip), %rdx
	leaq	(%rcx,%rdx), %rdi
	leaq	cmp1(%rip), %r8
	movl	$4, %ecx
	movq	%rax, %rdx
	leaq	tatemax(%rip), %rax
	movq	%rax, %rsi
	call	bsearch@PLT
	movq	%rax, -24(%rbp)
	movl	yokomaxnum(%rip), %eax
	cltq
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	bombw(%rip), %rdx
	leaq	(%rcx,%rdx), %rdi
	leaq	cmp1(%rip), %r8
	movl	$4, %ecx
	movq	%rax, %rdx
	leaq	yokomax(%rip), %rax
	movq	%rax, %rsi
	call	bsearch@PLT
	movq	%rax, -16(%rbp)
	cmpq	$0, -24(%rbp)
	je	.L15
	cmpq	$0, -16(%rbp)
	je	.L15
	addq	$1, -32(%rbp)
.L15:
	addl	$1, -56(%rbp)
.L14:
	movl	-68(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L16
	movl	tatemaxnum(%rip), %eax
	movslq	%eax, %rdx
	movl	yokomaxnum(%rip), %eax
	cltq
	imulq	%rdx, %rax
	cmpq	%rax, -32(%rbp)
	jne	.L17
	subq	$1, -40(%rbp)
.L17:
	movq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	main, .-main
	.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:
