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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xe8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xd8(%rsp)
  xor    %eax,%eax
  lea    0x71(%rsp),%rbx
  mov    $0xf,%edx
  lea    D115(%rip),%rsi
  mov    %rbx,%rdi
  call   <strncpy@plt>
  movq   $0x0,0x80(%rsp)
  movq   $0x0,0x88(%rsp)
  movq   $0x0,0x90(%rsp)
  movq   $0x0,0x98(%rsp)
  movq   $0x0,0xa0(%rsp)
  movq   $0x0,0xa8(%rsp)
  movq   $0x0,0xb0(%rsp)
  movq   $0x0,0xb8(%rsp)
  movq   $0x0,0xc0(%rsp)
  movq   $0x0,0xc8(%rsp)
  lea    D204(%rip),%rbp
  mov    %rbp,%rsi
  lea    D169(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,0x10(%rsp)
  mov    %rbp,%rsi
  lea    D45(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,0x18(%rsp)
  movl   $0x0,0x30(%rsp)
  movl   $0x0,0x34(%rsp)
  movl   $0x0,0x38(%rsp)
  movq   $0x0,0x4c(%rsp)
  movl   $0x0,0x54(%rsp)
  movq   $0x0,0x58(%rsp)
  movl   $0x0,0x60(%rsp)
  movq   $0x0,0x64(%rsp)
  movl   $0x0,0x6c(%rsp)
  movl   $0x0,0x3c(%rsp)
  movl   $0x0,0x40(%rsp)
  lea    0x4c(%rsp),%rdi
  mov    $0xc,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  lea    0x58(%rsp),%rdi
  mov    $0xc,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  lea    0x64(%rsp),%rdi
  mov    $0xc,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  mov    %rbx,%rsi
  lea    D59(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x9600,%esi
  mov    %rbx,%rdi
  call   <mstrain_setup@plt>
  mov    %eax,%ebx
  mov    %eax,%esi
  lea    D201(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  test   %ebx,%ebx
  js     L13
  lea    0x3c(%rsp),%rsi
  mov    %ebx,%edi
  call   <mstrain_temperature@plt>
  lea    0x40(%rsp),%rsi
  mov    %ebx,%edi
  call   <mstrain_serial_number@plt>
  pxor   %xmm0,%xmm0
  cvtss2sd 0x3c(%rsp),%xmm0
  mov    0x40(%rsp),%esi
  lea    D23(%rip),%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  lea    0x44(%rsp),%rax
  mov    %rax,(%rsp)
  lea    0x48(%rsp),%rax
  mov    %rax,0x8(%rsp)
  jmp    L20
L13:
  lea    D157(%rip),%rdi
  call   <puts@plt>
  mov    0xd8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L27
  mov    $0x0,%eax
  add    $0xe8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L31:
  mov    %ebx,%edi
  call   <close@plt>
  mov    $0x11170,%edi
  call   <usleep@plt>
  lea    0x71(%rsp),%rdi
  mov    $0x9600,%esi
  call   <mstrain_setup@plt>
  mov    %eax,%ebx
  mov    $0x0,%esi
  mov    (%rsp),%rdi
  call   <gettimeofday@plt>
  mov    0x8(%rsp),%rdi
  call   <localtime@plt>
  mov    (%rax),%eax
  mov    %eax,0x2c(%rsp)
  lea    0x2c(%rsp),%rcx
  lea    0x80(%rsp),%r12
  lea    D113(%rip),%rdx
  mov    $0x50,%esi
  mov    %r12,%rdi
  call   <strftime@plt>
  mov    0x44(%rsp),%r14d
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %eax,%r13d
  mov    %r12,%rdi
  call   <strlen@plt>
  movslq %eax,%rdi
  add    %r12,%rdi
  mov    %r14d,%ecx
  lea    D156(%rip),%rdx
  mov    %r13d,%esi
  call   <snprintf@plt>
  pxor   %xmm0,%xmm0
  cvtsi2ss %ebp,%xmm0
  mov    %r12,%rdx
  lea    D138(%rip),%rsi
  mov    0x18(%rsp),%rdi
  mov    $0x1,%eax
  call   <fprintf@plt>
L15:
  pxor   %xmm0,%xmm0
  cvtss2sd 0x30(%rsp),%xmm0
  pxor   %xmm2,%xmm2
  cvtss2sd 0x38(%rsp),%xmm2
  pxor   %xmm1,%xmm1
  cvtss2sd 0x34(%rsp),%xmm1
  lea    D75(%rip),%rdi
  mov    $0x3,%eax
  call   <printf@plt>
  mov    $0x0,%esi
  mov    (%rsp),%rdi
  call   <gettimeofday@plt>
  mov    0x8(%rsp),%rdi
  call   <localtime@plt>
  mov    (%rax),%eax
  mov    %eax,0x2c(%rsp)
  lea    0x2c(%rsp),%rcx
  lea    0x80(%rsp),%rbp
  lea    D113(%rip),%rdx
  mov    $0x50,%esi
  mov    %rbp,%rdi
  call   <strftime@plt>
  mov    0x44(%rsp),%r13d
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %eax,%r12d
  mov    %rbp,%rdi
  call   <strlen@plt>
  movslq %eax,%rdi
  add    %rbp,%rdi
  mov    %r13d,%ecx
  lea    D156(%rip),%rdx
  mov    %r12d,%esi
  call   <snprintf@plt>
  pxor   %xmm0,%xmm0
  cvtss2sd 0x60(%rsp),%xmm0
  lea    -0x20(%rsp),%rsp
  movsd  %xmm0,0x18(%rsp)
  pxor   %xmm0,%xmm0
  cvtss2sd 0x7c(%rsp),%xmm0
  movsd  %xmm0,0x10(%rsp)
  pxor   %xmm0,%xmm0
  cvtss2sd 0x78(%rsp),%xmm0
  movsd  %xmm0,0x8(%rsp)
  pxor   %xmm0,%xmm0
  cvtss2sd 0x74(%rsp),%xmm0
  movsd  %xmm0,(%rsp)
  pxor   %xmm7,%xmm7
  cvtss2sd 0x70(%rsp),%xmm7
  pxor   %xmm6,%xmm6
  cvtss2sd 0x6c(%rsp),%xmm6
  pxor   %xmm5,%xmm5
  cvtss2sd 0x8c(%rsp),%xmm5
  pxor   %xmm4,%xmm4
  cvtss2sd 0x88(%rsp),%xmm4
  pxor   %xmm3,%xmm3
  cvtss2sd 0x84(%rsp),%xmm3
  pxor   %xmm2,%xmm2
  cvtss2sd 0x58(%rsp),%xmm2
  pxor   %xmm1,%xmm1
  cvtss2sd 0x54(%rsp),%xmm1
  movss  0x50(%rsp),%xmm0
  mov    %rbp,%rdx
  lea    D79(%rip),%rsi
  mov    0x30(%rsp),%rdi
  mov    $0x8,%eax
  call   <fprintf@plt>
  add    $0x20,%rsp
L20:
  lea    D208(%rip),%rdi
  call   <puts@plt>
  lea    0x58(%rsp),%r15
  lea    0x4c(%rsp),%r14
  lea    0x64(%rsp),%rdx
  mov    %r15,%r8
  mov    %r14,%rcx
  mov    $0x0,%esi
  mov    %ebx,%edi
  call   <mstrain_vectors@plt>
  pxor   %xmm0,%xmm0
  cvtss2sd 0x64(%rsp),%xmm0
  pxor   %xmm2,%xmm2
  cvtss2sd 0x6c(%rsp),%xmm2
  pxor   %xmm1,%xmm1
  cvtss2sd 0x68(%rsp),%xmm1
  lea    D104(%rip),%rdi
  mov    $0x3,%eax
  call   <printf@plt>
  pxor   %xmm0,%xmm0
  cvtss2sd 0x4c(%rsp),%xmm0
  pxor   %xmm2,%xmm2
  cvtss2sd 0x54(%rsp),%xmm2
  pxor   %xmm1,%xmm1
  cvtss2sd 0x50(%rsp),%xmm1
  lea    D161(%rip),%rdi
  mov    $0x3,%eax
  call   <printf@plt>
  pxor   %xmm0,%xmm0
  cvtss2sd 0x58(%rsp),%xmm0
  pxor   %xmm2,%xmm2
  cvtss2sd 0x60(%rsp),%xmm2
  pxor   %xmm1,%xmm1
  cvtss2sd 0x5c(%rsp),%xmm1
  lea    D64(%rip),%rdi
  mov    $0x3,%eax
  call   <printf@plt>
  lea    D192(%rip),%rdi
  call   <puts@plt>
  lea    0x38(%rsp),%r13
  lea    0x30(%rsp),%r12
  lea    0x34(%rsp),%rbp
  mov    %r13,%rcx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %ebx,%edi
  call   <mstrain_euler_angles@plt>
  pxor   %xmm0,%xmm0
  cvtss2sd 0x34(%rsp),%xmm0
  pxor   %xmm2,%xmm2
  cvtss2sd 0x38(%rsp),%xmm2
  pxor   %xmm1,%xmm1
  cvtss2sd 0x30(%rsp),%xmm1
  lea    D87(%rip),%rdi
  mov    $0x3,%eax
  call   <printf@plt>
  lea    D98(%rip),%rdi
  call   <puts@plt>
  mov    %r15,%r9
  mov    %r14,%r8
  mov    %r13,%rcx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %ebx,%edi
  call   <mstrain_euler_vectors@plt>
  mov    %eax,%ebp
  test   %eax,%eax
  js     L31
  jmp    L15
L27:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: label: D115
datatype: string
name: disassemble_data
arguments: label: D204
datatype: string
name: disassemble_data
arguments: label: D169
datatype: string
name: disassemble_data
arguments: label: D45
datatype: string
name: disassemble_data
arguments: label: D59
datatype: string
name: disassemble_data
arguments: label: D201
datatype: string
name: disassemble_data
arguments: label: D23
datatype: string
name: disassemble_data
arguments: label: D157
datatype: string
name: disassemble_data
arguments: label: D113
datatype: string
name: disassemble_data
arguments: label: D156
datatype: string
name: disassemble_data
arguments: label: D138
datatype: string
name: disassemble_data
arguments: label: D75
datatype: string
name: disassemble_data
arguments: label: D79
datatype: string
name: disassemble_data
arguments: label: D208
datatype: string
name: disassemble_data
arguments: label: D104
datatype: string
name: disassemble_data
arguments: label: D161
datatype: string
name: disassemble_data
arguments: label: D64
datatype: string
name: disassemble_data
arguments: label: D192
datatype: string
name: disassemble_data
arguments: label: D87
datatype: string
name: disassemble_data
arguments: label: D98
datatype: string

tool: D115: /dev/ttyUSB0

tool: D204: w

tool: D169: imu_data.csv

tool: D45: imu_errors.txt

tool: D59: MAIN: Trying IMU at %s with 38400.


tool: D201: imu_fd = %d


tool: D23: MAIN: Temp: %f		SN: %d


tool: D157: MAIN: No IMU, quitting...

tool: D113: 20%y%m%d_%H%M%S

tool: D156: .%03ld

tool: D138: %s %d


tool: D75: Pitch: %f
Roll: %f
Yaw: %f



tool: D79: %s, %.04f, %.04f, %.04f, %.04f, %.04f, %.04f %.04f, %.04f, %.04f, %.04f, %.04f, %.04f


tool: D208: MAIN: Trying mstrain_vectors()...

tool: D104: Mag Vector: %f %f %f


tool: D161: Accel Vector: %f %f %f


tool: D64: Ang Rate Vector: %f %f %f



tool: D192: MAIN: Trying mstrain_euler_angles()...

tool: D87: Roll: %f
Pitch: %f
Yaw: %f



tool: D98: MAIN: Trying mstrain_euler_vectors()...

assistant: ```c
int main() {
  int imu_fd = -1;
  int status = -1;
  int enable_log = 1;
  char port_name[15];
  char *imu_port;
  strncpy(port_name, "/dev/ttyUSB0", 15);
  imu_port = port_name;
  struct timeval ctime;
  struct tm ct;
  char write_time[80] = {0};
  FILE *f_log;
  FILE *f_errors;
  if (enable_log) {
    f_log = fopen("imu_data.csv", "w");
  }
  if (enable_log) {
    f_errors = fopen("imu_errors.txt", "w");
  }
  float pitch = 0;
  float roll = 0;
  float yaw = 0;
  float accel[3] = {0};
  float ang_rate[3] = {0};
  float mag[3] = {0};
  float temp = 0;
  int serial_num = 0;
  int gyro_stab = 0;
  memset(&accel, '\0', sizeof(accel));
  memset(&ang_rate, '\0', sizeof(ang_rate));
  memset(&mag, '\0', sizeof(mag));
  printf("MAIN: Trying IMU at %s with 38400.\n", imu_port);
  imu_fd = mstrain_setup(imu_port, 38400);
  printf("imu_fd = %d\n", imu_fd);
  if (imu_fd < 0) {
    printf("MAIN: No IMU, quitting...\n");
    return 0;
  }
  status = mstrain_temperature(imu_fd, &temp);
  status = mstrain_serial_number(imu_fd, &serial_num);
  printf("MAIN: Temp: %f\t\tSN: %d\n", temp, serial_num);
  while (1) {
    printf("MAIN: Trying mstrain_vectors()...\n");
    status = mstrain_vectors(imu_fd, gyro_stab, mag, accel, ang_rate);
    printf("Mag Vector: %f %f %f\n", mag[0], mag[1], mag[2]);
    printf("Accel Vector: %f %f %f\n", accel[0], accel[1], accel[2]);
    printf("Ang Rate Vector: %f %f %f\n\n", ang_rate[0], ang_rate[1], ang_rate[2]);
    printf("MAIN: Trying mstrain_euler_angles()...\n");
    status = mstrain_euler_angles(imu_fd, &roll, &pitch, &yaw);
    printf("Roll: %f\nPitch: %f\nYaw: %f\n\n", roll, pitch, yaw);
    printf("MAIN: Trying mstrain_euler_vectors()...\n");
    status = mstrain_euler_vectors(imu_fd, &roll, &pitch, &yaw, accel, ang_rate);
    if (status < 0) {
      close(imu_fd);
      usleep(7000 * 10);
      imu_fd = mstrain_setup(imu_port, 38400);
      if (enable_log) {
        gettimeofday(&ctime, NULL);
        ct = *(localtime((const time_t *)&ctime.tv_sec));
        strftime(write_time, sizeof(write_time), "20%y%m%d_%H%M%S", &ct);
        snprintf(write_time + strlen(write_time), strlen(write_time), ".%03ld", ctime.tv_usec);
        fprintf(f_errors, "%s %d\n", write_time, status);
      }
    }
    printf("Pitch: %f\nRoll: %f\nYaw: %f\n\n", pitch, roll, yaw);
    if (enable_log) {
      gettimeofday(&ctime, NULL);
      ct = *(localtime((const time_t *)&ctime.tv_sec));
      strftime(write_time, sizeof(write_time), "20%y%m%d_%H%M%S", &ct);
      snprintf(write_time + strlen(write_time), strlen(write_time), ".%03ld", ctime.tv_usec);
      fprintf(f_log,
              "%s, %.04f, %.04f, %.04f, %.04f, %.04f, %.04f "
              "%.04f, %.04f, %.04f, %.04f, %.04f, %.04f\n",
              write_time, pitch, roll, yaw, mag[0], mag[1], mag[2], accel[0], accel[1], accel[2], ang_rate[0], ang_rate[1], ang_rate[2]);
    }
  }
  close(imu_fd);
  return 0;
}
```