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>
#define max_size (int)(1e5 + 1)

int max(int a, int b){
	return a >= b ? a : b;
}

int min(int a, int b){
	return a <= b ? a : b;
}

int main(){
	int i, a_num = 0, b_num = 0, c_num = 0;
	char *S = (char *)malloc(sizeof(char) * max_size);
	scanf("%s", S);
	for(i = 0; S[i] != '\0'; i++){
		if(S[i] == 'a'){
			a_num++;
		}
		if(S[i] == 'b'){
			b_num++;
		}
		if(S[i] == 'c'){
			c_num++;
		}
	}
	if(max(a_num, max(b_num, c_num)) - min(a_num, min(b_num, c_num)) <= 1){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB39:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	max, .-max
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB40:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"YES"
.LC2:
	.string	"NO"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	$100001, %edi
	call	malloc@PLT
	leaq	.LC0(%rip), %rdi
	movq	%rax, %rbx
	movq	%rax, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	(%rbx), %edx
	testb	%dl, %dl
	je	.L5
	leaq	1(%rbx), %rax
	xorl	%esi, %esi
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L6:
	cmpb	$98, %dl
	jne	.L8
	addl	$1, %ecx
.L7:
	movzbl	(%rax), %edx
	addq	$1, %rax
	testb	%dl, %dl
	je	.L17
.L9:
	cmpb	$97, %dl
	jne	.L6
	movzbl	(%rax), %edx
	addq	$1, %rax
	addl	$1, %edi
	testb	%dl, %dl
	jne	.L9
.L17:
	cmpl	%edi, %ecx
	movl	%edi, %eax
	cmovge	%ecx, %eax
	cmpl	%esi, %eax
	cmovl	%esi, %eax
	cmpl	%edi, %ecx
	cmovg	%edi, %ecx
	cmpl	%esi, %ecx
	cmovg	%esi, %ecx
	subl	%ecx, %eax
	cmpl	$1, %eax
	jle	.L5
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L11:
	xorl	%eax, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	cmpb	$99, %dl
	jne	.L7
	addl	$1, %esi
	jmp	.L7
.L5:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L11
	.cfi_endproc
.LFE41:
	.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:
.LFB39:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	max, .-max
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB40:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"YES"
.LC2:
	.string	"NO"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	$100001, %edi
	call	malloc@PLT
	leaq	.LC0(%rip), %rdi
	movq	%rax, %rbx
	movq	%rax, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	(%rbx), %edx
	testb	%dl, %dl
	je	.L5
	leaq	1(%rbx), %rax
	xorl	%esi, %esi
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L6:
	cmpb	$98, %dl
	jne	.L8
	addl	$1, %ecx
.L7:
	movzbl	(%rax), %edx
	addq	$1, %rax
	testb	%dl, %dl
	je	.L17
.L9:
	cmpb	$97, %dl
	jne	.L6
	movzbl	(%rax), %edx
	addq	$1, %rax
	addl	$1, %edi
	testb	%dl, %dl
	jne	.L9
.L17:
	cmpl	%edi, %ecx
	movl	%edi, %eax
	cmovge	%ecx, %eax
	cmpl	%esi, %eax
	cmovl	%esi, %eax
	cmpl	%edi, %ecx
	cmovg	%edi, %ecx
	cmpl	%esi, %ecx
	cmovg	%esi, %ecx
	subl	%ecx, %eax
	cmpl	$1, %eax
	jle	.L5
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L11:
	xorl	%eax, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	cmpb	$99, %dl
	jne	.L7
	addl	$1, %esi
	jmp	.L7
.L5:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L11
	.cfi_endproc
.LFE41:
	.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:
.LFB39:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	max, .-max
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB40:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"YES"
.LC2:
	.string	"NO"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	$100001, %edi
	call	malloc@PLT
	leaq	.LC0(%rip), %rdi
	movq	%rax, %rbx
	movq	%rax, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	(%rbx), %edx
	testb	%dl, %dl
	je	.L5
	leaq	1(%rbx), %rax
	xorl	%esi, %esi
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L6:
	cmpb	$98, %dl
	jne	.L8
	addl	$1, %ecx
.L7:
	movzbl	(%rax), %edx
	addq	$1, %rax
	testb	%dl, %dl
	je	.L17
.L9:
	cmpb	$97, %dl
	jne	.L6
	movzbl	(%rax), %edx
	addq	$1, %rax
	addl	$1, %edi
	testb	%dl, %dl
	jne	.L9
.L17:
	cmpl	%edi, %ecx
	movl	%edi, %eax
	cmovge	%ecx, %eax
	cmpl	%esi, %eax
	cmovl	%esi, %eax
	cmpl	%edi, %ecx
	cmovg	%edi, %ecx
	cmpl	%esi, %ecx
	cmovg	%esi, %ecx
	subl	%ecx, %eax
	cmpl	$1, %eax
	jle	.L5
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L11:
	xorl	%eax, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	cmpb	$99, %dl
	jne	.L7
	addl	$1, %esi
	jmp	.L7
.L5:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L11
	.cfi_endproc
.LFE41:
	.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>
#define max_size (int)(1e5 + 1)

int max(int a, int b){
	return a >= b ? a : b;
}

int min(int a, int b){
	return a <= b ? a : b;
}

int main(){
	int i, a_num = 0, b_num = 0, c_num = 0;
	char *S = (char *)malloc(sizeof(char) * max_size);
	scanf("%s", S);
	for(i = 0; S[i] != '\0'; i++){
		if(S[i] == 'a'){
			a_num++;
		}
		if(S[i] == 'b'){
			b_num++;
		}
		if(S[i] == 'c'){
			c_num++;
		}
	}
	if(max(a_num, max(b_num, c_num)) - min(a_num, min(b_num, c_num)) <= 1){
		printf("YES\n");
	}
	else{
		printf("NO\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 <stdlib.h>
#define max_size (int)(1e5 + 1)

int max(int a, int b){
	return a >= b ? a : b;
}

int min(int a, int b){
	return a <= b ? a : b;
}

int main(){
	int i, a_num = 0, b_num = 0, c_num = 0;
	char *S = (char *)malloc(sizeof(char) * max_size);
	scanf("%s", S);
	for(i = 0; S[i] != '\0'; i++){
		if(S[i] == 'a'){
			a_num++;
		}
		if(S[i] == 'b'){
			b_num++;
		}
		if(S[i] == 'c'){
			c_num++;
		}
	}
	if(max(a_num, max(b_num, c_num)) - min(a_num, min(b_num, c_num)) <= 1){
		printf("YES\n");
	}
	else{
		printf("NO\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:

acac
 bacaccbabab
 ccaa
 bacaacbcbab
 babcbcaacab
 bababccacab
 bacaccbabac
 bacaccbaaac
 caaabccacab
 caaaaccacab

NO
 YES
 NO
 YES
 YES
 YES
 YES
 NO
 NO
 NO

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>
#define max_size (int)(1e5 + 1)

int max(int a, int b){
	return a >= b ? a : b;
}

int min(int a, int b){
	return a <= b ? a : b;
}

int main(){
	int i, a_num = 0, b_num = 0, c_num = 0;
	char *S = (char *)malloc(sizeof(char) * max_size);
	scanf("%s", S);
	for(i = 0; S[i] != '\0'; i++){
		if(S[i] == 'a'){
			a_num++;
		}
		if(S[i] == 'b'){
			b_num++;
		}
		if(S[i] == 'c'){
			c_num++;
		}
	}
	if(max(a_num, max(b_num, c_num)) - min(a_num, min(b_num, c_num)) <= 1){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB39:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	max, .-max
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB40:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"YES"
.LC2:
	.string	"NO"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	$100001, %edi
	call	malloc@PLT
	leaq	.LC0(%rip), %rdi
	movq	%rax, %rbx
	movq	%rax, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	(%rbx), %edx
	testb	%dl, %dl
	je	.L5
	leaq	1(%rbx), %rax
	xorl	%esi, %esi
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L6:
	cmpb	$98, %dl
	jne	.L8
	addl	$1, %ecx
.L7:
	movzbl	(%rax), %edx
	addq	$1, %rax
	testb	%dl, %dl
	je	.L17
.L9:
	cmpb	$97, %dl
	jne	.L6
	movzbl	(%rax), %edx
	addq	$1, %rax
	addl	$1, %edi
	testb	%dl, %dl
	jne	.L9
.L17:
	cmpl	%edi, %ecx
	movl	%edi, %eax
	cmovge	%ecx, %eax
	cmpl	%esi, %eax
	cmovl	%esi, %eax
	cmpl	%edi, %ecx
	cmovg	%edi, %ecx
	cmpl	%esi, %ecx
	cmovg	%esi, %ecx
	subl	%ecx, %eax
	cmpl	$1, %eax
	jle	.L5
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L11:
	xorl	%eax, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	cmpb	$99, %dl
	jne	.L7
	addl	$1, %esi
	jmp	.L7
.L5:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L11
	.cfi_endproc
.LFE41:
	.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:
.LFB39:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	max, .-max
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB40:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"YES"
.LC2:
	.string	"NO"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	$100001, %edi
	call	malloc@PLT
	leaq	.LC0(%rip), %rdi
	movq	%rax, %rbx
	movq	%rax, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	(%rbx), %edx
	testb	%dl, %dl
	je	.L5
	leaq	1(%rbx), %rax
	xorl	%esi, %esi
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L6:
	cmpb	$98, %dl
	jne	.L8
	addl	$1, %ecx
.L7:
	movzbl	(%rax), %edx
	addq	$1, %rax
	testb	%dl, %dl
	je	.L17
.L9:
	cmpb	$97, %dl
	jne	.L6
	movzbl	(%rax), %edx
	addq	$1, %rax
	addl	$1, %edi
	testb	%dl, %dl
	jne	.L9
.L17:
	cmpl	%edi, %ecx
	movl	%edi, %eax
	cmovge	%ecx, %eax
	cmpl	%esi, %eax
	cmovl	%esi, %eax
	cmpl	%edi, %ecx
	cmovg	%edi, %ecx
	cmpl	%esi, %ecx
	cmovg	%esi, %ecx
	subl	%ecx, %eax
	cmpl	$1, %eax
	jle	.L5
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L11:
	xorl	%eax, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	cmpb	$99, %dl
	jne	.L7
	addl	$1, %esi
	jmp	.L7
.L5:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L11
	.cfi_endproc
.LFE41:
	.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:
```