user: Please show me the C implementation that matches the assembly code listed below:

```asm
<startup>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x58,%rsp
  cmp    $0x2,%edi
  jle    L4
  movl   $0x0,0x4c(%rsp)
  cmp    $0x4,%edi
  je     L23
L57:
  mov    0x10(%rbx),%rdi
  call   <atoi@plt>
  mov    0x8(%rbx),%rdi
  mov    %eax,%r14d
  mov    %eax,0xc(%rsp)
  call   <atoi@plt>
  lea    0x0(,%r14,4),%ebp
  mov    $0x1,%edi
  mov    %eax,%ebx
  mov    %eax,0x48(%rsp)
  call   <srand@plt>
  mov    %ebp,%edi
  call   <malloc@plt>
  mov    %ebp,%edi
  mov    %rax,0x28(%rsp)
  call   <malloc@plt>
  mov    %ebp,%edi
  mov    %rax,0x30(%rsp)
  call   <malloc@plt>
  mov    %ebp,%edi
  lea    0x0(,%rbx,4),%ebp
  mov    %rax,0x40(%rsp)
  call   <malloc@plt>
  mov    %ebp,%edi
  mov    %rax,0x38(%rsp)
  call   <malloc@plt>
  mov    %ebp,%edi
  mov    %rax,0x10(%rsp)
  call   <malloc@plt>
  mov    %rax,0x18(%rsp)
  test   %ebx,%ebx
  je     L45
  mov    %rax,%rbx
  mov    0x48(%rsp),%eax
  mov    0x10(%rsp),%rsi
  sub    $0x1,%eax
  mov    %rsi,%r12
  sub    %rsi,%rbx
  lea    0x4(%rsi,%rax,4),%rbp
  nopl   0x0(%rax)
L71:
  xor    %eax,%eax
  call   <rand@plt>
  pxor   %xmm0,%xmm0
  movslq %eax,%rdx
  mov    %eax,%ecx
  imul   $0x10624dd3,%rdx,%rdx
  sar    $0x1f,%ecx
  sar    $0x26,%rdx
  sub    %ecx,%edx
  imul   $0x3e8,%edx,%edx
  sub    %edx,%eax
  cvtsi2ss %eax,%xmm0
  xor    %eax,%eax
  movss  %xmm0,(%r12)
  call   <rand@plt>
  pxor   %xmm0,%xmm0
  movslq %eax,%rdx
  mov    %eax,%ecx
  imul   $0x10624dd3,%rdx,%rdx
  sar    $0x1f,%ecx
  sar    $0x26,%rdx
  sub    %ecx,%edx
  imul   $0x3e8,%edx,%edx
  sub    %edx,%eax
  cvtsi2ss %eax,%xmm0
  movss  %xmm0,(%rbx,%r12,1)
  add    $0x4,%r12
  cmp    %rbp,%r12
  jne    L71
L45:
  mov    0xc(%rsp),%edx
  test   %edx,%edx
  je     L63
  mov    0x48(%rsp),%eax
  mov    0x10(%rsp),%rsi
  movl   $0x0,0x8(%rsp)
  sub    $0x1,%eax
  lea    0x4(%rsi,%rax,4),%r14
  mov    0x28(%rsp),%rsi
  mov    0x30(%rsp),%rax
  sub    %rsi,%rax
  mov    %rsi,%rbx
  mov    %rax,0x20(%rsp)
  nop
L79:
  mov    0x48(%rsp),%eax
  movl   $0x0,(%rbx)
  test   %eax,%eax
  je     L17
  mov    0x20(%rsp),%rax
  mov    0x18(%rsp),%rbp
  mov    0x8(%rsp),%r12d
  lea    (%rax,%rbx,1),%r13
  mov    0x10(%rsp),%rax
  mov    %rax,%r15
  sub    %rax,%rbp
  nopl   0x0(%rax)
L122:
  xor    %eax,%eax
  call   <rand@plt>
  mov    %eax,%r8d
  lea    0x0(%rbp,%r15,1),%rax
  and    $0x1,%r8d
  je     L118
  pxor   %xmm0,%xmm0
  movss  (%r15),%xmm1
  add    $0x4,%r15
  cvtsi2ss %r12,%xmm0
  mulss  (%rax),%xmm0
  movss  %xmm1,0x4(%rsp)
  call   <cos@plt>
  mulss  0x4(%rsp),%xmm0
  addss  (%rbx),%xmm0
  movss  %xmm0,(%rbx)
  movl   $0x0,0x0(%r13)
  cmp    %r14,%r15
  jne    L122
L17:
  mov    0x8(%rsp),%eax
  add    $0x4,%rbx
  add    $0x1,%eax
  cmp    %eax,0xc(%rsp)
  je     L157
  mov    %eax,0x8(%rsp)
  jmp    L79
  nopl   0x0(%rax,%rax,1)
L118:
  pxor   %xmm0,%xmm0
  movss  (%r15),%xmm2
  add    $0x4,%r15
  cvtsi2ss %r12,%xmm0
  mulss  (%rax),%xmm0
  movss  %xmm2,0x4(%rsp)
  call   <sin@plt>
  mulss  0x4(%rsp),%xmm0
  addss  (%rbx),%xmm0
  movss  %xmm0,(%rbx)
  movl   $0x0,0x0(%r13)
  cmp    %r15,%r14
  jne    L122
  jmp    L17
  nopw   0x0(%rax,%rax,1)
L157:
  mov    0x40(%rsp),%rbx
  mov    0x4c(%rsp),%esi
  lea    D23(%rip),%rbp
  mov    0x38(%rsp),%r9
  mov    0x30(%rsp),%rcx
  mov    0x28(%rsp),%rdx
  mov    0xc(%rsp),%edi
  mov    %rbx,%r8
  mov    %rbx,%r13
  call   <fft_float@plt>
  lea    D53(%rip),%rdi
  call   <puts@plt>
  mov    %rbx,%rax
  mov    0x8(%rsp),%ebx
  shl    $0x2,%rbx
  lea    0x4(%rax,%rbx,1),%r12
  nopw   0x0(%rax,%rax,1)
L168:
  pxor   %xmm0,%xmm0
  mov    %rbp,%rdi
  mov    $0x1,%eax
  add    $0x4,%r13
  cvtss2sd -0x4(%r13),%xmm0
  call   <printf@plt>
  cmp    %r13,%r12
  jne    L168
  mov    $0xa,%edi
  call   <putchar@plt>
  lea    D35(%rip),%rdi
  call   <puts@plt>
  mov    0x38(%rsp),%rax
  mov    %rax,%r12
  lea    0x4(%rax,%rbx,1),%rbx
  nopl   0x0(%rax,%rax,1)
L21:
  pxor   %xmm0,%xmm0
  mov    %rbp,%rdi
  mov    $0x1,%eax
  add    $0x4,%r12
  cvtss2sd -0x4(%r12),%xmm0
  call   <printf@plt>
  cmp    %rbx,%r12
  jne    L21
L91:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    0x28(%rsp),%rdi
  call   <free@plt>
  mov    0x30(%rsp),%rdi
  call   <free@plt>
  mov    0x40(%rsp),%rdi
  call   <free@plt>
  mov    0x38(%rsp),%rdi
  call   <free@plt>
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  mov    0x18(%rsp),%rdi
  call   <free@plt>
  add    $0x58,%rsp
  xor    %edi,%edi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    11c0 <exit@plt>
L4:
  lea    D71(%rip),%rdi
  call   <puts@plt>
  lea    D44(%rip),%rdi
  call   <puts@plt>
  lea    D78(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D45(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
  movl   $0x0,0x4c(%rsp)
  jmp    L57
L23:
  mov    0x18(%rsi),%rdi
  mov    $0x2,%edx
  lea    D32(%rip),%rsi
  call   <strncmp@plt>
  test   %eax,%eax
  sete   %al
  movzbl %al,%eax
  mov    %eax,0x4c(%rsp)
  jmp    L57
L63:
  mov    0x38(%rsp),%r9
  mov    0x40(%rsp),%r8
  xor    %edi,%edi
  mov    0x30(%rsp),%rcx
  mov    0x28(%rsp),%rdx
  mov    0x4c(%rsp),%esi
  call   <fft_float@plt>
  lea    D53(%rip),%rdi
  call   <puts@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  lea    D35(%rip),%rdi
  call   <puts@plt>
  jmp    L91
```

tool_calls: name: parse_data
arguments: data_label: D23
type: string
name: parse_data
arguments: data_label: D53
type: string
name: parse_data
arguments: data_label: D35
type: string
name: parse_data
arguments: data_label: D71
type: string
name: parse_data
arguments: data_label: D44
type: string
name: parse_data
arguments: data_label: D78
type: string
name: parse_data
arguments: data_label: D45
type: string
name: parse_data
arguments: data_label: D32
type: string

tool: D23: %f 	

tool: D53: RealOut:

tool: D35: ImagOut:

tool: D71: Usage: fft <waves> <length> -i

tool: D44: -i performs an inverse fft

tool: D78: make <waves> random sinusoids

tool: D45: <length> is the number of samples

tool: D32: -i

assistant: ```c
int startup(int argc, char *argv[]) {
  unsigned MAXSIZE;
  unsigned MAXWAVES;
  unsigned i, j;
  float *RealIn;
  float *ImagIn;
  float *RealOut;
  float *ImagOut;
  float *coeff;
  float *amp;
  int invfft = 0;
  if (argc < 3) {
    printf("Usage: fft <waves> <length> -i\n");
    printf("-i performs an inverse fft\n");
    printf("make <waves> random sinusoids");
    printf("<length> is the number of samples\n");
    exit(-1);
  } else if (argc == 4)
    invfft = !strncmp(argv[3], "-i", 2);
  MAXSIZE = atoi(argv[2]);
  MAXWAVES = atoi(argv[1]);
  srand(1);
  RealIn = (float *)malloc(sizeof(float) * MAXSIZE);
  ImagIn = (float *)malloc(sizeof(float) * MAXSIZE);
  RealOut = (float *)malloc(sizeof(float) * MAXSIZE);
  ImagOut = (float *)malloc(sizeof(float) * MAXSIZE);
  coeff = (float *)malloc(sizeof(float) * MAXWAVES);
  amp = (float *)malloc(sizeof(float) * MAXWAVES);
  for (i = 0; i < MAXWAVES; i++) {
    coeff[i] = rand() % 1000;
    amp[i] = rand() % 1000;
  }
  for (i = 0; i < MAXSIZE; i++) {
    RealIn[i] = 0;
    for (j = 0; j < MAXWAVES; j++) {
      if (rand() % 2) {
        RealIn[i] += coeff[j] * cos(amp[j] * i);
      } else {
        RealIn[i] += coeff[j] * sin(amp[j] * i);
      }
      ImagIn[i] = 0;
    }
  }
  fft_float(MAXSIZE, invfft, RealIn, ImagIn, RealOut, ImagOut);
  printf("RealOut:\n");
  for (i = 0; i < MAXSIZE; i++)
    printf("%f \t", RealOut[i]);
  printf("\n");
  printf("ImagOut:\n");
  for (i = 0; i < MAXSIZE; i++)
    printf("%f \t", ImagOut[i]);
  printf("\n");
  free(RealIn);
  free(ImagIn);
  free(RealOut);
  free(ImagOut);
  free(coeff);
  free(amp);
  exit(0);
}
```