user: What would the C source look like for the assembly code provided here?

```asm
<foo>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    -0x8000(%rsp),%r11
L145:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L145
  sub    $0x50,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
L34:
  mov    -0x8038(%rbp),%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cmp    $0x2,%eax
  jne    L70
  addl   $0x1,-0x8038(%rbp)
L70:
  cmpl   $0x0,-0x8034(%rbp)
  je     L150
  mov    -0x8038(%rbp),%eax
  cmp    -0x8034(%rbp),%eax
  jg     L22
L150:
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x8038(%rbp),%xmm0
  movsd  %xmm0,-0x8028(%rbp)
  movl   $0x1,-0x803c(%rbp)
  mov    -0x803c(%rbp),%eax
  cltq
  movl   $0x0,-0x7ff0(%rbp,%rax,4)
  movl   $0x0,-0x8008(%rbp)
  jmp    L170
L26:
  mov    -0x8044(%rbp),%eax
  cltq
  movl   $0x0,-0x8000(%rbp,%rax,4)
  mov    -0x8044(%rbp),%eax
  cltq
  movl   $0x0,-0x8018(%rbp,%rax,4)
L90:
  pxor   %xmm0,%xmm0
  ucomisd -0x8020(%rbp),%xmm0
  jp     L151
  pxor   %xmm0,%xmm0
  ucomisd -0x8020(%rbp),%xmm0
  je     L54
L151:
  movsd  -0x8028(%rbp),%xmm0
  comisd -0x8020(%rbp),%xmm0
  ja     L26
  jmp    L54
L169:
  mov    -0x8044(%rbp),%eax
  cltq
  mov    -0x7ff0(%rbp,%rax,4),%edx
  mov    -0x8044(%rbp),%eax
  cltq
  mov    -0x8018(%rbp,%rax,4),%eax
  cmp    %eax,%edx
  jge    L108
  mov    -0x8044(%rbp),%eax
  cltq
  mov    -0x8008(%rbp,%rax,4),%edx
  mov    -0x803c(%rbp),%eax
  cltq
  mov    %edx,-0x7ff8(%rbp,%rax,4)
  mov    -0x803c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x803c(%rbp)
  cltq
  movl   $0x0,-0x8010(%rbp,%rax,4)
  jmp    L54
L108:
  mov    -0x8044(%rbp),%eax
  cltq
  mov    -0x7ff0(%rbp,%rax,4),%edx
  mov    -0x8040(%rbp),%eax
  cltq
  mov    -0x8018(%rbp,%rax,4),%eax
  cmp    %eax,%edx
  jle    L178
  mov    -0x8040(%rbp),%eax
  cltq
  mov    -0x8000(%rbp,%rax,4),%edx
  mov    -0x803c(%rbp),%eax
  cltq
  mov    %edx,-0x7ff8(%rbp,%rax,4)
  mov    -0x8040(%rbp),%edx
  lea    0x1(%rdx),%eax
  mov    %eax,-0x8040(%rbp)
  mov    -0x803c(%rbp),%eax
  lea    0x1(%rax),%ecx
  mov    %ecx,-0x803c(%rbp)
  movslq %edx,%rdx
  mov    -0x8018(%rbp,%rdx,4),%edx
  cltq
  mov    %edx,-0x8010(%rbp,%rax,4)
  jmp    L54
L178:
  mov    -0x8044(%rbp),%eax
  cltq
  mov    -0x8008(%rbp,%rax,4),%edx
  mov    -0x803c(%rbp),%eax
  cltq
  mov    %edx,-0x8000(%rbp,%rax,4)
  mov    -0x8044(%rbp),%edx
  lea    0x1(%rdx),%eax
  mov    %eax,-0x8044(%rbp)
  mov    -0x803c(%rbp),%eax
  lea    0x1(%rax),%ecx
  mov    %ecx,-0x803c(%rbp)
  movslq %edx,%rdx
  mov    -0x7ff0(%rbp,%rdx,4),%edx
  cltq
  mov    %edx,-0x8010(%rbp,%rax,4)
L54:
  mov    -0x8044(%rbp),%eax
  cltq
  mov    -0x7ff0(%rbp,%rax,4),%eax
  test   %eax,%eax
  je     L170
  mov    -0x8044(%rbp),%eax
  cltq
  mov    -0x8018(%rbp,%rax,4),%eax
  test   %eax,%eax
  jne    L169
L170:
  mov    -0x8030(%rbp),%eax
  cltd
  idivl  -0x802c(%rbp)
  mov    %edx,%eax
  test   %eax,%eax
  je     L90
  jmp    L34
L22:
  nop
  nop
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L63
  call   <__stack_chk_fail@plt>
L63:
  leave
  ret
```

assistant: ```c
foo() {
  int r0[8186];
  int r1[2];
  int r2[2];
  int bitm0[2];
  int bitm1[2];
  int bitm2[2];
  int i, j, k, m, n, m_max;
  int f;
  double fm, ft;
  while (1) {
    if (m % 4 == 2)
      ++m;
    if (m_max != 0 && m > m_max)
      break;
    fm = m;
    r0[k = 1] = 0;
    bitm0[0] = 0;
    while (n % f == 0) {
      while ((ft != 0) && (ft < fm)) {
        bitm1[i] = 0;
        r1[i] = 0;
      }
      while (r0[i] != 0 && r1[i] != 0) {
        if (r0[i] < r1[i]) {
          bitm2[k] = bitm0[i];
          r2[k++] = 0;
        } else if (r0[i] > r1[j]) {
          bitm2[k] = bitm1[j];
          r2[k++] = r1[j++];
        } else {
          bitm1[k] = bitm0[i];
          r2[k++] = r0[i++];
        }
      }
    }
  }
}
```