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

```c
/*
  AOJ 0594
  Title:Super Metropolis
  @kankichi573
*/

#include <stdio.h>
#define Max(x,y) (((x)>(y))?(x):(y))
#define Min(x,y) (((x)<(y))?(x):(y))


int W,H,N;
int Sign(int x)
{
  if(x>0)
    return(1);
  if(x==0)
    return(0);
  if(x<0)
    return(-1);
}
int Abs(int x)
{
  return((x>0)?x:(-x));
}
int solve(int x1,int y1,int x2,int y2)
{
  if(Sign(x1-x2)!=Sign(y1-y2))
    return(Abs(x1-x2)+Abs(y1-y2));
  else
    return(Max(Abs(x1-x2),Abs(y1-y2)));
}
main()
{
  int x,y,xold,yold,res,i,ret;

  scanf("%d %d %d",&W,&H,&N);
  scanf("%d %d",&xold,&yold);
  {
    for(i=0,res=0;i<N-1;i++)
      {
	scanf("%d %d",&x,&y);
	ret = solve(xold,yold,x,y);
	//printf("%d %d %d %d =%d\n",xold,yold,x,y,ret);
	res += ret;
	xold=x;
	yold=y;
      }
    printf("%d\n",res);
  }
  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
	.text
	.globl	Sign
	.type	Sign, @function
Sign:
.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)
	jle	.L2
	movl	$1, %eax
	jmp	.L1
.L2:
	cmpl	$0, -4(%rbp)
	jne	.L4
	movl	$0, %eax
	jmp	.L1
.L4:
	cmpl	$0, -4(%rbp)
	jns	.L5
	movl	$-1, %eax
	jmp	.L1
.L5:
.L1:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	Sign, .-Sign
	.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	solve
	.type	solve, @function
solve:
.LFB2:
	.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	$16, %rsp
	.cfi_offset 3, -24
	movl	%edi, -12(%rbp)
	movl	%esi, -16(%rbp)
	movl	%edx, -20(%rbp)
	movl	%ecx, -24(%rbp)
	movl	-12(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	%eax, %edi
	call	Sign
	movl	%eax, %ebx
	movl	-16(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, %edi
	call	Sign
	cmpl	%eax, %ebx
	je	.L9
	movl	-12(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	%eax, %edi
	call	Abs
	movl	%eax, %ebx
	movl	-16(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, %edi
	call	Abs
	addl	%ebx, %eax
	jmp	.L10
.L9:
	movl	-12(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	%eax, %edi
	call	Abs
	movl	%eax, %ebx
	movl	-16(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, %edi
	call	Abs
	cmpl	%eax, %ebx
	jle	.L11
	movl	-12(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	%eax, %edi
	call	Abs
	jmp	.L10
.L11:
	movl	-16(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, %edi
	call	Abs
.L10:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	solve, .-solve
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	N(%rip), %rax
	movq	%rax, %rcx
	leaq	H(%rip), %rax
	movq	%rax, %rdx
	leaq	W(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L14
.L15:
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %ecx
	movl	-36(%rbp), %edx
	movl	-24(%rbp), %esi
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	solve
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	addl	%eax, -20(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -24(%rbp)
	addl	$1, -16(%rbp)
.L14:
	movl	N(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -16(%rbp)
	jl	.L15
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	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	.L17
	call	__stack_chk_fail@PLT
.L17:
	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	Sign
	.type	Sign, @function
Sign:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	testl	%edi, %edi
	movl	$1, %edx
	setne	%al
	negl	%eax
	testl	%edi, %edi
	cmovg	%edx, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	Sign, .-Sign
	.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	solve
	.type	solve, @function
solve:
.LFB25:
	.cfi_startproc
	endbr64
	subl	%edx, %edi
	subl	%ecx, %esi
	testl	%edi, %edi
	jg	.L7
	testl	%esi, %esi
	jg	.L8
	setne	%dl
	testl	%edi, %edi
	setne	%al
	cmpb	%al, %dl
	je	.L9
.L8:
	movl	%edi, %eax
	movl	%esi, %edx
	negl	%eax
	cmovs	%edi, %eax
	negl	%edx
	cmovs	%esi, %edx
	addl	%edx, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	testl	%esi, %esi
	jle	.L8
.L9:
	movl	%edi, %eax
	movl	%esi, %edx
	negl	%eax
	cmovs	%edi, %eax
	negl	%edx
	cmovs	%esi, %edx
	cmpl	%edx, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE25:
	.size	solve, .-solve
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB26:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	N(%rip), %rcx
	leaq	H(%rip), %rdx
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	W(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC1(%rip), %rbx
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	leaq	20(%rsp), %rdx
	movq	%rbx, %rdi
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	cmpl	$1, N(%rip)
	jle	.L19
	xorl	%r14d, %r14d
	leaq	12(%rsp), %r13
	leaq	8(%rsp), %rbp
	xorl	%r12d, %r12d
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L23:
	testl	%edx, %edx
	jg	.L14
	setne	%r8b
	testl	%eax, %eax
	setne	%cl
	cmpb	%cl, %r8b
	jne	.L14
.L15:
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	movl	%edx, %ecx
	negl	%ecx
	cmovns	%ecx, %edx
	cmpl	%edx, %eax
	cmovl	%edx, %eax
.L16:
	addl	%eax, %r12d
	movl	N(%rip), %eax
	addl	$1, %r14d
	movl	%esi, 16(%rsp)
	movl	%edi, 20(%rsp)
	subl	$1, %eax
	cmpl	%r14d, %eax
	jle	.L12
.L17:
	movq	%r13, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %esi
	movl	16(%rsp), %eax
	movl	12(%rsp), %edi
	movl	20(%rsp), %edx
	subl	%esi, %eax
	subl	%edi, %edx
	testl	%eax, %eax
	jle	.L23
	testl	%edx, %edx
	jg	.L15
.L14:
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	movl	%edx, %ecx
	negl	%ecx
	cmovns	%ecx, %edx
	addl	%edx, %eax
	jmp	.L16
.L19:
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L24:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE26:
	.size	main, .-main
	.globl	N
	.bss
	.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
	.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	Sign
	.type	Sign, @function
Sign:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	testl	%edi, %edi
	movl	$1, %edx
	setne	%al
	negl	%eax
	testl	%edi, %edi
	cmovg	%edx, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	Sign, .-Sign
	.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	solve
	.type	solve, @function
solve:
.LFB25:
	.cfi_startproc
	endbr64
	subl	%edx, %edi
	subl	%ecx, %esi
	testl	%edi, %edi
	jg	.L7
	testl	%esi, %esi
	jg	.L8
	setne	%dl
	testl	%edi, %edi
	setne	%al
	cmpb	%al, %dl
	je	.L9
.L8:
	movl	%edi, %eax
	movl	%esi, %edx
	negl	%eax
	cmovs	%edi, %eax
	negl	%edx
	cmovs	%esi, %edx
	addl	%edx, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	testl	%esi, %esi
	jle	.L8
.L9:
	movl	%edi, %eax
	movl	%esi, %edx
	negl	%eax
	cmovs	%edi, %eax
	negl	%edx
	cmovs	%esi, %edx
	cmpl	%edx, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE25:
	.size	solve, .-solve
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB26:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	N(%rip), %rcx
	leaq	H(%rip), %rdx
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	W(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC1(%rip), %rbx
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	leaq	20(%rsp), %rdx
	movq	%rbx, %rdi
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	cmpl	$1, N(%rip)
	jle	.L19
	xorl	%r14d, %r14d
	leaq	12(%rsp), %r13
	leaq	8(%rsp), %rbp
	xorl	%r12d, %r12d
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L23:
	testl	%edx, %edx
	jg	.L14
	setne	%r8b
	testl	%eax, %eax
	setne	%cl
	cmpb	%cl, %r8b
	jne	.L14
.L15:
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	movl	%edx, %ecx
	negl	%ecx
	cmovns	%ecx, %edx
	cmpl	%edx, %eax
	cmovl	%edx, %eax
.L16:
	addl	%eax, %r12d
	movl	N(%rip), %eax
	addl	$1, %r14d
	movl	%esi, 16(%rsp)
	movl	%edi, 20(%rsp)
	subl	$1, %eax
	cmpl	%r14d, %eax
	jle	.L12
.L17:
	movq	%r13, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %esi
	movl	16(%rsp), %eax
	movl	12(%rsp), %edi
	movl	20(%rsp), %edx
	subl	%esi, %eax
	subl	%edi, %edx
	testl	%eax, %eax
	jle	.L23
	testl	%edx, %edx
	jg	.L15
.L14:
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	movl	%edx, %ecx
	negl	%ecx
	cmovns	%ecx, %edx
	addl	%edx, %eax
	jmp	.L16
.L19:
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L24:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE26:
	.size	main, .-main
	.globl	N
	.bss
	.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
	.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:

/*
  AOJ 0594
  Title:Super Metropolis
  @kankichi573
*/

#include <stdio.h>
#define Max(x,y) (((x)>(y))?(x):(y))
#define Min(x,y) (((x)<(y))?(x):(y))


int W,H,N;
int Sign(int x)
{
  if(x>0)
    return(1);
  if(x==0)
    return(0);
  if(x<0)
    return(-1);
}
int Abs(int x)
{
  return((x>0)?x:(-x));
}
int solve(int x1,int y1,int x2,int y2)
{
  if(Sign(x1-x2)!=Sign(y1-y2))
    return(Abs(x1-x2)+Abs(y1-y2));
  else
    return(Max(Abs(x1-x2),Abs(y1-y2)));
}
main()
{
  int x,y,xold,yold,res,i,ret;

  scanf("%d %d %d",&W,&H,&N);
  scanf("%d %d",&xold,&yold);
  {
    for(i=0,res=0;i<N-1;i++)
      {
	scanf("%d %d",&x,&y);
	ret = solve(xold,yold,x,y);
	//printf("%d %d %d %d =%d\n",xold,yold,x,y,ret);
	res += ret;
	xold=x;
	yold=y;
      }
    printf("%d\n",res);
  }
  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
/*
  AOJ 0594
  Title:Super Metropolis
  @kankichi573
*/

#include <stdio.h>
#define Max(x,y) (((x)>(y))?(x):(y))
#define Min(x,y) (((x)<(y))?(x):(y))


int W,H,N;
int Sign(int x)
{
  if(x>0)
    return(1);
  if(x==0)
    return(0);
  if(x<0)
    return(-1);
}
int Abs(int x)
{
  return((x>0)?x:(-x));
}
int solve(int x1,int y1,int x2,int y2)
{
  if(Sign(x1-x2)!=Sign(y1-y2))
    return(Abs(x1-x2)+Abs(y1-y2));
  else
    return(Max(Abs(x1-x2),Abs(y1-y2)));
}
main()
{
  int x,y,xold,yold,res,i,ret;

  scanf("%d %d %d",&W,&H,&N);
  scanf("%d %d",&xold,&yold);
  {
    for(i=0,res=0;i<N-1;i++)
      {
	scanf("%d %d",&x,&y);
	ret = solve(xold,yold,x,y);
	//printf("%d %d %d %d =%d\n",xold,yold,x,y,ret);
	res += ret;
	xold=x;
	yold=y;
      }
    printf("%d\n",res);
  }
  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
	.text
	.globl	Sign
	.type	Sign, @function
Sign:
.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)
	jle	.L2
	movl	$1, %eax
	jmp	.L1
.L2:
	cmpl	$0, -4(%rbp)
	jne	.L4
	movl	$0, %eax
	jmp	.L1
.L4:
	cmpl	$0, -4(%rbp)
	jns	.L5
	movl	$-1, %eax
	jmp	.L1
.L5:
.L1:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	Sign, .-Sign
	.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	solve
	.type	solve, @function
solve:
.LFB2:
	.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	$16, %rsp
	.cfi_offset 3, -24
	movl	%edi, -12(%rbp)
	movl	%esi, -16(%rbp)
	movl	%edx, -20(%rbp)
	movl	%ecx, -24(%rbp)
	movl	-12(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	%eax, %edi
	call	Sign
	movl	%eax, %ebx
	movl	-16(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, %edi
	call	Sign
	cmpl	%eax, %ebx
	je	.L9
	movl	-12(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	%eax, %edi
	call	Abs
	movl	%eax, %ebx
	movl	-16(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, %edi
	call	Abs
	addl	%ebx, %eax
	jmp	.L10
.L9:
	movl	-12(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	%eax, %edi
	call	Abs
	movl	%eax, %ebx
	movl	-16(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, %edi
	call	Abs
	cmpl	%eax, %ebx
	jle	.L11
	movl	-12(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	%eax, %edi
	call	Abs
	jmp	.L10
.L11:
	movl	-16(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, %edi
	call	Abs
.L10:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	solve, .-solve
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	N(%rip), %rax
	movq	%rax, %rcx
	leaq	H(%rip), %rax
	movq	%rax, %rdx
	leaq	W(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L14
.L15:
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %ecx
	movl	-36(%rbp), %edx
	movl	-24(%rbp), %esi
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	solve
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	addl	%eax, -20(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -24(%rbp)
	addl	$1, -16(%rbp)
.L14:
	movl	N(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -16(%rbp)
	jl	.L15
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	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	.L17
	call	__stack_chk_fail@PLT
.L17:
	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	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
	.text
	.globl	Sign
	.type	Sign, @function
Sign:
.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)
	jle	.L2
	movl	$1, %eax
	jmp	.L1
.L2:
	cmpl	$0, -4(%rbp)
	jne	.L4
	movl	$0, %eax
	jmp	.L1
.L4:
	cmpl	$0, -4(%rbp)
	jns	.L5
	movl	$-1, %eax
	jmp	.L1
.L5:
.L1:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	Sign, .-Sign
	.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	solve
	.type	solve, @function
solve:
.LFB2:
	.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	$16, %rsp
	.cfi_offset 3, -24
	movl	%edi, -12(%rbp)
	movl	%esi, -16(%rbp)
	movl	%edx, -20(%rbp)
	movl	%ecx, -24(%rbp)
	movl	-12(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	%eax, %edi
	call	Sign
	movl	%eax, %ebx
	movl	-16(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, %edi
	call	Sign
	cmpl	%eax, %ebx
	je	.L9
	movl	-12(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	%eax, %edi
	call	Abs
	movl	%eax, %ebx
	movl	-16(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, %edi
	call	Abs
	addl	%ebx, %eax
	jmp	.L10
.L9:
	movl	-12(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	%eax, %edi
	call	Abs
	movl	%eax, %ebx
	movl	-16(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, %edi
	call	Abs
	cmpl	%eax, %ebx
	jle	.L11
	movl	-12(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	%eax, %edi
	call	Abs
	jmp	.L10
.L11:
	movl	-16(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, %edi
	call	Abs
.L10:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	solve, .-solve
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	N(%rip), %rax
	movq	%rax, %rcx
	leaq	H(%rip), %rax
	movq	%rax, %rdx
	leaq	W(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L14
.L15:
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %ecx
	movl	-36(%rbp), %edx
	movl	-24(%rbp), %esi
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	solve
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	addl	%eax, -20(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -24(%rbp)
	addl	$1, -16(%rbp)
.L14:
	movl	N(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -16(%rbp)
	jl	.L15
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	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	.L17
	call	__stack_chk_fail@PLT
.L17:
	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:
