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

int main(void)
{
  unsigned long K, A, B, ANS;
  scanf("%ld %ld %ld", &K, &A, &B);
  //printf("K(%ld) A(%ld) B(%ld)\n", K, A, B);

  // 売れない
  if (K < ((A - 1) + 1)) {
    ANS = 1 + K;
  // 売れる
  } else {
    // 最初に叩いた残り回数が偶数の場合
    if ((K - (A - 1)) % 2 == 0) {
      // 売買で儲かる
      if (A + 2 < B) {
        ANS = 1 + (A - 1) + (B - A) * (K - (A - 1)) / 2;
      // 売買で儲からない
      } else {
        ANS = 1 + K;
      }
    // 最初に叩いた残り回数が奇数の場合
    } else {
      // 売買で儲かる
      if (A + 2 < B) {
        ANS = 1 + (A - 1) + (B - A) * (K - (A - 1) - 1) / 2 + 1;
      // 売買で儲からない
      } else {
        ANS = 1 + K;
      }
    }
  }
  printf("%ld\n", ANS);
  return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld %ld %ld"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	leaq	16(%rsp), %rcx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rdx
	movq	8(%rsp), %rax
	cmpq	%rax, %rdx
	jnb	.L2
	addq	$1, %rdx
.L3:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L10
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	movq	%rdx, %rsi
	movq	16(%rsp), %rcx
	leaq	2(%rax), %rdi
	addq	$1, %rdx
	subq	%rax, %rsi
	leaq	1(%rsi), %r8
	testb	$1, %sil
	je	.L4
	cmpq	%rdi, %rcx
	jbe	.L3
	subq	%rax, %rcx
	imulq	%r8, %rcx
	shrq	%rcx
	leaq	(%rcx,%rax), %rdx
	jmp	.L3
.L4:
	cmpq	%rdi, %rcx
	jbe	.L3
	subq	%rax, %rcx
	imulq	%rsi, %rcx
	shrq	%rcx
	leaq	1(%rax,%rcx), %rdx
	jmp	.L3
.L10:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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 %ld %ld"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	leaq	16(%rsp), %rcx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rdx
	movq	8(%rsp), %rax
	cmpq	%rax, %rdx
	jnb	.L2
	addq	$1, %rdx
.L3:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L10
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	movq	%rdx, %rsi
	movq	16(%rsp), %rcx
	leaq	2(%rax), %rdi
	addq	$1, %rdx
	subq	%rax, %rsi
	leaq	1(%rsi), %r8
	testb	$1, %sil
	je	.L4
	cmpq	%rdi, %rcx
	jbe	.L3
	subq	%rax, %rcx
	imulq	%r8, %rcx
	shrq	%rcx
	leaq	(%rcx,%rax), %rdx
	jmp	.L3
.L4:
	cmpq	%rdi, %rcx
	jbe	.L3
	subq	%rax, %rcx
	imulq	%rsi, %rcx
	shrq	%rcx
	leaq	1(%rax,%rcx), %rdx
	jmp	.L3
.L10:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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 %ld %ld"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	leaq	16(%rsp), %rcx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rdx
	movq	8(%rsp), %rax
	cmpq	%rax, %rdx
	jnb	.L2
	addq	$1, %rdx
.L3:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L10
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	movq	%rdx, %rsi
	movq	16(%rsp), %rcx
	leaq	2(%rax), %rdi
	addq	$1, %rdx
	subq	%rax, %rsi
	leaq	1(%rsi), %r8
	testb	$1, %sil
	je	.L4
	cmpq	%rdi, %rcx
	jbe	.L3
	subq	%rax, %rcx
	imulq	%r8, %rcx
	shrq	%rcx
	leaq	(%rcx,%rax), %rdx
	jmp	.L3
.L4:
	cmpq	%rdi, %rcx
	jbe	.L3
	subq	%rax, %rcx
	imulq	%rsi, %rcx
	shrq	%rcx
	leaq	1(%rax,%rcx), %rdx
	jmp	.L3
.L10:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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>
#include <stdlib.h>

int main(void)
{
  unsigned long K, A, B, ANS;
  scanf("%ld %ld %ld", &K, &A, &B);
  //printf("K(%ld) A(%ld) B(%ld)\n", K, A, B);

  // 売れない
  if (K < ((A - 1) + 1)) {
    ANS = 1 + K;
  // 売れる
  } else {
    // 最初に叩いた残り回数が偶数の場合
    if ((K - (A - 1)) % 2 == 0) {
      // 売買で儲かる
      if (A + 2 < B) {
        ANS = 1 + (A - 1) + (B - A) * (K - (A - 1)) / 2;
      // 売買で儲からない
      } else {
        ANS = 1 + K;
      }
    // 最初に叩いた残り回数が奇数の場合
    } else {
      // 売買で儲かる
      if (A + 2 < B) {
        ANS = 1 + (A - 1) + (B - A) * (K - (A - 1) - 1) / 2 + 1;
      // 売買で儲からない
      } else {
        ANS = 1 + K;
      }
    }
  }
  printf("%ld\n", ANS);
  return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
  unsigned long K, A, B, ANS;
  scanf("%ld %ld %ld", &K, &A, &B);
  //printf("K(%ld) A(%ld) B(%ld)\n", K, A, B);

  // 売れない
  if (K < ((A - 1) + 1)) {
    ANS = 1 + K;
  // 売れる
  } else {
    // 最初に叩いた残り回数が偶数の場合
    if ((K - (A - 1)) % 2 == 0) {
      // 売買で儲かる
      if (A + 2 < B) {
        ANS = 1 + (A - 1) + (B - A) * (K - (A - 1)) / 2;
      // 売買で儲からない
      } else {
        ANS = 1 + K;
      }
    // 最初に叩いた残り回数が奇数の場合
    } else {
      // 売買で儲かる
      if (A + 2 < B) {
        ANS = 1 + (A - 1) + (B - A) * (K - (A - 1) - 1) / 2 + 1;
      // 売買で儲からない
      } else {
        ANS = 1 + K;
      }
    }
  }
  printf("%ld\n", ANS);
  return 0;
}```

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:

5 2 6
 7 5 4
 314159265 35897932 35610649
 5 3 6
 7 1 4
 3 3 6
 407766107 35897932 14836778
 7 2 6
 407766107 9307229 14836778
 407766107 9307229 25447105

10
 8
 314159266
 7
 11
 4
 407766108
 14
 1101648954500241
 3215538450316794

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

int main(void)
{
  unsigned long K, A, B, ANS;
  scanf("%ld %ld %ld", &K, &A, &B);
  //printf("K(%ld) A(%ld) B(%ld)\n", K, A, B);

  // 売れない
  if (K < ((A - 1) + 1)) {
    ANS = 1 + K;
  // 売れる
  } else {
    // 最初に叩いた残り回数が偶数の場合
    if ((K - (A - 1)) % 2 == 0) {
      // 売買で儲かる
      if (A + 2 < B) {
        ANS = 1 + (A - 1) + (B - A) * (K - (A - 1)) / 2;
      // 売買で儲からない
      } else {
        ANS = 1 + K;
      }
    // 最初に叩いた残り回数が奇数の場合
    } else {
      // 売買で儲かる
      if (A + 2 < B) {
        ANS = 1 + (A - 1) + (B - A) * (K - (A - 1) - 1) / 2 + 1;
      // 売買で儲からない
      } else {
        ANS = 1 + K;
      }
    }
  }
  printf("%ld\n", ANS);
  return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld %ld %ld"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	leaq	16(%rsp), %rcx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rdx
	movq	8(%rsp), %rax
	cmpq	%rax, %rdx
	jnb	.L2
	addq	$1, %rdx
.L3:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L10
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	movq	%rdx, %rsi
	movq	16(%rsp), %rcx
	leaq	2(%rax), %rdi
	addq	$1, %rdx
	subq	%rax, %rsi
	leaq	1(%rsi), %r8
	testb	$1, %sil
	je	.L4
	cmpq	%rdi, %rcx
	jbe	.L3
	subq	%rax, %rcx
	imulq	%r8, %rcx
	shrq	%rcx
	leaq	(%rcx,%rax), %rdx
	jmp	.L3
.L4:
	cmpq	%rdi, %rcx
	jbe	.L3
	subq	%rax, %rcx
	imulq	%rsi, %rcx
	shrq	%rcx
	leaq	1(%rax,%rcx), %rdx
	jmp	.L3
.L10:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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 %ld %ld"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	leaq	16(%rsp), %rcx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rdx
	movq	8(%rsp), %rax
	cmpq	%rax, %rdx
	jnb	.L2
	addq	$1, %rdx
.L3:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L10
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	movq	%rdx, %rsi
	movq	16(%rsp), %rcx
	leaq	2(%rax), %rdi
	addq	$1, %rdx
	subq	%rax, %rsi
	leaq	1(%rsi), %r8
	testb	$1, %sil
	je	.L4
	cmpq	%rdi, %rcx
	jbe	.L3
	subq	%rax, %rcx
	imulq	%r8, %rcx
	shrq	%rcx
	leaq	(%rcx,%rax), %rdx
	jmp	.L3
.L4:
	cmpq	%rdi, %rcx
	jbe	.L3
	subq	%rax, %rcx
	imulq	%rsi, %rcx
	shrq	%rcx
	leaq	1(%rax,%rcx), %rdx
	jmp	.L3
.L10:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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:
```