user: 请将以下的汇编代码转换成C语言代码：

```asm
<codegen>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x118,%rsp
  mov    %rdi,(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x2108(%rsp)
  movabs $0x600000005,%rax
  mov    %rax,0x80(%rsp)
  movabs $0x800000007,%rax
  mov    %rax,0x88(%rsp)
  movabs $0x1200000011,%rax
  mov    %rax,0x90(%rsp)
  movabs $0x8c0000008b,%rax
  mov    %rax,0x98(%rsp)
  movabs $0xfb0000008d,%rax
  mov    %rax,0xa0(%rsp)
  movabs $0xfe000000fc,%rax
  mov    %rax,0xa8(%rsp)
  movabs $0x100000000ff,%rax
  mov    %rax,0xb0(%rsp)
  movabs $0x10200000101,%rax
  mov    %rax,0xb8(%rsp)
  movabs $0x1d6000001d5,%rax
  mov    %rax,0xc0(%rsp)
  movabs $0x1d8000001d7,%rax
  mov    %rax,0xc8(%rsp)
  movabs $0x1da000001d9,%rax
  mov    %rax,0xd0(%rsp)
  movabs $0x200000001fd,%rax
  mov    %rax,0xd8(%rsp)
  movabs $0x20200000201,%rax
  mov    %rax,0xe0(%rsp)
  movabs $0x20400000203,%rax
  mov    %rax,0xe8(%rsp)
  movabs $0x35c0000035b,%rax
  mov    %rax,0xf0(%rsp)
  movabs $0x35e0000035d,%rax
  mov    %rax,0xf8(%rsp)
  lea    -0x1(%rsi),%eax
  mov    %eax,0x1c(%rsp)
  cmp    $0x1f,%eax
  ja     L20
  pcmpeqd %xmm0,%xmm0
  lea    0x20(%rsp),%r13
  lea    0x24(%rsp),%rdi
  xor    %ebp,%ebp
  lea    0x1100(%rsp),%rax
  movaps %xmm0,0x50(%rsp)
  lea    0x4c(%rsp),%r12
  mov    %rax,0x8(%rsp)
  lea    0x6c(%rsp),%rax
  lea    0x100(%rsp),%r15
  movq   $0xffffffffffffffff,0x70(%rsp)
  movq   $0xffffffffffffffff,0x40(%rsp)
  mov    %rax,0x10(%rsp)
  movaps %xmm0,0x60(%rsp)
  movaps %xmm0,0x20(%rsp)
  movaps %xmm0,0x30(%rsp)
  nopl   0x0(%rax)
L47:
  mov    0x54(%rsp),%ecx
  imul   0x58(%rsp),%ecx
  mov    $0x24,%edx
  imul   0x64(%rsp),%ecx
  mov    0x70(%rsp),%ebx
  imul   0x6c(%rsp),%ecx
  mov    0x44(%rsp),%r10d
  mov    0x74(%rsp),%eax
  mov    0x8(%rsp),%rsi
  mov    %r10d,(%r15,%rbp,1)
  imul   0x28(%rsp),%r10d
  imul   %ebx,%ecx
  mov    %eax,(%rsi,%rbp,1)
  mov    %r13,%rsi
  mov    %r10d,0x18(%rsp)
  imul   %eax,%ecx
  mov    %ecx,%r14d
  call   <memmove@plt>
  mov    0x18(%rsp),%r10d
  mov    %rax,%rdi
  mov    0x10(%rsp),%rax
  jmp    L53
  nopl   0x0(%rax)
L59:
  mov    (%rax),%ebx
  sub    $0x4,%rax
L53:
  mov    %ebx,0x8(%rax)
  cmp    %rax,%r12
  jne    L59
  add    $0x4,%rbp
  mov    %r10d,0x20(%rsp)
  mov    %r14d,0x50(%rsp)
  cmp    $0xffc,%rbp
  jne    L47
  movslq 0x1c(%rsp),%rax
  mov    $0x3ff,%esi
  xor    %ecx,%ecx
  mov    $0x1,%edi
  sub    0x80(%rsp,%rax,4),%esi
  nopl   0x0(%rax)
L46:
  lea    (%rsi,%rcx,1),%edx
  movslq %edx,%rax
  mov    %edx,%r8d
  imul   $0xffffffff80200803,%rax,%rax
  sar    $0x1f,%r8d
  shr    $0x20,%rax
  add    %edx,%eax
  sar    $0x9,%eax
  sub    %r8d,%eax
  mov    %eax,%r8d
  shl    $0xa,%r8d
  sub    %eax,%r8d
  sub    %r8d,%edx
  movslq %edx,%rdx
  mov    0x1100(%rsp,%rdx,4),%eax
  imul   (%r15,%rcx,4),%eax
  mov    %edi,%edx
  sub    %eax,%edx
  mov    %edx,%eax
  shr    $0x1f,%eax
  add    %edx,%eax
  mov    (%rsp),%rdx
  sar    %eax
  mov    %eax,(%rdx,%rcx,4)
  add    $0x1,%rcx
  cmp    $0x3ff,%rcx
  jne    L46
L20:
  mov    0x2108(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L49
  add    $0x2118,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L49:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void codegen(int *ca, int prn) {
  int delay[] = {5, 6, 7, 8, 17, 18, 139, 140, 141, 251, 252, 254, 255, 256, 257, 258, 469, 470, 471, 472, 473, 474, 509, 512, 513, 514, 515, 516, 859, 860, 861, 862};
  int g1[1023], g2[1023], r1[10], r2[10], c1, c2;
  int i, j;
  if (prn < 1 || prn > 32)
    return;
  for (i = 0; i < 10; i++)
    r1[i] = r2[i] = -1;
  for (i = 0; i < 1023; i++) {
    g1[i] = r1[9];
    g2[i] = r2[9];
    c1 = r1[2] * r1[9];
    c2 = r2[1] * r2[2] * r2[5] * r2[7] * r2[8] * r2[9];
    for (j = 9; j > 0; j--) {
      r1[j] = r1[j - 1];
      r2[j] = r2[j - 1];
    }
    r1[0] = c1;
    r2[0] = c2;
  }
  for (i = 0, j = 1023 - delay[prn - 1]; i < 1023; i++, j++)
    ca[i] = (1 - g1[i] * g2[j % 1023]) / 2;
  return;
}
```