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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x1,-0x24(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  lea    D70(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    -0x28(%rbp),%rcx
  lea    -0x18(%rbp),%rdx
  lea    -0x20(%rbp),%rax
  mov    %rax,%rsi
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  cmpl   $0x2,-0x34(%rbp)
  jne    L0
  mov    -0x40(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    $0xa,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <strtol@plt>
  mov    %eax,-0x24(%rbp)
L0:
  mov    -0x28(%rbp),%edx
  movsd  -0x18(%rbp),%xmm0
  mov    -0x20(%rbp),%rax
  lea    -0x10(%rbp),%rcx
  mov    %rcx,%rsi
  mov    %edx,%edi
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <trap@plt>
  mov    -0x28(%rbp),%eax
  mov    %eax,%esi
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movsd  -0x10(%rbp),%xmm1
  movsd  -0x18(%rbp),%xmm0
  mov    -0x20(%rbp),%rax
  movapd %xmm1,%xmm2
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  lea    D61(%rip),%rax
  mov    %rax,%rdi
  mov    $0x3,%eax
  call   <printf@plt>
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  mov    -0x28(%rbp),%edx
  movsd  -0x18(%rbp),%xmm0
  mov    -0x20(%rbp),%rax
  mov    %edx,%edi
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <local_trap@plt>
  pxor   %xmm1,%xmm1
  cvtsi2sd %rax,%xmm1
  movsd  -0x10(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    -0x28(%rbp),%eax
  mov    %eax,%esi
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movsd  -0x10(%rbp),%xmm1
  movsd  -0x18(%rbp),%xmm0
  mov    -0x20(%rbp),%rax
  movapd %xmm1,%xmm2
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  lea    D61(%rip),%rax
  mov    %rax,%rdi
  mov    $0x3,%eax
  call   <printf@plt>
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  mov    -0x28(%rbp),%edx
  movsd  -0x18(%rbp),%xmm0
  mov    -0x20(%rbp),%rax
  mov    %edx,%edi
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <parallel_trap@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x10(%rbp)
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    -0x28(%rbp),%eax
  mov    %eax,%esi
  lea    D71(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movsd  -0x10(%rbp),%xmm1
  movsd  -0x18(%rbp),%xmm0
  mov    -0x20(%rbp),%rax
  movapd %xmm1,%xmm2
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  lea    D61(%rip),%rax
  mov    %rax,%rdi
  mov    $0x3,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L16
  call   <__stack_chk_fail@plt>
L16:
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D70
type_guessed: string
name: parse_data
arguments: data_label: D12
type_guessed: string
name: parse_data
arguments: data_label: D0
type_guessed: string
name: parse_data
arguments: data_label: D61
type_guessed: string
name: parse_data
arguments: data_label: D4
type_guessed: string
name: parse_data
arguments: data_label: D71
type_guessed: string

tool: D70: Enter a, b and n:

tool: D12: %lf %lf %d

tool: D0: Version 1: With n = %d trapezoids, our estimate


tool: D61: of the integral from %f to %f = %.14e


tool: D4: Version 2: With n = %d trapezoids, our estimate


tool: D71: Version 3: With n = %d trapezoids, our estimate


assistant: ```c
int main(int argc, char *argv[]) {
  int n;
  int thread_count = 1;
  double a;
  double b;
  double global_result = 0.0;
  printf("Enter a, b and n:\n");
  scanf("%lf %lf %d", &a, &b, &n);
  if (argc == 2) {
    thread_count = strtol(argv[1], NULL, 10);
  }
#pragma omp parallel num_threads(thread_count)
  trap(a, b, n, &global_result);
  printf("Version 1: With n = %d trapezoids, our estimate\n", n);
  printf("of the integral from %f to %f = %.14e\n", a, b, global_result);
  global_result = 0.0;
#pragma omp parallel num_threads(thread_count) reduction(+ : global_result)
  global_result += local_trap(a, b, n);
  printf("\n");
  printf("Version 2: With n = %d trapezoids, our estimate\n", n);
  printf("of the integral from %f to %f = %.14e\n", a, b, global_result);
  global_result = 0.0;
  global_result = parallel_trap(a, b, n);
  printf("\n");
  printf("Version 3: With n = %d trapezoids, our estimate\n", n);
  printf("of the integral from %f to %f = %.14e\n", a, b, global_result);
  return 0;
}
```