#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 */

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ isinf(float);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, double, ...);
int read(int, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int i, result, done = 0;
  int fd, temp_int, rate, channels;
  float points[8];
  int ticks = 0, trace_ticks = 0;
  double watts_vdd, watts_vpp;
  long long temp64;
  int trace = 0;
  int state = 0;
  double trace_joules_vdd, trace_joules_vpp = 0.0;
  int time_in_state = 0;
  int threshold = 1;
  double total_joules_vdd = 0.0;
  double total_joules_vpp = 0.0;
  double total_time = 0.0;
  if (argc > 1) {
    fd = open(argv[1], O_RDONLY);
    if (fd < 1) {
      fprintf(stderr, "Could not open %s\n", argv[1]);
      return -1;
    }
  } else {
    fd = 0;
  }
  read(fd, &temp_int, 4);
  printf("(* Version %d *)\n", temp_int);
  read(fd, &temp64, 8);
  printf("(* Start Time %lld.", temp64);
  read(fd, &temp64, 8);
  printf("%06lld)\n", temp64);
  read(fd, &temp_int, 4);
  rate = temp_int;
  printf("(* Rate %d Hz *)\n", rate);
  threshold = rate / 500;
  if (threshold < 1)
    threshold = 1;
  read(fd, &temp_int, 4);
  channels = temp_int;
  printf("(* Channels %d *)\n", channels);
  while (!done) {
    for (i = 0; i < channels; i++) {
      result = read(fd, &points[i], sizeof(float));
      if (isinf(points[i])) {
        done = 1;
        break;
      }
      if (result < sizeof(float)) {
        done = 1;
        break;
      }
    }
    if (done)
      break;
    if (state == 0) {
      if (points[7] > 4.0) {
        time_in_state++;
        if (time_in_state > threshold) {
          state = 1;
          time_in_state = 0;
        }
      }
    } else if (state == 1) {
      if (points[7] < -4.0) {
        state = 3;
        printf("Starting Trace %d at %lf\n", trace,
               (double)ticks / (double)rate);
        trace_ticks = 0;
        trace_joules_vdd = 0.0;
        trace_joules_vpp = 0.0;
        time_in_state = 0;
      }
    } else if (state == 3) {
      if (points[7] > 4.0) {
        time_in_state++;
        if (time_in_state > threshold) {
          state = 2;
          printf("Ending Trace %d at %lfs, %lfs Elapsed\n", trace,
                 (double)ticks / (double)rate,
                 (double)trace_ticks / (double)rate);
          printf("Total VDD Energy: %lfJ Average VDD Power: %lfW\n",
                 trace_joules_vdd,
                 trace_joules_vdd / ((double)trace_ticks / (double)rate));
          printf("Total VPP Energy: %lfJ Average VPP Power: %lfW\n",
                 trace_joules_vpp,
                 trace_joules_vpp / ((double)trace_ticks / (double)rate));
          total_joules_vdd += trace_joules_vdd;
          total_joules_vpp += trace_joules_vpp;
          total_time += (double)trace_ticks / (double)rate;
          trace++;
          time_in_state = 0;
        }
      }
    } else if (state == 2) {
      if (points[7] < -4.0) {
        state = 0;
        time_in_state = 0;
      }
    }
    if (state == 3) {
      watts_vdd = ((points[0] / 100.0) / 0.005) * points[1];
      watts_vpp = ((points[1] / 100.0) / 0.005) * points[2];
      trace_joules_vdd += (watts_vdd / rate);
      trace_joules_vpp += (watts_vpp / rate);
      trace_ticks++;
    }
    ticks++;
  }
  read(fd, &temp64, 8);
  printf("(* Stop Time %lld.", temp64);
  read(fd, &temp64, 8);
  printf("%06lld)\n", temp64);
  printf("Average Joules=%lf\tAverage Watts=%lf\n",
         (total_joules_vdd + total_joules_vpp) / (double)trace,
         (total_joules_vdd + total_joules_vpp) / total_time);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movl   $0x0,-0x8c(%rbp)
movl   $0x1,-0x90(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
cmpl   $0x1,-0x8(%rbp)
jle    1227 <main+0xd7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e03(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x1,-0x20(%rbp)
jge    1222 <main+0xd2>
mov    0x2dd8(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe0f(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    177d <main+0x62d>
jmp    122e <main+0xde>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%edi
lea    -0x24(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1040 <read@plt>
cvtsi2sdl -0x24(%rbp),%xmm0
lea    0xde6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1040 <read@plt>
cvtsi2sdq -0x70(%rbp),%xmm0
lea    0xdd1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1040 <read@plt>
cvtsi2sdq -0x70(%rbp),%xmm0
lea    0xdbe(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%edi
lea    -0x24(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1040 <read@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
cvtsi2sdl -0x28(%rbp),%xmm0
lea    0xd9b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
mov    $0x1f4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x90(%rbp)
cmpl   $0x1,-0x90(%rbp)
jge    12f6 <main+0x1a6>
movl   $0x1,-0x90(%rbp)
mov    -0x20(%rbp),%edi
lea    -0x24(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1040 <read@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x2c(%rbp)
cvtsi2sdl -0x2c(%rbp),%xmm0
lea    0xd59(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x1c(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1338 <main+0x1e8>
jmp    16e9 <main+0x599>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    13be <main+0x26e>
mov    -0x20(%rbp),%edi
movslq -0x14(%rbp),%rax
lea    -0x50(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1040 <read@plt>
mov    %eax,-0x18(%rbp)
movslq -0x14(%rbp),%rax
movss  -0x50(%rbp,%rax,4),%xmm0
call   1070 <isinf@plt>
cmp    $0x0,%rax
je     1391 <main+0x241>
movl   $0x1,-0x1c(%rbp)
jmp    13be <main+0x26e>
movslq -0x18(%rbp),%rax
cmp    $0x4,%rax
jae    13ab <main+0x25b>
movl   $0x1,-0x1c(%rbp)
jmp    13be <main+0x26e>
jmp    13b0 <main+0x260>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    133f <main+0x1ef>
cmpl   $0x0,-0x1c(%rbp)
je     13cd <main+0x27d>
jmp    16e9 <main+0x599>
cmpl   $0x0,-0x78(%rbp)
jne    142e <main+0x2de>
movss  -0x34(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc20(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1429 <main+0x2d9>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x90(%rbp),%eax
jle    1424 <main+0x2d4>
movl   $0x1,-0x78(%rbp)
movl   $0x0,-0x8c(%rbp)
jmp    1429 <main+0x2d9>
jmp    162c <main+0x4dc>
cmpl   $0x1,-0x78(%rbp)
jne    14a4 <main+0x354>
movss  -0x34(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xbb7(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    149f <main+0x34f>
movl   $0x3,-0x78(%rbp)
cvtsi2sdl -0x74(%rbp),%xmm0
cvtsi2sdl -0x54(%rbp),%xmm1
cvtsi2sdl -0x28(%rbp),%xmm2
divsd  %xmm2,%xmm1
lea    0xc13(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movl   $0x0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movl   $0x0,-0x8c(%rbp)
jmp    1627 <main+0x4d7>
cmpl   $0x3,-0x78(%rbp)
jne    15e2 <main+0x492>
movss  -0x34(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xb49(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    15dd <main+0x48d>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x90(%rbp),%eax
jle    15d8 <main+0x488>
movl   $0x2,-0x78(%rbp)
cvtsi2sdl -0x74(%rbp),%xmm0
cvtsi2sdl -0x54(%rbp),%xmm1
cvtsi2sdl -0x28(%rbp),%xmm2
divsd  %xmm2,%xmm1
cvtsi2sdl -0x58(%rbp),%xmm2
cvtsi2sdl -0x28(%rbp),%xmm3
divsd  %xmm3,%xmm2
lea    0xb88(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movsd  -0x80(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm1
cvtsi2sdl -0x58(%rbp),%xmm2
cvtsi2sdl -0x28(%rbp),%xmm3
divsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
lea    0xb85(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x88(%rbp),%xmm1
ff
cvtsi2sdl -0x58(%rbp),%xmm2
cvtsi2sdl -0x28(%rbp),%xmm3
divsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
lea    0xb85(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  -0x80(%rbp),%xmm0
addsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
addsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
cvtsi2sdl -0x58(%rbp),%xmm0
cvtsi2sdl -0x28(%rbp),%xmm1
divsd  %xmm1,%xmm0
addsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
movl   $0x0,-0x8c(%rbp)
jmp    15dd <main+0x48d>
jmp    1622 <main+0x4d2>
cmpl   $0x2,-0x78(%rbp)
jne    161d <main+0x4cd>
movss  -0x34(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xa03(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1618 <main+0x4c8>
movl   $0x0,-0x78(%rbp)
movl   $0x0,-0x8c(%rbp)
jmp    161d <main+0x4cd>
jmp    1622 <main+0x4d2>
jmp    1627 <main+0x4d7>
jmp    162c <main+0x4dc>
cmpl   $0x3,-0x78(%rbp)
jne    16db <main+0x58b>
movss  -0x50(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0x9d1(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0x9bd(%rip),%xmm1
divsd  %xmm1,%xmm0
movss  -0x4c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movss  -0x4c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0x99e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0x98a(%rip),%xmm1
divsd  %xmm1,%xmm0
movss  -0x48(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
cvtsi2sdl -0x28(%rbp),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x68(%rbp),%xmm0
cvtsi2sdl -0x28(%rbp),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1322 <main+0x1d2>
mov    -0x20(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1040 <read@plt>
cvtsi2sdq -0x70(%rbp),%xmm0
lea    0xa1f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1040 <read@plt>
cvtsi2sdq -0x70(%rbp),%xmm0
lea    0x929(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x98(%rbp),%xmm0
ff
addsd  -0xa0(%rbp),%xmm0
ff
cvtsi2sdl -0x74(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x98(%rbp),%xmm1
ff
addsd  -0xa0(%rbp),%xmm1
ff
divsd  -0xa8(%rbp),%xmm1
ff
lea    0x9cc(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    $0x0,%ebx
cmp    $0x2,%edi
jl     118a <main+0x3a>
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
mov    0x2e6f(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    15fe <main+0x4ae>
lea    0x14(%rsp),%r14
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   1040 <read@plt>
cvtsi2sdl 0x14(%rsp),%xmm0
lea    0xea6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0x18(%rsp),%rbp
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   1040 <read@plt>
xorps  %xmm0,%xmm0
cvtsi2sdq 0x18(%rsp),%xmm0
lea    0xe8a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   1040 <read@plt>
xorps  %xmm0,%xmm0
cvtsi2sdq 0x18(%rsp),%xmm0
lea    0xe75(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   1040 <read@plt>
movslq 0x14(%rsp),%rbp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movapd %xmm0,0x60(%rsp)
lea    0xe4d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
imul   $0x10624dd3,%rbp,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
test   %eax,%eax
mov    $0x1,%ecx
cmovg  %eax,%ecx
mov    %ecx,0x20(%rsp)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   1040 <read@plt>
mov    0x14(%rsp),%eax
mov    %rax,0x48(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
lea    0xe0e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movaps 0x60(%rsp),%xmm0
movlhps %xmm0,%xmm0
movaps %xmm0,0x90(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
xorps  %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
xor    %r13d,%r13d
movl   $0x0,0x24(%rsp)
movl   $0x0,0x10(%rsp)
xor    %r12d,%r12d
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
jmp    12e4 <main+0x194>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r13d
cmpl   $0x0,0x48(%rsp)
jle    133b <main+0x1eb>
mov    0x48(%rsp),%r14
lea    0x70(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x4,%edx
mov    %ebx,%edi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <read@plt>
mov    %eax,%r15d
movss  0x0(%rbp),%xmm0
call   1070 <isinf@plt>
test   %rax,%rax
jne    1558 <main+0x408>
cmp    $0x4,%r15d
jb     1558 <main+0x408>
add    $0x4,%rbp
add    $0xffffffffffffffff,%r14
jne    1300 <main+0x1b0>
cmp    $0x3,%r12d
ja     12e0 <main+0x190>
mov    %r12d,%eax
lea    0xce5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0x8c(%rsp),%xmm0
xor    %r12d,%r12d
ucomiss 0xc9d(%rip),%xmm0
jbe    12e0 <main+0x190>
xor    %r12d,%r12d
mov    0x8(%rsp),%rax
cmp    0x20(%rsp),%eax
lea    0x1(%rax),%eax
setge  %r12b
mov    $0x0,%ecx
cmovge %ecx,%eax
mov    %rax,0x8(%rsp)
add    $0x1,%r13d
jmp    12e4 <main+0x194>
mov    $0x2,%r12d
movss  0xc5c(%rip),%xmm0
ucomiss 0x8c(%rsp),%xmm0
jbe    12e0 <main+0x190>
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %r12d,%r12d
jmp    12e0 <main+0x190>
mov    $0x1,%r12d
movss  0xc31(%rip),%xmm0
ucomiss 0x8c(%rsp),%xmm0
jbe    12e0 <main+0x190>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x10(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %r13d,%xmm1
divsd  0x60(%rsp),%xmm1
lea    0xcac(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xorpd  %xmm3,%xmm3
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %eax,%eax
jmp    1440 <main+0x2f0>
movss  0x8c(%rsp),%xmm0
ucomiss 0xbe3(%rip),%xmm0
mov    0x24(%rsp),%eax
movapd 0x30(%rsp),%xmm3
jbe    1440 <main+0x2f0>
mov    0x8(%rsp),%rcx
cmp    0x20(%rsp),%ecx
jge    1495 <main+0x345>
add    $0x1,%ecx
mov    %rcx,0x8(%rsp)
cvtps2pd 0x70(%rsp),%xmm0
movapd %xmm0,%xmm1
divpd  0xbbf(%rip),%xmm1
divpd  0xbc7(%rip),%xmm1
movss  0x78(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
shufpd $0x1,%xmm2,%xmm0
mulpd  %xmm1,%xmm0
divpd  0x90(%rsp),%xmm0
addpd  %xmm0,%xmm3
movapd %xmm3,0x30(%rsp)
add    $0x1,%eax
mov    %eax,0x24(%rsp)
mov    $0x3,%r12d
add    $0x1,%r13d
jmp    12e4 <main+0x194>
mov    0x10(%rsp),%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %r13d,%xmm1
movapd 0x60(%rsp),%xmm4
divsd  %xmm4,%xmm1
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
divsd  %xmm4,%xmm2
movsd  %xmm2,0x8(%rsp)
lea    0xbf7(%rip),%rdi
mov    $0x3,%al
movapd %xmm3,0x30(%rsp)
call   1030 <printf@plt>
movapd 0x30(%rsp),%xmm0
movapd %xmm0,%xmm1
divsd  0x8(%rsp),%xmm1
lea    0xbfa(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movapd 0x30(%rsp),%xmm0
unpckhpd %xmm0,%xmm0
movapd %xmm0,%xmm1
divsd  0x8(%rsp),%xmm1
lea    0xc08(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movapd 0x50(%rsp),%xmm0
addpd  0x30(%rsp),%xmm0
movapd %xmm0,0x50(%rsp)
movsd  0x28(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
add    $0x1,%ebp
mov    %ebp,0x10(%rsp)
mov    $0x2,%r12d
xor    %eax,%eax
mov    %rax,0x8(%rsp)
add    $0x1,%r13d
jmp    12e4 <main+0x194>
xor    %r14d,%r14d
lea    0x18(%rsp),%rbp
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   1040 <read@plt>
xorps  %xmm0,%xmm0
cvtsi2sdq 0x18(%rsp),%xmm0
lea    0xbc6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   1040 <read@plt>
xorps  %xmm0,%xmm0
cvtsi2sdq 0x18(%rsp),%xmm0
lea    0xace(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movapd 0x50(%rsp),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm2,%xmm2
cvtsi2sdl 0x10(%rsp),%xmm2
movapd %xmm1,%xmm0
divsd  %xmm2,%xmm0
divsd  0x28(%rsp),%xmm1
lea    0xb79(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    %r14d,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x29d3(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbp),%rdx
lea    0xa2e(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%r14d
jmp    15e9 <main+0x499>

LLVM IR (-O0):
@O_RDONLY = global i32 0
@stderr = global i32 0
@.str = [19 x i8] c"Could not open %s\0A\00"
@.str.1 = [18 x i8] c"(* Version %d *)\0A\00"
@.str.2 = [20 x i8] c"(* Start Time %lld.\00"
@.str.3 = [9 x i8] c"%06lld)\0A\00"
@.str.4 = [18 x i8] c"(* Rate %d Hz *)\0A\00"
@.str.5 = [19 x i8] c"(* Channels %d *)\0A\00"
@.str.6 = [26 x i8] c"Starting Trace %d at %lf\0A\00"
@.str.7 = [39 x i8] c"Ending Trace %d at %lfs, %lfs Elapsed\0A\00"
@.str.8 = [48 x i8] c"Total VDD Energy: %lfJ Average VDD Power: %lfW\0A\00"
@.str.9 = [48 x i8] c"Total VPP Energy: %lfJ Average VPP Power: %lfW\0A\00"
@.str.10 = [19 x i8] c"(* Stop Time %lld.\00"
@.str.11 = [38 x i8] c"Average Joules=%lf\09Average Watts=%lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [8 x float]
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
%17 = alloca double
%18 = alloca i64
%19 = alloca i32
%20 = alloca i32
%21 = alloca double
%22 = alloca double
%23 = alloca i32
%24 = alloca i32
%25 = alloca double
%26 = alloca double
%27 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %19
store i32 0, i32* %20
store double 0.000000e+00, double* %22
store i32 0, i32* %23
store i32 1, i32* %24
store double 0.000000e+00, double* %25
store double 0.000000e+00, double* %26
store double 0.000000e+00, double* %27
%28 = load i32, i32* %4
%29 = icmp sgt i32 %28, 1
br i1 %29, label %30, label %45
30: ; preds = %2
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = load i32, i32* @O_RDONLY
%35 = call i32 @open(i8* %33, i32 %34)
store i32 %35, i32* %9
%36 = load i32, i32* %9
%37 = icmp slt i32 %36, 1
br i1 %37, label %38, label %44
38: ; preds = %30
%39 = load i32, i32* @stderr
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %42)
store i32 -1, i32* %3
br label %288
44: ; preds = %30
br label %46
45: ; preds = %2
store i32 0, i32* %9
br label %46
46: ; preds = %45, %44
%47 = load i32, i32* %9
%48 = call i32 (i32, ...) @read(i32 %47, i32* %10, i32 4)
%49 = load i32, i32* %10
%50 = sitofp i32 %49 to double
%51 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), double %50)
%52 = load i32, i32* %9
%53 = call i32 (i32, ...) @read(i32 %52, i64* %18, i32 8)
%54 = load i64, i64* %18
%55 = sitofp i64 %54 to double
%56 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), double %55)
%57 = load i32, i32* %9
%58 = call i32 (i32, ...) @read(i32 %57, i64* %18, i32 8)
%59 = load i64, i64* %18
%60 = sitofp i64 %59 to double
%61 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double %60)
%62 = load i32, i32* %9
%63 = call i32 (i32, ...) @read(i32 %62, i32* %10, i32 4)
%64 = load i32, i32* %10
store i32 %64, i32* %11
%65 = load i32, i32* %11
%66 = sitofp i32 %65 to double
%67 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), double %66)
%68 = load i32, i32* %11
%69 = sdiv i32 %68, 500
store i32 %69, i32* %24
%70 = load i32, i32* %24
%71 = icmp slt i32 %70, 1
br i1 %71, label %72, label %73
72: ; preds = %46
store i32 1, i32* %24
br label %73
73: ; preds = %72, %46
%74 = load i32, i32* %9
%75 = call i32 (i32, ...) @read(i32 %74, i32* %10, i32 4)
%76 = load i32, i32* %10
store i32 %76, i32* %12
%77 = load i32, i32* %12
%78 = sitofp i32 %77 to double
%79 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), double %78)
br label %80
80: ; preds = %262, %73
%81 = load i32, i32* %8
%82 = icmp ne i32 %81, 0
%83 = xor i1 %82, true
br i1 %83, label %84, label %265
84: ; preds = %80
store i32 0, i32* %6
br label %85
85: ; preds = %108, %84
%86 = load i32, i32* %6
%87 = load i32, i32* %12
%88 = icmp slt i32 %86, %87
br i1 %88, label %89, label %111
89: ; preds = %85
%90 = load i32, i32* %9
%91 = load i32, i32* %6
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [8 x float], [8 x float]* %13, i64 0, i64 %92
%94 = call i32 (i32, ...) @read(i32 %90, float* %93, i64 4)
store i32 %94, i32* %7
%95 = load i32, i32* %6
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [8 x float], [8 x float]* %13, i64 0, i64 %96
%98 = load float, float* %97
%99 = call i64 @isinf(float %98)
%100 = icmp ne i64 %99, 0
br i1 %100, label %101, label %102
101: ; preds = %89
store i32 1, i32* %8
br label %111
102: ; preds = %89
%103 = load i32, i32* %7
%104 = sext i32 %103 to i64
%105 = icmp ult i64 %104, 4
br i1 %105, label %106, label %107
106: ; preds = %102
store i32 1, i32* %8
br label %111
107: ; preds = %102
br label %108
108: ; preds = %107
%109 = load i32, i32* %6
%110 = add nsw i32 %109, 1
store i32 %110, i32* %6
br label %85
111: ; preds = %106, %101, %85
%112 = load i32, i32* %8
%113 = icmp ne i32 %112, 0
br i1 %113, label %114, label %115
114: ; preds = %111
br label %265
115: ; preds = %111
%116 = load i32, i32* %20
%117 = icmp eq i32 %116, 0
br i1 %117, label %118, label %132
118: ; preds = %115
%119 = getelementptr inbounds [8 x float], [8 x float]* %13, i64 0, i64 7
%120 = load float, float* %119
%121 = fpext float %120 to double
%122 = fcmp ogt double %121, 4.000000e+00
br i1 %122, label %123, label %131
123: ; preds = %118
%124 = load i32, i32* %23
%125 = add nsw i32 %124, 1
store i32 %125, i32* %23
%126 = load i32, i32* %23
%127 = load i32, i32* %24
%128 = icmp sgt i32 %126, %127
br i1 %128, label %129, label %130
129: ; preds = %123
store i32 1, i32* %20
store i32 0, i32* %23
br label %130
130: ; preds = %129, %123
br label %131
131: ; preds = %130, %118
br label %226
132: ; preds = %115
%133 = load i32, i32* %20
%134 = icmp eq i32 %133, 1
br i1 %134, label %135, label %150
135: ; preds = %132
%136 = getelementptr inbounds [8 x float], [8 x float]* %13, i64 0, i64 7
%137 = load float, float* %136
%138 = fpext float %137 to double
%139 = fcmp olt double %138, -4.000000e+00
br i1 %139, label %140, label %149
140: ; preds = %135
store i32 3, i32* %20
%141 = load i32, i32* %19
%142 = sitofp i32 %141 to double
%143 = load i32, i32* %14
%144 = sitofp i32 %143 to double
%145 = load i32, i32* %11
%146 = sitofp i32 %145 to double
%147 = fdiv double %144, %146
%148 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), double %142, double %147)
store i32 0, i32* %15
store double 0.000000e+00, double* %21
store double 0.000000e+00, double* %22
store i32 0, i32* %23
br label %149
149: ; preds = %140, %135
br label %225
150: ; preds = %132
%151 = load i32, i32* %20
%152 = icmp eq i32 %151, 3
br i1 %152, label %153, label %213
153: ; preds = %150
%154 = getelementptr inbounds [8 x float], [8 x float]* %13, i64 0, i64 7
%155 = load float, float* %154
%156 = fpext float %155 to double
%157 = fcmp ogt double %156, 4.000000e+00
br i1 %157, label %158, label %212
158: ; preds = %153
%159 = load i32, i32* %23
%160 = add nsw i32 %159, 1
store i32 %160, i32* %23
%161 = load i32, i32* %23
%162 = load i32, i32* %24
%163 = icmp sgt i32 %161, %162
br i1 %163, label %164, label %211
164: ; preds = %158
store i32 2, i32* %20
%165 = load i32, i32* %19
%166 = sitofp i32 %165 to double
%167 = load i32, i32* %14
%168 = sitofp i32 %167 to double
%169 = load i32, i32* %11
%170 = sitofp i32 %169 to double
%171 = fdiv double %168, %170
%172 = load i32, i32* %15
%173 = sitofp i32 %172 to double
%174 = load i32, i32* %11
%175 = sitofp i32 %174 to double
%176 = fdiv double %173, %175
%177 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0), double %166, double %171, double %176)
%178 = load double, double* %21
%179 = load double, double* %21
%180 = load i32, i32* %15
%181 = sitofp i32 %180 to double
%182 = load i32, i32* %11
%183 = sitofp i32 %182 to double
%184 = fdiv double %181, %183
%185 = fdiv double %179, %184
%186 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0), double %178, double %185)
%187 = load double, double* %22
%188 = load double, double* %22
%189 = load i32, i32* %15
%190 = sitofp i32 %189 to double
%191 = load i32, i32* %11
%192 = sitofp i32 %191 to double
%193 = fdiv double %190, %192
%194 = fdiv double %188, %193
%195 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.9, i64 0, i64 0), double %187, double %194)
%196 = load double, double* %21
%197 = load double, double* %25
%198 = fadd double %197, %196
store double %198, double* %25
%199 = load double, double* %22
%200 = load double, double* %26
%201 = fadd double %200, %199
store double %201, double* %26
%202 = load i32, i32* %15
%203 = sitofp i32 %202 to double
%204 = load i32, i32* %11
%205 = sitofp i32 %204 to double
%206 = fdiv double %203, %205
%207 = load double, double* %27
%208 = fadd double %207, %206
store double %208, double* %27
%209 = load i32, i32* %19
%210 = add nsw i32 %209, 1
store i32 %210, i32* %19
store i32 0, i32* %23
br label %211
211: ; preds = %164, %158
br label %212
212: ; preds = %211, %153
br label %224
213: ; preds = %150
%214 = load i32, i32* %20
%215 = icmp eq i32 %214, 2
br i1 %215, label %216, label %223
216: ; preds = %213
%217 = getelementptr inbounds [8 x float], [8 x float]* %13, i64 0, i64 7
%218 = load float, float* %217
%219 = fpext float %218 to double
%220 = fcmp olt double %219, -4.000000e+00
br i1 %220, label %221, label %222
221: ; preds = %216
store i32 0, i32* %20
store i32 0, i32* %23
br label %222
222: ; preds = %221, %216
br label %223
223: ; preds = %222, %213
br label %224
224: ; preds = %223, %212
br label %225
225: ; preds = %224, %149
br label %226
226: ; preds = %225, %131
%227 = load i32, i32* %20
%228 = icmp eq i32 %227, 3
br i1 %228, label %229, label %262
229: ; preds = %226
%230 = getelementptr inbounds [8 x float], [8 x float]* %13, i64 0, i64 0
%231 = load float, float* %230
%232 = fpext float %231 to double
%233 = fdiv double %232, 1.000000e+02
%234 = fdiv double %233, 5.000000e-03
%235 = getelementptr inbounds [8 x float], [8 x float]* %13, i64 0, i64 1
%236 = load float, float* %235
%237 = fpext float %236 to double
%238 = fmul double %234, %237
store double %238, double* %16
%239 = getelementptr inbounds [8 x float], [8 x float]* %13, i64 0, i64 1
%240 = load float, float* %239
%241 = fpext float %240 to double
%242 = fdiv double %241, 1.000000e+02
%243 = fdiv double %242, 5.000000e-03
%244 = getelementptr inbounds [8 x float], [8 x float]* %13, i64 0, i64 2
%245 = load float, float* %244
%246 = fpext float %245 to double
%247 = fmul double %243, %246
store double %247, double* %17
%248 = load double, double* %16
%249 = load i32, i32* %11
%250 = sitofp i32 %249 to double
%251 = fdiv double %248, %250
%252 = load double, double* %21
%253 = fadd double %252, %251
store double %253, double* %21
%254 = load double, double* %17
%255 = load i32, i32* %11
%256 = sitofp i32 %255 to double
%257 = fdiv double %254, %256
%258 = load double, double* %22
%259 = fadd double %258, %257
store double %259, double* %22
%260 = load i32, i32* %15
%261 = add nsw i32 %260, 1
store i32 %261, i32* %15
br label %262
262: ; preds = %229, %226
%263 = load i32, i32* %14
%264 = add nsw i32 %263, 1
store i32 %264, i32* %14
br label %80
265: ; preds = %114, %80
%266 = load i32, i32* %9
%267 = call i32 (i32, ...) @read(i32 %266, i64* %18, i32 8)
%268 = load i64, i64* %18
%269 = sitofp i64 %268 to double
%270 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), double %269)
%271 = load i32, i32* %9
%272 = call i32 (i32, ...) @read(i32 %271, i64* %18, i32 8)
%273 = load i64, i64* %18
%274 = sitofp i64 %273 to double
%275 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double %274)
%276 = load double, double* %25
%277 = load double, double* %26
%278 = fadd double %276, %277
%279 = load i32, i32* %19
%280 = sitofp i32 %279 to double
%281 = fdiv double %278, %280
%282 = load double, double* %25
%283 = load double, double* %26
%284 = fadd double %282, %283
%285 = load double, double* %27
%286 = fdiv double %284, %285
%287 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), double %281, double %286)
store i32 0, i32* %3
br label %288
288: ; preds = %265, %38
%289 = load i32, i32* %3
ret i32 %289
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@stderr = global i32 0
@.str = [19 x i8] c"Could not open %s\0A\00"
@.str.1 = [18 x i8] c"(* Version %d *)\0A\00"
@.str.2 = [20 x i8] c"(* Start Time %lld.\00"
@.str.3 = [9 x i8] c"%06lld)\0A\00"
@.str.4 = [18 x i8] c"(* Rate %d Hz *)\0A\00"
@.str.5 = [19 x i8] c"(* Channels %d *)\0A\00"
@.str.6 = [26 x i8] c"Starting Trace %d at %lf\0A\00"
@.str.7 = [39 x i8] c"Ending Trace %d at %lfs, %lfs Elapsed\0A\00"
@.str.8 = [48 x i8] c"Total VDD Energy: %lfJ Average VDD Power: %lfW\0A\00"
@.str.9 = [48 x i8] c"Total VPP Energy: %lfJ Average VPP Power: %lfW\0A\00"
@.str.10 = [19 x i8] c"(* Stop Time %lld.\00"
@.str.11 = [38 x i8] c"Average Joules=%lf\09Average Watts=%lf\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [8 x float]
%5 = alloca i64
%6 = bitcast i32* %3 to i8*
%7 = bitcast [8 x float]* %4 to i8*
%8 = bitcast i64* %5 to i8*
%9 = icmp sgt i32 %0, 1
br i1 %9, label %10, label %20
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = load i32, i32* @O_RDONLY
%14 = tail call i32 @open(i8* %12, i32 %13)
%15 = icmp slt i32 %14, 1
br i1 %15, label %16, label %20
16: ; preds = %10
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %11
%19 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %18)
br label %159
20: ; preds = %2, %10
%21 = phi i32 [ %14, %10 ], [ 0, %2 ]
%22 = call i32 (i32, ...) @read(i32 %21, i32* %3, i32 4)
%23 = load i32, i32* %3
%24 = sitofp i32 %23 to double
%25 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), double %24)
%26 = call i32 (i32, ...) @read(i32 %21, i64* %5, i32 8)
%27 = load i64, i64* %5
%28 = sitofp i64 %27 to double
%29 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), double %28)
%30 = call i32 (i32, ...) @read(i32 %21, i64* %5, i32 8)
%31 = load i64, i64* %5
%32 = sitofp i64 %31 to double
%33 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double %32)
%34 = call i32 (i32, ...) @read(i32 %21, i32* %3, i32 4)
%35 = load i32, i32* %3
%36 = sitofp i32 %35 to double
%37 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), double %36)
%38 = sdiv i32 %35, 500
%39 = icmp sgt i32 %38, 1
%40 = select i1 %39, i32 %38, i32 1
%41 = call i32 (i32, ...) @read(i32 %21, i32* %3, i32 4)
%42 = load i32, i32* %3
%43 = sitofp i32 %42 to double
%44 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), double %43)
%45 = icmp sgt i32 %42, 0
%46 = getelementptr inbounds [8 x float], [8 x float]* %4, i64 0, i64 7
%47 = getelementptr inbounds [8 x float], [8 x float]* %4, i64 0, i64 2
%48 = zext i32 %42 to i64
%49 = insertelement <2 x double> poison, double %36, i64 0
%50 = shufflevector <2 x double> %49, <2 x double> poison, <2 x i32> zeroinitializer
%51 = bitcast [8 x float]* %4 to <2 x float>*
br label %52
52: ; preds = %134, %20
%53 = phi i32 [ 0, %20 ], [ %142, %134 ]
%54 = phi i32 [ 0, %20 ], [ %139, %134 ]
%55 = phi i32 [ 0, %20 ], [ %138, %134 ]
%56 = phi i32 [ 0, %20 ], [ %137, %134 ]
%57 = phi i32 [ 0, %20 ], [ %136, %134 ]
%58 = phi double [ 0.000000e+00, %20 ], [ %135, %134 ]
%59 = phi <2 x double> [ zeroinitializer, %20 ], [ %140, %134 ]
%60 = phi <2 x double> [ <double undef, double 0.000000e+00>, %20 ], [ %141, %134 ]
br i1 %45, label %63, label %73
61: ; preds = %63
%62 = icmp eq i64 %72, %48
br i1 %62, label %73, label %63
63: ; preds = %52, %61
%64 = phi i64 [ %72, %61 ], [ 0, %52 ]
%65 = getelementptr inbounds [8 x float], [8 x float]* %4, i64 0, i64 %64
%66 = call i32 (i32, ...) @read(i32 %21, float* %65, i64 4)
%67 = load float, float* %65
%68 = call i64 @isinf(float %67)
%69 = icmp ne i64 %68, 0
%70 = icmp ult i32 %66, 4
%71 = select i1 %69, i1 true, i1 %70
%72 = add nuw nsw i64 %64, 1
br i1 %71, label %143, label %61
73: ; preds = %61, %52
switch i32 %56, label %134 [
i32 0, label %74
i32 1, label %83
i32 3, label %91
i32 2, label %113
]
74: ; preds = %73
%75 = load float, float* %46
%76 = fcmp ogt float %75, 4.000000e+00
br i1 %76, label %77, label %134
77: ; preds = %74
%78 = add nsw i32 %57, 1
%79 = icmp slt i32 %57, %40
%80 = xor i1 %79, true
%81 = zext i1 %80 to i32
%82 = select i1 %79, i32 %78, i32 0
br label %134
83: ; preds = %73
%84 = load float, float* %46
%85 = fcmp olt float %84, -4.000000e+00
br i1 %85, label %86, label %134
86: ; preds = %83
%87 = sitofp i32 %55 to double
%88 = sitofp i32 %53 to double
%89 = fdiv double %88, %36
%90 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), double %87, double %89)
br label %117
91: ; preds = %73
%92 = load float, float* %46
%93 = fcmp ogt float %92, 4.000000e+00
br i1 %93, label %94, label %117
94: ; preds = %91
%95 = add nsw i32 %57, 1
%96 = icmp slt i32 %57, %40
br i1 %96, label %117, label %97
97: ; preds = %94
%98 = sitofp i32 %55 to double
%99 = sitofp i32 %53 to double
%100 = fdiv double %99, %36
%101 = sitofp i32 %54 to double
%102 = fdiv double %101, %36
%103 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0), double %98, double %100, double %102)
%104 = extractelement <2 x double> %60, i64 0
%105 = fdiv double %104, %102
%106 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0), double %104, double %105)
%107 = extractelement <2 x double> %60, i64 1
%108 = fdiv double %107, %102
%109 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.9, i64 0, i64 0), double %107, double %108)
%110 = fadd <2 x double> %60, %59
%111 = fadd double %102, %58
%112 = add nsw i32 %55, 1
br label %134
113: ; preds = %73
%114 = load float, float* %46
%115 = fcmp olt float %114, -4.000000e+00
br i1 %115, label %116, label %134
116: ; preds = %113
br label %134
117: ; preds = %91, %94, %86
%118 = phi i32 [ %57, %91 ], [ %95, %94 ], [ 0, %86 ]
%119 = phi i32 [ %54, %91 ], [ %54, %94 ], [ 0, %86 ]
%120 = phi <2 x double> [ %60, %91 ], [ %60, %94 ], [ zeroinitializer, %86 ]
%121 = load <2 x float>, <2 x float>* %51
%122 = fpext <2 x float> %121 to <2 x double>
%123 = fdiv <2 x double> %122, <double 1.000000e+02, double 1.000000e+02>
%124 = fdiv <2 x double> %123, <double 5.000000e-03, double 5.000000e-03>
%125 = load float, float* %47
%126 = fpext float %125 to double
%127 = extractelement <2 x double> %122, i64 1
%128 = insertelement <2 x double> poison, double %127, i64 0
%129 = insertelement <2 x double> %128, double %126, i64 1
%130 = fmul <2 x double> %124, %129
%131 = fdiv <2 x double> %130, %50
%132 = fadd <2 x double> %120, %131
%133 = add nsw i32 %119, 1
br label %134
134: ; preds = %73, %77, %113, %116, %97, %83, %74, %117
%135 = phi double [ %58, %117 ], [ %58, %77 ], [ %58, %113 ], [ %58, %116 ], [ %111, %97 ], [ %58, %83 ], [ %58, %74 ], [ %58, %73 ]
%136 = phi i32 [ %118, %117 ], [ %82, %77 ], [ %57, %113 ], [ 0, %116 ], [ 0, %97 ], [ %57, %83 ], [ %57, %74 ], [ %57, %73 ]
%137 = phi i32 [ 3, %117 ], [ %81, %77 ], [ 2, %113 ], [ 0, %116 ], [ 2, %97 ], [ 1, %83 ], [ 0, %74 ], [ %56, %73 ]
%138 = phi i32 [ %55, %117 ], [ %55, %77 ], [ %55, %113 ], [ %55, %116 ], [ %112, %97 ], [ %55, %83 ], [ %55, %74 ], [ %55, %73 ]
%139 = phi i32 [ %133, %117 ], [ %54, %77 ], [ %54, %113 ], [ %54, %116 ], [ %54, %97 ], [ %54, %83 ], [ %54, %74 ], [ %54, %73 ]
%140 = phi <2 x double> [ %59, %117 ], [ %59, %77 ], [ %59, %113 ], [ %59, %116 ], [ %110, %97 ], [ %59, %83 ], [ %59, %74 ], [ %59, %73 ]
%141 = phi <2 x double> [ %132, %117 ], [ %60, %77 ], [ %60, %113 ], [ %60, %116 ], [ %60, %97 ], [ %60, %83 ], [ %60, %74 ], [ %60, %73 ]
%142 = add nuw nsw i32 %53, 1
br label %52
143: ; preds = %63
%144 = call i32 (i32, ...) @read(i32 %21, i64* %5, i32 8)
%145 = load i64, i64* %5
%146 = sitofp i64 %145 to double
%147 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), double %146)
%148 = call i32 (i32, ...) @read(i32 %21, i64* %5, i32 8)
%149 = load i64, i64* %5
%150 = sitofp i64 %149 to double
%151 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double %150)
%152 = shufflevector <2 x double> %59, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%153 = fadd <2 x double> %59, %152
%154 = extractelement <2 x double> %153, i64 0
%155 = sitofp i32 %55 to double
%156 = fdiv double %154, %155
%157 = fdiv double %154, %58
%158 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), double %156, double %157)
br label %159
159: ; preds = %143, %16
%160 = phi i32 [ -1, %16 ], [ 0, %143 ]
ret i32 %160
}