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

```asm
<main>:
  endbr64
  push   %r14
  mov    $0x7d0,%edi
  lea    D28(%rip),%r14
  push   %r13
  lea    D27(%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    D2(%rip),%rdi
  movl   $0x1,0x4(%rsp)
  mov    %rax,%rbx
  xor    %eax,%eax
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  test   %eax,%eax
  jle    L18
  nopw   0x0(%rax,%rax,1)
L82:
  mov    %rbx,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  movzbl (%rbx),%eax
  test   %al,%al
  je     L156
  lea    0x1(%rbx),%rdx
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  xor    %esi,%esi
  jmp    L0
  nopl   (%rax)
L183:
  test   %ecx,%ecx
  jne    L162
  lea    -0x61(%rax),%edi
  cmp    $0x19,%dil
  jbe    L88
  xor    %ecx,%ecx
  cmp    $0x30,%al
  sete   %cl
L152:
  movzbl (%rdx),%eax
  add    $0x1,%rdx
  test   %al,%al
  je     L179
L0:
  test   %esi,%esi
  jne    L183
  lea    -0x61(%rax),%edi
  cmp    $0x19,%dil
  jbe    L129
  cmp    $0x31,%al
  movzbl (%rdx),%eax
  sete   %sil
  cmove  %r12d,%ecx
  add    $0x1,%rdx
  movzbl %sil,%esi
  test   %al,%al
  jne    L0
  nopl   0x0(%rax)
L179:
  mov    %r8d,%esi
  mov    %r13,%rdi
  add    $0x1,%ebp
  call   <printf@plt>
  cmp    %ebp,0x4(%rsp)
  jg     L82
L18:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L151
  add    $0x10,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax,%rax,1)
L162:
  lea    -0x61(%rax),%edi
  cmp    $0x19,%dil
  jbe    L187
  cmp    $0x1,%ecx
  jne    L152
  mov    $0x1,%esi
  cmp    $0x31,%al
  jne    L152
  add    $0x1,%r8d
  xor    %ecx,%ecx
  jmp    L152
  nopw   0x0(%rax,%rax,1)
L129:
  xor    %ecx,%ecx
  jmp    L152
  nopw   0x0(%rax,%rax,1)
L187:
  xor    %ecx,%ecx
  xor    %esi,%esi
  jmp    L152
  nopl   0x0(%rax)
L88:
  xor    %esi,%esi
  jmp    L152
  nopw   0x0(%rax,%rax,1)
L156:
  xor    %r8d,%r8d
  jmp    L179
L151:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D28
type: string
name: disassemble_data
arguments: data_tag: D27
type: string
name: disassemble_data
arguments: data_tag: D2
type: string

tool: D28: %s

tool: D27: %d


tool: D2: %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;
}
```