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>
#include <stdbool.h>
#include <stdlib.h>
//#define DEBUG

int main()
{
    short friends, broughtCake, allMember;
    short numOfCake[100] = {};
    short cakeTotal = 0;

    //read
    scanf("%hd %hd", &friends, &broughtCake);
    for(int i = 0; i < broughtCake; i++)
    {
        scanf("%hd", &numOfCake[i]);
        cakeTotal += numOfCake[i];
    }
    allMember = friends + 1;

#ifdef DEBUG
    printf("friends:%d  cake total:%d\n", friends, cakeTotal);
    short cpf = (cakeTotal - (cakeTotal % allMember))/ allMember;
    printf("cake/member:%d rem:%d\n", cpf, cakeTotal % allMember);
#endif

    //sum
    short myCake = (cakeTotal - (cakeTotal % allMember))/ allMember;
    if((cakeTotal % allMember) != 0)
    {
        myCake++;
    }

    //output
    printf("%d\n", myCake);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%hd %hd"
.LC1:
	.string	"%hd"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$224, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-208(%rbp), %rdx
	movl	$0, %eax
	movl	$25, %ecx
	movq	%rdx, %rdi
	rep stosq
	movw	$0, -218(%rbp)
	leaq	-220(%rbp), %rdx
	leaq	-222(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -212(%rbp)
	jmp	.L2
.L3:
	leaq	-208(%rbp), %rdx
	movl	-212(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-212(%rbp), %eax
	cltq
	movzwl	-208(%rbp,%rax,2), %eax
	movl	%eax, %edx
	movzwl	-218(%rbp), %eax
	addl	%edx, %eax
	movw	%ax, -218(%rbp)
	addl	$1, -212(%rbp)
.L2:
	movzwl	-220(%rbp), %eax
	cwtl
	cmpl	%eax, -212(%rbp)
	jl	.L3
	movzwl	-222(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -214(%rbp)
	movswl	-218(%rbp), %ecx
	movswl	-218(%rbp), %eax
	movswl	-214(%rbp), %esi
	cltd
	idivl	%esi
	movl	%ecx, %eax
	subl	%edx, %eax
	movswl	-214(%rbp), %esi
	cltd
	idivl	%esi
	movw	%ax, -216(%rbp)
	movswl	-218(%rbp), %eax
	movswl	-214(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	je	.L4
	movzwl	-216(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -216(%rbp)
.L4:
	movswl	-216(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	"%hd %hd"
.LC1:
	.string	"%hd"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$25, %ecx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$232, %rsp
	.cfi_def_cfa_offset 272
	movq	%fs:40, %rax
	movq	%rax, 216(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %r12
	leaq	14(%rsp), %rdx
	movq	%r12, %rdi
	leaq	12(%rsp), %rsi
	rep stosq
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	cmpw	$0, 14(%rsp)
	jle	.L6
	xorl	%ebx, %ebx
	xorl	%ebp, %ebp
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	(%r12,%rbx,2), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movswl	14(%rsp), %eax
	addw	(%r12,%rbx,2), %bp
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jg	.L3
	movzwl	12(%rsp), %eax
	movswl	%bp, %ebp
	leal	1(%rax), %ecx
	movl	%ebp, %eax
	movswl	%cx, %ecx
	cltd
	idivl	%ecx
	subl	%edx, %ebp
	movl	%edx, %esi
	movl	%ebp, %eax
	cltd
	idivl	%ecx
	cmpl	$1, %esi
	movl	%eax, %ebp
	sbbw	$-1, %bp
.L2:
	xorl	%eax, %eax
	movswl	%bp, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	216(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L10
	addq	$232, %rsp
	.cfi_remember_state
	.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
.L6:
	.cfi_restore_state
	xorl	%ebp, %ebp
	jmp	.L2
.L10:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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	"%hd %hd"
.LC1:
	.string	"%hd"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$25, %ecx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$232, %rsp
	.cfi_def_cfa_offset 272
	movq	%fs:40, %rax
	movq	%rax, 216(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %r12
	leaq	14(%rsp), %rdx
	movq	%r12, %rdi
	leaq	12(%rsp), %rsi
	rep stosq
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	cmpw	$0, 14(%rsp)
	jle	.L6
	xorl	%ebx, %ebx
	xorl	%ebp, %ebp
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	(%r12,%rbx,2), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movswl	14(%rsp), %eax
	addw	(%r12,%rbx,2), %bp
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jg	.L3
	movzwl	12(%rsp), %eax
	movswl	%bp, %ebp
	leal	1(%rax), %ecx
	movl	%ebp, %eax
	movswl	%cx, %ecx
	cltd
	idivl	%ecx
	subl	%edx, %ebp
	movl	%edx, %esi
	movl	%ebp, %eax
	cltd
	idivl	%ecx
	cmpl	$1, %esi
	movl	%eax, %ebp
	sbbw	$-1, %bp
.L2:
	xorl	%eax, %eax
	movswl	%bp, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	216(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L10
	addq	$232, %rsp
	.cfi_remember_state
	.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
.L6:
	.cfi_restore_state
	xorl	%ebp, %ebp
	jmp	.L2
.L10:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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>
#include <stdbool.h>
#include <stdlib.h>
//#define DEBUG

int main()
{
    short friends, broughtCake, allMember;
    short numOfCake[100] = {};
    short cakeTotal = 0;

    //read
    scanf("%hd %hd", &friends, &broughtCake);
    for(int i = 0; i < broughtCake; i++)
    {
        scanf("%hd", &numOfCake[i]);
        cakeTotal += numOfCake[i];
    }
    allMember = friends + 1;

#ifdef DEBUG
    printf("friends:%d  cake total:%d\n", friends, cakeTotal);
    short cpf = (cakeTotal - (cakeTotal % allMember))/ allMember;
    printf("cake/member:%d rem:%d\n", cpf, cakeTotal % allMember);
#endif

    //sum
    short myCake = (cakeTotal - (cakeTotal % allMember))/ allMember;
    if((cakeTotal % allMember) != 0)
    {
        myCake++;
    }

    //output
    printf("%d\n", myCake);
}

4 5
8 8 8 8 8
 5 2
5 5 6 5
 100 3
1 3 3
 4 5
8 8 2 8 8
 4 5
8 8 2 0 8
 4 5
8 7 2 0 8
 1 5
8 7 2 0 8
 1 5
8 7 4 0 8
 0 5
8 7 4 0 8
 5 4
2 7 5 10

8
 2
 1
 7
 6
 5
 13
 14
 27
 4

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>
#include <stdbool.h>
#include <stdlib.h>
//#define DEBUG

int main()
{
    short friends, broughtCake, allMember;
    short numOfCake[100] = {};
    short cakeTotal = 0;

    //read
    scanf("%hd %hd", &friends, &broughtCake);
    for(int i = 0; i < broughtCake; i++)
    {
        scanf("%hd", &numOfCake[i]);
        cakeTotal += numOfCake[i];
    }
    allMember = friends + 1;

#ifdef DEBUG
    printf("friends:%d  cake total:%d\n", friends, cakeTotal);
    short cpf = (cakeTotal - (cakeTotal % allMember))/ allMember;
    printf("cake/member:%d rem:%d\n", cpf, cakeTotal % allMember);
#endif

    //sum
    short myCake = (cakeTotal - (cakeTotal % allMember))/ allMember;
    if((cakeTotal % allMember) != 0)
    {
        myCake++;
    }

    //output
    printf("%d\n", myCake);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%hd %hd"
.LC1:
	.string	"%hd"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$224, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-208(%rbp), %rdx
	movl	$0, %eax
	movl	$25, %ecx
	movq	%rdx, %rdi
	rep stosq
	movw	$0, -218(%rbp)
	leaq	-220(%rbp), %rdx
	leaq	-222(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -212(%rbp)
	jmp	.L2
.L3:
	leaq	-208(%rbp), %rdx
	movl	-212(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-212(%rbp), %eax
	cltq
	movzwl	-208(%rbp,%rax,2), %eax
	movl	%eax, %edx
	movzwl	-218(%rbp), %eax
	addl	%edx, %eax
	movw	%ax, -218(%rbp)
	addl	$1, -212(%rbp)
.L2:
	movzwl	-220(%rbp), %eax
	cwtl
	cmpl	%eax, -212(%rbp)
	jl	.L3
	movzwl	-222(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -214(%rbp)
	movswl	-218(%rbp), %ecx
	movswl	-218(%rbp), %eax
	movswl	-214(%rbp), %esi
	cltd
	idivl	%esi
	movl	%ecx, %eax
	subl	%edx, %eax
	movswl	-214(%rbp), %esi
	cltd
	idivl	%esi
	movw	%ax, -216(%rbp)
	movswl	-218(%rbp), %eax
	movswl	-214(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	je	.L4
	movzwl	-216(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -216(%rbp)
.L4:
	movswl	-216(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	"%hd %hd"
.LC1:
	.string	"%hd"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$224, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-208(%rbp), %rdx
	movl	$0, %eax
	movl	$25, %ecx
	movq	%rdx, %rdi
	rep stosq
	movw	$0, -218(%rbp)
	leaq	-220(%rbp), %rdx
	leaq	-222(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -212(%rbp)
	jmp	.L2
.L3:
	leaq	-208(%rbp), %rdx
	movl	-212(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-212(%rbp), %eax
	cltq
	movzwl	-208(%rbp,%rax,2), %eax
	movl	%eax, %edx
	movzwl	-218(%rbp), %eax
	addl	%edx, %eax
	movw	%ax, -218(%rbp)
	addl	$1, -212(%rbp)
.L2:
	movzwl	-220(%rbp), %eax
	cwtl
	cmpl	%eax, -212(%rbp)
	jl	.L3
	movzwl	-222(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -214(%rbp)
	movswl	-218(%rbp), %ecx
	movswl	-218(%rbp), %eax
	movswl	-214(%rbp), %esi
	cltd
	idivl	%esi
	movl	%ecx, %eax
	subl	%edx, %eax
	movswl	-214(%rbp), %esi
	cltd
	idivl	%esi
	movw	%ax, -216(%rbp)
	movswl	-218(%rbp), %eax
	movswl	-214(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	je	.L4
	movzwl	-216(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -216(%rbp)
.L4:
	movswl	-216(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
