user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    D10(%rip),%rdi
  call   <printf@plt>
  mov    %rsp,%rsi
  lea    D33(%rip),%rdi
  call   <scanf@plt>
  mov    $0x1,%esi
  mov    (%rsp),%edi
  call   <calloc@plt>
  mov    %rax,%rbx
  mov    (%rsp),%edi
  call   <sqrt@plt>
  mov    %eax,%r13d
  test   %eax,%eax
  jle    L100
  lea    0x1(%rax),%r9d
  mov    $0x1,%edi
  movabs $0x22022020020000,%r12
  movabs $0x80080080080,%rbp
  movabs $0x800800000800800,%r14
  jmp    L167
L108:
  movslq %eax,%rdx
  add    %rbx,%rdx
  cmpb   $0x0,(%rdx)
  sete   (%rdx)
  jmp    L54
L137:
  bt     %rax,%r14
  jae    L125
  movslq %edx,%rdx
  add    %rbx,%rdx
  cmpb   $0x0,(%rdx)
  sete   (%rdx)
L125:
  add    $0x1,%ecx
  cmp    %r9d,%ecx
  je     L124
L120:
  mov    %ecx,%esi
  imul   %ecx,%esi
  lea    (%r10,%rsi,1),%eax
  cmp    %eax,(%rsp)
  jl     L54
  movslq %eax,%rdx
  imul   $0xffffffff88888889,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0x5,%edx
  mov    %eax,%r15d
  sar    $0x1f,%r15d
  sub    %r15d,%edx
  imul   $0x3c,%edx,%r15d
  mov    %eax,%edx
  sub    %r15d,%edx
  mov    %r12,%r15
  or     $0x2002,%r15
  bt     %rdx,%r15
  jb     L108
L54:
  sub    %r8d,%eax
  cmp    %eax,(%rsp)
  jl     L140
  movslq %eax,%rdx
  imul   $0xffffffff88888889,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0x5,%edx
  mov    %eax,%r15d
  sar    $0x1f,%r15d
  sub    %r15d,%edx
  imul   $0x3c,%edx,%edx
  mov    %eax,%r15d
  sub    %edx,%r15d
  bt     %r15,%rbp
  jae    L140
  cltq
  add    %rbx,%rax
  cmpb   $0x0,(%rax)
  sete   (%rax)
L140:
  cmp    %ecx,%edi
  jle    L125
  mov    %r11d,%edx
  sub    %esi,%edx
  cmp    %edx,(%rsp)
  jl     L125
  movslq %edx,%rax
  imul   $0xffffffff88888889,%rax,%rax
  shr    $0x20,%rax
  add    %edx,%eax
  sar    $0x5,%eax
  mov    %edx,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  imul   $0x3c,%eax,%esi
  mov    %edx,%eax
  sub    %esi,%eax
  cmp    $0x3b,%eax
  ja     L125
  jmp    L137
L124:
  add    $0x1,%edi
  cmp    %r9d,%edi
  je     L100
L167:
  mov    %edi,%r8d
  imul   %edi,%r8d
  lea    0x0(,%r8,4),%r10d
  lea    (%r8,%r8,2),%r11d
  mov    $0x1,%ecx
  jmp    L120
L100:
  movl   $0x5,0x4(%rsp)
  cmp    $0x4,%r13d
  jle    L277
  mov    $0x5,%eax
  jmp    L7
L70:
  mov    0x4(%rsp),%eax
  add    $0x1,%eax
  mov    %eax,0x4(%rsp)
  cmp    %r13d,%eax
  jg     L277
L7:
  cltq
  cmpb   $0x1,(%rbx,%rax,1)
  jne    L70
  mov    0x4(%rsp),%eax
  imul   %eax,%eax
  cmp    (%rsp),%eax
  jg     L70
  mov    $0x1,%edx
L213:
  cltq
  movb   $0x0,(%rbx,%rax,1)
  add    $0x1,%edx
  mov    0x4(%rsp),%ecx
  mov    %ecx,%eax
  imul   %edx,%eax
  imul   %ecx,%eax
  cmp    (%rsp),%eax
  jle    L213
  jmp    L70
L277:
  lea    D1(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x5,0x4(%rsp)
  cmpl   $0x4,(%rsp)
  jle    L53
  mov    $0x5,%esi
  lea    D5(%rip),%rbp
  jmp    L279
L161:
  mov    0x4(%rsp),%eax
  lea    0x1(%rax),%esi
  mov    %esi,0x4(%rsp)
  cmp    (%rsp),%esi
  jg     L53
L279:
  movslq %esi,%rax
  cmpb   $0x1,(%rbx,%rax,1)
  jne    L161
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L161
L53:
  lea    0x4(%rsp),%rsi
  lea    D33(%rip),%rdi
  call   <scanf@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L180
  mov    $0x0,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L180:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D10
datatype: string
name: disassemble_data
arguments: data_label: D33
datatype: string
name: disassemble_data
arguments: data_label: D1
datatype: string
name: disassemble_data
arguments: data_label: D5
datatype: string

tool: D10: Insert a number to which are primes are calculated here: 

tool: D33: %d

tool: D1: The following primes have been calculated:
2
3
5

tool: D5: 
%d

assistant: ```c
int main() {
  int limit;
  int wlimit;
  int i, j, k, x, y, z;
  unsigned char *sieb;
  printf("Insert a number to which are primes are calculated here: ");
  scanf("%d", &limit);
  sieb = (unsigned char *)calloc(limit, sizeof(unsigned char));
  wlimit = sqrt(limit);
  for (x = 1; x <= wlimit; x++) {
    for (y = 1; y <= wlimit; y++) {
      z = 4 * x * x + y * y;
      if (z <= limit && (z % 60 == 1 || z % 60 == 13 || z % 60 == 17 || z % 60 == 29 || z % 60 == 37 || z % 60 == 41 || z % 60 == 49 || z % 60 == 53)) {
        sieb[z] = !sieb[z];
      }
      z = 3 * x * x + y * y;
      if (z <= limit && (z % 60 == 7 || z % 60 == 19 || z % 60 == 31 || z % 60 == 43)) {
        sieb[z] = !sieb[z];
      }
      z = 3 * x * x - y * y;
      if (x > y && z <= limit && (z % 60 == 11 || z % 60 == 23 || z % 60 == 47 || z % 60 == 59)) {
        sieb[z] = !sieb[z];
      }
    }
  }
  for (i = 5; i <= wlimit; i++) {
    if (sieb[i] == 1) {
      for (j = 1; j * i * i <= limit; j++) {
        sieb[j * i * i] = 0;
      }
    }
  }
  printf("The following primes have been calculated:\n2\n3\n5");
  for (i = 5; i <= limit; i++) {
    if (sieb[i] == 1) {
      printf("\n%d", i);
    }
  }
  scanf("%d", &i);
  return 0;
}
```