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

```asm
<main>:
  endbr64
  push   %r12
  lea    D7(%rip),%rdi
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x8(%rsp),%rsi
  call   <scanf@plt>
  mov    0x8(%rsp),%eax
  test   %eax,%eax
  jle    L253
  mov    %eax,%ecx
  and    $0xf,%ecx
  cmp    $0xa,%ecx
  lea    0x37(%rcx),%esi
  lea    0x30(%rcx),%edx
  cmovge %esi,%edx
  mov    %dl,0xe(%rsp)
  mov    %eax,%edx
  sar    $0x4,%edx
  je     L293
  and    $0xf,%edx
  cmp    $0xa,%edx
  lea    0x37(%rdx),%esi
  lea    0x30(%rdx),%ecx
  mov    %eax,%edx
  cmovl  %ecx,%esi
  sar    $0x8,%edx
  mov    %sil,0xf(%rsp)
  je     L54
  and    $0xf,%edx
  cmp    $0xa,%edx
  lea    0x37(%rdx),%esi
  lea    0x30(%rdx),%ecx
  mov    %eax,%edx
  cmovl  %ecx,%esi
  sar    $0xc,%edx
  mov    %sil,0x10(%rsp)
  je     L174
  and    $0xf,%edx
  lea    0x30(%rdx),%ecx
  cmp    $0x9,%edx
  jg     L361
L643:
  mov    %eax,%edx
  mov    %cl,0x11(%rsp)
  sar    $0x10,%edx
  je     L675
  and    $0xf,%edx
  lea    0x30(%rdx),%ecx
  cmp    $0x9,%edx
  jg     L717
L263:
  mov    %eax,%edx
  mov    %cl,0x12(%rsp)
  sar    $0x14,%edx
  je     L526
  and    $0xf,%edx
  lea    0x30(%rdx),%ecx
  cmp    $0x9,%edx
  jle    L67
  lea    0x37(%rdx),%ecx
L67:
  mov    %eax,%edx
  mov    %cl,0x13(%rsp)
  sar    $0x18,%edx
  je     L36
  and    $0xf,%edx
  lea    0x30(%rdx),%ecx
  cmp    $0x9,%edx
  jle    L504
  lea    0x37(%rdx),%ecx
L504:
  mov    %eax,%edx
  mov    %cl,0x14(%rsp)
  sar    $0x1c,%edx
  je     L626
  add    $0x30,%edx
  mov    $0x8,%esi
  mov    %dl,0x15(%rsp)
L576:
  lea    -0x1(%rsi),%edx
  mov    %esi,%edi
  movl   $0x0,0x8(%rsp)
  movzbl 0xe(%rsp),%r8d
  movslq %edx,%rcx
  sar    %edi
  cmp    0xe(%rsp,%rcx,1),%r8b
  je     L427
  mov    $0x1,%ecx
  test   %edi,%edi
  je     L168
L374:
  lea    -0x1(%rdx),%r9d
  mov    $0x1,%r10d
  movslq %r9d,%r9
  movzbl 0xe(%rsp,%r9,1),%ebx
  cmp    %bl,0xf(%rsp)
  cmovne %r10d,%ecx
  cmp    $0x1,%edi
  je     L330
  lea    -0x3(%rsi),%r9d
  movslq %r9d,%r9
  movzbl 0xe(%rsp,%r9,1),%ebx
  cmp    %bl,0x10(%rsp)
  cmovne %r10d,%ecx
  cmp    $0x2,%edi
  je     L330
  lea    -0x4(%rsi),%r9d
  movzbl 0x11(%rsp),%r11d
  movslq %r9d,%r9
  cmp    0xe(%rsp,%r9,1),%r11b
  cmovne %r10d,%ecx
  cmp    $0x4,%edi
  jne    L330
  cmp    0x12(%rsp),%r11b
  je     L295
  nopl   0x0(%rax)
L168:
  add    $0x1,%eax
  test   %eax,%eax
  jle    L611
  mov    %eax,%ecx
  and    $0xf,%ecx
  cmp    $0xa,%ecx
  lea    0x37(%rcx),%esi
  lea    0x30(%rcx),%edx
  cmovge %esi,%edx
  mov    %dl,0xe(%rsp)
  mov    %eax,%edx
  sar    $0x4,%edx
  je     L451
  and    $0xf,%edx
  cmp    $0xa,%edx
  lea    0x37(%rdx),%esi
  lea    0x30(%rdx),%ecx
  mov    %eax,%edx
  cmovl  %ecx,%esi
  sar    $0x8,%edx
  mov    %sil,0xf(%rsp)
  je     L211
  and    $0xf,%edx
  cmp    $0xa,%edx
  lea    0x37(%rdx),%esi
  lea    0x30(%rdx),%ecx
  mov    %eax,%edx
  cmovl  %ecx,%esi
  sar    $0xc,%edx
  mov    %sil,0x10(%rsp)
  je     L258
  and    $0xf,%edx
  cmp    $0xa,%edx
  lea    0x37(%rdx),%esi
  lea    0x30(%rdx),%ecx
  mov    %eax,%edx
  cmovl  %ecx,%esi
  sar    $0x10,%edx
  mov    %sil,0x11(%rsp)
  je     L522
  and    $0xf,%edx
  cmp    $0xa,%edx
  lea    0x37(%rdx),%esi
  lea    0x30(%rdx),%ecx
  mov    %eax,%edx
  cmovl  %ecx,%esi
  sar    $0x14,%edx
  mov    %sil,0x12(%rsp)
  je     L569
  and    $0xf,%edx
  cmp    $0xa,%edx
  lea    0x37(%rdx),%esi
  lea    0x30(%rdx),%ecx
  mov    %eax,%edx
  cmovl  %ecx,%esi
  sar    $0x18,%edx
  mov    %sil,0x13(%rsp)
  je     L621
  and    $0xf,%edx
  cmp    $0xa,%edx
  lea    0x37(%rdx),%esi
  lea    0x30(%rdx),%ecx
  mov    %eax,%edx
  cmovl  %ecx,%esi
  sar    $0x1c,%edx
  mov    %sil,0x14(%rsp)
  je     L194
  add    $0x30,%edx
  mov    $0x8,%esi
  mov    %dl,0x15(%rsp)
L141:
  lea    -0x1(%rsi),%edx
  mov    %esi,%ecx
  movzbl 0xe(%rsp),%r8d
  movslq %edx,%rdi
  sar    %ecx
  cmp    0xe(%rsp,%rdi,1),%r8b
  jne    L2
L502:
  xor    %edi,%edi
L312:
  sub    $0x1,%edx
  movslq %edx,%rdx
  movzbl 0xe(%rsp,%rdx,1),%ebx
  cmp    %bl,0xf(%rsp)
  je     L69
  mov    $0x1,%edi
  cmp    $0x1,%ecx
  je     L168
L272:
  lea    -0x3(%rsi),%edx
  movzbl 0x10(%rsp),%ebx
  movslq %edx,%rdx
  cmp    %bl,0xe(%rsp,%rdx,1)
  je     L140
  mov    $0x1,%edi
  cmp    $0x2,%ecx
  je     L168
L417:
  lea    -0x4(%rsi),%edx
  movzbl 0x11(%rsp),%ebx
  movslq %edx,%rdx
  cmp    %bl,0xe(%rsp,%rdx,1)
  je     L629
  mov    $0x1,%edi
  cmp    $0x4,%ecx
  jne    L168
L645:
  movzbl 0x11(%rsp),%ebx
  cmp    %bl,0x12(%rsp)
  jne    L168
L223:
  cmp    $0x1,%edi
  je     L168
  jmp    L257
  nopl   (%rax)
L2:
  test   %ecx,%ecx
  je     L168
L243:
  mov    $0x1,%edi
  jmp    L312
L361:
  lea    0x37(%rdx),%ecx
  jmp    L643
L717:
  lea    0x37(%rdx),%ecx
  jmp    L263
  nopw   0x0(%rax,%rax,1)
L69:
  cmp    $0x1,%ecx
  jne    L272
  jmp    L223
  nopl   0x0(%rax,%rax,1)
L140:
  cmp    $0x2,%ecx
  jne    L417
  jmp    L223
  nopw   0x0(%rax,%rax,1)
L629:
  cmp    $0x4,%ecx
  je     L645
  jmp    L223
  nopw   0x0(%rax,%rax,1)
L611:
  cmp    0xd(%rsp),%r8b
  jne    L168
  mov    %eax,%ecx
  xor    %esi,%esi
L227:
  mov    %ecx,%edi
L257:
  mov    %edi,0x8(%rsp)
L74:
  lea    -0x1(%rsi),%edx
  test   %esi,%esi
  je     L506
L596:
  lea    0xd(%rsp,%rsi,1),%rbp
  mov    %edx,%edx
  lea    0xe(%rsp,%rsi,1),%rbx
  sub    %rdx,%rbp
  lea    D1(%rip),%r12
  nopw   0x0(%rax,%rax,1)
L636:
  movsbl -0x1(%rbx),%esi
  mov    %r12,%rdi
  sub    $0x1,%rbx
  call   <printf@plt>
  cmp    %rbp,%rbx
  jne    L636
L506:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L721
  add    $0x20,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L211:
  mov    $0x2,%esi
L313:
  lea    -0x1(%rsi),%edx
  mov    %esi,%ecx
  movzbl 0xe(%rsp),%r8d
  movslq %edx,%rdi
  sar    %ecx
  cmp    0xe(%rsp,%rdi,1),%r8b
  jne    L243
  test   %ecx,%ecx
  je     L674
  jmp    L502
L258:
  mov    $0x3,%esi
  jmp    L313
L451:
  xor    %ecx,%ecx
L674:
  mov    $0x1,%esi
  jmp    L227
L522:
  mov    $0x4,%esi
  jmp    L313
L569:
  mov    $0x5,%esi
  jmp    L141
L621:
  mov    $0x6,%esi
  jmp    L141
L194:
  mov    $0x7,%esi
  jmp    L141
L427:
  xor    %ecx,%ecx
  test   %edi,%edi
  jne    L374
  jmp    L74
L330:
  sub    $0x1,%ecx
  je     L168
  jmp    L596
L526:
  mov    $0x5,%esi
  jmp    L576
L295:
  sub    $0x1,%ecx
  je     L168
  mov    $0x8,%esi
  mov    $0x7,%edx
  jmp    L596
L253:
  movzbl 0xe(%rsp),%r8d
  cmp    0xd(%rsp),%r8b
  jne    L168
  jmp    L506
L293:
  mov    $0x1,%esi
  jmp    L576
L54:
  mov    $0x2,%esi
  jmp    L576
L174:
  mov    $0x3,%esi
  jmp    L576
L675:
  mov    $0x4,%esi
  jmp    L576
L36:
  mov    $0x6,%esi
  jmp    L576
L626:
  mov    $0x7,%esi
  jmp    L576
L721:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D7
type: string
name: extract_symbolic_data
arguments: label: D1
type: string

tool: D7: %d

tool: D1: %c

assistant: ```c
int main() {
  int a = 0, num, i, ezway, end = 0, off;
  char hexa[10];
  scanf("%d", &num);
  off = num;
  for (i = 0; num > 0; i++) {
    ezway = num % 16;
    if (ezway < 10)
      hexa[i] = ezway + '0';
    else
      hexa[i] = ezway + 55;
    num /= 16;
  }
  while (a <= i / 2) {
    if (hexa[a] != hexa[i - a - 1])
      end = 1;
    a++;
  }
  while (end == 1) {
    off++;
    num = off;
    for (i = 0; num > 0; i++) {
      ezway = num % 16;
      if (ezway < 10)
        hexa[i] = ezway + '0';
      else
        hexa[i] = ezway + 55;
      num /= 16;
    }
    end = 0;
    a = 0;
    while (a <= i / 2) {
      if (hexa[a] != hexa[i - a - 1])
        end = 1;
      a++;
    }
  }
  while (i > 0) {
    printf("%c", hexa[i - 1]);
    i--;
  }
  return 0;
}
```