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

```asm
<main>:
  endbr64
  push   %r14
  mov    $0x7d0,%edi
  lea    D3(%rip),%r14
  push   %r13
  lea    D6(%rip),%r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <malloc@plt>
  lea    0x4(%rsp),%rsi
  lea    D9(%rip),%rdi
  movl   $0x1,0x4(%rsp)
  mov    %rax,%rbx
  xor    %eax,%eax
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  test   %eax,%eax
  jle    L39
  nopw   0x0(%rax,%rax,1)
L15:
  mov    %rbx,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  movzbl (%rbx),%eax
  test   %al,%al
  je     L174
  lea    0x1(%rbx),%rdx
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  xor    %esi,%esi
  jmp    L113
  nopl   (%rax)
L58:
  test   %ecx,%ecx
  jne    L36
  lea    -0x61(%rax),%edi
  cmp    $0x19,%dil
  jbe    L76
  xor    %ecx,%ecx
  cmp    $0x30,%al
  sete   %cl
L46:
  movzbl (%rdx),%eax
  add    $0x1,%rdx
  test   %al,%al
  je     L31
L113:
  test   %esi,%esi
  jne    L58
  lea    -0x61(%rax),%edi
  cmp    $0x19,%dil
  jbe    L133
  cmp    $0x31,%al
  movzbl (%rdx),%eax
  sete   %sil
  cmove  %r12d,%ecx
  add    $0x1,%rdx
  movzbl %sil,%esi
  test   %al,%al
  jne    L113
  nopl   0x0(%rax)
L31:
  mov    %r8d,%esi
  mov    %r13,%rdi
  add    $0x1,%ebp
  call   <printf@plt>
  cmp    %ebp,0x4(%rsp)
  jg     L15
L39:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L38
  add    $0x10,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax,%rax,1)
L36:
  lea    -0x61(%rax),%edi
  cmp    $0x19,%dil
  jbe    L111
  cmp    $0x1,%ecx
  jne    L46
  mov    $0x1,%esi
  cmp    $0x31,%al
  jne    L46
  add    $0x1,%r8d
  xor    %ecx,%ecx
  jmp    L46
  nopw   0x0(%rax,%rax,1)
L133:
  xor    %ecx,%ecx
  jmp    L46
  nopw   0x0(%rax,%rax,1)
L111:
  xor    %ecx,%ecx
  xor    %esi,%esi
  jmp    L46
  nopl   0x0(%rax)
L76:
  xor    %esi,%esi
  jmp    L46
  nopw   0x0(%rax,%rax,1)
L174:
  xor    %r8d,%r8d
  jmp    L31
L38:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D3
type_guessed: string
name: parse_data
arguments: label: D6
type_guessed: string
name: parse_data
arguments: label: D9
type_guessed: string

tool: D3: %s

tool: D6: %d


tool: D9: %d

assistant: ```c
int main() {
  char *str = (char *)malloc(sizeof(char) * 2000);
  char nextChar = '1';
  int fa = 0, fb = 0, fc = 0;
  int i = 0, count = 0, t = 1, y = 0;
  scanf("%d", &t);
  while (y++ < t) {
    fa = 0, fb = 0, fc = 0;
    count = 0, i = 0;
    scanf("%s", str);
    while (str[i] != '\0') {
      if (fa == 0) {
        nextChar = '1';
      } else if (fa == 1 && fb == 0) {
        nextChar = '0';
      } else if (fa == 1 && fb == 1) {
        nextChar = '1';
      }
      if (str[i] >= 97 && str[i] <= 122) {
        fa = 0;
        fb = 0;
        fc = 0;
      } else if (fa == 0 && str[i] == nextChar) {
        fa = 1;
        fb = 0;
        fc = 0;
      } else if (fa == 1 && fb == 0 && str[i] == nextChar) {
        fa = 1;
        fb = 1;
        fc = 0;
      } else if (fa == 1 && fb == 1 && fc == 0 && str[i] == nextChar) {
        fa = 1;
        fb = 1;
        fc = 1;
      }
      if (fa == 1 && fb == 1 && fc == 1) {
        count++;
        fa = 1;
        fb = 0;
        fc = 0;
      }
      i++;
    }
    printf("%d\n", count);
  }
  return 0;
}
```