user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<test_pmfrand>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsp,-0x50(%rbp)
  cmp    $0x2,%edi
  jle    L134
  mov    %edi,%ebx
  mov    0x8(%rsi),%rdi
  call   <atoi@plt>
  mov    %eax,%r13d
  lea    0x1(%rax),%eax
  cmp    %ebx,%eax
  jge    L106
  movslq %r13d,%rax
  mov    %rsp,%rcx
  mov    %rax,-0x48(%rbp)
  lea    0xf(,%rax,8),%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L142
L162:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L162
L142:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  je     L27
  orq    $0x0,-0x8(%rsp,%rdx,1)
L27:
  mov    %rsp,%r15
  test   %r13d,%r13d
  jle    L40
  xor    %ebx,%ebx
  nopw   0x0(%rax,%rax,1)
L24:
  mov    0x10(%r12,%rbx,8),%rdi
  call   <atof@plt>
  movsd  %xmm0,(%r15,%rbx,8)
  add    $0x1,%rbx
  cmp    -0x48(%rbp),%rbx
  jne    L24
L40:
  lea    -0x9000(%rsp),%rax
  cmp    %rax,%rsp
  je     L45
L13:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rax,%rsp
  jne    L13
L45:
  sub    $0xc40,%rsp
  orq    $0x0,0xc38(%rsp)
  mov    %rsp,%rbx
  lea    0x9c40(%rbx),%r12
  mov    %rbx,%r14
  nopl   0x0(%rax)
L130:
  mov    %r13d,%esi
  mov    %r15,%rdi
  add    $0x4,%r14
  call   <pmfrand@plt>
  mov    %eax,-0x4(%r14)
  cmp    %r12,%r14
  jne    L130
  test   %r13d,%r13d
  jle    L56
  mov    -0x48(%rbp),%rdx
  xor    %esi,%esi
  mov    %r15,%rdi
  shl    $0x3,%rdx
  call   <memset@plt>
L56:
  movsd  D36(%rip),%xmm1
  nopw   0x0(%rax,%rax,1)
L100:
  movslq (%rbx),%rax
  add    $0x4,%rbx
  movsd  (%r15,%rax,8),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%r15,%rax,8)
  cmp    %r12,%rbx
  jne    L100
  xor    %edx,%edx
  mov    %r15,%rdi
  mov    %r13d,%ecx
  mov    %r15,%rsi
  call   <mult@plt>
  xor    %eax,%eax
  lea    D30(%rip),%rdi
  call   <printf@plt>
  test   %r13d,%r13d
  jle    L145
  mov    %r13d,%r13d
  mov    %r15,%rbx
  lea    D8(%rip),%r12
  lea    (%r15,%r13,8),%r13
L6:
  movsd  (%rbx),%xmm0
  mov    %r12,%rdi
  mov    $0x1,%eax
  add    $0x8,%rbx
  call   <printf@plt>
  cmp    %r13,%rbx
  jne    L6
L145:
  lea    D26(%rip),%rdi
  call   <puts@plt>
  mov    -0x50(%rbp),%rsp
  jmp    L34
L134:
  mov    (%rsi),%rsi
  lea    D19(%rip),%rdi
  call   <printf@plt>
L84:
  mov    -0x50(%rbp),%rsp
L34:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L140
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L106:
  mov    (%r12),%rsi
  lea    D19(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L84
L140:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D36
type_guessed: byte[8]
name: unpack_data
arguments: tag: D30
type_guessed: string
name: unpack_data
arguments: tag: D8
type_guessed: string
name: unpack_data
arguments: tag: D26
type_guessed: string
name: unpack_data
arguments: tag: D19
type_guessed: string

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

tool: D30: w2 = [

tool: D8: %.2f, 

tool: D26: ]

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


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");
}
```