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
  lea    -0x4000(%rsp),%r11
L378:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L378
  sub    $0xe58,%rsp
  lea    D35(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x4e48(%rsp)
  xor    %eax,%eax
  lea    0x1c(%rsp),%rsi
  call   <scanf@plt>
  mov    0x1c(%rsp),%eax
  test   %eax,%eax
  jle    L142
  xor    %r12d,%r12d
  lea    0x1b(%rsp),%rbp
  lea    0x20(%rsp),%r13
  lea    D18(%rip),%rbx
  jmp    L387
  nopl   0x0(%rax)
L280:
  cmp    $0xa,%al
  jne    L47
L387:
  xor    %eax,%eax
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <scanf@plt>
  test   %rax,%rax
  movsbl 0x1b(%rsp),%eax
  jne    L280
L47:
  sub    $0x30,%eax
  mov    0x1c(%rsp),%edi
  mov    %eax,0x0(%r13,%r12,4)
  add    $0x1,%r12
  cmp    %r12d,%edi
  jg     L387
  test   %edi,%edi
  jle    L142
  xor    %esi,%esi
  mov    $0x1,%r9d
  xor    %r13d,%r13d
  nopl   0x0(%rax,%rax,1)
L328:
  movslq %esi,%rax
  lea    0x1(%rsi),%edx
  mov    $0x1,%ecx
  mov    0x20(%rsp,%rax,4),%r8d
  movslq %edx,%rax
  cmp    0x20(%rsp,%rax,4),%r8d
  je     L88
  jmp    L94
  nop
L149:
  cmp    %esi,%edx
  je     L298
L88:
  lea    0x1(%rdx),%eax
  add    $0x1,%ecx
  cltd
  idiv   %edi
  movslq %edx,%rax
  cmp    %r8d,0x20(%rsp,%rax,4)
  je     L149
L298:
  cmp    %r9d,%ecx
  jl     L60
  jle    L155
  mov    %ecx,%r9d
  mov    $0x1,%r13d
  xor    %eax,%eax
L213:
  mov    %esi,0x2f00(%rsp,%rax,8)
L60:
  add    %ecx,%esi
  cmp    %esi,%edi
  jg     L328
  test   %r13d,%r13d
  je     L229
  lea    -0x1(%r13),%eax
  cmp    $0x2,%eax
  jbe    L233
  mov    %r13d,%edx
  lea    0xfc0(%rsp),%rbx
  movdqa D0(%rip),%xmm0
  movdqa D45(%rip),%xmm2
  shr    $0x2,%edx
  mov    %rbx,%rax
  sub    $0x1,%edx
  shl    $0x4,%rdx
  lea    0xfd0(%rsp,%rdx,1),%rdx
L358:
  movdqa %xmm0,%xmm1
  add    $0x10,%rax
  paddd  %xmm2,%xmm0
  movaps %xmm1,-0x10(%rax)
  cmp    %rax,%rdx
  jne    L358
  mov    %r13d,%eax
  and    $0xfffffffc,%eax
  test   $0x3,%r13b
  je     L81
L283:
  movslq %eax,%rdx
  lea    0x1(%rax),%ecx
  shl    $0x2,%rdx
  mov    %eax,0xfc0(%rsp,%rdx,1)
  cmp    %ecx,%r13d
  jle    L81
  add    $0x2,%eax
  mov    %ecx,0xfc4(%rsp,%rdx,1)
  cmp    %eax,%r13d
  jle    L81
  mov    %eax,0xfc8(%rsp,%rdx,1)
L81:
  movl   $0x0,0x1f60(%rsp)
  cmp    $0x1,%edi
  jle    L4
  cmp    $0x1,%r13d
  je     L4
  mov    %r13d,0x4(%rsp)
  lea    0x1f60(%rsp),%rax
  xor    %r10d,%r10d
  cmpl   $0x1,0x4(%rsp)
  mov    %rax,0x8(%rsp)
  mov    $0x1,%ebp
  mov    $0xa,%r12d
  jle    L92
  cs nopw 0x0(%rax,%rax,1)
L398:
  mov    $0x4,%r8d
  mov    $0x1,%r11d
  mov    $0x1,%r13d
  jmp    L243
  nopl   0x0(%rax)
L265:
  mov    0x8(%rsp),%rdx
  mov    %r9d,(%rdx)
  cmp    %eax,0x4(%rsp)
  jle    L246
  mov    $0x1,%r13d
  movslq %r11d,%r10
L7:
  add    $0x4,%r8
  mov    %eax,%r11d
L243:
  movslq (%rbx,%r10,4),%rax
  lea    0x0(,%r10,4),%r14
  movslq 0x2f00(%rsp,%rax,8),%rcx
  lea    (%rcx,%rbp,1),%eax
  cltd
  idiv   %edi
  mov    %r12d,%eax
  sub    0x20(%rsp,%rcx,4),%eax
  movslq %eax,%rcx
  mov    %eax,%esi
  imul   $0x66666667,%rcx,%rcx
  sar    $0x1f,%esi
  sar    $0x22,%rcx
  sub    %esi,%ecx
  lea    (%rcx,%rcx,4),%ecx
  add    %ecx,%ecx
  sub    %ecx,%eax
  movslq %edx,%rdx
  add    0x20(%rsp,%rdx,4),%eax
  movslq %eax,%rcx
  cltd
  imul   $0x66666667,%rcx,%rcx
  sar    $0x22,%rcx
  sub    %edx,%ecx
  lea    (%rcx,%rcx,4),%edx
  add    %edx,%edx
  sub    %edx,%eax
  mov    %eax,%ecx
  movslq (%rbx,%r8,1),%rax
  movslq 0x2f00(%rsp,%rax,8),%rsi
  mov    %rax,%r9
  lea    (%rsi,%rbp,1),%eax
  cltd
  idiv   %edi
  mov    %r12d,%eax
  sub    0x20(%rsp,%rsi,4),%eax
  movslq %eax,%rsi
  mov    %eax,%r15d
  imul   $0x66666667,%rsi,%rsi
  sar    $0x1f,%r15d
  sar    $0x22,%rsi
  sub    %r15d,%esi
  lea    (%rsi,%rsi,4),%esi
  add    %esi,%esi
  sub    %esi,%eax
  movslq %edx,%rdx
  add    0x20(%rsp,%rdx,4),%eax
  movslq %eax,%rdx
  mov    %eax,%esi
  imul   $0x66666667,%rdx,%rdx
  sar    $0x1f,%esi
  sar    $0x22,%rdx
  sub    %esi,%edx
  lea    (%rdx,%rdx,4),%esi
  add    %esi,%esi
  sub    %esi,%eax
  mov    %eax,%edx
  lea    0x1(%r11),%eax
  cmp    %edx,%ecx
  jg     L265
  jne    L129
  mov    0x8(%rsp),%rcx
  movslq %r13d,%rdx
  add    $0x1,%r13d
  mov    %r9d,(%rcx,%rdx,4)
L129:
  cmp    %eax,0x4(%rsp)
  jg     L7
  mov    0x8(%rsp),%rcx
  add    $0x1,%ebp
  mov    (%rcx,%r14,1),%eax
  mov    %eax,(%rbx)
  cmp    %ebp,%edi
  jle    L415
  cmp    $0x1,%r13d
  je     L415
  mov    %rbx,%rax
  mov    %r13d,0x4(%rsp)
  cmpl   $0x1,0x4(%rsp)
  mov    %rcx,%rbx
  mov    %rax,0x8(%rsp)
  jg     L398
L92:
  mov    0x8(%rsp),%rax
  mov    (%rax,%r10,4),%eax
  mov    %eax,(%rbx)
L415:
  mov    0x8(%rsp),%rax
  movslq (%rax),%rax
  movslq 0x2f00(%rsp,%rax,8),%rax
  mov    0x20(%rsp,%rax,4),%esi
  mov    %rax,%rbp
  mov    $0xa,%eax
  sub    %esi,%eax
  movslq %eax,%rbx
  cltd
  imul   $0x66666667,%rbx,%rbx
  sar    $0x22,%rbx
  sub    %edx,%ebx
  lea    (%rbx,%rbx,4),%edx
  add    %edx,%edx
  sub    %edx,%eax
  mov    %eax,%ebx
L222:
  xor    %r12d,%r12d
  jmp    L141
  nopl   0x0(%rax,%rax,1)
L16:
  movslq %edx,%rax
  mov    0x20(%rsp,%rax,4),%esi
L141:
  add    %ebx,%esi
  lea    D35(%rip),%rdi
  add    $0x1,%r12d
  movslq %esi,%rcx
  mov    %esi,%eax
  imul   $0x66666667,%rcx,%rcx
  sar    $0x1f,%eax
  sar    $0x22,%rcx
  sub    %eax,%ecx
  lea    (%rcx,%rcx,4),%eax
  add    %eax,%eax
  sub    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  lea    0x1(%rbp),%eax
  mov    0x1c(%rsp),%ecx
  cltd
  idiv   %ecx
  mov    %edx,%ebp
  cmp    %r12d,%ecx
  jg     L16
L148:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    0x4e48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L403
  add    $0x4e58,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L94:
  cmp    $0x1,%r9d
  jne    L60
L155:
  movslq %r13d,%rax
  add    $0x1,%r13d
  jmp    L213
L142:
  movslq 0xfc0(%rsp),%rax
  mov    $0xa,%ebx
  movl   $0x0,0x1f60(%rsp)
  movslq 0x2f00(%rsp,%rax,8),%rax
  mov    0x20(%rsp,%rax,4),%esi
  mov    %rax,%rbp
  mov    %ebx,%eax
  sub    %esi,%eax
  cltd
  idiv   %ebx
  cmpl   $0x0,0x1c(%rsp)
  mov    %edx,%ebx
  jle    L148
  jmp    L222
L233:
  xor    %eax,%eax
  lea    0xfc0(%rsp),%rbx
  jmp    L283
L229:
  lea    0xfc0(%rsp),%rbx
  jmp    L81
L403:
  call   <__stack_chk_fail@plt>
L246:
  mov    0x8(%rsp),%rax
  mov    (%rax,%r8,1),%eax
  mov    %eax,(%rbx)
  jmp    L415
L4:
  mov    %rbx,0x8(%rsp)
  jmp    L415
```

tool_calls: name: parse_data
arguments: data_label: D35
type_infered: string
name: parse_data
arguments: data_label: D18
type_infered: string
name: parse_data
arguments: data_label: D0
type_infered: byte[16]
name: parse_data
arguments: data_label: D45
type_infered: byte[16]

tool: D35: %d

tool: D18: %c

tool: {"D0": [0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00]}

tool: {"D45": [0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00]}

assistant: ```c
int main() {
  int n;
  char entrada;
  int numero[1000];
  int nclusters, clusters[1000][2];
  int tamclusteratual, tamclustermax;
  int inicio;
  int vetor1[1000], vetor2[1000];
  int candidatosvelho, candidatosnovo;
  int rotcand, rotmelhor;
  int melhor;
  int digposcand, digposmelhor;
  int *tmp, *clustersvelho, *clustersnovo;
  int i, j;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    while (scanf("%c", &entrada) && entrada == '\n')
      ;
    numero[i] = (int)(entrada - '0');
  }
  if (0) {
    for (i = 0; i < n; i++)
      printf("%d ", numero[i]);
    printf("\n");
  }
  tamclustermax = 1;
  nclusters = 0;
  for (i = 0; i < n; i++) {
    tamclusteratual = 1;
    inicio = i;
    i++;
    while (numero[inicio] == numero[i] && i != inicio) {
      tamclusteratual++;
      i = (i + 1) % n;
    }
    if (tamclusteratual >= tamclustermax) {
      if (tamclusteratual > tamclustermax) {
        tamclustermax = tamclusteratual;
        nclusters = 0;
      }
      clusters[nclusters][0] = inicio;
      clusters[nclusters][1] = (i ? i - 1 : n - 1);
      nclusters++;
    }
    i = inicio + tamclusteratual - 1;
  }
  if (0) {
    printf("nclusters = %d:\n", nclusters);
    printf("tamanho dos clusters = %d:\n", tamclustermax);
    for (i = 0; i < nclusters; i++)
      printf("%d %d\n", clusters[i][0], clusters[i][1]);
  }
  candidatosvelho = nclusters;
  candidatosnovo = 1;
  melhor = 0;
  clustersvelho = vetor1;
  clustersnovo = vetor2;
  for (i = 0; i < candidatosvelho; i++)
    clustersvelho[i] = i;
  clustersnovo[0] = 0;
  if (0) {
    for (i = 0; i < candidatosvelho; i++)
      printf("%d ", clustersvelho[i]);
    printf("\n");
  }
  i = 1;
  while (i < n && candidatosvelho != 1) {
    for (j = 1; j < candidatosvelho; j++) {
      rotmelhor = (10 - numero[clusters[clustersvelho[melhor]][0]]) % 10;
      digposmelhor = (numero[(clusters[clustersvelho[melhor]][0] + i) % n] + rotmelhor) % 10;
      rotcand = (10 - numero[clusters[clustersvelho[j]][0]]) % 10;
      digposcand = (numero[(clusters[clustersvelho[j]][0] + i) % n] + rotcand) % 10;
      if (0) {
        printf("----------------------------------------\n");
        printf("deslocamento = %d\n\n", i);
        printf("melhor:\n");
        printf("pos=%d\n", clustersvelho[melhor]);
        printf("digpos= %d\n", digposmelhor);
        printf("numero = %d\n", numero[(clusters[clustersvelho[melhor]][0] + i) % n]);
        printf("rot = %d\n\n", rotmelhor);
        printf("candidato:\n");
        printf("pos=%d\n", clustersvelho[j]);
        printf("digpos= %d\n", digposcand);
        printf("numero = %d\n", numero[(clusters[clustersvelho[j]][0] + i) % n]);
        printf("rot = %d\n", rotcand);
        printf("\nteste = %d x %d\n\n", digposcand, digposmelhor);
      }
      if (digposcand < digposmelhor) {
        clustersnovo[0] = clustersvelho[j];
        candidatosnovo = 1;
        melhor = j;
      } else if (digposcand == digposmelhor) {
        clustersnovo[candidatosnovo] = clustersvelho[j];
        candidatosnovo++;
      }
    }
    if (0) {
      printf("candidatosnovo = %d \n", candidatosnovo);
    }
    tmp = clustersvelho;
    clustersvelho = clustersnovo;
    clustersnovo = tmp;
    clustersnovo[0] = clustersvelho[melhor];
    candidatosvelho = candidatosnovo;
    candidatosnovo = 1;
    i++;
  }
  j = clusters[clustersvelho[0]][0];
  rotmelhor = (10 - numero[clusters[clustersvelho[0]][0]]) % 10;
  if (0) {
    printf("\nEscolhidos: cluster de %d, com rot %d na posicao %d \n\n", numero[j], rotmelhor, j);
  }
  for (i = 0; i < n; i++) {
    printf("%d", (numero[j] + rotmelhor) % 10);
    j = (j + 1) % n;
  }
  printf("\n");
  return 0;
}
```