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(void){
    long int a,b,n;
    scanf("%ld %ld %ld",&n,&a,&b);
    if ((b - a) % 2 == 0){
        printf("%ld",((b - a) / 2));
    }else{
        if (b - 1 <= n - a){
            printf("%ld",(((b - a) / 2) + 1) +  (a - 1));
        }else{
            printf("%ld",(((b - a) / 2) + 1) + (n - b));
        }
    }
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld %ld %ld"
.LC1:
	.string	"%ld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	16(%rsp), %rsi
	leaq	8(%rsp), %rcx
	movq	%rsp, %rdx
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	movq	%rsi, %rax
	subq	%rdi, %rax
	testb	$1, %al
	je	.L8
	movq	%rax, %rcx
	movq	16(%rsp), %rdx
	leaq	-1(%rsi), %r8
	shrq	$63, %rcx
	addq	%rax, %rcx
	movq	%rdx, %rax
	sarq	%rcx
	subq	%rdi, %rax
	addq	$1, %rcx
	cmpq	%rax, %r8
	jle	.L9
	subq	%rsi, %rdx
	movl	$1, %edi
	xorl	%eax, %eax
	addq	%rcx, %rdx
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
.L3:
	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
.L9:
	.cfi_restore_state
	leaq	-1(%rdi,%rcx), %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
.L8:
	movl	$2, %ecx
	cqto
	movl	$1, %edi
	idivq	%rcx
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
.L10:
	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 %ld %ld"
.LC1:
	.string	"%ld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	16(%rsp), %rsi
	leaq	8(%rsp), %rcx
	movq	%rsp, %rdx
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	movq	%rsi, %rax
	subq	%rdi, %rax
	testb	$1, %al
	je	.L8
	movq	%rax, %rcx
	movq	16(%rsp), %rdx
	leaq	-1(%rsi), %r8
	shrq	$63, %rcx
	addq	%rax, %rcx
	movq	%rdx, %rax
	sarq	%rcx
	subq	%rdi, %rax
	addq	$1, %rcx
	cmpq	%rax, %r8
	jle	.L9
	subq	%rsi, %rdx
	movl	$1, %edi
	xorl	%eax, %eax
	addq	%rcx, %rdx
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
.L3:
	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
.L9:
	.cfi_restore_state
	leaq	-1(%rdi,%rcx), %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
.L8:
	movl	$2, %ecx
	cqto
	movl	$1, %edi
	idivq	%rcx
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
.L10:
	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 %ld %ld"
.LC1:
	.string	"%ld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	16(%rsp), %rsi
	leaq	8(%rsp), %rcx
	movq	%rsp, %rdx
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	movq	%rsi, %rax
	subq	%rdi, %rax
	testb	$1, %al
	je	.L8
	movq	%rax, %rcx
	movq	16(%rsp), %rdx
	leaq	-1(%rsi), %r8
	shrq	$63, %rcx
	addq	%rax, %rcx
	movq	%rdx, %rax
	sarq	%rcx
	subq	%rdi, %rax
	addq	$1, %rcx
	cmpq	%rax, %r8
	jle	.L9
	subq	%rsi, %rdx
	movl	$1, %edi
	xorl	%eax, %eax
	addq	%rcx, %rdx
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
.L3:
	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
.L9:
	.cfi_restore_state
	leaq	-1(%rdi,%rcx), %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
.L8:
	movl	$2, %ecx
	cqto
	movl	$1, %edi
	idivq	%rcx
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
.L10:
	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(void){
    long int a,b,n;
    scanf("%ld %ld %ld",&n,&a,&b);
    if ((b - a) % 2 == 0){
        printf("%ld",((b - a) / 2));
    }else{
        if (b - 1 <= n - a){
            printf("%ld",(((b - a) / 2) + 1) +  (a - 1));
        }else{
            printf("%ld",(((b - a) / 2) + 1) + (n - b));
        }
    }
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
 int main(void){
    long int a,b,n;
    scanf("%ld %ld %ld",&n,&a,&b);
    if ((b - a) % 2 == 0){
        printf("%ld",((b - a) / 2));
    }else{
        if (b - 1 <= n - a){
            printf("%ld",(((b - a) / 2) + 1) +  (a - 1));
        }else{
            printf("%ld",(((b - a) / 2) + 1) + (n - b));
        }
    }
}```

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:

4 2 3
 5 2 8
 6 3 3
 6 3 5
 1 2 5
 0 3 4
 2 -1 0
 5 2 16
 5 2 27
 10 4 5

2 3 0 1 -2 -3 -1 7 -9 4
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(void){
    long int a,b,n;
    scanf("%ld %ld %ld",&n,&a,&b);
    if ((b - a) % 2 == 0){
        printf("%ld",((b - a) / 2));
    }else{
        if (b - 1 <= n - a){
            printf("%ld",(((b - a) / 2) + 1) +  (a - 1));
        }else{
            printf("%ld",(((b - a) / 2) + 1) + (n - b));
        }
    }
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld %ld %ld"
.LC1:
	.string	"%ld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	16(%rsp), %rsi
	leaq	8(%rsp), %rcx
	movq	%rsp, %rdx
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	movq	%rsi, %rax
	subq	%rdi, %rax
	testb	$1, %al
	je	.L8
	movq	%rax, %rcx
	movq	16(%rsp), %rdx
	leaq	-1(%rsi), %r8
	shrq	$63, %rcx
	addq	%rax, %rcx
	movq	%rdx, %rax
	sarq	%rcx
	subq	%rdi, %rax
	addq	$1, %rcx
	cmpq	%rax, %r8
	jle	.L9
	subq	%rsi, %rdx
	movl	$1, %edi
	xorl	%eax, %eax
	addq	%rcx, %rdx
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
.L3:
	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
.L9:
	.cfi_restore_state
	leaq	-1(%rdi,%rcx), %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
.L8:
	movl	$2, %ecx
	cqto
	movl	$1, %edi
	idivq	%rcx
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
.L10:
	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 %ld %ld"
.LC1:
	.string	"%ld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	16(%rsp), %rsi
	leaq	8(%rsp), %rcx
	movq	%rsp, %rdx
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	movq	%rsi, %rax
	subq	%rdi, %rax
	testb	$1, %al
	je	.L8
	movq	%rax, %rcx
	movq	16(%rsp), %rdx
	leaq	-1(%rsi), %r8
	shrq	$63, %rcx
	addq	%rax, %rcx
	movq	%rdx, %rax
	sarq	%rcx
	subq	%rdi, %rax
	addq	$1, %rcx
	cmpq	%rax, %r8
	jle	.L9
	subq	%rsi, %rdx
	movl	$1, %edi
	xorl	%eax, %eax
	addq	%rcx, %rdx
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
.L3:
	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
.L9:
	.cfi_restore_state
	leaq	-1(%rdi,%rcx), %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
.L8:
	movl	$2, %ecx
	cqto
	movl	$1, %edi
	idivq	%rcx
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
.L10:
	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:
```