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

```c
// AOJ 409 Floor
// 2019.9.29

#include <stdio.h>

#define MIN(a,b) ((a)<=(b)?(a):(b))
#define MAX(a,b) ((a)>=(b)?(a):(b))
typedef struct { int x1, y1, x2, y2; } Rect;
Rect a1, a2, a;

int main()
{
	int x, y, id;

	scanf("%d%d", &x, &y);
	if (x == 0 && y == 0) puts("1");
	else if (x == 1 && y == 0) puts("2");
	else {
		a2.x1 = a2.x2 = 1, id = 2;
		while (1) {
			if ((id & 1) == 0) { // 北 or 南
				a.x1 = MIN(a1.x1, a2.x1), a.x2 = MAX(a1.x2, a2.x2);
				if (id % 4 == 2) { // 北
					a.y1 = a2.y2 + 1, a.y2 = a.y1 + a.x2-a.x1;
				} else {
					a.y2 = a2.y1 - 1, a.y1 = a.y2 - (a.x2-a.x1);
				}
			} else {
				a.y1 = MIN(a1.y1, a2.y1), a.y2 = MAX(a1.y2, a2.y2);
				if (id % 4 == 1) { // 東
					a.x1 = a2.x2 + 1, a.x2 = a.x1 + a.y2-a.y1;
				} else {
					a.x2 = a2.x1 - 1, a.x1 = a.x2 - (a.y2-a.y1);
				}
			}

	
			if (a.x1 <= x && x <= a.x2 && a.y1 <= y && y <= a.y2) {
				printf("%d\n", id%3+1);
				break;
			}
	
			id++;
			a1 = a2, a2 = a;
		}
	}
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a1
	.bss
	.align 16
	.type	a1, @object
	.size	a1, 16
a1:
	.zero	16
	.globl	a2
	.align 16
	.type	a2, @object
	.size	a2, 16
a2:
	.zero	16
	.globl	a
	.align 16
	.type	a, @object
	.size	a, 16
a:
	.zero	16
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"1"
.LC2:
	.string	"2"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	-16(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-16(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L3
.L2:
	movl	-20(%rbp), %eax
	cmpl	$1, %eax
	jne	.L4
	movl	-16(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L3
.L4:
	movl	$1, 8+a2(%rip)
	movl	8+a2(%rip), %eax
	movl	%eax, a2(%rip)
	movl	$2, -12(%rbp)
.L10:
	movl	-12(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L5
	movl	a1(%rip), %edx
	movl	a2(%rip), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, a(%rip)
	movl	8+a1(%rip), %edx
	movl	8+a2(%rip), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, 8+a(%rip)
	movl	-12(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	cmpl	$2, %eax
	jne	.L6
	movl	12+a2(%rip), %eax
	addl	$1, %eax
	movl	%eax, 4+a(%rip)
	movl	4+a(%rip), %edx
	movl	8+a(%rip), %eax
	addl	%edx, %eax
	movl	a(%rip), %edx
	subl	%edx, %eax
	movl	%eax, 12+a(%rip)
	jmp	.L7
.L6:
	movl	4+a2(%rip), %eax
	subl	$1, %eax
	movl	%eax, 12+a(%rip)
	movl	12+a(%rip), %eax
	movl	8+a(%rip), %edx
	movl	a(%rip), %ecx
	subl	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, 4+a(%rip)
	jmp	.L7
.L5:
	movl	4+a1(%rip), %edx
	movl	4+a2(%rip), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, 4+a(%rip)
	movl	12+a1(%rip), %edx
	movl	12+a2(%rip), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, 12+a(%rip)
	movl	-12(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L8
	movl	8+a2(%rip), %eax
	addl	$1, %eax
	movl	%eax, a(%rip)
	movl	a(%rip), %edx
	movl	12+a(%rip), %eax
	addl	%edx, %eax
	movl	4+a(%rip), %edx
	subl	%edx, %eax
	movl	%eax, 8+a(%rip)
	jmp	.L7
.L8:
	movl	a2(%rip), %eax
	subl	$1, %eax
	movl	%eax, 8+a(%rip)
	movl	8+a(%rip), %eax
	movl	12+a(%rip), %edx
	movl	4+a(%rip), %ecx
	subl	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, a(%rip)
.L7:
	movl	a(%rip), %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L9
	movl	8+a(%rip), %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	movl	4+a(%rip), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L9
	movl	12+a(%rip), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	movl	-12(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1431655766, %rax, %rax
	shrq	$32, %rax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	movl	%eax, %ecx
	addl	%ecx, %ecx
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L3
.L9:
	addl	$1, -12(%rbp)
	movq	a2(%rip), %rax
	movq	8+a2(%rip), %rdx
	movq	%rax, a1(%rip)
	movq	%rdx, 8+a1(%rip)
	movq	a(%rip), %rax
	movq	8+a(%rip), %rdx
	movq	%rax, a2(%rip)
	movq	%rdx, 8+a2(%rip)
	jmp	.L10
.L3:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"1"
.LC2:
	.string	"2"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	.LC0(%rip), %rdi
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %edi
	testl	%edi, %edi
	jne	.L2
	cmpl	$0, 4(%rsp)
	je	.L14
.L3:
	movl	$1, 8+a2(%rip)
	movl	4(%rsp), %r10d
	movl	$2, %esi
	leaq	a2(%rip), %r9
	movl	$1, a2(%rip)
	leaq	a(%rip), %r8
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L17:
	movl	(%r9), %eax
	movl	a1(%rip), %edx
	movl	8+a2(%rip), %ecx
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	movl	8+a1(%rip), %eax
	cmpl	%ecx, %eax
	movl	%edx, (%r8)
	cmovl	%ecx, %eax
	movl	%eax, 8+a(%rip)
	cmpl	$2, %r11d
	je	.L15
	movl	4+a2(%rip), %ebx
	movl	%eax, %r11d
	subl	%edx, %r11d
	leal	-1(%rbx), %ecx
	movl	%ecx, %ebx
	movl	%ecx, 12+a(%rip)
	subl	%r11d, %ebx
	movl	%ebx, 4+a(%rip)
.L7:
	cmpl	%edx, %edi
	jl	.L9
	cmpl	%eax, %edi
	jg	.L9
	cmpl	%r10d, %ebx
	jg	.L9
	cmpl	%r10d, %ecx
	jge	.L16
	.p2align 4,,10
	.p2align 3
.L9:
	movdqa	a2(%rip), %xmm0
	movdqa	a(%rip), %xmm1
	addl	$1, %esi
	movaps	%xmm0, a1(%rip)
	movaps	%xmm1, a2(%rip)
.L10:
	movl	%esi, %r11d
	andl	$3, %r11d
	testb	$1, %sil
	je	.L17
	movl	4+a1(%rip), %ecx
	movl	4+a2(%rip), %eax
	cmpl	%eax, %ecx
	cmovle	%ecx, %eax
	movl	12+a1(%rip), %ecx
	movl	%eax, 4+a(%rip)
	movl	%eax, %ebx
	movl	12+a2(%rip), %eax
	cmpl	%eax, %ecx
	cmovl	%eax, %ecx
	movl	%ecx, 12+a(%rip)
	cmpl	$1, %r11d
	je	.L18
	movl	(%r9), %eax
	movl	%ecx, %r11d
	subl	%ebx, %r11d
	subl	$1, %eax
	movl	%eax, %edx
	movl	%eax, 8+a(%rip)
	subl	%r11d, %edx
	movl	%edx, (%r8)
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L15:
	movl	12+a2(%rip), %ebx
	addl	$1, %ebx
	leal	(%rax,%rbx), %ecx
	movl	%ebx, 4+a(%rip)
	subl	%edx, %ecx
	movl	%ecx, 12+a(%rip)
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L18:
	movl	8+a2(%rip), %eax
	leal	1(%rax), %edx
	leal	(%rcx,%rdx), %eax
	movl	%edx, (%r8)
	subl	%ebx, %eax
	movl	%eax, 8+a(%rip)
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%esi, %eax
	movl	$2863311531, %edx
	movl	$1, %edi
	imulq	%rdx, %rax
	shrq	$33, %rax
	leal	(%rax,%rax,2), %eax
	subl	%eax, %esi
	xorl	%eax, %eax
	movl	%esi, %edx
	leaq	.LC3(%rip), %rsi
	addl	$1, %edx
	call	__printf_chk@PLT
.L4:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	cmpl	$1, %edi
	jne	.L3
	cmpl	$0, 4(%rsp)
	jne	.L3
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L4
.L14:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L4
.L19:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	a
	.bss
	.align 16
	.type	a, @object
	.size	a, 16
a:
	.zero	16
	.globl	a2
	.align 16
	.type	a2, @object
	.size	a2, 16
a2:
	.zero	16
	.globl	a1
	.align 16
	.type	a1, @object
	.size	a1, 16
a1:
	.zero	16
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"1"
.LC2:
	.string	"2"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	.LC0(%rip), %rdi
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %edi
	testl	%edi, %edi
	jne	.L2
	cmpl	$0, 4(%rsp)
	je	.L14
.L3:
	movl	$1, 8+a2(%rip)
	movl	4(%rsp), %r10d
	movl	$2, %esi
	leaq	a2(%rip), %r9
	movl	$1, a2(%rip)
	leaq	a(%rip), %r8
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L17:
	movl	(%r9), %eax
	movl	a1(%rip), %edx
	movl	8+a2(%rip), %ecx
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	movl	8+a1(%rip), %eax
	cmpl	%ecx, %eax
	movl	%edx, (%r8)
	cmovl	%ecx, %eax
	movl	%eax, 8+a(%rip)
	cmpl	$2, %r11d
	je	.L15
	movl	4+a2(%rip), %ebx
	movl	%eax, %r11d
	subl	%edx, %r11d
	leal	-1(%rbx), %ecx
	movl	%ecx, %ebx
	movl	%ecx, 12+a(%rip)
	subl	%r11d, %ebx
	movl	%ebx, 4+a(%rip)
.L7:
	cmpl	%edx, %edi
	jl	.L9
	cmpl	%eax, %edi
	jg	.L9
	cmpl	%r10d, %ebx
	jg	.L9
	cmpl	%r10d, %ecx
	jge	.L16
	.p2align 4,,10
	.p2align 3
.L9:
	movdqa	a2(%rip), %xmm0
	movdqa	a(%rip), %xmm1
	addl	$1, %esi
	movaps	%xmm0, a1(%rip)
	movaps	%xmm1, a2(%rip)
.L10:
	movl	%esi, %r11d
	andl	$3, %r11d
	testb	$1, %sil
	je	.L17
	movl	4+a1(%rip), %ecx
	movl	4+a2(%rip), %eax
	cmpl	%eax, %ecx
	cmovle	%ecx, %eax
	movl	12+a1(%rip), %ecx
	movl	%eax, 4+a(%rip)
	movl	%eax, %ebx
	movl	12+a2(%rip), %eax
	cmpl	%eax, %ecx
	cmovl	%eax, %ecx
	movl	%ecx, 12+a(%rip)
	cmpl	$1, %r11d
	je	.L18
	movl	(%r9), %eax
	movl	%ecx, %r11d
	subl	%ebx, %r11d
	subl	$1, %eax
	movl	%eax, %edx
	movl	%eax, 8+a(%rip)
	subl	%r11d, %edx
	movl	%edx, (%r8)
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L15:
	movl	12+a2(%rip), %ebx
	addl	$1, %ebx
	leal	(%rax,%rbx), %ecx
	movl	%ebx, 4+a(%rip)
	subl	%edx, %ecx
	movl	%ecx, 12+a(%rip)
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L18:
	movl	8+a2(%rip), %eax
	leal	1(%rax), %edx
	leal	(%rcx,%rdx), %eax
	movl	%edx, (%r8)
	subl	%ebx, %eax
	movl	%eax, 8+a(%rip)
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%esi, %eax
	movl	$2863311531, %edx
	movl	$1, %edi
	imulq	%rdx, %rax
	shrq	$33, %rax
	leal	(%rax,%rax,2), %eax
	subl	%eax, %esi
	xorl	%eax, %eax
	movl	%esi, %edx
	leaq	.LC3(%rip), %rsi
	addl	$1, %edx
	call	__printf_chk@PLT
.L4:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	cmpl	$1, %edi
	jne	.L3
	cmpl	$0, 4(%rsp)
	jne	.L3
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L4
.L14:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L4
.L19:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	a
	.bss
	.align 16
	.type	a, @object
	.size	a, 16
a:
	.zero	16
	.globl	a2
	.align 16
	.type	a2, @object
	.size	a2, 16
a2:
	.zero	16
	.globl	a1
	.align 16
	.type	a1, @object
	.size	a1, 16
a1:
	.zero	16
	.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 409 Floor
// 2019.9.29

#include <stdio.h>

#define MIN(a,b) ((a)<=(b)?(a):(b))
#define MAX(a,b) ((a)>=(b)?(a):(b))
typedef struct { int x1, y1, x2, y2; } Rect;
Rect a1, a2, a;

int main()
{
	int x, y, id;

	scanf("%d%d", &x, &y);
	if (x == 0 && y == 0) puts("1");
	else if (x == 1 && y == 0) puts("2");
	else {
		a2.x1 = a2.x2 = 1, id = 2;
		while (1) {
			if ((id & 1) == 0) { // 北 or 南
				a.x1 = MIN(a1.x1, a2.x1), a.x2 = MAX(a1.x2, a2.x2);
				if (id % 4 == 2) { // 北
					a.y1 = a2.y2 + 1, a.y2 = a.y1 + a.x2-a.x1;
				} else {
					a.y2 = a2.y1 - 1, a.y1 = a.y2 - (a.x2-a.x1);
				}
			} else {
				a.y1 = MIN(a1.y1, a2.y1), a.y2 = MAX(a1.y2, a2.y2);
				if (id % 4 == 1) { // 東
					a.x1 = a2.x2 + 1, a.x2 = a.x1 + a.y2-a.y1;
				} else {
					a.x2 = a2.x1 - 1, a.x1 = a.x2 - (a.y2-a.y1);
				}
			}

	
			if (a.x1 <= x && x <= a.x2 && a.y1 <= y && y <= a.y2) {
				printf("%d\n", id%3+1);
				break;
			}
	
			id++;
			a1 = a2, a2 = a;
		}
	}
	return 0;
}

0 0

1

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

```c
// AOJ 409 Floor
// 2019.9.29

#include <stdio.h>

#define MIN(a,b) ((a)<=(b)?(a):(b))
#define MAX(a,b) ((a)>=(b)?(a):(b))
typedef struct { int x1, y1, x2, y2; } Rect;
Rect a1, a2, a;

int main()
{
	int x, y, id;

	scanf("%d%d", &x, &y);
	if (x == 0 && y == 0) puts("1");
	else if (x == 1 && y == 0) puts("2");
	else {
		a2.x1 = a2.x2 = 1, id = 2;
		while (1) {
			if ((id & 1) == 0) { // 北 or 南
				a.x1 = MIN(a1.x1, a2.x1), a.x2 = MAX(a1.x2, a2.x2);
				if (id % 4 == 2) { // 北
					a.y1 = a2.y2 + 1, a.y2 = a.y1 + a.x2-a.x1;
				} else {
					a.y2 = a2.y1 - 1, a.y1 = a.y2 - (a.x2-a.x1);
				}
			} else {
				a.y1 = MIN(a1.y1, a2.y1), a.y2 = MAX(a1.y2, a2.y2);
				if (id % 4 == 1) { // 東
					a.x1 = a2.x2 + 1, a.x2 = a.x1 + a.y2-a.y1;
				} else {
					a.x2 = a2.x1 - 1, a.x1 = a.x2 - (a.y2-a.y1);
				}
			}

	
			if (a.x1 <= x && x <= a.x2 && a.y1 <= y && y <= a.y2) {
				printf("%d\n", id%3+1);
				break;
			}
	
			id++;
			a1 = a2, a2 = a;
		}
	}
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a1
	.bss
	.align 16
	.type	a1, @object
	.size	a1, 16
a1:
	.zero	16
	.globl	a2
	.align 16
	.type	a2, @object
	.size	a2, 16
a2:
	.zero	16
	.globl	a
	.align 16
	.type	a, @object
	.size	a, 16
a:
	.zero	16
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"1"
.LC2:
	.string	"2"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	-16(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-16(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L3
.L2:
	movl	-20(%rbp), %eax
	cmpl	$1, %eax
	jne	.L4
	movl	-16(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L3
.L4:
	movl	$1, 8+a2(%rip)
	movl	8+a2(%rip), %eax
	movl	%eax, a2(%rip)
	movl	$2, -12(%rbp)
.L10:
	movl	-12(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L5
	movl	a1(%rip), %edx
	movl	a2(%rip), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, a(%rip)
	movl	8+a1(%rip), %edx
	movl	8+a2(%rip), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, 8+a(%rip)
	movl	-12(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	cmpl	$2, %eax
	jne	.L6
	movl	12+a2(%rip), %eax
	addl	$1, %eax
	movl	%eax, 4+a(%rip)
	movl	4+a(%rip), %edx
	movl	8+a(%rip), %eax
	addl	%edx, %eax
	movl	a(%rip), %edx
	subl	%edx, %eax
	movl	%eax, 12+a(%rip)
	jmp	.L7
.L6:
	movl	4+a2(%rip), %eax
	subl	$1, %eax
	movl	%eax, 12+a(%rip)
	movl	12+a(%rip), %eax
	movl	8+a(%rip), %edx
	movl	a(%rip), %ecx
	subl	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, 4+a(%rip)
	jmp	.L7
.L5:
	movl	4+a1(%rip), %edx
	movl	4+a2(%rip), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, 4+a(%rip)
	movl	12+a1(%rip), %edx
	movl	12+a2(%rip), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, 12+a(%rip)
	movl	-12(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L8
	movl	8+a2(%rip), %eax
	addl	$1, %eax
	movl	%eax, a(%rip)
	movl	a(%rip), %edx
	movl	12+a(%rip), %eax
	addl	%edx, %eax
	movl	4+a(%rip), %edx
	subl	%edx, %eax
	movl	%eax, 8+a(%rip)
	jmp	.L7
.L8:
	movl	a2(%rip), %eax
	subl	$1, %eax
	movl	%eax, 8+a(%rip)
	movl	8+a(%rip), %eax
	movl	12+a(%rip), %edx
	movl	4+a(%rip), %ecx
	subl	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, a(%rip)
.L7:
	movl	a(%rip), %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L9
	movl	8+a(%rip), %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	movl	4+a(%rip), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L9
	movl	12+a(%rip), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	movl	-12(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1431655766, %rax, %rax
	shrq	$32, %rax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	movl	%eax, %ecx
	addl	%ecx, %ecx
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L3
.L9:
	addl	$1, -12(%rbp)
	movq	a2(%rip), %rax
	movq	8+a2(%rip), %rdx
	movq	%rax, a1(%rip)
	movq	%rdx, 8+a1(%rip)
	movq	a(%rip), %rax
	movq	8+a(%rip), %rdx
	movq	%rax, a2(%rip)
	movq	%rdx, 8+a2(%rip)
	jmp	.L10
.L3:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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	a1
	.bss
	.align 16
	.type	a1, @object
	.size	a1, 16
a1:
	.zero	16
	.globl	a2
	.align 16
	.type	a2, @object
	.size	a2, 16
a2:
	.zero	16
	.globl	a
	.align 16
	.type	a, @object
	.size	a, 16
a:
	.zero	16
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"1"
.LC2:
	.string	"2"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	-16(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-16(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L3
.L2:
	movl	-20(%rbp), %eax
	cmpl	$1, %eax
	jne	.L4
	movl	-16(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L3
.L4:
	movl	$1, 8+a2(%rip)
	movl	8+a2(%rip), %eax
	movl	%eax, a2(%rip)
	movl	$2, -12(%rbp)
.L10:
	movl	-12(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L5
	movl	a1(%rip), %edx
	movl	a2(%rip), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, a(%rip)
	movl	8+a1(%rip), %edx
	movl	8+a2(%rip), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, 8+a(%rip)
	movl	-12(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	cmpl	$2, %eax
	jne	.L6
	movl	12+a2(%rip), %eax
	addl	$1, %eax
	movl	%eax, 4+a(%rip)
	movl	4+a(%rip), %edx
	movl	8+a(%rip), %eax
	addl	%edx, %eax
	movl	a(%rip), %edx
	subl	%edx, %eax
	movl	%eax, 12+a(%rip)
	jmp	.L7
.L6:
	movl	4+a2(%rip), %eax
	subl	$1, %eax
	movl	%eax, 12+a(%rip)
	movl	12+a(%rip), %eax
	movl	8+a(%rip), %edx
	movl	a(%rip), %ecx
	subl	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, 4+a(%rip)
	jmp	.L7
.L5:
	movl	4+a1(%rip), %edx
	movl	4+a2(%rip), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, 4+a(%rip)
	movl	12+a1(%rip), %edx
	movl	12+a2(%rip), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, 12+a(%rip)
	movl	-12(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L8
	movl	8+a2(%rip), %eax
	addl	$1, %eax
	movl	%eax, a(%rip)
	movl	a(%rip), %edx
	movl	12+a(%rip), %eax
	addl	%edx, %eax
	movl	4+a(%rip), %edx
	subl	%edx, %eax
	movl	%eax, 8+a(%rip)
	jmp	.L7
.L8:
	movl	a2(%rip), %eax
	subl	$1, %eax
	movl	%eax, 8+a(%rip)
	movl	8+a(%rip), %eax
	movl	12+a(%rip), %edx
	movl	4+a(%rip), %ecx
	subl	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, a(%rip)
.L7:
	movl	a(%rip), %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L9
	movl	8+a(%rip), %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	movl	4+a(%rip), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L9
	movl	12+a(%rip), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	movl	-12(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1431655766, %rax, %rax
	shrq	$32, %rax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	movl	%eax, %ecx
	addl	%ecx, %ecx
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L3
.L9:
	addl	$1, -12(%rbp)
	movq	a2(%rip), %rax
	movq	8+a2(%rip), %rdx
	movq	%rax, a1(%rip)
	movq	%rdx, 8+a1(%rip)
	movq	a(%rip), %rax
	movq	8+a(%rip), %rdx
	movq	%rax, a2(%rip)
	movq	%rdx, 8+a2(%rip)
	jmp	.L10
.L3:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
