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>
long int sq(long int n) {
    long int l=0,r=n,m;
    while (r-l>1L){m=(r+l)/2L;if(0<n/m/m)l=m;else r=m;}
    return l-(l*l==n);
}
int main(){
  long int i,q,a,b,x;
  scanf("%ld",&q);
  for(i=0;i<q;i++){
    scanf("%ld%ld",&a,&b);if(a>b){x=a;a=b;b=x;}
    if(a==b||a+1==b)x=a*2-2;
    else {x=sq(a*b);x=2*x-2+(x*(x+1)<a*b);}
    printf("%ld\n",x);
  }
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	sq
	.type	sq, @function
sq:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movq	$0, -24(%rbp)
	movq	-40(%rbp), %rax
	movq	%rax, -16(%rbp)
	jmp	.L2
.L4:
	movq	-16(%rbp), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -8(%rbp)
	movq	-40(%rbp), %rax
	cqto
	idivq	-8(%rbp)
	cqto
	idivq	-8(%rbp)
	testq	%rax, %rax
	jle	.L3
	movq	-8(%rbp), %rax
	movq	%rax, -24(%rbp)
	jmp	.L2
.L3:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
.L2:
	movq	-16(%rbp), %rax
	subq	-24(%rbp), %rax
	cmpq	$1, %rax
	jg	.L4
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	cmpq	%rax, -40(%rbp)
	sete	%al
	movzbl	%al, %edx
	movq	-24(%rbp), %rax
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	sq, .-sq
	.section	.rodata
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld%ld"
.LC2:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -24(%rbp)
	jmp	.L7
.L12:
	leaq	-32(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-40(%rbp), %rdx
	movq	-32(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L8
	movq	-40(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -40(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, -32(%rbp)
.L8:
	movq	-40(%rbp), %rdx
	movq	-32(%rbp), %rax
	cmpq	%rax, %rdx
	je	.L9
	movq	-40(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	-32(%rbp), %rax
	cmpq	%rax, %rdx
	jne	.L10
.L9:
	movq	-40(%rbp), %rax
	subq	$1, %rax
	addq	%rax, %rax
	movq	%rax, -16(%rbp)
	jmp	.L11
.L10:
	movq	-40(%rbp), %rdx
	movq	-32(%rbp), %rax
	imulq	%rdx, %rax
	movq	%rax, %rdi
	call	sq
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rax
	subq	$1, %rax
	leaq	(%rax,%rax), %rsi
	movq	-16(%rbp), %rax
	addq	$1, %rax
	imulq	-16(%rbp), %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rcx
	movq	-32(%rbp), %rax
	imulq	%rcx, %rax
	cmpq	%rax, %rdx
	setl	%al
	movzbl	%al, %eax
	addq	%rsi, %rax
	movq	%rax, -16(%rbp)
.L11:
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addq	$1, -24(%rbp)
.L7:
	movq	-48(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L12
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	sq
	.type	sq, @function
sq:
.LFB23:
	.cfi_startproc
	endbr64
	movq	%rdi, %r8
	xorl	%esi, %esi
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	(%rsi,%r8), %rdx
	movq	%rdi, %rax
	movq	%rdx, %rcx
	shrq	$63, %rcx
	addq	%rdx, %rcx
	cqto
	sarq	%rcx
	idivq	%rcx
	cqto
	idivq	%rcx
	testq	%rax, %rax
	cmovle	%rcx, %r8
	cmovg	%rcx, %rsi
.L3:
	movq	%r8, %rax
	subq	%rsi, %rax
	cmpq	$1, %rax
	jg	.L4
	movq	%rsi, %rax
	xorl	%edx, %edx
	imulq	%rsi, %rax
	cmpq	%rdi, %rax
	movq	%rsi, %rax
	sete	%dl
	subq	%rdx, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	sq, .-sq
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld%ld"
.LC2:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	cmpq	$0, (%rsp)
	jle	.L17
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r14
	leaq	8(%rsp), %r13
	leaq	.LC1(%rip), %r12
	leaq	.LC2(%rip), %rbp
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L24:
	leaq	1(%rdi), %rdx
	movq	%rdi, 8(%rsp)
	movq	%rax, 16(%rsp)
	cmpq	%rax, %rdx
	jne	.L12
.L11:
	leaq	-2(%rdi,%rdi), %rdx
.L13:
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpq	%rbx, (%rsp)
	jle	.L17
.L8:
	movq	%r12, %rdi
	movq	%r14, %rdx
	movq	%r13, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rax
	movq	16(%rsp), %rdi
	cmpq	%rdi, %rax
	jg	.L24
	je	.L11
	movq	%rdi, %rdx
	movq	%rax, %rdi
	movq	%rdx, %rax
	leaq	1(%rdi), %rdx
	cmpq	%rax, %rdx
	je	.L11
.L12:
	imulq	%rax, %rdi
	xorl	%esi, %esi
	movq	%rdi, %r8
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L16:
	leaq	(%rsi,%r8), %rax
	movq	%rax, %rcx
	shrq	$63, %rcx
	addq	%rax, %rcx
	movq	%rdi, %rax
	sarq	%rcx
	cqto
	idivq	%rcx
	cqto
	idivq	%rcx
	testq	%rax, %rax
	cmovle	%rcx, %r8
	cmovg	%rcx, %rsi
.L15:
	movq	%r8, %rax
	subq	%rsi, %rax
	cmpq	$1, %rax
	jg	.L16
	movq	%rsi, %rax
	imulq	%rsi, %rax
	cmpq	%rdi, %rax
	sete	%al
	movzbl	%al, %eax
	subq	%rax, %rsi
	leaq	1(%rsi), %rax
	imulq	%rsi, %rax
	cmpq	%rax, %rdi
	setg	%al
	movzbl	%al, %eax
	leaq	-2(%rax,%rsi,2), %rdx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L17:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L25:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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
	.p2align 4
	.globl	sq
	.type	sq, @function
sq:
.LFB23:
	.cfi_startproc
	endbr64
	movq	%rdi, %r8
	xorl	%esi, %esi
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	(%rsi,%r8), %rdx
	movq	%rdi, %rax
	movq	%rdx, %rcx
	shrq	$63, %rcx
	addq	%rdx, %rcx
	cqto
	sarq	%rcx
	idivq	%rcx
	cqto
	idivq	%rcx
	testq	%rax, %rax
	cmovle	%rcx, %r8
	cmovg	%rcx, %rsi
.L3:
	movq	%r8, %rax
	subq	%rsi, %rax
	cmpq	$1, %rax
	jg	.L4
	movq	%rsi, %rax
	xorl	%edx, %edx
	imulq	%rsi, %rax
	cmpq	%rdi, %rax
	movq	%rsi, %rax
	sete	%dl
	subq	%rdx, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	sq, .-sq
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld%ld"
.LC2:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	cmpq	$0, (%rsp)
	jle	.L17
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r14
	leaq	8(%rsp), %r13
	leaq	.LC1(%rip), %r12
	leaq	.LC2(%rip), %rbp
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L24:
	leaq	1(%rdi), %rdx
	movq	%rdi, 8(%rsp)
	movq	%rax, 16(%rsp)
	cmpq	%rax, %rdx
	jne	.L12
.L11:
	leaq	-2(%rdi,%rdi), %rdx
.L13:
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpq	%rbx, (%rsp)
	jle	.L17
.L8:
	movq	%r12, %rdi
	movq	%r14, %rdx
	movq	%r13, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rax
	movq	16(%rsp), %rdi
	cmpq	%rdi, %rax
	jg	.L24
	je	.L11
	movq	%rdi, %rdx
	movq	%rax, %rdi
	movq	%rdx, %rax
	leaq	1(%rdi), %rdx
	cmpq	%rax, %rdx
	je	.L11
.L12:
	imulq	%rax, %rdi
	xorl	%esi, %esi
	movq	%rdi, %r8
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L16:
	leaq	(%rsi,%r8), %rax
	movq	%rax, %rcx
	shrq	$63, %rcx
	addq	%rax, %rcx
	movq	%rdi, %rax
	sarq	%rcx
	cqto
	idivq	%rcx
	cqto
	idivq	%rcx
	testq	%rax, %rax
	cmovle	%rcx, %r8
	cmovg	%rcx, %rsi
.L15:
	movq	%r8, %rax
	subq	%rsi, %rax
	cmpq	$1, %rax
	jg	.L16
	movq	%rsi, %rax
	imulq	%rsi, %rax
	cmpq	%rdi, %rax
	sete	%al
	movzbl	%al, %eax
	subq	%rax, %rsi
	leaq	1(%rsi), %rax
	imulq	%rsi, %rax
	cmpq	%rax, %rdi
	setg	%al
	movzbl	%al, %eax
	leaq	-2(%rax,%rsi,2), %rdx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L17:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L25:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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>
long int sq(long int n) {
    long int l=0,r=n,m;
    while (r-l>1L){m=(r+l)/2L;if(0<n/m/m)l=m;else r=m;}
    return l-(l*l==n);
}
int main(){
  long int i,q,a,b,x;
  scanf("%ld",&q);
  for(i=0;i<q;i++){
    scanf("%ld%ld",&a,&b);if(a>b){x=a;a=b;b=x;}
    if(a==b||a+1==b)x=a*2-2;
    else {x=sq(a*b);x=2*x-2+(x*(x+1)<a*b);}
    printf("%ld\n",x);
  }
}

8
1 4
10 5
3 3
4 11
8 9
22 11
8 36
314159265 358979323
 8
1 4
10 5
3 3
4 11
8 9
22 3
8 36
314159265 358979323
 8
1 4
10 5
3 3
4 11
8 9
22 3
8 36
314159265 541984339
 8
1 4
10 5
3 3
4 11
8 9
22 3
7 36
314159265 541984339
 8
1 4
10 5
3 3
5 11
8 9
22 3
7 36
314159265 541984339
 8
2 4
10 5
3 3
5 11
8 9
22 3
7 36
314159265 541984339
 8
2 4
10 5
3 6
5 11
8 9
22 3
7 36
314159265 541984339
 8
2 4
10 5
3 6
5 11
8 9
22 3
3 36
314159265 541984339
 8
2 4
10 5
3 7
5 11
8 9
22 3
3 36
314159265 541984339
 8
2 4
10 5
3 7
5 11
8 9
22 1
3 36
314159265 541984339

1
12
4
11
14
29
31
671644785
 1
12
4
11
14
14
31
671644785
 1
12
4
11
14
14
31
825274259
 1
12
4
11
14
14
29
825274259
 1
12
4
12
14
14
29
825274259
 3
12
4
12
14
14
29
825274259
 3
12
6
12
14
14
29
825274259
 3
12
6
12
14
14
18
825274259
 3
12
7
12
14
14
18
825274259
 3
12
7
12
14
7
18
825274259

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>
long int sq(long int n) {
    long int l=0,r=n,m;
    while (r-l>1L){m=(r+l)/2L;if(0<n/m/m)l=m;else r=m;}
    return l-(l*l==n);
}
int main(){
  long int i,q,a,b,x;
  scanf("%ld",&q);
  for(i=0;i<q;i++){
    scanf("%ld%ld",&a,&b);if(a>b){x=a;a=b;b=x;}
    if(a==b||a+1==b)x=a*2-2;
    else {x=sq(a*b);x=2*x-2+(x*(x+1)<a*b);}
    printf("%ld\n",x);
  }
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	sq
	.type	sq, @function
sq:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movq	$0, -24(%rbp)
	movq	-40(%rbp), %rax
	movq	%rax, -16(%rbp)
	jmp	.L2
.L4:
	movq	-16(%rbp), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -8(%rbp)
	movq	-40(%rbp), %rax
	cqto
	idivq	-8(%rbp)
	cqto
	idivq	-8(%rbp)
	testq	%rax, %rax
	jle	.L3
	movq	-8(%rbp), %rax
	movq	%rax, -24(%rbp)
	jmp	.L2
.L3:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
.L2:
	movq	-16(%rbp), %rax
	subq	-24(%rbp), %rax
	cmpq	$1, %rax
	jg	.L4
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	cmpq	%rax, -40(%rbp)
	sete	%al
	movzbl	%al, %edx
	movq	-24(%rbp), %rax
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	sq, .-sq
	.section	.rodata
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld%ld"
.LC2:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -24(%rbp)
	jmp	.L7
.L12:
	leaq	-32(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-40(%rbp), %rdx
	movq	-32(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L8
	movq	-40(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -40(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, -32(%rbp)
.L8:
	movq	-40(%rbp), %rdx
	movq	-32(%rbp), %rax
	cmpq	%rax, %rdx
	je	.L9
	movq	-40(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	-32(%rbp), %rax
	cmpq	%rax, %rdx
	jne	.L10
.L9:
	movq	-40(%rbp), %rax
	subq	$1, %rax
	addq	%rax, %rax
	movq	%rax, -16(%rbp)
	jmp	.L11
.L10:
	movq	-40(%rbp), %rdx
	movq	-32(%rbp), %rax
	imulq	%rdx, %rax
	movq	%rax, %rdi
	call	sq
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rax
	subq	$1, %rax
	leaq	(%rax,%rax), %rsi
	movq	-16(%rbp), %rax
	addq	$1, %rax
	imulq	-16(%rbp), %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rcx
	movq	-32(%rbp), %rax
	imulq	%rcx, %rax
	cmpq	%rax, %rdx
	setl	%al
	movzbl	%al, %eax
	addq	%rsi, %rax
	movq	%rax, -16(%rbp)
.L11:
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addq	$1, -24(%rbp)
.L7:
	movq	-48(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L12
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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
	.globl	sq
	.type	sq, @function
sq:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movq	$0, -24(%rbp)
	movq	-40(%rbp), %rax
	movq	%rax, -16(%rbp)
	jmp	.L2
.L4:
	movq	-16(%rbp), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -8(%rbp)
	movq	-40(%rbp), %rax
	cqto
	idivq	-8(%rbp)
	cqto
	idivq	-8(%rbp)
	testq	%rax, %rax
	jle	.L3
	movq	-8(%rbp), %rax
	movq	%rax, -24(%rbp)
	jmp	.L2
.L3:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
.L2:
	movq	-16(%rbp), %rax
	subq	-24(%rbp), %rax
	cmpq	$1, %rax
	jg	.L4
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	cmpq	%rax, -40(%rbp)
	sete	%al
	movzbl	%al, %edx
	movq	-24(%rbp), %rax
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	sq, .-sq
	.section	.rodata
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld%ld"
.LC2:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -24(%rbp)
	jmp	.L7
.L12:
	leaq	-32(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-40(%rbp), %rdx
	movq	-32(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L8
	movq	-40(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -40(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, -32(%rbp)
.L8:
	movq	-40(%rbp), %rdx
	movq	-32(%rbp), %rax
	cmpq	%rax, %rdx
	je	.L9
	movq	-40(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	-32(%rbp), %rax
	cmpq	%rax, %rdx
	jne	.L10
.L9:
	movq	-40(%rbp), %rax
	subq	$1, %rax
	addq	%rax, %rax
	movq	%rax, -16(%rbp)
	jmp	.L11
.L10:
	movq	-40(%rbp), %rdx
	movq	-32(%rbp), %rax
	imulq	%rdx, %rax
	movq	%rax, %rdi
	call	sq
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rax
	subq	$1, %rax
	leaq	(%rax,%rax), %rsi
	movq	-16(%rbp), %rax
	addq	$1, %rax
	imulq	-16(%rbp), %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rcx
	movq	-32(%rbp), %rax
	imulq	%rcx, %rax
	cmpq	%rax, %rdx
	setl	%al
	movzbl	%al, %eax
	addq	%rsi, %rax
	movq	%rax, -16(%rbp)
.L11:
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addq	$1, -24(%rbp)
.L7:
	movq	-48(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L12
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
