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 main(){
int a[30];
int x,i,b=5;
for(i=0;i<30;i++){
a[i]=b;
b++;
if(b==8){
b=1;
}
}
scanf("%d\n",&x);
x=x-1;
if(a[x]==1){
printf("mon\n");
}
else if(a[x]==2){
printf("tue\n");
}
else if(a[x]==3){
printf("wed\n");
}
else if(a[x]==4){
printf("thu\n");
}
else if(a[x]==5){
printf("fri\n");
}
else if(a[x]==6){
printf("sat\n");
}
else if(a[x]==7){
printf("sun\n");
}
return 0;
}

```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"mon"
.LC2:
	.string	"tue"
.LC3:
	.string	"wed"
.LC4:
	.string	"thu"
.LC5:
	.string	"fri"
.LC6:
	.string	"sat"
.LC7:
	.string	"sun"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	136(%rsp), %rcx
	movl	$5, %eax
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%eax, (%rdx)
	addl	$1, %eax
	addq	$4, %rdx
	cmpl	$8, %eax
	je	.L2
	cmpq	%rcx, %rdx
	jne	.L5
.L4:
	leaq	12(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	subl	$1, %eax
	movl	%eax, 12(%rsp)
	cltq
	movl	16(%rsp,%rax,4), %eax
	cmpl	$1, %eax
	je	.L18
	cmpl	$7, %eax
	ja	.L7
	leaq	.L9(%rip), %rdx
	movslq	(%rdx,%rax,4), %rax
	addq	%rdx, %rax
	notrack jmp	*%rax
	.section	.rodata
	.align 4
	.align 4
.L9:
	.long	.L7-.L9
	.long	.L7-.L9
	.long	.L14-.L9
	.long	.L13-.L9
	.long	.L12-.L9
	.long	.L11-.L9
	.long	.L10-.L9
	.long	.L8-.L9
	.section	.text.startup
	.p2align 4,,10
	.p2align 3
.L2:
	cmpq	%rdx, %rcx
	je	.L4
	movl	$1, %eax
	jmp	.L5
.L18:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L7:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	xorl	%eax, %eax
	addq	$152, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	leaq	.LC7(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L14:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L13:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L12:
	leaq	.LC4(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L11:
	leaq	.LC5(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L10:
	leaq	.LC6(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L19:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"mon"
.LC2:
	.string	"tue"
.LC3:
	.string	"wed"
.LC4:
	.string	"thu"
.LC5:
	.string	"fri"
.LC6:
	.string	"sat"
.LC7:
	.string	"sun"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	136(%rsp), %rcx
	movl	$5, %eax
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%eax, (%rdx)
	addl	$1, %eax
	addq	$4, %rdx
	cmpl	$8, %eax
	je	.L2
	cmpq	%rcx, %rdx
	jne	.L5
.L4:
	leaq	12(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	subl	$1, %eax
	movl	%eax, 12(%rsp)
	cltq
	movl	16(%rsp,%rax,4), %eax
	cmpl	$1, %eax
	je	.L18
	cmpl	$7, %eax
	ja	.L7
	leaq	.L9(%rip), %rdx
	movslq	(%rdx,%rax,4), %rax
	addq	%rdx, %rax
	notrack jmp	*%rax
	.section	.rodata
	.align 4
	.align 4
.L9:
	.long	.L7-.L9
	.long	.L7-.L9
	.long	.L14-.L9
	.long	.L13-.L9
	.long	.L12-.L9
	.long	.L11-.L9
	.long	.L10-.L9
	.long	.L8-.L9
	.section	.text.startup
	.p2align 4,,10
	.p2align 3
.L2:
	cmpq	%rdx, %rcx
	je	.L4
	movl	$1, %eax
	jmp	.L5
.L18:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L7:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	xorl	%eax, %eax
	addq	$152, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	leaq	.LC7(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L14:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L13:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L12:
	leaq	.LC4(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L11:
	leaq	.LC5(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L10:
	leaq	.LC6(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L19:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"mon"
.LC2:
	.string	"tue"
.LC3:
	.string	"wed"
.LC4:
	.string	"thu"
.LC5:
	.string	"fri"
.LC6:
	.string	"sat"
.LC7:
	.string	"sun"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	136(%rsp), %rcx
	movl	$5, %eax
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%eax, (%rdx)
	addl	$1, %eax
	addq	$4, %rdx
	cmpl	$8, %eax
	je	.L2
	cmpq	%rcx, %rdx
	jne	.L5
.L4:
	leaq	12(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	subl	$1, %eax
	movl	%eax, 12(%rsp)
	cltq
	movl	16(%rsp,%rax,4), %eax
	cmpl	$1, %eax
	je	.L18
	cmpl	$7, %eax
	ja	.L7
	leaq	.L9(%rip), %rdx
	movslq	(%rdx,%rax,4), %rax
	addq	%rdx, %rax
	notrack jmp	*%rax
	.section	.rodata
	.align 4
	.align 4
.L9:
	.long	.L7-.L9
	.long	.L7-.L9
	.long	.L14-.L9
	.long	.L13-.L9
	.long	.L12-.L9
	.long	.L11-.L9
	.long	.L10-.L9
	.long	.L8-.L9
	.section	.text.startup
	.p2align 4,,10
	.p2align 3
.L2:
	cmpq	%rdx, %rcx
	je	.L4
	movl	$1, %eax
	jmp	.L5
.L18:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L7:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	xorl	%eax, %eax
	addq	$152, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	leaq	.LC7(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L14:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L13:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L12:
	leaq	.LC4(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L11:
	leaq	.LC5(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L10:
	leaq	.LC6(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L19:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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 main(){
int a[30];
int x,i,b=5;
for(i=0;i<30;i++){
a[i]=b;
b++;
if(b==8){
b=1;
}
}
scanf("%d\n",&x);
x=x-1;
if(a[x]==1){
printf("mon\n");
}
else if(a[x]==2){
printf("tue\n");
}
else if(a[x]==3){
printf("wed\n");
}
else if(a[x]==4){
printf("thu\n");
}
else if(a[x]==5){
printf("fri\n");
}
else if(a[x]==6){
printf("sat\n");
}
else if(a[x]==7){
printf("sun\n");
}
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 main(){
int a[30];
int x,i,b=5;
for(i=0;i<30;i++){
a[i]=b;
b++;
if(b==8){
b=1;
}
}
scanf("%d\n",&x);
x=x-1;
if(a[x]==1){
printf("mon\n");
}
else if(a[x]==2){
printf("tue\n");
}
else if(a[x]==3){
printf("wed\n");
}
else if(a[x]==4){
printf("thu\n");
}
else if(a[x]==5){
printf("fri\n");
}
else if(a[x]==6){
printf("sat\n");
}
else if(a[x]==7){
printf("sun\n");
}
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:

1

fri

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 main(){
int a[30];
int x,i,b=5;
for(i=0;i<30;i++){
a[i]=b;
b++;
if(b==8){
b=1;
}
}
scanf("%d\n",&x);
x=x-1;
if(a[x]==1){
printf("mon\n");
}
else if(a[x]==2){
printf("tue\n");
}
else if(a[x]==3){
printf("wed\n");
}
else if(a[x]==4){
printf("thu\n");
}
else if(a[x]==5){
printf("fri\n");
}
else if(a[x]==6){
printf("sat\n");
}
else if(a[x]==7){
printf("sun\n");
}
return 0;
}

```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"mon"
.LC2:
	.string	"tue"
.LC3:
	.string	"wed"
.LC4:
	.string	"thu"
.LC5:
	.string	"fri"
.LC6:
	.string	"sat"
.LC7:
	.string	"sun"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	136(%rsp), %rcx
	movl	$5, %eax
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%eax, (%rdx)
	addl	$1, %eax
	addq	$4, %rdx
	cmpl	$8, %eax
	je	.L2
	cmpq	%rcx, %rdx
	jne	.L5
.L4:
	leaq	12(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	subl	$1, %eax
	movl	%eax, 12(%rsp)
	cltq
	movl	16(%rsp,%rax,4), %eax
	cmpl	$1, %eax
	je	.L18
	cmpl	$7, %eax
	ja	.L7
	leaq	.L9(%rip), %rdx
	movslq	(%rdx,%rax,4), %rax
	addq	%rdx, %rax
	notrack jmp	*%rax
	.section	.rodata
	.align 4
	.align 4
.L9:
	.long	.L7-.L9
	.long	.L7-.L9
	.long	.L14-.L9
	.long	.L13-.L9
	.long	.L12-.L9
	.long	.L11-.L9
	.long	.L10-.L9
	.long	.L8-.L9
	.section	.text.startup
	.p2align 4,,10
	.p2align 3
.L2:
	cmpq	%rdx, %rcx
	je	.L4
	movl	$1, %eax
	jmp	.L5
.L18:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L7:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	xorl	%eax, %eax
	addq	$152, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	leaq	.LC7(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L14:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L13:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L12:
	leaq	.LC4(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L11:
	leaq	.LC5(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L10:
	leaq	.LC6(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L19:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"mon"
.LC2:
	.string	"tue"
.LC3:
	.string	"wed"
.LC4:
	.string	"thu"
.LC5:
	.string	"fri"
.LC6:
	.string	"sat"
.LC7:
	.string	"sun"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	136(%rsp), %rcx
	movl	$5, %eax
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%eax, (%rdx)
	addl	$1, %eax
	addq	$4, %rdx
	cmpl	$8, %eax
	je	.L2
	cmpq	%rcx, %rdx
	jne	.L5
.L4:
	leaq	12(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	subl	$1, %eax
	movl	%eax, 12(%rsp)
	cltq
	movl	16(%rsp,%rax,4), %eax
	cmpl	$1, %eax
	je	.L18
	cmpl	$7, %eax
	ja	.L7
	leaq	.L9(%rip), %rdx
	movslq	(%rdx,%rax,4), %rax
	addq	%rdx, %rax
	notrack jmp	*%rax
	.section	.rodata
	.align 4
	.align 4
.L9:
	.long	.L7-.L9
	.long	.L7-.L9
	.long	.L14-.L9
	.long	.L13-.L9
	.long	.L12-.L9
	.long	.L11-.L9
	.long	.L10-.L9
	.long	.L8-.L9
	.section	.text.startup
	.p2align 4,,10
	.p2align 3
.L2:
	cmpq	%rdx, %rcx
	je	.L4
	movl	$1, %eax
	jmp	.L5
.L18:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L7:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	xorl	%eax, %eax
	addq	$152, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	leaq	.LC7(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L14:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L13:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L12:
	leaq	.LC4(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L11:
	leaq	.LC5(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L10:
	leaq	.LC6(%rip), %rdi
	call	puts@PLT
	jmp	.L7
.L19:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:
```