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>
#define N_MAX 1000

int w,h;
int n, xy[N_MAX][2];

int sgn(int n){
	if(n<0)
		return -1;
	if(n>0)
		return 1;
	return 0;
}

int abs(int n){
	return(n>0)?n:-n;
}

int difference(int x,int y){
	return abs(x-y);
}

int min(int x,int y){
	return (x<y)?x:y;
}

int path(int x, int y){
	int ans = difference(x,y);
	if(sgn(x)==sgn(y))
		ans += min(abs(x),abs(y));
	return ans;
}

void solve(void){
	int answer = 0;
	int i = 0;
	while(++i < n){
		int
		x = xy[i][0] - xy[i-1][0],
		y = xy[i][1] - xy[i-1][1];
		answer += path(x,y);
	}
	printf("%d\n",answer);
	return;
}

int main(void){
	int i;
	scanf("%d%d%d",&w,&h,&n);
	for(i=0;i<n;i++){
		scanf("%d%d", &xy[i][0], &xy[i][1]);
	}
	solve();
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	w
	.bss
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	xy
	.align 32
	.type	xy, @object
	.size	xy, 8000
xy:
	.zero	8000
	.text
	.globl	sgn
	.type	sgn, @function
sgn:
.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)
	cmpl	$0, -4(%rbp)
	jns	.L2
	movl	$-1, %eax
	jmp	.L3
.L2:
	cmpl	$0, -4(%rbp)
	jle	.L4
	movl	$1, %eax
	jmp	.L3
.L4:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	sgn, .-sgn
	.globl	abs
	.type	abs, @function
abs:
.LFB1:
	.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
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	abs, .-abs
	.globl	difference
	.type	difference, @function
difference:
.LFB2:
	.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
	subl	-8(%rbp), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	difference, .-difference
	.globl	min
	.type	min, @function
min:
.LFB3:
	.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	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	min, .-min
	.globl	path
	.type	path, @function
path:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movl	%edi, -28(%rbp)
	movl	%esi, -32(%rbp)
	movl	-32(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	difference
	movl	%eax, -12(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	sgn
	movl	%eax, %ebx
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	sgn
	cmpl	%eax, %ebx
	jne	.L12
	movl	-32(%rbp), %eax
	movl	%eax, %edx
	negl	%edx
	cmovs	%eax, %edx
	movl	-28(%rbp), %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	addl	%eax, -12(%rbp)
.L12:
	movl	-12(%rbp), %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	path, .-path
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	solve
	.type	solve, @function
solve:
.LFB5:
	.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
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L15
.L16:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	xy(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	xy(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+xy(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+xy(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	path
	addl	%eax, -16(%rbp)
.L15:
	addl	$1, -12(%rbp)
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L16
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	solve, .-solve
	.section	.rodata
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.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
	leaq	n(%rip), %rax
	movq	%rax, %rcx
	leaq	h(%rip), %rax
	movq	%rax, %rdx
	leaq	w(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4(%rbp)
	jmp	.L19
.L20:
	movl	-4(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	4(%rax), %rdx
	leaq	xy(%rip), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	xy(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4(%rbp)
.L19:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L20
	call	solve
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	sgn
	.type	sgn, @function
sgn:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	testl	%edi, %edi
	movl	$-1, %edx
	setne	%al
	cmovs	%edx, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	sgn, .-sgn
	.p2align 4
	.globl	abs
	.type	abs, @function
abs:
.LFB24:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	negl	%eax
	cmovs	%edi, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	abs, .-abs
	.p2align 4
	.globl	difference
	.type	difference, @function
difference:
.LFB25:
	.cfi_startproc
	endbr64
	subl	%esi, %edi
	movl	%edi, %eax
	negl	%eax
	cmovs	%edi, %eax
	ret
	.cfi_endproc
.LFE25:
	.size	difference, .-difference
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB26:
	.cfi_startproc
	endbr64
	cmpl	%edi, %esi
	movl	%edi, %eax
	cmovle	%esi, %eax
	ret
	.cfi_endproc
.LFE26:
	.size	min, .-min
	.p2align 4
	.globl	path
	.type	path, @function
path:
.LFB27:
	.cfi_startproc
	endbr64
	movl	%edi, %edx
	subl	%esi, %edx
	movl	%edx, %eax
	negl	%eax
	cmovs	%edx, %eax
	testl	%edi, %edi
	js	.L9
	testl	%esi, %esi
	js	.L8
	testl	%edi, %edi
	setne	%cl
	testl	%esi, %esi
	setne	%dl
	cmpb	%dl, %cl
	je	.L11
.L8:
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	testl	%esi, %esi
	jns	.L8
.L11:
	movl	%esi, %edx
	movl	%edi, %ecx
	negl	%edx
	cmovs	%esi, %edx
	negl	%ecx
	cmovs	%edi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	addl	%edx, %eax
	ret
	.cfi_endproc
.LFE27:
	.size	path, .-path
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d\n"
	.text
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB28:
	.cfi_startproc
	endbr64
	movl	n(%rip), %edi
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	cmpl	$1, %edi
	jle	.L29
	leal	-2(%rdi), %eax
	leal	-1(%rdi), %ecx
	cmpl	$2, %eax
	jbe	.L30
	movl	%ecx, %edx
	pxor	%xmm5, %xmm5
	pcmpeqd	%xmm7, %xmm7
	movdqa	.LC0(%rip), %xmm6
	shrl	$2, %edx
	leaq	8+xy(%rip), %rax
	movdqa	%xmm5, %xmm4
	subl	$1, %edx
	leaq	32(%rax), %rsi
	salq	$5, %rdx
	addq	%rsi, %rdx
	.p2align 4,,10
	.p2align 3
.L15:
	movdqu	(%rax), %xmm1
	movdqa	-8(%rax), %xmm0
	movdqa	%xmm4, %xmm9
	addq	$32, %rax
	movdqu	-16(%rax), %xmm3
	movdqa	%xmm1, %xmm2
	shufps	$136, %xmm3, %xmm2
	movdqa	%xmm0, %xmm3
	shufps	$136, -24(%rax), %xmm3
	psubd	%xmm3, %xmm2
	movdqu	-16(%rax), %xmm3
	movdqa	%xmm2, %xmm8
	shufps	$221, -24(%rax), %xmm0
	movdqa	%xmm8, %xmm11
	shufps	$221, %xmm3, %xmm1
	movdqa	%xmm2, %xmm3
	movdqa	%xmm4, %xmm2
	psubd	%xmm0, %xmm1
	pcmpgtd	%xmm8, %xmm2
	pcmpgtd	%xmm1, %xmm9
	psubd	%xmm1, %xmm3
	pcmpeqd	%xmm4, %xmm11
	movdqa	%xmm3, %xmm0
	psrad	$31, %xmm0
	movdqa	%xmm2, %xmm10
	pcmpeqd	%xmm4, %xmm2
	pxor	%xmm0, %xmm3
	pand	%xmm9, %xmm10
	pcmpeqd	%xmm4, %xmm9
	pandn	%xmm6, %xmm11
	psubd	%xmm0, %xmm3
	pand	%xmm9, %xmm2
	pand	%xmm2, %xmm11
	movdqa	%xmm2, %xmm0
	movdqa	%xmm1, %xmm2
	pcmpeqd	%xmm4, %xmm2
	pandn	%xmm7, %xmm0
	por	%xmm11, %xmm0
	pandn	%xmm6, %xmm2
	pcmpeqd	%xmm2, %xmm0
	movdqa	%xmm1, %xmm2
	psrad	$31, %xmm2
	pxor	%xmm2, %xmm1
	pand	%xmm9, %xmm0
	movdqa	%xmm8, %xmm9
	psubd	%xmm2, %xmm1
	psrad	$31, %xmm9
	movdqa	%xmm8, %xmm2
	movdqa	%xmm1, %xmm8
	pxor	%xmm9, %xmm2
	por	%xmm10, %xmm0
	psubd	%xmm9, %xmm2
	pcmpgtd	%xmm2, %xmm8
	pand	%xmm8, %xmm2
	pandn	%xmm1, %xmm8
	por	%xmm2, %xmm8
	paddd	%xmm3, %xmm8
	pand	%xmm0, %xmm8
	pandn	%xmm3, %xmm0
	por	%xmm8, %xmm0
	paddd	%xmm0, %xmm5
	cmpq	%rax, %rdx
	jne	.L15
	movdqa	%xmm5, %xmm0
	movl	%ecx, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	paddd	%xmm0, %xmm5
	leal	1(%rsi), %eax
	movdqa	%xmm5, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm5
	movd	%xmm5, %edx
	cmpl	%esi, %ecx
	je	.L13
.L14:
	leaq	xy(%rip), %rcx
	movslq	%eax, %r8
	movslq	%esi, %rsi
	movl	(%rcx,%r8,8), %r10d
	movl	4(%rcx,%r8,8), %r9d
	movl	%r10d, %ebx
	subl	(%rcx,%rsi,8), %ebx
	movl	%r9d, %r11d
	subl	4(%rcx,%rsi,8), %r11d
	movl	%ebx, %r8d
	subl	%r11d, %r8d
	movl	%r8d, %esi
	negl	%esi
	cmovs	%r8d, %esi
	testl	%ebx, %ebx
	js	.L35
	testl	%r11d, %r11d
	js	.L20
	testl	%ebx, %ebx
	setne	%bpl
	testl	%r11d, %r11d
	setne	%r8b
	cmpb	%r8b, %bpl
	je	.L19
.L20:
	addl	%esi, %edx
	leal	1(%rax), %esi
	cmpl	%edi, %esi
	jge	.L13
	movslq	%esi, %rsi
	movl	(%rcx,%rsi,8), %r11d
	movl	%r11d, %ebx
	subl	%r10d, %ebx
	movl	4(%rcx,%rsi,8), %r10d
	movl	%r10d, %r8d
	subl	%r9d, %r8d
	movl	%ebx, %r9d
	subl	%r8d, %r9d
	movl	%r9d, %esi
	negl	%esi
	cmovs	%r9d, %esi
	testl	%ebx, %ebx
	js	.L36
	testl	%r8d, %r8d
	js	.L23
	testl	%ebx, %ebx
	setne	%bpl
	testl	%r8d, %r8d
	setne	%r9b
	cmpb	%r9b, %bpl
	je	.L22
.L23:
	addl	$2, %eax
	addl	%esi, %edx
	cmpl	%eax, %edi
	jle	.L13
	cltq
	movl	(%rcx,%rax,8), %esi
	movl	4(%rcx,%rax,8), %eax
	subl	%r11d, %esi
	subl	%r10d, %eax
	movl	%esi, %edi
	subl	%eax, %edi
	movl	%edi, %ecx
	negl	%ecx
	cmovs	%edi, %ecx
	testl	%esi, %esi
	js	.L37
	testl	%eax, %eax
	js	.L26
	setne	%r8b
	testl	%esi, %esi
	setne	%dil
	cmpb	%dil, %r8b
	je	.L28
.L26:
	addl	%ecx, %edx
.L13:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
	.p2align 4,,10
	.p2align 3
.L35:
	.cfi_restore_state
	testl	%r11d, %r11d
	jns	.L20
.L19:
	movl	%ebx, %r8d
	negl	%r8d
	cmovs	%ebx, %r8d
	movl	%r11d, %ebx
	negl	%ebx
	cmovns	%ebx, %r11d
	cmpl	%r11d, %r8d
	cmovg	%r11d, %r8d
	addl	%r8d, %esi
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L36:
	testl	%r8d, %r8d
	jns	.L23
.L22:
	movl	%r8d, %r9d
	negl	%r9d
	cmovns	%r9d, %r8d
	movl	%ebx, %r9d
	negl	%r9d
	cmovs	%ebx, %r9d
	cmpl	%r9d, %r8d
	cmovg	%r9d, %r8d
	addl	%r8d, %esi
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L37:
	testl	%eax, %eax
	jns	.L26
.L28:
	movl	%eax, %edi
	negl	%edi
	cmovns	%edi, %eax
	movl	%esi, %edi
	negl	%edi
	cmovns	%edi, %esi
	cmpl	%esi, %eax
	cmovg	%esi, %eax
	addl	%eax, %ecx
	addl	%ecx, %edx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L29:
	xorl	%edx, %edx
	jmp	.L13
.L30:
	movl	$1, %eax
	xorl	%esi, %esi
	xorl	%edx, %edx
	jmp	.L14
	.cfi_endproc
.LFE28:
	.size	solve, .-solve
	.section	.rodata.str1.1
.LC2:
	.string	"%d%d%d"
.LC3:
	.string	"%d%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB29:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	n(%rip), %rcx
	xorl	%eax, %eax
	leaq	h(%rip), %rdx
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	w(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L41
	leaq	xy(%rip), %rbx
	xorl	%ebp, %ebp
	leaq	.LC3(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L40:
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	addl	$1, %ebp
	addq	$8, %rbx
	cmpl	%ebp, n(%rip)
	jg	.L40
.L41:
	call	solve
	popq	%rbx
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE29:
	.size	main, .-main
	.globl	xy
	.bss
	.align 32
	.type	xy, @object
	.size	xy, 8000
xy:
	.zero	8000
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.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	sgn
	.type	sgn, @function
sgn:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	testl	%edi, %edi
	movl	$-1, %edx
	setne	%al
	cmovs	%edx, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	sgn, .-sgn
	.p2align 4
	.globl	abs
	.type	abs, @function
abs:
.LFB24:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	negl	%eax
	cmovs	%edi, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	abs, .-abs
	.p2align 4
	.globl	difference
	.type	difference, @function
difference:
.LFB25:
	.cfi_startproc
	endbr64
	subl	%esi, %edi
	movl	%edi, %eax
	negl	%eax
	cmovs	%edi, %eax
	ret
	.cfi_endproc
.LFE25:
	.size	difference, .-difference
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB26:
	.cfi_startproc
	endbr64
	cmpl	%edi, %esi
	movl	%edi, %eax
	cmovle	%esi, %eax
	ret
	.cfi_endproc
.LFE26:
	.size	min, .-min
	.p2align 4
	.globl	path
	.type	path, @function
path:
.LFB27:
	.cfi_startproc
	endbr64
	movl	%edi, %edx
	subl	%esi, %edx
	movl	%edx, %eax
	negl	%eax
	cmovs	%edx, %eax
	testl	%edi, %edi
	js	.L9
	testl	%esi, %esi
	js	.L8
	testl	%edi, %edi
	setne	%cl
	testl	%esi, %esi
	setne	%dl
	cmpb	%dl, %cl
	je	.L11
.L8:
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	testl	%esi, %esi
	jns	.L8
.L11:
	movl	%esi, %edx
	movl	%edi, %ecx
	negl	%edx
	cmovs	%esi, %edx
	negl	%ecx
	cmovs	%edi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	addl	%edx, %eax
	ret
	.cfi_endproc
.LFE27:
	.size	path, .-path
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d\n"
	.text
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB28:
	.cfi_startproc
	endbr64
	movl	n(%rip), %edi
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	cmpl	$1, %edi
	jle	.L29
	leal	-2(%rdi), %eax
	leal	-1(%rdi), %ecx
	cmpl	$2, %eax
	jbe	.L30
	movl	%ecx, %edx
	pxor	%xmm5, %xmm5
	pcmpeqd	%xmm7, %xmm7
	movdqa	.LC0(%rip), %xmm6
	shrl	$2, %edx
	leaq	8+xy(%rip), %rax
	movdqa	%xmm5, %xmm4
	subl	$1, %edx
	leaq	32(%rax), %rsi
	salq	$5, %rdx
	addq	%rsi, %rdx
	.p2align 4,,10
	.p2align 3
.L15:
	movdqu	(%rax), %xmm1
	movdqa	-8(%rax), %xmm0
	movdqa	%xmm4, %xmm9
	addq	$32, %rax
	movdqu	-16(%rax), %xmm3
	movdqa	%xmm1, %xmm2
	shufps	$136, %xmm3, %xmm2
	movdqa	%xmm0, %xmm3
	shufps	$136, -24(%rax), %xmm3
	psubd	%xmm3, %xmm2
	movdqu	-16(%rax), %xmm3
	movdqa	%xmm2, %xmm8
	shufps	$221, -24(%rax), %xmm0
	movdqa	%xmm8, %xmm11
	shufps	$221, %xmm3, %xmm1
	movdqa	%xmm2, %xmm3
	movdqa	%xmm4, %xmm2
	psubd	%xmm0, %xmm1
	pcmpgtd	%xmm8, %xmm2
	pcmpgtd	%xmm1, %xmm9
	psubd	%xmm1, %xmm3
	pcmpeqd	%xmm4, %xmm11
	movdqa	%xmm3, %xmm0
	psrad	$31, %xmm0
	movdqa	%xmm2, %xmm10
	pcmpeqd	%xmm4, %xmm2
	pxor	%xmm0, %xmm3
	pand	%xmm9, %xmm10
	pcmpeqd	%xmm4, %xmm9
	pandn	%xmm6, %xmm11
	psubd	%xmm0, %xmm3
	pand	%xmm9, %xmm2
	pand	%xmm2, %xmm11
	movdqa	%xmm2, %xmm0
	movdqa	%xmm1, %xmm2
	pcmpeqd	%xmm4, %xmm2
	pandn	%xmm7, %xmm0
	por	%xmm11, %xmm0
	pandn	%xmm6, %xmm2
	pcmpeqd	%xmm2, %xmm0
	movdqa	%xmm1, %xmm2
	psrad	$31, %xmm2
	pxor	%xmm2, %xmm1
	pand	%xmm9, %xmm0
	movdqa	%xmm8, %xmm9
	psubd	%xmm2, %xmm1
	psrad	$31, %xmm9
	movdqa	%xmm8, %xmm2
	movdqa	%xmm1, %xmm8
	pxor	%xmm9, %xmm2
	por	%xmm10, %xmm0
	psubd	%xmm9, %xmm2
	pcmpgtd	%xmm2, %xmm8
	pand	%xmm8, %xmm2
	pandn	%xmm1, %xmm8
	por	%xmm2, %xmm8
	paddd	%xmm3, %xmm8
	pand	%xmm0, %xmm8
	pandn	%xmm3, %xmm0
	por	%xmm8, %xmm0
	paddd	%xmm0, %xmm5
	cmpq	%rax, %rdx
	jne	.L15
	movdqa	%xmm5, %xmm0
	movl	%ecx, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	paddd	%xmm0, %xmm5
	leal	1(%rsi), %eax
	movdqa	%xmm5, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm5
	movd	%xmm5, %edx
	cmpl	%esi, %ecx
	je	.L13
.L14:
	leaq	xy(%rip), %rcx
	movslq	%eax, %r8
	movslq	%esi, %rsi
	movl	(%rcx,%r8,8), %r10d
	movl	4(%rcx,%r8,8), %r9d
	movl	%r10d, %ebx
	subl	(%rcx,%rsi,8), %ebx
	movl	%r9d, %r11d
	subl	4(%rcx,%rsi,8), %r11d
	movl	%ebx, %r8d
	subl	%r11d, %r8d
	movl	%r8d, %esi
	negl	%esi
	cmovs	%r8d, %esi
	testl	%ebx, %ebx
	js	.L35
	testl	%r11d, %r11d
	js	.L20
	testl	%ebx, %ebx
	setne	%bpl
	testl	%r11d, %r11d
	setne	%r8b
	cmpb	%r8b, %bpl
	je	.L19
.L20:
	addl	%esi, %edx
	leal	1(%rax), %esi
	cmpl	%edi, %esi
	jge	.L13
	movslq	%esi, %rsi
	movl	(%rcx,%rsi,8), %r11d
	movl	%r11d, %ebx
	subl	%r10d, %ebx
	movl	4(%rcx,%rsi,8), %r10d
	movl	%r10d, %r8d
	subl	%r9d, %r8d
	movl	%ebx, %r9d
	subl	%r8d, %r9d
	movl	%r9d, %esi
	negl	%esi
	cmovs	%r9d, %esi
	testl	%ebx, %ebx
	js	.L36
	testl	%r8d, %r8d
	js	.L23
	testl	%ebx, %ebx
	setne	%bpl
	testl	%r8d, %r8d
	setne	%r9b
	cmpb	%r9b, %bpl
	je	.L22
.L23:
	addl	$2, %eax
	addl	%esi, %edx
	cmpl	%eax, %edi
	jle	.L13
	cltq
	movl	(%rcx,%rax,8), %esi
	movl	4(%rcx,%rax,8), %eax
	subl	%r11d, %esi
	subl	%r10d, %eax
	movl	%esi, %edi
	subl	%eax, %edi
	movl	%edi, %ecx
	negl	%ecx
	cmovs	%edi, %ecx
	testl	%esi, %esi
	js	.L37
	testl	%eax, %eax
	js	.L26
	setne	%r8b
	testl	%esi, %esi
	setne	%dil
	cmpb	%dil, %r8b
	je	.L28
.L26:
	addl	%ecx, %edx
.L13:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
	.p2align 4,,10
	.p2align 3
.L35:
	.cfi_restore_state
	testl	%r11d, %r11d
	jns	.L20
.L19:
	movl	%ebx, %r8d
	negl	%r8d
	cmovs	%ebx, %r8d
	movl	%r11d, %ebx
	negl	%ebx
	cmovns	%ebx, %r11d
	cmpl	%r11d, %r8d
	cmovg	%r11d, %r8d
	addl	%r8d, %esi
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L36:
	testl	%r8d, %r8d
	jns	.L23
.L22:
	movl	%r8d, %r9d
	negl	%r9d
	cmovns	%r9d, %r8d
	movl	%ebx, %r9d
	negl	%r9d
	cmovs	%ebx, %r9d
	cmpl	%r9d, %r8d
	cmovg	%r9d, %r8d
	addl	%r8d, %esi
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L37:
	testl	%eax, %eax
	jns	.L26
.L28:
	movl	%eax, %edi
	negl	%edi
	cmovns	%edi, %eax
	movl	%esi, %edi
	negl	%edi
	cmovns	%edi, %esi
	cmpl	%esi, %eax
	cmovg	%esi, %eax
	addl	%eax, %ecx
	addl	%ecx, %edx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L29:
	xorl	%edx, %edx
	jmp	.L13
.L30:
	movl	$1, %eax
	xorl	%esi, %esi
	xorl	%edx, %edx
	jmp	.L14
	.cfi_endproc
.LFE28:
	.size	solve, .-solve
	.section	.rodata.str1.1
.LC2:
	.string	"%d%d%d"
.LC3:
	.string	"%d%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB29:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	n(%rip), %rcx
	xorl	%eax, %eax
	leaq	h(%rip), %rdx
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	w(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L41
	leaq	xy(%rip), %rbx
	xorl	%ebp, %ebp
	leaq	.LC3(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L40:
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	addl	$1, %ebp
	addq	$8, %rbx
	cmpl	%ebp, n(%rip)
	jg	.L40
.L41:
	call	solve
	popq	%rbx
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE29:
	.size	main, .-main
	.globl	xy
	.bss
	.align 32
	.type	xy, @object
	.size	xy, 8000
xy:
	.zero	8000
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.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>
#define N_MAX 1000

int w,h;
int n, xy[N_MAX][2];

int sgn(int n){
	if(n<0)
		return -1;
	if(n>0)
		return 1;
	return 0;
}

int abs(int n){
	return(n>0)?n:-n;
}

int difference(int x,int y){
	return abs(x-y);
}

int min(int x,int y){
	return (x<y)?x:y;
}

int path(int x, int y){
	int ans = difference(x,y);
	if(sgn(x)==sgn(y))
		ans += min(abs(x),abs(y));
	return ans;
}

void solve(void){
	int answer = 0;
	int i = 0;
	while(++i < n){
		int
		x = xy[i][0] - xy[i-1][0],
		y = xy[i][1] - xy[i-1][1];
		answer += path(x,y);
	}
	printf("%d\n",answer);
	return;
}

int main(void){
	int i;
	scanf("%d%d%d",&w,&h,&n);
	for(i=0;i<n;i++){
		scanf("%d%d", &xy[i][0], &xy[i][1]);
	}
	solve();
	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>
#define N_MAX 1000

int w,h;
int n, xy[N_MAX][2];

int sgn(int n){
	if(n<0)
		return -1;
	if(n>0)
		return 1;
	return 0;
}

int abs(int n){
	return(n>0)?n:-n;
}

int difference(int x,int y){
	return abs(x-y);
}

int min(int x,int y){
	return (x<y)?x:y;
}

int path(int x, int y){
	int ans = difference(x,y);
	if(sgn(x)==sgn(y))
		ans += min(abs(x),abs(y));
	return ans;
}

void solve(void){
	int answer = 0;
	int i = 0;
	while(++i < n){
		int
		x = xy[i][0] - xy[i-1][0],
		y = xy[i][1] - xy[i-1][1];
		answer += path(x,y);
	}
	printf("%d\n",answer);
	return;
}

int main(void){
	int i;
	scanf("%d%d%d",&w,&h,&n);
	for(i=0;i<n;i++){
		scanf("%d%d", &xy[i][0], &xy[i][1]);
	}
	solve();
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	w
	.bss
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	xy
	.align 32
	.type	xy, @object
	.size	xy, 8000
xy:
	.zero	8000
	.text
	.globl	sgn
	.type	sgn, @function
sgn:
.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)
	cmpl	$0, -4(%rbp)
	jns	.L2
	movl	$-1, %eax
	jmp	.L3
.L2:
	cmpl	$0, -4(%rbp)
	jle	.L4
	movl	$1, %eax
	jmp	.L3
.L4:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	sgn, .-sgn
	.globl	abs
	.type	abs, @function
abs:
.LFB1:
	.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
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	abs, .-abs
	.globl	difference
	.type	difference, @function
difference:
.LFB2:
	.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
	subl	-8(%rbp), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	difference, .-difference
	.globl	min
	.type	min, @function
min:
.LFB3:
	.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	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	min, .-min
	.globl	path
	.type	path, @function
path:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movl	%edi, -28(%rbp)
	movl	%esi, -32(%rbp)
	movl	-32(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	difference
	movl	%eax, -12(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	sgn
	movl	%eax, %ebx
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	sgn
	cmpl	%eax, %ebx
	jne	.L12
	movl	-32(%rbp), %eax
	movl	%eax, %edx
	negl	%edx
	cmovs	%eax, %edx
	movl	-28(%rbp), %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	addl	%eax, -12(%rbp)
.L12:
	movl	-12(%rbp), %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	path, .-path
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	solve
	.type	solve, @function
solve:
.LFB5:
	.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
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L15
.L16:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	xy(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	xy(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+xy(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+xy(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	path
	addl	%eax, -16(%rbp)
.L15:
	addl	$1, -12(%rbp)
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L16
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	solve, .-solve
	.section	.rodata
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.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
	leaq	n(%rip), %rax
	movq	%rax, %rcx
	leaq	h(%rip), %rax
	movq	%rax, %rdx
	leaq	w(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4(%rbp)
	jmp	.L19
.L20:
	movl	-4(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	4(%rax), %rdx
	leaq	xy(%rip), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	xy(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4(%rbp)
.L19:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L20
	call	solve
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	w
	.bss
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	xy
	.align 32
	.type	xy, @object
	.size	xy, 8000
xy:
	.zero	8000
	.text
	.globl	sgn
	.type	sgn, @function
sgn:
.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)
	cmpl	$0, -4(%rbp)
	jns	.L2
	movl	$-1, %eax
	jmp	.L3
.L2:
	cmpl	$0, -4(%rbp)
	jle	.L4
	movl	$1, %eax
	jmp	.L3
.L4:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	sgn, .-sgn
	.globl	abs
	.type	abs, @function
abs:
.LFB1:
	.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
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	abs, .-abs
	.globl	difference
	.type	difference, @function
difference:
.LFB2:
	.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
	subl	-8(%rbp), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	difference, .-difference
	.globl	min
	.type	min, @function
min:
.LFB3:
	.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	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	min, .-min
	.globl	path
	.type	path, @function
path:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movl	%edi, -28(%rbp)
	movl	%esi, -32(%rbp)
	movl	-32(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	difference
	movl	%eax, -12(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	sgn
	movl	%eax, %ebx
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	sgn
	cmpl	%eax, %ebx
	jne	.L12
	movl	-32(%rbp), %eax
	movl	%eax, %edx
	negl	%edx
	cmovs	%eax, %edx
	movl	-28(%rbp), %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	addl	%eax, -12(%rbp)
.L12:
	movl	-12(%rbp), %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	path, .-path
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	solve
	.type	solve, @function
solve:
.LFB5:
	.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
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L15
.L16:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	xy(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	xy(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+xy(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+xy(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	path
	addl	%eax, -16(%rbp)
.L15:
	addl	$1, -12(%rbp)
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L16
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	solve, .-solve
	.section	.rodata
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.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
	leaq	n(%rip), %rax
	movq	%rax, %rcx
	leaq	h(%rip), %rax
	movq	%rax, %rdx
	leaq	w(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4(%rbp)
	jmp	.L19
.L20:
	movl	-4(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	4(%rax), %rdx
	leaq	xy(%rip), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	xy(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4(%rbp)
.L19:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L20
	call	solve
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
