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 max(int a,int b){
  if(a > b){
    return a;
  }
  return b;
}

int min(int a,int b){
  if(a < b){
    return a;
  }
  return b;
}

int main(void){
  char S[100000];
  scanf("%s",S);

  char past = S[0];
  int ans = 0;
  int cnt = 0;
  for(int i = 1;i < strlen(S);i++){
    if(past != S[i]){
      ans = max(ans,min(i,strlen(S)-i+cnt));
      cnt = 1;
    }else{
      cnt++;
    }
    past = S[i];
  }

  if(ans == 0) ans = strlen(S);
  ans = max(ans,cnt);
  printf("%d\n",ans);

  return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB35:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE35:
	.size	max, .-max
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB36:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE36:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB37:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	-98304(%rsp), %r11
	.cfi_def_cfa 11, 98328
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1720, %rsp
	.cfi_def_cfa_offset 100048
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 100008(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	movzbl	(%rsp), %ebx
	call	strlen@PLT
	cmpq	$1, %rax
	jbe	.L11
	movl	%eax, %r8d
	movl	$1, %esi
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L15:
	addl	%r8d, %ecx
	subl	%esi, %ecx
	cmpl	%esi, %ecx
	cmovg	%esi, %ecx
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
	addq	$1, %rsi
	movl	$1, %ecx
	cmpq	%rsi, %rax
	je	.L14
.L8:
	movl	%ebx, %edi
	movzbl	0(%rbp,%rsi), %ebx
	cmpb	%bl, %dil
	jne	.L15
	addq	$1, %rsi
	addl	$1, %ecx
	cmpq	%rsi, %rax
	jne	.L8
.L14:
	testl	%edx, %edx
	je	.L5
.L9:
	cmpl	%ecx, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	cmovl	%ecx, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	100008(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$100024, %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
.L11:
	.cfi_restore_state
	xorl	%ecx, %ecx
.L5:
	movl	%eax, %edx
	jmp	.L9
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE37:
	.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
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB35:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE35:
	.size	max, .-max
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB36:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE36:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB37:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	-98304(%rsp), %r11
	.cfi_def_cfa 11, 98328
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1720, %rsp
	.cfi_def_cfa_offset 100048
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 100008(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	movzbl	(%rsp), %ebx
	call	strlen@PLT
	cmpq	$1, %rax
	jbe	.L11
	movl	%eax, %r8d
	movl	$1, %esi
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L15:
	addl	%r8d, %ecx
	subl	%esi, %ecx
	cmpl	%esi, %ecx
	cmovg	%esi, %ecx
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
	addq	$1, %rsi
	movl	$1, %ecx
	cmpq	%rsi, %rax
	je	.L14
.L8:
	movl	%ebx, %edi
	movzbl	0(%rbp,%rsi), %ebx
	cmpb	%bl, %dil
	jne	.L15
	addq	$1, %rsi
	addl	$1, %ecx
	cmpq	%rsi, %rax
	jne	.L8
.L14:
	testl	%edx, %edx
	je	.L5
.L9:
	cmpl	%ecx, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	cmovl	%ecx, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	100008(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$100024, %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
.L11:
	.cfi_restore_state
	xorl	%ecx, %ecx
.L5:
	movl	%eax, %edx
	jmp	.L9
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE37:
	.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
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB35:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE35:
	.size	max, .-max
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB36:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE36:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB37:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	-98304(%rsp), %r11
	.cfi_def_cfa 11, 98328
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1720, %rsp
	.cfi_def_cfa_offset 100048
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 100008(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	movzbl	(%rsp), %ebx
	call	strlen@PLT
	cmpq	$1, %rax
	jbe	.L11
	movl	%eax, %r8d
	movl	$1, %esi
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L15:
	addl	%r8d, %ecx
	subl	%esi, %ecx
	cmpl	%esi, %ecx
	cmovg	%esi, %ecx
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
	addq	$1, %rsi
	movl	$1, %ecx
	cmpq	%rsi, %rax
	je	.L14
.L8:
	movl	%ebx, %edi
	movzbl	0(%rbp,%rsi), %ebx
	cmpb	%bl, %dil
	jne	.L15
	addq	$1, %rsi
	addl	$1, %ecx
	cmpq	%rsi, %rax
	jne	.L8
.L14:
	testl	%edx, %edx
	je	.L5
.L9:
	cmpl	%ecx, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	cmovl	%ecx, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	100008(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$100024, %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
.L11:
	.cfi_restore_state
	xorl	%ecx, %ecx
.L5:
	movl	%eax, %edx
	jmp	.L9
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE37:
	.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 max(int a,int b){
  if(a > b){
    return a;
  }
  return b;
}

int min(int a,int b){
  if(a < b){
    return a;
  }
  return b;
}

int main(void){
  char S[100000];
  scanf("%s",S);

  char past = S[0];
  int ans = 0;
  int cnt = 0;
  for(int i = 1;i < strlen(S);i++){
    if(past != S[i]){
      ans = max(ans,min(i,strlen(S)-i+cnt));
      cnt = 1;
    }else{
      cnt++;
    }
    past = S[i];
  }

  if(ans == 0) ans = strlen(S);
  ans = max(ans,cnt);
  printf("%d\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 <string.h>

int max(int a,int b){
  if(a > b){
    return a;
  }
  return b;
}

int min(int a,int b){
  if(a < b){
    return a;
  }
  return b;
}

int main(void){
  char S[100000];
  scanf("%s",S);

  char past = S[0];
  int ans = 0;
  int cnt = 0;
  for(int i = 1;i < strlen(S);i++){
    if(past != S[i]){
      ans = max(ans,min(i,strlen(S)-i+cnt));
      cnt = 1;
    }else{
      cnt++;
    }
    past = S[i];
  }

  if(ans == 0) ans = strlen(S);
  ans = max(ans,cnt);
  printf("%d\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:

010

2

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 max(int a,int b){
  if(a > b){
    return a;
  }
  return b;
}

int min(int a,int b){
  if(a < b){
    return a;
  }
  return b;
}

int main(void){
  char S[100000];
  scanf("%s",S);

  char past = S[0];
  int ans = 0;
  int cnt = 0;
  for(int i = 1;i < strlen(S);i++){
    if(past != S[i]){
      ans = max(ans,min(i,strlen(S)-i+cnt));
      cnt = 1;
    }else{
      cnt++;
    }
    past = S[i];
  }

  if(ans == 0) ans = strlen(S);
  ans = max(ans,cnt);
  printf("%d\n",ans);

  return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB35:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE35:
	.size	max, .-max
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB36:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE36:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB37:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	-98304(%rsp), %r11
	.cfi_def_cfa 11, 98328
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1720, %rsp
	.cfi_def_cfa_offset 100048
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 100008(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	movzbl	(%rsp), %ebx
	call	strlen@PLT
	cmpq	$1, %rax
	jbe	.L11
	movl	%eax, %r8d
	movl	$1, %esi
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L15:
	addl	%r8d, %ecx
	subl	%esi, %ecx
	cmpl	%esi, %ecx
	cmovg	%esi, %ecx
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
	addq	$1, %rsi
	movl	$1, %ecx
	cmpq	%rsi, %rax
	je	.L14
.L8:
	movl	%ebx, %edi
	movzbl	0(%rbp,%rsi), %ebx
	cmpb	%bl, %dil
	jne	.L15
	addq	$1, %rsi
	addl	$1, %ecx
	cmpq	%rsi, %rax
	jne	.L8
.L14:
	testl	%edx, %edx
	je	.L5
.L9:
	cmpl	%ecx, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	cmovl	%ecx, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	100008(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$100024, %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
.L11:
	.cfi_restore_state
	xorl	%ecx, %ecx
.L5:
	movl	%eax, %edx
	jmp	.L9
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE37:
	.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
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB35:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE35:
	.size	max, .-max
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB36:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE36:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB37:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	-98304(%rsp), %r11
	.cfi_def_cfa 11, 98328
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1720, %rsp
	.cfi_def_cfa_offset 100048
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 100008(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	movzbl	(%rsp), %ebx
	call	strlen@PLT
	cmpq	$1, %rax
	jbe	.L11
	movl	%eax, %r8d
	movl	$1, %esi
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L15:
	addl	%r8d, %ecx
	subl	%esi, %ecx
	cmpl	%esi, %ecx
	cmovg	%esi, %ecx
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
	addq	$1, %rsi
	movl	$1, %ecx
	cmpq	%rsi, %rax
	je	.L14
.L8:
	movl	%ebx, %edi
	movzbl	0(%rbp,%rsi), %ebx
	cmpb	%bl, %dil
	jne	.L15
	addq	$1, %rsi
	addl	$1, %ecx
	cmpq	%rsi, %rax
	jne	.L8
.L14:
	testl	%edx, %edx
	je	.L5
.L9:
	cmpl	%ecx, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	cmovl	%ecx, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	100008(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$100024, %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
.L11:
	.cfi_restore_state
	xorl	%ecx, %ecx
.L5:
	movl	%eax, %edx
	jmp	.L9
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE37:
	.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:
```