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

```c
#include<stdio.h>

int gcd(int x, int y) {
    if (y == 0)
        return (x);
     else
        return (gcd(y, x % y));
}


int main(void){
    int K,a,b,c;
    unsigned long sum=0;
    scanf("%d",&K);

    for(a=1;a<=K;a++){
        for(b=1;b<=K;b++){
            for(c=1;c<=K;c++){
                sum+=gcd(gcd(a,b),c);
            }
        }
    }

    printf("%lu\n",sum);

    return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	movl	%esi, %r8d
	testl	%esi, %esi
	jne	.L2
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%edx, %r8d
.L2:
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L11
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edi, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lu\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r10d
	testl	%r10d, %r10d
	jle	.L23
	addl	$1, %r10d
	xorl	%r8d, %r8d
	movl	$1, %r11d
.L14:
	movl	$1, %r9d
	.p2align 4,,10
	.p2align 3
.L21:
	movl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%r11d, %eax
	movl	%r9d, %ecx
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L28:
	movl	%edx, %ecx
.L16:
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L28
	movslq	%edi, %rsi
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L29:
	movslq	%edx, %rsi
.L15:
	movl	%ecx, %eax
	movl	%esi, %ecx
	cltd
	idivl	%esi
	testl	%edx, %edx
	jne	.L29
	addl	$1, %edi
	addq	%rsi, %r8
	cmpl	%r10d, %edi
	jne	.L17
	addl	$1, %r9d
	cmpl	%r10d, %r9d
	jne	.L21
	addl	$1, %r11d
	cmpl	%r10d, %r11d
	jne	.L14
.L13:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L13
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	movl	%esi, %r8d
	testl	%esi, %esi
	jne	.L2
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%edx, %r8d
.L2:
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L11
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edi, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lu\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r10d
	testl	%r10d, %r10d
	jle	.L23
	addl	$1, %r10d
	xorl	%r8d, %r8d
	movl	$1, %r11d
.L14:
	movl	$1, %r9d
	.p2align 4,,10
	.p2align 3
.L21:
	movl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%r11d, %eax
	movl	%r9d, %ecx
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L28:
	movl	%edx, %ecx
.L16:
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L28
	movslq	%edi, %rsi
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L29:
	movslq	%edx, %rsi
.L15:
	movl	%ecx, %eax
	movl	%esi, %ecx
	cltd
	idivl	%esi
	testl	%edx, %edx
	jne	.L29
	addl	$1, %edi
	addq	%rsi, %r8
	cmpl	%r10d, %edi
	jne	.L17
	addl	$1, %r9d
	cmpl	%r10d, %r9d
	jne	.L21
	addl	$1, %r11d
	cmpl	%r10d, %r11d
	jne	.L14
.L13:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L13
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	movl	%esi, %r8d
	testl	%esi, %esi
	jne	.L2
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%edx, %r8d
.L2:
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L11
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edi, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lu\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r10d
	testl	%r10d, %r10d
	jle	.L23
	addl	$1, %r10d
	xorl	%r8d, %r8d
	movl	$1, %r11d
.L14:
	movl	$1, %r9d
	.p2align 4,,10
	.p2align 3
.L21:
	movl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%r11d, %eax
	movl	%r9d, %ecx
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L28:
	movl	%edx, %ecx
.L16:
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L28
	movslq	%edi, %rsi
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L29:
	movslq	%edx, %rsi
.L15:
	movl	%ecx, %eax
	movl	%esi, %ecx
	cltd
	idivl	%esi
	testl	%edx, %edx
	jne	.L29
	addl	$1, %edi
	addq	%rsi, %r8
	cmpl	%r10d, %edi
	jne	.L17
	addl	$1, %r9d
	cmpl	%r10d, %r9d
	jne	.L21
	addl	$1, %r11d
	cmpl	%r10d, %r11d
	jne	.L14
.L13:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L13
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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:
```
```c
#include<stdio.h>

int gcd(int x, int y) {
    if (y == 0)
        return (x);
     else
        return (gcd(y, x % y));
}


int main(void){
    int K,a,b,c;
    unsigned long sum=0;
    scanf("%d",&K);

    for(a=1;a<=K;a++){
        for(b=1;b<=K;b++){
            for(c=1;c<=K;c++){
                sum+=gcd(gcd(a,b),c);
            }
        }
    }

    printf("%lu\n",sum);

    return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>

int gcd(int x, int y) {
    if (y == 0)
        return (x);
     else
        return (gcd(y, x % y));
}


int main(void){
    int K,a,b,c;
    unsigned long sum=0;
    scanf("%d",&K);

    for(a=1;a<=K;a++){
        for(b=1;b<=K;b++){
            for(c=1;c<=K;c++){
                sum+=gcd(gcd(a,b),c);
            }
        }
    }

    printf("%lu\n",sum);

    return 0;
}```

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.
Optimized Assembly Code:

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 assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>

int gcd(int x, int y) {
    if (y == 0)
        return (x);
     else
        return (gcd(y, x % y));
}


int main(void){
    int K,a,b,c;
    unsigned long sum=0;
    scanf("%d",&K);

    for(a=1;a<=K;a++){
        for(b=1;b<=K;b++){
            for(c=1;c<=K;c++){
                sum+=gcd(gcd(a,b),c);
            }
        }
    }

    printf("%lu\n",sum);

    return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	movl	%esi, %r8d
	testl	%esi, %esi
	jne	.L2
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%edx, %r8d
.L2:
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L11
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edi, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lu\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r10d
	testl	%r10d, %r10d
	jle	.L23
	addl	$1, %r10d
	xorl	%r8d, %r8d
	movl	$1, %r11d
.L14:
	movl	$1, %r9d
	.p2align 4,,10
	.p2align 3
.L21:
	movl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%r11d, %eax
	movl	%r9d, %ecx
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L28:
	movl	%edx, %ecx
.L16:
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L28
	movslq	%edi, %rsi
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L29:
	movslq	%edx, %rsi
.L15:
	movl	%ecx, %eax
	movl	%esi, %ecx
	cltd
	idivl	%esi
	testl	%edx, %edx
	jne	.L29
	addl	$1, %edi
	addq	%rsi, %r8
	cmpl	%r10d, %edi
	jne	.L17
	addl	$1, %r9d
	cmpl	%r10d, %r9d
	jne	.L21
	addl	$1, %r11d
	cmpl	%r10d, %r11d
	jne	.L14
.L13:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L13
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	movl	%esi, %r8d
	testl	%esi, %esi
	jne	.L2
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%edx, %r8d
.L2:
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L11
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edi, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lu\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r10d
	testl	%r10d, %r10d
	jle	.L23
	addl	$1, %r10d
	xorl	%r8d, %r8d
	movl	$1, %r11d
.L14:
	movl	$1, %r9d
	.p2align 4,,10
	.p2align 3
.L21:
	movl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%r11d, %eax
	movl	%r9d, %ecx
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L28:
	movl	%edx, %ecx
.L16:
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L28
	movslq	%edi, %rsi
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L29:
	movslq	%edx, %rsi
.L15:
	movl	%ecx, %eax
	movl	%esi, %ecx
	cltd
	idivl	%esi
	testl	%edx, %edx
	jne	.L29
	addl	$1, %edi
	addq	%rsi, %r8
	cmpl	%r10d, %edi
	jne	.L17
	addl	$1, %r9d
	cmpl	%r10d, %r9d
	jne	.L21
	addl	$1, %r11d
	cmpl	%r10d, %r11d
	jne	.L14
.L13:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L13
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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:
```