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

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rsi
  lea    D13(%rip),%rdi
  call   <scanf@plt>
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    0xc(%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,0xc(%rsp)
  test   %eax,%eax
  je     L91
  lea    0x10(%rsp),%rbx
  mov    $0x0,%r13d
  lea    D18(%rip),%r12
  lea    D4(%rip),%rbp
  jmp    L81
L108:
  add    $0x1,%rdx
  cmp    %r8,%rdx
  je     L148
L92:
  movzbl (%rdx),%ecx
  lea    -0x30(%rcx),%esi
  cmp    $0x9,%sil
  ja     L108
  movslq %edi,%rsi
  mov    %cl,0x30(%rsp,%rsi,1)
  add    $0x1,%edi
  jmp    L108
L154:
  mov    $0x0,%edi
  mov    %r13d,%eax
L148:
  cltq
  movb   $0x0,0x10(%rsp,%rax,1)
  movslq %edi,%rdi
  movb   $0x0,0x30(%rsp,%rdi,1)
  lea    0x30(%rsp),%rdi
  call   <strlen@plt>
  mov    %eax,%r9d
  test   %eax,%eax
  jle    L87
  lea    0x30(%rsp),%rcx
  mov    $0x0,%eax
  mov    $0x0,%r10d
  mov    $0x0,%edi
  jmp    L10
L15:
  movsbl (%rcx),%edx
  lea    -0x30(%r10,%rdx,1),%r10d
L86:
  add    $0x1,%eax
  add    $0x1,%rcx
  cmp    %eax,%r9d
  je     L22
L10:
  test   $0x1,%al
  jne    L15
  movsbl (%rcx),%edx
  lea    -0x60(%rdx,%rdx,1),%r8d
  lea    -0x1(%r8),%edx
  movslq %edx,%rsi
  imul   $0x38e38e39,%rsi,%rsi
  sar    $0x21,%rsi
  sar    $0x1f,%edx
  sub    %esi,%edx
  lea    (%rdx,%rdx,8),%edx
  add    %r8d,%edx
  add    %edx,%edi
  jmp    L86
L22:
  add    %r10d,%edi
  movslq %edi,%rax
  imul   $0x66666667,%rax,%rax
  sar    $0x22,%rax
  mov    %edi,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  lea    (%rax,%rax,4),%eax
  add    %eax,%eax
  cmp    %eax,%edi
  je     L87
  mov    %rbp,%rdi
  call   <printf@plt>
  jmp    L43
L87:
  mov    %r12,%rdi
  call   <printf@plt>
L43:
  mov    0xc(%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,0xc(%rsp)
  test   %eax,%eax
  je     L91
L81:
  mov    %rbx,%rdi
  call   <gets@plt>
  mov    %rbx,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  jle    L154
  lea    0x10(%rsp),%rdx
  lea    -0x1(%rax),%ecx
  lea    0x11(%rsp,%rcx,1),%r8
  mov    $0x0,%edi
  jmp    L92
L91:
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  mov    $0x0,%eax
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L0:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D13
type_guessed: string
name: extract_symbolic_data
arguments: label: D18
type_guessed: string
name: extract_symbolic_data
arguments: label: D4
type_guessed: string

tool: D13: %d

tool: D18: Valid


tool: D4: Invalid


assistant: ```c
int main() {
  char m[22], a[22];
  int b, c = 0, d = 0, ch;
  int n, i, j, l, len, len2, total;
  scanf("%d", &n);
  getchar();
  while (n--) {
    gets(m);
    len = strlen(m);
    j = 0, l = 0;
    while (j < len) {
      if (m[j] >= '0' && m[j] <= '9') {
        a[l] = m[j];
        l++;
      }
      j++;
    }
    m[j] = '\0';
    a[l] = '\0';
    len2 = strlen(a);
    for (j = 0; j < len2; j++) {
      if (j % 2 == 0) {
        ch = 0;
        b = (a[j] - '0') * 2;
        b = b - 9 * ((b - 1) / 9);
        c = c + b;
      } else {
        d += (a[j] - '0');
      }
    }
    total = c + d;
    if (total % 10 == 0) {
      printf("Valid\n");
    } else {
      printf("Invalid\n");
    }
    c = 0, d = 0, ch = 0;
  }
  return 0;
}
```