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>
int main()
{
    int K,i;
    scanf("%d",&K);
    char S[100000],l[10000];
    scanf("%s",&S);
    int length;
    length=strlen(S);

    if(length>K)
    {

        for(i=0; i<K; i++)
        {

            l[i]=S[i];
        }
          printf("%s...",l);


    }

    else
    {
         for(i=0; i<K; i++)
        {

            l[i]=S[i];

        }
        printf("%s",l);

    }


    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%s..."
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-106496(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3536, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-110028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-100016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-100016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -110020(%rbp)
	movl	-110028(%rbp), %eax
	cmpl	%eax, -110020(%rbp)
	jle	.L2
	movl	$0, -110024(%rbp)
	jmp	.L3
.L4:
	movl	-110024(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %edx
	movl	-110024(%rbp), %eax
	cltq
	movb	%dl, -110016(%rbp,%rax)
	addl	$1, -110024(%rbp)
.L3:
	movl	-110028(%rbp), %eax
	cmpl	%eax, -110024(%rbp)
	jl	.L4
	leaq	-110016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L5
.L2:
	movl	$0, -110024(%rbp)
	jmp	.L6
.L7:
	movl	-110024(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %edx
	movl	-110024(%rbp), %eax
	cltq
	movb	%dl, -110016(%rbp,%rax)
	addl	$1, -110024(%rbp)
.L6:
	movl	-110028(%rbp), %eax
	cmpl	%eax, -110024(%rbp)
	jl	.L7
	leaq	-110016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L5:
	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
.LFE0:
	.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	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%s..."
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	-106496(%rsp), %r11
	.cfi_def_cfa 11, 106520
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3544, %rsp
	.cfi_def_cfa_offset 110064
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 110024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	10016(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	movslq	12(%rsp), %rdx
	leaq	16(%rsp), %r8
	cmpl	%eax, %edx
	jl	.L2
	testl	%edx, %edx
	je	.L4
	movq	%r8, %rdi
	movq	%rbp, %rsi
	call	memcpy@PLT
	movq	%rax, %r8
.L4:
	movq	%r8, %rdx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L6:
	movq	110024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$110040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	testl	%edx, %edx
	jle	.L5
	movq	%r8, %rdi
	movq	%rbp, %rsi
	call	memcpy@PLT
	movq	%rax, %r8
.L5:
	movq	%r8, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L6
.L12:
	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
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%s..."
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	-106496(%rsp), %r11
	.cfi_def_cfa 11, 106520
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3544, %rsp
	.cfi_def_cfa_offset 110064
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 110024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	10016(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	movslq	12(%rsp), %rdx
	leaq	16(%rsp), %r8
	cmpl	%eax, %edx
	jl	.L2
	testl	%edx, %edx
	je	.L4
	movq	%r8, %rdi
	movq	%rbp, %rsi
	call	memcpy@PLT
	movq	%rax, %r8
.L4:
	movq	%r8, %rdx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L6:
	movq	110024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$110040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	testl	%edx, %edx
	jle	.L5
	movq	%r8, %rdi
	movq	%rbp, %rsi
	call	memcpy@PLT
	movq	%rax, %r8
.L5:
	movq	%r8, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L6
.L12:
	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:

#include<stdio.h>
int main()
{
    int K,i;
    scanf("%d",&K);
    char S[100000],l[10000];
    scanf("%s",&S);
    int length;
    length=strlen(S);

    if(length>K)
    {

        for(i=0; i<K; i++)
        {

            l[i]=S[i];
        }
          printf("%s...",l);


    }

    else
    {
         for(i=0; i<K; i++)
        {

            l[i]=S[i];

        }
        printf("%s",l);

    }


    return 0;
}

7
ecitslosdnaokin
 40
ferelibenterhominesidquodvomuntcredunt
 7
nikoandrolstice
 40
ferelibenterhominesidquodvonuntcredunt
 7
oikoandrolstice
 40
ferelibenterhominesidquodvonuntcreudnt
 40
ferelhbenterhominesidquodvonuntcreudnt
 7
oikoancrolstice
 40
tnduerctnunovdouqdisenimohretnebhleref
 40
tndueretnunovdouqdisenimohretnebhlcref

ecitslo... ferelibenterhominesidquodvomuntcredunt nikoand... ferelibenterhominesidquodvonuntcredunt oikoand... ferelibenterhominesidquodvonuntcreudnt ferelhbenterhominesidquodvonuntcreudnt oikoanc... tnduerctnunovdouqdisenimohretnebhleref tndueretnunovdouqdisenimohretnebhlcref
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>
int main()
{
    int K,i;
    scanf("%d",&K);
    char S[100000],l[10000];
    scanf("%s",&S);
    int length;
    length=strlen(S);

    if(length>K)
    {

        for(i=0; i<K; i++)
        {

            l[i]=S[i];
        }
          printf("%s...",l);


    }

    else
    {
         for(i=0; i<K; i++)
        {

            l[i]=S[i];

        }
        printf("%s",l);

    }


    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%s..."
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-106496(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3536, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-110028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-100016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-100016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -110020(%rbp)
	movl	-110028(%rbp), %eax
	cmpl	%eax, -110020(%rbp)
	jle	.L2
	movl	$0, -110024(%rbp)
	jmp	.L3
.L4:
	movl	-110024(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %edx
	movl	-110024(%rbp), %eax
	cltq
	movb	%dl, -110016(%rbp,%rax)
	addl	$1, -110024(%rbp)
.L3:
	movl	-110028(%rbp), %eax
	cmpl	%eax, -110024(%rbp)
	jl	.L4
	leaq	-110016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L5
.L2:
	movl	$0, -110024(%rbp)
	jmp	.L6
.L7:
	movl	-110024(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %edx
	movl	-110024(%rbp), %eax
	cltq
	movb	%dl, -110016(%rbp,%rax)
	addl	$1, -110024(%rbp)
.L6:
	movl	-110028(%rbp), %eax
	cmpl	%eax, -110024(%rbp)
	jl	.L7
	leaq	-110016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L5:
	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
.LFE0:
	.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
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%s..."
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-106496(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3536, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-110028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-100016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-100016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -110020(%rbp)
	movl	-110028(%rbp), %eax
	cmpl	%eax, -110020(%rbp)
	jle	.L2
	movl	$0, -110024(%rbp)
	jmp	.L3
.L4:
	movl	-110024(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %edx
	movl	-110024(%rbp), %eax
	cltq
	movb	%dl, -110016(%rbp,%rax)
	addl	$1, -110024(%rbp)
.L3:
	movl	-110028(%rbp), %eax
	cmpl	%eax, -110024(%rbp)
	jl	.L4
	leaq	-110016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L5
.L2:
	movl	$0, -110024(%rbp)
	jmp	.L6
.L7:
	movl	-110024(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %edx
	movl	-110024(%rbp), %eax
	cltq
	movb	%dl, -110016(%rbp,%rax)
	addl	$1, -110024(%rbp)
.L6:
	movl	-110028(%rbp), %eax
	cmpl	%eax, -110024(%rbp)
	jl	.L7
	leaq	-110016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L5:
	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
.LFE0:
	.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:
