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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x14(%rbp)
  lea    D140(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
L97:
  lea    -0x20(%rbp),%rax
  mov    %rax,%rsi
  lea    D53(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x20(%rbp),%eax
  test   %eax,%eax
  jle    L97
  lea    D94(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
L55:
  lea    -0x1c(%rbp),%rax
  mov    %rax,%rsi
  lea    D53(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x1c(%rbp),%eax
  test   %eax,%eax
  jle    L55
  jmp    L26
L63:
  lea    D80(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    -0x14(%rbp),%rdx
  lea    -0x18(%rbp),%rax
  mov    %rax,%rsi
  lea    D103(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x18(%rbp),%eax
  cmp    $0x1,%eax
  jne    L39
  mov    -0x14(%rbp),%edx
  mov    -0x20(%rbp),%eax
  cmp    %eax,%edx
  jg     L78
  mov    -0x14(%rbp),%eax
  test   %eax,%eax
  jne    L83
L78:
  lea    D158(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x1c(%rbp),%edx
  mov    -0x20(%rbp),%eax
  mov    %eax,%esi
  lea    D156(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L26
L83:
  lea    D120(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x20(%rbp),%eax
  mov    -0x14(%rbp),%edx
  sub    %edx,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x1c(%rbp),%edx
  mov    -0x20(%rbp),%eax
  mov    %eax,%esi
  lea    D156(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x10(%rbp)
  jmp    L26
L39:
  mov    -0x18(%rbp),%eax
  cmp    $0x2,%eax
  jne    L26
  mov    -0x14(%rbp),%edx
  mov    -0x1c(%rbp),%eax
  cmp    %eax,%edx
  jg     L32
  mov    -0x14(%rbp),%eax
  test   %eax,%eax
  jne    L72
L32:
  lea    D158(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x1c(%rbp),%edx
  mov    -0x20(%rbp),%eax
  mov    %eax,%esi
  lea    D156(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L26
L72:
  mov    -0x1c(%rbp),%eax
  mov    -0x14(%rbp),%edx
  sub    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  lea    D120(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x1c(%rbp),%edx
  mov    -0x20(%rbp),%eax
  mov    %eax,%esi
  lea    D156(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0xc(%rbp)
L26:
  mov    -0x20(%rbp),%eax
  test   %eax,%eax
  jg     L63
  mov    -0x1c(%rbp),%eax
  test   %eax,%eax
  jg     L63
  lea    D148(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x10(%rbp),%eax
  mov    %eax,%esi
  lea    D30(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0xc(%rbp),%eax
  mov    %eax,%esi
  lea    D142(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L57
  call   <__stack_chk_fail@plt>
L57:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D140
datatype: string
name: extract_symbolic_data
arguments: data_label: D53
datatype: string
name: extract_symbolic_data
arguments: data_label: D94
datatype: string
name: extract_symbolic_data
arguments: data_label: D80
datatype: string
name: extract_symbolic_data
arguments: data_label: D103
datatype: string
name: extract_symbolic_data
arguments: data_label: D158
datatype: string
name: extract_symbolic_data
arguments: data_label: D156
datatype: string
name: extract_symbolic_data
arguments: data_label: D120
datatype: string
name: extract_symbolic_data
arguments: data_label: D148
datatype: string
name: extract_symbolic_data
arguments: data_label: D30
datatype: string
name: extract_symbolic_data
arguments: data_label: D142
datatype: string

tool: D140: Informe a quantidade inicial do produto A:

tool: D53: %d

tool: D94: Informe a quantidade inicial do produto B:

tool: D80: Informe vendas:

tool: D103: %d %d

tool: D158: Venda nao registrada

tool: D156: Estoque: A = %d B = %d


tool: D120: Venda registrada

tool: D148: 
Relatorio:

tool: D30: Numero de registos de venda o produto A: %d


tool: D142: Numero de registos de venda o produto B: %d


assistant: ```c
int main() {
  int prodA = 0, prodB = 0, vendA = 0, vendB = 0;
  int cod, prod = 0;
  printf("Informe a quantidade inicial do produto A:\n");
  do {
    scanf("%d", &prodA);
  } while (prodA <= 0);
  printf("Informe a quantidade inicial do produto B:\n");
  do {
    scanf("%d", &prodB);
  } while (prodB <= 0);
  while (prodA > 0 || prodB > 0) {
    printf("Informe vendas:\n");
    scanf("%d %d", &cod, &prod);
    if (cod == 1) {
      if (prod > prodA || prod == 0) {
        puts("Venda nao registrada");
        printf("Estoque: A = %d B = %d\n", prodA, prodB);
      } else {
        puts("Venda registrada");
        prodA -= prod;
        printf("Estoque: A = %d B = %d\n", prodA, prodB);
        vendA++;
      }
    } else if (cod == 2) {
      if (prod > prodB || prod == 0) {
        puts("Venda nao registrada");
        printf("Estoque: A = %d B = %d\n", prodA, prodB);
      } else {
        prodB -= prod;
        puts("Venda registrada");
        printf("Estoque: A = %d B = %d\n", prodA, prodB);
        vendB++;
      }
    }
  }
  puts("\nRelatorio:");
  printf("Numero de registos de venda o produto A: %d\n", vendA);
  printf("Numero de registos de venda o produto B: %d\n", vendB);
  return 0;
}
```