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>

int ABS(int a){
	return a >= 0 ? a : -a;
}

int GCD(int a, int b){
	if(b == 0){
		return a;
	}
	else{
		return GCD(b, a % b);
	}
}

int main(){
	int A, B, C, D, H, W, g;
	scanf("%d%d%d%d", &A, &B, &C, &D);
	H = ABS(A - C);
	W = ABS(B - D);
	g = GCD(H, W);
	H /= g;
	W /= g;
	printf("%d\n", g * (H + W - 1));
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	ABS
	.type	ABS, @function
ABS:
.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	-4(%rbp), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	ABS, .-ABS
	.globl	GCD
	.type	GCD, @function
GCD:
.LFB1:
	.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	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	cmpl	$0, -8(%rbp)
	jne	.L4
	movl	-4(%rbp), %eax
	jmp	.L5
.L4:
	movl	-4(%rbp), %eax
	cltd
	idivl	-8(%rbp)
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	GCD
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	GCD, .-GCD
	.section	.rodata
.LC0:
	.string	"%d%d%d%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.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
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-24(%rbp), %rsi
	leaq	-28(%rbp), %rcx
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	movl	-28(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %edi
	call	ABS
	movl	%eax, -20(%rbp)
	movl	-32(%rbp), %eax
	movl	-24(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %edi
	call	ABS
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	GCD
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%eax, -20(%rbp)
	movl	-16(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%eax, -16(%rbp)
	movl	-20(%rbp), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	subl	$1, %eax
	imull	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	ABS
	.type	ABS, @function
ABS:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	negl	%eax
	cmovs	%edi, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	ABS, .-ABS
	.p2align 4
	.globl	GCD
	.type	GCD, @function
GCD:
.LFB24:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	movl	%esi, %r8d
	testl	%esi, %esi
	jne	.L4
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L12:
	movl	%edx, %r8d
.L4:
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L12
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%edi, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	GCD, .-GCD
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d%d%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rcx
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	leaq	20(%rsp), %r8
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	subl	16(%rsp), %eax
	movl	%eax, %esi
	movl	12(%rsp), %r8d
	movl	20(%rsp), %ecx
	negl	%esi
	cmovs	%eax, %esi
	movl	%r8d, %eax
	subl	%ecx, %eax
	movl	%eax, %edi
	negl	%edi
	cmovs	%eax, %edi
	movl	%esi, %eax
	movl	%edi, %edx
	cmpl	%ecx, %r8d
	je	.L25
	.p2align 4,,10
	.p2align 3
.L14:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L14
.L15:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	movl	%eax, %esi
	movl	%edi, %eax
	movl	$1, %edi
	cltd
	idivl	%ecx
	leal	-1(%rsi,%rax), %edx
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	imull	%ecx, %edx
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L25:
	.cfi_restore_state
	movl	%esi, %ecx
	jmp	.L15
.L26:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.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	ABS
	.type	ABS, @function
ABS:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	negl	%eax
	cmovs	%edi, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	ABS, .-ABS
	.p2align 4
	.globl	GCD
	.type	GCD, @function
GCD:
.LFB24:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	movl	%esi, %r8d
	testl	%esi, %esi
	jne	.L4
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L12:
	movl	%edx, %r8d
.L4:
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L12
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%edi, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	GCD, .-GCD
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d%d%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rcx
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	leaq	20(%rsp), %r8
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	subl	16(%rsp), %eax
	movl	%eax, %esi
	movl	12(%rsp), %r8d
	movl	20(%rsp), %ecx
	negl	%esi
	cmovs	%eax, %esi
	movl	%r8d, %eax
	subl	%ecx, %eax
	movl	%eax, %edi
	negl	%edi
	cmovs	%eax, %edi
	movl	%esi, %eax
	movl	%edi, %edx
	cmpl	%ecx, %r8d
	je	.L25
	.p2align 4,,10
	.p2align 3
.L14:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L14
.L15:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	movl	%eax, %esi
	movl	%edi, %eax
	movl	$1, %edi
	cltd
	idivl	%ecx
	leal	-1(%rsi,%rax), %edx
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	imull	%ecx, %edx
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L25:
	.cfi_restore_state
	movl	%esi, %ecx
	jmp	.L15
.L26:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.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>

int ABS(int a){
	return a >= 0 ? a : -a;
}

int GCD(int a, int b){
	if(b == 0){
		return a;
	}
	else{
		return GCD(b, a % b);
	}
}

int main(){
	int A, B, C, D, H, W, g;
	scanf("%d%d%d%d", &A, &B, &C, &D);
	H = ABS(A - C);
	W = ABS(B - D);
	g = GCD(H, W);
	H /= g;
	W /= g;
	printf("%d\n", g * (H + W - 1));
	return 0;
}
1 2 3 4
 3 3 10 7
 1 2 6 4
 3 3 10 5
 6 3 10 5
 1 0 11 4
 1 0 15 4
 6 6 3 5
 1 1 15 2
 6 16 3 5

2
 10
 6
 8
 4
 12
 16
 3
 14
 13

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>

int ABS(int a){
	return a >= 0 ? a : -a;
}

int GCD(int a, int b){
	if(b == 0){
		return a;
	}
	else{
		return GCD(b, a % b);
	}
}

int main(){
	int A, B, C, D, H, W, g;
	scanf("%d%d%d%d", &A, &B, &C, &D);
	H = ABS(A - C);
	W = ABS(B - D);
	g = GCD(H, W);
	H /= g;
	W /= g;
	printf("%d\n", g * (H + W - 1));
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	ABS
	.type	ABS, @function
ABS:
.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	-4(%rbp), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	ABS, .-ABS
	.globl	GCD
	.type	GCD, @function
GCD:
.LFB1:
	.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	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	cmpl	$0, -8(%rbp)
	jne	.L4
	movl	-4(%rbp), %eax
	jmp	.L5
.L4:
	movl	-4(%rbp), %eax
	cltd
	idivl	-8(%rbp)
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	GCD
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	GCD, .-GCD
	.section	.rodata
.LC0:
	.string	"%d%d%d%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.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
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-24(%rbp), %rsi
	leaq	-28(%rbp), %rcx
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	movl	-28(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %edi
	call	ABS
	movl	%eax, -20(%rbp)
	movl	-32(%rbp), %eax
	movl	-24(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %edi
	call	ABS
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	GCD
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%eax, -20(%rbp)
	movl	-16(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%eax, -16(%rbp)
	movl	-20(%rbp), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	subl	$1, %eax
	imull	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	ABS
	.type	ABS, @function
ABS:
.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	-4(%rbp), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	ABS, .-ABS
	.globl	GCD
	.type	GCD, @function
GCD:
.LFB1:
	.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	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	cmpl	$0, -8(%rbp)
	jne	.L4
	movl	-4(%rbp), %eax
	jmp	.L5
.L4:
	movl	-4(%rbp), %eax
	cltd
	idivl	-8(%rbp)
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	GCD
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	GCD, .-GCD
	.section	.rodata
.LC0:
	.string	"%d%d%d%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.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
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-24(%rbp), %rsi
	leaq	-28(%rbp), %rcx
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	movl	-28(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %edi
	call	ABS
	movl	%eax, -20(%rbp)
	movl	-32(%rbp), %eax
	movl	-24(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %edi
	call	ABS
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	GCD
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%eax, -20(%rbp)
	movl	-16(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%eax, -16(%rbp)
	movl	-20(%rbp), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	subl	$1, %eax
	imull	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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:
