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>

int main()
{
  int i;
  int m, n;
  int total_payment;
  int money;
  int payment;
  
  while (1) {
    total_payment = 0;
    scanf("%d %d", &n, &m);
    if (m == 0 && n == 0) break;
    payment = m / n;
    for (i = 0; i < n; i++) {
      scanf("%d", &money);
      if (money >= payment) {
	total_payment += payment;
      } else {
	total_payment +=  money;
      }
    }
    printf("%d\n", total_payment);
  }

  return 0;
}

```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rax
	leaq	28(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	36(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L7:
	movq	8(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%r15, %rdx
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	movl	32(%rsp), %ecx
	movl	%eax, %edi
	orl	%ecx, %edi
	je	.L2
	cltd
	xorl	%r13d, %r13d
	idivl	%ecx
	movl	%eax, %ebx
	testl	%ecx, %ecx
	jle	.L3
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	xorl	%eax, %eax
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %eax
	leal	0(%r13,%rbx), %esi
	leal	0(%r13,%rax), %edx
	cmpl	%ebx, %eax
	cmovl	%edx, %esi
	addl	$1, %r14d
	movl	%esi, %r13d
	cmpl	%r14d, 32(%rsp)
	jg	.L6
.L3:
	movl	%r13d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L2:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$56, %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
.L13:
	.cfi_restore_state
	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:
```

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 %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rax
	leaq	28(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	36(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L7:
	movq	8(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%r15, %rdx
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	movl	32(%rsp), %ecx
	movl	%eax, %edi
	orl	%ecx, %edi
	je	.L2
	cltd
	xorl	%r13d, %r13d
	idivl	%ecx
	movl	%eax, %ebx
	testl	%ecx, %ecx
	jle	.L3
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	xorl	%eax, %eax
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %eax
	leal	0(%r13,%rbx), %esi
	leal	0(%r13,%rax), %edx
	cmpl	%ebx, %eax
	cmovl	%edx, %esi
	addl	$1, %r14d
	movl	%esi, %r13d
	cmpl	%r14d, 32(%rsp)
	jg	.L6
.L3:
	movl	%r13d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L2:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$56, %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
.L13:
	.cfi_restore_state
	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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rax
	leaq	28(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	36(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L7:
	movq	8(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%r15, %rdx
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	movl	32(%rsp), %ecx
	movl	%eax, %edi
	orl	%ecx, %edi
	je	.L2
	cltd
	xorl	%r13d, %r13d
	idivl	%ecx
	movl	%eax, %ebx
	testl	%ecx, %ecx
	jle	.L3
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	xorl	%eax, %eax
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %eax
	leal	0(%r13,%rbx), %esi
	leal	0(%r13,%rax), %edx
	cmpl	%ebx, %eax
	cmovl	%edx, %esi
	addl	$1, %r14d
	movl	%esi, %r13d
	cmpl	%r14d, 32(%rsp)
	jg	.L6
.L3:
	movl	%r13d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L2:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$56, %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
.L13:
	.cfi_restore_state
	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:
```
```c
#include <stdio.h>

int main()
{
  int i;
  int m, n;
  int total_payment;
  int money;
  int payment;
  
  while (1) {
    total_payment = 0;
    scanf("%d %d", &n, &m);
    if (m == 0 && n == 0) break;
    payment = m / n;
    for (i = 0; i < n; i++) {
      scanf("%d", &money);
      if (money >= payment) {
	total_payment += payment;
      } else {
	total_payment +=  money;
      }
    }
    printf("%d\n", total_payment);
  }

  return 0;
}

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

```c
#include <stdio.h>

int main()
{
  int i;
  int m, n;
  int total_payment;
  int money;
  int payment;
  
  while (1) {
    total_payment = 0;
    scanf("%d %d", &n, &m);
    if (m == 0 && n == 0) break;
    payment = m / n;
    for (i = 0; i < n; i++) {
      scanf("%d", &money);
      if (money >= payment) {
	total_payment += payment;
      } else {
	total_payment +=  money;
      }
    }
    printf("%d\n", total_payment);
  }

  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:

3 300
120 100 80
3 5
10 20 5
4 1000
100 200 300 400
5 5
2523 8430 3 4199 632
0 0
 3 300
120 100 80
3 5
10 20 5
4 1000
100 260 300 400
5 5
2523 8430 3 4199 632
0 0
 3 300
120 100 80
2 5
10 34 5
4 1000
100 200 300 400
5 5
2523 8430 3 4199 632
0 0
 3 300
120 101 80
3 5
10 34 5
4 1000
100 200 159 400
5 5
183 8430 3 4199 632
0 0
 3 276
120 101 80
3 5
10 34 10
4 1000
100 200 159 400
5 5
183 8430 3 4199 632
0 0
 3 276
120 101 93
3 5
10 34 10
4 1000
100 200 159 400
5 5
127 8430 3 4199 632
0 0
 3 276
120 101 93
3 5
10 34 10
4 1000
100 200 159 400
5 5
127 8430 0 4199 632
0 0
 3 300
120 010 80
2 5
12 34 5
4 0000
110 200 300 400
5 5
2523 8430 3 4199 201
0 0
 3 300
120 100 80
3 30
10 20 5
4 1000
100 200 300 400
5 5
2523 8430 3 4199 987
0 0
 3 300
120 101 80
3 5
10 34 5
4 1000
100 200 300 400
5 1
2523 8430 3 4199 632
0 0

280
3
800
5
 280
3
850
5
 280
4
0
5
 280
3
709
5
 264
3
709
5
 276
3
709
5
 276
3
709
4
 190
4
0
5
 280
25
800
5
 280
3
800
0

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>

int main()
{
  int i;
  int m, n;
  int total_payment;
  int money;
  int payment;
  
  while (1) {
    total_payment = 0;
    scanf("%d %d", &n, &m);
    if (m == 0 && n == 0) break;
    payment = m / n;
    for (i = 0; i < n; i++) {
      scanf("%d", &money);
      if (money >= payment) {
	total_payment += payment;
      } else {
	total_payment +=  money;
      }
    }
    printf("%d\n", total_payment);
  }

  return 0;
}

```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rax
	leaq	28(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	36(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L7:
	movq	8(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%r15, %rdx
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	movl	32(%rsp), %ecx
	movl	%eax, %edi
	orl	%ecx, %edi
	je	.L2
	cltd
	xorl	%r13d, %r13d
	idivl	%ecx
	movl	%eax, %ebx
	testl	%ecx, %ecx
	jle	.L3
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	xorl	%eax, %eax
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %eax
	leal	0(%r13,%rbx), %esi
	leal	0(%r13,%rax), %edx
	cmpl	%ebx, %eax
	cmovl	%edx, %esi
	addl	$1, %r14d
	movl	%esi, %r13d
	cmpl	%r14d, 32(%rsp)
	jg	.L6
.L3:
	movl	%r13d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L2:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$56, %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
.L13:
	.cfi_restore_state
	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:
```

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 %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rax
	leaq	28(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	36(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L7:
	movq	8(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%r15, %rdx
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	movl	32(%rsp), %ecx
	movl	%eax, %edi
	orl	%ecx, %edi
	je	.L2
	cltd
	xorl	%r13d, %r13d
	idivl	%ecx
	movl	%eax, %ebx
	testl	%ecx, %ecx
	jle	.L3
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	xorl	%eax, %eax
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %eax
	leal	0(%r13,%rbx), %esi
	leal	0(%r13,%rax), %edx
	cmpl	%ebx, %eax
	cmovl	%edx, %esi
	addl	$1, %r14d
	movl	%esi, %r13d
	cmpl	%r14d, 32(%rsp)
	jg	.L6
.L3:
	movl	%r13d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L2:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$56, %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
.L13:
	.cfi_restore_state
	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:
```