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 com(int *a,int *b)
{
  int tmp;
  if(b>a){
    tmp=*a;
    *a=*b;
    *b=tmp;
  }
}
int sk(int a, int b)
{
  int i;
  com(&a,&b);
  i=a%b;
  while(i!=0){
    a=b;
    b=i;
    i=a%b;
  }
  return b;
}
int gcd(int a,int b,int c)
{
  int d;
  com(&a,&b);
  d=sk(a,b);
  com(&d,&c);
  return sk(d,c);
}
int main()
{
  int k,a,b,c,sam=0;
  scanf("%d",&k);
  for(a=1;a<=k;a++){
    for(b=1;b<=k;b++){
      for(c=1;c<=k;c++){
        sam+=gcd(a,b,c);
      }
    }
  }
  printf("%d",sam);
        
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	com
	.type	com, @function
com:
.LFB0:
	.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
	cmpq	-24(%rbp), %rax
	jbe	.L2
	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)
.L2:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	com, .-com
	.globl	sk
	.type	sk, @function
sk:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$24, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	leaq	-24(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	com
	movl	-20(%rbp), %eax
	movl	-24(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -4(%rbp)
	jmp	.L4
.L5:
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	movl	-24(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -4(%rbp)
.L4:
	cmpl	$0, -4(%rbp)
	jne	.L5
	movl	-24(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	sk, .-sk
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB2:
	.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
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-24(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	com
	movl	-24(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	sk
	movl	%eax, -12(%rbp)
	leaq	-28(%rbp), %rdx
	leaq	-12(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	com
	movl	-28(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	sk
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	gcd, .-gcd
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -12(%rbp)
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -24(%rbp)
	jmp	.L11
.L16:
	movl	$1, -20(%rbp)
	jmp	.L12
.L15:
	movl	$1, -16(%rbp)
	jmp	.L13
.L14:
	movl	-16(%rbp), %edx
	movl	-20(%rbp), %ecx
	movl	-24(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	gcd
	addl	%eax, -12(%rbp)
	addl	$1, -16(%rbp)
.L13:
	movl	-28(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L14
	addl	$1, -20(%rbp)
.L12:
	movl	-28(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L15
	addl	$1, -24(%rbp)
.L11:
	movl	-28(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L16
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	com
	.type	com, @function
com:
.LFB23:
	.cfi_startproc
	endbr64
	cmpq	%rdi, %rsi
	jbe	.L2
	movl	(%rdi), %eax
	movl	(%rsi), %edx
	movl	%edx, (%rdi)
	movl	%eax, (%rsi)
.L2:
	ret
	.cfi_endproc
.LFE23:
	.size	com, .-com
	.p2align 4
	.globl	sk
	.type	sk, @function
sk:
.LFB24:
	.cfi_startproc
	endbr64
	leaq	-8(%rsp), %rcx
	leaq	-4(%rsp), %rdx
	movl	%edi, %eax
	cmpq	%rdx, %rcx
	jbe	.L5
	movl	%esi, %eax
	movl	%edi, %esi
.L5:
	cltd
	idivl	%esi
	movl	%edx, %r8d
	testl	%edx, %edx
	jne	.L7
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%edx, %r8d
.L7:
	movl	%esi, %eax
	movl	%r8d, %esi
	cltd
	idivl	%r8d
	testl	%edx, %edx
	jne	.L9
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%esi, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	sk, .-sk
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB25:
	.cfi_startproc
	endbr64
	subq	$56, %rsp
	.cfi_def_cfa_offset 64
	movl	%esi, %eax
	movl	%edi, %ecx
	movl	%esi, 8(%rsp)
	leaq	8(%rsp), %rsi
	movl	%edi, 12(%rsp)
	movl	%edx, 4(%rsp)
	movq	%fs:40, %rdx
	movq	%rdx, 40(%rsp)
	xorl	%edx, %edx
	leaq	12(%rsp), %rdx
	cmpq	%rdx, %rsi
	jbe	.L12
	movl	%edi, 8(%rsp)
	movl	%eax, %edx
	movl	%eax, 12(%rsp)
	movl	%edx, %ecx
	movl	%edi, %eax
.L12:
	leaq	36(%rsp), %r8
	leaq	32(%rsp), %rdi
	movl	%eax, 36(%rsp)
	cmpq	%rdi, %r8
	ja	.L13
	movl	%eax, %edx
	movl	%ecx, %eax
	movl	%edx, %ecx
.L13:
	cltd
	idivl	%ecx
	movl	%edx, %esi
	testl	%edx, %edx
	jne	.L15
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L22:
	movl	%edx, %esi
.L15:
	movl	%ecx, %eax
	movl	%esi, %ecx
	cltd
	idivl	%esi
	testl	%edx, %edx
	jne	.L22
.L14:
	leaq	4(%rsp), %rdx
	leaq	28(%rsp), %rax
	movl	4(%rsp), %ecx
	cmpq	%rax, %rdx
	jbe	.L16
	movl	%ecx, %eax
	movl	%esi, %ecx
	movl	%eax, %esi
.L16:
	cmpq	%rdi, %r8
	jbe	.L17
	movl	%esi, %eax
	movl	%ecx, %esi
	movl	%eax, %ecx
.L17:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	movl	%edx, %r8d
	testl	%edx, %edx
	jne	.L19
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L24:
	movl	%edx, %r8d
.L19:
	movl	%ecx, %eax
	movl	%r8d, %ecx
	cltd
	idivl	%r8d
	testl	%edx, %edx
	jne	.L24
.L11:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	movl	%r8d, %eax
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_restore_state
	movl	%ecx, %esi
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L27:
	movl	%ecx, %r8d
	jmp	.L11
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB26:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ebp
	testl	%ebp, %ebp
	jle	.L45
	addl	$1, %ebp
	leaq	20(%rsp), %r15
	leaq	16(%rsp), %r14
	xorl	%r10d, %r10d
	movl	$1, %r9d
	leaq	32(%rsp), %rbx
	leaq	36(%rsp), %r11
	leaq	24(%rsp), %r13
	leaq	28(%rsp), %r12
.L31:
	movl	$1, %r8d
	.p2align 4,,10
	.p2align 3
.L43:
	movl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L41:
	movl	%r9d, 16(%rsp)
	movl	%r8d, 20(%rsp)
	movl	%edi, 24(%rsp)
	cmpq	%r14, %r15
	jbe	.L46
	movl	%r8d, 16(%rsp)
	movl	%r8d, %esi
	movl	%r9d, %eax
	movl	%r9d, 20(%rsp)
.L32:
	cmpq	%r11, %rbx
	ja	.L33
	movl	%eax, %edx
	movl	%esi, %eax
	movl	%edx, %esi
.L33:
	cltd
	idivl	%esi
	movl	%edx, %ecx
	testl	%edx, %edx
	jne	.L35
	jmp	.L53
	.p2align 4,,10
	.p2align 3
.L48:
	movl	%edx, %ecx
.L35:
	movl	%esi, %eax
	movl	%ecx, %esi
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.L48
.L34:
	cmpq	%r12, %r13
	ja	.L36
	movl	%ecx, 28(%rsp)
	movl	%ecx, %esi
	movl	%edi, %ecx
.L37:
	movl	%ecx, 32(%rsp)
	cmpq	%r11, %rbx
	ja	.L38
	movl	%ecx, %eax
	movl	%esi, %ecx
	movl	%eax, %esi
.L38:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movl	%edx, %ecx
	testl	%edx, %edx
	jne	.L40
	jmp	.L54
	.p2align 4,,10
	.p2align 3
.L50:
	movl	%edx, %ecx
.L40:
	movl	%esi, %eax
	movl	%ecx, %esi
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.L50
	addl	$1, %edi
	addl	%ecx, %r10d
	cmpl	%ebp, %edi
	jne	.L41
.L56:
	addl	$1, %r8d
	cmpl	%ebp, %r8d
	jne	.L43
	addl	$1, %r9d
	cmpl	%ebp, %r9d
	jne	.L31
.L30:
	xorl	%eax, %eax
	movl	%r10d, %edx
	movl	$1, %edi
	leaq	.LC0(%rip), %rsi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L55
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L36:
	.cfi_restore_state
	movl	%edi, 28(%rsp)
	movl	%edi, %esi
	movl	%ecx, 24(%rsp)
	jmp	.L37
	.p2align 4,,10
	.p2align 3
.L46:
	movl	%r9d, %esi
	movl	%r8d, %eax
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L54:
	movl	%esi, %ecx
	addl	$1, %edi
	addl	%ecx, %r10d
	cmpl	%ebp, %edi
	jne	.L41
	jmp	.L56
	.p2align 4,,10
	.p2align 3
.L53:
	movl	%esi, %ecx
	jmp	.L34
.L45:
	xorl	%r10d, %r10d
	jmp	.L30
.L55:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE26:
	.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	com
	.type	com, @function
com:
.LFB23:
	.cfi_startproc
	endbr64
	cmpq	%rdi, %rsi
	jbe	.L2
	movl	(%rdi), %eax
	movl	(%rsi), %edx
	movl	%edx, (%rdi)
	movl	%eax, (%rsi)
.L2:
	ret
	.cfi_endproc
.LFE23:
	.size	com, .-com
	.p2align 4
	.globl	sk
	.type	sk, @function
sk:
.LFB24:
	.cfi_startproc
	endbr64
	leaq	-8(%rsp), %rcx
	leaq	-4(%rsp), %rdx
	movl	%edi, %eax
	cmpq	%rdx, %rcx
	jbe	.L5
	movl	%esi, %eax
	movl	%edi, %esi
.L5:
	cltd
	idivl	%esi
	movl	%edx, %r8d
	testl	%edx, %edx
	jne	.L7
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%edx, %r8d
.L7:
	movl	%esi, %eax
	movl	%r8d, %esi
	cltd
	idivl	%r8d
	testl	%edx, %edx
	jne	.L9
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%esi, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	sk, .-sk
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB25:
	.cfi_startproc
	endbr64
	subq	$56, %rsp
	.cfi_def_cfa_offset 64
	movl	%esi, %eax
	movl	%edi, %ecx
	movl	%esi, 8(%rsp)
	leaq	8(%rsp), %rsi
	movl	%edi, 12(%rsp)
	movl	%edx, 4(%rsp)
	movq	%fs:40, %rdx
	movq	%rdx, 40(%rsp)
	xorl	%edx, %edx
	leaq	12(%rsp), %rdx
	cmpq	%rdx, %rsi
	jbe	.L12
	movl	%edi, 8(%rsp)
	movl	%eax, %edx
	movl	%eax, 12(%rsp)
	movl	%edx, %ecx
	movl	%edi, %eax
.L12:
	leaq	36(%rsp), %r8
	leaq	32(%rsp), %rdi
	movl	%eax, 36(%rsp)
	cmpq	%rdi, %r8
	ja	.L13
	movl	%eax, %edx
	movl	%ecx, %eax
	movl	%edx, %ecx
.L13:
	cltd
	idivl	%ecx
	movl	%edx, %esi
	testl	%edx, %edx
	jne	.L15
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L22:
	movl	%edx, %esi
.L15:
	movl	%ecx, %eax
	movl	%esi, %ecx
	cltd
	idivl	%esi
	testl	%edx, %edx
	jne	.L22
.L14:
	leaq	4(%rsp), %rdx
	leaq	28(%rsp), %rax
	movl	4(%rsp), %ecx
	cmpq	%rax, %rdx
	jbe	.L16
	movl	%ecx, %eax
	movl	%esi, %ecx
	movl	%eax, %esi
.L16:
	cmpq	%rdi, %r8
	jbe	.L17
	movl	%esi, %eax
	movl	%ecx, %esi
	movl	%eax, %ecx
.L17:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	movl	%edx, %r8d
	testl	%edx, %edx
	jne	.L19
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L24:
	movl	%edx, %r8d
.L19:
	movl	%ecx, %eax
	movl	%r8d, %ecx
	cltd
	idivl	%r8d
	testl	%edx, %edx
	jne	.L24
.L11:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	movl	%r8d, %eax
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_restore_state
	movl	%ecx, %esi
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L27:
	movl	%ecx, %r8d
	jmp	.L11
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB26:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ebp
	testl	%ebp, %ebp
	jle	.L45
	addl	$1, %ebp
	leaq	20(%rsp), %r15
	leaq	16(%rsp), %r14
	xorl	%r10d, %r10d
	movl	$1, %r9d
	leaq	32(%rsp), %rbx
	leaq	36(%rsp), %r11
	leaq	24(%rsp), %r13
	leaq	28(%rsp), %r12
.L31:
	movl	$1, %r8d
	.p2align 4,,10
	.p2align 3
.L43:
	movl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L41:
	movl	%r9d, 16(%rsp)
	movl	%r8d, 20(%rsp)
	movl	%edi, 24(%rsp)
	cmpq	%r14, %r15
	jbe	.L46
	movl	%r8d, 16(%rsp)
	movl	%r8d, %esi
	movl	%r9d, %eax
	movl	%r9d, 20(%rsp)
.L32:
	cmpq	%r11, %rbx
	ja	.L33
	movl	%eax, %edx
	movl	%esi, %eax
	movl	%edx, %esi
.L33:
	cltd
	idivl	%esi
	movl	%edx, %ecx
	testl	%edx, %edx
	jne	.L35
	jmp	.L53
	.p2align 4,,10
	.p2align 3
.L48:
	movl	%edx, %ecx
.L35:
	movl	%esi, %eax
	movl	%ecx, %esi
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.L48
.L34:
	cmpq	%r12, %r13
	ja	.L36
	movl	%ecx, 28(%rsp)
	movl	%ecx, %esi
	movl	%edi, %ecx
.L37:
	movl	%ecx, 32(%rsp)
	cmpq	%r11, %rbx
	ja	.L38
	movl	%ecx, %eax
	movl	%esi, %ecx
	movl	%eax, %esi
.L38:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movl	%edx, %ecx
	testl	%edx, %edx
	jne	.L40
	jmp	.L54
	.p2align 4,,10
	.p2align 3
.L50:
	movl	%edx, %ecx
.L40:
	movl	%esi, %eax
	movl	%ecx, %esi
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.L50
	addl	$1, %edi
	addl	%ecx, %r10d
	cmpl	%ebp, %edi
	jne	.L41
.L56:
	addl	$1, %r8d
	cmpl	%ebp, %r8d
	jne	.L43
	addl	$1, %r9d
	cmpl	%ebp, %r9d
	jne	.L31
.L30:
	xorl	%eax, %eax
	movl	%r10d, %edx
	movl	$1, %edi
	leaq	.LC0(%rip), %rsi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L55
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L36:
	.cfi_restore_state
	movl	%edi, 28(%rsp)
	movl	%edi, %esi
	movl	%ecx, 24(%rsp)
	jmp	.L37
	.p2align 4,,10
	.p2align 3
.L46:
	movl	%r9d, %esi
	movl	%r8d, %eax
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L54:
	movl	%esi, %ecx
	addl	$1, %edi
	addl	%ecx, %r10d
	cmpl	%ebp, %edi
	jne	.L41
	jmp	.L56
	.p2align 4,,10
	.p2align 3
.L53:
	movl	%esi, %ecx
	jmp	.L34
.L45:
	xorl	%r10d, %r10d
	jmp	.L30
.L55:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE26:
	.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 com(int *a,int *b)
{
  int tmp;
  if(b>a){
    tmp=*a;
    *a=*b;
    *b=tmp;
  }
}
int sk(int a, int b)
{
  int i;
  com(&a,&b);
  i=a%b;
  while(i!=0){
    a=b;
    b=i;
    i=a%b;
  }
  return b;
}
int gcd(int a,int b,int c)
{
  int d;
  com(&a,&b);
  d=sk(a,b);
  com(&d,&c);
  return sk(d,c);
}
int main()
{
  int k,a,b,c,sam=0;
  scanf("%d",&k);
  for(a=1;a<=k;a++){
    for(b=1;b<=k;b++){
      for(c=1;c<=k;c++){
        sam+=gcd(a,b,c);
      }
    }
  }
  printf("%d",sam);
        
  return 0;
}
4
 8
 3
 5
 7
 0
 1
 10
 20
 9

76 624 30 141 400 0 1 1249 10248 885
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 com(int *a,int *b)
{
  int tmp;
  if(b>a){
    tmp=*a;
    *a=*b;
    *b=tmp;
  }
}
int sk(int a, int b)
{
  int i;
  com(&a,&b);
  i=a%b;
  while(i!=0){
    a=b;
    b=i;
    i=a%b;
  }
  return b;
}
int gcd(int a,int b,int c)
{
  int d;
  com(&a,&b);
  d=sk(a,b);
  com(&d,&c);
  return sk(d,c);
}
int main()
{
  int k,a,b,c,sam=0;
  scanf("%d",&k);
  for(a=1;a<=k;a++){
    for(b=1;b<=k;b++){
      for(c=1;c<=k;c++){
        sam+=gcd(a,b,c);
      }
    }
  }
  printf("%d",sam);
        
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	com
	.type	com, @function
com:
.LFB0:
	.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
	cmpq	-24(%rbp), %rax
	jbe	.L2
	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)
.L2:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	com, .-com
	.globl	sk
	.type	sk, @function
sk:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$24, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	leaq	-24(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	com
	movl	-20(%rbp), %eax
	movl	-24(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -4(%rbp)
	jmp	.L4
.L5:
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	movl	-24(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -4(%rbp)
.L4:
	cmpl	$0, -4(%rbp)
	jne	.L5
	movl	-24(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	sk, .-sk
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB2:
	.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
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-24(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	com
	movl	-24(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	sk
	movl	%eax, -12(%rbp)
	leaq	-28(%rbp), %rdx
	leaq	-12(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	com
	movl	-28(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	sk
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	gcd, .-gcd
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -12(%rbp)
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -24(%rbp)
	jmp	.L11
.L16:
	movl	$1, -20(%rbp)
	jmp	.L12
.L15:
	movl	$1, -16(%rbp)
	jmp	.L13
.L14:
	movl	-16(%rbp), %edx
	movl	-20(%rbp), %ecx
	movl	-24(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	gcd
	addl	%eax, -12(%rbp)
	addl	$1, -16(%rbp)
.L13:
	movl	-28(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L14
	addl	$1, -20(%rbp)
.L12:
	movl	-28(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L15
	addl	$1, -24(%rbp)
.L11:
	movl	-28(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L16
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	com
	.type	com, @function
com:
.LFB0:
	.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
	cmpq	-24(%rbp), %rax
	jbe	.L2
	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)
.L2:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	com, .-com
	.globl	sk
	.type	sk, @function
sk:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$24, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	leaq	-24(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	com
	movl	-20(%rbp), %eax
	movl	-24(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -4(%rbp)
	jmp	.L4
.L5:
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	movl	-24(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -4(%rbp)
.L4:
	cmpl	$0, -4(%rbp)
	jne	.L5
	movl	-24(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	sk, .-sk
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB2:
	.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
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-24(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	com
	movl	-24(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	sk
	movl	%eax, -12(%rbp)
	leaq	-28(%rbp), %rdx
	leaq	-12(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	com
	movl	-28(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	sk
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	gcd, .-gcd
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -12(%rbp)
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -24(%rbp)
	jmp	.L11
.L16:
	movl	$1, -20(%rbp)
	jmp	.L12
.L15:
	movl	$1, -16(%rbp)
	jmp	.L13
.L14:
	movl	-16(%rbp), %edx
	movl	-20(%rbp), %ecx
	movl	-24(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	gcd
	addl	%eax, -12(%rbp)
	addl	$1, -16(%rbp)
.L13:
	movl	-28(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L14
	addl	$1, -20(%rbp)
.L12:
	movl	-28(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L15
	addl	$1, -24(%rbp)
.L11:
	movl	-28(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L16
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
