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

```c
#include<stdio.h>

int main(){
  long n,left,right,mid;
  scanf("%ld",&n);
  left=1;
  right=n;
  mid=(left+right)/2;
  while(left<right){
    mid=(left+right)/2;
    if(n-mid>mid*(mid-1)/2)
      left=mid+1;
    else if(n-mid<mid*(mid-1)/2)
      right=mid;
    else
      left=right=mid;
  }
  for(long i=1;i<=left;i++)
    if(i!=(left*(left+1)/2)-n)
      printf("%ld\n",i);
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rdx
	cmpq	$1, %rdx
	jle	.L12
	movq	%rdx, %rsi
	movl	$1, %ecx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	1(%rbx), %rcx
.L4:
	cmpq	%rcx, %rsi
	jle	.L17
.L6:
	leaq	(%rsi,%rcx), %rbx
	movq	%rdx, %rdi
	sarq	%rbx
	leaq	-1(%rbx), %rax
	subq	%rbx, %rdi
	imulq	%rbx, %rax
	sarq	%rax
	cmpq	%rax, %rdi
	jg	.L18
	jl	.L19
.L2:
	leaq	1(%rbx), %r12
	movl	$1, %ebp
	leaq	.LC1(%rip), %r13
	imulq	%rbx, %r12
	sarq	%r12
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r12, %rax
	subq	%rdx, %rax
	cmpq	%rbp, %rax
	je	.L7
.L20:
	movq	%rbp, %rdx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$1, %rbp
	cmpq	%rbp, %rbx
	jl	.L9
	movq	(%rsp), %rdx
	movq	%r12, %rax
	subq	%rdx, %rax
	cmpq	%rbp, %rax
	jne	.L20
.L7:
	addq	$1, %rbp
	cmpq	%rbp, %rbx
	jge	.L10
.L9:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L19:
	.cfi_restore_state
	movq	%rbx, %rsi
	jmp	.L4
.L12:
	movl	$1, %ebx
	jmp	.L2
.L17:
	movq	%rcx, %rbx
	jmp	.L2
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rdx
	cmpq	$1, %rdx
	jle	.L12
	movq	%rdx, %rsi
	movl	$1, %ecx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	1(%rbx), %rcx
.L4:
	cmpq	%rcx, %rsi
	jle	.L17
.L6:
	leaq	(%rsi,%rcx), %rbx
	movq	%rdx, %rdi
	sarq	%rbx
	leaq	-1(%rbx), %rax
	subq	%rbx, %rdi
	imulq	%rbx, %rax
	sarq	%rax
	cmpq	%rax, %rdi
	jg	.L18
	jl	.L19
.L2:
	leaq	1(%rbx), %r12
	movl	$1, %ebp
	leaq	.LC1(%rip), %r13
	imulq	%rbx, %r12
	sarq	%r12
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r12, %rax
	subq	%rdx, %rax
	cmpq	%rbp, %rax
	je	.L7
.L20:
	movq	%rbp, %rdx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$1, %rbp
	cmpq	%rbp, %rbx
	jl	.L9
	movq	(%rsp), %rdx
	movq	%r12, %rax
	subq	%rdx, %rax
	cmpq	%rbp, %rax
	jne	.L20
.L7:
	addq	$1, %rbp
	cmpq	%rbp, %rbx
	jge	.L10
.L9:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L19:
	.cfi_restore_state
	movq	%rbx, %rsi
	jmp	.L4
.L12:
	movl	$1, %ebx
	jmp	.L2
.L17:
	movq	%rcx, %rbx
	jmp	.L2
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```
rule
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rdx
	cmpq	$1, %rdx
	jle	.L12
	movq	%rdx, %rsi
	movl	$1, %ecx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	1(%rbx), %rcx
.L4:
	cmpq	%rcx, %rsi
	jle	.L17
.L6:
	leaq	(%rsi,%rcx), %rbx
	movq	%rdx, %rdi
	sarq	%rbx
	leaq	-1(%rbx), %rax
	subq	%rbx, %rdi
	imulq	%rbx, %rax
	sarq	%rax
	cmpq	%rax, %rdi
	jg	.L18
	jl	.L19
.L2:
	leaq	1(%rbx), %r12
	movl	$1, %ebp
	leaq	.LC1(%rip), %r13
	imulq	%rbx, %r12
	sarq	%r12
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r12, %rax
	subq	%rdx, %rax
	cmpq	%rbp, %rax
	je	.L7
.L20:
	movq	%rbp, %rdx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$1, %rbp
	cmpq	%rbp, %rbx
	jl	.L9
	movq	(%rsp), %rdx
	movq	%r12, %rax
	subq	%rdx, %rax
	cmpq	%rbp, %rax
	jne	.L20
.L7:
	addq	$1, %rbp
	cmpq	%rbp, %rbx
	jge	.L10
.L9:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L19:
	.cfi_restore_state
	movq	%rbx, %rsi
	jmp	.L4
.L12:
	movl	$1, %ebx
	jmp	.L2
.L17:
	movq	%rcx, %rbx
	jmp	.L2
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```
```c
#include<stdio.h>

int main(){
  long n,left,right,mid;
  scanf("%ld",&n);
  left=1;
  right=n;
  mid=(left+right)/2;
  while(left<right){
    mid=(left+right)/2;
    if(n-mid>mid*(mid-1)/2)
      left=mid+1;
    else if(n-mid<mid*(mid-1)/2)
      right=mid;
    else
      left=right=mid;
  }
  for(long i=1;i<=left;i++)
    if(i!=(left*(left+1)/2)-n)
      printf("%ld\n",i);
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>

int main(){
  long n,left,right,mid;
  scanf("%ld",&n);
  left=1;
  right=n;
  mid=(left+right)/2;
  while(left<right){
    mid=(left+right)/2;
    if(n-mid>mid*(mid-1)/2)
      left=mid+1;
    else if(n-mid<mid*(mid-1)/2)
      right=mid;
    else
      left=right=mid;
  }
  for(long i=1;i<=left;i++)
    if(i!=(left*(left+1)/2)-n)
      printf("%ld\n",i);
}```

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:

14
 2
 3
 8
 12
 21
 5
 9
 17
 31

2
3
4
5
 2
 1
2
 1
3
4
 1
2
4
5
 1
2
3
4
5
6
 2
3
 2
3
4
 1
2
3
5
6
 1
2
3
4
6
7
8

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

```c
#include<stdio.h>

int main(){
  long n,left,right,mid;
  scanf("%ld",&n);
  left=1;
  right=n;
  mid=(left+right)/2;
  while(left<right){
    mid=(left+right)/2;
    if(n-mid>mid*(mid-1)/2)
      left=mid+1;
    else if(n-mid<mid*(mid-1)/2)
      right=mid;
    else
      left=right=mid;
  }
  for(long i=1;i<=left;i++)
    if(i!=(left*(left+1)/2)-n)
      printf("%ld\n",i);
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rdx
	cmpq	$1, %rdx
	jle	.L12
	movq	%rdx, %rsi
	movl	$1, %ecx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	1(%rbx), %rcx
.L4:
	cmpq	%rcx, %rsi
	jle	.L17
.L6:
	leaq	(%rsi,%rcx), %rbx
	movq	%rdx, %rdi
	sarq	%rbx
	leaq	-1(%rbx), %rax
	subq	%rbx, %rdi
	imulq	%rbx, %rax
	sarq	%rax
	cmpq	%rax, %rdi
	jg	.L18
	jl	.L19
.L2:
	leaq	1(%rbx), %r12
	movl	$1, %ebp
	leaq	.LC1(%rip), %r13
	imulq	%rbx, %r12
	sarq	%r12
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r12, %rax
	subq	%rdx, %rax
	cmpq	%rbp, %rax
	je	.L7
.L20:
	movq	%rbp, %rdx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$1, %rbp
	cmpq	%rbp, %rbx
	jl	.L9
	movq	(%rsp), %rdx
	movq	%r12, %rax
	subq	%rdx, %rax
	cmpq	%rbp, %rax
	jne	.L20
.L7:
	addq	$1, %rbp
	cmpq	%rbp, %rbx
	jge	.L10
.L9:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L19:
	.cfi_restore_state
	movq	%rbx, %rsi
	jmp	.L4
.L12:
	movl	$1, %ebx
	jmp	.L2
.L17:
	movq	%rcx, %rbx
	jmp	.L2
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rdx
	cmpq	$1, %rdx
	jle	.L12
	movq	%rdx, %rsi
	movl	$1, %ecx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	1(%rbx), %rcx
.L4:
	cmpq	%rcx, %rsi
	jle	.L17
.L6:
	leaq	(%rsi,%rcx), %rbx
	movq	%rdx, %rdi
	sarq	%rbx
	leaq	-1(%rbx), %rax
	subq	%rbx, %rdi
	imulq	%rbx, %rax
	sarq	%rax
	cmpq	%rax, %rdi
	jg	.L18
	jl	.L19
.L2:
	leaq	1(%rbx), %r12
	movl	$1, %ebp
	leaq	.LC1(%rip), %r13
	imulq	%rbx, %r12
	sarq	%r12
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r12, %rax
	subq	%rdx, %rax
	cmpq	%rbp, %rax
	je	.L7
.L20:
	movq	%rbp, %rdx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$1, %rbp
	cmpq	%rbp, %rbx
	jl	.L9
	movq	(%rsp), %rdx
	movq	%r12, %rax
	subq	%rdx, %rax
	cmpq	%rbp, %rax
	jne	.L20
.L7:
	addq	$1, %rbp
	cmpq	%rbp, %rbx
	jge	.L10
.L9:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L19:
	.cfi_restore_state
	movq	%rbx, %rsi
	jmp	.L4
.L12:
	movl	$1, %ebx
	jmp	.L2
.L17:
	movq	%rcx, %rbx
	jmp	.L2
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```