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 <string.h>

int main(void) {

  char s[26];
  scanf("%s", s);
  int length = strlen(s);
  int alp[26];
  for (int i = 0; i < 26; i++) {
    alp[i] = 0;
  }
  for (int i = 0; i < length; i++) {
    alp[s[i]-'a']++;
  }
  if (length != 26) {
    printf("%s", s);
    for (int i = 0; i < 26; i++) {
      if (alp[i] == 0) {
        printf("%c\n", i+'a');
        return 0;
      }
    }
  } else {
    int end = -1;
    for (int i = length-1; i > 0; i--) {
      alp[s[i]-'a']--;
      if (s[i] > s[i-1]) {
        end = i-1;
        for (int j = s[end]-'a'+1; j < 26; j++) {
          if (alp[j] == 0) {
            s[end] = j+'a';
            break;
          }
        }
        break;
      }
    }
    if (end == -1) {
      printf("-1\n");
      return 0;
    }
    for (int i = 0; i <= end; i++) {
      printf("%c", s[i]);
    }
    printf("\n");
  }

  return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%c\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rbp, %rdi
	subq	$160, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	112(%rsp), %r12
	movq	%rsp, %rbx
	movq	%r12, %rsi
	call	__isoc99_scanf@PLT
	movq	%r12, %rdi
	call	strlen@PLT
	movl	$13, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rsi
	xorl	%eax, %eax
	rep stosq
	testq	%rsi, %rsi
	je	.L2
	leal	-1(%rsi), %eax
	movq	%r12, %rdx
	leaq	113(%rsp,%rax), %rcx
	.p2align 4,,10
	.p2align 3
.L3:
	movsbl	(%rdx), %eax
	addq	$1, %rdx
	subl	$97, %eax
	cltq
	addl	$1, (%rsp,%rax,4)
	cmpq	%rdx, %rcx
	jne	.L3
.L2:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	addq	$1, %rax
	cmpq	$26, %rax
	je	.L5
.L6:
	movl	(%rbx,%rax,4), %ecx
	movl	%eax, %edx
	testl	%ecx, %ecx
	jne	.L4
	addl	$97, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L5:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$160, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L15:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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	"%s"
.LC1:
	.string	"%c\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rbp, %rdi
	subq	$160, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	112(%rsp), %r12
	movq	%rsp, %rbx
	movq	%r12, %rsi
	call	__isoc99_scanf@PLT
	movq	%r12, %rdi
	call	strlen@PLT
	movl	$13, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rsi
	xorl	%eax, %eax
	rep stosq
	testq	%rsi, %rsi
	je	.L2
	leal	-1(%rsi), %eax
	movq	%r12, %rdx
	leaq	113(%rsp,%rax), %rcx
	.p2align 4,,10
	.p2align 3
.L3:
	movsbl	(%rdx), %eax
	addq	$1, %rdx
	subl	$97, %eax
	cltq
	addl	$1, (%rsp,%rax,4)
	cmpq	%rdx, %rcx
	jne	.L3
.L2:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	addq	$1, %rax
	cmpq	$26, %rax
	je	.L5
.L6:
	movl	(%rbx,%rax,4), %ecx
	movl	%eax, %edx
	testl	%ecx, %ecx
	jne	.L4
	addl	$97, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L5:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$160, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L15:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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	"%s"
.LC1:
	.string	"%c\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rbp, %rdi
	subq	$160, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	112(%rsp), %r12
	movq	%rsp, %rbx
	movq	%r12, %rsi
	call	__isoc99_scanf@PLT
	movq	%r12, %rdi
	call	strlen@PLT
	movl	$13, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rsi
	xorl	%eax, %eax
	rep stosq
	testq	%rsi, %rsi
	je	.L2
	leal	-1(%rsi), %eax
	movq	%r12, %rdx
	leaq	113(%rsp,%rax), %rcx
	.p2align 4,,10
	.p2align 3
.L3:
	movsbl	(%rdx), %eax
	addq	$1, %rdx
	subl	$97, %eax
	cltq
	addl	$1, (%rsp,%rax,4)
	cmpq	%rdx, %rcx
	jne	.L3
.L2:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	addq	$1, %rax
	cmpq	$26, %rax
	je	.L5
.L6:
	movl	(%rbx,%rax,4), %ecx
	movl	%eax, %edx
	testl	%ecx, %ecx
	jne	.L4
	addl	$97, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L5:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$160, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L15:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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 <string.h>

int main(void) {

  char s[26];
  scanf("%s", s);
  int length = strlen(s);
  int alp[26];
  for (int i = 0; i < 26; i++) {
    alp[i] = 0;
  }
  for (int i = 0; i < length; i++) {
    alp[s[i]-'a']++;
  }
  if (length != 26) {
    printf("%s", s);
    for (int i = 0; i < 26; i++) {
      if (alp[i] == 0) {
        printf("%c\n", i+'a');
        return 0;
      }
    }
  } else {
    int end = -1;
    for (int i = length-1; i > 0; i--) {
      alp[s[i]-'a']--;
      if (s[i] > s[i-1]) {
        end = i-1;
        for (int j = s[end]-'a'+1; j < 26; j++) {
          if (alp[j] == 0) {
            s[end] = j+'a';
            break;
          }
        }
        break;
      }
    }
    if (end == -1) {
      printf("-1\n");
      return 0;
    }
    for (int i = 0; i <= end; i++) {
      printf("%c", s[i]);
    }
    printf("\n");
  }

  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 <string.h>

int main(void) {

  char s[26];
  scanf("%s", s);
  int length = strlen(s);
  int alp[26];
  for (int i = 0; i < 26; i++) {
    alp[i] = 0;
  }
  for (int i = 0; i < length; i++) {
    alp[s[i]-'a']++;
  }
  if (length != 26) {
    printf("%s", s);
    for (int i = 0; i < 26; i++) {
      if (alp[i] == 0) {
        printf("%c\n", i+'a');
        return 0;
      }
    }
  } else {
    int end = -1;
    for (int i = length-1; i > 0; i--) {
      alp[s[i]-'a']--;
      if (s[i] > s[i-1]) {
        end = i-1;
        for (int j = s[end]-'a'+1; j < 26; j++) {
          if (alp[j] == 0) {
            s[end] = j+'a';
            break;
          }
        }
        break;
      }
    }
    if (end == -1) {
      printf("-1\n");
      return 0;
    }
    for (int i = 0; i <= end; i++) {
      printf("%c", s[i]);
    }
    printf("\n");
  }

  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:

redocta
 azcdefghijklmnopqrstuvwbyx
 cba
 redoctb
 bca
 bac
 abd
 atcodes
 abcdefghijklmnopqrytuvwzsx
 btcoder

redoctab
 azcdefghijklmnopqrstuvwx
 cbad
 redoctba
 bcad
 bacd
 abdc
 atcodesb
 abcdefghijklmnopqrytuvwzx
 btcodera

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 <string.h>

int main(void) {

  char s[26];
  scanf("%s", s);
  int length = strlen(s);
  int alp[26];
  for (int i = 0; i < 26; i++) {
    alp[i] = 0;
  }
  for (int i = 0; i < length; i++) {
    alp[s[i]-'a']++;
  }
  if (length != 26) {
    printf("%s", s);
    for (int i = 0; i < 26; i++) {
      if (alp[i] == 0) {
        printf("%c\n", i+'a');
        return 0;
      }
    }
  } else {
    int end = -1;
    for (int i = length-1; i > 0; i--) {
      alp[s[i]-'a']--;
      if (s[i] > s[i-1]) {
        end = i-1;
        for (int j = s[end]-'a'+1; j < 26; j++) {
          if (alp[j] == 0) {
            s[end] = j+'a';
            break;
          }
        }
        break;
      }
    }
    if (end == -1) {
      printf("-1\n");
      return 0;
    }
    for (int i = 0; i <= end; i++) {
      printf("%c", s[i]);
    }
    printf("\n");
  }

  return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%c\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rbp, %rdi
	subq	$160, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	112(%rsp), %r12
	movq	%rsp, %rbx
	movq	%r12, %rsi
	call	__isoc99_scanf@PLT
	movq	%r12, %rdi
	call	strlen@PLT
	movl	$13, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rsi
	xorl	%eax, %eax
	rep stosq
	testq	%rsi, %rsi
	je	.L2
	leal	-1(%rsi), %eax
	movq	%r12, %rdx
	leaq	113(%rsp,%rax), %rcx
	.p2align 4,,10
	.p2align 3
.L3:
	movsbl	(%rdx), %eax
	addq	$1, %rdx
	subl	$97, %eax
	cltq
	addl	$1, (%rsp,%rax,4)
	cmpq	%rdx, %rcx
	jne	.L3
.L2:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	addq	$1, %rax
	cmpq	$26, %rax
	je	.L5
.L6:
	movl	(%rbx,%rax,4), %ecx
	movl	%eax, %edx
	testl	%ecx, %ecx
	jne	.L4
	addl	$97, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L5:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$160, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L15:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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	"%s"
.LC1:
	.string	"%c\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rbp, %rdi
	subq	$160, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	112(%rsp), %r12
	movq	%rsp, %rbx
	movq	%r12, %rsi
	call	__isoc99_scanf@PLT
	movq	%r12, %rdi
	call	strlen@PLT
	movl	$13, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rsi
	xorl	%eax, %eax
	rep stosq
	testq	%rsi, %rsi
	je	.L2
	leal	-1(%rsi), %eax
	movq	%r12, %rdx
	leaq	113(%rsp,%rax), %rcx
	.p2align 4,,10
	.p2align 3
.L3:
	movsbl	(%rdx), %eax
	addq	$1, %rdx
	subl	$97, %eax
	cltq
	addl	$1, (%rsp,%rax,4)
	cmpq	%rdx, %rcx
	jne	.L3
.L2:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	addq	$1, %rax
	cmpq	$26, %rax
	je	.L5
.L6:
	movl	(%rbx,%rax,4), %ecx
	movl	%eax, %edx
	testl	%ecx, %ecx
	jne	.L4
	addl	$97, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L5:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$160, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L15:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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:
```