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

```c
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void swap_int(int *x, int *y) {int temp;temp = *x;*x = *y;*y = temp;}
void swap_char(char *x, char *y) {char temp;temp = *x;*x = *y;*y = temp;}
int max(int x, int y) { return x > y ? x : y; }
int min(int x, int y) { return x > y ? y : x; }
int fsum(int x){
    char str[1000];
    sprintf(str,"%d",x);
    int sum=0;
    for(int i=0;str[i]!='\0';i++)sum+=str[i]-0x30;
    return sum;
}
int main(){
    int N;
    int a,b;
    int i,j,k;
    int min=999999;

    scanf("%d",&N);

    for(i=1;i<=N/2;i++){
        a=i;
        b=N-a;
        if(min>fsum(a)+fsum(b))min=fsum(a)+fsum(b);
    }
    printf("%d\n",min);
    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	swap_int
	.type	swap_int, @function
swap_int:
.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	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	swap_int, .-swap_int
	.globl	swap_char
	.type	swap_char, @function
swap_char:
.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	-24(%rbp), %rax
	movzbl	(%rax), %eax
	movb	%al, -1(%rbp)
	movq	-32(%rbp), %rax
	movzbl	(%rax), %edx
	movq	-24(%rbp), %rax
	movb	%dl, (%rax)
	movq	-32(%rbp), %rax
	movzbl	-1(%rbp), %edx
	movb	%dl, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	swap_char, .-swap_char
	.globl	max
	.type	max, @function
max:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	max, .-max
	.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
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	min, .-min
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	fsum
	.type	fsum, @function
fsum:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$1040, %rsp
	movl	%edi, -1028(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	-1028(%rbp), %edx
	leaq	-1008(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
	movl	$0, -1016(%rbp)
	movl	$0, -1012(%rbp)
	jmp	.L8
.L9:
	movl	-1012(%rbp), %eax
	cltq
	movzbl	-1008(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	addl	%eax, -1016(%rbp)
	addl	$1, -1012(%rbp)
.L8:
	movl	-1012(%rbp), %eax
	cltq
	movzbl	-1008(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L9
	movl	-1016(%rbp), %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	fsum, .-fsum
	.section	.rodata
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB11:
	.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	$40, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$999999, -36(%rbp)
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -40(%rbp)
	jmp	.L13
.L15:
	movl	-40(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-44(%rbp), %eax
	subl	-32(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	fsum
	movl	%eax, %ebx
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	fsum
	addl	%ebx, %eax
	cmpl	%eax, -36(%rbp)
	jle	.L14
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	fsum
	movl	%eax, %ebx
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	fsum
	addl	%ebx, %eax
	movl	%eax, -36(%rbp)
.L14:
	addl	$1, -40(%rbp)
.L13:
	movl	-44(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -40(%rbp)
	jle	.L15
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.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_int
	.type	swap_int, @function
swap_int:
.LFB51:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	movl	(%rsi), %edx
	movl	%edx, (%rdi)
	movl	%eax, (%rsi)
	ret
	.cfi_endproc
.LFE51:
	.size	swap_int, .-swap_int
	.p2align 4
	.globl	swap_char
	.type	swap_char, @function
swap_char:
.LFB52:
	.cfi_startproc
	endbr64
	movzbl	(%rdi), %eax
	movzbl	(%rsi), %edx
	movb	%dl, (%rdi)
	movb	%al, (%rsi)
	ret
	.cfi_endproc
.LFE52:
	.size	swap_char, .-swap_char
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB53:
	.cfi_startproc
	endbr64
	cmpl	%edi, %esi
	movl	%edi, %eax
	cmovge	%esi, %eax
	ret
	.cfi_endproc
.LFE53:
	.size	max, .-max
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB54:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE54:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.text
	.p2align 4
	.globl	fsum
	.type	fsum, @function
fsum:
.LFB55:
	.cfi_startproc
	endbr64
	subq	$1016, %rsp
	.cfi_def_cfa_offset 1024
	movl	%edi, %r8d
	movl	$1000, %edx
	movl	$1, %esi
	movq	%fs:40, %rax
	movq	%rax, 1000(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rdi
	leaq	.LC0(%rip), %rcx
	call	__sprintf_chk@PLT
	movsbl	(%rsp), %eax
	testb	%al, %al
	je	.L10
	leaq	1(%rsp), %rdx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L8:
	addq	$1, %rdx
	leal	-48(%r8,%rax), %r8d
	movsbl	-1(%rdx), %eax
	testb	%al, %al
	jne	.L8
.L6:
	movq	1000(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	movl	%r8d, %eax
	addq	$1016, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L6
.L13:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE55:
	.size	fsum, .-fsum
	.section	.rodata.str1.1
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB56:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	$999999, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	cmpl	$1, %edx
	jle	.L15
	movl	$1, %r13d
	.p2align 4,,10
	.p2align 3
.L18:
	subl	%r13d, %edx
	movl	%r13d, %edi
	movl	%edx, %ebp
	call	fsum
	movl	%ebp, %edi
	movl	%eax, %ebx
	call	fsum
	addl	%eax, %ebx
	cmpl	%r12d, %ebx
	jl	.L22
	movl	4(%rsp), %edx
	addl	$1, %r13d
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cmpl	%r13d, %eax
	jge	.L18
.L15:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L22:
	.cfi_restore_state
	movl	%r13d, %edi
	addl	$1, %r13d
	call	fsum
	movl	%ebp, %edi
	movl	%eax, %r12d
	call	fsum
	movl	4(%rsp), %edx
	addl	%eax, %r12d
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, %r13d
	jle	.L18
	jmp	.L15
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE56:
	.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	swap_int
	.type	swap_int, @function
swap_int:
.LFB51:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	movl	(%rsi), %edx
	movl	%edx, (%rdi)
	movl	%eax, (%rsi)
	ret
	.cfi_endproc
.LFE51:
	.size	swap_int, .-swap_int
	.p2align 4
	.globl	swap_char
	.type	swap_char, @function
swap_char:
.LFB52:
	.cfi_startproc
	endbr64
	movzbl	(%rdi), %eax
	movzbl	(%rsi), %edx
	movb	%dl, (%rdi)
	movb	%al, (%rsi)
	ret
	.cfi_endproc
.LFE52:
	.size	swap_char, .-swap_char
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB53:
	.cfi_startproc
	endbr64
	cmpl	%edi, %esi
	movl	%edi, %eax
	cmovge	%esi, %eax
	ret
	.cfi_endproc
.LFE53:
	.size	max, .-max
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB54:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE54:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.text
	.p2align 4
	.globl	fsum
	.type	fsum, @function
fsum:
.LFB55:
	.cfi_startproc
	endbr64
	subq	$1016, %rsp
	.cfi_def_cfa_offset 1024
	movl	%edi, %r8d
	movl	$1000, %edx
	movl	$1, %esi
	movq	%fs:40, %rax
	movq	%rax, 1000(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rdi
	leaq	.LC0(%rip), %rcx
	call	__sprintf_chk@PLT
	movsbl	(%rsp), %eax
	testb	%al, %al
	je	.L10
	leaq	1(%rsp), %rdx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L8:
	addq	$1, %rdx
	leal	-48(%r8,%rax), %r8d
	movsbl	-1(%rdx), %eax
	testb	%al, %al
	jne	.L8
.L6:
	movq	1000(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	movl	%r8d, %eax
	addq	$1016, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L6
.L13:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE55:
	.size	fsum, .-fsum
	.section	.rodata.str1.1
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB56:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	$999999, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	cmpl	$1, %edx
	jle	.L15
	movl	$1, %r13d
	.p2align 4,,10
	.p2align 3
.L18:
	subl	%r13d, %edx
	movl	%r13d, %edi
	movl	%edx, %ebp
	call	fsum
	movl	%ebp, %edi
	movl	%eax, %ebx
	call	fsum
	addl	%eax, %ebx
	cmpl	%r12d, %ebx
	jl	.L22
	movl	4(%rsp), %edx
	addl	$1, %r13d
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cmpl	%r13d, %eax
	jge	.L18
.L15:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L22:
	.cfi_restore_state
	movl	%r13d, %edi
	addl	$1, %r13d
	call	fsum
	movl	%ebp, %edi
	movl	%eax, %r12d
	call	fsum
	movl	4(%rsp), %edx
	addl	%eax, %r12d
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, %r13d
	jle	.L18
	jmp	.L15
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE56:
	.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 <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void swap_int(int *x, int *y) {int temp;temp = *x;*x = *y;*y = temp;}
void swap_char(char *x, char *y) {char temp;temp = *x;*x = *y;*y = temp;}
int max(int x, int y) { return x > y ? x : y; }
int min(int x, int y) { return x > y ? y : x; }
int fsum(int x){
    char str[1000];
    sprintf(str,"%d",x);
    int sum=0;
    for(int i=0;str[i]!='\0';i++)sum+=str[i]-0x30;
    return sum;
}
int main(){
    int N;
    int a,b;
    int i,j,k;
    int min=999999;

    scanf("%d",&N);

    for(i=1;i<=N/2;i++){
        a=i;
        b=N-a;
        if(min>fsum(a)+fsum(b))min=fsum(a)+fsum(b);
    }
    printf("%d\n",min);
    return 0;
}

22
 37
 36
 3
 5
 7
 26
 38
 58
 78

4
 10
 9
 3
 5
 7
 8
 11
 13
 15

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

```c
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void swap_int(int *x, int *y) {int temp;temp = *x;*x = *y;*y = temp;}
void swap_char(char *x, char *y) {char temp;temp = *x;*x = *y;*y = temp;}
int max(int x, int y) { return x > y ? x : y; }
int min(int x, int y) { return x > y ? y : x; }
int fsum(int x){
    char str[1000];
    sprintf(str,"%d",x);
    int sum=0;
    for(int i=0;str[i]!='\0';i++)sum+=str[i]-0x30;
    return sum;
}
int main(){
    int N;
    int a,b;
    int i,j,k;
    int min=999999;

    scanf("%d",&N);

    for(i=1;i<=N/2;i++){
        a=i;
        b=N-a;
        if(min>fsum(a)+fsum(b))min=fsum(a)+fsum(b);
    }
    printf("%d\n",min);
    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	swap_int
	.type	swap_int, @function
swap_int:
.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	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	swap_int, .-swap_int
	.globl	swap_char
	.type	swap_char, @function
swap_char:
.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	-24(%rbp), %rax
	movzbl	(%rax), %eax
	movb	%al, -1(%rbp)
	movq	-32(%rbp), %rax
	movzbl	(%rax), %edx
	movq	-24(%rbp), %rax
	movb	%dl, (%rax)
	movq	-32(%rbp), %rax
	movzbl	-1(%rbp), %edx
	movb	%dl, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	swap_char, .-swap_char
	.globl	max
	.type	max, @function
max:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	max, .-max
	.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
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	min, .-min
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	fsum
	.type	fsum, @function
fsum:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$1040, %rsp
	movl	%edi, -1028(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	-1028(%rbp), %edx
	leaq	-1008(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
	movl	$0, -1016(%rbp)
	movl	$0, -1012(%rbp)
	jmp	.L8
.L9:
	movl	-1012(%rbp), %eax
	cltq
	movzbl	-1008(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	addl	%eax, -1016(%rbp)
	addl	$1, -1012(%rbp)
.L8:
	movl	-1012(%rbp), %eax
	cltq
	movzbl	-1008(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L9
	movl	-1016(%rbp), %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	fsum, .-fsum
	.section	.rodata
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB11:
	.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	$40, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$999999, -36(%rbp)
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -40(%rbp)
	jmp	.L13
.L15:
	movl	-40(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-44(%rbp), %eax
	subl	-32(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	fsum
	movl	%eax, %ebx
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	fsum
	addl	%ebx, %eax
	cmpl	%eax, -36(%rbp)
	jle	.L14
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	fsum
	movl	%eax, %ebx
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	fsum
	addl	%ebx, %eax
	movl	%eax, -36(%rbp)
.L14:
	addl	$1, -40(%rbp)
.L13:
	movl	-44(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -40(%rbp)
	jle	.L15
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.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	swap_int
	.type	swap_int, @function
swap_int:
.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	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	swap_int, .-swap_int
	.globl	swap_char
	.type	swap_char, @function
swap_char:
.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	-24(%rbp), %rax
	movzbl	(%rax), %eax
	movb	%al, -1(%rbp)
	movq	-32(%rbp), %rax
	movzbl	(%rax), %edx
	movq	-24(%rbp), %rax
	movb	%dl, (%rax)
	movq	-32(%rbp), %rax
	movzbl	-1(%rbp), %edx
	movb	%dl, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	swap_char, .-swap_char
	.globl	max
	.type	max, @function
max:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	max, .-max
	.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
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	min, .-min
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	fsum
	.type	fsum, @function
fsum:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$1040, %rsp
	movl	%edi, -1028(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	-1028(%rbp), %edx
	leaq	-1008(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
	movl	$0, -1016(%rbp)
	movl	$0, -1012(%rbp)
	jmp	.L8
.L9:
	movl	-1012(%rbp), %eax
	cltq
	movzbl	-1008(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	addl	%eax, -1016(%rbp)
	addl	$1, -1012(%rbp)
.L8:
	movl	-1012(%rbp), %eax
	cltq
	movzbl	-1008(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L9
	movl	-1016(%rbp), %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	fsum, .-fsum
	.section	.rodata
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB11:
	.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	$40, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$999999, -36(%rbp)
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -40(%rbp)
	jmp	.L13
.L15:
	movl	-40(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-44(%rbp), %eax
	subl	-32(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	fsum
	movl	%eax, %ebx
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	fsum
	addl	%ebx, %eax
	cmpl	%eax, -36(%rbp)
	jle	.L14
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	fsum
	movl	%eax, %ebx
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	fsum
	addl	%ebx, %eax
	movl	%eax, -36(%rbp)
.L14:
	addl	$1, -40(%rbp)
.L13:
	movl	-44(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -40(%rbp)
	jle	.L15
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.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:
