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

```c
// AOJ 0636: Foehn Phenomena
// 2017.12.14 bal4u@uu

#include <stdio.h>
#include <string.h>

long long dx[200001];
long long S, T;
char buf[40], *p;

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

long long calc(int i, int x)
{
	long long d;

	if (dx[i] > 0) d = dx[i]*S;
	else           d = dx[i]*T;
	dx[i] += x;
	if (dx[i] > 0) d -= dx[i]*S;
	else           d -= dx[i]*T;
	return d;
}

int main()
{
	int N, Q, i, a0, a, l, r, x;
	long long u, d, ans;
	
	fgets(p=buf, 40, stdin);
	N = getint(), Q = getint(), S = getint(), T = getint();

	fgets(buf, 10, stdin);
	u = d = a0 = 0;
	for (i = 1; i <= N; i++) {
		fgets(p=buf, 10, stdin);
		a = getint();
		a0 = a - a0;
		dx[i] = a0;
		if (a0 >= 0) u += a0;
		else         d += a0;
		a0 = a;
	}

	ans = -(d*T+u*S);
	while (Q--) {
		fgets(p=buf, 30, stdin);
		l = getint(), r = getint(), x = getint();
		ans += calc(l, x);
		if (r < N) ans += calc(r+1, -x);
		printf("%lld\n", ans);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	dx
	.bss
	.align 32
	.type	dx, @object
	.size	dx, 1600008
dx:
	.zero	1600008
	.globl	S
	.align 8
	.type	S, @object
	.size	S, 8
S:
	.zero	8
	.globl	T
	.align 8
	.type	T, @object
	.size	T, 8
T:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 40
buf:
	.zero	40
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	getint
	.type	getint, @function
getint:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$45, %al
	jne	.L6
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	jmp	.L3
.L4:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L3:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L4
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	-4(%rbp), %eax
	negl	%eax
	jmp	.L5
.L7:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L6:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L7
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	-4(%rbp), %eax
.L5:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	getint, .-getint
	.globl	calc
	.type	calc, @function
calc:
.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, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	jle	.L9
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	S(%rip), %rax
	imulq	%rdx, %rax
	movq	%rax, -8(%rbp)
	jmp	.L10
.L9:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	T(%rip), %rax
	imulq	%rdx, %rax
	movq	%rax, -8(%rbp)
.L10:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-24(%rbp), %eax
	cltq
	leaq	(%rdx,%rax), %rcx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	jle	.L11
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	S(%rip), %rax
	imulq	%rdx, %rax
	subq	%rax, -8(%rbp)
	jmp	.L12
.L11:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	T(%rip), %rax
	imulq	%rdx, %rax
	subq	%rax, -8(%rbp)
.L12:
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	calc, .-calc
	.section	.rodata
.LC0:
	.string	"%lld\n"
	.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
	subq	$64, %rsp
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$40, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, %eax
	call	getint
	movl	%eax, -44(%rbp)
	movl	$0, %eax
	call	getint
	movl	%eax, -56(%rbp)
	movl	$0, %eax
	call	getint
	cltq
	movq	%rax, S(%rip)
	movl	$0, %eax
	call	getint
	cltq
	movq	%rax, T(%rip)
	movq	stdin(%rip), %rax
	movq	%rax, %rdx
	movl	$10, %esi
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, -48(%rbp)
	movq	$0, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, -24(%rbp)
	movl	$1, -52(%rbp)
	jmp	.L15
.L18:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$10, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, %eax
	call	getint
	movl	%eax, -28(%rbp)
	movl	-28(%rbp), %eax
	subl	-48(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-48(%rbp), %eax
	cltq
	movl	-52(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	dx(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	cmpl	$0, -48(%rbp)
	js	.L16
	movl	-48(%rbp), %eax
	cltq
	addq	%rax, -24(%rbp)
	jmp	.L17
.L16:
	movl	-48(%rbp), %eax
	cltq
	addq	%rax, -16(%rbp)
.L17:
	movl	-28(%rbp), %eax
	movl	%eax, -48(%rbp)
	addl	$1, -52(%rbp)
.L15:
	movl	-52(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jle	.L18
	movq	T(%rip), %rax
	imulq	-16(%rbp), %rax
	movq	%rax, %rdx
	movq	S(%rip), %rax
	imulq	-24(%rbp), %rax
	addq	%rdx, %rax
	negq	%rax
	movq	%rax, -8(%rbp)
	jmp	.L19
.L21:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$30, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, %eax
	call	getint
	movl	%eax, -40(%rbp)
	movl	$0, %eax
	call	getint
	movl	%eax, -36(%rbp)
	movl	$0, %eax
	call	getint
	movl	%eax, -32(%rbp)
	movl	-32(%rbp), %edx
	movl	-40(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	addq	%rax, -8(%rbp)
	movl	-36(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jge	.L20
	movl	-32(%rbp), %eax
	negl	%eax
	movl	%eax, %edx
	movl	-36(%rbp), %eax
	addl	$1, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	addq	%rax, -8(%rbp)
.L20:
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L19:
	movl	-56(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -56(%rbp)
	testl	%eax, %eax
	jne	.L21
	movl	$0, %eax
	leave
	.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
	.p2align 4
	.globl	getint
	.type	getint, @function
getint:
.LFB35:
	.cfi_startproc
	endbr64
	movq	p(%rip), %rcx
	movzbl	(%rcx), %edx
	leaq	1(%rcx), %rax
	cmpb	$45, %dl
	je	.L2
	xorl	%r8d, %r8d
	cmpb	$47, %dl
	jle	.L4
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rcx
	addq	$1, %rax
	leal	(%r8,%r8,4), %esi
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rsi,2), %r8d
	jg	.L8
.L4:
	addq	$1, %rcx
	movl	%r8d, %eax
	movq	%rcx, p(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rax, p(%rip)
	cmpb	$47, 1(%rcx)
	jle	.L9
	addq	$2, %rcx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rcx, p(%rip)
	movzbl	-1(%rcx), %edx
	movq	%rcx, %rax
	leal	(%r8,%r8,4), %esi
	leaq	1(%rcx), %rcx
	andl	$15, %edx
	cmpb	$47, (%rax)
	leal	(%rdx,%rsi,2), %r8d
	jg	.L6
	negl	%r8d
.L5:
	leaq	1(%rax), %rcx
	movl	%r8d, %eax
	movq	%rcx, p(%rip)
	ret
.L9:
	xorl	%r8d, %r8d
	jmp	.L5
	.cfi_endproc
.LFE35:
	.size	getint, .-getint
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB36:
	.cfi_startproc
	endbr64
	leaq	dx(%rip), %rcx
	movslq	%edi, %rdi
	movq	(%rcx,%rdi,8), %rdx
	movq	%rdx, %rax
	testq	%rdx, %rdx
	jle	.L15
	movslq	%esi, %rsi
	imulq	S(%rip), %rax
	addq	%rdx, %rsi
	movq	%rsi, (%rcx,%rdi,8)
	testq	%rsi, %rsi
	jle	.L17
.L19:
	imulq	S(%rip), %rsi
	subq	%rsi, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L15:
	movslq	%esi, %rsi
	imulq	T(%rip), %rax
	addq	%rdx, %rsi
	movq	%rsi, (%rcx,%rdi,8)
	testq	%rsi, %rsi
	jg	.L19
.L17:
	imulq	T(%rip), %rsi
	subq	%rsi, %rax
	ret
	.cfi_endproc
.LFE36:
	.size	calc, .-calc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB37:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$40, %esi
	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	buf(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	stdin(%rip), %rdx
	movq	%rbp, p(%rip)
	call	fgets@PLT
	xorl	%eax, %eax
	movq	%rbp, %rdi
	call	getint
	movl	%eax, %r13d
	xorl	%eax, %eax
	call	getint
	movl	%eax, 12(%rsp)
	xorl	%eax, %eax
	call	getint
	cltq
	movq	%rax, S(%rip)
	xorl	%eax, %eax
	call	getint
	movq	stdin(%rip), %rdx
	movl	$10, %esi
	cltq
	movq	%rax, T(%rip)
	call	fgets@PLT
	testl	%r13d, %r13d
	jle	.L65
	movq	$0, (%rsp)
	movl	$1, %ebx
	xorl	%r15d, %r15d
	xorl	%r14d, %r14d
	leaq	dx(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L31:
	movq	stdin(%rip), %rdx
	movl	$10, %esi
	movq	%rbp, %rdi
	movq	%rbp, p(%rip)
	call	fgets@PLT
	movq	p(%rip), %rsi
	movzbl	(%rsi), %edi
	cmpb	$45, %dil
	je	.L22
	leaq	1(%rsi), %rax
	xorl	%edx, %edx
	cmpb	$47, %dil
	jle	.L24
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%rax, p(%rip)
	leal	(%rdx,%rdx,4), %edi
	movzbl	-1(%rax), %edx
	movq	%rax, %rsi
	addq	$1, %rax
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rdi,2), %edx
	jg	.L28
.L24:
	addq	$1, %rsi
.L27:
	movq	%rsi, p(%rip)
	movl	%edx, %esi
	subl	%r14d, %esi
	movslq	%esi, %rax
	movq	%rax, (%r12,%rbx,8)
	js	.L29
	addq	$1, %rbx
	addq	%rax, %r15
	cmpl	%ebx, %r13d
	jl	.L21
.L67:
	movl	%edx, %r14d
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L29:
	addq	$1, %rbx
	addq	%rax, (%rsp)
	cmpl	%ebx, %r13d
	jge	.L67
.L21:
	movq	(%rsp), %rbx
	imulq	S(%rip), %r15
	leaq	dx(%rip), %r12
	imulq	T(%rip), %rbx
	movl	12(%rsp), %r14d
	addq	%r15, %rbx
	leaq	.LC0(%rip), %r15
	negq	%rbx
	testl	%r14d, %r14d
	je	.L85
	.p2align 4,,10
	.p2align 3
.L63:
	movq	stdin(%rip), %rdx
	movl	$30, %esi
	movq	%rbp, %rdi
	movq	%rbp, p(%rip)
	call	fgets@PLT
	movq	p(%rip), %rax
	movzbl	(%rax), %esi
	cmpb	$45, %sil
	je	.L33
	leaq	1(%rax), %rdx
	xorl	%ecx, %ecx
	cmpb	$47, %sil
	jle	.L35
	.p2align 4,,10
	.p2align 3
.L39:
	movq	%rdx, p(%rip)
	leal	(%rcx,%rcx,4), %esi
	movzbl	-1(%rdx), %ecx
	movq	%rdx, %rax
	addq	$1, %rdx
	andl	$15, %ecx
	cmpb	$47, -1(%rdx)
	leal	(%rcx,%rsi,2), %ecx
	jg	.L39
.L35:
	addq	$1, %rax
	movq	%rax, p(%rip)
	movzbl	(%rax), %edi
	cmpb	$45, %dil
	je	.L40
.L89:
	leaq	1(%rax), %rdx
	xorl	%esi, %esi
	cmpb	$47, %dil
	jle	.L42
	.p2align 4,,10
	.p2align 3
.L46:
	movq	%rdx, p(%rip)
	leal	(%rsi,%rsi,4), %edi
	movzbl	-1(%rdx), %esi
	movq	%rdx, %rax
	addq	$1, %rdx
	andl	$15, %esi
	cmpb	$47, -1(%rdx)
	leal	(%rsi,%rdi,2), %esi
	jg	.L46
.L42:
	addq	$1, %rax
.L45:
	movq	%rax, p(%rip)
	movzbl	(%rax), %r8d
	cmpb	$45, %r8b
	je	.L47
	leaq	1(%rax), %rdx
	xorl	%edi, %edi
	cmpb	$47, %r8b
	jle	.L87
	.p2align 4,,10
	.p2align 3
.L53:
	movq	%rdx, %rax
	movq	%rdx, p(%rip)
	movzbl	-1(%rdx), %edx
	leal	(%rdi,%rdi,4), %edi
	andl	$15, %edx
	cmpb	$47, (%rax)
	leal	(%rdx,%rdi,2), %edi
	leaq	1(%rax), %rdx
	jg	.L53
	movslq	%edi, %r8
.L49:
	addq	$1, %rax
.L52:
	movslq	%ecx, %rcx
	movq	%rax, p(%rip)
	movq	(%r12,%rcx,8), %rax
	movq	%rax, %rdx
	testq	%rax, %rax
	jle	.L54
	imulq	S(%rip), %rdx
.L55:
	addq	%r8, %rax
	movq	%rax, (%r12,%rcx,8)
	testq	%rax, %rax
	jle	.L56
	imulq	S(%rip), %rax
	subq	%rax, %rdx
	addq	%rdx, %rbx
	cmpl	%esi, %r13d
	jg	.L88
.L58:
	xorl	%eax, %eax
	movq	%rbx, %rdx
	movq	%r15, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	subl	$1, %r14d
	jne	.L63
.L85:
	addq	$24, %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
	.p2align 4,,10
	.p2align 3
.L22:
	.cfi_restore_state
	leaq	1(%rsi), %rdi
	movq	%rdi, p(%rip)
	cmpb	$47, 1(%rsi)
	jle	.L66
	addq	$2, %rsi
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L26:
	movq	%rsi, p(%rip)
	movzbl	-1(%rsi), %eax
	movq	%rsi, %rdi
	leal	(%rdx,%rdx,4), %edx
	addq	$1, %rsi
	andl	$15, %eax
	cmpb	$47, -1(%rsi)
	leal	(%rax,%rdx,2), %edx
	jg	.L26
.L25:
	leaq	1(%rdi), %rsi
	negl	%edx
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L56:
	imulq	T(%rip), %rax
	subq	%rax, %rdx
	addq	%rdx, %rbx
	cmpl	%esi, %r13d
	jle	.L58
.L88:
	addl	$1, %esi
	movl	%edi, %eax
	movslq	%esi, %rsi
	negl	%eax
	movq	(%r12,%rsi,8), %rcx
	movq	%rcx, %rdx
	testq	%rcx, %rcx
	jle	.L59
	imulq	S(%rip), %rdx
.L60:
	cltq
	addq	%rcx, %rax
	movq	%rax, (%r12,%rsi,8)
	testq	%rax, %rax
	jle	.L61
	imulq	S(%rip), %rax
	subq	%rax, %rdx
.L62:
	addq	%rdx, %rbx
	jmp	.L58
	.p2align 4,,10
	.p2align 3
.L54:
	imulq	T(%rip), %rdx
	jmp	.L55
	.p2align 4,,10
	.p2align 3
.L47:
	leaq	1(%rax), %r8
	movq	%r8, p(%rip)
	cmpb	$47, 1(%rax)
	jle	.L70
	leaq	2(%rax), %rdx
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L51:
	movq	%rdx, p(%rip)
	movzbl	-1(%rdx), %eax
	movq	%rdx, %r8
	leal	(%rdi,%rdi,4), %edi
	addq	$1, %rdx
	andl	$15, %eax
	cmpb	$47, -1(%rdx)
	leal	(%rax,%rdi,2), %edi
	jg	.L51
.L50:
	negl	%edi
	leaq	1(%r8), %rax
	movslq	%edi, %r8
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L33:
	leaq	1(%rax), %rsi
	movq	%rsi, p(%rip)
	cmpb	$47, 1(%rax)
	jle	.L68
	addq	$2, %rax
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L37:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rsi
	leal	(%rcx,%rcx,4), %ecx
	addq	$1, %rax
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %ecx
	jg	.L37
.L36:
	leaq	1(%rsi), %rax
	negl	%ecx
	movq	%rax, p(%rip)
	movzbl	(%rax), %edi
	cmpb	$45, %dil
	jne	.L89
.L40:
	leaq	1(%rax), %rdi
	movq	%rdi, p(%rip)
	cmpb	$47, 1(%rax)
	jle	.L69
	addq	$2, %rax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L44:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rdi
	leal	(%rsi,%rsi,4), %esi
	addq	$1, %rax
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rsi,2), %esi
	jg	.L44
.L43:
	leaq	1(%rdi), %rax
	negl	%esi
	jmp	.L45
	.p2align 4,,10
	.p2align 3
.L61:
	imulq	T(%rip), %rax
	subq	%rax, %rdx
	jmp	.L62
	.p2align 4,,10
	.p2align 3
.L59:
	imulq	T(%rip), %rdx
	jmp	.L60
	.p2align 4,,10
	.p2align 3
.L87:
	xorl	%r8d, %r8d
	jmp	.L49
.L66:
	xorl	%edx, %edx
	jmp	.L25
.L70:
	xorl	%edi, %edi
	jmp	.L50
.L68:
	xorl	%ecx, %ecx
	jmp	.L36
.L69:
	xorl	%esi, %esi
	jmp	.L43
.L65:
	movq	$0, (%rsp)
	xorl	%r15d, %r15d
	jmp	.L21
	.cfi_endproc
.LFE37:
	.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, 40
buf:
	.zero	40
	.globl	T
	.align 8
	.type	T, @object
	.size	T, 8
T:
	.zero	8
	.globl	S
	.align 8
	.type	S, @object
	.size	S, 8
S:
	.zero	8
	.globl	dx
	.align 32
	.type	dx, @object
	.size	dx, 1600008
dx:
	.zero	1600008
	.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
	.p2align 4
	.globl	getint
	.type	getint, @function
getint:
.LFB35:
	.cfi_startproc
	endbr64
	movq	p(%rip), %rcx
	movzbl	(%rcx), %edx
	leaq	1(%rcx), %rax
	cmpb	$45, %dl
	je	.L2
	xorl	%r8d, %r8d
	cmpb	$47, %dl
	jle	.L4
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rcx
	addq	$1, %rax
	leal	(%r8,%r8,4), %esi
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rsi,2), %r8d
	jg	.L8
.L4:
	addq	$1, %rcx
	movl	%r8d, %eax
	movq	%rcx, p(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rax, p(%rip)
	cmpb	$47, 1(%rcx)
	jle	.L9
	addq	$2, %rcx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rcx, p(%rip)
	movzbl	-1(%rcx), %edx
	movq	%rcx, %rax
	leal	(%r8,%r8,4), %esi
	leaq	1(%rcx), %rcx
	andl	$15, %edx
	cmpb	$47, (%rax)
	leal	(%rdx,%rsi,2), %r8d
	jg	.L6
	negl	%r8d
.L5:
	leaq	1(%rax), %rcx
	movl	%r8d, %eax
	movq	%rcx, p(%rip)
	ret
.L9:
	xorl	%r8d, %r8d
	jmp	.L5
	.cfi_endproc
.LFE35:
	.size	getint, .-getint
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB36:
	.cfi_startproc
	endbr64
	leaq	dx(%rip), %rcx
	movslq	%edi, %rdi
	movq	(%rcx,%rdi,8), %rdx
	movq	%rdx, %rax
	testq	%rdx, %rdx
	jle	.L15
	movslq	%esi, %rsi
	imulq	S(%rip), %rax
	addq	%rdx, %rsi
	movq	%rsi, (%rcx,%rdi,8)
	testq	%rsi, %rsi
	jle	.L17
.L19:
	imulq	S(%rip), %rsi
	subq	%rsi, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L15:
	movslq	%esi, %rsi
	imulq	T(%rip), %rax
	addq	%rdx, %rsi
	movq	%rsi, (%rcx,%rdi,8)
	testq	%rsi, %rsi
	jg	.L19
.L17:
	imulq	T(%rip), %rsi
	subq	%rsi, %rax
	ret
	.cfi_endproc
.LFE36:
	.size	calc, .-calc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB37:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$40, %esi
	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	buf(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	stdin(%rip), %rdx
	movq	%rbp, p(%rip)
	call	fgets@PLT
	xorl	%eax, %eax
	movq	%rbp, %rdi
	call	getint
	movl	%eax, %r13d
	xorl	%eax, %eax
	call	getint
	movl	%eax, 12(%rsp)
	xorl	%eax, %eax
	call	getint
	cltq
	movq	%rax, S(%rip)
	xorl	%eax, %eax
	call	getint
	movq	stdin(%rip), %rdx
	movl	$10, %esi
	cltq
	movq	%rax, T(%rip)
	call	fgets@PLT
	testl	%r13d, %r13d
	jle	.L65
	movq	$0, (%rsp)
	movl	$1, %ebx
	xorl	%r15d, %r15d
	xorl	%r14d, %r14d
	leaq	dx(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L31:
	movq	stdin(%rip), %rdx
	movl	$10, %esi
	movq	%rbp, %rdi
	movq	%rbp, p(%rip)
	call	fgets@PLT
	movq	p(%rip), %rsi
	movzbl	(%rsi), %edi
	cmpb	$45, %dil
	je	.L22
	leaq	1(%rsi), %rax
	xorl	%edx, %edx
	cmpb	$47, %dil
	jle	.L24
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%rax, p(%rip)
	leal	(%rdx,%rdx,4), %edi
	movzbl	-1(%rax), %edx
	movq	%rax, %rsi
	addq	$1, %rax
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rdi,2), %edx
	jg	.L28
.L24:
	addq	$1, %rsi
.L27:
	movq	%rsi, p(%rip)
	movl	%edx, %esi
	subl	%r14d, %esi
	movslq	%esi, %rax
	movq	%rax, (%r12,%rbx,8)
	js	.L29
	addq	$1, %rbx
	addq	%rax, %r15
	cmpl	%ebx, %r13d
	jl	.L21
.L67:
	movl	%edx, %r14d
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L29:
	addq	$1, %rbx
	addq	%rax, (%rsp)
	cmpl	%ebx, %r13d
	jge	.L67
.L21:
	movq	(%rsp), %rbx
	imulq	S(%rip), %r15
	leaq	dx(%rip), %r12
	imulq	T(%rip), %rbx
	movl	12(%rsp), %r14d
	addq	%r15, %rbx
	leaq	.LC0(%rip), %r15
	negq	%rbx
	testl	%r14d, %r14d
	je	.L85
	.p2align 4,,10
	.p2align 3
.L63:
	movq	stdin(%rip), %rdx
	movl	$30, %esi
	movq	%rbp, %rdi
	movq	%rbp, p(%rip)
	call	fgets@PLT
	movq	p(%rip), %rax
	movzbl	(%rax), %esi
	cmpb	$45, %sil
	je	.L33
	leaq	1(%rax), %rdx
	xorl	%ecx, %ecx
	cmpb	$47, %sil
	jle	.L35
	.p2align 4,,10
	.p2align 3
.L39:
	movq	%rdx, p(%rip)
	leal	(%rcx,%rcx,4), %esi
	movzbl	-1(%rdx), %ecx
	movq	%rdx, %rax
	addq	$1, %rdx
	andl	$15, %ecx
	cmpb	$47, -1(%rdx)
	leal	(%rcx,%rsi,2), %ecx
	jg	.L39
.L35:
	addq	$1, %rax
	movq	%rax, p(%rip)
	movzbl	(%rax), %edi
	cmpb	$45, %dil
	je	.L40
.L89:
	leaq	1(%rax), %rdx
	xorl	%esi, %esi
	cmpb	$47, %dil
	jle	.L42
	.p2align 4,,10
	.p2align 3
.L46:
	movq	%rdx, p(%rip)
	leal	(%rsi,%rsi,4), %edi
	movzbl	-1(%rdx), %esi
	movq	%rdx, %rax
	addq	$1, %rdx
	andl	$15, %esi
	cmpb	$47, -1(%rdx)
	leal	(%rsi,%rdi,2), %esi
	jg	.L46
.L42:
	addq	$1, %rax
.L45:
	movq	%rax, p(%rip)
	movzbl	(%rax), %r8d
	cmpb	$45, %r8b
	je	.L47
	leaq	1(%rax), %rdx
	xorl	%edi, %edi
	cmpb	$47, %r8b
	jle	.L87
	.p2align 4,,10
	.p2align 3
.L53:
	movq	%rdx, %rax
	movq	%rdx, p(%rip)
	movzbl	-1(%rdx), %edx
	leal	(%rdi,%rdi,4), %edi
	andl	$15, %edx
	cmpb	$47, (%rax)
	leal	(%rdx,%rdi,2), %edi
	leaq	1(%rax), %rdx
	jg	.L53
	movslq	%edi, %r8
.L49:
	addq	$1, %rax
.L52:
	movslq	%ecx, %rcx
	movq	%rax, p(%rip)
	movq	(%r12,%rcx,8), %rax
	movq	%rax, %rdx
	testq	%rax, %rax
	jle	.L54
	imulq	S(%rip), %rdx
.L55:
	addq	%r8, %rax
	movq	%rax, (%r12,%rcx,8)
	testq	%rax, %rax
	jle	.L56
	imulq	S(%rip), %rax
	subq	%rax, %rdx
	addq	%rdx, %rbx
	cmpl	%esi, %r13d
	jg	.L88
.L58:
	xorl	%eax, %eax
	movq	%rbx, %rdx
	movq	%r15, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	subl	$1, %r14d
	jne	.L63
.L85:
	addq	$24, %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
	.p2align 4,,10
	.p2align 3
.L22:
	.cfi_restore_state
	leaq	1(%rsi), %rdi
	movq	%rdi, p(%rip)
	cmpb	$47, 1(%rsi)
	jle	.L66
	addq	$2, %rsi
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L26:
	movq	%rsi, p(%rip)
	movzbl	-1(%rsi), %eax
	movq	%rsi, %rdi
	leal	(%rdx,%rdx,4), %edx
	addq	$1, %rsi
	andl	$15, %eax
	cmpb	$47, -1(%rsi)
	leal	(%rax,%rdx,2), %edx
	jg	.L26
.L25:
	leaq	1(%rdi), %rsi
	negl	%edx
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L56:
	imulq	T(%rip), %rax
	subq	%rax, %rdx
	addq	%rdx, %rbx
	cmpl	%esi, %r13d
	jle	.L58
.L88:
	addl	$1, %esi
	movl	%edi, %eax
	movslq	%esi, %rsi
	negl	%eax
	movq	(%r12,%rsi,8), %rcx
	movq	%rcx, %rdx
	testq	%rcx, %rcx
	jle	.L59
	imulq	S(%rip), %rdx
.L60:
	cltq
	addq	%rcx, %rax
	movq	%rax, (%r12,%rsi,8)
	testq	%rax, %rax
	jle	.L61
	imulq	S(%rip), %rax
	subq	%rax, %rdx
.L62:
	addq	%rdx, %rbx
	jmp	.L58
	.p2align 4,,10
	.p2align 3
.L54:
	imulq	T(%rip), %rdx
	jmp	.L55
	.p2align 4,,10
	.p2align 3
.L47:
	leaq	1(%rax), %r8
	movq	%r8, p(%rip)
	cmpb	$47, 1(%rax)
	jle	.L70
	leaq	2(%rax), %rdx
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L51:
	movq	%rdx, p(%rip)
	movzbl	-1(%rdx), %eax
	movq	%rdx, %r8
	leal	(%rdi,%rdi,4), %edi
	addq	$1, %rdx
	andl	$15, %eax
	cmpb	$47, -1(%rdx)
	leal	(%rax,%rdi,2), %edi
	jg	.L51
.L50:
	negl	%edi
	leaq	1(%r8), %rax
	movslq	%edi, %r8
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L33:
	leaq	1(%rax), %rsi
	movq	%rsi, p(%rip)
	cmpb	$47, 1(%rax)
	jle	.L68
	addq	$2, %rax
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L37:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rsi
	leal	(%rcx,%rcx,4), %ecx
	addq	$1, %rax
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %ecx
	jg	.L37
.L36:
	leaq	1(%rsi), %rax
	negl	%ecx
	movq	%rax, p(%rip)
	movzbl	(%rax), %edi
	cmpb	$45, %dil
	jne	.L89
.L40:
	leaq	1(%rax), %rdi
	movq	%rdi, p(%rip)
	cmpb	$47, 1(%rax)
	jle	.L69
	addq	$2, %rax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L44:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rdi
	leal	(%rsi,%rsi,4), %esi
	addq	$1, %rax
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rsi,2), %esi
	jg	.L44
.L43:
	leaq	1(%rdi), %rax
	negl	%esi
	jmp	.L45
	.p2align 4,,10
	.p2align 3
.L61:
	imulq	T(%rip), %rax
	subq	%rax, %rdx
	jmp	.L62
	.p2align 4,,10
	.p2align 3
.L59:
	imulq	T(%rip), %rdx
	jmp	.L60
	.p2align 4,,10
	.p2align 3
.L87:
	xorl	%r8d, %r8d
	jmp	.L49
.L66:
	xorl	%edx, %edx
	jmp	.L25
.L70:
	xorl	%edi, %edi
	jmp	.L50
.L68:
	xorl	%ecx, %ecx
	jmp	.L36
.L69:
	xorl	%esi, %esi
	jmp	.L43
.L65:
	movq	$0, (%rsp)
	xorl	%r15d, %r15d
	jmp	.L21
	.cfi_endproc
.LFE37:
	.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, 40
buf:
	.zero	40
	.globl	T
	.align 8
	.type	T, @object
	.size	T, 8
T:
	.zero	8
	.globl	S
	.align 8
	.type	S, @object
	.size	S, 8
S:
	.zero	8
	.globl	dx
	.align 32
	.type	dx, @object
	.size	dx, 1600008
dx:
	.zero	1600008
	.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:

// AOJ 0636: Foehn Phenomena
// 2017.12.14 bal4u@uu

#include <stdio.h>
#include <string.h>

long long dx[200001];
long long S, T;
char buf[40], *p;

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

long long calc(int i, int x)
{
	long long d;

	if (dx[i] > 0) d = dx[i]*S;
	else           d = dx[i]*T;
	dx[i] += x;
	if (dx[i] > 0) d -= dx[i]*S;
	else           d -= dx[i]*T;
	return d;
}

int main()
{
	int N, Q, i, a0, a, l, r, x;
	long long u, d, ans;
	
	fgets(p=buf, 40, stdin);
	N = getint(), Q = getint(), S = getint(), T = getint();

	fgets(buf, 10, stdin);
	u = d = a0 = 0;
	for (i = 1; i <= N; i++) {
		fgets(p=buf, 10, stdin);
		a = getint();
		a0 = a - a0;
		dx[i] = a0;
		if (a0 >= 0) u += a0;
		else         d += a0;
		a0 = a;
	}

	ans = -(d*T+u*S);
	while (Q--) {
		fgets(p=buf, 30, stdin);
		l = getint(), r = getint(), x = getint();
		ans += calc(l, x);
		if (r < N) ans += calc(r+1, -x);
		printf("%lld\n", ans);
	}
	return 0;
}
3 5 1 2
0
4
1
8
1 2 2
1 1 -2
2 3 5
1 2 -1
1 2 5
 3 5 1 2
0
4
1
8
1 2 2
1 1 -3
2 3 5
1 2 -1
1 2 5
 3 5 1 2
0
4
1
8
2 2 2
1 1 -3
2 3 5
1 2 -1
1 2 5
 3 5 1 2
0
4
1
8
2 2 2
1 1 -3
2 1 5
1 2 -1
1 2 5
 3 5 1 2
0
4
1
7
2 2 2
1 1 -3
2 1 5
1 2 -1
1 2 5
 3 5 2 2
0
4
1
7
2 2 2
1 1 -3
2 1 5
1 2 -1
1 2 5
 3 5 1 2
0
4
1
8
1 2 2
1 1 -2
2 3 5
2 2 -1
1 3 5
 3 5 1 2
0
4
1
8
1 2 2
1 1 -6
2 3 5
1 2 -1
1 2 5
 3 4 2 2
0
4
1
7
2 2 2
1 2 -3
2 1 5
1 2 -1
1 2 5
 3 5 1 2
0
4
1
7
2 2 2
1 2 -3
2 1 5
0 2 0
1 2 5

-5
-7
-13
-13
-13
 -5
-8
-13
-13
-13
 -7
-8
-13
-13
-13
 -7
-8
-8
-8
-8
 -6
-7
-7
-7
-7
 -14
-14
-14
-14
-14
 -5
-7
-13
-13
-18
 -5
-8
-13
-12
-13
 -14
-14
-14
-14
 -6
-6
-6
-6
-6

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

```c
// AOJ 0636: Foehn Phenomena
// 2017.12.14 bal4u@uu

#include <stdio.h>
#include <string.h>

long long dx[200001];
long long S, T;
char buf[40], *p;

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

long long calc(int i, int x)
{
	long long d;

	if (dx[i] > 0) d = dx[i]*S;
	else           d = dx[i]*T;
	dx[i] += x;
	if (dx[i] > 0) d -= dx[i]*S;
	else           d -= dx[i]*T;
	return d;
}

int main()
{
	int N, Q, i, a0, a, l, r, x;
	long long u, d, ans;
	
	fgets(p=buf, 40, stdin);
	N = getint(), Q = getint(), S = getint(), T = getint();

	fgets(buf, 10, stdin);
	u = d = a0 = 0;
	for (i = 1; i <= N; i++) {
		fgets(p=buf, 10, stdin);
		a = getint();
		a0 = a - a0;
		dx[i] = a0;
		if (a0 >= 0) u += a0;
		else         d += a0;
		a0 = a;
	}

	ans = -(d*T+u*S);
	while (Q--) {
		fgets(p=buf, 30, stdin);
		l = getint(), r = getint(), x = getint();
		ans += calc(l, x);
		if (r < N) ans += calc(r+1, -x);
		printf("%lld\n", ans);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	dx
	.bss
	.align 32
	.type	dx, @object
	.size	dx, 1600008
dx:
	.zero	1600008
	.globl	S
	.align 8
	.type	S, @object
	.size	S, 8
S:
	.zero	8
	.globl	T
	.align 8
	.type	T, @object
	.size	T, 8
T:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 40
buf:
	.zero	40
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	getint
	.type	getint, @function
getint:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$45, %al
	jne	.L6
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	jmp	.L3
.L4:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L3:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L4
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	-4(%rbp), %eax
	negl	%eax
	jmp	.L5
.L7:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L6:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L7
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	-4(%rbp), %eax
.L5:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	getint, .-getint
	.globl	calc
	.type	calc, @function
calc:
.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, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	jle	.L9
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	S(%rip), %rax
	imulq	%rdx, %rax
	movq	%rax, -8(%rbp)
	jmp	.L10
.L9:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	T(%rip), %rax
	imulq	%rdx, %rax
	movq	%rax, -8(%rbp)
.L10:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-24(%rbp), %eax
	cltq
	leaq	(%rdx,%rax), %rcx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	jle	.L11
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	S(%rip), %rax
	imulq	%rdx, %rax
	subq	%rax, -8(%rbp)
	jmp	.L12
.L11:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	T(%rip), %rax
	imulq	%rdx, %rax
	subq	%rax, -8(%rbp)
.L12:
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	calc, .-calc
	.section	.rodata
.LC0:
	.string	"%lld\n"
	.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
	subq	$64, %rsp
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$40, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, %eax
	call	getint
	movl	%eax, -44(%rbp)
	movl	$0, %eax
	call	getint
	movl	%eax, -56(%rbp)
	movl	$0, %eax
	call	getint
	cltq
	movq	%rax, S(%rip)
	movl	$0, %eax
	call	getint
	cltq
	movq	%rax, T(%rip)
	movq	stdin(%rip), %rax
	movq	%rax, %rdx
	movl	$10, %esi
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, -48(%rbp)
	movq	$0, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, -24(%rbp)
	movl	$1, -52(%rbp)
	jmp	.L15
.L18:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$10, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, %eax
	call	getint
	movl	%eax, -28(%rbp)
	movl	-28(%rbp), %eax
	subl	-48(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-48(%rbp), %eax
	cltq
	movl	-52(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	dx(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	cmpl	$0, -48(%rbp)
	js	.L16
	movl	-48(%rbp), %eax
	cltq
	addq	%rax, -24(%rbp)
	jmp	.L17
.L16:
	movl	-48(%rbp), %eax
	cltq
	addq	%rax, -16(%rbp)
.L17:
	movl	-28(%rbp), %eax
	movl	%eax, -48(%rbp)
	addl	$1, -52(%rbp)
.L15:
	movl	-52(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jle	.L18
	movq	T(%rip), %rax
	imulq	-16(%rbp), %rax
	movq	%rax, %rdx
	movq	S(%rip), %rax
	imulq	-24(%rbp), %rax
	addq	%rdx, %rax
	negq	%rax
	movq	%rax, -8(%rbp)
	jmp	.L19
.L21:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$30, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, %eax
	call	getint
	movl	%eax, -40(%rbp)
	movl	$0, %eax
	call	getint
	movl	%eax, -36(%rbp)
	movl	$0, %eax
	call	getint
	movl	%eax, -32(%rbp)
	movl	-32(%rbp), %edx
	movl	-40(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	addq	%rax, -8(%rbp)
	movl	-36(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jge	.L20
	movl	-32(%rbp), %eax
	negl	%eax
	movl	%eax, %edx
	movl	-36(%rbp), %eax
	addl	$1, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	addq	%rax, -8(%rbp)
.L20:
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L19:
	movl	-56(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -56(%rbp)
	testl	%eax, %eax
	jne	.L21
	movl	$0, %eax
	leave
	.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.
val
	.file	"temp.c"
	.text
	.globl	dx
	.bss
	.align 32
	.type	dx, @object
	.size	dx, 1600008
dx:
	.zero	1600008
	.globl	S
	.align 8
	.type	S, @object
	.size	S, 8
S:
	.zero	8
	.globl	T
	.align 8
	.type	T, @object
	.size	T, 8
T:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 40
buf:
	.zero	40
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	getint
	.type	getint, @function
getint:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$45, %al
	jne	.L6
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	jmp	.L3
.L4:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L3:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L4
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	-4(%rbp), %eax
	negl	%eax
	jmp	.L5
.L7:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L6:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L7
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	-4(%rbp), %eax
.L5:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	getint, .-getint
	.globl	calc
	.type	calc, @function
calc:
.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, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	jle	.L9
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	S(%rip), %rax
	imulq	%rdx, %rax
	movq	%rax, -8(%rbp)
	jmp	.L10
.L9:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	T(%rip), %rax
	imulq	%rdx, %rax
	movq	%rax, -8(%rbp)
.L10:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-24(%rbp), %eax
	cltq
	leaq	(%rdx,%rax), %rcx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	jle	.L11
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	S(%rip), %rax
	imulq	%rdx, %rax
	subq	%rax, -8(%rbp)
	jmp	.L12
.L11:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dx(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	T(%rip), %rax
	imulq	%rdx, %rax
	subq	%rax, -8(%rbp)
.L12:
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	calc, .-calc
	.section	.rodata
.LC0:
	.string	"%lld\n"
	.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
	subq	$64, %rsp
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$40, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, %eax
	call	getint
	movl	%eax, -44(%rbp)
	movl	$0, %eax
	call	getint
	movl	%eax, -56(%rbp)
	movl	$0, %eax
	call	getint
	cltq
	movq	%rax, S(%rip)
	movl	$0, %eax
	call	getint
	cltq
	movq	%rax, T(%rip)
	movq	stdin(%rip), %rax
	movq	%rax, %rdx
	movl	$10, %esi
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, -48(%rbp)
	movq	$0, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, -24(%rbp)
	movl	$1, -52(%rbp)
	jmp	.L15
.L18:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$10, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, %eax
	call	getint
	movl	%eax, -28(%rbp)
	movl	-28(%rbp), %eax
	subl	-48(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-48(%rbp), %eax
	cltq
	movl	-52(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	dx(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	cmpl	$0, -48(%rbp)
	js	.L16
	movl	-48(%rbp), %eax
	cltq
	addq	%rax, -24(%rbp)
	jmp	.L17
.L16:
	movl	-48(%rbp), %eax
	cltq
	addq	%rax, -16(%rbp)
.L17:
	movl	-28(%rbp), %eax
	movl	%eax, -48(%rbp)
	addl	$1, -52(%rbp)
.L15:
	movl	-52(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jle	.L18
	movq	T(%rip), %rax
	imulq	-16(%rbp), %rax
	movq	%rax, %rdx
	movq	S(%rip), %rax
	imulq	-24(%rbp), %rax
	addq	%rdx, %rax
	negq	%rax
	movq	%rax, -8(%rbp)
	jmp	.L19
.L21:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$30, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, %eax
	call	getint
	movl	%eax, -40(%rbp)
	movl	$0, %eax
	call	getint
	movl	%eax, -36(%rbp)
	movl	$0, %eax
	call	getint
	movl	%eax, -32(%rbp)
	movl	-32(%rbp), %edx
	movl	-40(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	addq	%rax, -8(%rbp)
	movl	-36(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jge	.L20
	movl	-32(%rbp), %eax
	negl	%eax
	movl	%eax, %edx
	movl	-36(%rbp), %eax
	addl	$1, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	addq	%rax, -8(%rbp)
.L20:
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L19:
	movl	-56(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -56(%rbp)
	testl	%eax, %eax
	jne	.L21
	movl	$0, %eax
	leave
	.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:
