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

```asm
<BuildSampler>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %rdi,%r12
  xor    %edi,%edi
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    $0x1,%ebx
  sub    $0x28,%rsp
  test   %ebp,%ebp
  setne  %dil
  mov    %ebp,0x4(%rsp)
  mov    %rdx,0x8(%rsp)
  call   <assert@plt>
  test   %ebp,%ebp
  je     L79
  nopl   0x0(%rax)
L84:
  mov    %ebx,%eax
  mov    0x8(%rsp),%rsi
  pxor   %xmm3,%xmm3
  xor    %edi,%edi
  lea    (%r12,%rax,8),%r14
  movsd  (%r14),%xmm0
  mov    %ebx,(%rsi,%rax,4)
  mov    %ebx,0x0(%r13,%rax,4)
  comisd %xmm3,%xmm0
  setae  %dil
  add    $0x1,%ebx
  call   <assert@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %rbp,%xmm0
  mulsd  (%r14),%xmm0
  movsd  %xmm0,(%r14)
  cmp    %ebx,0x4(%rsp)
  jae    L84
L79:
  mov    0x4(%rsp),%eax
  mov    D43(%rip),%rdx
  xor    %r8d,%r8d
  movl   $0x0,0x0(%r13)
  movq   $0x0,(%r12)
  movsd  D34(%rip),%xmm0
  add    $0x1,%eax
  mov    %eax,0x0(%r13,%rax,4)
  mov    %rax,%rbx
  mov    %rdx,(%r12,%rax,8)
  nopl   0x0(%rax)
L128:
  lea    0x1(%r8),%eax
  lea    0x0(%r13,%rax,4),%r10
  mov    %rax,%r8
  mov    (%r10),%eax
  comisd (%r12,%rax,8),%xmm0
  mov    %rax,%r9
  ja     L128
  nopw   0x0(%rax,%rax,1)
L125:
  lea    -0x1(%rbx),%r14d
  mov    %ebx,%ebp
  lea    0x0(%r13,%r14,4),%rax
  mov    %r14,%rbx
  mov    (%rax),%edi
  movsd  (%r12,%rdi,8),%xmm1
  comisd %xmm0,%xmm1
  jae    L125
  cmp    %r14d,%r8d
  jae    L106
  mov    %edi,(%r10)
  mov    %r9d,(%rax)
  jmp    L128
  nopl   0x0(%rax)
L106:
  mov    %ebp,%r15d
  test   %r14d,%r14d
  jne    L131
  jmp    L100
  nopl   (%rax)
L18:
  lea    0x1(%rbp),%r15d
  mov    %r15,%rbp
L131:
  lea    0x0(%r13,%r15,4),%rcx
  mov    (%rcx),%eax
  comisd (%r12,%rax,8),%xmm0
  jae    L18
  xor    %edi,%edi
  comisd %xmm1,%xmm0
  lea    0x0(%r13,%r14,4),%rax
  mov    %rcx,0x10(%rsp)
  mov    %rax,0x18(%rsp)
  seta   %dil
  call   <assert@plt>
  cmp    %ebp,0x4(%rsp)
  jb     L100
  mov    $0x1,%edi
  call   <assert@plt>
  mov    0x10(%rsp),%rcx
  xor    %edi,%edi
  mov    (%rcx),%eax
  movsd  (%r12,%rax,8),%xmm1
  mov    D34(%rip),%rax
  movq   %rax,%xmm0
  comisd %xmm0,%xmm1
  seta   %dil
  call   <assert@plt>
  mov    0x10(%rsp),%rcx
  mov    0x8(%rsp),%rsi
  mov    D34(%rip),%rdx
  mov    (%rcx),%eax
  movq   %rdx,%xmm2
  movq   %rdx,%xmm0
  lea    (%r12,%rax,8),%r9
  mov    %rax,%rdi
  lea    0x0(%r13,%r14,4),%rax
  mov    (%rax),%eax
  movsd  (%r9),%xmm1
  subsd  (%r12,%rax,8),%xmm2
  subsd  %xmm2,%xmm1
  movsd  %xmm1,(%r9)
  mov    %edi,(%rsi,%rax,4)
  mov    (%rcx),%eax
  comisd (%r12,%rax,8),%xmm0
  ja     L63
  sub    $0x1,%ebx
  je     L100
  mov    %ebx,%r14d
L34:
  mov    0x0(%r13,%r14,4),%eax
  movsd  (%r12,%rax,8),%xmm1
  jmp    L131
  nopl   0x0(%rax)
L63:
  xor    %edi,%edi
  cmp    %ebx,%ebp
  lea    0x1(%rbp),%r15d
  seta   %dil
  mov    %r15,%rbp
  call   <assert@plt>
  mov    0x18(%rsp),%rdx
  mov    0x10(%rsp),%rcx
  mov    (%rdx),%eax
  mov    (%rcx),%edi
  mov    %edi,(%rdx)
  mov    %eax,(%rcx)
  mov    D34(%rip),%rax
  movq   %rax,%xmm0
  jmp    L34
  nopl   0x0(%rax)
L100:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: retrieve_data
arguments: label: D43
data_type: f64
name: retrieve_data
arguments: label: D34
data_type: f64

tool: D43: 2

tool: D34: 1

assistant: ```c
void BuildSampler(double *X, unsigned int N, unsigned int *A, unsigned int *B) {
  unsigned int i, j, k;
  assert(1 <= N);
  for (i = 1; i <= N; i++) {
    A[i] = i;
    B[i] = i;
    assert(X[i] >= 0.0);
    X[i] = X[i] * N;
  }
  B[0] = 0;
  X[0] = 0.0;
  B[N + 1] = N + 1;
  X[N + 1] = 2.0;
  i = 0;
  j = N + 1;
  for (;;) {
    do {
      i++;
    } while (X[B[i]] < 1.0);
    do {
      j--;
    } while (X[B[j]] >= 1.0);
    if (i >= j)
      break;
    k = B[i];
    B[i] = B[j];
    B[j] = k;
  }
  i = j;
  j++;
  while (i > 0) {
    while (X[B[j]] <= 1.0) {
      j++;
    }
    assert(X[B[i]] < 1.0);
    if (j > N)
      break;
    assert(j <= N);
    assert(X[B[j]] > 1.0);
    X[B[j]] -= 1.0 - X[B[i]];
    A[B[i]] = B[j];
    if (X[B[j]] < 1.0) {
      assert(i < j);
      k = B[i];
      B[i] = B[j];
      B[j] = k;
      j++;
    } else {
      i--;
    }
  }
}
```