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>
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);
  }
}
```

Assembly Code:

```assembly
	.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:
```

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
	.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
```assembly
	.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:
```
```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);
  }
}
```
Given the following C 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);
  }
}
```

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:

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 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);
  }
}
```

Assembly Code:

```assembly
	.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:
```

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
	.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:
```