user: 请从给定的汇编指令推导出C源代码：

```asm
<test_pmfrand>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x28,%rsp
  mov    %rsi,%r12
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsp,-0x48(%rbp)
  cmp    $0x2,%edi
  jle    L125
  mov    %edi,%ebx
  mov    0x8(%rsi),%rdi
  call   <atoi@plt>
  mov    %eax,%r15d
  lea    0x1(%rax),%eax
  cmp    %ebx,%eax
  jge    L98
  movslq %r15d,%rax
  lea    0xf(,%rax,8),%rax
  mov    %rax,%rcx
  and    $0xfffffffffffffff0,%rcx
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rdx
  sub    %rax,%rdx
L12:
  cmp    %rdx,%rsp
  je     L71
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L12
L125:
  mov    (%rsi),%rsi
  lea    D19(%rip),%rdi
  call   <printf@plt>
L33:
  mov    -0x48(%rbp),%rsp
  jmp    L27
L98:
  mov    (%r12),%rsi
  lea    D19(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L33
L71:
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L57
  orq    $0x0,-0x8(%rsp,%rax,1)
L57:
  mov    %rsp,%r13
  test   %r15d,%r15d
  jle    L21
  mov    %r15d,%r14d
  mov    $0x0,%ebx
L43:
  mov    0x10(%r12,%rbx,8),%rdi
  call   <atof@plt>
  movsd  %xmm0,0x0(%r13,%rbx,8)
  add    $0x1,%rbx
  cmp    %r14,%rbx
  jne    L43
L21:
  lea    -0x9000(%rsp),%rax
L115:
  cmp    %rax,%rsp
  je     L173
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L115
L173:
  sub    $0xc40,%rsp
  orq    $0x0,0xc38(%rsp)
  mov    %rsp,%rbx
  mov    %rbx,%r12
  lea    0x9c40(%rbx),%r14
L16:
  mov    %r15d,%esi
  mov    %r13,%rdi
  call   <pmfrand@plt>
  mov    %eax,(%rbx)
  add    $0x4,%rbx
  cmp    %r14,%rbx
  jne    L16
  test   %r15d,%r15d
  jle    L37
  mov    %r13,%rax
  mov    %r15d,%edx
  lea    0x0(%r13,%rdx,8),%rdx
L75:
  movq   $0x0,(%rax)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L75
L37:
  movsd  D59(%rip),%xmm1
L23:
  movslq (%r12),%rax
  movapd %xmm1,%xmm0
  addsd  0x0(%r13,%rax,8),%xmm0
  movsd  %xmm0,0x0(%r13,%rax,8)
  add    $0x4,%r12
  cmp    %r14,%r12
  jne    L23
  mov    %r15d,%ecx
  mov    $0x0,%edx
  mov    %r13,%rsi
  mov    %r13,%rdi
  call   <mult@plt>
  lea    D40(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  test   %r15d,%r15d
  jle    L84
  mov    %r13,%rbx
  mov    %r15d,%r15d
  lea    0x0(%r13,%r15,8),%r13
  lea    D47(%rip),%r12
L121:
  movsd  (%rbx),%xmm0
  mov    %r12,%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  add    $0x8,%rbx
  cmp    %r13,%rbx
  jne    L121
L84:
  lea    D14(%rip),%rdi
  call   <puts@plt>
  mov    -0x48(%rbp),%rsp
L27:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L31
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L31:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D19
type: string
name: extract_symbolic_data
arguments: data_tag: D59
type: byte[8]
name: extract_symbolic_data
arguments: data_tag: D40
type: string
name: extract_symbolic_data
arguments: data_tag: D47
type: string
name: extract_symbolic_data
arguments: data_tag: D14
type: string

tool: D19: usage: %s <n> <w1> ... <wn>


tool: {"D59": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

tool: D40: w2 = [

tool: D47: %.2f, 

tool: D14: ]

assistant: ```c
void test_pmfrand(int argc, char *argv[]) {
  if (argc < 3) {
    printf("usage: %s <n> <w1> ... <wn>\n", argv[0]);
    return;
  }
  int n = atoi(argv[1]);
  if (argc < n + 2) {
    printf("usage: %s <n> <w1> ... <wn>\n", argv[0]);
    return;
  }
  int i;
  double w[n];
  for (i = 0; i < n; i++)
    w[i] = atof(argv[i + 2]);
  int nsamples = 10000;
  int x[nsamples];
  for (i = 0; i < nsamples; i++)
    x[i] = pmfrand(w, n);
  for (i = 0; i < n; i++)
    w[i] = 0;
  for (i = 0; i < nsamples; i++)
    w[x[i]]++;
  mult(w, w, 1 / (double)nsamples, n);
  printf("w2 = [");
  for (i = 0; i < n; i++)
    printf("%.2f, ", w[i]);
  printf("]\n");
}
```