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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    $0x1,%r12d
  push   %rbp
  lea    D18(%rip),%rbp
  push   %rbx
  sub    $0xff8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xfe8(%rsp)
  xor    %eax,%eax
  lea    0x1c(%rsp),%rax
  lea    0x20(%rsp),%r13
  mov    %rax,0x8(%rsp)
  nopl   0x0(%rax)
L21:
  mov    0x8(%rsp),%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  cmp    $0x1,%eax
  jne    L182
  mov    0x1c(%rsp),%r10d
  test   %r10d,%r10d
  je     L182
  mov    %r13,%rbx
  mov    %r13,%r14
  mov    $0x0,%r15d
  jle    L76
  xchg   %ax,%ax
L87:
  mov    %r14,%rsi
  mov    %rbp,%rdi
  add    $0x1,%r15d
  add    $0x4,%r14
  call   <scanf@plt>
  mov    0x1c(%rsp),%esi
  cmp    %r15d,%esi
  jg     L87
  test   %esi,%esi
  jle    L76
  lea    -0x1(%rsi),%eax
  cmp    $0x3,%eax
  jbe    L139
  mov    %esi,%eax
  pxor   %xmm1,%xmm1
  shr    $0x2,%eax
  movdqa %xmm1,%xmm0
  movdqa %xmm1,%xmm4
  lea    -0x1(%rax),%edx
  lea    0x10(%r13),%rax
  shl    $0x4,%rdx
  add    %rax,%rdx
  jmp    L214
  nopl   0x0(%rax)
L144:
  add    $0x10,%rax
L214:
  movdqa %xmm4,%xmm2
  pcmpeqd (%rbx),%xmm2
  mov    %rax,%rbx
  movdqa %xmm2,%xmm3
  pandn  D16(%rip),%xmm3
  psubd  %xmm2,%xmm1
  paddd  %xmm3,%xmm0
  cmp    %rax,%rdx
  jne    L144
  movdqa %xmm1,%xmm2
  mov    %esi,%ecx
  psrldq $0x8,%xmm2
  and    $0xfffffffc,%ecx
  paddd  %xmm2,%xmm1
  movdqa %xmm1,%xmm2
  psrldq $0x4,%xmm2
  paddd  %xmm2,%xmm1
  movd   %xmm1,%eax
  movdqa %xmm0,%xmm1
  psrldq $0x8,%xmm1
  paddd  %xmm1,%xmm0
  movdqa %xmm0,%xmm1
  psrldq $0x4,%xmm1
  paddd  %xmm1,%xmm0
  movd   %xmm0,%edx
  test   $0x3,%sil
  je     L12
L223:
  movslq %ecx,%rdi
  mov    0x20(%rsp,%rdi,4),%r9d
  test   %r9d,%r9d
  jne    L221
  add    $0x1,%eax
L212:
  lea    0x1(%rcx),%edi
  cmp    %edi,%esi
  jle    L12
  movslq %edi,%rdi
  mov    0x20(%rsp,%rdi,4),%r8d
  test   %r8d,%r8d
  jne    L54
  add    $0x1,%eax
L71:
  lea    0x2(%rcx),%edi
  cmp    %edi,%esi
  jle    L12
  movslq %edi,%rdi
  mov    0x20(%rsp,%rdi,4),%edi
  test   %edi,%edi
  jne    L200
  add    $0x1,%eax
L80:
  add    $0x3,%ecx
  cmp    %ecx,%esi
  jle    L12
  movslq %ecx,%rcx
  mov    0x20(%rsp,%rcx,4),%ecx
  test   %ecx,%ecx
  je     L177
  add    $0x1,%edx
L12:
  sub    %eax,%edx
L201:
  mov    %r12d,%esi
  lea    D25(%rip),%rdi
  add    $0x1,%r12d
  call   <printf@plt>
  jmp    L21
  nopw   0x0(%rax,%rax,1)
L221:
  add    $0x1,%edx
  jmp    L212
  nopl   (%rax)
L54:
  add    $0x1,%edx
  jmp    L71
  nopl   (%rax)
L200:
  add    $0x1,%edx
  jmp    L80
  nopl   (%rax)
L177:
  add    $0x1,%eax
  jmp    L12
  nopl   (%rax)
L182:
  mov    0xfe8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L218
  add    $0xff8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L76:
  xor    %edx,%edx
  jmp    L201
L139:
  xor    %eax,%eax
  xor    %edx,%edx
  xor    %ecx,%ecx
  jmp    L223
L218:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D18
data_type: string
name: disassemble_data
arguments: data_tag: D16
data_type: byte[16]
name: disassemble_data
arguments: data_tag: D25
data_type: string

tool: D18: %d

tool: {"D16": [0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00]}

tool: D25: Case %d: %d


assistant: ```c
int main() {
  int i, st, gt, n, a[1009], t = 1;
  while (scanf("%d", &n) == 1) {
    if (n == 0)
      break;
    for (i = 0; i < n; i++)
      scanf("%d", &a[i]);
    st = 0;
    gt = 0;
    for (i = 0; i < n; i++) {
      if (a[i] == 0)
        gt++;
      else
        st++;
    }
    printf("Case %d: %d\n", t, (st - gt));
    t++;
  }
  return 0;
}
```