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 main(void)
{
	char pattern[10][10];
	char buf[10][10];
	int x, y, i, j;
	
	for (i = 0; i < 8; i++){
		scanf("%s", pattern[i]);
	}
	
	
	/*pattern[y][x]*/
	for (i = 0; i < 3; i++){
		switch (i){
		  case 0:
		  	printf("90\n");
			break;
			
		  case 1:
		  	printf("180\n");
			break;
			
		  case 2:
		  	printf("270\n");
			break;
		}
		
		/*90度回転*/
		for (y = 0; y < 8; y++){
			for (x = 0; x < 8; x++){
				buf[y][x] = pattern[7 - x][y];
			}
			buf[y][8] = '\0';
		}
		
		for (y = 0; y < 8; y++){
			for (x = 0; x < 8; x++){
				pattern[y][x] = buf[y][x];
			}
			pattern[y][8] = '\0';
		}
		
		for (j = 0; j < 8; j++){
			printf("%s\n", pattern[j]);
		}
	}
	
	return (0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"90"
.LC2:
	.string	"180"
.LC3:
	.string	"270"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$240, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -232(%rbp)
	jmp	.L2
.L3:
	leaq	-224(%rbp), %rcx
	movl	-232(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -232(%rbp)
.L2:
	cmpl	$7, -232(%rbp)
	jle	.L3
	movl	$0, -232(%rbp)
	jmp	.L4
.L19:
	cmpl	$2, -232(%rbp)
	je	.L5
	cmpl	$2, -232(%rbp)
	jg	.L6
	cmpl	$0, -232(%rbp)
	je	.L7
	cmpl	$1, -232(%rbp)
	je	.L8
	jmp	.L6
.L7:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L6
.L8:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L6
.L5:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	nop
.L6:
	movl	$0, -236(%rbp)
	jmp	.L9
.L12:
	movl	$0, -240(%rbp)
	jmp	.L10
.L11:
	movl	$7, %eax
	subl	-240(%rbp), %eax
	movl	-236(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$224, %rax
	movzbl	(%rax), %edx
	movl	-240(%rbp), %eax
	movslq	%eax, %rsi
	movl	-236(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$112, %rax
	movb	%dl, (%rax)
	addl	$1, -240(%rbp)
.L10:
	cmpl	$7, -240(%rbp)
	jle	.L11
	movl	-236(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	subq	$104, %rax
	movb	$0, (%rax)
	addl	$1, -236(%rbp)
.L9:
	cmpl	$7, -236(%rbp)
	jle	.L12
	movl	$0, -236(%rbp)
	jmp	.L13
.L16:
	movl	$0, -240(%rbp)
	jmp	.L14
.L15:
	movl	-240(%rbp), %eax
	movslq	%eax, %rcx
	movl	-236(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$112, %rax
	movzbl	(%rax), %edx
	movl	-240(%rbp), %eax
	movslq	%eax, %rsi
	movl	-236(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$224, %rax
	movb	%dl, (%rax)
	addl	$1, -240(%rbp)
.L14:
	cmpl	$7, -240(%rbp)
	jle	.L15
	movl	-236(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	subq	$216, %rax
	movb	$0, (%rax)
	addl	$1, -236(%rbp)
.L13:
	cmpl	$7, -236(%rbp)
	jle	.L16
	movl	$0, -228(%rbp)
	jmp	.L17
.L18:
	leaq	-224(%rbp), %rcx
	movl	-228(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movq	%rax, %rdi
	call	puts@PLT
	addl	$1, -228(%rbp)
.L17:
	cmpl	$7, -228(%rbp)
	jle	.L18
	addl	$1, -232(%rbp)
.L4:
	cmpl	$2, -232(%rbp)
	jle	.L19
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"90"
.LC2:
	.string	"180"
.LC3:
	.string	"270"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	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	$120, %rsp
	.cfi_def_cfa_offset 176
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r12
	leaq	80(%rsp), %rbx
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$10, %rbp
	call	__isoc99_scanf@PLT
	cmpq	%rbp, %rbx
	jne	.L2
	xorl	%ebp, %ebp
	leaq	.LC2(%rip), %r15
	leaq	.LC3(%rip), %r14
.L7:
	cmpl	$1, %ebp
	je	.L3
	cmpl	$2, %ebp
	je	.L4
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L5:
	movzbl	1(%rsp), %r9d
	movzbl	11(%rsp), %eax
	movq	%r12, %r13
	movzbl	2(%rsp), %r8d
	movzbl	3(%rsp), %edi
	salq	$8, %r9
	movzbl	4(%rsp), %esi
	salq	$8, %r8
	orq	%rax, %r9
	movzbl	21(%rsp), %eax
	salq	$8, %rdi
	salq	$8, %r9
	orq	%rax, %r9
	movzbl	31(%rsp), %eax
	salq	$8, %r9
	orq	%rax, %r9
	movzbl	41(%rsp), %eax
	salq	$8, %r9
	orq	%rax, %r9
	movzbl	51(%rsp), %eax
	salq	$8, %r9
	orq	%rax, %r9
	movzbl	61(%rsp), %eax
	salq	$8, %r9
	orq	%rax, %r9
	movzbl	71(%rsp), %eax
	salq	$8, %r9
	orq	%rax, %r9
	movzbl	12(%rsp), %eax
	orq	%rax, %r8
	movzbl	22(%rsp), %eax
	salq	$8, %r8
	orq	%rax, %r8
	movzbl	32(%rsp), %eax
	salq	$8, %r8
	orq	%rax, %r8
	movzbl	42(%rsp), %eax
	salq	$8, %r8
	orq	%rax, %r8
	movzbl	52(%rsp), %eax
	salq	$8, %r8
	orq	%rax, %r8
	movzbl	62(%rsp), %eax
	salq	$8, %r8
	orq	%rax, %r8
	movzbl	72(%rsp), %eax
	salq	$8, %r8
	orq	%rax, %r8
	movzbl	13(%rsp), %eax
	orq	%rax, %rdi
	movzbl	23(%rsp), %eax
	salq	$8, %rdi
	orq	%rax, %rdi
	movzbl	33(%rsp), %eax
	salq	$8, %rdi
	salq	$8, %rsi
	orq	%rax, %rdi
	movzbl	43(%rsp), %eax
	salq	$8, %rdi
	orq	%rax, %rdi
	movzbl	53(%rsp), %eax
	salq	$8, %rdi
	orq	%rax, %rdi
	movzbl	63(%rsp), %eax
	salq	$8, %rdi
	orq	%rax, %rdi
	movzbl	73(%rsp), %eax
	salq	$8, %rdi
	orq	%rax, %rdi
	movzbl	14(%rsp), %eax
	orq	%rax, %rsi
	movzbl	24(%rsp), %eax
	salq	$8, %rsi
	orq	%rax, %rsi
	movzbl	34(%rsp), %eax
	salq	$8, %rsi
	orq	%rax, %rsi
	movzbl	44(%rsp), %eax
	salq	$8, %rsi
	orq	%rax, %rsi
	movzbl	54(%rsp), %eax
	salq	$8, %rsi
	orq	%rax, %rsi
	movzbl	64(%rsp), %eax
	salq	$8, %rsi
	orq	%rax, %rsi
	movzbl	74(%rsp), %eax
	movzbl	5(%rsp), %ecx
	salq	$8, %rsi
	movzbl	6(%rsp), %edx
	movzbl	17(%rsp), %r10d
	orq	%rax, %rsi
	movzbl	15(%rsp), %eax
	salq	$8, %rcx
	movzbl	10(%rsp), %r11d
	orq	%rax, %rcx
	movzbl	25(%rsp), %eax
	salq	$8, %rcx
	orq	%rax, %rcx
	movzbl	35(%rsp), %eax
	salq	$8, %rcx
	orq	%rax, %rcx
	movzbl	45(%rsp), %eax
	salq	$8, %rcx
	orq	%rax, %rcx
	movzbl	55(%rsp), %eax
	salq	$8, %rcx
	salq	$8, %rdx
	orq	%rax, %rcx
	movzbl	65(%rsp), %eax
	salq	$8, %rcx
	orq	%rax, %rcx
	movzbl	75(%rsp), %eax
	salq	$8, %rcx
	orq	%rax, %rcx
	movzbl	16(%rsp), %eax
	orq	%rax, %rdx
	movzbl	26(%rsp), %eax
	salq	$8, %rdx
	orq	%rax, %rdx
	movzbl	36(%rsp), %eax
	salq	$8, %rdx
	orq	%rax, %rdx
	movzbl	46(%rsp), %eax
	salq	$8, %rdx
	orq	%rax, %rdx
	movzbl	56(%rsp), %eax
	salq	$8, %rdx
	orq	%rax, %rdx
	movzbl	66(%rsp), %eax
	salq	$8, %rdx
	orq	%rax, %rdx
	movzbl	76(%rsp), %eax
	salq	$8, %rdx
	orq	%rax, %rdx
	movzbl	7(%rsp), %eax
	salq	$8, %rax
	orq	%r10, %rax
	movzbl	27(%rsp), %r10d
	salq	$8, %rax
	orq	%r10, %rax
	movzbl	37(%rsp), %r10d
	salq	$8, %rax
	orq	%r10, %rax
	movzbl	47(%rsp), %r10d
	salq	$8, %rax
	orq	%r10, %rax
	movzbl	57(%rsp), %r10d
	salq	$8, %rax
	orq	%r10, %rax
	movzbl	67(%rsp), %r10d
	salq	$8, %rax
	orq	%r10, %rax
	movzbl	77(%rsp), %r10d
	salq	$8, %rax
	orq	%r10, %rax
	movzbl	(%rsp), %r10d
	salq	$8, %r10
	orq	%r11, %r10
	movzbl	20(%rsp), %r11d
	salq	$8, %r10
	orq	%r11, %r10
	movzbl	30(%rsp), %r11d
	salq	$8, %r10
	orq	%r11, %r10
	movzbl	40(%rsp), %r11d
	salq	$8, %r10
	orq	%r11, %r10
	movzbl	50(%rsp), %r11d
	salq	$8, %r10
	orq	%r11, %r10
	movzbl	60(%rsp), %r11d
	salq	$8, %r10
	orq	%r11, %r10
	movzbl	70(%rsp), %r11d
	salq	$8, %r10
	orq	%r11, %r10
	movq	%r10, (%rsp)
	movb	$0, 8(%rsp)
	movq	%r9, 10(%rsp)
	movb	$0, 18(%rsp)
	movq	%r8, 20(%rsp)
	movb	$0, 28(%rsp)
	movq	%rdi, 30(%rsp)
	movb	$0, 38(%rsp)
	movq	%rsi, 40(%rsp)
	movb	$0, 48(%rsp)
	movq	%rcx, 50(%rsp)
	movb	$0, 58(%rsp)
	movq	%rdx, 60(%rsp)
	movb	$0, 68(%rsp)
	movq	%rax, 70(%rsp)
	movb	$0, 78(%rsp)
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r13, %rdi
	addq	$10, %r13
	call	puts@PLT
	cmpq	%r13, %rbx
	jne	.L6
	addl	$1, %ebp
	cmpl	$3, %ebp
	jne	.L7
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$120, %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
.L4:
	.cfi_restore_state
	movq	%r14, %rdi
	call	puts@PLT
	jmp	.L5
.L3:
	movq	%r15, %rdi
	call	puts@PLT
	jmp	.L5
.L14:
	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
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"90"
.LC2:
	.string	"180"
.LC3:
	.string	"270"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	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	$120, %rsp
	.cfi_def_cfa_offset 176
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r12
	leaq	80(%rsp), %rbx
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$10, %rbp
	call	__isoc99_scanf@PLT
	cmpq	%rbp, %rbx
	jne	.L2
	xorl	%ebp, %ebp
	leaq	.LC2(%rip), %r15
	leaq	.LC3(%rip), %r14
.L7:
	cmpl	$1, %ebp
	je	.L3
	cmpl	$2, %ebp
	je	.L4
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L5:
	movzbl	1(%rsp), %r9d
	movzbl	11(%rsp), %eax
	movq	%r12, %r13
	movzbl	2(%rsp), %r8d
	movzbl	3(%rsp), %edi
	salq	$8, %r9
	movzbl	4(%rsp), %esi
	salq	$8, %r8
	orq	%rax, %r9
	movzbl	21(%rsp), %eax
	salq	$8, %rdi
	salq	$8, %r9
	orq	%rax, %r9
	movzbl	31(%rsp), %eax
	salq	$8, %r9
	orq	%rax, %r9
	movzbl	41(%rsp), %eax
	salq	$8, %r9
	orq	%rax, %r9
	movzbl	51(%rsp), %eax
	salq	$8, %r9
	orq	%rax, %r9
	movzbl	61(%rsp), %eax
	salq	$8, %r9
	orq	%rax, %r9
	movzbl	71(%rsp), %eax
	salq	$8, %r9
	orq	%rax, %r9
	movzbl	12(%rsp), %eax
	orq	%rax, %r8
	movzbl	22(%rsp), %eax
	salq	$8, %r8
	orq	%rax, %r8
	movzbl	32(%rsp), %eax
	salq	$8, %r8
	orq	%rax, %r8
	movzbl	42(%rsp), %eax
	salq	$8, %r8
	orq	%rax, %r8
	movzbl	52(%rsp), %eax
	salq	$8, %r8
	orq	%rax, %r8
	movzbl	62(%rsp), %eax
	salq	$8, %r8
	orq	%rax, %r8
	movzbl	72(%rsp), %eax
	salq	$8, %r8
	orq	%rax, %r8
	movzbl	13(%rsp), %eax
	orq	%rax, %rdi
	movzbl	23(%rsp), %eax
	salq	$8, %rdi
	orq	%rax, %rdi
	movzbl	33(%rsp), %eax
	salq	$8, %rdi
	salq	$8, %rsi
	orq	%rax, %rdi
	movzbl	43(%rsp), %eax
	salq	$8, %rdi
	orq	%rax, %rdi
	movzbl	53(%rsp), %eax
	salq	$8, %rdi
	orq	%rax, %rdi
	movzbl	63(%rsp), %eax
	salq	$8, %rdi
	orq	%rax, %rdi
	movzbl	73(%rsp), %eax
	salq	$8, %rdi
	orq	%rax, %rdi
	movzbl	14(%rsp), %eax
	orq	%rax, %rsi
	movzbl	24(%rsp), %eax
	salq	$8, %rsi
	orq	%rax, %rsi
	movzbl	34(%rsp), %eax
	salq	$8, %rsi
	orq	%rax, %rsi
	movzbl	44(%rsp), %eax
	salq	$8, %rsi
	orq	%rax, %rsi
	movzbl	54(%rsp), %eax
	salq	$8, %rsi
	orq	%rax, %rsi
	movzbl	64(%rsp), %eax
	salq	$8, %rsi
	orq	%rax, %rsi
	movzbl	74(%rsp), %eax
	movzbl	5(%rsp), %ecx
	salq	$8, %rsi
	movzbl	6(%rsp), %edx
	movzbl	17(%rsp), %r10d
	orq	%rax, %rsi
	movzbl	15(%rsp), %eax
	salq	$8, %rcx
	movzbl	10(%rsp), %r11d
	orq	%rax, %rcx
	movzbl	25(%rsp), %eax
	salq	$8, %rcx
	orq	%rax, %rcx
	movzbl	35(%rsp), %eax
	salq	$8, %rcx
	orq	%rax, %rcx
	movzbl	45(%rsp), %eax
	salq	$8, %rcx
	orq	%rax, %rcx
	movzbl	55(%rsp), %eax
	salq	$8, %rcx
	salq	$8, %rdx
	orq	%rax, %rcx
	movzbl	65(%rsp), %eax
	salq	$8, %rcx
	orq	%rax, %rcx
	movzbl	75(%rsp), %eax
	salq	$8, %rcx
	orq	%rax, %rcx
	movzbl	16(%rsp), %eax
	orq	%rax, %rdx
	movzbl	26(%rsp), %eax
	salq	$8, %rdx
	orq	%rax, %rdx
	movzbl	36(%rsp), %eax
	salq	$8, %rdx
	orq	%rax, %rdx
	movzbl	46(%rsp), %eax
	salq	$8, %rdx
	orq	%rax, %rdx
	movzbl	56(%rsp), %eax
	salq	$8, %rdx
	orq	%rax, %rdx
	movzbl	66(%rsp), %eax
	salq	$8, %rdx
	orq	%rax, %rdx
	movzbl	76(%rsp), %eax
	salq	$8, %rdx
	orq	%rax, %rdx
	movzbl	7(%rsp), %eax
	salq	$8, %rax
	orq	%r10, %rax
	movzbl	27(%rsp), %r10d
	salq	$8, %rax
	orq	%r10, %rax
	movzbl	37(%rsp), %r10d
	salq	$8, %rax
	orq	%r10, %rax
	movzbl	47(%rsp), %r10d
	salq	$8, %rax
	orq	%r10, %rax
	movzbl	57(%rsp), %r10d
	salq	$8, %rax
	orq	%r10, %rax
	movzbl	67(%rsp), %r10d
	salq	$8, %rax
	orq	%r10, %rax
	movzbl	77(%rsp), %r10d
	salq	$8, %rax
	orq	%r10, %rax
	movzbl	(%rsp), %r10d
	salq	$8, %r10
	orq	%r11, %r10
	movzbl	20(%rsp), %r11d
	salq	$8, %r10
	orq	%r11, %r10
	movzbl	30(%rsp), %r11d
	salq	$8, %r10
	orq	%r11, %r10
	movzbl	40(%rsp), %r11d
	salq	$8, %r10
	orq	%r11, %r10
	movzbl	50(%rsp), %r11d
	salq	$8, %r10
	orq	%r11, %r10
	movzbl	60(%rsp), %r11d
	salq	$8, %r10
	orq	%r11, %r10
	movzbl	70(%rsp), %r11d
	salq	$8, %r10
	orq	%r11, %r10
	movq	%r10, (%rsp)
	movb	$0, 8(%rsp)
	movq	%r9, 10(%rsp)
	movb	$0, 18(%rsp)
	movq	%r8, 20(%rsp)
	movb	$0, 28(%rsp)
	movq	%rdi, 30(%rsp)
	movb	$0, 38(%rsp)
	movq	%rsi, 40(%rsp)
	movb	$0, 48(%rsp)
	movq	%rcx, 50(%rsp)
	movb	$0, 58(%rsp)
	movq	%rdx, 60(%rsp)
	movb	$0, 68(%rsp)
	movq	%rax, 70(%rsp)
	movb	$0, 78(%rsp)
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r13, %rdi
	addq	$10, %r13
	call	puts@PLT
	cmpq	%r13, %rbx
	jne	.L6
	addl	$1, %ebp
	cmpl	$3, %ebp
	jne	.L7
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$120, %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
.L4:
	.cfi_restore_state
	movq	%r14, %rdi
	call	puts@PLT
	jmp	.L5
.L3:
	movq	%r15, %rdi
	call	puts@PLT
	jmp	.L5
.L14:
	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:

#include <stdio.h>

int main(void)
{
	char pattern[10][10];
	char buf[10][10];
	int x, y, i, j;
	
	for (i = 0; i < 8; i++){
		scanf("%s", pattern[i]);
	}
	
	
	/*pattern[y][x]*/
	for (i = 0; i < 3; i++){
		switch (i){
		  case 0:
		  	printf("90\n");
			break;
			
		  case 1:
		  	printf("180\n");
			break;
			
		  case 2:
		  	printf("270\n");
			break;
		}
		
		/*90度回転*/
		for (y = 0; y < 8; y++){
			for (x = 0; x < 8; x++){
				buf[y][x] = pattern[7 - x][y];
			}
			buf[y][8] = '\0';
		}
		
		for (y = 0; y < 8; y++){
			for (x = 0; x < 8; x++){
				pattern[y][x] = buf[y][x];
			}
			pattern[y][8] = '\0';
		}
		
		for (j = 0; j < 8; j++){
			printf("%s\n", pattern[j]);
		}
	}
	
	return (0);
}
#*******
#*******
"*******
#*******
#*******
#*******
#*******
########
 ****)**
*******
*******
*******
*******
*******
*******
 #*******
#*******
"*******
#*******
#*******
#*******
#*******
$#######
 ****)**
*******
*******
*******
*******
*****+*
*******
 #*******
#*******
"*******
#*******
#**)****
#*******
#*******
$#######
 ****)**
*******
*******
*******
*)*****
*****+*
*******
 #*******
#*******
"*******
#*******
#**)****
#*******
#*)*****
$#######
 ****)**
+******
*******
*******
*)*****
*****+*
*******
 #*******
#*******
"***+***
#*******
#**)****
#*******
#*)*****
$#######
 ****)**
+******
*******
*******
*)*****
*****+*
*****)*

90
#####"##
#*******
#*******
#*******
#*******
#*******
#*******
#*******
180
########
*******#
*******#
*******#
*******#
*******"
*******#
*******#
270
*******#
*******#
*******#
*******#
*******#
*******#
*******#
##"#####
 90








180








270

*******
*******
)******
*******
*******
*******
*******
 90
$####"##
#*******
#*******
#*******
#*******
#*******
#*******
#*******
180
#######$
*******#
*******#
*******#
*******#
*******"
*******#
*******#
270
*******#
*******#
*******#
*******#
*******#
*******#
*******#
##"####$
 90








180








270

*******
*****+*
)******
*******
*******
*******
*******
 90
$####"##
#*******
#*******
#**)****
#*******
#*******
#*******
#*******
180
#######$
*******#
*******#
****)**#
*******#
*******"
*******#
*******#
270
*******#
*******#
*******#
*******#
****)**#
*******#
*******#
##"####$
 90








180








270

*******
*****+*
)******
*******
*******
****)**
*******
 90
$####"##
#*******
#)******
#**)****
#*******
#*******
#*******
#*******
180
#######$
*****)*#
*******#
****)**#
*******#
*******"
*******#
*******#
270
*******#
*******#
*******#
*******#
****)**#
******)#
*******#
##"####$
 90








180








270

*******
*****+*
)******
*******
*******
****)**
*+*****
 90
$####"##
#*******
#)******
#**)****
#****+**
#*******
#*******
#*******
180
#######$
*****)*#
*******#
****)**#
*******#
***+***"
*******#
*******#
270
*******#
*******#
*******#
**+****#
****)**#
******)#
*******#
##"####$
 90








180








270

*******
*****+)
)******
*******
*******
****)**
*+*****

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 main(void)
{
	char pattern[10][10];
	char buf[10][10];
	int x, y, i, j;
	
	for (i = 0; i < 8; i++){
		scanf("%s", pattern[i]);
	}
	
	
	/*pattern[y][x]*/
	for (i = 0; i < 3; i++){
		switch (i){
		  case 0:
		  	printf("90\n");
			break;
			
		  case 1:
		  	printf("180\n");
			break;
			
		  case 2:
		  	printf("270\n");
			break;
		}
		
		/*90度回転*/
		for (y = 0; y < 8; y++){
			for (x = 0; x < 8; x++){
				buf[y][x] = pattern[7 - x][y];
			}
			buf[y][8] = '\0';
		}
		
		for (y = 0; y < 8; y++){
			for (x = 0; x < 8; x++){
				pattern[y][x] = buf[y][x];
			}
			pattern[y][8] = '\0';
		}
		
		for (j = 0; j < 8; j++){
			printf("%s\n", pattern[j]);
		}
	}
	
	return (0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"90"
.LC2:
	.string	"180"
.LC3:
	.string	"270"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$240, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -232(%rbp)
	jmp	.L2
.L3:
	leaq	-224(%rbp), %rcx
	movl	-232(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -232(%rbp)
.L2:
	cmpl	$7, -232(%rbp)
	jle	.L3
	movl	$0, -232(%rbp)
	jmp	.L4
.L19:
	cmpl	$2, -232(%rbp)
	je	.L5
	cmpl	$2, -232(%rbp)
	jg	.L6
	cmpl	$0, -232(%rbp)
	je	.L7
	cmpl	$1, -232(%rbp)
	je	.L8
	jmp	.L6
.L7:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L6
.L8:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L6
.L5:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	nop
.L6:
	movl	$0, -236(%rbp)
	jmp	.L9
.L12:
	movl	$0, -240(%rbp)
	jmp	.L10
.L11:
	movl	$7, %eax
	subl	-240(%rbp), %eax
	movl	-236(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$224, %rax
	movzbl	(%rax), %edx
	movl	-240(%rbp), %eax
	movslq	%eax, %rsi
	movl	-236(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$112, %rax
	movb	%dl, (%rax)
	addl	$1, -240(%rbp)
.L10:
	cmpl	$7, -240(%rbp)
	jle	.L11
	movl	-236(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	subq	$104, %rax
	movb	$0, (%rax)
	addl	$1, -236(%rbp)
.L9:
	cmpl	$7, -236(%rbp)
	jle	.L12
	movl	$0, -236(%rbp)
	jmp	.L13
.L16:
	movl	$0, -240(%rbp)
	jmp	.L14
.L15:
	movl	-240(%rbp), %eax
	movslq	%eax, %rcx
	movl	-236(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$112, %rax
	movzbl	(%rax), %edx
	movl	-240(%rbp), %eax
	movslq	%eax, %rsi
	movl	-236(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$224, %rax
	movb	%dl, (%rax)
	addl	$1, -240(%rbp)
.L14:
	cmpl	$7, -240(%rbp)
	jle	.L15
	movl	-236(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	subq	$216, %rax
	movb	$0, (%rax)
	addl	$1, -236(%rbp)
.L13:
	cmpl	$7, -236(%rbp)
	jle	.L16
	movl	$0, -228(%rbp)
	jmp	.L17
.L18:
	leaq	-224(%rbp), %rcx
	movl	-228(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movq	%rax, %rdi
	call	puts@PLT
	addl	$1, -228(%rbp)
.L17:
	cmpl	$7, -228(%rbp)
	jle	.L18
	addl	$1, -232(%rbp)
.L4:
	cmpl	$2, -232(%rbp)
	jle	.L19
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"90"
.LC2:
	.string	"180"
.LC3:
	.string	"270"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$240, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -232(%rbp)
	jmp	.L2
.L3:
	leaq	-224(%rbp), %rcx
	movl	-232(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -232(%rbp)
.L2:
	cmpl	$7, -232(%rbp)
	jle	.L3
	movl	$0, -232(%rbp)
	jmp	.L4
.L19:
	cmpl	$2, -232(%rbp)
	je	.L5
	cmpl	$2, -232(%rbp)
	jg	.L6
	cmpl	$0, -232(%rbp)
	je	.L7
	cmpl	$1, -232(%rbp)
	je	.L8
	jmp	.L6
.L7:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L6
.L8:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L6
.L5:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	nop
.L6:
	movl	$0, -236(%rbp)
	jmp	.L9
.L12:
	movl	$0, -240(%rbp)
	jmp	.L10
.L11:
	movl	$7, %eax
	subl	-240(%rbp), %eax
	movl	-236(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$224, %rax
	movzbl	(%rax), %edx
	movl	-240(%rbp), %eax
	movslq	%eax, %rsi
	movl	-236(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$112, %rax
	movb	%dl, (%rax)
	addl	$1, -240(%rbp)
.L10:
	cmpl	$7, -240(%rbp)
	jle	.L11
	movl	-236(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	subq	$104, %rax
	movb	$0, (%rax)
	addl	$1, -236(%rbp)
.L9:
	cmpl	$7, -236(%rbp)
	jle	.L12
	movl	$0, -236(%rbp)
	jmp	.L13
.L16:
	movl	$0, -240(%rbp)
	jmp	.L14
.L15:
	movl	-240(%rbp), %eax
	movslq	%eax, %rcx
	movl	-236(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$112, %rax
	movzbl	(%rax), %edx
	movl	-240(%rbp), %eax
	movslq	%eax, %rsi
	movl	-236(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$224, %rax
	movb	%dl, (%rax)
	addl	$1, -240(%rbp)
.L14:
	cmpl	$7, -240(%rbp)
	jle	.L15
	movl	-236(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rbp, %rax
	subq	$216, %rax
	movb	$0, (%rax)
	addl	$1, -236(%rbp)
.L13:
	cmpl	$7, -236(%rbp)
	jle	.L16
	movl	$0, -228(%rbp)
	jmp	.L17
.L18:
	leaq	-224(%rbp), %rcx
	movl	-228(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movq	%rax, %rdi
	call	puts@PLT
	addl	$1, -228(%rbp)
.L17:
	cmpl	$7, -228(%rbp)
	jle	.L18
	addl	$1, -232(%rbp)
.L4:
	cmpl	$2, -232(%rbp)
	jle	.L19
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
