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>
static int h, w, n, a, i, j, xss[100][100], dx = 1, dy, x, y;
void print(void) {
    int x, y;
    for (y = 0; y < h; ++y) {
        for (x = 0; x < w; ++x) {
            if (x) putchar(' ');
            printf("%d", xss[y][x]);
        }
        putchar('\n');
    }
}
void put(int i) {
    xss[y][x] = i;
    x += dx;
    if (x <= -1 || x >= w) {
        x -= dx;
        ++y;
        dx = -dx;
    }
}
int main(void) {
    scanf("%d%d%d", &h, &w, &n);
    for (i = 1; i <= n; ++i) {
        scanf("%d", &a);
        for (j = 1; j <= a; ++j) put(i);
    }
    print();
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.local	h
	.comm	h,4,4
	.local	w
	.comm	w,4,4
	.local	n
	.comm	n,4,4
	.local	a
	.comm	a,4,4
	.local	i
	.comm	i,4,4
	.local	j
	.comm	j,4,4
	.local	xss
	.comm	xss,40000,32
	.data
	.align 4
	.type	dx, @object
	.size	dx, 4
dx:
	.long	1
	.local	dy
	.comm	dy,4,4
	.local	x
	.comm	x,4,4
	.local	y
	.comm	y,4,4
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	print
	.type	print, @function
print:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -4(%rbp)
	jmp	.L2
.L6:
	movl	$0, -8(%rbp)
	jmp	.L3
.L5:
	cmpl	$0, -8(%rbp)
	je	.L4
	movl	$32, %edi
	call	putchar@PLT
.L4:
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	xss(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -8(%rbp)
.L3:
	movl	w(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L5
	movl	$10, %edi
	call	putchar@PLT
	addl	$1, -4(%rbp)
.L2:
	movl	h(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L6
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	print, .-print
	.globl	put
	.type	put, @function
put:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	xss(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	x(%rip), %edx
	movl	dx(%rip), %eax
	addl	%edx, %eax
	movl	%eax, x(%rip)
	movl	x(%rip), %eax
	testl	%eax, %eax
	js	.L8
	movl	x(%rip), %edx
	movl	w(%rip), %eax
	cmpl	%eax, %edx
	jl	.L10
.L8:
	movl	x(%rip), %eax
	movl	dx(%rip), %edx
	subl	%edx, %eax
	movl	%eax, x(%rip)
	movl	y(%rip), %eax
	addl	$1, %eax
	movl	%eax, y(%rip)
	movl	dx(%rip), %eax
	negl	%eax
	movl	%eax, dx(%rip)
.L10:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	put, .-put
	.section	.rodata
.LC1:
	.string	"%d%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	n(%rip), %rax
	movq	%rax, %rcx
	leaq	w(%rip), %rax
	movq	%rax, %rdx
	leaq	h(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, i(%rip)
	jmp	.L12
.L15:
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, j(%rip)
	jmp	.L13
.L14:
	movl	i(%rip), %eax
	movl	%eax, %edi
	call	put
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L13:
	movl	j(%rip), %edx
	movl	a(%rip), %eax
	cmpl	%eax, %edx
	jle	.L14
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L12:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jle	.L15
	call	print
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	"%d"
	.text
	.p2align 4
	.globl	print
	.type	print, @function
print:
.LFB23:
	.cfi_startproc
	endbr64
	movl	h(%rip), %edx
	testl	%edx, %edx
	jle	.L10
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	xss(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	.p2align 4,,10
	.p2align 3
.L3:
	movl	w(%rip), %eax
	xorl	%ebx, %ebx
	testl	%eax, %eax
	jg	.L5
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	movq	stdout(%rip), %rsi
	movl	$32, %edi
	call	putc@PLT
.L5:
	movl	0(%rbp,%rbx,4), %edx
	xorl	%eax, %eax
	movq	%r12, %rsi
	movl	$1, %edi
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, w(%rip)
	jg	.L4
.L6:
	movq	stdout(%rip), %rsi
	movl	$10, %edi
	addl	$1, %r13d
	addq	$400, %rbp
	call	putc@PLT
	cmpl	%r13d, h(%rip)
	jg	.L3
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L10:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	ret
	.cfi_endproc
.LFE23:
	.size	print, .-print
	.p2align 4
	.globl	put
	.type	put, @function
put:
.LFB24:
	.cfi_startproc
	endbr64
	movslq	y(%rip), %rax
	movslq	x(%rip), %rsi
	movq	%rax, %rdx
	leaq	(%rax,%rax,4), %rax
	movq	%rsi, %rcx
	leaq	(%rax,%rax,4), %rax
	leaq	(%rsi,%rax,4), %rsi
	leaq	xss(%rip), %rax
	movl	%edi, (%rax,%rsi,4)
	movl	dx(%rip), %eax
	leal	(%rcx,%rax), %esi
	movl	%esi, x(%rip)
	testl	%esi, %esi
	js	.L15
	cmpl	w(%rip), %esi
	jl	.L14
.L15:
	addl	$1, %edx
	negl	%eax
	movl	%ecx, x(%rip)
	movl	%edx, y(%rip)
	movl	%eax, dx(%rip)
.L14:
	ret
	.cfi_endproc
.LFE24:
	.size	put, .-put
	.section	.rodata.str1.1
.LC1:
	.string	"%d%d%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	n(%rip), %rcx
	xorl	%eax, %eax
	leaq	w(%rip), %rdx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	h(%rip), %rsi
	leaq	.LC1(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	movl	$1, i(%rip)
	testl	%eax, %eax
	jle	.L24
	leaq	a(%rip), %rbp
	leaq	.LC0(%rip), %rbx
	leaq	xss(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	a(%rip), %r10d
	movl	$1, j(%rip)
	movl	i(%rip), %r9d
	testl	%r10d, %r10d
	jle	.L20
	movslq	y(%rip), %rdx
	movslq	x(%rip), %rax
	xorl	%edi, %edi
	xorl	%r11d, %r11d
	movl	dx(%rip), %ecx
	movl	w(%rip), %r13d
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L26:
	movl	%eax, %edi
	movslq	%r8d, %rdx
	movslq	%esi, %rax
.L23:
	movl	%eax, %esi
	addl	%ecx, %esi
	js	.L21
	movl	%edx, %r8d
	cmpl	%esi, %r13d
	jg	.L22
.L21:
	leal	1(%rdx), %r8d
	negl	%ecx
	movl	%eax, %esi
	movl	$1, %r11d
.L22:
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rdx,4), %rax
	movl	%r9d, (%r12,%rax,4)
	leal	1(%rdi), %eax
	cmpl	%eax, %r10d
	jne	.L26
	addl	$2, %edi
	movl	%esi, x(%rip)
	movl	%edi, j(%rip)
	testb	%r11b, %r11b
	je	.L20
	movl	%ecx, dx(%rip)
	movl	%r8d, y(%rip)
.L20:
	addl	$1, %r9d
	cmpl	n(%rip), %r9d
	movl	%r9d, i(%rip)
	jle	.L18
.L24:
	call	print
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.local	y
	.comm	y,4,4
	.local	x
	.comm	x,4,4
	.data
	.align 4
	.type	dx, @object
	.size	dx, 4
dx:
	.long	1
	.local	xss
	.comm	xss,40000,32
	.local	j
	.comm	j,4,4
	.local	i
	.comm	i,4,4
	.local	a
	.comm	a,4,4
	.local	n
	.comm	n,4,4
	.local	w
	.comm	w,4,4
	.local	h
	.comm	h,4,4
	.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	"%d"
	.text
	.p2align 4
	.globl	print
	.type	print, @function
print:
.LFB23:
	.cfi_startproc
	endbr64
	movl	h(%rip), %edx
	testl	%edx, %edx
	jle	.L10
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	xss(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	.p2align 4,,10
	.p2align 3
.L3:
	movl	w(%rip), %eax
	xorl	%ebx, %ebx
	testl	%eax, %eax
	jg	.L5
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	movq	stdout(%rip), %rsi
	movl	$32, %edi
	call	putc@PLT
.L5:
	movl	0(%rbp,%rbx,4), %edx
	xorl	%eax, %eax
	movq	%r12, %rsi
	movl	$1, %edi
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, w(%rip)
	jg	.L4
.L6:
	movq	stdout(%rip), %rsi
	movl	$10, %edi
	addl	$1, %r13d
	addq	$400, %rbp
	call	putc@PLT
	cmpl	%r13d, h(%rip)
	jg	.L3
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L10:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	ret
	.cfi_endproc
.LFE23:
	.size	print, .-print
	.p2align 4
	.globl	put
	.type	put, @function
put:
.LFB24:
	.cfi_startproc
	endbr64
	movslq	y(%rip), %rax
	movslq	x(%rip), %rsi
	movq	%rax, %rdx
	leaq	(%rax,%rax,4), %rax
	movq	%rsi, %rcx
	leaq	(%rax,%rax,4), %rax
	leaq	(%rsi,%rax,4), %rsi
	leaq	xss(%rip), %rax
	movl	%edi, (%rax,%rsi,4)
	movl	dx(%rip), %eax
	leal	(%rcx,%rax), %esi
	movl	%esi, x(%rip)
	testl	%esi, %esi
	js	.L15
	cmpl	w(%rip), %esi
	jl	.L14
.L15:
	addl	$1, %edx
	negl	%eax
	movl	%ecx, x(%rip)
	movl	%edx, y(%rip)
	movl	%eax, dx(%rip)
.L14:
	ret
	.cfi_endproc
.LFE24:
	.size	put, .-put
	.section	.rodata.str1.1
.LC1:
	.string	"%d%d%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	n(%rip), %rcx
	xorl	%eax, %eax
	leaq	w(%rip), %rdx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	h(%rip), %rsi
	leaq	.LC1(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	movl	$1, i(%rip)
	testl	%eax, %eax
	jle	.L24
	leaq	a(%rip), %rbp
	leaq	.LC0(%rip), %rbx
	leaq	xss(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	a(%rip), %r10d
	movl	$1, j(%rip)
	movl	i(%rip), %r9d
	testl	%r10d, %r10d
	jle	.L20
	movslq	y(%rip), %rdx
	movslq	x(%rip), %rax
	xorl	%edi, %edi
	xorl	%r11d, %r11d
	movl	dx(%rip), %ecx
	movl	w(%rip), %r13d
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L26:
	movl	%eax, %edi
	movslq	%r8d, %rdx
	movslq	%esi, %rax
.L23:
	movl	%eax, %esi
	addl	%ecx, %esi
	js	.L21
	movl	%edx, %r8d
	cmpl	%esi, %r13d
	jg	.L22
.L21:
	leal	1(%rdx), %r8d
	negl	%ecx
	movl	%eax, %esi
	movl	$1, %r11d
.L22:
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rdx,4), %rax
	movl	%r9d, (%r12,%rax,4)
	leal	1(%rdi), %eax
	cmpl	%eax, %r10d
	jne	.L26
	addl	$2, %edi
	movl	%esi, x(%rip)
	movl	%edi, j(%rip)
	testb	%r11b, %r11b
	je	.L20
	movl	%ecx, dx(%rip)
	movl	%r8d, y(%rip)
.L20:
	addl	$1, %r9d
	cmpl	n(%rip), %r9d
	movl	%r9d, i(%rip)
	jle	.L18
.L24:
	call	print
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.local	y
	.comm	y,4,4
	.local	x
	.comm	x,4,4
	.data
	.align 4
	.type	dx, @object
	.size	dx, 4
dx:
	.long	1
	.local	xss
	.comm	xss,40000,32
	.local	j
	.comm	j,4,4
	.local	i
	.comm	i,4,4
	.local	a
	.comm	a,4,4
	.local	n
	.comm	n,4,4
	.local	w
	.comm	w,4,4
	.local	h
	.comm	h,4,4
	.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>
static int h, w, n, a, i, j, xss[100][100], dx = 1, dy, x, y;
void print(void) {
    int x, y;
    for (y = 0; y < h; ++y) {
        for (x = 0; x < w; ++x) {
            if (x) putchar(' ');
            printf("%d", xss[y][x]);
        }
        putchar('\n');
    }
}
void put(int i) {
    xss[y][x] = i;
    x += dx;
    if (x <= -1 || x >= w) {
        x -= dx;
        ++y;
        dx = -dx;
    }
}
int main(void) {
    scanf("%d%d%d", &h, &w, &n);
    for (i = 1; i <= n; ++i) {
        scanf("%d", &a);
        for (j = 1; j <= a; ++j) put(i);
    }
    print();
    return 0;
}
2 2
3
2 1 1

1 1
3 2

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>
static int h, w, n, a, i, j, xss[100][100], dx = 1, dy, x, y;
void print(void) {
    int x, y;
    for (y = 0; y < h; ++y) {
        for (x = 0; x < w; ++x) {
            if (x) putchar(' ');
            printf("%d", xss[y][x]);
        }
        putchar('\n');
    }
}
void put(int i) {
    xss[y][x] = i;
    x += dx;
    if (x <= -1 || x >= w) {
        x -= dx;
        ++y;
        dx = -dx;
    }
}
int main(void) {
    scanf("%d%d%d", &h, &w, &n);
    for (i = 1; i <= n; ++i) {
        scanf("%d", &a);
        for (j = 1; j <= a; ++j) put(i);
    }
    print();
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.local	h
	.comm	h,4,4
	.local	w
	.comm	w,4,4
	.local	n
	.comm	n,4,4
	.local	a
	.comm	a,4,4
	.local	i
	.comm	i,4,4
	.local	j
	.comm	j,4,4
	.local	xss
	.comm	xss,40000,32
	.data
	.align 4
	.type	dx, @object
	.size	dx, 4
dx:
	.long	1
	.local	dy
	.comm	dy,4,4
	.local	x
	.comm	x,4,4
	.local	y
	.comm	y,4,4
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	print
	.type	print, @function
print:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -4(%rbp)
	jmp	.L2
.L6:
	movl	$0, -8(%rbp)
	jmp	.L3
.L5:
	cmpl	$0, -8(%rbp)
	je	.L4
	movl	$32, %edi
	call	putchar@PLT
.L4:
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	xss(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -8(%rbp)
.L3:
	movl	w(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L5
	movl	$10, %edi
	call	putchar@PLT
	addl	$1, -4(%rbp)
.L2:
	movl	h(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L6
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	print, .-print
	.globl	put
	.type	put, @function
put:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	xss(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	x(%rip), %edx
	movl	dx(%rip), %eax
	addl	%edx, %eax
	movl	%eax, x(%rip)
	movl	x(%rip), %eax
	testl	%eax, %eax
	js	.L8
	movl	x(%rip), %edx
	movl	w(%rip), %eax
	cmpl	%eax, %edx
	jl	.L10
.L8:
	movl	x(%rip), %eax
	movl	dx(%rip), %edx
	subl	%edx, %eax
	movl	%eax, x(%rip)
	movl	y(%rip), %eax
	addl	$1, %eax
	movl	%eax, y(%rip)
	movl	dx(%rip), %eax
	negl	%eax
	movl	%eax, dx(%rip)
.L10:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	put, .-put
	.section	.rodata
.LC1:
	.string	"%d%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	n(%rip), %rax
	movq	%rax, %rcx
	leaq	w(%rip), %rax
	movq	%rax, %rdx
	leaq	h(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, i(%rip)
	jmp	.L12
.L15:
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, j(%rip)
	jmp	.L13
.L14:
	movl	i(%rip), %eax
	movl	%eax, %edi
	call	put
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L13:
	movl	j(%rip), %edx
	movl	a(%rip), %eax
	cmpl	%eax, %edx
	jle	.L14
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L12:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jle	.L15
	call	print
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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
	.local	h
	.comm	h,4,4
	.local	w
	.comm	w,4,4
	.local	n
	.comm	n,4,4
	.local	a
	.comm	a,4,4
	.local	i
	.comm	i,4,4
	.local	j
	.comm	j,4,4
	.local	xss
	.comm	xss,40000,32
	.data
	.align 4
	.type	dx, @object
	.size	dx, 4
dx:
	.long	1
	.local	dy
	.comm	dy,4,4
	.local	x
	.comm	x,4,4
	.local	y
	.comm	y,4,4
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	print
	.type	print, @function
print:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -4(%rbp)
	jmp	.L2
.L6:
	movl	$0, -8(%rbp)
	jmp	.L3
.L5:
	cmpl	$0, -8(%rbp)
	je	.L4
	movl	$32, %edi
	call	putchar@PLT
.L4:
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	xss(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -8(%rbp)
.L3:
	movl	w(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L5
	movl	$10, %edi
	call	putchar@PLT
	addl	$1, -4(%rbp)
.L2:
	movl	h(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L6
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	print, .-print
	.globl	put
	.type	put, @function
put:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	xss(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	x(%rip), %edx
	movl	dx(%rip), %eax
	addl	%edx, %eax
	movl	%eax, x(%rip)
	movl	x(%rip), %eax
	testl	%eax, %eax
	js	.L8
	movl	x(%rip), %edx
	movl	w(%rip), %eax
	cmpl	%eax, %edx
	jl	.L10
.L8:
	movl	x(%rip), %eax
	movl	dx(%rip), %edx
	subl	%edx, %eax
	movl	%eax, x(%rip)
	movl	y(%rip), %eax
	addl	$1, %eax
	movl	%eax, y(%rip)
	movl	dx(%rip), %eax
	negl	%eax
	movl	%eax, dx(%rip)
.L10:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	put, .-put
	.section	.rodata
.LC1:
	.string	"%d%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	n(%rip), %rax
	movq	%rax, %rcx
	leaq	w(%rip), %rax
	movq	%rax, %rdx
	leaq	h(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, i(%rip)
	jmp	.L12
.L15:
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, j(%rip)
	jmp	.L13
.L14:
	movl	i(%rip), %eax
	movl	%eax, %edi
	call	put
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L13:
	movl	j(%rip), %edx
	movl	a(%rip), %eax
	cmpl	%eax, %edx
	jle	.L14
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L12:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jle	.L15
	call	print
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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:
