#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ write_time;
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};
struct timeval {
  int /*<<< orphan*/ tv_usec;
  int /*<<< orphan*/ tv_sec;
};
typedef int /*<<< orphan*/ mag;
typedef int /*<<< orphan*/ ang_rate;
typedef int /*<<< orphan*/ accel;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, float, ...);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ const *);
int /*<<< orphan*/ memset(float **, char, int);
int mstrain_euler_angles(int, float *, float *, float *);
int mstrain_euler_vectors(int, float *, float *, float *, float *, float *);
int mstrain_serial_number(int, int *);
int mstrain_setup(char *, int);
int mstrain_temperature(int, float *);
int mstrain_vectors(int, int, float *, float *, float *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ usleep(int);
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;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
lea    -0x1f(%rbp),%rdi
lea    0xdae(%rip),%rsi
mov    $0xf,%edx
call   1040 <strncpy@plt>
lea    -0x1f(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   10c0 <memset@plt>
cmpl   $0x0,-0x10(%rbp)
je     129b <main+0x7b>
lea    0xd85(%rip),%rdi
lea    0xd8b(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x98(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     12bf <main+0x9f>
lea    0xd70(%rip),%rdi
lea    0xd67(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0xa0(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xa4(%rbp)
ff
xorps  %xmm0,%xmm0
movss  %xmm0,-0xa8(%rbp)
ff
xorps  %xmm0,%xmm0
movss  %xmm0,-0xac(%rbp)
ff
lea    -0xb8(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10c0 <memset@plt>
lea    -0xc4(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10c0 <memset@plt>
lea    -0xd0(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10c0 <memset@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0xd4(%rbp)
ff
movl   $0x0,-0xd8(%rbp)
movl   $0x0,-0xdc(%rbp)
lea    -0xb8(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10c0 <memset@plt>
lea    -0xc4(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10c0 <memset@plt>
lea    -0xd0(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10c0 <memset@plt>
mov    -0x28(%rbp),%rsi
lea    0xcaf(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    $0x9600,%esi
call   1110 <mstrain_setup@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xcb1(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jge    13c8 <main+0x1a8>
lea    0xca6(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret
mov    -0x8(%rbp),%edi
lea    -0xd4(%rbp),%rsi
call   1050 <mstrain_temperature@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
lea    -0xd8(%rbp),%rsi
call   1120 <mstrain_serial_number@plt>
mov    %eax,-0xc(%rbp)
movss  -0xd4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
mov    -0xd8(%rbp),%esi
lea    0xc72(%rip),%rdi
mov    $0x1,%al
call   1090 <printf@plt>
lea    0xc7c(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xdc(%rbp),%esi
lea    -0xd0(%rbp),%rdx
lea    -0xb8(%rbp),%rcx
lea    -0xc4(%rbp),%r8
call   1070 <mstrain_vectors@plt>
mov    %eax,-0xc(%rbp)
movss  -0xd0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0xcc(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0xc8(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
lea    0xc47(%rip),%rdi
mov    $0x3,%al
call   1090 <printf@plt>
movss  -0xb8(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0xb4(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0xb0(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
lea    0xc2b(%rip),%rdi
mov    $0x3,%al
call   1090 <printf@plt>
movss  -0xc4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0xc0(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0xbc(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
lea    0xc11(%rip),%rdi
mov    $0x3,%al
call   1090 <printf@plt>
lea    0xc1f(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x8(%rbp),%edi
lea    -0xa8(%rbp),%rsi
lea    -0xa4(%rbp),%rdx
lea    -0xac(%rbp),%rcx
call   1130 <mstrain_euler_angles@plt>
mov    %eax,-0xc(%rbp)
movss  -0xa8(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0xa4(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0xac(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
lea    0xbf5(%rip),%rdi
mov    $0x3,%al
call   1090 <printf@plt>
lea    0xc04(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x8(%rbp),%edi
lea    -0xb8(%rbp),%r8
lea    -0xc4(%rbp),%r9
lea    -0xa8(%rbp),%rsi
lea    -0xa4(%rbp),%rdx
lea    -0xac(%rbp),%rcx
call   1060 <mstrain_euler_vectors@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    165e <main+0x43e>
mov    -0x8(%rbp),%edi
call   10d0 <close@plt>
mov    $0x11170,%edi
call   1140 <usleep@plt>
mov    -0x28(%rbp),%rdi
mov    $0x9600,%esi
call   1110 <mstrain_setup@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1659 <main+0x439>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   10b0 <gettimeofday@plt>
lea    -0x30(%rbp),%rdi
add    $0x4,%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
lea    -0x90(%rbp),%rdi
mov    $0x50,%esi
lea    0xb8f(%rip),%rdx
lea    -0x38(%rbp),%rcx
call   10f0 <strftime@plt>
lea    -0x90(%rbp),%rax
mov    %rax,-0xf0(%rbp)
lea    -0x90(%rbp),%rdi
call   1080 <strlen@plt>
mov    %eax,%ecx
mov    -0xf0(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0xe8(%rbp)
lea    -0x90(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0xe8(%rbp),%rdi
mov    %eax,%esi
mov    -0x30(%rbp),%ecx
lea    0xb47(%rip),%rdx
call   10a0 <snprintf@plt>
mov    -0xa0(%rbp),%rdi
lea    -0x90(%rbp),%rdx
cvtsi2ssl -0xc(%rbp),%xmm0
lea    0xb2f(%rip),%rsi
mov    $0x1,%al
call   10e0 <fprintf@plt>
jmp    165e <main+0x43e>
movss  -0xa4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0xa8(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0xac(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
lea    0xaff(%rip),%rdi
mov    $0x3,%al
call   1090 <printf@plt>
cmpl   $0x0,-0x10(%rbp)
je     17f4 <main+0x5d4>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   10b0 <gettimeofday@plt>
lea    -0x30(%rbp),%rdi
add    $0x4,%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
lea    -0x90(%rbp),%rdi
mov    $0x50,%esi
lea    0xa9e(%rip),%rdx
lea    -0x38(%rbp),%rcx
call   10f0 <strftime@plt>
lea    -0x90(%rbp),%rax
mov    %rax,-0x100(%rbp)
lea    -0x90(%rbp),%rdi
call   1080 <strlen@plt>
mov    %eax,%ecx
mov    -0x100(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0xf8(%rbp)
lea    -0x90(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0xf8(%rbp),%rdi
mov    %eax,%esi
mov    -0x30(%rbp),%ecx
lea    0xa56(%rip),%rdx
call   10a0 <snprintf@plt>
mov    -0x98(%rbp),%rdi
lea    -0x90(%rbp),%rdx
movss  -0xa4(%rbp),%xmm0
ff
movss  -0xa8(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0xac(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
movss  -0xd0(%rbp),%xmm3
ff
cvtss2sd %xmm3,%xmm3
movss  -0xcc(%rbp),%xmm4
ff
cvtss2sd %xmm4,%xmm4
movss  -0xc8(%rbp),%xmm5
ff
cvtss2sd %xmm5,%xmm5
movss  -0xb8(%rbp),%xmm6
ff
cvtss2sd %xmm6,%xmm6
movss  -0xb4(%rbp),%xmm7
ff
cvtss2sd %xmm7,%xmm7
movss  -0xb0(%rbp),%xmm8
ff ff
cvtss2sd %xmm8,%xmm11
movss  -0xc4(%rbp),%xmm8
ff ff
cvtss2sd %xmm8,%xmm10
movss  -0xc0(%rbp),%xmm8
ff ff
cvtss2sd %xmm8,%xmm9
movss  -0xbc(%rbp),%xmm8
ff ff
cvtss2sd %xmm8,%xmm8
lea    0x9d3(%rip),%rsi
movsd  %xmm11,(%rsp)
movsd  %xmm10,0x8(%rsp)
movsd  %xmm9,0x10(%rsp)
movsd  %xmm8,0x18(%rsp)
mov    $0x8,%al
call   10e0 <fprintf@plt>
jmp    140c <main+0x1ec>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf8,%rsp
lea    0xdb8(%rip),%rsi
lea    0x91(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xf,%edx
call   1040 <strncpy@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
lea    0xd7e(%rip),%rdi
lea    0xd84(%rip),%rbp
mov    %rbp,%rsi
call   1110 <fopen@plt>
mov    %rax,0x88(%rsp)
lea    0xd6f(%rip),%rdi
mov    %rbp,%rsi
call   1110 <fopen@plt>
mov    %rax,0x80(%rsp)
movl   $0x0,0x34(%rsp)
movl   $0x0,0x30(%rsp)
movl   $0x0,0x2c(%rsp)
movl   $0x0,0x70(%rsp)
movq   $0x0,0x68(%rsp)
movl   $0x0,0x60(%rsp)
movq   $0x0,0x58(%rsp)
movl   $0x0,0x50(%rsp)
movq   $0x0,0x48(%rsp)
movl   $0x0,0x7c(%rsp)
movl   $0x0,0x78(%rsp)
lea    0x68(%rsp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10d0 <memset@plt>
lea    0x58(%rsp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10d0 <memset@plt>
lea    0x48(%rsp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10d0 <memset@plt>
lea    0xcd9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %rbx,%rdi
mov    $0x9600,%esi
call   1120 <mstrain_setup@plt>
mov    %eax,%ebx
lea    0xcdd(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10a0 <printf@plt>
test   %ebx,%ebx
js     1722 <main+0x4f2>
lea    0x7c(%rsp),%rsi
mov    %ebx,%edi
call   1050 <mstrain_temperature@plt>
lea    0x78(%rsp),%rsi
mov    %ebx,0x74(%rsp)
mov    %ebx,%edi
call   1130 <mstrain_serial_number@plt>
movss  0x7c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    0x78(%rsp),%esi
lea    0xca8(%rip),%rdi
mov    $0x1,%al
call   10a0 <printf@plt>
jmp    15c1 <main+0x391>
mov    %eax,%r15d
mov    %r12d,%edi
call   10e0 <close@plt>
mov    $0x11170,%edi
call   1150 <usleep@plt>
lea    0x91(%rsp),%rdi
mov    $0x9600,%esi
call   1120 <mstrain_setup@plt>
mov    %eax,0x74(%rsp)
lea    0x40(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
call   10c0 <gettimeofday@plt>
lea    0x44(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
mov    %eax,0x38(%rsp)
lea    0xa0(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x50,%esi
lea    0xcba(%rip),%rbx
mov    %rbx,%rdx
lea    0x38(%rsp),%r12
mov    %r12,%rcx
call   1100 <strftime@plt>
mov    %rbp,%rdi
call   1090 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%r13
add    $0xa0,%r13
mov    %rbp,%rdi
call   1090 <strlen@plt>
mov    0x40(%rsp),%ecx
mov    %r13,%rdi
mov    %eax,%esi
lea    0xc8d(%rip),%r13
mov    %r13,%rdx
call   10b0 <snprintf@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %r15d,%xmm0
lea    0x44(%rsp),%r15
mov    0x80(%rsp),%rdi
lea    0xc70(%rip),%rsi
mov    %rbp,%rdx
mov    $0x1,%al
call   10f0 <fprintf@plt>
movss  0x34(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x30(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0x2c(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xc48(%rip),%rdi
mov    $0x3,%al
call   10a0 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   10c0 <gettimeofday@plt>
mov    %r15,%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
mov    %eax,0x38(%rsp)
mov    %rbp,%rdi
mov    $0x50,%esi
mov    %rbx,%rdx
mov    %r12,%rcx
call   1100 <strftime@plt>
mov    %rbp,%rdi
call   1090 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rbx
add    $0xa0,%rbx
mov    %rbp,%rdi
call   1090 <strlen@plt>
mov    0x40(%rsp),%ecx
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r13,%rdx
call   10b0 <snprintf@plt>
movss  0x34(%rsp),%xmm0
movss  0x30(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0x2c(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  0x48(%rsp),%xmm3
movss  0x4c(%rsp),%xmm4
cvtss2sd %xmm3,%xmm3
cvtss2sd %xmm4,%xmm4
movss  0x50(%rsp),%xmm5
cvtss2sd %xmm5,%xmm5
movss  0x68(%rsp),%xmm6
movss  0x6c(%rsp),%xmm7
cvtss2sd %xmm6,%xmm6
cvtss2sd %xmm7,%xmm7
movss  0x70(%rsp),%xmm8
cvtss2sd %xmm8,%xmm8
movss  0x58(%rsp),%xmm9
movss  0x5c(%rsp),%xmm10
cvtss2sd %xmm9,%xmm9
cvtss2sd %xmm10,%xmm10
movss  0x60(%rsp),%xmm11
cvtss2sd %xmm11,%xmm11
movsd  %xmm11,0x18(%rsp)
movsd  %xmm10,0x10(%rsp)
movsd  %xmm9,0x8(%rsp)
movsd  %xmm8,(%rsp)
mov    0x88(%rsp),%rdi
lea    0xb5f(%rip),%rsi
mov    %rbp,%rdx
mov    $0x8,%al
call   10f0 <fprintf@plt>
lea    0xba5(%rip),%rdi
call   1060 <puts@plt>
mov    0x74(%rsp),%r12d
mov    %r12d,%edi
xor    %esi,%esi
lea    0x48(%rsp),%rdx
lea    0x68(%rsp),%r15
mov    %r15,%rcx
lea    0x58(%rsp),%rbp
mov    %rbp,%r8
call   1080 <mstrain_vectors@plt>
movss  0x48(%rsp),%xmm0
movss  0x4c(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x50(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xa5e(%rip),%rdi
mov    $0x3,%al
call   10a0 <printf@plt>
movss  0x68(%rsp),%xmm0
movss  0x6c(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x70(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xa48(%rip),%rdi
mov    $0x3,%al
call   10a0 <printf@plt>
movss  0x58(%rsp),%xmm0
movss  0x5c(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x60(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xa34(%rip),%rdi
mov    $0x3,%al
call   10a0 <printf@plt>
lea    0xb13(%rip),%rdi
call   1060 <puts@plt>
mov    %r12d,%edi
lea    0x30(%rsp),%rbx
mov    %rbx,%rsi
lea    0x34(%rsp),%r13
mov    %r13,%rdx
lea    0x2c(%rsp),%r14
mov    %r14,%rcx
call   1140 <mstrain_euler_angles@plt>
movss  0x30(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x34(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0x2c(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0x9f8(%rip),%rdi
mov    $0x3,%al
call   10a0 <printf@plt>
lea    0xae2(%rip),%rdi
call   1060 <puts@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r14,%rcx
mov    %r15,%r8
mov    %rbp,%r9
call   1070 <mstrain_euler_vectors@plt>
test   %eax,%eax
js     13c0 <main+0x190>
lea    0x44(%rsp),%r15
lea    0x40(%rsp),%r14
lea    0x9d2(%rip),%rbx
lea    0xa0(%rsp),%rbp
lea    0x38(%rsp),%r12
lea    0x9ce(%rip),%r13
jmp    148c <main+0x25c>
lea    0xab5(%rip),%rdi
call   1060 <puts@plt>
xor    %eax,%eax
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
%struct.tm = type { i32 }
@.str = [13 x i8] c"/dev/ttyUSB0\00"
@.str.1 = [13 x i8] c"imu_data.csv\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [15 x i8] c"imu_errors.txt\00"
@.str.4 = [36 x i8] c"MAIN: Trying IMU at %s with 38400.\0A\00"
@.str.5 = [13 x i8] c"imu_fd = %d\0A\00"
@.str.6 = [27 x i8] c"MAIN: No IMU, quitting...\0A\00"
@.str.7 = [24 x i8] c"MAIN: Temp: %f\09\09SN: %d\0A\00"
@.str.8 = [35 x i8] c"MAIN: Trying mstrain_vectors()...\0A\00"
@.str.9 = [22 x i8] c"Mag Vector: %f %f %f\0A\00"
@.str.10 = [24 x i8] c"Accel Vector: %f %f %f\0A\00"
@.str.11 = [28 x i8] c"Ang Rate Vector: %f %f %f\0A\0A\00"
@.str.12 = [40 x i8] c"MAIN: Trying mstrain_euler_angles()...\0A\00"
@.str.13 = [29 x i8] c"Roll: %f\0APitch: %f\0AYaw: %f\0A\0A\00"
@.str.14 = [41 x i8] c"MAIN: Trying mstrain_euler_vectors()...\0A\00"
@.str.15 = [16 x i8] c"20%y%m%d_%H%M%S\00"
@.str.16 = [7 x i8] c".%03ld\00"
@.str.17 = [7 x i8] c"%s %d\0A\00"
@.str.18 = [29 x i8] c"Pitch: %f\0ARoll: %f\0AYaw: %f\0A\0A\00"
@.str.19 = [87 x i8] c"%s, %.04f, %.04f, %.04f, %.04f, %.04f, %.04f %.04f, %.04f, %.04f, %.04f, %.04f, %.04f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [15 x i8]
%6 = alloca i8*
%7 = alloca %struct.timeval
%8 = alloca %struct.tm
%9 = alloca [80 x i8]
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca [3 x float]
%16 = alloca [3 x float]
%17 = alloca [3 x float]
%18 = alloca float
%19 = alloca i32
%20 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %2
store i32 -1, i32* %3
store i32 1, i32* %4
%21 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%22 = call i32 @strncpy(i8* %21, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 15)
%23 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
store i8* %23, i8** %6
%24 = bitcast [80 x i8]* %9 to i8*
%25 = load i32, i32* %4
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %0
%28 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %28, i32** %10
br label %29
29: ; preds = %27, %0
%30 = load i32, i32* %4
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %33, i32** %11
br label %34
34: ; preds = %32, %29
store float 0.000000e+00, float* %12
store float 0.000000e+00, float* %13
store float 0.000000e+00, float* %14
%35 = bitcast [3 x float]* %15 to i8*
%36 = bitcast [3 x float]* %16 to i8*
%37 = bitcast [3 x float]* %17 to i8*
store float 0.000000e+00, float* %18
store i32 0, i32* %19
store i32 0, i32* %20
%38 = bitcast [3 x float]* %15 to float**
%39 = call i32 @memset(float** %38, i8 signext 0, i32 12)
%40 = bitcast [3 x float]* %16 to float**
%41 = call i32 @memset(float** %40, i8 signext 0, i32 12)
%42 = bitcast [3 x float]* %17 to float**
%43 = call i32 @memset(float** %42, i8 signext 0, i32 12)
%44 = load i8*, i8** %6
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i8* %44)
%46 = load i8*, i8** %6
%47 = call i32 @mstrain_setup(i8* %46, i32 38400)
store i32 %47, i32* %2
%48 = load i32, i32* %2
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %2
%51 = icmp slt i32 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %34
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
54: ; preds = %34
%55 = load i32, i32* %2
%56 = call i32 @mstrain_temperature(i32 %55, float* %18)
store i32 %56, i32* %3
%57 = load i32, i32* %2
%58 = call i32 @mstrain_serial_number(i32 %57, i32* %19)
store i32 %58, i32* %3
%59 = load float, float* %18
%60 = fpext float %59 to double
%61 = load i32, i32* %19
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), double %60, i32 %61)
br label %63
63: ; preds = %54, %213
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
%65 = load i32, i32* %2
%66 = load i32, i32* %20
%67 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 0
%68 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 0
%69 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 0
%70 = call i32 @mstrain_vectors(i32 %65, i32 %66, float* %67, float* %68, float* %69)
store i32 %70, i32* %3
%71 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 0
%72 = load float, float* %71
%73 = fpext float %72 to double
%74 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 1
%75 = load float, float* %74
%76 = fpext float %75 to double
%77 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 2
%78 = load float, float* %77
%79 = fpext float %78 to double
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), double %73, double %76, double %79)
%81 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 0
%82 = load float, float* %81
%83 = fpext float %82 to double
%84 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 1
%85 = load float, float* %84
%86 = fpext float %85 to double
%87 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 2
%88 = load float, float* %87
%89 = fpext float %88 to double
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), double %83, double %86, double %89)
%91 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 0
%92 = load float, float* %91
%93 = fpext float %92 to double
%94 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 1
%95 = load float, float* %94
%96 = fpext float %95 to double
%97 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 2
%98 = load float, float* %97
%99 = fpext float %98 to double
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), double %93, double %96, double %99)
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.12, i64 0, i64 0))
%102 = load i32, i32* %2
%103 = call i32 @mstrain_euler_angles(i32 %102, float* %13, float* %12, float* %14)
store i32 %103, i32* %3
%104 = load float, float* %13
%105 = fpext float %104 to double
%106 = load float, float* %12
%107 = fpext float %106 to double
%108 = load float, float* %14
%109 = fpext float %108 to double
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), double %105, double %107, double %109)
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.14, i64 0, i64 0))
%112 = load i32, i32* %2
%113 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 0
%114 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 0
%115 = call i32 @mstrain_euler_vectors(i32 %112, float* %13, float* %12, float* %14, float* %113, float* %114)
store i32 %115, i32* %3
%116 = load i32, i32* %3
%117 = icmp slt i32 %116, 0
br i1 %117, label %118, label %150
118: ; preds = %63
%119 = load i32, i32* %2
%120 = call i32 @close(i32 %119)
%121 = call i32 @usleep(i32 70000)
%122 = load i8*, i8** %6
%123 = call i32 @mstrain_setup(i8* %122, i32 38400)
store i32 %123, i32* %2
%124 = load i32, i32* %4
%125 = icmp ne i32 %124, 0
br i1 %125, label %126, label %149
126: ; preds = %118
%127 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%128 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 1
%129 = call %struct.tm* @localtime(i32* %128)
%130 = bitcast %struct.tm* %8 to i8*
%131 = bitcast %struct.tm* %129 to i8*
%132 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%133 = call i32 @strftime(i8* %132, i32 80, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), %struct.tm* %8)
%134 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%135 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%136 = call i32 @strlen(i8* %135)
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds i8, i8* %134, i64 %137
%139 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%140 = call i32 @strlen(i8* %139)
%141 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%142 = load i32, i32* %141
%143 = call i32 @snprintf(i8* %138, i32 %140, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i32 %142)
%144 = load i32*, i32** %11
%145 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%146 = load i32, i32* %3
%147 = sitofp i32 %146 to float
%148 = call i32 (i32*, i8*, i8*, float, ...) @fprintf(i32* %144, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8* %145, float %147)
br label %149
149: ; preds = %126, %118
br label %150
150: ; preds = %149, %63
%151 = load float, float* %12
%152 = fpext float %151 to double
%153 = load float, float* %13
%154 = fpext float %153 to double
%155 = load float, float* %14
%156 = fpext float %155 to double
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.18, i64 0, i64 0), double %152, double %154, double %156)
%158 = load i32, i32* %4
%159 = icmp ne i32 %158, 0
br i1 %159, label %160, label %213
160: ; preds = %150
%161 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%162 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 1
%163 = call %struct.tm* @localtime(i32* %162)
%164 = bitcast %struct.tm* %8 to i8*
%165 = bitcast %struct.tm* %163 to i8*
%166 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%167 = call i32 @strftime(i8* %166, i32 80, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), %struct.tm* %8)
%168 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%169 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%170 = call i32 @strlen(i8* %169)
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds i8, i8* %168, i64 %171
%173 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%174 = call i32 @strlen(i8* %173)
%175 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%176 = load i32, i32* %175
%177 = call i32 @snprintf(i8* %172, i32 %174, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i32 %176)
%178 = load i32*, i32** %10
%179 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%180 = load float, float* %12
%181 = load float, float* %13
%182 = fpext float %181 to double
%183 = load float, float* %14
%184 = fpext float %183 to double
%185 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 0
%186 = load float, float* %185
%187 = fpext float %186 to double
%188 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 1
%189 = load float, float* %188
%190 = fpext float %189 to double
%191 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 2
%192 = load float, float* %191
%193 = fpext float %192 to double
%194 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 0
%195 = load float, float* %194
%196 = fpext float %195 to double
%197 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 1
%198 = load float, float* %197
%199 = fpext float %198 to double
%200 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 2
%201 = load float, float* %200
%202 = fpext float %201 to double
%203 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 0
%204 = load float, float* %203
%205 = fpext float %204 to double
%206 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 1
%207 = load float, float* %206
%208 = fpext float %207 to double
%209 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 2
%210 = load float, float* %209
%211 = fpext float %210 to double
%212 = call i32 (i32*, i8*, i8*, float, ...) @fprintf(i32* %178, i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.19, i64 0, i64 0), i8* %179, float %180, double %182, double %184, double %187, double %190, double %193, double %196, double %199, double %202, double %205, double %208, double %211)
br label %213
213: ; preds = %160, %150
br label %63
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
%struct.tm = type { i32 }
@.str = [13 x i8] c"/dev/ttyUSB0\00"
@.str.1 = [13 x i8] c"imu_data.csv\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [15 x i8] c"imu_errors.txt\00"
@.str.4 = [36 x i8] c"MAIN: Trying IMU at %s with 38400.\0A\00"
@.str.5 = [13 x i8] c"imu_fd = %d\0A\00"
@.str.7 = [24 x i8] c"MAIN: Temp: %f\09\09SN: %d\0A\00"
@.str.9 = [22 x i8] c"Mag Vector: %f %f %f\0A\00"
@.str.10 = [24 x i8] c"Accel Vector: %f %f %f\0A\00"
@.str.11 = [28 x i8] c"Ang Rate Vector: %f %f %f\0A\0A\00"
@.str.13 = [29 x i8] c"Roll: %f\0APitch: %f\0AYaw: %f\0A\0A\00"
@.str.15 = [16 x i8] c"20%y%m%d_%H%M%S\00"
@.str.16 = [7 x i8] c".%03ld\00"
@.str.17 = [7 x i8] c"%s %d\0A\00"
@.str.18 = [29 x i8] c"Pitch: %f\0ARoll: %f\0AYaw: %f\0A\0A\00"
@.str.19 = [87 x i8] c"%s, %.04f, %.04f, %.04f, %.04f, %.04f, %.04f %.04f, %.04f, %.04f, %.04f, %.04f, %.04f\0A\00"
@str = [34 x i8] c"MAIN: Trying mstrain_vectors()...\00"
@str.20 = [39 x i8] c"MAIN: Trying mstrain_euler_angles()...\00"
@str.21 = [40 x i8] c"MAIN: Trying mstrain_euler_vectors()...\00"
@str.22 = [26 x i8] c"MAIN: No IMU, quitting...\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca %struct.timeval
%3 = alloca %struct.tm
%4 = alloca [80 x i8]
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca [3 x float]
%9 = alloca [3 x float]
%10 = alloca [3 x float]
%11 = alloca float
%12 = alloca i32
%13 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%14 = call i32 @strncpy(i8* %13, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 15)
%15 = bitcast %struct.timeval* %2 to i8*
%16 = bitcast %struct.tm* %3 to i8*
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%18 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%20 = bitcast float* %5 to i8*
store float 0.000000e+00, float* %5
%21 = bitcast float* %6 to i8*
store float 0.000000e+00, float* %6
%22 = bitcast float* %7 to i8*
store float 0.000000e+00, float* %7
%23 = bitcast [3 x float]* %8 to i8*
%24 = bitcast [3 x float]* %9 to i8*
%25 = bitcast [3 x float]* %10 to i8*
%26 = bitcast float* %11 to i8*
store float 0.000000e+00, float* %11
%27 = bitcast i32* %12 to i8*
store i32 0, i32* %12
%28 = bitcast [3 x float]* %8 to float**
%29 = call i32 @memset(float** %28, i8 signext 0, i32 12)
%30 = bitcast [3 x float]* %9 to float**
%31 = call i32 @memset(float** %30, i8 signext 0, i32 12)
%32 = bitcast [3 x float]* %10 to float**
%33 = call i32 @memset(float** %32, i8 signext 0, i32 12)
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%35 = call i32 @mstrain_setup(i8* %13, i32 38400)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %35)
%37 = icmp slt i32 %35, 0
br i1 %37, label %38, label %40
38: ; preds = %0
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.22, i64 0, i64 0))
ret i32 0
40: ; preds = %0
%41 = call i32 @mstrain_temperature(i32 %35, float* %11)
%42 = call i32 @mstrain_serial_number(i32 %35, i32* %12)
%43 = load float, float* %11
%44 = fpext float %43 to double
%45 = load i32, i32* %12
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), double %44, i32 %45)
%47 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 0
%48 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 0
%49 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
%50 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 1
%51 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 2
%52 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 1
%53 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 2
%54 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 1
%55 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 2
%56 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
%57 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 0
%58 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
br label %59
59: ; preds = %113, %40
%60 = phi i32 [ %35, %40 ], [ %114, %113 ]
%61 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%62 = call i32 @mstrain_vectors(i32 %60, i32 0, float* %47, float* %48, float* %49)
%63 = load float, float* %47
%64 = fpext float %63 to double
%65 = load float, float* %50
%66 = fpext float %65 to double
%67 = load float, float* %51
%68 = fpext float %67 to double
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), double %64, double %66, double %68)
%70 = load float, float* %48
%71 = fpext float %70 to double
%72 = load float, float* %52
%73 = fpext float %72 to double
%74 = load float, float* %53
%75 = fpext float %74 to double
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), double %71, double %73, double %75)
%77 = load float, float* %49
%78 = fpext float %77 to double
%79 = load float, float* %54
%80 = fpext float %79 to double
%81 = load float, float* %55
%82 = fpext float %81 to double
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), double %78, double %80, double %82)
%84 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.20, i64 0, i64 0))
%85 = call i32 @mstrain_euler_angles(i32 %60, float* %6, float* %5, float* %7)
%86 = load float, float* %6
%87 = fpext float %86 to double
%88 = load float, float* %5
%89 = fpext float %88 to double
%90 = load float, float* %7
%91 = fpext float %90 to double
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), double %87, double %89, double %91)
%93 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.21, i64 0, i64 0))
%94 = call i32 @mstrain_euler_vectors(i32 %60, float* %6, float* %5, float* %7, float* %48, float* %49)
%95 = icmp slt i32 %94, 0
br i1 %95, label %96, label %113
96: ; preds = %59
%97 = call i32 @close(i32 %60)
%98 = call i32 @usleep(i32 70000)
%99 = call i32 @mstrain_setup(i8* %13, i32 38400)
%100 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%101 = call %struct.tm* @localtime(i32* %56)
%102 = getelementptr %struct.tm, %struct.tm* %101, i64 0, i32 0
%103 = load i32, i32* %102
store i32 %103, i32* %57
%104 = call i32 @strftime(i8* %17, i32 80, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), %struct.tm* %3)
%105 = call i32 @strlen(i8* %17)
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %106
%108 = call i32 @strlen(i8* %17)
%109 = load i32, i32* %58
%110 = call i32 @snprintf(i8* %107, i32 %108, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i32 %109)
%111 = sitofp i32 %94 to float
%112 = call i32 (i32*, i8*, i8*, float, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8* %17, float %111)
br label %113
113: ; preds = %96, %59
%114 = phi i32 [ %99, %96 ], [ %60, %59 ]
%115 = load float, float* %5
%116 = fpext float %115 to double
%117 = load float, float* %6
%118 = fpext float %117 to double
%119 = load float, float* %7
%120 = fpext float %119 to double
%121 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.18, i64 0, i64 0), double %116, double %118, double %120)
%122 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%123 = call %struct.tm* @localtime(i32* %56)
%124 = getelementptr %struct.tm, %struct.tm* %123, i64 0, i32 0
%125 = load i32, i32* %124
store i32 %125, i32* %57
%126 = call i32 @strftime(i8* %17, i32 80, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), %struct.tm* %3)
%127 = call i32 @strlen(i8* %17)
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %128
%130 = call i32 @strlen(i8* %17)
%131 = load i32, i32* %58
%132 = call i32 @snprintf(i8* %129, i32 %130, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i32 %131)
%133 = load float, float* %5
%134 = load float, float* %6
%135 = fpext float %134 to double
%136 = load float, float* %7
%137 = fpext float %136 to double
%138 = load float, float* %47
%139 = fpext float %138 to double
%140 = load float, float* %50
%141 = fpext float %140 to double
%142 = load float, float* %51
%143 = fpext float %142 to double
%144 = load float, float* %48
%145 = fpext float %144 to double
%146 = load float, float* %52
%147 = fpext float %146 to double
%148 = load float, float* %53
%149 = fpext float %148 to double
%150 = load float, float* %49
%151 = fpext float %150 to double
%152 = load float, float* %54
%153 = fpext float %152 to double
%154 = load float, float* %55
%155 = fpext float %154 to double
%156 = call i32 (i32*, i8*, i8*, float, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.19, i64 0, i64 0), i8* %17, float %133, double %135, double %137, double %139, double %141, double %143, double %145, double %147, double %149, double %151, double %153, double %155)
br label %59
}