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

```asm
<random_sample>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x38,%rsp
  mov    %rsi,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  cmp    %edx,%edi
  jg     L53
  mov    %edi,%r12d
  test   %edi,%edi
  jle    L53
  mov    %edx,%ebx
  cmp    %edx,%edi
  je     L136
  movslq %edi,%rax
  mov    %rsp,%rcx
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L151
L63:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L63
L151:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L3
L86:
  test   %r12d,%r12d
  mov    $0x1,%ecx
  mov    %rsp,%r13
  cmovg  %r12d,%ecx
  cmp    $0x3,%r12d
  jle    L93
  mov    %ecx,%edx
  movd   %ebx,%xmm1
  mov    %r13,%rax
  shr    $0x2,%edx
  pshufd $0x0,%xmm1,%xmm0
  shl    $0x4,%rdx
  add    %r13,%rdx
  nopl   0x0(%rax)
L129:
  movups %xmm0,(%rax)
  add    $0x10,%rax
  cmp    %rdx,%rax
  jne    L129
  mov    %ecx,%eax
  and    $0xfffffffc,%eax
  and    $0x3,%ecx
  je     L17
L158:
  movslq %eax,%rdx
  lea    0x1(%rax),%ecx
  lea    0x0(%r13,%rdx,4),%rdx
  mov    %ebx,(%rdx)
  cmp    %ecx,%r12d
  jle    L17
  add    $0x2,%eax
  mov    %ebx,0x4(%rdx)
  cmp    %eax,%r12d
  jle    L17
  mov    %ebx,0x8(%rdx)
L17:
  xor    %edi,%edi
  xor    %r15d,%r15d
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  mov    %r12d,%eax
  mov    %rax,-0x58(%rbp)
  cs nopw 0x0(%rax,%rax,1)
L156:
  xor    %eax,%eax
  call   <rand@plt>
  mov    %r13,%rsi
  cltd
  idiv   %ebx
  mov    %edx,%r14d
  mov    %r12d,%edx
  mov    %r14d,%edi
  call   <in_int_array@plt>
  cmp    $0x1,%eax
  je     L156
  mov    -0x48(%rbp),%rax
  movslq %r14d,%r8
  mov    %r14d,0x0(%r13,%r15,4)
  movsd  (%rax,%r8,8),%xmm0
  mov    -0x50(%rbp),%rax
  movsd  %xmm0,(%rax,%r15,8)
  add    $0x1,%r15
  cmp    -0x58(%rbp),%r15
  jne    L156
  xor    %eax,%eax
L112:
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L22
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  cs nopw 0x0(%rax,%rax,1)
L3:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L86
  nopl   0x0(%rax,%rax,1)
L136:
  lea    D6(%rip),%rdi
  call   <printf@plt>
  mov    -0x48(%rbp),%rsi
  mov    -0x50(%rbp),%rdi
  lea    0x0(,%r12,8),%edx
  call   <memcpy@plt>
  xor    %eax,%eax
  jmp    L112
L93:
  xor    %eax,%eax
  jmp    L158
L53:
  lea    D0(%rip),%rdi
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L112
L22:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D6
data_type: string
name: unpack_data
arguments: data_label: D0
data_type: string

tool: D6: INFO: k == arr_len, COPYING ORIGINAL ARRAY


tool: D0: ERROR: k > arr_len || k < 1, ABORTING


assistant: ```c
int random_sample(int k, double *arr, int arr_len, double *buf) {
  if (k > arr_len || k < 1) {
    printf("ERROR: k > arr_len || k < 1, ABORTING\n");
    return -1;
  }
  if (k == arr_len) {
    printf("INFO: k == arr_len, COPYING ORIGINAL ARRAY\n");
    memcpy(buf, arr, sizeof(double) * k);
    return 0;
  }
  int used_indexes[k];
  int random_index;
  for (int i = 0; i < k; i++) {
    used_indexes[i] = arr_len;
  }
  srand((unsigned)time(NULL));
  int i = 0;
  while (i < k) {
    random_index = rand() % arr_len;
    if (in_int_array(random_index, used_indexes, k) == 1) {
      continue;
    }
    *(used_indexes + i) = random_index;
    *(buf + i) = *(arr + random_index);
    i++;
  }
  return 0;
}
```