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

int main()
{
	int e[101][101];
	int R, C, r, c;
	int s, total;

	scanf("%d%d", &R, &C);
	for (r = 1; r <= R; r++) {
		for (c= 1; c <= C; c++) scanf("%d", &e[r][c]);
	}
	
	for (r = 1; r <= R; r++) {
		s = 0;
		for (c = 1; c <= C; c++) s += e[r][c];
		e[r][0] = s;
	}
	total = 0;
	for (c = 1; c <= C; c++) {
		s = 0;
		for (r = 1; r <= R; r++) s += e[r][c];
		e[0][c] = s;
		total += s;
	}
	for (r = 1; r <= R; r++) {
		for (c = 1; c <= C; c++) printf("%d ", e[r][c]);
		printf("%d\n", e[r][0]);
	}
	for (c = 1; c <= C; c++) printf("%d ", e[0][c]);
	printf("%d\n", total);
	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d "
.LC3:
	.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
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3984, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-40836(%rbp), %rdx
	leaq	-40840(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -40832(%rbp)
	jmp	.L2
.L5:
	movl	$1, -40828(%rbp)
	jmp	.L3
.L4:
	leaq	-40816(%rbp), %rcx
	movl	-40828(%rbp), %eax
	movslq	%eax, %rsi
	movl	-40832(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40828(%rbp)
.L3:
	movl	-40836(%rbp), %eax
	cmpl	%eax, -40828(%rbp)
	jle	.L4
	addl	$1, -40832(%rbp)
.L2:
	movl	-40840(%rbp), %eax
	cmpl	%eax, -40832(%rbp)
	jle	.L5
	movl	$1, -40832(%rbp)
	jmp	.L6
.L9:
	movl	$0, -40824(%rbp)
	movl	$1, -40828(%rbp)
	jmp	.L7
.L8:
	movl	-40828(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40832(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movl	-40816(%rbp,%rax,4), %eax
	addl	%eax, -40824(%rbp)
	addl	$1, -40828(%rbp)
.L7:
	movl	-40836(%rbp), %eax
	cmpl	%eax, -40828(%rbp)
	jle	.L8
	movl	-40832(%rbp), %eax
	cltq
	imulq	$404, %rax, %rax
	addq	%rbp, %rax
	leaq	-40816(%rax), %rdx
	movl	-40824(%rbp), %eax
	movl	%eax, (%rdx)
	addl	$1, -40832(%rbp)
.L6:
	movl	-40840(%rbp), %eax
	cmpl	%eax, -40832(%rbp)
	jle	.L9
	movl	$0, -40820(%rbp)
	movl	$1, -40828(%rbp)
	jmp	.L10
.L13:
	movl	$0, -40824(%rbp)
	movl	$1, -40832(%rbp)
	jmp	.L11
.L12:
	movl	-40828(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40832(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movl	-40816(%rbp,%rax,4), %eax
	addl	%eax, -40824(%rbp)
	addl	$1, -40832(%rbp)
.L11:
	movl	-40840(%rbp), %eax
	cmpl	%eax, -40832(%rbp)
	jle	.L12
	movl	-40828(%rbp), %eax
	cltq
	movl	-40824(%rbp), %edx
	movl	%edx, -40816(%rbp,%rax,4)
	movl	-40824(%rbp), %eax
	addl	%eax, -40820(%rbp)
	addl	$1, -40828(%rbp)
.L10:
	movl	-40836(%rbp), %eax
	cmpl	%eax, -40828(%rbp)
	jle	.L13
	movl	$1, -40832(%rbp)
	jmp	.L14
.L17:
	movl	$1, -40828(%rbp)
	jmp	.L15
.L16:
	movl	-40828(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40832(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movl	-40816(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40828(%rbp)
.L15:
	movl	-40836(%rbp), %eax
	cmpl	%eax, -40828(%rbp)
	jle	.L16
	movl	-40832(%rbp), %eax
	cltq
	imulq	$404, %rax, %rax
	addq	%rbp, %rax
	subq	$40816, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40832(%rbp)
.L14:
	movl	-40840(%rbp), %eax
	cmpl	%eax, -40832(%rbp)
	jle	.L17
	movl	$1, -40828(%rbp)
	jmp	.L18
.L19:
	movl	-40828(%rbp), %eax
	cltq
	movl	-40816(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40828(%rbp)
.L18:
	movl	-40836(%rbp), %eax
	cmpl	%eax, -40828(%rbp)
	jle	.L19
	movl	-40820(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	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	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3976, %rsp
	.cfi_def_cfa_offset 40896
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 40824(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %edi
	movl	12(%rsp), %edx
	testl	%edi, %edi
	jle	.L10
	leaq	424(%rsp), %r13
	movl	$1, %r14d
	leaq	.LC1(%rip), %r12
	movq	%r13, %r15
	testl	%edx, %edx
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%r15, %rbp
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %rbp
	cmpl	%ebx, %edx
	jge	.L4
	movl	8(%rsp), %edi
	addl	$1, %r14d
	cmpl	%r14d, %edi
	jl	.L47
	addq	$404, %r15
	testl	%edx, %edx
	jg	.L28
.L7:
	movl	%edx, %eax
	movl	%edx, %r10d
	leal	1(%rdi), %r9d
	movl	$1, %esi
	shrl	$2, %eax
	andl	$-4, %r10d
	leal	-1(%rdx), %r11d
	leal	-1(%rax), %r8d
	leal	1(%r10), %ebx
	addq	$1, %r8
	salq	$4, %r8
	.p2align 4,,10
	.p2align 3
.L11:
	xorl	%eax, %eax
	testl	%edx, %edx
	jle	.L16
	cmpl	$2, %r11d
	jbe	.L29
	leaq	(%r8,%r13), %rcx
	movq	%r13, %rax
	pxor	%xmm0, %xmm0
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	cmpq	%rcx, %rax
	jne	.L13
	movdqa	%xmm0, %xmm1
	movl	%ebx, %ecx
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	cmpl	%edx, %r10d
	je	.L16
.L12:
	movslq	%esi, %r12
	movslq	%ecx, %rbp
	leaq	(%r12,%r12,4), %r14
	leaq	(%r14,%r14,4), %r14
	leaq	(%r12,%r14,4), %r12
	addq	%r12, %rbp
	addl	16(%rsp,%rbp,4), %eax
	leal	1(%rcx), %ebp
	cmpl	%edx, %ebp
	jg	.L16
	movslq	%ebp, %rbp
	addl	$2, %ecx
	addq	%r12, %rbp
	addl	16(%rsp,%rbp,4), %eax
	cmpl	%edx, %ecx
	jg	.L16
	movslq	%ecx, %rcx
	addq	%rcx, %r12
	addl	16(%rsp,%r12,4), %eax
.L16:
	addl	$1, %esi
	movl	%eax, -4(%r13)
	addq	$404, %r13
	cmpl	%r9d, %esi
	jne	.L11
.L10:
	testl	%edx, %edx
	jle	.L30
	leal	-1(%rdi), %eax
	leaq	20(%rsp), %r8
	xorl	%r12d, %r12d
	imulq	$404, %rax, %rax
	leaq	424(%rsp,%rax), %rsi
	leal	-1(%rdx), %eax
	leaq	24(%rsp,%rax,4), %r9
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%r8, %rax
	xorl	%ecx, %ecx
	testl	%edi, %edi
	jle	.L20
	.p2align 4,,10
	.p2align 3
.L19:
	addl	404(%rax), %ecx
	addq	$404, %rax
	cmpq	%rsi, %rax
	jne	.L19
	addl	%ecx, %r12d
.L20:
	movl	%ecx, (%r8)
	addq	$4, %r8
	addq	$4, %rsi
	cmpq	%r9, %r8
	jne	.L18
.L17:
	leaq	.LC3(%rip), %r14
	testl	%edi, %edi
	jle	.L21
	leaq	420(%rsp), %r15
	movl	$1, %r13d
	leaq	.LC2(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L22:
	movl	$1, %ebx
	testl	%edx, %edx
	jle	.L24
	.p2align 4,,10
	.p2align 3
.L23:
	movl	(%r15,%rbx,4), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, 12(%rsp)
	jge	.L23
.L24:
	movl	(%r15), %edx
	movq	%r14, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %r13d
	addq	$404, %r15
	call	__printf_chk@PLT
	cmpl	%r13d, 8(%rsp)
	jl	.L21
	movl	12(%rsp), %edx
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L21:
	movl	12(%rsp), %eax
	movl	$1, %ebx
	leaq	16(%rsp), %rbp
	leaq	.LC2(%rip), %r13
	testl	%eax, %eax
	jle	.L26
	.p2align 4,,10
	.p2align 3
.L25:
	movl	0(%rbp,%rbx,4), %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, 12(%rsp)
	jge	.L25
.L26:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movq	%r14, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40824(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L48
	addq	$40840, %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
.L29:
	.cfi_restore_state
	xorl	%eax, %eax
	movl	$1, %ecx
	jmp	.L12
.L30:
	xorl	%r12d, %r12d
	jmp	.L17
.L48:
	call	__stack_chk_fail@PLT
.L47:
	testl	%edi, %edi
	jg	.L7
	jmp	.L10
	.cfi_endproc
.LFE41:
	.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	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3976, %rsp
	.cfi_def_cfa_offset 40896
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 40824(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %edi
	movl	12(%rsp), %edx
	testl	%edi, %edi
	jle	.L10
	leaq	424(%rsp), %r13
	movl	$1, %r14d
	leaq	.LC1(%rip), %r12
	movq	%r13, %r15
	testl	%edx, %edx
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%r15, %rbp
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %rbp
	cmpl	%ebx, %edx
	jge	.L4
	movl	8(%rsp), %edi
	addl	$1, %r14d
	cmpl	%r14d, %edi
	jl	.L47
	addq	$404, %r15
	testl	%edx, %edx
	jg	.L28
.L7:
	movl	%edx, %eax
	movl	%edx, %r10d
	leal	1(%rdi), %r9d
	movl	$1, %esi
	shrl	$2, %eax
	andl	$-4, %r10d
	leal	-1(%rdx), %r11d
	leal	-1(%rax), %r8d
	leal	1(%r10), %ebx
	addq	$1, %r8
	salq	$4, %r8
	.p2align 4,,10
	.p2align 3
.L11:
	xorl	%eax, %eax
	testl	%edx, %edx
	jle	.L16
	cmpl	$2, %r11d
	jbe	.L29
	leaq	(%r8,%r13), %rcx
	movq	%r13, %rax
	pxor	%xmm0, %xmm0
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	cmpq	%rcx, %rax
	jne	.L13
	movdqa	%xmm0, %xmm1
	movl	%ebx, %ecx
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	cmpl	%edx, %r10d
	je	.L16
.L12:
	movslq	%esi, %r12
	movslq	%ecx, %rbp
	leaq	(%r12,%r12,4), %r14
	leaq	(%r14,%r14,4), %r14
	leaq	(%r12,%r14,4), %r12
	addq	%r12, %rbp
	addl	16(%rsp,%rbp,4), %eax
	leal	1(%rcx), %ebp
	cmpl	%edx, %ebp
	jg	.L16
	movslq	%ebp, %rbp
	addl	$2, %ecx
	addq	%r12, %rbp
	addl	16(%rsp,%rbp,4), %eax
	cmpl	%edx, %ecx
	jg	.L16
	movslq	%ecx, %rcx
	addq	%rcx, %r12
	addl	16(%rsp,%r12,4), %eax
.L16:
	addl	$1, %esi
	movl	%eax, -4(%r13)
	addq	$404, %r13
	cmpl	%r9d, %esi
	jne	.L11
.L10:
	testl	%edx, %edx
	jle	.L30
	leal	-1(%rdi), %eax
	leaq	20(%rsp), %r8
	xorl	%r12d, %r12d
	imulq	$404, %rax, %rax
	leaq	424(%rsp,%rax), %rsi
	leal	-1(%rdx), %eax
	leaq	24(%rsp,%rax,4), %r9
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%r8, %rax
	xorl	%ecx, %ecx
	testl	%edi, %edi
	jle	.L20
	.p2align 4,,10
	.p2align 3
.L19:
	addl	404(%rax), %ecx
	addq	$404, %rax
	cmpq	%rsi, %rax
	jne	.L19
	addl	%ecx, %r12d
.L20:
	movl	%ecx, (%r8)
	addq	$4, %r8
	addq	$4, %rsi
	cmpq	%r9, %r8
	jne	.L18
.L17:
	leaq	.LC3(%rip), %r14
	testl	%edi, %edi
	jle	.L21
	leaq	420(%rsp), %r15
	movl	$1, %r13d
	leaq	.LC2(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L22:
	movl	$1, %ebx
	testl	%edx, %edx
	jle	.L24
	.p2align 4,,10
	.p2align 3
.L23:
	movl	(%r15,%rbx,4), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, 12(%rsp)
	jge	.L23
.L24:
	movl	(%r15), %edx
	movq	%r14, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %r13d
	addq	$404, %r15
	call	__printf_chk@PLT
	cmpl	%r13d, 8(%rsp)
	jl	.L21
	movl	12(%rsp), %edx
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L21:
	movl	12(%rsp), %eax
	movl	$1, %ebx
	leaq	16(%rsp), %rbp
	leaq	.LC2(%rip), %r13
	testl	%eax, %eax
	jle	.L26
	.p2align 4,,10
	.p2align 3
.L25:
	movl	0(%rbp,%rbx,4), %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, 12(%rsp)
	jge	.L25
.L26:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movq	%r14, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40824(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L48
	addq	$40840, %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
.L29:
	.cfi_restore_state
	xorl	%eax, %eax
	movl	$1, %ecx
	jmp	.L12
.L30:
	xorl	%r12d, %r12d
	jmp	.L17
.L48:
	call	__stack_chk_fail@PLT
.L47:
	testl	%edi, %edi
	jg	.L7
	jmp	.L10
	.cfi_endproc
.LFE41:
	.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 <ctype.h>
#include <stdlib.h>

int main()
{
	int e[101][101];
	int R, C, r, c;
	int s, total;

	scanf("%d%d", &R, &C);
	for (r = 1; r <= R; r++) {
		for (c= 1; c <= C; c++) scanf("%d", &e[r][c]);
	}
	
	for (r = 1; r <= R; r++) {
		s = 0;
		for (c = 1; c <= C; c++) s += e[r][c];
		e[r][0] = s;
	}
	total = 0;
	for (c = 1; c <= C; c++) {
		s = 0;
		for (r = 1; r <= R; r++) s += e[r][c];
		e[0][c] = s;
		total += s;
	}
	for (r = 1; r <= R; r++) {
		for (c = 1; c <= C; c++) printf("%d ", e[r][c]);
		printf("%d\n", e[r][0]);
	}
	for (c = 1; c <= C; c++) printf("%d ", e[0][c]);
	printf("%d\n", total);
	return 0;
}


4 5
1 1 3 4 8
2 2 2 4 5
3 3 0 1 1
2 3 4 4 6
 4 5
1 1 3 4 8
2 2 2 4 5
3 3 0 1 1
2 3 4 8 6
 4 5
1 1 3 4 8
2 2 2 4 5
3 3 0 1 1
2 6 4 8 6
 4 5
1 1 3 4 8
2 2 2 4 5
3 3 0 1 2
2 6 4 8 6
 4 5
2 1 3 4 8
2 2 2 4 5
3 3 0 1 2
2 6 4 8 6
 4 5
1 1 3 1 5
2 2 2 4 5
3 3 0 1 1
2 3 4 4 6
 4 5
1 1 1 4 8
2 2 2 4 5
3 3 0 1 1
2 3 4 4 6
 4 5
1 1 3 4 8
2 2 2 4 5
3 3 0 1 0
2 3 4 8 6
 4 5
1 1 3 4 8
2 2 2 4 5
3 3 0 1 1
2 6 4 1 6
 4 5
1 1 3 8 8
2 2 2 4 5
3 3 0 1 2
2 6 4 8 6

1 1 3 4 8 17
2 2 2 4 5 15
3 3 0 1 1 8
2 3 4 4 6 19
8 9 9 13 20 59
 1 1 3 4 8 17
2 2 2 4 5 15
3 3 0 1 1 8
2 3 4 8 6 23
8 9 9 17 20 63
 1 1 3 4 8 17
2 2 2 4 5 15
3 3 0 1 1 8
2 6 4 8 6 26
8 12 9 17 20 66
 1 1 3 4 8 17
2 2 2 4 5 15
3 3 0 1 2 9
2 6 4 8 6 26
8 12 9 17 21 67
 2 1 3 4 8 18
2 2 2 4 5 15
3 3 0 1 2 9
2 6 4 8 6 26
9 12 9 17 21 68
 1 1 3 1 5 11
2 2 2 4 5 15
3 3 0 1 1 8
2 3 4 4 6 19
8 9 9 10 17 53
 1 1 1 4 8 15
2 2 2 4 5 15
3 3 0 1 1 8
2 3 4 4 6 19
8 9 7 13 20 57
 1 1 3 4 8 17
2 2 2 4 5 15
3 3 0 1 0 7
2 3 4 8 6 23
8 9 9 17 19 62
 1 1 3 4 8 17
2 2 2 4 5 15
3 3 0 1 1 8
2 6 4 1 6 19
8 12 9 10 20 59
 1 1 3 8 8 21
2 2 2 4 5 15
3 3 0 1 2 9
2 6 4 8 6 26
8 12 9 21 21 71

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

int main()
{
	int e[101][101];
	int R, C, r, c;
	int s, total;

	scanf("%d%d", &R, &C);
	for (r = 1; r <= R; r++) {
		for (c= 1; c <= C; c++) scanf("%d", &e[r][c]);
	}
	
	for (r = 1; r <= R; r++) {
		s = 0;
		for (c = 1; c <= C; c++) s += e[r][c];
		e[r][0] = s;
	}
	total = 0;
	for (c = 1; c <= C; c++) {
		s = 0;
		for (r = 1; r <= R; r++) s += e[r][c];
		e[0][c] = s;
		total += s;
	}
	for (r = 1; r <= R; r++) {
		for (c = 1; c <= C; c++) printf("%d ", e[r][c]);
		printf("%d\n", e[r][0]);
	}
	for (c = 1; c <= C; c++) printf("%d ", e[0][c]);
	printf("%d\n", total);
	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d "
.LC3:
	.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
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3984, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-40836(%rbp), %rdx
	leaq	-40840(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -40832(%rbp)
	jmp	.L2
.L5:
	movl	$1, -40828(%rbp)
	jmp	.L3
.L4:
	leaq	-40816(%rbp), %rcx
	movl	-40828(%rbp), %eax
	movslq	%eax, %rsi
	movl	-40832(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40828(%rbp)
.L3:
	movl	-40836(%rbp), %eax
	cmpl	%eax, -40828(%rbp)
	jle	.L4
	addl	$1, -40832(%rbp)
.L2:
	movl	-40840(%rbp), %eax
	cmpl	%eax, -40832(%rbp)
	jle	.L5
	movl	$1, -40832(%rbp)
	jmp	.L6
.L9:
	movl	$0, -40824(%rbp)
	movl	$1, -40828(%rbp)
	jmp	.L7
.L8:
	movl	-40828(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40832(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movl	-40816(%rbp,%rax,4), %eax
	addl	%eax, -40824(%rbp)
	addl	$1, -40828(%rbp)
.L7:
	movl	-40836(%rbp), %eax
	cmpl	%eax, -40828(%rbp)
	jle	.L8
	movl	-40832(%rbp), %eax
	cltq
	imulq	$404, %rax, %rax
	addq	%rbp, %rax
	leaq	-40816(%rax), %rdx
	movl	-40824(%rbp), %eax
	movl	%eax, (%rdx)
	addl	$1, -40832(%rbp)
.L6:
	movl	-40840(%rbp), %eax
	cmpl	%eax, -40832(%rbp)
	jle	.L9
	movl	$0, -40820(%rbp)
	movl	$1, -40828(%rbp)
	jmp	.L10
.L13:
	movl	$0, -40824(%rbp)
	movl	$1, -40832(%rbp)
	jmp	.L11
.L12:
	movl	-40828(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40832(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movl	-40816(%rbp,%rax,4), %eax
	addl	%eax, -40824(%rbp)
	addl	$1, -40832(%rbp)
.L11:
	movl	-40840(%rbp), %eax
	cmpl	%eax, -40832(%rbp)
	jle	.L12
	movl	-40828(%rbp), %eax
	cltq
	movl	-40824(%rbp), %edx
	movl	%edx, -40816(%rbp,%rax,4)
	movl	-40824(%rbp), %eax
	addl	%eax, -40820(%rbp)
	addl	$1, -40828(%rbp)
.L10:
	movl	-40836(%rbp), %eax
	cmpl	%eax, -40828(%rbp)
	jle	.L13
	movl	$1, -40832(%rbp)
	jmp	.L14
.L17:
	movl	$1, -40828(%rbp)
	jmp	.L15
.L16:
	movl	-40828(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40832(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movl	-40816(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40828(%rbp)
.L15:
	movl	-40836(%rbp), %eax
	cmpl	%eax, -40828(%rbp)
	jle	.L16
	movl	-40832(%rbp), %eax
	cltq
	imulq	$404, %rax, %rax
	addq	%rbp, %rax
	subq	$40816, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40832(%rbp)
.L14:
	movl	-40840(%rbp), %eax
	cmpl	%eax, -40832(%rbp)
	jle	.L17
	movl	$1, -40828(%rbp)
	jmp	.L18
.L19:
	movl	-40828(%rbp), %eax
	cltq
	movl	-40816(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40828(%rbp)
.L18:
	movl	-40836(%rbp), %eax
	cmpl	%eax, -40828(%rbp)
	jle	.L19
	movl	-40820(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	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	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d "
.LC3:
	.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
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3984, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-40836(%rbp), %rdx
	leaq	-40840(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -40832(%rbp)
	jmp	.L2
.L5:
	movl	$1, -40828(%rbp)
	jmp	.L3
.L4:
	leaq	-40816(%rbp), %rcx
	movl	-40828(%rbp), %eax
	movslq	%eax, %rsi
	movl	-40832(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40828(%rbp)
.L3:
	movl	-40836(%rbp), %eax
	cmpl	%eax, -40828(%rbp)
	jle	.L4
	addl	$1, -40832(%rbp)
.L2:
	movl	-40840(%rbp), %eax
	cmpl	%eax, -40832(%rbp)
	jle	.L5
	movl	$1, -40832(%rbp)
	jmp	.L6
.L9:
	movl	$0, -40824(%rbp)
	movl	$1, -40828(%rbp)
	jmp	.L7
.L8:
	movl	-40828(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40832(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movl	-40816(%rbp,%rax,4), %eax
	addl	%eax, -40824(%rbp)
	addl	$1, -40828(%rbp)
.L7:
	movl	-40836(%rbp), %eax
	cmpl	%eax, -40828(%rbp)
	jle	.L8
	movl	-40832(%rbp), %eax
	cltq
	imulq	$404, %rax, %rax
	addq	%rbp, %rax
	leaq	-40816(%rax), %rdx
	movl	-40824(%rbp), %eax
	movl	%eax, (%rdx)
	addl	$1, -40832(%rbp)
.L6:
	movl	-40840(%rbp), %eax
	cmpl	%eax, -40832(%rbp)
	jle	.L9
	movl	$0, -40820(%rbp)
	movl	$1, -40828(%rbp)
	jmp	.L10
.L13:
	movl	$0, -40824(%rbp)
	movl	$1, -40832(%rbp)
	jmp	.L11
.L12:
	movl	-40828(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40832(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movl	-40816(%rbp,%rax,4), %eax
	addl	%eax, -40824(%rbp)
	addl	$1, -40832(%rbp)
.L11:
	movl	-40840(%rbp), %eax
	cmpl	%eax, -40832(%rbp)
	jle	.L12
	movl	-40828(%rbp), %eax
	cltq
	movl	-40824(%rbp), %edx
	movl	%edx, -40816(%rbp,%rax,4)
	movl	-40824(%rbp), %eax
	addl	%eax, -40820(%rbp)
	addl	$1, -40828(%rbp)
.L10:
	movl	-40836(%rbp), %eax
	cmpl	%eax, -40828(%rbp)
	jle	.L13
	movl	$1, -40832(%rbp)
	jmp	.L14
.L17:
	movl	$1, -40828(%rbp)
	jmp	.L15
.L16:
	movl	-40828(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40832(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movl	-40816(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40828(%rbp)
.L15:
	movl	-40836(%rbp), %eax
	cmpl	%eax, -40828(%rbp)
	jle	.L16
	movl	-40832(%rbp), %eax
	cltq
	imulq	$404, %rax, %rax
	addq	%rbp, %rax
	subq	$40816, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40832(%rbp)
.L14:
	movl	-40840(%rbp), %eax
	cmpl	%eax, -40832(%rbp)
	jle	.L17
	movl	$1, -40828(%rbp)
	jmp	.L18
.L19:
	movl	-40828(%rbp), %eax
	cltq
	movl	-40816(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40828(%rbp)
.L18:
	movl	-40836(%rbp), %eax
	cmpl	%eax, -40828(%rbp)
	jle	.L19
	movl	-40820(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	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:
