user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  lea    D30(%rip),%r13
  push   %r12
  lea    D27(%rip),%r12
  push   %rbp
  lea    D29(%rip),%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x1d(%rsp),%rbx
  nopl   0x0(%rax)
L66:
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  mov    %rbx,%rdi
  call   <atoi@plt>
  cmpb   $0x2d,0x1d(%rsp)
  je     L224
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L115
  cmpb   $0x30,0x1d(%rsp)
  mov    %rbx,%rdi
  jne    L183
  cmpb   $0x78,0x1e(%rsp)
  je     L22
L183:
  call   <atoi@plt>
  mov    %r13,%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L66
  xchg   %ax,%ax
L115:
  lea    D13(%rip),%rdi
  call   <puts@plt>
  jmp    L66
  xchg   %ax,%ax
L224:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L162
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L22:
  call   <strlen@plt>
  sub    $0x1,%eax
  js     L154
  movslq %eax,%r15
  xor    %ecx,%ecx
  xor    %r14d,%r14d
  nopl   0x0(%rax,%rax,1)
L113:
  movzbl (%rbx,%r15,1),%edx
  cmp    $0x78,%dl
  je     L185
  cmp    $0x30,%dl
  je     L40
  lea    -0x41(%rdx),%eax
  cmp    $0x25,%al
  ja     L15
  lea    D45(%rip),%rsi
  movzbl %al,%eax
  movslq (%rsi,%rax,4),%rax
  add    %rsi,%rax
  notrack jmp *%rax
L185:
  cmpb   $0x30,0x1c(%rsp,%r15,1)
  je     L151
L15:
  mov    %ecx,%esi
  mov    $0x10,%edi
  mov    %dl,0xf(%rsp)
  mov    %ecx,0x8(%rsp)
  call   <pow@plt>
  movsbl 0xf(%rsp),%edx
  mov    0x8(%rsp),%ecx
  mov    %rax,%r9
  sub    $0x30,%edx
  movslq %edx,%rax
  imul   %r9,%rax
  add    %rax,%r14
  nopl   0x0(%rax,%rax,1)
L151:
  sub    $0x1,%r15
  add    $0x1,%ecx
  test   %r15d,%r15d
  jns    L113
L197:
  mov    %r14,%rsi
  lea    D35(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L66
  mov    %ecx,%esi
  mov    $0x10,%edi
  mov    %ecx,0x8(%rsp)
  call   <pow@plt>
  mov    0x8(%rsp),%ecx
  imul   $0xf,%rax,%rax
  add    %rax,%r14
  jmp    L151
  mov    %ecx,%esi
  mov    $0x10,%edi
  mov    %ecx,0x8(%rsp)
  call   <pow@plt>
  mov    0x8(%rsp),%ecx
  imul   $0xe,%rax,%rax
  add    %rax,%r14
  jmp    L151
  mov    %ecx,%esi
  mov    $0x10,%edi
  mov    %ecx,0x8(%rsp)
  call   <pow@plt>
  mov    0x8(%rsp),%ecx
  imul   $0xd,%rax,%rax
  add    %rax,%r14
  jmp    L151
  mov    %ecx,%esi
  mov    $0x10,%edi
  mov    %ecx,0x8(%rsp)
  call   <pow@plt>
  mov    0x8(%rsp),%ecx
  imul   $0xc,%rax,%rax
  add    %rax,%r14
  jmp    L151
  mov    %ecx,%esi
  mov    $0x10,%edi
  mov    %ecx,0x8(%rsp)
  call   <pow@plt>
  mov    0x8(%rsp),%ecx
  imul   $0xb,%rax,%rax
  add    %rax,%r14
  jmp    L151
  mov    %ecx,%esi
  mov    $0x10,%edi
  mov    %ecx,0x8(%rsp)
  call   <pow@plt>
  mov    0x8(%rsp),%ecx
  imul   $0xa,%rax,%rax
  add    %rax,%r14
  jmp    L151
L40:
  lea    0x1(%r15),%eax
  cltq
  cmpb   $0x78,0x1d(%rsp,%rax,1)
  jne    L15
  jmp    L151
L154:
  xor    %r14d,%r14d
  jmp    L197
L162:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D30
data_type: string
name: unpack_data
arguments: label: D27
data_type: string
name: unpack_data
arguments: label: D29
data_type: string
name: unpack_data
arguments: label: D13
data_type: string
name: unpack_data
arguments: label: D35
data_type: string

tool: D30: 0x%X


tool: D27: 0x80000000

tool: D29: %s

tool: D13: 2147483648

tool: D35: %i


assistant: ```c
int main() {
  int tam, k = 0, l = 0, pos = 0;
  long long r = 0, resul = 0;
  char ent[11], val;
  unsigned int v = 0, v1 = 0, v2 = 0, v3 = 0, j = 0, conv = 0;
  int q = 0, i = 0;
  while ((ent[0] == '0' && ent[1] == 'x') || conv >= 0) {
    scanf("%s", ent);
    conv = atoi(ent);
    resul = 0;
    if (ent[0] == '-') {
      break;
    } else if (strcmp(ent, "0x80000000") == 0) {
      printf("2147483648\n");
    } else if (ent[0] == '0' && ent[1] == 'x') {
      tam = strlen(ent) - 1;
      for (i = tam; i >= 0; i--) {
        val = ent[i];
        if (val == 'x' && ent[i - 1] == '0') {
        } else if (val == '0' && ent[i + 1] == 'x') {
        } else if (val == 'A' || val == 'a') {
          r = 10;
          pos = tam - i;
          resul = resul + (r * pow(16, pos));
        } else if (val == 'B' || val == 'b') {
          r = 11;
          pos = tam - i;
          resul = resul + (r * pow(16, pos));
        } else if (val == 'C' || val == 'c') {
          r = 12;
          pos = tam - i;
          resul = resul + (r * pow(16, pos));
        } else if (val == 'D' || val == 'd') {
          r = 13;
          pos = tam - i;
          resul = resul + (r * pow(16, pos));
        } else if (val == 'E' || val == 'e') {
          r = 14;
          pos = tam - i;
          resul = resul + (r * pow(16, pos));
        } else if (val == 'F' || val == 'f') {
          r = 15;
          pos = tam - i;
          resul = resul + (r * pow(16, pos));
        } else {
          r = val - 48;
          pos = tam - i;
          resul = resul + (r * pow(16, pos));
        }
      }
      printf("%i\n", resul);
    } else {
      v = atoi(ent);
      printf("0x%X\n", v);
    }
  }
  return 0;
}
```