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

```asm
<main>:
  endbr64
  push   %r15
  lea    D21(%rip),%rdi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  lea    D19(%rip),%rbp
  push   %rbx
  sub    $0xb68,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xb58(%rsp)
  xor    %eax,%eax
  call   <printf@plt>
  xor    %eax,%eax
  lea    0x44(%rsp),%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  cmp    $0x1,%eax
  je     L69
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L69:
  lea    D11(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %eax,%eax
  lea    0x48(%rsp),%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  cmp    $0x1,%eax
  je     L26
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L26:
  mov    0x48(%rsp),%edx
  test   %edx,%edx
  jle    L107
  lea    0x510(%rsp),%rax
  lea    0x5c(%rsp),%r13
  xor    %r14d,%r14d
  mov    %rax,0x10(%rsp)
  lea    0x1f0(%rsp),%rax
  lea    0x58(%rsp),%r12
  mov    %rax,0x8(%rsp)
  lea    0x830(%rsp),%rax
  lea    0x60(%rsp),%rbx
  mov    %rax,0x18(%rsp)
  mov    %r13,%rax
  lea    D59(%rip),%r15
  mov    %r12,%r13
  lea    D64(%rip),%rbp
  mov    %r14,%r12
  mov    %rax,%r14
  nopl   0x0(%rax,%rax,1)
L38:
  mov    %r12d,%esi
  mov    %r15,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x10(%rsp),%rdx
  mov    %r14,%rcx
  mov    %rbx,%rsi
  lea    0x0(,%r12,8),%rax
  mov    %rbp,%rdi
  lea    (%rdx,%rax,1),%r9
  mov    0x8(%rsp),%rdx
  lea    (%rdx,%rax,1),%r8
  xor    %eax,%eax
  mov    %r13,%rdx
  call   <scanf@plt>
  cmp    $0x5,%eax
  je     L2
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L2:
  mov    0x58(%rsp),%edx
  mov    0x5c(%rsp),%eax
  pxor   %xmm0,%xmm0
  add    $0x4,%rbx
  imul   %edx,%eax
  add    %edx,%eax
  cvtsi2sd %eax,%xmm0
  mulsd  D67(%rip),%xmm0
  mov    0x18(%rsp),%rax
  movsd  %xmm0,(%rax,%r12,8)
  add    $0x1,%r12
  cmp    %r12d,0x48(%rsp)
  jg     L38
L107:
  lea    0x3c(%rsp),%rax
  mov    %rax,0x20(%rsp)
  lea    0x40(%rsp),%rax
  mov    %rax,0x28(%rsp)
  nopw   0x0(%rax,%rax,1)
L80:
  lea    D35(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x20(%rsp),%rdi
  call   <get_stat@plt>
  test   %eax,%eax
  je     L79
  mov    0x28(%rsp),%rdi
  call   <get_stat@plt>
  test   %eax,%eax
  jne    L75
L79:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L75:
  mov    0x3c(%rsp),%eax
  or     0x40(%rsp),%eax
  je     L16
  lea    D47(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D5(%rip),%rdi
  call   <puts@plt>
  mov    0x48(%rsp),%eax
  test   %eax,%eax
  jle    L118
  lea    0x510(%rsp),%rax
  lea    0x60(%rsp),%r12
  xor    %r14d,%r14d
  mov    %rax,0x18(%rsp)
  lea    0x54(%rsp),%r15
  lea    0x50(%rsp),%rbp
  lea    0x830(%rsp),%rax
  lea    0x4c(%rsp),%rbx
  mov    %rax,0x10(%rsp)
  mov    %r12,%rax
  lea    0x1f0(%rsp),%r13
  mov    %rbp,%r12
  mov    %rbx,%rbp
  mov    %r15,%rbx
  mov    %rax,%r15
  nopw   0x0(%rax,%rax,1)
L81:
  mov    (%r15,%r14,4),%edi
  mov    0x40(%rsp),%edx
  mov    %rbx,%r9
  mov    %r12,%r8
  mov    0x3c(%rsp),%esi
  mov    %rbp,%rcx
  call   <attack_blows@plt>
  mov    0x10(%rsp),%rax
  pxor   %xmm0,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sdl 0x50(%rsp),%xmm0
  mov    (%r15,%r14,4),%edi
  mov    0x44(%rsp),%esi
  mulsd  (%rax,%r14,8),%xmm0
  cvttsd2si %xmm0,%eax
  movsd  0x0(%r13,%r14,8),%xmm0
  cvtsi2sd %eax,%xmm1
  movsd  %xmm1,0x8(%rsp)
  call   <critical_blow@plt>
  mov    0x50(%rsp),%ecx
  pxor   %xmm2,%xmm2
  mov    %r14d,%esi
  mov    0x18(%rsp),%rax
  movsd  0x8(%rsp),%xmm1
  movapd %xmm0,%xmm3
  lea    D49(%rip),%rdi
  cvtsi2sd %ecx,%xmm2
  mov    0x54(%rsp),%r8d
  mov    0x4c(%rsp),%edx
  mulsd  (%rax,%r14,8),%xmm2
  mov    $0x2,%eax
  add    $0x1,%r14
  addsd  %xmm2,%xmm1
  addsd  %xmm3,%xmm2
  movapd %xmm1,%xmm0
  movapd %xmm2,%xmm1
  call   <printf@plt>
  cmp    %r14d,0x48(%rsp)
  jg     L81
L118:
  mov    $0xa,%edi
  call   <putchar@plt>
  jmp    L80
  nopl   0x0(%rax)
L16:
  mov    0xb58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L24
  add    $0xb68,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L24:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D21
type: string
name: disassemble_data
arguments: data_label: D19
type: string
name: disassemble_data
arguments: data_label: D11
type: string
name: disassemble_data
arguments: data_label: D59
type: string
name: disassemble_data
arguments: data_label: D64
type: string
name: disassemble_data
arguments: data_label: D67
type: byte[8]
name: disassemble_data
arguments: data_label: D35
type: string
name: disassemble_data
arguments: data_label: D47
type: string
name: disassemble_data
arguments: data_label: D5
type: string
name: disassemble_data
arguments: data_label: D49
type: string

tool: D21: Enter level of your character: 

tool: D19:  %d

tool: D11: Enter number of weapons: 

tool: D59: Enter weight, weapon_dam, to_hit, to_dam for weapon #%d: 

tool: D64:  %d %dd%d %lf %lf

tool: {"D67": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

tool: D35: Enter cstr, cdex: 

tool: D47:   Weapon | Max blows | Blows | weight ratio | hp of dam |

tool: D5:  w/ critical |

tool: D49:   %4d   | %6d    | %4d  | %8d     | %6g    |  %7g    |


assistant: ```c
int main() {
  int cstr, cdex, player_level;
  int weight[100];
  double to_hit[100], to_dam[100], weapon_dam[100];
  int num_weapons, i;
  int max_blows, real_blows;
  int adj_weight;
  double avg_dam, critical;
  int num_die, die_sides;
  printf("Enter level of your character: ");
  if (1 != scanf(" %d", &player_level)) {
    putchar('\n');
    exit(1);
  }
  printf("Enter number of weapons: ");
  if (1 != scanf(" %d", &num_weapons)) {
    putchar('\n');
    exit(1);
  }
  for (i = 0; i < num_weapons; i++) {
    printf("Enter weight, weapon_dam, to_hit, to_dam for weapon #%d: ", i);
    if (5 != scanf(" %d %dd%d %lf %lf", &weight[i], &num_die, &die_sides, &to_hit[i], &to_dam[i])) {
      putchar('\n');
      exit(1);
    }
    weapon_dam[i] = (num_die * die_sides + num_die) / 2.;
  }
  while (1) {
    printf("Enter cstr, cdex: ");
    if (!get_stat(&cstr) || !get_stat(&cdex)) {
      putchar('\n');
      exit(1);
    }
    if (cstr == 0 && cdex == 0)
      break;
    printf("  Weapon | Max blows | Blows | weight ratio | hp of dam |");
    printf(" w/ critical |\n");
    for (i = 0; i < num_weapons; i++) {
      attack_blows(weight[i], cstr, cdex, &max_blows, &real_blows, &adj_weight);
      avg_dam = (int)(real_blows * weapon_dam[i]);
      critical = critical_blow(weight[i], to_hit[i], avg_dam, player_level);
      avg_dam += (int)real_blows * to_dam[i];
      critical += (int)real_blows * to_dam[i];
      printf("  %4d   | %6d    | %4d  | %8d     | %6g    |  %7g    |\n", i, max_blows, real_blows, adj_weight, avg_dam, critical);
    }
    printf("\n");
  }
  return (0);
}
```