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>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
#define BIG 2000000007
 
#define MOD 1000000007
typedef unsigned long long ull;
typedef   signed long long sll;
 
typedef struct {
	int a;
	int b;
} hw;
 
#define N_MAX 200000
#define M_MAX 100000
 
ull n, m, k;
ull h, w;
// ull a[N_MAX];
sll a[N_MAX];
// ull b[N_MAX];
// ull dp[N_MAX][M_MAX + 1];
// char s[N_MAX + 1];
// char t[N_MAX + 1];
// hw arr[N_MAX];
 
void swap_adj(ull *a, ull *b){
	ull tmp = *b;
	*b = *a;
	*a = tmp;
	return;
}

ull divide(ull a, ull b){
	ull x = MOD - 2;
	ull ans = 1;
	while (x) {
		if (x & 1) ans = (ans * b) % MOD;
		b = (b * b) % MOD;
		x /= 2;
	}
	return (a * ans) % MOD;
}
 
int digits(ull x){
	int i = 1;
	while (x >= 10) {
		x /= 10;
		i++;
	}
	return i;
}
 
int min(ull x, ull y){
	return (x < y) ? x : y;
}
 
ull gcd(ull x, ull y){
	if (x < y) {
		return gcd(y, x);
	} else if (y == 0) {
		return x;
	} else {
		return gcd(y, x % y);
	}
}
 
ull bitpow(ull a, ull x){
	ull result = 1;
	while (x) {
		if (x & 1) {
			result *= a;
			result %= MOD;
		}
		x /= 2;
		a = (a * a) % MOD;
	}
	return result;
}

int comp(const void *left, const void *right){
	if ((*(int*)left) < (*(int*)right)) {
		return -1;
	} else if ((*(int*)left) > (*(int*)right)) {
		return +1;
	} else {
		return 0;
	}
}

// int nextroute(int arr[]){
// 	int i = n - 1;
// 	int j, x;
// 	while (arr[i - 1] > arr[i]) i--;

// 	x = n;
// 	for (j = i; j < n; j++) {
// 		if (arr[j] < arr[i - 1]) continue;
// 		if (x == n || arr[x] > arr[j]) x = j;
// 	}
// 	arr[i - 1] ^= arr[x];
// 	arr[x] ^= arr[i - 1];
// 	arr[i - 1] ^= arr[x];

// 	qsort(&arr[i], n - i, sizeof(int), comp);
// 	return 0;
// }

ull solve(){
	int i, j;
	sll left = 0, right = 0;
	sll mindiff;

	for (i = 0; i < n; i++) right += a[i];

	for (i = 0; i < n - 1; i++) {
		sll tmpdiff;

		left += a[i];
		right -= a[i];
		tmpdiff = ((left > right) ? left - right : right - left);
		if (i == 0 || tmpdiff < mindiff) mindiff = tmpdiff;
	}

	printf("%lld\n", mindiff);
 
	return 0;
}
 
int main(void){
	int i, j;
	int x = 0;
 
	scanf("%llu", &n);
	for (i = 0; i < n; i++) {
		scanf("%lld", &a[i]); // signed
	}

	solve();
 
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	m
	.align 8
	.type	m, @object
	.size	m, 8
m:
	.zero	8
	.globl	k
	.align 8
	.type	k, @object
	.size	k, 8
k:
	.zero	8
	.globl	h
	.align 8
	.type	h, @object
	.size	h, 8
h:
	.zero	8
	.globl	w
	.align 8
	.type	w, @object
	.size	w, 8
w:
	.zero	8
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600000
a:
	.zero	1600000
	.text
	.globl	swap_adj
	.type	swap_adj, @function
swap_adj:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-32(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rdx
	movq	-32(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	swap_adj, .-swap_adj
	.globl	divide
	.type	divide, @function
divide:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	$1000000005, -16(%rbp)
	movq	$1, -8(%rbp)
	jmp	.L4
.L6:
	movq	-16(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	je	.L5
	movq	-8(%rbp), %rax
	imulq	-32(%rbp), %rax
	movq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -8(%rbp)
.L5:
	movq	-32(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	movq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -32(%rbp)
	movq	-16(%rbp), %rax
	shrq	%rax
	movq	%rax, -16(%rbp)
.L4:
	cmpq	$0, -16(%rbp)
	jne	.L6
	movq	-24(%rbp), %rax
	imulq	-8(%rbp), %rax
	movq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	divide, .-divide
	.globl	digits
	.type	digits, @function
digits:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	$1, -4(%rbp)
	jmp	.L9
.L10:
	movq	-24(%rbp), %rax
	movabsq	$-3689348814741910323, %rdx
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$3, %rax
	movq	%rax, -24(%rbp)
	addl	$1, -4(%rbp)
.L9:
	cmpq	$9, -24(%rbp)
	ja	.L10
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	digits, .-digits
	.globl	min
	.type	min, @function
min:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovbe	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	min, .-min
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB10:
	.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
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jnb	.L15
	movq	-8(%rbp), %rdx
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	jmp	.L16
.L15:
	cmpq	$0, -16(%rbp)
	jne	.L17
	movq	-8(%rbp), %rax
	jmp	.L16
.L17:
	movq	-8(%rbp), %rax
	movl	$0, %edx
	divq	-16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	gcd, .-gcd
	.globl	bitpow
	.type	bitpow, @function
bitpow:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	$1, -8(%rbp)
	jmp	.L19
.L21:
	movq	-32(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	je	.L20
	movq	-8(%rbp), %rax
	imulq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -8(%rbp)
.L20:
	movq	-32(%rbp), %rax
	shrq	%rax
	movq	%rax, -32(%rbp)
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	movq	%rax, -24(%rbp)
	movq	-24(%rbp), %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -24(%rbp)
.L19:
	cmpq	$0, -32(%rbp)
	jne	.L21
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	bitpow, .-bitpow
	.globl	comp
	.type	comp, @function
comp:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L24
	movl	$-1, %eax
	jmp	.L25
.L24:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L26
	movl	$1, %eax
	jmp	.L25
.L26:
	movl	$0, %eax
.L25:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	comp, .-comp
	.section	.rodata
.LC0:
	.string	"%lld\n"
	.text
	.globl	solve
	.type	solve, @function
solve:
.LFB13:
	.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	$0, -32(%rbp)
	movq	$0, -24(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L28
.L29:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, -24(%rbp)
	addl	$1, -36(%rbp)
.L28:
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jb	.L29
	movl	$0, -36(%rbp)
	jmp	.L30
.L35:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	subq	%rax, -24(%rbp)
	movq	-32(%rbp), %rax
	cmpq	-24(%rbp), %rax
	jle	.L31
	movq	-32(%rbp), %rax
	subq	-24(%rbp), %rax
	jmp	.L32
.L31:
	movq	-24(%rbp), %rax
	subq	-32(%rbp), %rax
.L32:
	movq	%rax, -8(%rbp)
	cmpl	$0, -36(%rbp)
	je	.L33
	movq	-8(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jge	.L34
.L33:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
.L34:
	addl	$1, -36(%rbp)
.L30:
	movl	-36(%rbp), %eax
	cltq
	movq	n(%rip), %rdx
	subq	$1, %rdx
	cmpq	%rdx, %rax
	jb	.L35
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	solve, .-solve
	.section	.rodata
.LC1:
	.string	"%llu"
.LC2:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB14:
	.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, -4(%rbp)
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -8(%rbp)
	jmp	.L38
.L39:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L38:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jb	.L39
	movl	$0, %eax
	call	solve
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.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	swap_adj
	.type	swap_adj, @function
swap_adj:
.LFB51:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rax
	movq	(%rdi), %rdx
	movq	%rdx, (%rsi)
	movq	%rax, (%rdi)
	ret
	.cfi_endproc
.LFE51:
	.size	swap_adj, .-swap_adj
	.p2align 4
	.globl	divide
	.type	divide, @function
divide:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	$30, %r8d
	movq	%rdi, %rbx
	movl	$1, %ecx
	movabsq	$-8543223828751151131, %r11
	movl	$1000000005, %edi
	.p2align 4,,10
	.p2align 3
.L5:
	testb	$1, %dil
	je	.L4
	imulq	%rsi, %rcx
	movq	%rcx, %rax
	mulq	%r11
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rcx
.L4:
	imulq	%rsi, %rsi
	shrq	%rdi
	movq	%rsi, %rax
	movq	%rsi, %r9
	mulq	%r11
	movq	%rdx, %rsi
	shrq	$29, %rsi
	imulq	$1000000007, %rsi, %r10
	movq	%r9, %rsi
	subq	%r10, %rsi
	subl	$1, %r8d
	jne	.L5
	imulq	%rcx, %rbx
	movq	%rbx, %rax
	mulq	%r11
	movq	%rdx, %rax
	shrq	$29, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rbx, %rax
	popq	%rbx
	.cfi_def_cfa_offset 8
	subq	%rdx, %rax
	ret
	.cfi_endproc
.LFE52:
	.size	divide, .-divide
	.p2align 4
	.globl	digits
	.type	digits, @function
digits:
.LFB53:
	.cfi_startproc
	endbr64
	movq	%rdi, %rdx
	movl	$1, %r8d
	cmpq	$9, %rdi
	jbe	.L11
	movabsq	$-3689348814741910323, %rsi
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%rdx, %rax
	movq	%rdx, %rcx
	addl	$1, %r8d
	mulq	%rsi
	shrq	$3, %rdx
	cmpq	$99, %rcx
	ja	.L13
.L11:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE53:
	.size	digits, .-digits
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB54:
	.cfi_startproc
	endbr64
	cmpq	%rdi, %rsi
	cmovbe	%rsi, %rdi
	movq	%rdi, %rax
	ret
	.cfi_endproc
.LFE54:
	.size	min, .-min
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB55:
	.cfi_startproc
	endbr64
	movq	%rdi, %rdx
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L22:
	xorl	%edx, %edx
	divq	%rsi
.L19:
	movq	%rdx, %rax
	movq	%rsi, %rdx
	movq	%rax, %rsi
.L18:
	cmpq	%rsi, %rdx
	jb	.L19
	movq	%rdx, %rax
	testq	%rsi, %rsi
	jne	.L22
	ret
	.cfi_endproc
.LFE55:
	.size	gcd, .-gcd
	.p2align 4
	.globl	bitpow
	.type	bitpow, @function
bitpow:
.LFB56:
	.cfi_startproc
	endbr64
	movl	$1, %r8d
	testq	%rsi, %rsi
	je	.L23
	movabsq	$-8543223828751151131, %r9
	.p2align 4,,10
	.p2align 3
.L26:
	testb	$1, %sil
	je	.L25
	movq	%r8, %rcx
	imulq	%rdi, %rcx
	movq	%rcx, %rax
	mulq	%r9
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rcx
	movq	%rcx, %r8
.L25:
	movq	%rdi, %rcx
	imulq	%rdi, %rcx
	movq	%rcx, %rax
	mulq	%r9
	movq	%rdx, %rdi
	shrq	$29, %rdi
	imulq	$1000000007, %rdi, %rax
	subq	%rax, %rcx
	shrq	%rsi
	movq	%rcx, %rdi
	jne	.L26
.L23:
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE56:
	.size	bitpow, .-bitpow
	.p2align 4
	.globl	comp
	.type	comp, @function
comp:
.LFB57:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	cmpl	%eax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE57:
	.size	comp, .-comp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld\n"
	.text
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB58:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movq	n(%rip), %rdx
	testq	%rdx, %rdx
	je	.L46
	cmpq	$1, %rdx
	je	.L47
	movq	%rdx, %rcx
	leaq	a(%rip), %r8
	pxor	%xmm0, %xmm0
	shrq	%rcx
	movq	%r8, %rax
	salq	$4, %rcx
	addq	%r8, %rcx
	.p2align 4,,10
	.p2align 3
.L38:
	paddq	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L38
	movdqa	%xmm0, %xmm1
	movq	%rdx, %rsi
	psrldq	$8, %xmm1
	andq	$-2, %rsi
	paddq	%xmm1, %xmm0
	movslq	%esi, %rcx
	movq	%xmm0, %rax
	cmpq	%rsi, %rdx
	je	.L59
.L37:
	movq	%rdx, %rdi
	addq	(%r8,%rcx,8), %rax
	subq	$1, %rdi
	je	.L40
.L36:
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	jmp	.L45
	.p2align 4,,10
	.p2align 3
.L43:
	addq	$1, %rcx
	cmpq	%rdi, %rcx
	jnb	.L40
.L45:
	addq	(%r8,%rcx,8), %rdx
	subq	(%r8,%rcx,8), %rax
	movq	%rdx, %r9
	movq	%rax, %rsi
	subq	%rax, %r9
	subq	%rdx, %rsi
	cmpq	%rdx, %rax
	cmovl	%r9, %rsi
	cmpq	%r10, %rsi
	jl	.L48
	testl	%ecx, %ecx
	jne	.L43
.L48:
	addq	$1, %rcx
	movq	%rsi, %r10
	cmpq	%rdi, %rcx
	jb	.L45
.L40:
	movq	%r10, %rdx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L59:
	.cfi_restore_state
	leaq	-1(%rdx), %rdi
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L46:
	movq	$-1, %rdi
	xorl	%eax, %eax
	leaq	a(%rip), %r8
	jmp	.L36
.L47:
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	leaq	a(%rip), %r8
	jmp	.L37
	.cfi_endproc
.LFE58:
	.size	solve, .-solve
	.section	.rodata.str1.1
.LC1:
	.string	"%llu"
.LC2:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB59:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%eax, %eax
	leaq	n(%rip), %rsi
	leaq	.LC1(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	call	__isoc99_scanf@PLT
	cmpq	$0, n(%rip)
	je	.L61
	leaq	a(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	.LC2(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L62:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	addq	$1, %rbx
	call	__isoc99_scanf@PLT
	addq	$8, %rbp
	cmpq	%rbx, n(%rip)
	ja	.L62
.L61:
	xorl	%eax, %eax
	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
.LFE59:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1600000
a:
	.zero	1600000
	.globl	w
	.align 8
	.type	w, @object
	.size	w, 8
w:
	.zero	8
	.globl	h
	.align 8
	.type	h, @object
	.size	h, 8
h:
	.zero	8
	.globl	k
	.align 8
	.type	k, @object
	.size	k, 8
k:
	.zero	8
	.globl	m
	.align 8
	.type	m, @object
	.size	m, 8
m:
	.zero	8
	.globl	n
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.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	swap_adj
	.type	swap_adj, @function
swap_adj:
.LFB51:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rax
	movq	(%rdi), %rdx
	movq	%rdx, (%rsi)
	movq	%rax, (%rdi)
	ret
	.cfi_endproc
.LFE51:
	.size	swap_adj, .-swap_adj
	.p2align 4
	.globl	divide
	.type	divide, @function
divide:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	$30, %r8d
	movq	%rdi, %rbx
	movl	$1, %ecx
	movabsq	$-8543223828751151131, %r11
	movl	$1000000005, %edi
	.p2align 4,,10
	.p2align 3
.L5:
	testb	$1, %dil
	je	.L4
	imulq	%rsi, %rcx
	movq	%rcx, %rax
	mulq	%r11
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rcx
.L4:
	imulq	%rsi, %rsi
	shrq	%rdi
	movq	%rsi, %rax
	movq	%rsi, %r9
	mulq	%r11
	movq	%rdx, %rsi
	shrq	$29, %rsi
	imulq	$1000000007, %rsi, %r10
	movq	%r9, %rsi
	subq	%r10, %rsi
	subl	$1, %r8d
	jne	.L5
	imulq	%rcx, %rbx
	movq	%rbx, %rax
	mulq	%r11
	movq	%rdx, %rax
	shrq	$29, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rbx, %rax
	popq	%rbx
	.cfi_def_cfa_offset 8
	subq	%rdx, %rax
	ret
	.cfi_endproc
.LFE52:
	.size	divide, .-divide
	.p2align 4
	.globl	digits
	.type	digits, @function
digits:
.LFB53:
	.cfi_startproc
	endbr64
	movq	%rdi, %rdx
	movl	$1, %r8d
	cmpq	$9, %rdi
	jbe	.L11
	movabsq	$-3689348814741910323, %rsi
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%rdx, %rax
	movq	%rdx, %rcx
	addl	$1, %r8d
	mulq	%rsi
	shrq	$3, %rdx
	cmpq	$99, %rcx
	ja	.L13
.L11:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE53:
	.size	digits, .-digits
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB54:
	.cfi_startproc
	endbr64
	cmpq	%rdi, %rsi
	cmovbe	%rsi, %rdi
	movq	%rdi, %rax
	ret
	.cfi_endproc
.LFE54:
	.size	min, .-min
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB55:
	.cfi_startproc
	endbr64
	movq	%rdi, %rdx
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L22:
	xorl	%edx, %edx
	divq	%rsi
.L19:
	movq	%rdx, %rax
	movq	%rsi, %rdx
	movq	%rax, %rsi
.L18:
	cmpq	%rsi, %rdx
	jb	.L19
	movq	%rdx, %rax
	testq	%rsi, %rsi
	jne	.L22
	ret
	.cfi_endproc
.LFE55:
	.size	gcd, .-gcd
	.p2align 4
	.globl	bitpow
	.type	bitpow, @function
bitpow:
.LFB56:
	.cfi_startproc
	endbr64
	movl	$1, %r8d
	testq	%rsi, %rsi
	je	.L23
	movabsq	$-8543223828751151131, %r9
	.p2align 4,,10
	.p2align 3
.L26:
	testb	$1, %sil
	je	.L25
	movq	%r8, %rcx
	imulq	%rdi, %rcx
	movq	%rcx, %rax
	mulq	%r9
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rcx
	movq	%rcx, %r8
.L25:
	movq	%rdi, %rcx
	imulq	%rdi, %rcx
	movq	%rcx, %rax
	mulq	%r9
	movq	%rdx, %rdi
	shrq	$29, %rdi
	imulq	$1000000007, %rdi, %rax
	subq	%rax, %rcx
	shrq	%rsi
	movq	%rcx, %rdi
	jne	.L26
.L23:
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE56:
	.size	bitpow, .-bitpow
	.p2align 4
	.globl	comp
	.type	comp, @function
comp:
.LFB57:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	cmpl	%eax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE57:
	.size	comp, .-comp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld\n"
	.text
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB58:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movq	n(%rip), %rdx
	testq	%rdx, %rdx
	je	.L46
	cmpq	$1, %rdx
	je	.L47
	movq	%rdx, %rcx
	leaq	a(%rip), %r8
	pxor	%xmm0, %xmm0
	shrq	%rcx
	movq	%r8, %rax
	salq	$4, %rcx
	addq	%r8, %rcx
	.p2align 4,,10
	.p2align 3
.L38:
	paddq	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L38
	movdqa	%xmm0, %xmm1
	movq	%rdx, %rsi
	psrldq	$8, %xmm1
	andq	$-2, %rsi
	paddq	%xmm1, %xmm0
	movslq	%esi, %rcx
	movq	%xmm0, %rax
	cmpq	%rsi, %rdx
	je	.L59
.L37:
	movq	%rdx, %rdi
	addq	(%r8,%rcx,8), %rax
	subq	$1, %rdi
	je	.L40
.L36:
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	jmp	.L45
	.p2align 4,,10
	.p2align 3
.L43:
	addq	$1, %rcx
	cmpq	%rdi, %rcx
	jnb	.L40
.L45:
	addq	(%r8,%rcx,8), %rdx
	subq	(%r8,%rcx,8), %rax
	movq	%rdx, %r9
	movq	%rax, %rsi
	subq	%rax, %r9
	subq	%rdx, %rsi
	cmpq	%rdx, %rax
	cmovl	%r9, %rsi
	cmpq	%r10, %rsi
	jl	.L48
	testl	%ecx, %ecx
	jne	.L43
.L48:
	addq	$1, %rcx
	movq	%rsi, %r10
	cmpq	%rdi, %rcx
	jb	.L45
.L40:
	movq	%r10, %rdx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L59:
	.cfi_restore_state
	leaq	-1(%rdx), %rdi
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L46:
	movq	$-1, %rdi
	xorl	%eax, %eax
	leaq	a(%rip), %r8
	jmp	.L36
.L47:
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	leaq	a(%rip), %r8
	jmp	.L37
	.cfi_endproc
.LFE58:
	.size	solve, .-solve
	.section	.rodata.str1.1
.LC1:
	.string	"%llu"
.LC2:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB59:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%eax, %eax
	leaq	n(%rip), %rsi
	leaq	.LC1(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	call	__isoc99_scanf@PLT
	cmpq	$0, n(%rip)
	je	.L61
	leaq	a(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	.LC2(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L62:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	addq	$1, %rbx
	call	__isoc99_scanf@PLT
	addq	$8, %rbp
	cmpq	%rbx, n(%rip)
	ja	.L62
.L61:
	xorl	%eax, %eax
	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
.LFE59:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1600000
a:
	.zero	1600000
	.globl	w
	.align 8
	.type	w, @object
	.size	w, 8
w:
	.zero	8
	.globl	h
	.align 8
	.type	h, @object
	.size	h, 8
h:
	.zero	8
	.globl	k
	.align 8
	.type	k, @object
	.size	k, 8
k:
	.zero	8
	.globl	m
	.align 8
	.type	m, @object
	.size	m, 8
m:
	.zero	8
	.globl	n
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.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>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
#define BIG 2000000007
 
#define MOD 1000000007
typedef unsigned long long ull;
typedef   signed long long sll;
 
typedef struct {
	int a;
	int b;
} hw;
 
#define N_MAX 200000
#define M_MAX 100000
 
ull n, m, k;
ull h, w;
// ull a[N_MAX];
sll a[N_MAX];
// ull b[N_MAX];
// ull dp[N_MAX][M_MAX + 1];
// char s[N_MAX + 1];
// char t[N_MAX + 1];
// hw arr[N_MAX];
 
void swap_adj(ull *a, ull *b){
	ull tmp = *b;
	*b = *a;
	*a = tmp;
	return;
}

ull divide(ull a, ull b){
	ull x = MOD - 2;
	ull ans = 1;
	while (x) {
		if (x & 1) ans = (ans * b) % MOD;
		b = (b * b) % MOD;
		x /= 2;
	}
	return (a * ans) % MOD;
}
 
int digits(ull x){
	int i = 1;
	while (x >= 10) {
		x /= 10;
		i++;
	}
	return i;
}
 
int min(ull x, ull y){
	return (x < y) ? x : y;
}
 
ull gcd(ull x, ull y){
	if (x < y) {
		return gcd(y, x);
	} else if (y == 0) {
		return x;
	} else {
		return gcd(y, x % y);
	}
}
 
ull bitpow(ull a, ull x){
	ull result = 1;
	while (x) {
		if (x & 1) {
			result *= a;
			result %= MOD;
		}
		x /= 2;
		a = (a * a) % MOD;
	}
	return result;
}

int comp(const void *left, const void *right){
	if ((*(int*)left) < (*(int*)right)) {
		return -1;
	} else if ((*(int*)left) > (*(int*)right)) {
		return +1;
	} else {
		return 0;
	}
}

// int nextroute(int arr[]){
// 	int i = n - 1;
// 	int j, x;
// 	while (arr[i - 1] > arr[i]) i--;

// 	x = n;
// 	for (j = i; j < n; j++) {
// 		if (arr[j] < arr[i - 1]) continue;
// 		if (x == n || arr[x] > arr[j]) x = j;
// 	}
// 	arr[i - 1] ^= arr[x];
// 	arr[x] ^= arr[i - 1];
// 	arr[i - 1] ^= arr[x];

// 	qsort(&arr[i], n - i, sizeof(int), comp);
// 	return 0;
// }

ull solve(){
	int i, j;
	sll left = 0, right = 0;
	sll mindiff;

	for (i = 0; i < n; i++) right += a[i];

	for (i = 0; i < n - 1; i++) {
		sll tmpdiff;

		left += a[i];
		right -= a[i];
		tmpdiff = ((left > right) ? left - right : right - left);
		if (i == 0 || tmpdiff < mindiff) mindiff = tmpdiff;
	}

	printf("%lld\n", mindiff);
 
	return 0;
}
 
int main(void){
	int i, j;
	int x = 0;
 
	scanf("%llu", &n);
	for (i = 0; i < n; i++) {
		scanf("%lld", &a[i]); // signed
	}

	solve();
 
	return 0;
}

6
1 2 3 4 5 6

1

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>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
#define BIG 2000000007
 
#define MOD 1000000007
typedef unsigned long long ull;
typedef   signed long long sll;
 
typedef struct {
	int a;
	int b;
} hw;
 
#define N_MAX 200000
#define M_MAX 100000
 
ull n, m, k;
ull h, w;
// ull a[N_MAX];
sll a[N_MAX];
// ull b[N_MAX];
// ull dp[N_MAX][M_MAX + 1];
// char s[N_MAX + 1];
// char t[N_MAX + 1];
// hw arr[N_MAX];
 
void swap_adj(ull *a, ull *b){
	ull tmp = *b;
	*b = *a;
	*a = tmp;
	return;
}

ull divide(ull a, ull b){
	ull x = MOD - 2;
	ull ans = 1;
	while (x) {
		if (x & 1) ans = (ans * b) % MOD;
		b = (b * b) % MOD;
		x /= 2;
	}
	return (a * ans) % MOD;
}
 
int digits(ull x){
	int i = 1;
	while (x >= 10) {
		x /= 10;
		i++;
	}
	return i;
}
 
int min(ull x, ull y){
	return (x < y) ? x : y;
}
 
ull gcd(ull x, ull y){
	if (x < y) {
		return gcd(y, x);
	} else if (y == 0) {
		return x;
	} else {
		return gcd(y, x % y);
	}
}
 
ull bitpow(ull a, ull x){
	ull result = 1;
	while (x) {
		if (x & 1) {
			result *= a;
			result %= MOD;
		}
		x /= 2;
		a = (a * a) % MOD;
	}
	return result;
}

int comp(const void *left, const void *right){
	if ((*(int*)left) < (*(int*)right)) {
		return -1;
	} else if ((*(int*)left) > (*(int*)right)) {
		return +1;
	} else {
		return 0;
	}
}

// int nextroute(int arr[]){
// 	int i = n - 1;
// 	int j, x;
// 	while (arr[i - 1] > arr[i]) i--;

// 	x = n;
// 	for (j = i; j < n; j++) {
// 		if (arr[j] < arr[i - 1]) continue;
// 		if (x == n || arr[x] > arr[j]) x = j;
// 	}
// 	arr[i - 1] ^= arr[x];
// 	arr[x] ^= arr[i - 1];
// 	arr[i - 1] ^= arr[x];

// 	qsort(&arr[i], n - i, sizeof(int), comp);
// 	return 0;
// }

ull solve(){
	int i, j;
	sll left = 0, right = 0;
	sll mindiff;

	for (i = 0; i < n; i++) right += a[i];

	for (i = 0; i < n - 1; i++) {
		sll tmpdiff;

		left += a[i];
		right -= a[i];
		tmpdiff = ((left > right) ? left - right : right - left);
		if (i == 0 || tmpdiff < mindiff) mindiff = tmpdiff;
	}

	printf("%lld\n", mindiff);
 
	return 0;
}
 
int main(void){
	int i, j;
	int x = 0;
 
	scanf("%llu", &n);
	for (i = 0; i < n; i++) {
		scanf("%lld", &a[i]); // signed
	}

	solve();
 
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	m
	.align 8
	.type	m, @object
	.size	m, 8
m:
	.zero	8
	.globl	k
	.align 8
	.type	k, @object
	.size	k, 8
k:
	.zero	8
	.globl	h
	.align 8
	.type	h, @object
	.size	h, 8
h:
	.zero	8
	.globl	w
	.align 8
	.type	w, @object
	.size	w, 8
w:
	.zero	8
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600000
a:
	.zero	1600000
	.text
	.globl	swap_adj
	.type	swap_adj, @function
swap_adj:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-32(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rdx
	movq	-32(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	swap_adj, .-swap_adj
	.globl	divide
	.type	divide, @function
divide:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	$1000000005, -16(%rbp)
	movq	$1, -8(%rbp)
	jmp	.L4
.L6:
	movq	-16(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	je	.L5
	movq	-8(%rbp), %rax
	imulq	-32(%rbp), %rax
	movq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -8(%rbp)
.L5:
	movq	-32(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	movq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -32(%rbp)
	movq	-16(%rbp), %rax
	shrq	%rax
	movq	%rax, -16(%rbp)
.L4:
	cmpq	$0, -16(%rbp)
	jne	.L6
	movq	-24(%rbp), %rax
	imulq	-8(%rbp), %rax
	movq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	divide, .-divide
	.globl	digits
	.type	digits, @function
digits:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	$1, -4(%rbp)
	jmp	.L9
.L10:
	movq	-24(%rbp), %rax
	movabsq	$-3689348814741910323, %rdx
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$3, %rax
	movq	%rax, -24(%rbp)
	addl	$1, -4(%rbp)
.L9:
	cmpq	$9, -24(%rbp)
	ja	.L10
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	digits, .-digits
	.globl	min
	.type	min, @function
min:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovbe	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	min, .-min
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB10:
	.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
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jnb	.L15
	movq	-8(%rbp), %rdx
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	jmp	.L16
.L15:
	cmpq	$0, -16(%rbp)
	jne	.L17
	movq	-8(%rbp), %rax
	jmp	.L16
.L17:
	movq	-8(%rbp), %rax
	movl	$0, %edx
	divq	-16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	gcd, .-gcd
	.globl	bitpow
	.type	bitpow, @function
bitpow:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	$1, -8(%rbp)
	jmp	.L19
.L21:
	movq	-32(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	je	.L20
	movq	-8(%rbp), %rax
	imulq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -8(%rbp)
.L20:
	movq	-32(%rbp), %rax
	shrq	%rax
	movq	%rax, -32(%rbp)
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	movq	%rax, -24(%rbp)
	movq	-24(%rbp), %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -24(%rbp)
.L19:
	cmpq	$0, -32(%rbp)
	jne	.L21
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	bitpow, .-bitpow
	.globl	comp
	.type	comp, @function
comp:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L24
	movl	$-1, %eax
	jmp	.L25
.L24:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L26
	movl	$1, %eax
	jmp	.L25
.L26:
	movl	$0, %eax
.L25:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	comp, .-comp
	.section	.rodata
.LC0:
	.string	"%lld\n"
	.text
	.globl	solve
	.type	solve, @function
solve:
.LFB13:
	.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	$0, -32(%rbp)
	movq	$0, -24(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L28
.L29:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, -24(%rbp)
	addl	$1, -36(%rbp)
.L28:
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jb	.L29
	movl	$0, -36(%rbp)
	jmp	.L30
.L35:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	subq	%rax, -24(%rbp)
	movq	-32(%rbp), %rax
	cmpq	-24(%rbp), %rax
	jle	.L31
	movq	-32(%rbp), %rax
	subq	-24(%rbp), %rax
	jmp	.L32
.L31:
	movq	-24(%rbp), %rax
	subq	-32(%rbp), %rax
.L32:
	movq	%rax, -8(%rbp)
	cmpl	$0, -36(%rbp)
	je	.L33
	movq	-8(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jge	.L34
.L33:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
.L34:
	addl	$1, -36(%rbp)
.L30:
	movl	-36(%rbp), %eax
	cltq
	movq	n(%rip), %rdx
	subq	$1, %rdx
	cmpq	%rdx, %rax
	jb	.L35
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	solve, .-solve
	.section	.rodata
.LC1:
	.string	"%llu"
.LC2:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB14:
	.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, -4(%rbp)
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -8(%rbp)
	jmp	.L38
.L39:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L38:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jb	.L39
	movl	$0, %eax
	call	solve
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.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	n
	.bss
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	m
	.align 8
	.type	m, @object
	.size	m, 8
m:
	.zero	8
	.globl	k
	.align 8
	.type	k, @object
	.size	k, 8
k:
	.zero	8
	.globl	h
	.align 8
	.type	h, @object
	.size	h, 8
h:
	.zero	8
	.globl	w
	.align 8
	.type	w, @object
	.size	w, 8
w:
	.zero	8
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600000
a:
	.zero	1600000
	.text
	.globl	swap_adj
	.type	swap_adj, @function
swap_adj:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-32(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rdx
	movq	-32(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	swap_adj, .-swap_adj
	.globl	divide
	.type	divide, @function
divide:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	$1000000005, -16(%rbp)
	movq	$1, -8(%rbp)
	jmp	.L4
.L6:
	movq	-16(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	je	.L5
	movq	-8(%rbp), %rax
	imulq	-32(%rbp), %rax
	movq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -8(%rbp)
.L5:
	movq	-32(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	movq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -32(%rbp)
	movq	-16(%rbp), %rax
	shrq	%rax
	movq	%rax, -16(%rbp)
.L4:
	cmpq	$0, -16(%rbp)
	jne	.L6
	movq	-24(%rbp), %rax
	imulq	-8(%rbp), %rax
	movq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	divide, .-divide
	.globl	digits
	.type	digits, @function
digits:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	$1, -4(%rbp)
	jmp	.L9
.L10:
	movq	-24(%rbp), %rax
	movabsq	$-3689348814741910323, %rdx
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$3, %rax
	movq	%rax, -24(%rbp)
	addl	$1, -4(%rbp)
.L9:
	cmpq	$9, -24(%rbp)
	ja	.L10
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	digits, .-digits
	.globl	min
	.type	min, @function
min:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovbe	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	min, .-min
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB10:
	.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
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jnb	.L15
	movq	-8(%rbp), %rdx
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	jmp	.L16
.L15:
	cmpq	$0, -16(%rbp)
	jne	.L17
	movq	-8(%rbp), %rax
	jmp	.L16
.L17:
	movq	-8(%rbp), %rax
	movl	$0, %edx
	divq	-16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	gcd, .-gcd
	.globl	bitpow
	.type	bitpow, @function
bitpow:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	$1, -8(%rbp)
	jmp	.L19
.L21:
	movq	-32(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	je	.L20
	movq	-8(%rbp), %rax
	imulq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -8(%rbp)
.L20:
	movq	-32(%rbp), %rax
	shrq	%rax
	movq	%rax, -32(%rbp)
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	movq	%rax, -24(%rbp)
	movq	-24(%rbp), %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -24(%rbp)
.L19:
	cmpq	$0, -32(%rbp)
	jne	.L21
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	bitpow, .-bitpow
	.globl	comp
	.type	comp, @function
comp:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L24
	movl	$-1, %eax
	jmp	.L25
.L24:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L26
	movl	$1, %eax
	jmp	.L25
.L26:
	movl	$0, %eax
.L25:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	comp, .-comp
	.section	.rodata
.LC0:
	.string	"%lld\n"
	.text
	.globl	solve
	.type	solve, @function
solve:
.LFB13:
	.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	$0, -32(%rbp)
	movq	$0, -24(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L28
.L29:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, -24(%rbp)
	addl	$1, -36(%rbp)
.L28:
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jb	.L29
	movl	$0, -36(%rbp)
	jmp	.L30
.L35:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	subq	%rax, -24(%rbp)
	movq	-32(%rbp), %rax
	cmpq	-24(%rbp), %rax
	jle	.L31
	movq	-32(%rbp), %rax
	subq	-24(%rbp), %rax
	jmp	.L32
.L31:
	movq	-24(%rbp), %rax
	subq	-32(%rbp), %rax
.L32:
	movq	%rax, -8(%rbp)
	cmpl	$0, -36(%rbp)
	je	.L33
	movq	-8(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jge	.L34
.L33:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
.L34:
	addl	$1, -36(%rbp)
.L30:
	movl	-36(%rbp), %eax
	cltq
	movq	n(%rip), %rdx
	subq	$1, %rdx
	cmpq	%rdx, %rax
	jb	.L35
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	solve, .-solve
	.section	.rodata
.LC1:
	.string	"%llu"
.LC2:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB14:
	.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, -4(%rbp)
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -8(%rbp)
	jmp	.L38
.L39:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L38:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jb	.L39
	movl	$0, %eax
	call	solve
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.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:
