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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xb0,%rsp
  mov    %edi,-0xa4(%rbp)
  mov    %rsi,-0xb0(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x9c(%rbp)
  mov    -0xa4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0xb0(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  lea    D83(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L79
  movl   $0x1,-0x9c(%rbp)
  subl   $0x1,-0xa4(%rbp)
L79:
  cmpl   $0x4,-0xa4(%rbp)
  je     L176
  cmpl   $0x5,-0xa4(%rbp)
  jne    L226
L176:
  mov    -0xb0(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %rax,-0x98(%rbp)
  mov    -0xb0(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %rax,-0x90(%rbp)
  mov    -0xb0(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%rax
  lea    -0x88(%rbp),%rdx
  lea    D50(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  je     L238
  mov    -0xb0(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%rax
  mov    %rax,%rsi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x3,%eax
  jmp    L10
L238:
  mov    -0x98(%rbp),%rax
  test   %rax,%rax
  js     L174
  mov    -0x90(%rbp),%rax
  test   %rax,%rax
  js     L174
  movsd  -0x88(%rbp),%xmm1
  pxor   %xmm0,%xmm0
  comisd %xmm1,%xmm0
  jbe    L294
L174:
  lea    D51(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x3,%eax
  jmp    L10
L294:
  mov    -0x98(%rbp),%rdx
  mov    -0x90(%rbp),%rax
  cmp    %rax,%rdx
  jle    L252
  lea    D143(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x3,%eax
  jmp    L10
L252:
  movsd  -0x88(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm1,%xmm0
  jp     L162
  pxor   %xmm1,%xmm1
  ucomisd %xmm1,%xmm0
  je     L9
L162:
  movsd  -0x88(%rbp),%xmm0
  movsd  D65(%rip),%xmm1
  comisd %xmm1,%xmm0
  jb     L196
L9:
  mov    -0xb0(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%rax
  mov    %rax,%rsi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x3,%eax
  jmp    L10
L196:
  cmpl   $0x4,-0xa4(%rbp)
  jne    L223
  mov    -0x88(%rbp),%rsi
  mov    -0x90(%rbp),%rcx
  mov    -0x98(%rbp),%rax
  mov    -0x9c(%rbp),%edx
  movq   %rsi,%xmm0
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <binom_2sided@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x80(%rbp)
  jmp    L22
L223:
  mov    -0xb0(%rbp),%rax
  add    $0x20,%rax
  mov    (%rax),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L306
  mov    -0xb0(%rbp),%rax
  add    $0x20,%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  cmp    $0x2b,%al
  je     L178
  mov    -0xb0(%rbp),%rax
  add    $0x20,%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  je     L178
L306:
  lea    D52(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x3,%eax
  jmp    L10
L178:
  cmpl   $0x0,-0x9c(%rbp)
  je     L69
  lea    D92(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x3,%eax
  jmp    L10
L69:
  mov    -0xb0(%rbp),%rax
  add    $0x20,%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  cmp    $0x2b,%al
  jne    L84
  movsd  -0x88(%rbp),%xmm1
  movsd  D65(%rip),%xmm0
  subsd  %xmm1,%xmm0
  movq   %xmm0,%rdx
  mov    -0x90(%rbp),%rax
  mov    -0x90(%rbp),%rcx
  mov    -0x98(%rbp),%rsi
  sub    %rsi,%rcx
  movq   %rdx,%xmm0
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <binom_1sided@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x80(%rbp)
  jmp    L22
L84:
  mov    -0x88(%rbp),%rcx
  mov    -0x90(%rbp),%rdx
  mov    -0x98(%rbp),%rax
  movq   %rcx,%xmm0
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <binom_1sided@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x80(%rbp)
L22:
  mov    -0x80(%rbp),%rax
  movq   %rax,%xmm0
  lea    D66(%rip),%rax
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  jmp    L10
L226:
  cmpl   $0x2,-0xa4(%rbp)
  je     L115
  lea    D145(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x1,%eax
  jmp    L10
L115:
  mov    -0xb0(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  lea    D55(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x78(%rbp)
  cmpq   $0x0,-0x78(%rbp)
  jne    L39
  lea    D38(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x2,%eax
  jmp    L10
L156:
  lea    -0x88(%rbp),%rdi
  lea    -0x90(%rbp),%rsi
  lea    -0x98(%rbp),%rcx
  lea    -0x70(%rbp),%rdx
  mov    -0x78(%rbp),%rax
  mov    %rdi,%r9
  mov    %rsi,%r8
  lea    D122(%rip),%rsi
  mov    %rax,%rdi
  call   <fscanf@plt>
  mov    -0x88(%rbp),%rsi
  mov    -0x90(%rbp),%rcx
  mov    -0x98(%rbp),%rax
  mov    -0x9c(%rbp),%edx
  movq   %rsi,%xmm0
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <binom_2sided@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x80(%rbp)
  mov    -0x80(%rbp),%rdx
  lea    -0x70(%rbp),%rax
  movq   %rdx,%xmm0
  mov    %rax,%rsi
  lea    D100(%rip),%rax
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <printf@plt>
L39:
  mov    -0x78(%rbp),%rax
  mov    %rax,%rdi
  call   <feof@plt>
  test   %eax,%eax
  je     L156
  mov    -0x78(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0x0,%eax
L10:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L288
  call   <__stack_chk_fail@plt>
L288:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D83
type_guessed: string
name: disassemble_data
arguments: data_tag: D50
type_guessed: string
name: disassemble_data
arguments: data_tag: D2
type_guessed: string
name: disassemble_data
arguments: data_tag: D51
type_guessed: string
name: disassemble_data
arguments: data_tag: D143
type_guessed: string
name: disassemble_data
arguments: data_tag: D65
type_guessed: byte[8]
name: disassemble_data
arguments: data_tag: D52
type_guessed: string
name: disassemble_data
arguments: data_tag: D92
type_guessed: string
name: disassemble_data
arguments: data_tag: D66
type_guessed: string
name: disassemble_data
arguments: data_tag: D145
type_guessed: string
name: disassemble_data
arguments: data_tag: D55
type_guessed: string
name: disassemble_data
arguments: data_tag: D38
type_guessed: string
name: disassemble_data
arguments: data_tag: D122
type_guessed: string
name: disassemble_data
arguments: data_tag: D100
type_guessed: string

tool: D83: midp

tool: D50: %lg

tool: D2: Error: Invalid expected success rate '%s'.


tool: D51: Error: Negative parameter.

tool: D143: Error: # successes > # observations.

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

tool: D52: Error: Invalid alternative hypothesis ('+' = more successes, '-' = fewer)

tool: D92: Error: 1-sided demo does not currently support mid-p adjustment.

tool: D66: P-value: %g


tool: D145: Binomial test    https://github.com/chrchang/stats
(C) 2013 Christopher Chang, GNU General Public License version 3

  binom_test [success ct] [total obs ct] [expected succ rate] <+ | - | midp>
  binom_test [filename]

If a filename is provided, each line of the file is expected to contain an ID
in the first column, and then 3 values (in succ-obs-rate order).

tool: D55: r

tool: D38: Error: Unable to open file.

tool: D122: %s %d %d %lg


tool: D100: P-value for %s: %g


assistant: ```c
int main(int argc, char **argv) {
  uint32_t midp = 0;
  FILE *test_file;
  int32_t succ;
  int32_t obs;
  double rate;
  double p_value;
  char name[100];
  if (!strcmp(argv[argc - 1], "midp")) {
    midp = 1;
    argc--;
  }
  if ((argc == 4) || (argc == 5)) {
    succ = atoi(argv[1]);
    obs = atoi(argv[2]);
    if (sscanf(argv[3], "%lg", &rate) != 1) {
      printf("Error: Invalid expected success rate '%s'.\n", argv[3]);
      return 3;
    }
    if ((succ < 0) || (obs < 0) || (rate < 0)) {
      printf("Error: Negative parameter.\n");
      return 3;
    } else if (succ > obs) {
      printf("Error: # successes > # observations.\n");
      return 3;
    } else if ((rate == 0) || (rate >= 1)) {
      printf("Error: Invalid expected success rate '%s'.\n", argv[3]);
      return 3;
    }
    if (argc == 4) {
      p_value = binom_2sided(succ, obs, rate, midp);
    } else {
      if (argv[4][1] || ((argv[4][0] != '+') && (argv[4][0] != '-'))) {
        printf("Error: Invalid alternative hypothesis ('+' = more successes, '-' = fewer)\n");
        return 3;
      }
      if (midp) {
        printf("Error: 1-sided demo does not currently support mid-p adjustment.\n");
        return 3;
      }
      if (argv[4][0] == '+') {
        p_value = binom_1sided(obs - succ, obs, 1 - rate);
      } else {
        p_value = binom_1sided(succ, obs, rate);
      }
    }
    printf("P-value: %g\n", p_value);
    return 0;
  } else if (argc != 2) {
    printf("Binomial test    https://github.com/chrchang/stats\n"
           "(C) 2013 Christopher Chang, GNU General Public License version 3\n\n"
           "  binom_test [success ct] [total obs ct] [expected succ rate] <+ | - | midp>\n"
           "  binom_test [filename]\n\n"
           "If a filename is provided, each line of the file is expected to contain an ID\n"
           "in the first column, and then 3 values (in succ-obs-rate order).\n");
    return 1;
  }
  test_file = fopen(argv[1], "r");
  if (!test_file) {
    printf("Error: Unable to open file.\n");
    return 2;
  }
  while (!feof(test_file)) {
    fscanf(test_file, "%s %d %d %lg\n", name, &succ, &obs, &rate);
    p_value = binom_2sided(succ, obs, rate, midp);
    printf("P-value for %s: %g\n", name, p_value);
  }
  fclose(test_file);
  return 0;
}
```