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

```asm
<main>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rsi
  lea    D52(%rip),%rdi
  call   <scanf@plt>
  mov    $0x0,%ebp
  cmpb   $0x39,(%rsp)
  je     L361
L345:
  movzbl 0x6(%rsp),%eax
  cmp    $0x39,%al
  je     L143
  cmp    $0x35,%al
  jne    L311
  mov    $0x0,%ebx
  cmpb   $0x35,0x7(%rsp)
  jne    L66
  cmpb   $0x35,0x8(%rsp)
  jne    L66
  cmpb   $0x38,0x9(%rsp)
  jne    L66
  cmpb   $0x33,0xa(%rsp)
  sete   %bl
  movzbl %bl,%ebx
  add    %ebx,%ebx
  jmp    L66
L361:
  cmpb   $0x37,0x1(%rsp)
  jne    L345
  movzbl 0x2(%rsp),%eax
  sub    $0x38,%eax
  cmp    $0x1,%al
  setbe  %bpl
  movzbl %bpl,%ebp
  jmp    L345
L143:
  mov    $0x0,%ebx
  cmpb   $0x33,0x7(%rsp)
  je     L167
L217:
  cmp    $0x30,%al
  jne    L66
  cmpb   $0x31,0x7(%rsp)
  mov    $0x4,%eax
  cmove  %eax,%ebx
L66:
  mov    %rsp,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  jle    L210
  mov    $0x0,%edx
L25:
  mov    %edx,%ecx
  add    $0x1,%edx
  cmp    %edx,%eax
  jne    L25
  mov    %rsp,%rdx
  mov    %ecx,%ecx
  lea    0x1(%rsp,%rcx,1),%rcx
L247:
  subb   $0x30,(%rdx)
  add    $0x1,%rdx
  cmp    %rcx,%rdx
  jne    L247
L210:
  lea    -0x1(%rax),%r8d
  test   %r8d,%r8d
  jle    L244
  mov    %rsp,%rdx
  lea    -0x2(%rax),%eax
  lea    0x1(%rsp,%rax,1),%r9
  mov    $0x0,%esi
  mov    $0x1,%ecx
  mov    $0x0,%edi
  jmp    L48
L167:
  cmpb   $0x33,0x8(%rsp)
  jne    L217
  cmpb   $0x33,0x9(%rsp)
  jne    L217
  cmpb   $0x34,0xa(%rsp)
  jne    L217
  cmpb   $0x36,0xb(%rsp)
  sete   %bl
  movzbl %bl,%ebx
  jmp    L217
L311:
  cmp    $0x34,%al
  jne    L94
  mov    $0x0,%ebx
  cmpb   $0x32,0x7(%rsp)
  jne    L66
  cmpb   $0x31,0x8(%rsp)
  jne    L66
  cmpb   $0x30,0x9(%rsp)
  sete   %bl
  movzbl %bl,%ebx
  lea    (%rbx,%rbx,2),%ebx
  jmp    L66
L94:
  mov    $0x0,%ebx
  jmp    L217
L174:
  add    $0x1,%rdx
  cmp    %rdx,%r9
  je     L220
L48:
  movzbl (%rdx),%eax
  cmp    $0x9,%al
  ja     L174
  movsbl %al,%eax
  imul   %ecx,%eax
  add    %eax,%edi
  add    $0x1,%esi
  mov    %esi,%eax
  and    $0x1,%eax
  cmp    $0x1,%eax
  sbb    %ecx,%ecx
  and    $0xfffffffe,%ecx
  add    $0x3,%ecx
  jmp    L174
L244:
  mov    $0x0,%edi
L220:
  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
  sub    %edi,%eax
  lea    0xa(%rax),%edx
  movslq %r8d,%r8
  movsbl (%rsp,%r8,1),%eax
  cmp    %eax,%edx
  jne    L38
  test   %ebp,%ebp
  jne    L134
L38:
  lea    D25(%rip),%rdi
  call   <printf@plt>
L118:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L289
  mov    $0x0,%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  ret
L134:
  lea    D32(%rip),%rdi
  call   <printf@plt>
  cmp    $0x1,%ebx
  je     L324
  cmp    $0x2,%ebx
  je     L340
  cmp    $0x3,%ebx
  je     L207
L96:
  cmp    $0x4,%ebx
  jne    L118
  lea    D10(%rip),%rdi
  call   <printf@plt>
  jmp    L118
L324:
  lea    D67(%rip),%rdi
  call   <printf@plt>
  jmp    L96
L340:
  lea    D26(%rip),%rdi
  call   <printf@plt>
  jmp    L118
L207:
  lea    D9(%rip),%rdi
  call   <printf@plt>
  jmp    L118
L289:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D52
data_type: string
name: extract_symbolic_data
arguments: label: D25
data_type: string
name: extract_symbolic_data
arguments: label: D32
data_type: string
name: extract_symbolic_data
arguments: label: D10
data_type: string
name: extract_symbolic_data
arguments: label: D67
data_type: string
name: extract_symbolic_data
arguments: label: D26
data_type: string
name: extract_symbolic_data
arguments: label: D9
data_type: string

tool: D52: %s

tool: D25: 0

tool: D32: 1

tool: D10: 
Pyramid Books

tool: D67: 
Bluebridge

tool: D26: 
Alyson Books

tool: D9: 
FUNimation Productions, Ltd.

assistant: ```c
int main() {
  char ISBN[20];
  int valid = 1, counter, l, sum = 0, check = 1, counter2 = 0, company = 0;
  scanf("%s", ISBN);
  if (ISBN[0] != '9' || ISBN[1] != '7' || (ISBN[2] != '8' && ISBN[2] != '9')) {
    valid = 0;
  }
  if (ISBN[6] == '9' && ISBN[7] == '3' && ISBN[8] == '3' && ISBN[9] == '3' && ISBN[10] == '4' && ISBN[11] == '6') {
    company = 1;
  }
  if (ISBN[6] == '5' && ISBN[7] == '5' && ISBN[8] == '5' && ISBN[9] == '8' && ISBN[10] == '3') {
    company = 2;
  }
  if (ISBN[6] == '4' && ISBN[7] == '2' && ISBN[8] == '1' && ISBN[9] == '0') {
    company = 3;
  }
  if (ISBN[6] == '0' && ISBN[7] == '1') {
    company = 4;
  }
  l = strlen(ISBN);
  for (counter = 0; counter < l; counter++) {
    if (ISBN[counter] > '9' && ISBN[counter] < '0' && ISBN[counter] != '-')
      valid = 0;
  }
  for (counter = 0; counter < l; counter++) {
    ISBN[counter] = (ISBN[counter] - 48);
  }
  for (counter = 0; counter < l - 1; counter++) {
    if (ISBN[counter] <= 9 && ISBN[counter] >= 0) {
      sum = sum + ISBN[counter] * check;
      counter2++;
      if (counter2 % 2 != 0) {
        check = 3;
      } else {
        check = 1;
      }
    }
  }
  if (ISBN[l - 1] != 10 - (sum % 10)) {
    valid = 0;
  }
  if (valid != 0) {
    printf("1");
    if (company == 1) {
      printf("\nBluebridge");
    }
    if (company == 2) {
      printf("\nAlyson Books");
    }
    if (company == 3) {
      printf("\nFUNimation Productions, Ltd.");
    }
    if (company == 4) {
      printf("\nPyramid Books");
    }
  } else {
    printf("0");
  }
  return 0;
}
```