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>
#include <string.h>

int main() {
    int N, M, i, lock;
    char U[300][11];
    char s[11];

    scanf("%d", &N);

    for (i = 0; i < N; i++) { scanf("%s", U[i]); }

    scanf("%d", &M);

    lock = 1;

    while (M--) {
        scanf("%s", s);
        for (i = 0; i < N; i++) {
            if (strcmp(s, U[i]) == 0 && lock) {
                printf("Opened by %s\n", s);
                lock = 0;
                break;
            }
            else if (strcmp(s, U[i]) == 0 && !lock) {
                printf("Closed by %s\n", s);
                lock = 1;
                break;
            }
            if (i == N-1) { printf("Unknown %s\n", s); }
        }
    }
    return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"Opened by %s\n"
.LC3:
	.string	"Unknown %s\n"
.LC4:
	.string	"Closed by %s\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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
	movq	%r13, %rdi
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$3352, %rsp
	.cfi_def_cfa_offset 3408
	movq	%fs:40, %rax
	movq	%rax, 3336(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	16(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$11, %rbp
	cmpl	%ebx, 8(%rsp)
	jg	.L4
.L5:
	movq	%r13, %rdi
	leaq	12(%rsp), %rsi
	xorl	%eax, %eax
	movl	$1, %r12d
	call	__isoc99_scanf@PLT
	leaq	.LC3(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	je	.L8
.L29:
	leaq	3325(%rsp), %r15
.L7:
	movq	%r15, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %r14d
	leaq	16(%rsp), %rbp
	testl	%r14d, %r14d
	jle	.L13
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%rbp, %rsi
	movq	%r15, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L9
	movq	%r15, %rdx
	testl	%r12d, %r12d
	jne	.L28
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	$1, %r12d
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	jne	.L29
.L8:
	movq	3336(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$3352, %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
.L9:
	.cfi_restore_state
	leal	-1(%r14), %eax
	cmpl	%ebx, %eax
	je	.L31
	addl	$1, %ebx
	addq	$11, %rbp
	cmpl	%r14d, %ebx
	jl	.L14
.L13:
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	jne	.L7
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%r15, %rdx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	8(%rsp), %r14d
	addl	$1, %ebx
	addq	$11, %rbp
	cmpl	%r14d, %ebx
	jl	.L14
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	jne	.L7
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L28:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%r12d, %r12d
	call	__printf_chk@PLT
	jmp	.L3
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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"
.LC1:
	.string	"%s"
.LC2:
	.string	"Opened by %s\n"
.LC3:
	.string	"Unknown %s\n"
.LC4:
	.string	"Closed by %s\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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
	movq	%r13, %rdi
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$3352, %rsp
	.cfi_def_cfa_offset 3408
	movq	%fs:40, %rax
	movq	%rax, 3336(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	16(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$11, %rbp
	cmpl	%ebx, 8(%rsp)
	jg	.L4
.L5:
	movq	%r13, %rdi
	leaq	12(%rsp), %rsi
	xorl	%eax, %eax
	movl	$1, %r12d
	call	__isoc99_scanf@PLT
	leaq	.LC3(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	je	.L8
.L29:
	leaq	3325(%rsp), %r15
.L7:
	movq	%r15, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %r14d
	leaq	16(%rsp), %rbp
	testl	%r14d, %r14d
	jle	.L13
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%rbp, %rsi
	movq	%r15, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L9
	movq	%r15, %rdx
	testl	%r12d, %r12d
	jne	.L28
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	$1, %r12d
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	jne	.L29
.L8:
	movq	3336(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$3352, %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
.L9:
	.cfi_restore_state
	leal	-1(%r14), %eax
	cmpl	%ebx, %eax
	je	.L31
	addl	$1, %ebx
	addq	$11, %rbp
	cmpl	%r14d, %ebx
	jl	.L14
.L13:
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	jne	.L7
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%r15, %rdx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	8(%rsp), %r14d
	addl	$1, %ebx
	addq	$11, %rbp
	cmpl	%r14d, %ebx
	jl	.L14
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	jne	.L7
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L28:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%r12d, %r12d
	call	__printf_chk@PLT
	jmp	.L3
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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"
.LC1:
	.string	"%s"
.LC2:
	.string	"Opened by %s\n"
.LC3:
	.string	"Unknown %s\n"
.LC4:
	.string	"Closed by %s\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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
	movq	%r13, %rdi
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$3352, %rsp
	.cfi_def_cfa_offset 3408
	movq	%fs:40, %rax
	movq	%rax, 3336(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	16(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$11, %rbp
	cmpl	%ebx, 8(%rsp)
	jg	.L4
.L5:
	movq	%r13, %rdi
	leaq	12(%rsp), %rsi
	xorl	%eax, %eax
	movl	$1, %r12d
	call	__isoc99_scanf@PLT
	leaq	.LC3(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	je	.L8
.L29:
	leaq	3325(%rsp), %r15
.L7:
	movq	%r15, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %r14d
	leaq	16(%rsp), %rbp
	testl	%r14d, %r14d
	jle	.L13
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%rbp, %rsi
	movq	%r15, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L9
	movq	%r15, %rdx
	testl	%r12d, %r12d
	jne	.L28
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	$1, %r12d
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	jne	.L29
.L8:
	movq	3336(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$3352, %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
.L9:
	.cfi_restore_state
	leal	-1(%r14), %eax
	cmpl	%ebx, %eax
	je	.L31
	addl	$1, %ebx
	addq	$11, %rbp
	cmpl	%r14d, %ebx
	jl	.L14
.L13:
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	jne	.L7
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%r15, %rdx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	8(%rsp), %r14d
	addl	$1, %ebx
	addq	$11, %rbp
	cmpl	%r14d, %ebx
	jl	.L14
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	jne	.L7
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L28:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%r12d, %r12d
	call	__printf_chk@PLT
	jmp	.L3
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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>
#include <string.h>

int main() {
    int N, M, i, lock;
    char U[300][11];
    char s[11];

    scanf("%d", &N);

    for (i = 0; i < N; i++) { scanf("%s", U[i]); }

    scanf("%d", &M);

    lock = 1;

    while (M--) {
        scanf("%s", s);
        for (i = 0; i < N; i++) {
            if (strcmp(s, U[i]) == 0 && lock) {
                printf("Opened by %s\n", s);
                lock = 0;
                break;
            }
            else if (strcmp(s, U[i]) == 0 && !lock) {
                printf("Closed by %s\n", s);
                lock = 1;
                break;
            }
            if (i == N-1) { printf("Unknown %s\n", s); }
        }
    }
    return 0;
}
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <string.h>

int main() {
    int N, M, i, lock;
    char U[300][11];
    char s[11];

    scanf("%d", &N);

    for (i = 0; i < N; i++) { scanf("%s", U[i]); }

    scanf("%d", &M);

    lock = 1;

    while (M--) {
        scanf("%s", s);
        for (i = 0; i < N; i++) {
            if (strcmp(s, U[i]) == 0 && lock) {
                printf("Opened by %s\n", s);
                lock = 0;
                break;
            }
            else if (strcmp(s, U[i]) == 0 && !lock) {
                printf("Closed by %s\n", s);
                lock = 1;
                break;
            }
            if (i == N-1) { printf("Unknown %s\n", s); }
        }
    }
    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
abcd
efgh
ijkl
mnop
5
abcd
abcc
efgh
abcd
mnop

Opened by abcd
Unknown abcc
Closed by efgh
Opened by abcd
Closed by mnop

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>
#include <string.h>

int main() {
    int N, M, i, lock;
    char U[300][11];
    char s[11];

    scanf("%d", &N);

    for (i = 0; i < N; i++) { scanf("%s", U[i]); }

    scanf("%d", &M);

    lock = 1;

    while (M--) {
        scanf("%s", s);
        for (i = 0; i < N; i++) {
            if (strcmp(s, U[i]) == 0 && lock) {
                printf("Opened by %s\n", s);
                lock = 0;
                break;
            }
            else if (strcmp(s, U[i]) == 0 && !lock) {
                printf("Closed by %s\n", s);
                lock = 1;
                break;
            }
            if (i == N-1) { printf("Unknown %s\n", s); }
        }
    }
    return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"Opened by %s\n"
.LC3:
	.string	"Unknown %s\n"
.LC4:
	.string	"Closed by %s\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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
	movq	%r13, %rdi
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$3352, %rsp
	.cfi_def_cfa_offset 3408
	movq	%fs:40, %rax
	movq	%rax, 3336(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	16(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$11, %rbp
	cmpl	%ebx, 8(%rsp)
	jg	.L4
.L5:
	movq	%r13, %rdi
	leaq	12(%rsp), %rsi
	xorl	%eax, %eax
	movl	$1, %r12d
	call	__isoc99_scanf@PLT
	leaq	.LC3(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	je	.L8
.L29:
	leaq	3325(%rsp), %r15
.L7:
	movq	%r15, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %r14d
	leaq	16(%rsp), %rbp
	testl	%r14d, %r14d
	jle	.L13
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%rbp, %rsi
	movq	%r15, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L9
	movq	%r15, %rdx
	testl	%r12d, %r12d
	jne	.L28
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	$1, %r12d
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	jne	.L29
.L8:
	movq	3336(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$3352, %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
.L9:
	.cfi_restore_state
	leal	-1(%r14), %eax
	cmpl	%ebx, %eax
	je	.L31
	addl	$1, %ebx
	addq	$11, %rbp
	cmpl	%r14d, %ebx
	jl	.L14
.L13:
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	jne	.L7
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%r15, %rdx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	8(%rsp), %r14d
	addl	$1, %ebx
	addq	$11, %rbp
	cmpl	%r14d, %ebx
	jl	.L14
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	jne	.L7
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L28:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%r12d, %r12d
	call	__printf_chk@PLT
	jmp	.L3
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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"
.LC1:
	.string	"%s"
.LC2:
	.string	"Opened by %s\n"
.LC3:
	.string	"Unknown %s\n"
.LC4:
	.string	"Closed by %s\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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
	movq	%r13, %rdi
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$3352, %rsp
	.cfi_def_cfa_offset 3408
	movq	%fs:40, %rax
	movq	%rax, 3336(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	16(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$11, %rbp
	cmpl	%ebx, 8(%rsp)
	jg	.L4
.L5:
	movq	%r13, %rdi
	leaq	12(%rsp), %rsi
	xorl	%eax, %eax
	movl	$1, %r12d
	call	__isoc99_scanf@PLT
	leaq	.LC3(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	je	.L8
.L29:
	leaq	3325(%rsp), %r15
.L7:
	movq	%r15, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %r14d
	leaq	16(%rsp), %rbp
	testl	%r14d, %r14d
	jle	.L13
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%rbp, %rsi
	movq	%r15, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L9
	movq	%r15, %rdx
	testl	%r12d, %r12d
	jne	.L28
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	$1, %r12d
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	jne	.L29
.L8:
	movq	3336(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$3352, %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
.L9:
	.cfi_restore_state
	leal	-1(%r14), %eax
	cmpl	%ebx, %eax
	je	.L31
	addl	$1, %ebx
	addq	$11, %rbp
	cmpl	%r14d, %ebx
	jl	.L14
.L13:
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	jne	.L7
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%r15, %rdx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	8(%rsp), %r14d
	addl	$1, %ebx
	addq	$11, %rbp
	cmpl	%r14d, %ebx
	jl	.L14
	movl	12(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 12(%rsp)
	testl	%eax, %eax
	jne	.L7
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L28:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%r12d, %r12d
	call	__printf_chk@PLT
	jmp	.L3
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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:
```