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

```asm
<main>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0xf60,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1f58(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rcx
  lea    0x8(%rsp),%rdx
  lea    0x4(%rsp),%rsi
  lea    D31(%rip),%rdi
  call   <scanf@plt>
  cmpl   $0x0,0x8(%rsp)
  jle    L117
  lea    0x10(%rsp),%rbp
  mov    $0x0,%ebx
  lea    D52(%rip),%r12
L142:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  add    $0x1,%ebx
  add    $0x4,%rbp
  cmp    %ebx,0x8(%rsp)
  jg     L142
L117:
  mov    0xc(%rsp),%esi
  test   %esi,%esi
  jle    L136
  lea    0xfb0(%rsp),%rbp
  mov    $0x0,%ebx
  lea    D52(%rip),%r12
L95:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  add    $0x1,%ebx
  mov    0xc(%rsp),%esi
  add    $0x4,%rbp
  cmp    %ebx,%esi
  jg     L95
L136:
  mov    0x4(%rsp),%r10d
  lea    D35(%rip),%rax
  test   %r10d,%r10d
  jle    L173
  mov    0x8(%rsp),%r8d
  mov    $0x0,%r9d
  mov    $0x0,%ecx
  jmp    L97
L28:
  cmp    $0x2,%edi
  jne    L105
  mov    %ecx,%eax
  cltd
  idiv   %esi
  movslq %edx,%rdx
  cmpl   $0x5,0xfb0(%rsp,%rdx,4)
  je     L57
L171:
  mov    %ecx,%eax
  cltd
  idiv   %esi
  movslq %edx,%rdx
  cmp    0xfb0(%rsp,%rdx,4),%edi
  je     L88
  sub    $0x1,%r9d
L88:
  add    $0x1,%ecx
  cmp    %r10d,%ecx
  je     L5
L97:
  mov    %ecx,%eax
  cltd
  idiv   %r8d
  movslq %edx,%rdx
  mov    0x10(%rsp,%rdx,4),%edi
  test   %edi,%edi
  jne    L28
  mov    %ecx,%eax
  cltd
  idiv   %esi
  movslq %edx,%rdx
  cmpl   $0x2,0xfb0(%rsp,%rdx,4)
  jne    L171
L57:
  add    $0x1,%r9d
  jmp    L88
L105:
  cmp    $0x5,%edi
  jne    L171
  mov    %ecx,%eax
  cltd
  idiv   %esi
  movslq %edx,%rdx
  cmpl   $0x0,0xfb0(%rsp,%rdx,4)
  jne    L171
  jmp    L57
L5:
  lea    D35(%rip),%rax
  test   %r9d,%r9d
  je     L173
  lea    D42(%rip),%rax
  lea    D43(%rip),%rdx
  cmovle %rdx,%rax
L173:
  mov    %rax,%rsi
  lea    D5(%rip),%rdi
  call   <printf@plt>
  mov    0x1f58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L145
  mov    $0x0,%eax
  add    $0x1f60,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L145:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D31
datatype: string
name: disassemble_data
arguments: data_label: D52
datatype: string
name: disassemble_data
arguments: data_label: D35
datatype: string
name: disassemble_data
arguments: data_label: D42
datatype: string
name: disassemble_data
arguments: data_label: D43
datatype: string
name: disassemble_data
arguments: data_label: D5
datatype: string

tool: D31: %i %i %i

tool: D52: %i

tool: D35: draw

tool: D42: A

tool: D43: B

tool: D5: %s

assistant: ```c
int main(int argc, char *argv[]) {
  int a[1000], b[1000], n, na, nb, i, ret = 0;
  scanf("%i %i %i", &n, &na, &nb);
  for (i = 0; i < na; i++)
    scanf("%i", &a[i]);
  for (i = 0; i < nb; i++)
    scanf("%i", &b[i]);
  for (i = 0; i < n; i++) {
    if (a[i % na] == 0 && b[i % nb] == 2 || a[i % na] == 2 && b[i % nb] == 5 || a[i % na] == 5 && b[i % nb] == 0) {
      ret++;
    } else if (a[i % na] != b[i % nb]) {
      ret--;
    }
  }
  printf("%s", ret ? ret > 0 ? "A" : "B" : "draw");
  return 0;
}
```