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>

typedef struct{
  int x;
  int y;
} point;

int smaller(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

int count(point s,point g){
  if((s.x>g.x)&&(s.y>g.y)){
    return count(g,s);
  }
  else if((s.x<g.x)&&(s.y<g.y)){
    int tlt=smaller(g.x-s.x,g.y-s.y);
    point ns={s.x+tlt,s.y+tlt};
    return tlt+count(ns,g);
  }
  else{
    return abs(s.x-g.x)+abs(s.y-g.y);
  }
}

void doit(int w,int h,int n){
  point st;
  point gl;
  int i;
  int ans=0;
  scanf("%d %d",&st.x,&st.y);
  for(i=1;i<n;i++){
    scanf("%d %d",&gl.x,&gl.y);
    ans+=count(st,gl);
    st=gl;
  }
  printf("%d\n",ans);
}

int main(){
  int w,h;
  int n;
  scanf("%d %d %d",&w,&h,&n);
  doit(w,h,n);
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	smaller
	.type	smaller, @function
smaller:
.LFB0:
	.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	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jge	.L2
	movl	-4(%rbp), %eax
	jmp	.L3
.L2:
	movl	-8(%rbp), %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	smaller, .-smaller
	.globl	count
	.type	count, @function
count:
.LFB1:
	.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)
	movl	-24(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-20(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movq	-24(%rbp), %rdx
	movq	-32(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	count
	jmp	.L6
.L5:
	movl	-24(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L7
	movl	-20(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L7
	movl	-28(%rbp), %eax
	movl	-20(%rbp), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	-32(%rbp), %eax
	movl	-24(%rbp), %ecx
	subl	%ecx, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	smaller
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-20(%rbp), %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	count
	movl	-12(%rbp), %edx
	addl	%edx, %eax
	jmp	.L6
.L7:
	movl	-24(%rbp), %eax
	movl	-32(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, %ecx
	movl	-20(%rbp), %eax
	movl	-28(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%ecx, %eax
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	count, .-count
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.text
	.globl	doit
	.type	doit, @function
doit:
.LFB2:
	.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
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	%edx, -44(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -28(%rbp)
	leaq	-24(%rbp), %rax
	leaq	4(%rax), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -32(%rbp)
	jmp	.L9
.L10:
	leaq	-16(%rbp), %rax
	leaq	4(%rax), %rdx
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-16(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	count
	addl	%eax, -28(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, -24(%rbp)
	addl	$1, -32(%rbp)
.L9:
	movl	-32(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L10
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	doit, .-doit
	.section	.rodata
.LC2:
	.string	"%d %d %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.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	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-12(%rbp), %rcx
	leaq	-16(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %ecx
	movl	-20(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	doit
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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	smaller
	.type	smaller, @function
smaller:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	smaller, .-smaller
	.p2align 4
	.globl	count
	.type	count, @function
count:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%rdi, (%rsp)
	movl	(%rsp), %eax
	movq	%rsi, 8(%rsp)
	movl	8(%rsp), %ecx
	movl	4(%rsp), %edx
	movl	12(%rsp), %esi
	cmpl	%eax, %ecx
	jge	.L4
	cmpl	%esi, %edx
	jg	.L23
.L5:
	subl	%ecx, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	subl	%esi, %edx
	movl	%edx, %ecx
	negl	%ecx
	cmovns	%ecx, %edx
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	addl	%edx, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	cmpl	%esi, %edx
	jge	.L5
	cmpl	%eax, %ecx
	jle	.L5
	movl	%esi, %ebx
	movq	(%rsp), %xmm3
	subl	%edx, %ebx
	movl	%ecx, %edx
	subl	%eax, %edx
	cmpl	%edx, %ebx
	cmovg	%edx, %ebx
	movd	%ebx, %xmm2
	pshufd	$0xe0, %xmm2, %xmm0
	paddd	%xmm3, %xmm0
	movd	%xmm0, %edx
	pshufd	$0xe5, %xmm0, %xmm4
	movd	%xmm4, %edi
	cmpl	%ecx, %edx
	jle	.L7
	cmpl	%esi, %edi
	jg	.L24
.L8:
	subl	%ecx, %edx
	movl	%edx, %eax
	negl	%eax
	cmovs	%edx, %eax
	subl	%esi, %edi
	movl	%edi, %ecx
	movl	%edi, %edx
	negl	%ecx
	cmovns	%ecx, %edx
	addl	%edx, %eax
	addl	%ebx, %eax
.L25:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L23:
	.cfi_restore_state
	subl	%esi, %edx
	subl	%ecx, %eax
	movq	8(%rsp), %xmm5
	movq	(%rsp), %rsi
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movd	%eax, %xmm6
	movl	%eax, %ebx
	pshufd	$0xe0, %xmm6, %xmm0
	paddd	%xmm0, %xmm5
	movq	%xmm5, %rdi
	call	count
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	addl	%ebx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	jge	.L8
	cmpl	%esi, %edi
	jge	.L8
	movl	%esi, %eax
	subl	%edx, %ecx
	movq	8(%rsp), %rsi
	subl	%edi, %eax
	cmpl	%ecx, %eax
	cmovle	%eax, %ecx
	movd	%ecx, %xmm7
	movl	%ecx, %ebp
	pshufd	$0xe0, %xmm7, %xmm1
	paddd	%xmm0, %xmm1
	movq	%xmm1, %rdi
	call	count
	addl	%ebp, %eax
	addl	%ebx, %eax
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L24:
	movq	8(%rsp), %rdi
	movq	%xmm0, %rsi
	call	count
	addl	%ebx, %eax
	jmp	.L25
	.cfi_endproc
.LFE24:
	.size	count, .-count
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.text
	.p2align 4
	.globl	doit
	.type	doit, @function
doit:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	movl	%edx, %ebx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	12(%rsp), %rdx
	call	__isoc99_scanf@PLT
	cmpl	$1, %ebx
	jle	.L27
	movl	$1, %r15d
	leaq	16(%rsp), %r14
	leaq	20(%rsp), %r13
	jmp	.L43
	.p2align 4,,10
	.p2align 3
.L103:
	cmpl	%edi, %ecx
	jg	.L102
.L29:
	movl	%edx, %eax
	subl	%esi, %eax
	movl	%eax, %edx
	negl	%edx
	cmovs	%eax, %edx
	movl	%ecx, %eax
	subl	%edi, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	addl	%edx, %eax
.L33:
	addl	%eax, %r12d
	movq	16(%rsp), %rax
	addl	$1, %r15d
	movq	%rax, 8(%rsp)
	cmpl	%r15d, %ebx
	je	.L27
.L43:
	movq	%r13, %rdx
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %xmm0
	movq	16(%rsp), %xmm1
	movd	%xmm0, %edx
	movd	%xmm1, %esi
	pshufd	$0xe5, %xmm0, %xmm3
	pshufd	$0xe5, %xmm1, %xmm4
	movd	%xmm3, %ecx
	movd	%xmm4, %edi
	cmpl	%esi, %edx
	jg	.L103
	jge	.L29
	cmpl	%edi, %ecx
	jge	.L29
	movd	%xmm4, %eax
	subl	%ecx, %eax
	movd	%xmm1, %ecx
	subl	%edx, %ecx
	cmpl	%ecx, %eax
	cmovle	%eax, %ecx
	movd	%ecx, %xmm5
	movl	%ecx, %r8d
	pshufd	$0xe0, %xmm5, %xmm2
	paddd	%xmm2, %xmm0
	movd	%xmm0, %eax
	pshufd	$0xe5, %xmm0, %xmm6
	movd	%xmm6, %edx
	cmpl	%esi, %eax
	jle	.L34
	cmpl	%edi, %edx
	jg	.L104
.L34:
	cmpl	%edi, %edx
	jge	.L36
	cmpl	%esi, %eax
	jl	.L105
.L36:
	subl	%esi, %eax
	movl	%eax, %r9d
	negl	%r9d
	cmovs	%eax, %r9d
	subl	%edi, %edx
	movl	%edx, %eax
	negl	%eax
	cmovs	%edx, %eax
	addl	%eax, %r9d
.L35:
	leal	(%r8,%r9), %eax
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L27:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L106
	addq	$40, %rsp
	.cfi_remember_state
	.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
	.p2align 4,,10
	.p2align 3
.L102:
	.cfi_restore_state
	movd	%xmm0, %eax
	movq	%xmm0, %r9
	subl	%esi, %eax
	movd	%xmm3, %esi
	subl	%edi, %esi
	cmpl	%esi, %eax
	cmovle	%eax, %esi
	movd	%esi, %xmm7
	movl	%esi, %r8d
	pshufd	$0xe0, %xmm7, %xmm2
	paddd	%xmm2, %xmm1
	pshufd	$0xe5, %xmm1, %xmm7
	movd	%xmm7, %eax
	movd	%xmm1, %esi
	cmpl	%eax, %ecx
	jge	.L30
	cmpl	%esi, %edx
	jl	.L107
.L30:
	cmpl	%eax, %ecx
	jle	.L32
	cmpl	%esi, %edx
	jg	.L108
.L32:
	subl	%edx, %esi
	movl	%esi, %edx
	negl	%edx
	cmovs	%esi, %edx
	subl	%ecx, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	addl	%edx, %eax
.L31:
	addl	%r8d, %eax
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L105:
	movl	%edi, %r9d
	subl	%edx, %r9d
	movl	%esi, %edx
	subl	%eax, %edx
	cmpl	%edx, %r9d
	cmovg	%edx, %r9d
	movd	%r9d, %xmm5
	pshufd	$0xe0, %xmm5, %xmm2
	paddd	%xmm2, %xmm0
	pshufd	$0xe5, %xmm0, %xmm6
	movd	%xmm6, %eax
	movd	%xmm0, %edx
	cmpl	%edi, %eax
	jle	.L37
	cmpl	%esi, %edx
	jg	.L109
.L37:
	cmpl	%edi, %eax
	jge	.L39
	cmpl	%esi, %edx
	jge	.L39
	movl	%edi, %r10d
	subl	%eax, %r10d
	movl	%esi, %eax
	subl	%edx, %eax
	cmpl	%eax, %r10d
	cmovg	%eax, %r10d
	movq	%xmm1, %rax
	movd	%r10d, %xmm7
	pshufd	$0xe0, %xmm7, %xmm2
	paddd	%xmm2, %xmm0
	pshufd	$0xe5, %xmm0, %xmm7
	movd	%xmm7, %edx
	movd	%xmm0, %ecx
	cmpl	%edi, %edx
	jle	.L40
	cmpl	%esi, %ecx
	jle	.L40
	movq	%xmm0, %rsi
	movq	%xmm1, %rdi
	call	count
	movl	%eax, %r11d
	jmp	.L41
	.p2align 4,,10
	.p2align 3
.L39:
	subl	%esi, %edx
	movl	%edx, %r10d
	negl	%r10d
	cmovs	%edx, %r10d
	subl	%edi, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%eax, %r10d
.L38:
	addl	%r10d, %r9d
	jmp	.L35
.L40:
	cmpl	%edi, %edx
	jge	.L42
	cmpl	%esi, %ecx
	jl	.L110
.L42:
	subl	%esi, %ecx
	movl	%ecx, %r11d
	negl	%r11d
	cmovs	%ecx, %r11d
	subl	%edi, %edx
	movl	%edx, %eax
	negl	%eax
	cmovs	%edx, %eax
	addl	%eax, %r11d
.L41:
	addl	%r11d, %r10d
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L104:
	subl	%edi, %edx
	subl	%esi, %eax
	movq	%xmm0, %r10
	cmpl	%eax, %edx
	movl	%edx, %r9d
	movq	%r10, %rsi
	cmovg	%eax, %r9d
	movd	%r9d, %xmm7
	pshufd	$0xe0, %xmm7, %xmm0
	paddd	%xmm1, %xmm0
	movq	%xmm0, %rdi
	call	count
	addl	%eax, %r9d
	jmp	.L35
.L109:
	movq	%xmm1, %rdi
	movq	%xmm0, %rsi
	call	count
	movl	%eax, %r10d
	jmp	.L38
.L108:
	subl	%esi, %edx
	subl	%eax, %ecx
	movq	%r9, %rsi
	cmpl	%edx, %ecx
	movl	%ecx, %r10d
	cmovg	%edx, %r10d
	movd	%r10d, %xmm5
	pshufd	$0xe0, %xmm5, %xmm0
	paddd	%xmm1, %xmm0
	movq	%xmm0, %rdi
	call	count
	addl	%r10d, %eax
	jmp	.L31
.L107:
	movq	%xmm1, %rsi
	movq	%xmm0, %rdi
	call	count
	jmp	.L31
.L110:
	subl	%edx, %edi
	subl	%ecx, %esi
	cmpl	%esi, %edi
	movl	%edi, %r11d
	cmovg	%esi, %r11d
	movq	%rax, %rsi
	movd	%r11d, %xmm6
	pshufd	$0xe0, %xmm6, %xmm1
	paddd	%xmm0, %xmm1
	movq	%xmm1, %rdi
	call	count
	addl	%eax, %r11d
	jmp	.L41
.L106:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.size	doit, .-doit
	.section	.rodata.str1.1
.LC2:
	.string	"%d %d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB26:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	leaq	.LC2(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	12(%rsp), %rsi
	leaq	20(%rsp), %rcx
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %edx
	movl	16(%rsp), %esi
	movl	12(%rsp), %edi
	call	doit
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L114
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L114:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE26:
	.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:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	smaller
	.type	smaller, @function
smaller:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	smaller, .-smaller
	.p2align 4
	.globl	count
	.type	count, @function
count:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%rdi, (%rsp)
	movl	(%rsp), %eax
	movq	%rsi, 8(%rsp)
	movl	8(%rsp), %ecx
	movl	4(%rsp), %edx
	movl	12(%rsp), %esi
	cmpl	%eax, %ecx
	jge	.L4
	cmpl	%esi, %edx
	jg	.L23
.L5:
	subl	%ecx, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	subl	%esi, %edx
	movl	%edx, %ecx
	negl	%ecx
	cmovns	%ecx, %edx
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	addl	%edx, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	cmpl	%esi, %edx
	jge	.L5
	cmpl	%eax, %ecx
	jle	.L5
	movl	%esi, %ebx
	movq	(%rsp), %xmm3
	subl	%edx, %ebx
	movl	%ecx, %edx
	subl	%eax, %edx
	cmpl	%edx, %ebx
	cmovg	%edx, %ebx
	movd	%ebx, %xmm2
	pshufd	$0xe0, %xmm2, %xmm0
	paddd	%xmm3, %xmm0
	movd	%xmm0, %edx
	pshufd	$0xe5, %xmm0, %xmm4
	movd	%xmm4, %edi
	cmpl	%ecx, %edx
	jle	.L7
	cmpl	%esi, %edi
	jg	.L24
.L8:
	subl	%ecx, %edx
	movl	%edx, %eax
	negl	%eax
	cmovs	%edx, %eax
	subl	%esi, %edi
	movl	%edi, %ecx
	movl	%edi, %edx
	negl	%ecx
	cmovns	%ecx, %edx
	addl	%edx, %eax
	addl	%ebx, %eax
.L25:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L23:
	.cfi_restore_state
	subl	%esi, %edx
	subl	%ecx, %eax
	movq	8(%rsp), %xmm5
	movq	(%rsp), %rsi
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movd	%eax, %xmm6
	movl	%eax, %ebx
	pshufd	$0xe0, %xmm6, %xmm0
	paddd	%xmm0, %xmm5
	movq	%xmm5, %rdi
	call	count
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	addl	%ebx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	jge	.L8
	cmpl	%esi, %edi
	jge	.L8
	movl	%esi, %eax
	subl	%edx, %ecx
	movq	8(%rsp), %rsi
	subl	%edi, %eax
	cmpl	%ecx, %eax
	cmovle	%eax, %ecx
	movd	%ecx, %xmm7
	movl	%ecx, %ebp
	pshufd	$0xe0, %xmm7, %xmm1
	paddd	%xmm0, %xmm1
	movq	%xmm1, %rdi
	call	count
	addl	%ebp, %eax
	addl	%ebx, %eax
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L24:
	movq	8(%rsp), %rdi
	movq	%xmm0, %rsi
	call	count
	addl	%ebx, %eax
	jmp	.L25
	.cfi_endproc
.LFE24:
	.size	count, .-count
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.text
	.p2align 4
	.globl	doit
	.type	doit, @function
doit:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	movl	%edx, %ebx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	12(%rsp), %rdx
	call	__isoc99_scanf@PLT
	cmpl	$1, %ebx
	jle	.L27
	movl	$1, %r15d
	leaq	16(%rsp), %r14
	leaq	20(%rsp), %r13
	jmp	.L43
	.p2align 4,,10
	.p2align 3
.L103:
	cmpl	%edi, %ecx
	jg	.L102
.L29:
	movl	%edx, %eax
	subl	%esi, %eax
	movl	%eax, %edx
	negl	%edx
	cmovs	%eax, %edx
	movl	%ecx, %eax
	subl	%edi, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	addl	%edx, %eax
.L33:
	addl	%eax, %r12d
	movq	16(%rsp), %rax
	addl	$1, %r15d
	movq	%rax, 8(%rsp)
	cmpl	%r15d, %ebx
	je	.L27
.L43:
	movq	%r13, %rdx
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %xmm0
	movq	16(%rsp), %xmm1
	movd	%xmm0, %edx
	movd	%xmm1, %esi
	pshufd	$0xe5, %xmm0, %xmm3
	pshufd	$0xe5, %xmm1, %xmm4
	movd	%xmm3, %ecx
	movd	%xmm4, %edi
	cmpl	%esi, %edx
	jg	.L103
	jge	.L29
	cmpl	%edi, %ecx
	jge	.L29
	movd	%xmm4, %eax
	subl	%ecx, %eax
	movd	%xmm1, %ecx
	subl	%edx, %ecx
	cmpl	%ecx, %eax
	cmovle	%eax, %ecx
	movd	%ecx, %xmm5
	movl	%ecx, %r8d
	pshufd	$0xe0, %xmm5, %xmm2
	paddd	%xmm2, %xmm0
	movd	%xmm0, %eax
	pshufd	$0xe5, %xmm0, %xmm6
	movd	%xmm6, %edx
	cmpl	%esi, %eax
	jle	.L34
	cmpl	%edi, %edx
	jg	.L104
.L34:
	cmpl	%edi, %edx
	jge	.L36
	cmpl	%esi, %eax
	jl	.L105
.L36:
	subl	%esi, %eax
	movl	%eax, %r9d
	negl	%r9d
	cmovs	%eax, %r9d
	subl	%edi, %edx
	movl	%edx, %eax
	negl	%eax
	cmovs	%edx, %eax
	addl	%eax, %r9d
.L35:
	leal	(%r8,%r9), %eax
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L27:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L106
	addq	$40, %rsp
	.cfi_remember_state
	.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
	.p2align 4,,10
	.p2align 3
.L102:
	.cfi_restore_state
	movd	%xmm0, %eax
	movq	%xmm0, %r9
	subl	%esi, %eax
	movd	%xmm3, %esi
	subl	%edi, %esi
	cmpl	%esi, %eax
	cmovle	%eax, %esi
	movd	%esi, %xmm7
	movl	%esi, %r8d
	pshufd	$0xe0, %xmm7, %xmm2
	paddd	%xmm2, %xmm1
	pshufd	$0xe5, %xmm1, %xmm7
	movd	%xmm7, %eax
	movd	%xmm1, %esi
	cmpl	%eax, %ecx
	jge	.L30
	cmpl	%esi, %edx
	jl	.L107
.L30:
	cmpl	%eax, %ecx
	jle	.L32
	cmpl	%esi, %edx
	jg	.L108
.L32:
	subl	%edx, %esi
	movl	%esi, %edx
	negl	%edx
	cmovs	%esi, %edx
	subl	%ecx, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	addl	%edx, %eax
.L31:
	addl	%r8d, %eax
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L105:
	movl	%edi, %r9d
	subl	%edx, %r9d
	movl	%esi, %edx
	subl	%eax, %edx
	cmpl	%edx, %r9d
	cmovg	%edx, %r9d
	movd	%r9d, %xmm5
	pshufd	$0xe0, %xmm5, %xmm2
	paddd	%xmm2, %xmm0
	pshufd	$0xe5, %xmm0, %xmm6
	movd	%xmm6, %eax
	movd	%xmm0, %edx
	cmpl	%edi, %eax
	jle	.L37
	cmpl	%esi, %edx
	jg	.L109
.L37:
	cmpl	%edi, %eax
	jge	.L39
	cmpl	%esi, %edx
	jge	.L39
	movl	%edi, %r10d
	subl	%eax, %r10d
	movl	%esi, %eax
	subl	%edx, %eax
	cmpl	%eax, %r10d
	cmovg	%eax, %r10d
	movq	%xmm1, %rax
	movd	%r10d, %xmm7
	pshufd	$0xe0, %xmm7, %xmm2
	paddd	%xmm2, %xmm0
	pshufd	$0xe5, %xmm0, %xmm7
	movd	%xmm7, %edx
	movd	%xmm0, %ecx
	cmpl	%edi, %edx
	jle	.L40
	cmpl	%esi, %ecx
	jle	.L40
	movq	%xmm0, %rsi
	movq	%xmm1, %rdi
	call	count
	movl	%eax, %r11d
	jmp	.L41
	.p2align 4,,10
	.p2align 3
.L39:
	subl	%esi, %edx
	movl	%edx, %r10d
	negl	%r10d
	cmovs	%edx, %r10d
	subl	%edi, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%eax, %r10d
.L38:
	addl	%r10d, %r9d
	jmp	.L35
.L40:
	cmpl	%edi, %edx
	jge	.L42
	cmpl	%esi, %ecx
	jl	.L110
.L42:
	subl	%esi, %ecx
	movl	%ecx, %r11d
	negl	%r11d
	cmovs	%ecx, %r11d
	subl	%edi, %edx
	movl	%edx, %eax
	negl	%eax
	cmovs	%edx, %eax
	addl	%eax, %r11d
.L41:
	addl	%r11d, %r10d
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L104:
	subl	%edi, %edx
	subl	%esi, %eax
	movq	%xmm0, %r10
	cmpl	%eax, %edx
	movl	%edx, %r9d
	movq	%r10, %rsi
	cmovg	%eax, %r9d
	movd	%r9d, %xmm7
	pshufd	$0xe0, %xmm7, %xmm0
	paddd	%xmm1, %xmm0
	movq	%xmm0, %rdi
	call	count
	addl	%eax, %r9d
	jmp	.L35
.L109:
	movq	%xmm1, %rdi
	movq	%xmm0, %rsi
	call	count
	movl	%eax, %r10d
	jmp	.L38
.L108:
	subl	%esi, %edx
	subl	%eax, %ecx
	movq	%r9, %rsi
	cmpl	%edx, %ecx
	movl	%ecx, %r10d
	cmovg	%edx, %r10d
	movd	%r10d, %xmm5
	pshufd	$0xe0, %xmm5, %xmm0
	paddd	%xmm1, %xmm0
	movq	%xmm0, %rdi
	call	count
	addl	%r10d, %eax
	jmp	.L31
.L107:
	movq	%xmm1, %rsi
	movq	%xmm0, %rdi
	call	count
	jmp	.L31
.L110:
	subl	%edx, %edi
	subl	%ecx, %esi
	cmpl	%esi, %edi
	movl	%edi, %r11d
	cmovg	%esi, %r11d
	movq	%rax, %rsi
	movd	%r11d, %xmm6
	pshufd	$0xe0, %xmm6, %xmm1
	paddd	%xmm0, %xmm1
	movq	%xmm1, %rdi
	call	count
	addl	%eax, %r11d
	jmp	.L41
.L106:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.size	doit, .-doit
	.section	.rodata.str1.1
.LC2:
	.string	"%d %d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB26:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	leaq	.LC2(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	12(%rsp), %rsi
	leaq	20(%rsp), %rcx
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %edx
	movl	16(%rsp), %esi
	movl	12(%rsp), %edi
	call	doit
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L114
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L114:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE26:
	.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:

#include<stdio.h>

typedef struct{
  int x;
  int y;
} point;

int smaller(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

int count(point s,point g){
  if((s.x>g.x)&&(s.y>g.y)){
    return count(g,s);
  }
  else if((s.x<g.x)&&(s.y<g.y)){
    int tlt=smaller(g.x-s.x,g.y-s.y);
    point ns={s.x+tlt,s.y+tlt};
    return tlt+count(ns,g);
  }
  else{
    return abs(s.x-g.x)+abs(s.y-g.y);
  }
}

void doit(int w,int h,int n){
  point st;
  point gl;
  int i;
  int ans=0;
  scanf("%d %d",&st.x,&st.y);
  for(i=1;i<n;i++){
    scanf("%d %d",&gl.x,&gl.y);
    ans+=count(st,gl);
    st=gl;
  }
  printf("%d\n",ans);
}

int main(){
  int w,h;
  int n;
  scanf("%d %d %d",&w,&h,&n);
  doit(w,h,n);
  return 0;
}
4 3 3
1 1
3 3
4 1

5

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>

typedef struct{
  int x;
  int y;
} point;

int smaller(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

int count(point s,point g){
  if((s.x>g.x)&&(s.y>g.y)){
    return count(g,s);
  }
  else if((s.x<g.x)&&(s.y<g.y)){
    int tlt=smaller(g.x-s.x,g.y-s.y);
    point ns={s.x+tlt,s.y+tlt};
    return tlt+count(ns,g);
  }
  else{
    return abs(s.x-g.x)+abs(s.y-g.y);
  }
}

void doit(int w,int h,int n){
  point st;
  point gl;
  int i;
  int ans=0;
  scanf("%d %d",&st.x,&st.y);
  for(i=1;i<n;i++){
    scanf("%d %d",&gl.x,&gl.y);
    ans+=count(st,gl);
    st=gl;
  }
  printf("%d\n",ans);
}

int main(){
  int w,h;
  int n;
  scanf("%d %d %d",&w,&h,&n);
  doit(w,h,n);
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	smaller
	.type	smaller, @function
smaller:
.LFB0:
	.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	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jge	.L2
	movl	-4(%rbp), %eax
	jmp	.L3
.L2:
	movl	-8(%rbp), %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	smaller, .-smaller
	.globl	count
	.type	count, @function
count:
.LFB1:
	.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)
	movl	-24(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-20(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movq	-24(%rbp), %rdx
	movq	-32(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	count
	jmp	.L6
.L5:
	movl	-24(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L7
	movl	-20(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L7
	movl	-28(%rbp), %eax
	movl	-20(%rbp), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	-32(%rbp), %eax
	movl	-24(%rbp), %ecx
	subl	%ecx, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	smaller
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-20(%rbp), %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	count
	movl	-12(%rbp), %edx
	addl	%edx, %eax
	jmp	.L6
.L7:
	movl	-24(%rbp), %eax
	movl	-32(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, %ecx
	movl	-20(%rbp), %eax
	movl	-28(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%ecx, %eax
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	count, .-count
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.text
	.globl	doit
	.type	doit, @function
doit:
.LFB2:
	.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
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	%edx, -44(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -28(%rbp)
	leaq	-24(%rbp), %rax
	leaq	4(%rax), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -32(%rbp)
	jmp	.L9
.L10:
	leaq	-16(%rbp), %rax
	leaq	4(%rax), %rdx
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-16(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	count
	addl	%eax, -28(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, -24(%rbp)
	addl	$1, -32(%rbp)
.L9:
	movl	-32(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L10
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	doit, .-doit
	.section	.rodata
.LC2:
	.string	"%d %d %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.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	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-12(%rbp), %rcx
	leaq	-16(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %ecx
	movl	-20(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	doit
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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	smaller
	.type	smaller, @function
smaller:
.LFB0:
	.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	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jge	.L2
	movl	-4(%rbp), %eax
	jmp	.L3
.L2:
	movl	-8(%rbp), %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	smaller, .-smaller
	.globl	count
	.type	count, @function
count:
.LFB1:
	.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)
	movl	-24(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-20(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movq	-24(%rbp), %rdx
	movq	-32(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	count
	jmp	.L6
.L5:
	movl	-24(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L7
	movl	-20(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L7
	movl	-28(%rbp), %eax
	movl	-20(%rbp), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	-32(%rbp), %eax
	movl	-24(%rbp), %ecx
	subl	%ecx, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	smaller
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-20(%rbp), %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	count
	movl	-12(%rbp), %edx
	addl	%edx, %eax
	jmp	.L6
.L7:
	movl	-24(%rbp), %eax
	movl	-32(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, %ecx
	movl	-20(%rbp), %eax
	movl	-28(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%ecx, %eax
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	count, .-count
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.text
	.globl	doit
	.type	doit, @function
doit:
.LFB2:
	.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
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	%edx, -44(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -28(%rbp)
	leaq	-24(%rbp), %rax
	leaq	4(%rax), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -32(%rbp)
	jmp	.L9
.L10:
	leaq	-16(%rbp), %rax
	leaq	4(%rax), %rdx
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-16(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	count
	addl	%eax, -28(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, -24(%rbp)
	addl	$1, -32(%rbp)
.L9:
	movl	-32(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L10
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	doit, .-doit
	.section	.rodata
.LC2:
	.string	"%d %d %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.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	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-12(%rbp), %rcx
	leaq	-16(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %ecx
	movl	-20(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	doit
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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:
