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

char input[100001];

int main(void)
{
    int a, b, i, j, k, length;

    scanf("%s %d", input, &k);

    length = strlen(input);

    for (i = 0; i < length; i++) {
        if (input[i] == 'a' || ('z' + 1) - input[i] > k) {
            continue;
        } else {
            k -= ('z' + 1) - input[i];
            input[i] = 'a';
        }
    }
    k %= 26;
    input[i-1] += k;
    if (input[i-1] > 'z') {
        input[i-1] = input[i-1] - 'z' + 'a';
    }

    printf("%s\n", input);

    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	input
	.bss
	.align 32
	.type	input, @object
	.size	input, 100001
input:
	.zero	100001
	.section	.rodata
.LC0:
	.string	"%s %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20(%rbp), %rax
	movq	%rax, %rdx
	leaq	input(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	input(%rip), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -12(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L2
.L6:
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$97, %al
	je	.L10
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	$123, %edx
	subl	%eax, %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L10
	movl	-20(%rbp), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rcx
	movzbl	(%rax,%rcx), %eax
	movsbl	%al, %eax
	movl	$123, %ecx
	subl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -20(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rdx
	movb	$97, (%rax,%rdx)
	jmp	.L5
.L10:
	nop
.L5:
	addl	$1, -16(%rbp)
.L2:
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jl	.L6
	movl	-20(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1321528399, %rax, %rax
	shrq	$32, %rax
	sarl	$3, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$26, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -20(%rbp)
	movl	-16(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	input(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movl	%eax, %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-16(%rbp), %eax
	subl	$1, %eax
	movl	%edx, %ecx
	cltq
	leaq	input(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	movl	-16(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	input(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$122, %al
	jle	.L7
	movl	-16(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	input(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	leal	-25(%rax), %edx
	movl	-16(%rbp), %eax
	subl	$1, %eax
	movl	%edx, %ecx
	cltq
	leaq	input(%rip), %rdx
	movb	%cl, (%rax,%rdx)
.L7:
	leaq	input(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	input(%rip), %rbp
	leaq	.LC0(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rbp, %rsi
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	testq	%rax, %rax
	je	.L20
	movl	4(%rsp), %r10d
	leal	-1(%rax), %ecx
	leaq	1(%rbp), %r9
	movq	%rbp, %rdx
	movq	%rcx, %rax
	addq	%rcx, %r9
	xorl	%ebx, %ebx
	movl	$123, %r11d
	movl	%r10d, %edi
	.p2align 4,,10
	.p2align 3
.L5:
	movzbl	(%rdx), %ecx
	cmpb	$97, %cl
	je	.L4
	movsbl	%cl, %r8d
	movl	%r11d, %esi
	subl	%r8d, %esi
	cmpl	%edi, %esi
	jg	.L4
	movb	$97, (%rdx)
	subl	%esi, %edi
	movl	$97, %ecx
	movl	$1, %ebx
.L4:
	addq	$1, %rdx
	cmpq	%rdx, %r9
	jne	.L5
	testb	%bl, %bl
	cmovne	%edi, %r10d
.L3:
	movslq	%r10d, %rdx
	movl	%r10d, %esi
	cltq
	imulq	$1321528399, %rdx, %rdx
	sarl	$31, %esi
	sarq	$35, %rdx
	subl	%esi, %edx
	imull	$26, %edx, %esi
	movl	%r10d, %edx
	subl	%esi, %edx
	addl	%edx, %ecx
	movl	%edx, 4(%rsp)
	cmpb	$122, %cl
	jle	.L18
	subl	$25, %ecx
.L18:
	movq	%rbp, %rdi
	movb	%cl, 0(%rbp,%rax)
	call	puts@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L20:
	.cfi_restore_state
	movzbl	-1+input(%rip), %ecx
	movl	4(%rsp), %r10d
	orl	$-1, %eax
	jmp	.L3
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	input
	.bss
	.align 32
	.type	input, @object
	.size	input, 100001
input:
	.zero	100001
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	input(%rip), %rbp
	leaq	.LC0(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rbp, %rsi
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	testq	%rax, %rax
	je	.L20
	movl	4(%rsp), %r10d
	leal	-1(%rax), %ecx
	leaq	1(%rbp), %r9
	movq	%rbp, %rdx
	movq	%rcx, %rax
	addq	%rcx, %r9
	xorl	%ebx, %ebx
	movl	$123, %r11d
	movl	%r10d, %edi
	.p2align 4,,10
	.p2align 3
.L5:
	movzbl	(%rdx), %ecx
	cmpb	$97, %cl
	je	.L4
	movsbl	%cl, %r8d
	movl	%r11d, %esi
	subl	%r8d, %esi
	cmpl	%edi, %esi
	jg	.L4
	movb	$97, (%rdx)
	subl	%esi, %edi
	movl	$97, %ecx
	movl	$1, %ebx
.L4:
	addq	$1, %rdx
	cmpq	%rdx, %r9
	jne	.L5
	testb	%bl, %bl
	cmovne	%edi, %r10d
.L3:
	movslq	%r10d, %rdx
	movl	%r10d, %esi
	cltq
	imulq	$1321528399, %rdx, %rdx
	sarl	$31, %esi
	sarq	$35, %rdx
	subl	%esi, %edx
	imull	$26, %edx, %esi
	movl	%r10d, %edx
	subl	%esi, %edx
	addl	%edx, %ecx
	movl	%edx, 4(%rsp)
	cmpb	$122, %cl
	jle	.L18
	subl	$25, %ecx
.L18:
	movq	%rbp, %rdi
	movb	%cl, 0(%rbp,%rax)
	call	puts@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L20:
	.cfi_restore_state
	movzbl	-1+input(%rip), %ecx
	movl	4(%rsp), %r10d
	orl	$-1, %eax
	jmp	.L3
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	input
	.bss
	.align 32
	.type	input, @object
	.size	input, 100001
input:
	.zero	100001
	.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>
#include <string.h>
#include <stdlib.h>
#include <math.h>

char input[100001];

int main(void)
{
    int a, b, i, j, k, length;

    scanf("%s %d", input, &k);

    length = strlen(input);

    for (i = 0; i < length; i++) {
        if (input[i] == 'a' || ('z' + 1) - input[i] > k) {
            continue;
        } else {
            k -= ('z' + 1) - input[i];
            input[i] = 'a';
        }
    }
    k %= 26;
    input[i-1] += k;
    if (input[i-1] > 'z') {
        input[i-1] = input[i-1] - 'z' + 'a';
    }

    printf("%s\n", input);

    return 0;
}

codefestival
101
 xyz
1
 zyx
1
 cdoeffstival
101
 zyx
2
 cdoeffstival
111
 zyx
3
 lavitsffeodc
111
 xyz
2
 caoeffstivdl
111

aaaafeaaiaal
 xya
 ayx
 aaaaffaaiaal
 ayy
 aaaaafativam
 aax
 aaaaaaaaeadg
 xaz
 aaaaaaativdo

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

char input[100001];

int main(void)
{
    int a, b, i, j, k, length;

    scanf("%s %d", input, &k);

    length = strlen(input);

    for (i = 0; i < length; i++) {
        if (input[i] == 'a' || ('z' + 1) - input[i] > k) {
            continue;
        } else {
            k -= ('z' + 1) - input[i];
            input[i] = 'a';
        }
    }
    k %= 26;
    input[i-1] += k;
    if (input[i-1] > 'z') {
        input[i-1] = input[i-1] - 'z' + 'a';
    }

    printf("%s\n", input);

    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	input
	.bss
	.align 32
	.type	input, @object
	.size	input, 100001
input:
	.zero	100001
	.section	.rodata
.LC0:
	.string	"%s %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20(%rbp), %rax
	movq	%rax, %rdx
	leaq	input(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	input(%rip), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -12(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L2
.L6:
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$97, %al
	je	.L10
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	$123, %edx
	subl	%eax, %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L10
	movl	-20(%rbp), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rcx
	movzbl	(%rax,%rcx), %eax
	movsbl	%al, %eax
	movl	$123, %ecx
	subl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -20(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rdx
	movb	$97, (%rax,%rdx)
	jmp	.L5
.L10:
	nop
.L5:
	addl	$1, -16(%rbp)
.L2:
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jl	.L6
	movl	-20(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1321528399, %rax, %rax
	shrq	$32, %rax
	sarl	$3, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$26, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -20(%rbp)
	movl	-16(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	input(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movl	%eax, %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-16(%rbp), %eax
	subl	$1, %eax
	movl	%edx, %ecx
	cltq
	leaq	input(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	movl	-16(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	input(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$122, %al
	jle	.L7
	movl	-16(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	input(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	leal	-25(%rax), %edx
	movl	-16(%rbp), %eax
	subl	$1, %eax
	movl	%edx, %ecx
	cltq
	leaq	input(%rip), %rdx
	movb	%cl, (%rax,%rdx)
.L7:
	leaq	input(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	input
	.bss
	.align 32
	.type	input, @object
	.size	input, 100001
input:
	.zero	100001
	.section	.rodata
.LC0:
	.string	"%s %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20(%rbp), %rax
	movq	%rax, %rdx
	leaq	input(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	input(%rip), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -12(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L2
.L6:
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$97, %al
	je	.L10
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	$123, %edx
	subl	%eax, %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L10
	movl	-20(%rbp), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rcx
	movzbl	(%rax,%rcx), %eax
	movsbl	%al, %eax
	movl	$123, %ecx
	subl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -20(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rdx
	movb	$97, (%rax,%rdx)
	jmp	.L5
.L10:
	nop
.L5:
	addl	$1, -16(%rbp)
.L2:
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jl	.L6
	movl	-20(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1321528399, %rax, %rax
	shrq	$32, %rax
	sarl	$3, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$26, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -20(%rbp)
	movl	-16(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	input(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movl	%eax, %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-16(%rbp), %eax
	subl	$1, %eax
	movl	%edx, %ecx
	cltq
	leaq	input(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	movl	-16(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	input(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$122, %al
	jle	.L7
	movl	-16(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	input(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	leal	-25(%rax), %edx
	movl	-16(%rbp), %eax
	subl	$1, %eax
	movl	%edx, %ecx
	cltq
	leaq	input(%rip), %rdx
	movb	%cl, (%rax,%rdx)
.L7:
	leaq	input(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
