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>
int a[1000001];
int main(){
    int K;
    scanf("%d",&K);
    a[1]=7%K;
    for(int i=2;i<=K;i++)a[i]=(a[i-1]*10+7)%K;
 
    for(int i=1;i<=K;i++)if(a[i]==0){
        printf("%d\n",i);
        return 0;
    }
    printf("-1\n");
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"-1"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	$7, %eax
	movl	4(%rsp), %esi
	cltd
	idivl	%esi
	movl	%edx, 4+a(%rip)
	cmpl	$1, %esi
	jle	.L2
	leaq	8+a(%rip), %rcx
	leal	-2(%rsi), %eax
	leaq	4(%rcx), %rdi
	leaq	(%rdi,%rax,4), %rdi
	.p2align 4,,10
	.p2align 3
.L3:
	leal	(%rdx,%rdx,4), %eax
	addq	$4, %rcx
	leal	7(%rax,%rax), %eax
	cltd
	idivl	%esi
	movl	%edx, -4(%rcx)
	cmpq	%rdi, %rcx
	jne	.L3
.L5:
	movl	$1, %eax
	leaq	a(%rip), %rdx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$1, %rax
	cmpl	%eax, %esi
	jl	.L6
.L4:
	movl	(%rdx,%rax,4), %ecx
	testl	%ecx, %ecx
	jne	.L7
	movl	%eax, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L2:
	je	.L5
.L6:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L8:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L17:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 4000004
a:
	.zero	4000004
	.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	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"-1"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	$7, %eax
	movl	4(%rsp), %esi
	cltd
	idivl	%esi
	movl	%edx, 4+a(%rip)
	cmpl	$1, %esi
	jle	.L2
	leaq	8+a(%rip), %rcx
	leal	-2(%rsi), %eax
	leaq	4(%rcx), %rdi
	leaq	(%rdi,%rax,4), %rdi
	.p2align 4,,10
	.p2align 3
.L3:
	leal	(%rdx,%rdx,4), %eax
	addq	$4, %rcx
	leal	7(%rax,%rax), %eax
	cltd
	idivl	%esi
	movl	%edx, -4(%rcx)
	cmpq	%rdi, %rcx
	jne	.L3
.L5:
	movl	$1, %eax
	leaq	a(%rip), %rdx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$1, %rax
	cmpl	%eax, %esi
	jl	.L6
.L4:
	movl	(%rdx,%rax,4), %ecx
	testl	%ecx, %ecx
	jne	.L7
	movl	%eax, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L2:
	je	.L5
.L6:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L8:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L17:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 4000004
a:
	.zero	4000004
	.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	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"-1"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	$7, %eax
	movl	4(%rsp), %esi
	cltd
	idivl	%esi
	movl	%edx, 4+a(%rip)
	cmpl	$1, %esi
	jle	.L2
	leaq	8+a(%rip), %rcx
	leal	-2(%rsi), %eax
	leaq	4(%rcx), %rdi
	leaq	(%rdi,%rax,4), %rdi
	.p2align 4,,10
	.p2align 3
.L3:
	leal	(%rdx,%rdx,4), %eax
	addq	$4, %rcx
	leal	7(%rax,%rax), %eax
	cltd
	idivl	%esi
	movl	%edx, -4(%rcx)
	cmpq	%rdi, %rcx
	jne	.L3
.L5:
	movl	$1, %eax
	leaq	a(%rip), %rdx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$1, %rax
	cmpl	%eax, %esi
	jl	.L6
.L4:
	movl	(%rdx,%rax,4), %ecx
	testl	%ecx, %ecx
	jne	.L7
	movl	%eax, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L2:
	je	.L5
.L6:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L8:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L17:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 4000004
a:
	.zero	4000004
	.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>
int a[1000001];
int main(){
    int K;
    scanf("%d",&K);
    a[1]=7%K;
    for(int i=2;i<=K;i++)a[i]=(a[i-1]*10+7)%K;
 
    for(int i=1;i<=K;i++)if(a[i]==0){
        printf("%d\n",i);
        return 0;
    }
    printf("-1\n");
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
int a[1000001];
int main(){
    int K;
    scanf("%d",&K);
    a[1]=7%K;
    for(int i=2;i<=K;i++)a[i]=(a[i-1]*10+7)%K;
 
    for(int i=1;i<=K;i++)if(a[i]==0){
        printf("%d\n",i);
        return 0;
    }
    printf("-1\n");
}```

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:

3

3

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>
int a[1000001];
int main(){
    int K;
    scanf("%d",&K);
    a[1]=7%K;
    for(int i=2;i<=K;i++)a[i]=(a[i-1]*10+7)%K;
 
    for(int i=1;i<=K;i++)if(a[i]==0){
        printf("%d\n",i);
        return 0;
    }
    printf("-1\n");
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"-1"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	$7, %eax
	movl	4(%rsp), %esi
	cltd
	idivl	%esi
	movl	%edx, 4+a(%rip)
	cmpl	$1, %esi
	jle	.L2
	leaq	8+a(%rip), %rcx
	leal	-2(%rsi), %eax
	leaq	4(%rcx), %rdi
	leaq	(%rdi,%rax,4), %rdi
	.p2align 4,,10
	.p2align 3
.L3:
	leal	(%rdx,%rdx,4), %eax
	addq	$4, %rcx
	leal	7(%rax,%rax), %eax
	cltd
	idivl	%esi
	movl	%edx, -4(%rcx)
	cmpq	%rdi, %rcx
	jne	.L3
.L5:
	movl	$1, %eax
	leaq	a(%rip), %rdx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$1, %rax
	cmpl	%eax, %esi
	jl	.L6
.L4:
	movl	(%rdx,%rax,4), %ecx
	testl	%ecx, %ecx
	jne	.L7
	movl	%eax, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L2:
	je	.L5
.L6:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L8:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L17:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 4000004
a:
	.zero	4000004
	.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	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"-1"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	$7, %eax
	movl	4(%rsp), %esi
	cltd
	idivl	%esi
	movl	%edx, 4+a(%rip)
	cmpl	$1, %esi
	jle	.L2
	leaq	8+a(%rip), %rcx
	leal	-2(%rsi), %eax
	leaq	4(%rcx), %rdi
	leaq	(%rdi,%rax,4), %rdi
	.p2align 4,,10
	.p2align 3
.L3:
	leal	(%rdx,%rdx,4), %eax
	addq	$4, %rcx
	leal	7(%rax,%rax), %eax
	cltd
	idivl	%esi
	movl	%edx, -4(%rcx)
	cmpq	%rdi, %rcx
	jne	.L3
.L5:
	movl	$1, %eax
	leaq	a(%rip), %rdx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$1, %rax
	cmpl	%eax, %esi
	jl	.L6
.L4:
	movl	(%rdx,%rax,4), %ecx
	testl	%ecx, %ecx
	jne	.L7
	movl	%eax, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L2:
	je	.L5
.L6:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L8:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L17:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 4000004
a:
	.zero	4000004
	.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:
```