user: What is the c source code of the assembly code below?

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  mov    %rsi,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x68,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  cmp    $0x2,%edi
  jle    L134
  mov    0x8(%rsi),%rdi
  lea    D55(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L26
L53:
  movq   $0x0,(%rsp)
  cmp    $0x3,%ebx
  jg     L21
L227:
  lea    0x30(%rsp),%rbx
  lea    0x4c(%rsp),%rdx
  mov    %rbp,%rdi
  xor    %eax,%eax
  lea    D1(%rip),%r13
  lea    D159(%rip),%rsi
  call   <fscanf@plt>
  mov    %rbx,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    %rbx,0x8(%rsp)
  lea    D46(%rip),%r12
  call   <fscanf@plt>
  lea    0x50(%rsp),%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fscanf@plt>
  lea    0x54(%rsp),%rax
  mov    %r13,%rsi
  mov    %rbp,%rdi
  mov    %rax,%rdx
  mov    %rax,0x10(%rsp)
  xor    %eax,%eax
  call   <fscanf@plt>
  mov    %rbx,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fscanf@plt>
  lea    0x24(%rsp),%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fscanf@plt>
  lea    0x26(%rsp),%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fscanf@plt>
  lea    0x38(%rsp),%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fscanf@plt>
  lea    0x40(%rsp),%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fscanf@plt>
  lea    0x28(%rsp),%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fscanf@plt>
  xor    %eax,%eax
  lea    0x2a(%rsp),%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <fscanf@plt>
  cmpq   $0x10,0x30(%rsp)
  je     L152
  xor    %r15d,%r15d
  lea    0x2c(%rsp),%r12
  lea    D96(%rip),%rbx
  nopw   0x0(%rax,%rax,1)
L46:
  mov    %r12,%rdx
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fscanf@plt>
  mov    0x30(%rsp),%rax
  add    $0x1,%r15
  sub    $0x10,%rax
  cmp    %r15,%rax
  ja     L46
L152:
  mov    0x10(%rsp),%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fscanf@plt>
  mov    0x8(%rsp),%rdx
  xor    %eax,%eax
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <fscanf@plt>
  cmpq   $0x0,(%rsp)
  jne    L110
  mov    0x38(%rsp),%rax
  mov    %rax,(%rsp)
L202:
  mov    0x10(%r14),%rdi
  lea    D135(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L258
L48:
  movzwl 0x2a(%rsp),%eax
  movswl 0x26(%rsp),%ecx
  test   %ax,%ax
  lea    0x7(%rax),%ebx
  cmovns %eax,%ebx
  mov    0x30(%rsp),%rax
  xor    %edx,%edx
  sar    $0x3,%bx
  movswl %bx,%ebx
  imul   %ebx,%ecx
  movslq %ecx,%rcx
  div    %rcx
  mov    0x38(%rsp),%rdx
  test   %rdx,%rdx
  js     L39
  pxor   %xmm1,%xmm1
  cvtsi2sd %rdx,%xmm1
L140:
  mov    (%rsp),%rcx
  test   %rcx,%rcx
  js     L177
  pxor   %xmm0,%xmm0
  cvtsi2sd %rcx,%xmm0
L185:
  divsd  %xmm0,%xmm1
  pxor   %xmm7,%xmm7
  cvtsi2sd %eax,%xmm7
  movq   %xmm7,%r13
  movsd  %xmm1,0x10(%rsp)
  test   %eax,%eax
  jle    L75
  pxor   %xmm2,%xmm2
  lea    0x23(%rsp),%r14
  movapd %xmm2,%xmm1
  movsd  %xmm2,0x18(%rsp)
  movapd %xmm2,%xmm3
  nopl   0x0(%rax,%rax,1)
L40:
  addsd  0x10(%rsp),%xmm1
  pxor   %xmm7,%xmm7
  comisd %xmm7,%xmm1
  ja     L184
  jmp    L31
  nopw   0x0(%rax,%rax,1)
L249:
  addsd  %xmm0,%xmm3
L91:
  subsd  D49(%rip),%xmm1
  pxor   %xmm4,%xmm4
  comisd %xmm4,%xmm1
  jbe    L31
L184:
  movswl 0x26(%rsp),%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  movsd  %xmm1,0x8(%rsp)
  movsd  %xmm3,(%rsp)
  call   <nextSample@plt>
  movsd  0x8(%rsp),%xmm1
  movsd  (%rsp),%xmm3
  comisd D49(%rip),%xmm1
  movapd %xmm0,%xmm2
  jae    L249
  mulsd  %xmm1,%xmm0
  addsd  %xmm0,%xmm3
  jmp    L91
  nopl   0x0(%rax,%rax,1)
L31:
  divsd  0x10(%rsp),%xmm3
  movapd %xmm3,%xmm0
  movsd  %xmm1,0x8(%rsp)
  movsd  %xmm2,(%rsp)
  call   <round@plt>
  mov    %r12,%rcx
  mov    $0x1,%edx
  mov    %r14,%rdi
  mov    $0x1,%esi
  mov    %al,0x23(%rsp)
  call   <fwrite@plt>
  movsd  0x18(%rsp),%xmm5
  movq   %r13,%xmm6
  addsd  0x10(%rsp),%xmm5
  movsd  (%rsp),%xmm2
  movsd  0x8(%rsp),%xmm1
  comisd %xmm5,%xmm6
  movsd  %xmm5,0x18(%rsp)
  jbe    L75
  pxor   %xmm7,%xmm7
  pxor   %xmm3,%xmm3
  comisd %xmm1,%xmm7
  jbe    L40
  movapd %xmm1,%xmm0
  movapd %xmm7,%xmm3
  mulsd  %xmm2,%xmm0
  subsd  %xmm0,%xmm3
  jmp    L40
  nopw   0x0(%rax,%rax,1)
L75:
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L151
  add    $0x68,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L110:
  mov    0x38(%rsp),%rdx
  mov    (%rsp),%rax
  cmp    %rax,%rdx
  jae    L202
  mov    %rax,%rsi
  lea    D79(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D92(%rip),%rdi
  call   <puts@plt>
  mov    $0x4,%edi
  call   <exit@plt>
  jmp    L202
L21:
  mov    0x18(%r14),%rdi
  call   <atoi@plt>
  mov    %rax,(%rsp)
  jmp    L227
L177:
  mov    (%rsp),%rsi
  pxor   %xmm0,%xmm0
  mov    %rsi,%rcx
  and    $0x1,%esi
  shr    %rcx
  or     %rsi,%rcx
  cvtsi2sd %rcx,%xmm0
  addsd  %xmm0,%xmm0
  jmp    L185
L39:
  mov    %rdx,%rcx
  and    $0x1,%edx
  pxor   %xmm1,%xmm1
  shr    %rcx
  or     %rdx,%rcx
  cvtsi2sd %rcx,%xmm1
  addsd  %xmm1,%xmm1
  jmp    L140
L134:
  lea    D15(%rip),%rdi
  call   <puts@plt>
  lea    D140(%rip),%rdi
  call   <puts@plt>
  lea    D119(%rip),%rdi
  call   <puts@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  lea    D93(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  mov    0x8(%r14),%rdi
  lea    D55(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L26
  movq   $0x0,(%rsp)
  jmp    L227
L26:
  mov    0x8(%r14),%rsi
  lea    D73(%rip),%rdi
  xor    %eax,%eax
  xor    %ebp,%ebp
  call   <printf@plt>
  mov    $0x2,%edi
  call   <exit@plt>
  jmp    L53
L258:
  mov    0x10(%r14),%rsi
  lea    D58(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x3,%edi
  call   <exit@plt>
  jmp    L48
L151:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D55
type: string
name: parse_data
arguments: data_tag: D1
type: string
name: parse_data
arguments: data_tag: D159
type: string
name: parse_data
arguments: data_tag: D46
type: string
name: parse_data
arguments: data_tag: D96
type: string
name: parse_data
arguments: data_tag: D135
type: string
name: parse_data
arguments: data_tag: D49
type: f32
name: parse_data
arguments: data_tag: D79
type: string
name: parse_data
arguments: data_tag: D92
type: string
name: parse_data
arguments: data_tag: D15
type: string
name: parse_data
arguments: data_tag: D140
type: string
name: parse_data
arguments: data_tag: D119
type: string
name: parse_data
arguments: data_tag: D93
type: string
name: parse_data
arguments: data_tag: D73
type: string
name: parse_data
arguments: data_tag: D58
type: string

tool: D55: rb

tool: D1: %4c

tool: D159: %4s

tool: D46: %2c

tool: D96: %1c

tool: D135: w

tool: D49: 0

tool: D79: Output rate (%ld) cannot be above input rate (%ld)


tool: D92: Use lower output rate value or higher input rate file

tool: D15: Usage: wav2raw sourceWavFile destRawFile <outRate>

tool: D140: Output rate is given in Hand should be <= to the input sample sample.

tool: D119: Success returns errorlevel 0. Error return greater than zero.

tool: D93: Ex: wav2raw input.wav output.raw 11025

tool: D73: The source file %s was not opened


tool: D58: The output file %s was not opened


assistant: ```c
int main(int argc, char *argv[]) {
  FILE *infile, *outfile;
  char prefix[4];
  char fileFormat[4];
  char ckID[4];
  unsigned long nChunkSize;
  short wFormatTag;
  short nChannels;
  unsigned long nSamplesPerSecond;
  unsigned long nBytesPerSecond;
  unsigned long nOutputSamplesPerSecond;
  short nBlockAlign;
  short nBitsPerSample;
  int i, j;
  if (argc < 3) {
    printf("Usage: wav2raw sourceWavFile destRawFile <outRate>\n");
    printf("Output rate is given in Hand should be <= to the input sample sample.\n");
    printf("Success returns errorlevel 0. Error return greater than zero.\n");
    printf("\n");
    printf("Ex: wav2raw input.wav output.raw 11025\n");
    exit(1);
  }
  if ((infile = fopen(argv[1], "rb")) == NULL) {
    printf("The source file %s was not opened\n", argv[1]);
    exit(2);
  }
  if (argc > 3)
    nOutputSamplesPerSecond = atoi(argv[3]);
  else
    nOutputSamplesPerSecond = 0;
  fscanf(infile, "%4s", prefix);
  fscanf(infile, "%4c", &nChunkSize);
  fscanf(infile, "%4c", fileFormat);
  fscanf(infile, "%4c", ckID);
  fscanf(infile, "%4c", &nChunkSize);
  fscanf(infile, "%2c", &wFormatTag);
  fscanf(infile, "%2c", &nChannels);
  fscanf(infile, "%4c", &nSamplesPerSecond);
  fscanf(infile, "%4c", &nBytesPerSecond);
  fscanf(infile, "%2c", &nBlockAlign);
  fscanf(infile, "%2c", &nBitsPerSample);
  for (i = 0; i < nChunkSize - 0x10; i++)
    fscanf(infile, "%1c", &j);
  fscanf(infile, "%4c", ckID);
  fscanf(infile, "%4c", &nChunkSize);
  if (nOutputSamplesPerSecond == 0)
    nOutputSamplesPerSecond = nSamplesPerSecond;
  if (nSamplesPerSecond < nOutputSamplesPerSecond) {
    printf("Output rate (%ld) cannot be above input rate (%ld)\n", nOutputSamplesPerSecond, nSamplesPerSecond);
    printf("Use lower output rate value or higher input rate file\n");
    exit(4);
  }
  if ((outfile = fopen(argv[2], "w")) == NULL) {
    printf("The output file %s was not opened\n", argv[2]);
    exit(3);
  }
  int nBytesPerSample = nBitsPerSample / 8;
  int size = nChunkSize / (nChannels * nBytesPerSample);
  double offset;
  double step;
  double value;
  double lastSample;
  step = nSamplesPerSecond;
  step /= nOutputSamplesPerSecond;
  value = 0;
  lastSample = 0;
  for (offset = 0; offset < size; offset += step) {
    char byte;
    double sample = 0;
    if (value < 0)
      sample += lastSample * -value;
    value += step;
    while (value > 0) {
      lastSample = nextSample(infile, nBytesPerSample, nChannels);
      if (value >= 1)
        sample += lastSample;
      else
        sample += lastSample * value;
      value--;
    }
    sample /= step;
    byte = round(sample);
    fwrite(&byte, 1, 1, outfile);
  }
  fclose(infile);
  fclose(outfile);
  return 0;
}
```