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

```asm
<checkRecord>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x34(%rbp)
  movl   $0x3b9aca07,-0x20(%rbp)
  mov    -0x34(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  movl   $0x1,(%rax)
  mov    -0x18(%rbp),%rax
  add    $0x4,%rax
  movl   $0x2,(%rax)
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  movl   $0x4,(%rax)
  mov    -0x10(%rbp),%rax
  movl   $0x1,(%rax)
  mov    -0x8(%rbp),%rax
  movl   $0x1,(%rax)
  mov    -0x8(%rbp),%rax
  add    $0x4,%rax
  movl   $0x3,(%rax)
  movl   $0x1,-0x24(%rbp)
  jmp    L16
L11:
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  add    %edx,%eax
  cltd
  idivl  -0x20(%rbp)
  mov    %edx,%ecx
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %ecx,%eax
  mov    -0x24(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x10(%rbp),%rdx
  add    %rdx,%rcx
  cltd
  idivl  -0x20(%rbp)
  mov    %edx,%eax
  mov    %eax,(%rcx)
  cmpl   $0x1,-0x24(%rbp)
  jle    L19
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x8(%rax),%rcx
  mov    -0x10(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  add    %edx,%eax
  cltd
  idivl  -0x20(%rbp)
  mov    %edx,%esi
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rcx
  mov    -0x10(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  add    %edx,%eax
  cltd
  idivl  -0x20(%rbp)
  mov    %edx,%eax
  add    %esi,%eax
  mov    -0x24(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rdx,%rcx
  cltd
  idivl  -0x20(%rbp)
  mov    %edx,%eax
  mov    %eax,(%rcx)
  cmpl   $0x2,-0x24(%rbp)
  jle    L19
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0xc(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x8(%rax),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  add    %edx,%eax
  cltd
  idivl  -0x20(%rbp)
  mov    %edx,%ecx
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %ecx,%eax
  mov    -0x24(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x18(%rbp),%rdx
  add    %rdx,%rcx
  cltd
  idivl  -0x20(%rbp)
  mov    %edx,%eax
  mov    %eax,(%rcx)
L19:
  addl   $0x1,-0x24(%rbp)
L16:
  mov    -0x24(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L11
  mov    -0x34(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x34(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  add    %edx,%eax
  cltd
  idivl  -0x20(%rbp)
  mov    %edx,%ecx
  mov    -0x34(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %ecx,%eax
  cltd
  idivl  -0x20(%rbp)
  mov    %edx,-0x1c(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x1c(%rbp),%eax
  leave
  ret
```

assistant: ```c
int checkRecord(int n) {
  int t = 1000000007, *a, *p, *l, i, ret;
  a = (int *)malloc(3 * n * sizeof(int));
  p = a + n;
  l = p + n;
  a[0] = 1;
  a[1] = 2;
  a[2] = 4;
  p[0] = 1;
  l[0] = 1;
  l[1] = 3;
  for (i = 1; i < n; ++i) {
    p[i] = ((a[i - 1] + l[i - 1]) % t + p[i - 1]) % t;
    if (i > 1) {
      l[i] = ((a[i - 2] + p[i - 2]) % t + (a[i - 1] + p[i - 1]) % t) % t;
      if (i > 2)
        a[i] = ((a[i - 3] + a[i - 2]) % t + a[i - 1]) % t;
    }
  }
  ret = ((a[n - 1] + l[n - 1]) % t + p[n - 1]) % t;
  free(a);
  return ret;
}
```