user: Please show me the C implementation that matches the assembly code listed below:

```asm
<sieveBuildBig>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x48,%rsp
  mov    %rdx,0x20(%rsp)
  mov    %rcx,%rbx
  mov    %rdi,%rbp
  mov    %esi,%r12d
  mov    %rcx,0x18(%rsp)
  mov    %rdx,%r15
  mov    %r12,%r13
  mov    %r8d,0xc(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x1038(%rsp)
  xor    %eax,%eax
  call   <assert@plt>
  xor    %eax,%eax
  mov    %rbx,%rdi
  call   <bnLSWord@plt>
  test   $0x1,%al
  je     L114
  mov    %r15,%rdi
  xor    %eax,%eax
  call   <bnLSWord@plt>
  mov    $0xaa,%esi
  mov    %r12,%rdx
  mov    %rbp,%rdi
  and    $0x1,%eax
  mov    %eax,%ecx
  sar    %cl,%esi
  call   <memset@plt>
L55:
  lea    0x30(%rsp),%rdi
  mov    $0x1000,%esi
  xor    %eax,%eax
  mov    %rdi,0x28(%rsp)
  call   <sieveSmall@plt>
  movl   $0x0,0x14(%rsp)
  testb  $0x1,0x30(%rsp)
  jne    L110
  jmp    L104
  nopl   0x0(%rax)
L65:
  mov    0x20(%rsp),%rdi
  call   <bnModQ@plt>
  xor    %edi,%edi
  test   %eax,%eax
  setne  %dil
  xor    %eax,%eax
  call   <assert@plt>
L32:
  mov    0x14(%rsp),%edx
  mov    0x28(%rsp),%rdi
  mov    $0x1000,%esi
  xor    %eax,%eax
  call   <sieveSearch@plt>
  mov    %eax,0x14(%rsp)
  test   %eax,%eax
  je     L59
L110:
  mov    0x14(%rsp),%eax
  mov    0x18(%rsp),%rdi
  lea    0x1(%rax,%rax,1),%r14d
  xor    %eax,%eax
  mov    %r14d,%esi
  call   <bnModQ@plt>
  mov    %r14d,%esi
  test   %eax,%eax
  je     L65
  mov    0x18(%rsp),%rdi
  xor    %eax,%eax
  mov    %r14d,%ebx
  xor    %r15d,%r15d
  call   <bnModQ@plt>
  mov    %r14d,%esi
  mov    %eax,%edi
  xor    %eax,%eax
  call   <sieveModInvert@plt>
  mov    %eax,%r12d
  mov    %eax,%edi
  xor    %eax,%eax
  call   <assert@plt>
  mov    0x20(%rsp),%rdi
  mov    %r14d,%esi
  xor    %eax,%eax
  sub    %r12d,%ebx
  call   <bnModQ@plt>
  mov    %ebx,%edx
  mov    %r14d,%ecx
  mov    %r13d,%esi
  mov    %eax,%eax
  mov    %rbp,%rdi
  imul   %rdx,%rax
  xor    %edx,%edx
  div    %rcx
  mov    %r14d,%ecx
  xor    %eax,%eax
  mov    %edx,%r12d
  call   <sieveSingle@plt>
  mov    %r14d,%eax
  shr    %eax
  add    $0x1,%eax
  mov    %eax,0x10(%rsp)
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  je     L32
  mov    %r15d,%eax
  mov    %r14d,%r15d
  mov    %eax,%r14d
  jmp    L18
  nopl   0x0(%rax,%rax,1)
L97:
  mov    %r15d,%ecx
  mov    %r12d,%edx
  mov    %r13d,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  add    $0x1,%r14d
  call   <sieveSingle@plt>
  cmp    %r14d,0xc(%rsp)
  je     L32
L18:
  mov    %ebx,%edx
  mov    0x10(%rsp),%eax
  shr    %ebx
  and    $0x1,%edx
  add    %ebx,%eax
  test   %edx,%edx
  cmovne %eax,%ebx
  mov    %r12d,%eax
  xor    %edx,%edx
  add    %ebx,%eax
  setb   %dl
  mov    %eax,%r12d
  cmp    %eax,%r15d
  jbe    L46
  test   %edx,%edx
  je     L97
L46:
  sub    %r15d,%eax
  mov    %eax,%r12d
  jmp    L97
  nopw   0x0(%rax,%rax,1)
L59:
  mov    0x1038(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L80
  add    $0x1048,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L114:
  mov    %r12,%rdx
  mov    $0xff,%esi
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    0x20(%rsp),%rdi
  xor    %eax,%eax
  call   <bnLSWord@plt>
  and    $0x1,%eax
  mov    %eax,%edi
  xor    %eax,%eax
  call   <assert@plt>
  jmp    L55
L104:
  mov    0x28(%rsp),%rdi
  xor    %edx,%edx
  mov    $0x1000,%esi
  xor    %eax,%eax
  call   <sieveSearch@plt>
  mov    %eax,0x14(%rsp)
  jmp    L110
L80:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int sieveBuildBig(unsigned char *array, unsigned size, struct BigNum const *bn, struct BigNum const *step, unsigned dbl) {
  unsigned i, j;
  unsigned p;
  unsigned s;
  unsigned t;
  unsigned char small[(65536 / 16)];
  assert(array);
  if (bnLSWord(step) & 1) {
    s = bnLSWord(bn) & 1;
    memset(array, 0xAA >> s, size);
  } else {
    memset(array, 255, size);
    assert(bnLSWord(bn) & 1);
  }
  sieveSmall(small, (65536 / 16));
  i = (small[0] & 1) ? 0 : sieveSearch(small, (65536 / 16), 0);
  do {
    p = 2 * i + 1;
    t = bnModQ(step, p);
    if (!t) {
      assert(bnModQ(bn, p) != 0);
      continue;
    }
    t = sieveModInvert(bnModQ(step, p), p);
    assert(t);
    t = p - t;
    s = bnModQ(bn, p);
    s = (unsigned)(((unsigned long)s * t) % p);
    sieveSingle(array, size, s, p);
    for (j = 0; j < dbl; j++) {
      t = (t & 1) ? p / 2 + t / 2 + 1 : t / 2;
      s += t;
      if (s >= p || s < t)
        s -= p;
      sieveSingle(array, size, s, p);
    }
  } while ((i = sieveSearch(small, (65536 / 16), i)) != 0);
  return 0;
}
```