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

```c
// AOJ 1027: A Piece of Cake
// 2017.8.17 bal4u@uu
// 2017.12.15

#include <stdio.h>

char buf[20000], *p;

int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	p++;
	return n;
}

int main()
{
	int K, i, s;
	
	while (fgets(p=buf, 10, stdin) && *p != '0') {
		K = getint();
		fgets(p=buf, sizeof(buf), stdin);
		s = 0, i = K*(K-1) >> 1; while (i--) s += getint();
		printf("%d\n", s / (K - 1));
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	getint
	.type	getint, @function
getint:
.LFB23:
	.cfi_startproc
	endbr64
	movq	p(%rip), %rsi
	cmpb	$47, (%rsi)
	jle	.L4
	leaq	1(%rsi), %rax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rsi
	addq	$1, %rax
	leal	(%r8,%r8,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r8d
	jg	.L3
	addq	$1, %rsi
	movl	%r8d, %eax
	movq	%rsi, p(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%r8d, %r8d
	addq	$1, %rsi
	movq	%rsi, p(%rip)
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	getint, .-getint
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	buf(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L8:
	movq	stdin(%rip), %rdx
	movl	$10, %esi
	movq	%rbx, %rdi
	movq	%rbx, p(%rip)
	call	fgets@PLT
	testq	%rax, %rax
	je	.L21
	movq	p(%rip), %rax
	movzbl	(%rax), %edx
	cmpb	$48, %dl
	je	.L21
	movq	stdin(%rip), %r8
	addq	$1, %rax
	xorl	%r12d, %r12d
	cmpb	$47, %dl
	jle	.L34
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	addq	$1, %rax
	leal	(%r12,%r12,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r12d
	jg	.L9
	movq	%r8, %rdx
	movl	$20000, %esi
	movq	%rbx, %rdi
	movq	%rbx, p(%rip)
	call	fgets@PLT
	leal	-1(%r12), %r9d
	movl	%r12d, %eax
	imull	%r9d, %eax
	sarl	%eax
	leal	-1(%rax), %edx
	je	.L10
	movq	p(%rip), %rcx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L11:
	xorl	%esi, %esi
	cmpb	$47, (%rcx)
	leaq	1(%rcx), %rdi
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rdi, p(%rip)
	leal	(%rsi,%rsi,4), %r8d
	movzbl	-1(%rdi), %esi
	movq	%rdi, %rcx
	leaq	1(%rdi), %rdi
	andl	$15, %esi
	cmpb	$47, (%rcx)
	leal	(%rsi,%r8,2), %esi
	jg	.L12
	addl	%esi, %eax
.L14:
	addq	$1, %rcx
	movq	%rcx, p(%rip)
	subl	$1, %edx
	jnb	.L11
	cltd
	idivl	%r9d
.L10:
	movl	%eax, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L21:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L34:
	.cfi_restore_state
	movq	%r8, %rdx
	movl	$20000, %esi
	movq	%rbx, %rdi
	movq	%rbx, p(%rip)
	call	fgets@PLT
	xorl	%eax, %eax
	jmp	.L10
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 20000
buf:
	.zero	20000
	.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	getint
	.type	getint, @function
getint:
.LFB23:
	.cfi_startproc
	endbr64
	movq	p(%rip), %rsi
	cmpb	$47, (%rsi)
	jle	.L4
	leaq	1(%rsi), %rax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rsi
	addq	$1, %rax
	leal	(%r8,%r8,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r8d
	jg	.L3
	addq	$1, %rsi
	movl	%r8d, %eax
	movq	%rsi, p(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%r8d, %r8d
	addq	$1, %rsi
	movq	%rsi, p(%rip)
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	getint, .-getint
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	buf(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L8:
	movq	stdin(%rip), %rdx
	movl	$10, %esi
	movq	%rbx, %rdi
	movq	%rbx, p(%rip)
	call	fgets@PLT
	testq	%rax, %rax
	je	.L21
	movq	p(%rip), %rax
	movzbl	(%rax), %edx
	cmpb	$48, %dl
	je	.L21
	movq	stdin(%rip), %r8
	addq	$1, %rax
	xorl	%r12d, %r12d
	cmpb	$47, %dl
	jle	.L34
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	addq	$1, %rax
	leal	(%r12,%r12,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r12d
	jg	.L9
	movq	%r8, %rdx
	movl	$20000, %esi
	movq	%rbx, %rdi
	movq	%rbx, p(%rip)
	call	fgets@PLT
	leal	-1(%r12), %r9d
	movl	%r12d, %eax
	imull	%r9d, %eax
	sarl	%eax
	leal	-1(%rax), %edx
	je	.L10
	movq	p(%rip), %rcx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L11:
	xorl	%esi, %esi
	cmpb	$47, (%rcx)
	leaq	1(%rcx), %rdi
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rdi, p(%rip)
	leal	(%rsi,%rsi,4), %r8d
	movzbl	-1(%rdi), %esi
	movq	%rdi, %rcx
	leaq	1(%rdi), %rdi
	andl	$15, %esi
	cmpb	$47, (%rcx)
	leal	(%rsi,%r8,2), %esi
	jg	.L12
	addl	%esi, %eax
.L14:
	addq	$1, %rcx
	movq	%rcx, p(%rip)
	subl	$1, %edx
	jnb	.L11
	cltd
	idivl	%r9d
.L10:
	movl	%eax, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L21:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L34:
	.cfi_restore_state
	movq	%r8, %rdx
	movl	$20000, %esi
	movq	%rbx, %rdi
	movq	%rbx, p(%rip)
	call	fgets@PLT
	xorl	%eax, %eax
	jmp	.L10
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 20000
buf:
	.zero	20000
	.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	getint
	.type	getint, @function
getint:
.LFB23:
	.cfi_startproc
	endbr64
	movq	p(%rip), %rsi
	cmpb	$47, (%rsi)
	jle	.L4
	leaq	1(%rsi), %rax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rsi
	addq	$1, %rax
	leal	(%r8,%r8,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r8d
	jg	.L3
	addq	$1, %rsi
	movl	%r8d, %eax
	movq	%rsi, p(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%r8d, %r8d
	addq	$1, %rsi
	movq	%rsi, p(%rip)
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	getint, .-getint
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	buf(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L8:
	movq	stdin(%rip), %rdx
	movl	$10, %esi
	movq	%rbx, %rdi
	movq	%rbx, p(%rip)
	call	fgets@PLT
	testq	%rax, %rax
	je	.L21
	movq	p(%rip), %rax
	movzbl	(%rax), %edx
	cmpb	$48, %dl
	je	.L21
	movq	stdin(%rip), %r8
	addq	$1, %rax
	xorl	%r12d, %r12d
	cmpb	$47, %dl
	jle	.L34
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	addq	$1, %rax
	leal	(%r12,%r12,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r12d
	jg	.L9
	movq	%r8, %rdx
	movl	$20000, %esi
	movq	%rbx, %rdi
	movq	%rbx, p(%rip)
	call	fgets@PLT
	leal	-1(%r12), %r9d
	movl	%r12d, %eax
	imull	%r9d, %eax
	sarl	%eax
	leal	-1(%rax), %edx
	je	.L10
	movq	p(%rip), %rcx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L11:
	xorl	%esi, %esi
	cmpb	$47, (%rcx)
	leaq	1(%rcx), %rdi
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rdi, p(%rip)
	leal	(%rsi,%rsi,4), %r8d
	movzbl	-1(%rdi), %esi
	movq	%rdi, %rcx
	leaq	1(%rdi), %rdi
	andl	$15, %esi
	cmpb	$47, (%rcx)
	leal	(%rsi,%r8,2), %esi
	jg	.L12
	addl	%esi, %eax
.L14:
	addq	$1, %rcx
	movq	%rcx, p(%rip)
	subl	$1, %edx
	jnb	.L11
	cltd
	idivl	%r9d
.L10:
	movl	%eax, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L21:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L34:
	.cfi_restore_state
	movq	%r8, %rdx
	movl	$20000, %esi
	movq	%rbx, %rdi
	movq	%rbx, p(%rip)
	call	fgets@PLT
	xorl	%eax, %eax
	jmp	.L10
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 20000
buf:
	.zero	20000
	.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
// AOJ 1027: A Piece of Cake
// 2017.8.17 bal4u@uu
// 2017.12.15

#include <stdio.h>

char buf[20000], *p;

int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	p++;
	return n;
}

int main()
{
	int K, i, s;
	
	while (fgets(p=buf, 10, stdin) && *p != '0') {
		K = getint();
		fgets(p=buf, sizeof(buf), stdin);
		s = 0, i = K*(K-1) >> 1; while (i--) s += getint();
		printf("%d\n", s / (K - 1));
	}
	return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
// AOJ 1027: A Piece of Cake
// 2017.8.17 bal4u@uu
// 2017.12.15

#include <stdio.h>

char buf[20000], *p;

int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	p++;
	return n;
}

int main()
{
	int K, i, s;
	
	while (fgets(p=buf, 10, stdin) && *p != '0') {
		K = getint();
		fgets(p=buf, sizeof(buf), stdin);
		s = 0, i = K*(K-1) >> 1; while (i--) s += getint();
		printf("%d\n", s / (K - 1));
	}
	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:

2
2
3
7 4 3
0
 2
2
0
7 4 3
0
 2
2
3
3 4 3
0
 2
0
0
7 8 3
0
 2
1
3
3 4 3
0
 2
1
0
7 14 4
0
 2
2
3
2 1 4
0
 2
2
3
4 1 4
0
 2
1
3
4 5 3
0
 2
-1
0
7 14 4
0

2
7
 2
 2
5
 0
 1
5
 1
 2
3
 2
4
 1
6
 0

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

```c
// AOJ 1027: A Piece of Cake
// 2017.8.17 bal4u@uu
// 2017.12.15

#include <stdio.h>

char buf[20000], *p;

int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	p++;
	return n;
}

int main()
{
	int K, i, s;
	
	while (fgets(p=buf, 10, stdin) && *p != '0') {
		K = getint();
		fgets(p=buf, sizeof(buf), stdin);
		s = 0, i = K*(K-1) >> 1; while (i--) s += getint();
		printf("%d\n", s / (K - 1));
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	getint
	.type	getint, @function
getint:
.LFB23:
	.cfi_startproc
	endbr64
	movq	p(%rip), %rsi
	cmpb	$47, (%rsi)
	jle	.L4
	leaq	1(%rsi), %rax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rsi
	addq	$1, %rax
	leal	(%r8,%r8,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r8d
	jg	.L3
	addq	$1, %rsi
	movl	%r8d, %eax
	movq	%rsi, p(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%r8d, %r8d
	addq	$1, %rsi
	movq	%rsi, p(%rip)
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	getint, .-getint
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	buf(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L8:
	movq	stdin(%rip), %rdx
	movl	$10, %esi
	movq	%rbx, %rdi
	movq	%rbx, p(%rip)
	call	fgets@PLT
	testq	%rax, %rax
	je	.L21
	movq	p(%rip), %rax
	movzbl	(%rax), %edx
	cmpb	$48, %dl
	je	.L21
	movq	stdin(%rip), %r8
	addq	$1, %rax
	xorl	%r12d, %r12d
	cmpb	$47, %dl
	jle	.L34
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	addq	$1, %rax
	leal	(%r12,%r12,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r12d
	jg	.L9
	movq	%r8, %rdx
	movl	$20000, %esi
	movq	%rbx, %rdi
	movq	%rbx, p(%rip)
	call	fgets@PLT
	leal	-1(%r12), %r9d
	movl	%r12d, %eax
	imull	%r9d, %eax
	sarl	%eax
	leal	-1(%rax), %edx
	je	.L10
	movq	p(%rip), %rcx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L11:
	xorl	%esi, %esi
	cmpb	$47, (%rcx)
	leaq	1(%rcx), %rdi
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rdi, p(%rip)
	leal	(%rsi,%rsi,4), %r8d
	movzbl	-1(%rdi), %esi
	movq	%rdi, %rcx
	leaq	1(%rdi), %rdi
	andl	$15, %esi
	cmpb	$47, (%rcx)
	leal	(%rsi,%r8,2), %esi
	jg	.L12
	addl	%esi, %eax
.L14:
	addq	$1, %rcx
	movq	%rcx, p(%rip)
	subl	$1, %edx
	jnb	.L11
	cltd
	idivl	%r9d
.L10:
	movl	%eax, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L21:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L34:
	.cfi_restore_state
	movq	%r8, %rdx
	movl	$20000, %esi
	movq	%rbx, %rdi
	movq	%rbx, p(%rip)
	call	fgets@PLT
	xorl	%eax, %eax
	jmp	.L10
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 20000
buf:
	.zero	20000
	.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	getint
	.type	getint, @function
getint:
.LFB23:
	.cfi_startproc
	endbr64
	movq	p(%rip), %rsi
	cmpb	$47, (%rsi)
	jle	.L4
	leaq	1(%rsi), %rax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rsi
	addq	$1, %rax
	leal	(%r8,%r8,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r8d
	jg	.L3
	addq	$1, %rsi
	movl	%r8d, %eax
	movq	%rsi, p(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%r8d, %r8d
	addq	$1, %rsi
	movq	%rsi, p(%rip)
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	getint, .-getint
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	buf(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L8:
	movq	stdin(%rip), %rdx
	movl	$10, %esi
	movq	%rbx, %rdi
	movq	%rbx, p(%rip)
	call	fgets@PLT
	testq	%rax, %rax
	je	.L21
	movq	p(%rip), %rax
	movzbl	(%rax), %edx
	cmpb	$48, %dl
	je	.L21
	movq	stdin(%rip), %r8
	addq	$1, %rax
	xorl	%r12d, %r12d
	cmpb	$47, %dl
	jle	.L34
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	addq	$1, %rax
	leal	(%r12,%r12,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r12d
	jg	.L9
	movq	%r8, %rdx
	movl	$20000, %esi
	movq	%rbx, %rdi
	movq	%rbx, p(%rip)
	call	fgets@PLT
	leal	-1(%r12), %r9d
	movl	%r12d, %eax
	imull	%r9d, %eax
	sarl	%eax
	leal	-1(%rax), %edx
	je	.L10
	movq	p(%rip), %rcx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L11:
	xorl	%esi, %esi
	cmpb	$47, (%rcx)
	leaq	1(%rcx), %rdi
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rdi, p(%rip)
	leal	(%rsi,%rsi,4), %r8d
	movzbl	-1(%rdi), %esi
	movq	%rdi, %rcx
	leaq	1(%rdi), %rdi
	andl	$15, %esi
	cmpb	$47, (%rcx)
	leal	(%rsi,%r8,2), %esi
	jg	.L12
	addl	%esi, %eax
.L14:
	addq	$1, %rcx
	movq	%rcx, p(%rip)
	subl	$1, %edx
	jnb	.L11
	cltd
	idivl	%r9d
.L10:
	movl	%eax, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L21:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L34:
	.cfi_restore_state
	movq	%r8, %rdx
	movl	$20000, %esi
	movq	%rbx, %rdi
	movq	%rbx, p(%rip)
	call	fgets@PLT
	xorl	%eax, %eax
	jmp	.L10
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 20000
buf:
	.zero	20000
	.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:
```