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 <math.h>
#define MAX 1000

int main()
{
  int a, d, n, i=0, j, k, sum, t=0, sosuucheck=0;
  int sosuu[MAX];

  while(t!=1)
    {
      scanf("%d %d %d",&a,&d,&n);

      if(n==0)
	t = 1;
      else
	{
	  sum = a;
	  i = 0;
	  while(i!=n)
	    {
	      if(sum==2)
		{
		  sosuucheck = 0;
		}
	      else if(sum==1)
		{
		  sosuucheck = 1;
		}
	      else
		{
		  if(sum%2==0)
		    {
		      sosuucheck = 1;
		    }
		  else
		    {
		      for(j=3;j<=sqrt(sum);j=j+2)
			{
			  if(sum%j==0)
			    {
			      sosuucheck = 1;
			    }
			}
		    }
		}

	      if(sosuucheck==0)
		{
		  sosuu[i] = sum;
		  i++;
		}
	      sosuucheck = 0;
	      sum = sum + d;
	    }
	  printf("%d\n",sosuu[n-1]);
	  /*
	  for(k=0;k<=MAX;k++)
	    {
	      sosuu[k] = 0;
	    }
	  */
	}
    }
  return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d\n"
.LC3:
	.string	"%d %d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	$1, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4072, %rsp
	.cfi_def_cfa_offset 4128
	movq	%fs:40, %rax
	movq	%rax, 4056(%rsp)
	xorl	%eax, %eax
	leaq	44(%rsp), %r14
	leaq	40(%rsp), %r13
	leaq	36(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	leaq	.LC3(%rip), %rdi
	movq	%r14, %rcx
	movq	%r13, %rdx
	movq	%r12, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %edi
	testl	%edi, %edi
	je	.L40
	movl	36(%rsp), %ebx
	movl	40(%rsp), %r9d
	xorl	%r15d, %r15d
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L3:
	cmpl	$1, %ebx
	je	.L4
	testb	$1, %bl
	jne	.L41
.L4:
	addl	%r9d, %ebx
	cmpl	%r15d, %edi
	je	.L42
.L13:
	cmpl	$2, %ebx
	jne	.L3
.L8:
	movslq	%r15d, %rax
	addl	$1, %r15d
	movl	%ebx, 48(%rsp,%rax,4)
.L43:
	addl	%r9d, %ebx
	cmpl	%r15d, %edi
	jne	.L13
.L42:
	subl	$1, %edi
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movslq	%edi, %rdi
	movl	48(%rsp,%rdi,4), %edx
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L41:
	pxor	%xmm1, %xmm1
	pxor	%xmm3, %xmm3
	cvtsi2sdl	%ebx, %xmm1
	ucomisd	%xmm1, %xmm3
	ja	.L35
	sqrtsd	%xmm1, %xmm1
	xorl	%esi, %esi
	movl	$3, %ecx
	comisd	.LC1(%rip), %xmm1
	jb	.L8
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%ebx, %eax
	pxor	%xmm0, %xmm0
	cltd
	idivl	%ecx
	testl	%edx, %edx
	cmove	%ebp, %esi
	addl	$2, %ecx
	cvtsi2sdl	%ecx, %xmm0
	comisd	%xmm0, %xmm1
	jnb	.L7
.L9:
	testl	%esi, %esi
	jne	.L4
	movslq	%r15d, %rax
	addl	$1, %r15d
	movl	%ebx, 48(%rsp,%rax,4)
	jmp	.L43
	.p2align 4,,10
	.p2align 3
.L40:
	movq	4056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L44
	addq	$4072, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L35:
	.cfi_restore_state
	xorl	%esi, %esi
	movl	$3, %ecx
	jmp	.L5
.L45:
	movl	%ebx, %eax
	movsd	8(%rsp), %xmm1
	cltd
	idivl	%ecx
	testl	%edx, %edx
	cmove	%ebp, %esi
	addl	$2, %ecx
.L5:
	movapd	%xmm1, %xmm0
	movl	%ecx, 28(%rsp)
	movl	%r9d, 24(%rsp)
	movl	%esi, 20(%rsp)
	movl	%edi, 16(%rsp)
	movsd	%xmm1, 8(%rsp)
	call	sqrt@PLT
	movl	28(%rsp), %ecx
	movl	16(%rsp), %edi
	movapd	%xmm0, %xmm2
	pxor	%xmm0, %xmm0
	movl	20(%rsp), %esi
	movl	24(%rsp), %r9d
	cvtsi2sdl	%ecx, %xmm0
	comisd	%xmm0, %xmm2
	jnb	.L45
	jmp	.L9
.L44:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1074266112
	.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
.LC2:
	.string	"%d\n"
.LC3:
	.string	"%d %d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	$1, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4072, %rsp
	.cfi_def_cfa_offset 4128
	movq	%fs:40, %rax
	movq	%rax, 4056(%rsp)
	xorl	%eax, %eax
	leaq	44(%rsp), %r14
	leaq	40(%rsp), %r13
	leaq	36(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	leaq	.LC3(%rip), %rdi
	movq	%r14, %rcx
	movq	%r13, %rdx
	movq	%r12, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %edi
	testl	%edi, %edi
	je	.L40
	movl	36(%rsp), %ebx
	movl	40(%rsp), %r9d
	xorl	%r15d, %r15d
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L3:
	cmpl	$1, %ebx
	je	.L4
	testb	$1, %bl
	jne	.L41
.L4:
	addl	%r9d, %ebx
	cmpl	%r15d, %edi
	je	.L42
.L13:
	cmpl	$2, %ebx
	jne	.L3
.L8:
	movslq	%r15d, %rax
	addl	$1, %r15d
	movl	%ebx, 48(%rsp,%rax,4)
.L43:
	addl	%r9d, %ebx
	cmpl	%r15d, %edi
	jne	.L13
.L42:
	subl	$1, %edi
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movslq	%edi, %rdi
	movl	48(%rsp,%rdi,4), %edx
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L41:
	pxor	%xmm1, %xmm1
	pxor	%xmm3, %xmm3
	cvtsi2sdl	%ebx, %xmm1
	ucomisd	%xmm1, %xmm3
	ja	.L35
	sqrtsd	%xmm1, %xmm1
	xorl	%esi, %esi
	movl	$3, %ecx
	comisd	.LC1(%rip), %xmm1
	jb	.L8
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%ebx, %eax
	pxor	%xmm0, %xmm0
	cltd
	idivl	%ecx
	testl	%edx, %edx
	cmove	%ebp, %esi
	addl	$2, %ecx
	cvtsi2sdl	%ecx, %xmm0
	comisd	%xmm0, %xmm1
	jnb	.L7
.L9:
	testl	%esi, %esi
	jne	.L4
	movslq	%r15d, %rax
	addl	$1, %r15d
	movl	%ebx, 48(%rsp,%rax,4)
	jmp	.L43
	.p2align 4,,10
	.p2align 3
.L40:
	movq	4056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L44
	addq	$4072, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L35:
	.cfi_restore_state
	xorl	%esi, %esi
	movl	$3, %ecx
	jmp	.L5
.L45:
	movl	%ebx, %eax
	movsd	8(%rsp), %xmm1
	cltd
	idivl	%ecx
	testl	%edx, %edx
	cmove	%ebp, %esi
	addl	$2, %ecx
.L5:
	movapd	%xmm1, %xmm0
	movl	%ecx, 28(%rsp)
	movl	%r9d, 24(%rsp)
	movl	%esi, 20(%rsp)
	movl	%edi, 16(%rsp)
	movsd	%xmm1, 8(%rsp)
	call	sqrt@PLT
	movl	28(%rsp), %ecx
	movl	16(%rsp), %edi
	movapd	%xmm0, %xmm2
	pxor	%xmm0, %xmm0
	movl	20(%rsp), %esi
	movl	24(%rsp), %r9d
	cvtsi2sdl	%ecx, %xmm0
	comisd	%xmm0, %xmm2
	jnb	.L45
	jmp	.L9
.L44:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1074266112
	.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
.LC2:
	.string	"%d\n"
.LC3:
	.string	"%d %d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	$1, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4072, %rsp
	.cfi_def_cfa_offset 4128
	movq	%fs:40, %rax
	movq	%rax, 4056(%rsp)
	xorl	%eax, %eax
	leaq	44(%rsp), %r14
	leaq	40(%rsp), %r13
	leaq	36(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	leaq	.LC3(%rip), %rdi
	movq	%r14, %rcx
	movq	%r13, %rdx
	movq	%r12, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %edi
	testl	%edi, %edi
	je	.L40
	movl	36(%rsp), %ebx
	movl	40(%rsp), %r9d
	xorl	%r15d, %r15d
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L3:
	cmpl	$1, %ebx
	je	.L4
	testb	$1, %bl
	jne	.L41
.L4:
	addl	%r9d, %ebx
	cmpl	%r15d, %edi
	je	.L42
.L13:
	cmpl	$2, %ebx
	jne	.L3
.L8:
	movslq	%r15d, %rax
	addl	$1, %r15d
	movl	%ebx, 48(%rsp,%rax,4)
.L43:
	addl	%r9d, %ebx
	cmpl	%r15d, %edi
	jne	.L13
.L42:
	subl	$1, %edi
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movslq	%edi, %rdi
	movl	48(%rsp,%rdi,4), %edx
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L41:
	pxor	%xmm1, %xmm1
	pxor	%xmm3, %xmm3
	cvtsi2sdl	%ebx, %xmm1
	ucomisd	%xmm1, %xmm3
	ja	.L35
	sqrtsd	%xmm1, %xmm1
	xorl	%esi, %esi
	movl	$3, %ecx
	comisd	.LC1(%rip), %xmm1
	jb	.L8
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%ebx, %eax
	pxor	%xmm0, %xmm0
	cltd
	idivl	%ecx
	testl	%edx, %edx
	cmove	%ebp, %esi
	addl	$2, %ecx
	cvtsi2sdl	%ecx, %xmm0
	comisd	%xmm0, %xmm1
	jnb	.L7
.L9:
	testl	%esi, %esi
	jne	.L4
	movslq	%r15d, %rax
	addl	$1, %r15d
	movl	%ebx, 48(%rsp,%rax,4)
	jmp	.L43
	.p2align 4,,10
	.p2align 3
.L40:
	movq	4056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L44
	addq	$4072, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L35:
	.cfi_restore_state
	xorl	%esi, %esi
	movl	$3, %ecx
	jmp	.L5
.L45:
	movl	%ebx, %eax
	movsd	8(%rsp), %xmm1
	cltd
	idivl	%ecx
	testl	%edx, %edx
	cmove	%ebp, %esi
	addl	$2, %ecx
.L5:
	movapd	%xmm1, %xmm0
	movl	%ecx, 28(%rsp)
	movl	%r9d, 24(%rsp)
	movl	%esi, 20(%rsp)
	movl	%edi, 16(%rsp)
	movsd	%xmm1, 8(%rsp)
	call	sqrt@PLT
	movl	28(%rsp), %ecx
	movl	16(%rsp), %edi
	movapd	%xmm0, %xmm2
	pxor	%xmm0, %xmm0
	movl	20(%rsp), %esi
	movl	24(%rsp), %r9d
	cvtsi2sdl	%ecx, %xmm0
	comisd	%xmm0, %xmm2
	jnb	.L45
	jmp	.L9
.L44:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1074266112
	.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 <math.h>
#define MAX 1000

int main()
{
  int a, d, n, i=0, j, k, sum, t=0, sosuucheck=0;
  int sosuu[MAX];

  while(t!=1)
    {
      scanf("%d %d %d",&a,&d,&n);

      if(n==0)
	t = 1;
      else
	{
	  sum = a;
	  i = 0;
	  while(i!=n)
	    {
	      if(sum==2)
		{
		  sosuucheck = 0;
		}
	      else if(sum==1)
		{
		  sosuucheck = 1;
		}
	      else
		{
		  if(sum%2==0)
		    {
		      sosuucheck = 1;
		    }
		  else
		    {
		      for(j=3;j<=sqrt(sum);j=j+2)
			{
			  if(sum%j==0)
			    {
			      sosuucheck = 1;
			    }
			}
		    }
		}

	      if(sosuucheck==0)
		{
		  sosuu[i] = sum;
		  i++;
		}
	      sosuucheck = 0;
	      sum = sum + d;
	    }
	  printf("%d\n",sosuu[n-1]);
	  /*
	  for(k=0;k<=MAX;k++)
	    {
	      sosuu[k] = 0;
	    }
	  */
	}
    }
  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 <math.h>
#define MAX 1000

int main()
{
  int a, d, n, i=0, j, k, sum, t=0, sosuucheck=0;
  int sosuu[MAX];

  while(t!=1)
    {
      scanf("%d %d %d",&a,&d,&n);

      if(n==0)
	t = 1;
      else
	{
	  sum = a;
	  i = 0;
	  while(i!=n)
	    {
	      if(sum==2)
		{
		  sosuucheck = 0;
		}
	      else if(sum==1)
		{
		  sosuucheck = 1;
		}
	      else
		{
		  if(sum%2==0)
		    {
		      sosuucheck = 1;
		    }
		  else
		    {
		      for(j=3;j<=sqrt(sum);j=j+2)
			{
			  if(sum%j==0)
			    {
			      sosuucheck = 1;
			    }
			}
		    }
		}

	      if(sosuucheck==0)
		{
		  sosuu[i] = sum;
		  i++;
		}
	      sosuucheck = 0;
	      sum = sum + d;
	    }
	  printf("%d\n",sosuu[n-1]);
	  /*
	  for(k=0;k<=MAX;k++)
	    {
	      sosuu[k] = 0;
	    }
	  */
	}
    }
  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:

367 186 151
179 10 203
271 37 39
103 230 1
27 104 185
253 87 85
1 1 1
9075 337 210
307 24 79
331 221 177
259 170 40
269 58 102
0 0 0
 367 186 151
179 10 203
271 37 39
103 230 1
27 104 185
253 87 85
1 1 1
9075 337 210
307 24 79
331 221 345
259 170 40
269 58 102
0 0 0
 367 186 151
179 10 203
271 37 39
103 230 1
27 104 185
253 87 85
1 1 1
9075 337 210
307 24 79
331 221 345
259 170 40
37 58 102
0 0 0
 367 186 151
179 10 203
271 37 39
103 230 1
27 104 185
253 50 85
1 1 1
9075 337 210
307 24 79
331 221 177
259 170 40
269 75 102
0 0 0
 367 186 151
179 10 203
271 37 39
103 230 1
27 104 185
253 87 85
1 1 1
10208 337 210
307 24 79
331 221 177
259 170 40
269 58 102
0 0 0
 367 186 151
179 10 203
271 37 39
103 230 1
27 104 185
253 87 85
1 1 1
9075 337 210
307 24 79
331 221 345
259 33 40
269 58 102
0 0 0
 367 186 151
179 10 203
271 37 39
103 230 1
27 104 185
253 87 85
1 1 1
9075 337 210
307 24 79
331 221 345
259 170 40
37 58 146
0 0 0
 367 186 151
179 10 203
271 37 39
103 230 1
19 104 185
253 87 85
1 1 1
10208 337 210
307 24 79
331 221 177
259 170 40
269 58 102
0 0 0
 367 186 151
179 10 203
271 37 39
103 230 1
27 104 185
253 145 85
1 1 1
9075 337 210
307 24 79
331 221 345
259 33 40
269 58 102
0 0 0
 367 186 151
179 10 203
271 37 39
73 230 1
19 104 185
253 87 85
1 1 1
10208 337 210
307 24 79
331 221 177
259 170 40
269 58 102
0 0 0

92809
6709
12037
103
93523
43579
2
899429
5107
412717
22699
25673
 92809
6709
12037
103
93523
43579
2
899429
5107
842341
22699
25673
 92809
6709
12037
103
93523
43579
2
899429
5107
842341
22699
24919
 92809
6709
12037
103
93523
14503
2
899429
5107
412717
22699
38669
 92809
6709
12037
103
93523
43579
2
925163
5107
412717
22699
25673
 92809
6709
12037
103
93523
43579
2
899429
5107
842341
6199
25673
 92809
6709
12037
103
93523
43579
2
899429
5107
842341
22699
36809
 92809
6709
12037
103
91019
43579
2
925163
5107
412717
22699
25673
 92809
6709
12037
103
93523
94793
2
899429
5107
842341
6199
25673
 92809
6709
12037
73
91019
43579
2
925163
5107
412717
22699
25673

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 <math.h>
#define MAX 1000

int main()
{
  int a, d, n, i=0, j, k, sum, t=0, sosuucheck=0;
  int sosuu[MAX];

  while(t!=1)
    {
      scanf("%d %d %d",&a,&d,&n);

      if(n==0)
	t = 1;
      else
	{
	  sum = a;
	  i = 0;
	  while(i!=n)
	    {
	      if(sum==2)
		{
		  sosuucheck = 0;
		}
	      else if(sum==1)
		{
		  sosuucheck = 1;
		}
	      else
		{
		  if(sum%2==0)
		    {
		      sosuucheck = 1;
		    }
		  else
		    {
		      for(j=3;j<=sqrt(sum);j=j+2)
			{
			  if(sum%j==0)
			    {
			      sosuucheck = 1;
			    }
			}
		    }
		}

	      if(sosuucheck==0)
		{
		  sosuu[i] = sum;
		  i++;
		}
	      sosuucheck = 0;
	      sum = sum + d;
	    }
	  printf("%d\n",sosuu[n-1]);
	  /*
	  for(k=0;k<=MAX;k++)
	    {
	      sosuu[k] = 0;
	    }
	  */
	}
    }
  return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d\n"
.LC3:
	.string	"%d %d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	$1, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4072, %rsp
	.cfi_def_cfa_offset 4128
	movq	%fs:40, %rax
	movq	%rax, 4056(%rsp)
	xorl	%eax, %eax
	leaq	44(%rsp), %r14
	leaq	40(%rsp), %r13
	leaq	36(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	leaq	.LC3(%rip), %rdi
	movq	%r14, %rcx
	movq	%r13, %rdx
	movq	%r12, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %edi
	testl	%edi, %edi
	je	.L40
	movl	36(%rsp), %ebx
	movl	40(%rsp), %r9d
	xorl	%r15d, %r15d
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L3:
	cmpl	$1, %ebx
	je	.L4
	testb	$1, %bl
	jne	.L41
.L4:
	addl	%r9d, %ebx
	cmpl	%r15d, %edi
	je	.L42
.L13:
	cmpl	$2, %ebx
	jne	.L3
.L8:
	movslq	%r15d, %rax
	addl	$1, %r15d
	movl	%ebx, 48(%rsp,%rax,4)
.L43:
	addl	%r9d, %ebx
	cmpl	%r15d, %edi
	jne	.L13
.L42:
	subl	$1, %edi
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movslq	%edi, %rdi
	movl	48(%rsp,%rdi,4), %edx
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L41:
	pxor	%xmm1, %xmm1
	pxor	%xmm3, %xmm3
	cvtsi2sdl	%ebx, %xmm1
	ucomisd	%xmm1, %xmm3
	ja	.L35
	sqrtsd	%xmm1, %xmm1
	xorl	%esi, %esi
	movl	$3, %ecx
	comisd	.LC1(%rip), %xmm1
	jb	.L8
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%ebx, %eax
	pxor	%xmm0, %xmm0
	cltd
	idivl	%ecx
	testl	%edx, %edx
	cmove	%ebp, %esi
	addl	$2, %ecx
	cvtsi2sdl	%ecx, %xmm0
	comisd	%xmm0, %xmm1
	jnb	.L7
.L9:
	testl	%esi, %esi
	jne	.L4
	movslq	%r15d, %rax
	addl	$1, %r15d
	movl	%ebx, 48(%rsp,%rax,4)
	jmp	.L43
	.p2align 4,,10
	.p2align 3
.L40:
	movq	4056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L44
	addq	$4072, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L35:
	.cfi_restore_state
	xorl	%esi, %esi
	movl	$3, %ecx
	jmp	.L5
.L45:
	movl	%ebx, %eax
	movsd	8(%rsp), %xmm1
	cltd
	idivl	%ecx
	testl	%edx, %edx
	cmove	%ebp, %esi
	addl	$2, %ecx
.L5:
	movapd	%xmm1, %xmm0
	movl	%ecx, 28(%rsp)
	movl	%r9d, 24(%rsp)
	movl	%esi, 20(%rsp)
	movl	%edi, 16(%rsp)
	movsd	%xmm1, 8(%rsp)
	call	sqrt@PLT
	movl	28(%rsp), %ecx
	movl	16(%rsp), %edi
	movapd	%xmm0, %xmm2
	pxor	%xmm0, %xmm0
	movl	20(%rsp), %esi
	movl	24(%rsp), %r9d
	cvtsi2sdl	%ecx, %xmm0
	comisd	%xmm0, %xmm2
	jnb	.L45
	jmp	.L9
.L44:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1074266112
	.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
.LC2:
	.string	"%d\n"
.LC3:
	.string	"%d %d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	$1, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4072, %rsp
	.cfi_def_cfa_offset 4128
	movq	%fs:40, %rax
	movq	%rax, 4056(%rsp)
	xorl	%eax, %eax
	leaq	44(%rsp), %r14
	leaq	40(%rsp), %r13
	leaq	36(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	leaq	.LC3(%rip), %rdi
	movq	%r14, %rcx
	movq	%r13, %rdx
	movq	%r12, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %edi
	testl	%edi, %edi
	je	.L40
	movl	36(%rsp), %ebx
	movl	40(%rsp), %r9d
	xorl	%r15d, %r15d
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L3:
	cmpl	$1, %ebx
	je	.L4
	testb	$1, %bl
	jne	.L41
.L4:
	addl	%r9d, %ebx
	cmpl	%r15d, %edi
	je	.L42
.L13:
	cmpl	$2, %ebx
	jne	.L3
.L8:
	movslq	%r15d, %rax
	addl	$1, %r15d
	movl	%ebx, 48(%rsp,%rax,4)
.L43:
	addl	%r9d, %ebx
	cmpl	%r15d, %edi
	jne	.L13
.L42:
	subl	$1, %edi
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movslq	%edi, %rdi
	movl	48(%rsp,%rdi,4), %edx
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L41:
	pxor	%xmm1, %xmm1
	pxor	%xmm3, %xmm3
	cvtsi2sdl	%ebx, %xmm1
	ucomisd	%xmm1, %xmm3
	ja	.L35
	sqrtsd	%xmm1, %xmm1
	xorl	%esi, %esi
	movl	$3, %ecx
	comisd	.LC1(%rip), %xmm1
	jb	.L8
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%ebx, %eax
	pxor	%xmm0, %xmm0
	cltd
	idivl	%ecx
	testl	%edx, %edx
	cmove	%ebp, %esi
	addl	$2, %ecx
	cvtsi2sdl	%ecx, %xmm0
	comisd	%xmm0, %xmm1
	jnb	.L7
.L9:
	testl	%esi, %esi
	jne	.L4
	movslq	%r15d, %rax
	addl	$1, %r15d
	movl	%ebx, 48(%rsp,%rax,4)
	jmp	.L43
	.p2align 4,,10
	.p2align 3
.L40:
	movq	4056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L44
	addq	$4072, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L35:
	.cfi_restore_state
	xorl	%esi, %esi
	movl	$3, %ecx
	jmp	.L5
.L45:
	movl	%ebx, %eax
	movsd	8(%rsp), %xmm1
	cltd
	idivl	%ecx
	testl	%edx, %edx
	cmove	%ebp, %esi
	addl	$2, %ecx
.L5:
	movapd	%xmm1, %xmm0
	movl	%ecx, 28(%rsp)
	movl	%r9d, 24(%rsp)
	movl	%esi, 20(%rsp)
	movl	%edi, 16(%rsp)
	movsd	%xmm1, 8(%rsp)
	call	sqrt@PLT
	movl	28(%rsp), %ecx
	movl	16(%rsp), %edi
	movapd	%xmm0, %xmm2
	pxor	%xmm0, %xmm0
	movl	20(%rsp), %esi
	movl	24(%rsp), %r9d
	cvtsi2sdl	%ecx, %xmm0
	comisd	%xmm0, %xmm2
	jnb	.L45
	jmp	.L9
.L44:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1074266112
	.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:
```