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

```asm
<GET_NBR>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    -0x3c(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x66666667,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x2,%edx
  sar    $0x1f,%eax
  sub    %eax,%edx
  mov    %edx,%r15d
  mov    -0x3c(%rbp),%edx
  movslq %edx,%rax
  imul   $0x66666667,%rax,%rax
  shr    $0x20,%rax
  sar    $0x2,%eax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  mov    %eax,%r13d
  mov    %r13d,%eax
  shl    $0x2,%eax
  add    %r13d,%eax
  add    %eax,%eax
  sub    %eax,%edx
  mov    %edx,%r13d
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,%ebx
  mov    $0x0,%r12d
  jmp    L62
L92:
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,%ebx
L182:
  cmp    $0xa,%ebx
  jne    L92
  mov    -0x3c(%rbp),%eax
  mov    %eax,%esi
  lea    D42(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,%ebx
L62:
  cmp    $0x2f,%ebx
  jle    L182
  cmp    $0x39,%ebx
  jg     L182
  jmp    L142
L139:
  lea    -0x30(%rbx),%r14d
  cmp    %r15d,%r12d
  jge    L167
  mov    %r12d,%eax
  shl    $0x2,%eax
  add    %r12d,%eax
  add    %eax,%eax
  lea    (%r14,%rax,1),%r12d
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,%ebx
  jmp    L142
L167:
  cmp    %r15d,%r12d
  jne    L241
  cmp    %r13d,%r14d
  jg     L13
  mov    %r12d,%eax
  shl    $0x2,%eax
  add    %r12d,%eax
  add    %eax,%eax
  lea    (%r14,%rax,1),%r12d
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,%ebx
  jmp    L142
L186:
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,%ebx
L13:
  cmp    $0xa,%ebx
  jne    L186
  mov    -0x3c(%rbp),%eax
  mov    %eax,%esi
  lea    D42(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,%ebx
  mov    $0x0,%r12d
  jmp    L51
L91:
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,%ebx
L225:
  cmp    $0xa,%ebx
  jne    L91
  mov    -0x3c(%rbp),%eax
  mov    %eax,%esi
  lea    D42(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,%ebx
L51:
  cmp    $0x2f,%ebx
  jle    L225
  cmp    $0x39,%ebx
  jg     L225
  jmp    L142
L148:
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,%ebx
L241:
  cmp    $0xa,%ebx
  jne    L148
  mov    -0x3c(%rbp),%eax
  mov    %eax,%esi
  lea    D42(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,%ebx
  mov    $0x0,%r12d
  jmp    L119
L235:
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,%ebx
L37:
  cmp    $0xa,%ebx
  jne    L235
  mov    -0x3c(%rbp),%eax
  mov    %eax,%esi
  lea    D42(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,%ebx
L119:
  cmp    $0x2f,%ebx
  jle    L37
  cmp    $0x39,%ebx
  jg     L37
L142:
  cmp    $0x2f,%ebx
  jle    L231
  cmp    $0x39,%ebx
  jle    L139
  jmp    L231
L170:
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,%ebx
L231:
  cmp    $0xa,%ebx
  jne    L170
  mov    -0x38(%rbp),%rax
  mov    %r12d,(%rax)
  nop
  add    $0x18,%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

tool_calls: name: unpack_data
arguments: label: D42
type_guessed: string

tool: D42:     Not a number (0..%d) - re-input: 

assistant: ```c
void GET_NBR(r, d) int *r, d;
{
  register int c, m, k, l, n;
  {
    n = 0;
    k = d / 10;
    l = d - 10 * (d / 10);
    c = getchar();
    n = 0;
    while ((c < '0') || (c > '9')) {
      while (c != '\n') {
        c = getchar();
      }
      printf("    Not a number (0..%d) - re-input: ", d);
      c = getchar();
    };
    while ((c >= '0') && (c <= '9')) {
      m = c - '0';
      if (n < k) {
        n = 10 * n + m;
        c = getchar();
      } else if (n == k) {
        if (m <= l) {
          n = 10 * n + m;
          c = getchar();
        } else {
          while (c != '\n') {
            c = getchar();
          }
          printf("    Not a number (0..%d) - re-input: ", d);
          c = getchar();
          n = 0;
          while ((c < '0') || (c > '9')) {
            while (c != '\n') {
              c = getchar();
            }
            printf("    Not a number (0..%d) - re-input: ", d);
            c = getchar();
          };
        }
      } else {
        while (c != '\n') {
          c = getchar();
        }
        printf("    Not a number (0..%d) - re-input: ", d);
        c = getchar();
        n = 0;
        while ((c < '0') || (c > '9')) {
          while (c != '\n') {
            c = getchar();
          }
          printf("    Not a number (0..%d) - re-input: ", d);
          c = getchar();
        };
      }
    }
    while (c != '\n') {
      c = getchar();
    }
    *r = n;
  }
}
```