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

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ get_float_from_within_string(char **, double *);
scalar_t__ malloc(int);
scalar_t__ realloc(char *, int);
int /*<<< orphan*/ stdout;
int read_brkdata(double **bbrk, FILE *fp, int mode) {
  double *p, *w, zmax, zmin, lasttime = 0;
  char *q, temp[400];
  int is_time = 1, is_insert = 0, cnt = 0;
  int arraysize = 200;
  if (mode == 1) {
    zmax = 120.0;
    zmin = -120.0;
  } else {
    zmax = 1000.0;
    zmin = 0.001;
  }
  if ((*bbrk = (double *)malloc(arraysize * sizeof(double))) == NULL) {
    fprintf(stdout,
            "ERROR: INSUFFICIENT MEMORY to store input brktable data.\n");
    fflush(stdout);
    return (0);
  }
  p = *bbrk;
  cnt = 0;
  while (fgets(temp, 200, fp) == temp) {
    q = temp;
    while (get_float_from_within_string(&q, p)) {
      if (is_time) {
        if (cnt == 0) {
          if (*p < 0.0) {
            fprintf(
                stdout,
                "ERROR: First timeval (%lf) in brkpntfile is less than zero.\n",
                *p);
            fflush(stdout);
            return (0);
          } else if (*p > 0.0) {
            is_insert = 1;
          }
        } else {
          if (is_insert) {
            p += 2;
            cnt += 2;
            w = p;
            *p = *(p - 2);
            p--;
            *p = *(p - 2);
            p--;
            *p = *(p - 2);
            (*bbrk)[0] = 0.0;
            p = w;
            is_insert = 0;
          }
          if (*p <= lasttime) {
            fprintf(stdout,
                    "ERROR: Times (%lf & %lf) in brkpntfile are not in "
                    "increasing order.\n",
                    *p, lasttime);
            fflush(stdout);
            return (0);
          }
        }
        lasttime = *p;
      } else {
        if (*p < zmin || *p > zmax) {
          fprintf(stdout,
                  "ERROR: Time stretch values are out of range (%lf to %lf)\n",
                  zmin, zmax);
          fflush(stdout);
          return (0);
        }
      }
      is_time = !is_time;
      p++;
      if (++cnt >= arraysize) {
        arraysize += 200;
        if ((*bbrk = (double *)realloc((char *)(*bbrk),
                                       arraysize * sizeof(double))) == NULL) {
          fprintf(stdout, "ERROR: INSUFFICIENT MEMORY to reallocate input "
                          "brktable data.\n");
          fflush(stdout);
          return (0);
        }
        p = (*bbrk) + cnt;
      }
    }
  }
  if (cnt < 4) {
    fprintf(stdout, "ERROR: Not enough data in brkpnt file.\n");
    fflush(stdout);
    return (0);
  }
  if (cnt & 1) {
    fprintf(stdout, "ERROR: Data not paired correctly in brkpntfile.\n");
    fflush(stdout);
    return (0);
  }
  return cnt / 2;
}


x86 assembly (clang, -O0):
<read_brkdata>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x1,-0x1e4(%rbp)
movl   $0x0,-0x1e8(%rbp)
movl   $0x0,-0x1ec(%rbp)
movl   $0xc8,-0x1f0(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    11cf <read_brkdata+0x6f>
movsd  0xe60(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe4b(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    11e9 <read_brkdata+0x89>
movsd  0xe31(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe1c(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movslq -0x1f0(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    -0x10(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    123d <read_brkdata+0xdd>
mov    0x2dcd(%rip),%rax
mov    (%rax),%edi
lea    0xe04(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
movl   $0x0,-0x4(%rbp)
jmp    15f6 <read_brkdata+0x496>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1ec(%rbp)
lea    -0x1e0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0xc8,%esi
call   1040 <fgets@plt>
lea    -0x1e0(%rbp),%rcx
cmp    %rcx,%rax
jne    1564 <read_brkdata+0x404>
lea    -0x1e0(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x28(%rbp),%rsi
lea    -0x50(%rbp),%rdi
call   1030 <get_float_from_within_string@plt>
cmp    $0x0,%rax
je     155f <read_brkdata+0x3ff>
cmpl   $0x0,-0x1e4(%rbp)
je     142d <read_brkdata+0x2cd>
cmpl   $0x0,-0x1ec(%rbp)
jne    1326 <read_brkdata+0x1c6>
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
jbe    12fd <read_brkdata+0x19d>
mov    0x2d15(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xd7e(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
mov    0x2cf6(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
movl   $0x0,-0x4(%rbp)
jmp    15f6 <read_brkdata+0x496>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    131c <read_brkdata+0x1bc>
movl   $0x1,-0x1e8(%rbp)
jmp    1321 <read_brkdata+0x1c1>
jmp    141b <read_brkdata+0x2bb>
cmpl   $0x0,-0x1e8(%rbp)
je     13c1 <read_brkdata+0x261>
mov    -0x28(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x28(%rbp)
mov    -0x1ec(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1ec(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
movsd  -0x10(%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsd  -0x10(%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsd  -0x10(%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1e8(%rbp)
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1416 <read_brkdata+0x2b6>
mov    0x2c01(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x48(%rbp),%xmm1
lea    0xca2(%rip),%rsi
mov    $0x2,%al
call   1050 <fprintf@plt>
mov    0x2bdd(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
movl   $0x0,-0x4(%rbp)
jmp    15f6 <read_brkdata+0x496>
jmp    141b <read_brkdata+0x2bb>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1497 <read_brkdata+0x337>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     1457 <read_brkdata+0x2f7>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    1492 <read_brkdata+0x332>
mov    0x2b82(%rip),%rax
mov    (%rax),%edi
movsd  -0x40(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
lea    0xc6b(%rip),%rsi
mov    $0x2,%al
call   1050 <fprintf@plt>
mov    0x2b61(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
movl   $0x0,-0x4(%rbp)
jmp    15f6 <read_brkdata+0x496>
jmp    1497 <read_brkdata+0x337>
cmpl   $0x0,-0x1e4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1e4(%rbp)
mov    -0x28(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x28(%rbp)
mov    -0x1ec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ec(%rbp)
cmp    -0x1f0(%rbp),%eax
jl     155a <read_brkdata+0x3fa>
mov    -0x1f0(%rbp),%eax
add    $0xc8,%eax
mov    %eax,-0x1f0(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
movslq -0x1f0(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%esi
call   1080 <realloc@plt>
mov    -0x10(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    1541 <read_brkdata+0x3e1>
mov    0x2ac9(%rip),%rax
mov    (%rax),%edi
lea    0xbf6(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2ab2(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
movl   $0x0,-0x4(%rbp)
jmp    15f6 <read_brkdata+0x496>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x1ec(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
jmp    1282 <read_brkdata+0x122>
jmp    1252 <read_brkdata+0xf2>
cmpl   $0x4,-0x1ec(%rbp)
jge    15a2 <read_brkdata+0x442>
mov    0x2a68(%rip),%rax
mov    (%rax),%edi
lea    0xbd4(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2a51(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
movl   $0x0,-0x4(%rbp)
jmp    15f6 <read_brkdata+0x496>
mov    -0x1ec(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     15e5 <read_brkdata+0x485>
mov    0x2a25(%rip),%rax
mov    (%rax),%edi
lea    0xbb9(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2a0e(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
movl   $0x0,-0x4(%rbp)
jmp    15f6 <read_brkdata+0x496>
mov    -0x1ec(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_brkdata>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1d8,%rsp
mov    %rsi,%rbp
mov    %rdi,%rbx
xor    %r13d,%r13d
cmp    $0x1,%edx
sete   %r15b
mov    $0x640,%edi
call   1060 <malloc@plt>
mov    %rbx,0x20(%rsp)
mov    %rax,(%rbx)
test   %rax,%rax
je     11c7 <read_brkdata+0x67>
mov    %rax,%r14
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc8,%esi
mov    %rbp,%rdx
call   1040 <fgets@plt>
cmp    %rbx,%rax
je     11fd <read_brkdata+0x9d>
mov    0x2e24(%rip),%rbx
mov    (%rbx),%edi
lea    0xf90(%rip),%rsi
jmp    11d7 <read_brkdata+0x77>
mov    0x2e12(%rip),%rbx
mov    (%rbx),%edi
lea    0xe49(%rip),%rsi
xor    %r12d,%r12d
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%rbx),%edi
call   1070 <fflush@plt>
mov    %r12d,%eax
add    $0x1d8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xc8,%eax
mov    %rax,0x28(%rsp)
mov    %rbp,0x30(%rsp)
mov    %r15b,%r13b
lea    0xdea(%rip),%rax
movsd  (%rax,%r13,8),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0xde7(%rip),%rax
movsd  (%rax,%r13,8),%xmm0
movsd  %xmm0,0x18(%rsp)
mov    $0x1,%r15d
xor    %r12d,%r12d
lea    0x38(%rsp),%rbp
movl   $0x0,0x4(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,0x38(%rsp)
mov    %rbp,%rdi
mov    %r14,%rsi
call   1030 <get_float_from_within_string@plt>
test   %rax,%rax
jne    12ba <read_brkdata+0x15a>
mov    %r15d,%r13d
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc8,%esi
mov    0x30(%rsp),%rdx
call   1040 <fgets@plt>
mov    %r13d,%r15d
cmp    %rbx,%rax
je     1255 <read_brkdata+0xf5>
jmp    1451 <read_brkdata+0x2f1>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x8,%r14
mov    %r15b,%r13b
mov    %rbp,%rdi
mov    %r14,%rsi
call   1030 <get_float_from_within_string@plt>
mov    %r13d,%r15d
test   %rax,%rax
je     126d <read_brkdata+0x10d>
test   %r15d,%r15d
je     1330 <read_brkdata+0x1d0>
test   %r12d,%r12d
je     1360 <read_brkdata+0x200>
cmpl   $0x0,0x4(%rsp)
je     12fc <read_brkdata+0x19c>
movsd  (%r14),%xmm0
movsd  %xmm0,0x10(%r14)
movupd -0x10(%r14),%xmm0
movupd %xmm0,(%r14)
add    $0x10,%r14
add    $0x2,%r12d
mov    0x20(%rsp),%rax
mov    (%rax),%rax
movq   $0x0,(%rax)
movsd  (%r14),%xmm0
movl   $0x0,0x4(%rsp)
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jae    13f4 <read_brkdata+0x294>
movsd  %xmm0,0x8(%rsp)
jmp    1390 <read_brkdata+0x230>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%r14),%xmm0
movsd  0x18(%rsp),%xmm1
ucomisd %xmm0,%xmm1
ja     1406 <read_brkdata+0x2a6>
ucomisd 0x10(%rsp),%xmm0
jbe    1390 <read_brkdata+0x230>
jmp    1406 <read_brkdata+0x2a6>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r14),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     142b <read_brkdata+0x2cb>
xor    %r12d,%r12d
movsd  %xmm0,0x8(%rsp)
ucomisd %xmm1,%xmm0
jbe    1390 <read_brkdata+0x230>
movl   $0x1,0x4(%rsp)
nopw   0x0(%rax,%rax,1)
xor    %r13d,%r13d
test   %r15d,%r15d
sete   %r15b
add    $0x1,%r12d
mov    0x28(%rsp),%rbx
cmp    %ebx,%r12d
jl     12a0 <read_brkdata+0x140>
mov    0x20(%rsp),%r14
mov    (%r14),%rdi
lea    0x640(,%rbx,8),%esi
call   1080 <realloc@plt>
mov    %rax,(%r14)
test   %rax,%rax
je     13df <read_brkdata+0x27f>
add    $0xc8,%ebx
mov    %rbx,0x28(%rsp)
movslq %r12d,%rcx
lea    (%rax,%rcx,8),%r14
jmp    12a4 <read_brkdata+0x144>
mov    0x2bfa(%rip),%rbx
mov    (%rbx),%edi
lea    0xd27(%rip),%rsi
jmp    11d7 <read_brkdata+0x77>
mov    0x2be5(%rip),%rbx
mov    (%rbx),%edi
lea    0xc93(%rip),%rsi
jmp    1422 <read_brkdata+0x2c2>
mov    0x2bd3(%rip),%rbx
mov    (%rbx),%edi
lea    0xcc6(%rip),%rsi
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    $0x2,%al
call   1050 <fprintf@plt>
jmp    1442 <read_brkdata+0x2e2>
mov    0x2bae(%rip),%rbx
mov    (%rbx),%edi
lea    0xc1f(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
mov    (%rbx),%edi
call   1070 <fflush@plt>
xor    %r12d,%r12d
jmp    11e8 <read_brkdata+0x88>
cmp    $0x3,%r12d
jle    11b5 <read_brkdata+0x55>
test   $0x1,%r12b
jne    1469 <read_brkdata+0x309>
shr    %r12d
jmp    11e8 <read_brkdata+0x88>
mov    0x2b70(%rip),%rbx
mov    (%rbx),%edi
lea    0xd04(%rip),%rsi
jmp    11d7 <read_brkdata+0x77>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [58 x i8] c"ERROR: INSUFFICIENT MEMORY to store input brktable data.\0A\00"
@.str.1 = [61 x i8] c"ERROR: First timeval (%lf) in brkpntfile is less than zero.\0A\00"
@.str.2 = [69 x i8] c"ERROR: Times (%lf & %lf) in brkpntfile are not in increasing order.\0A\00"
@.str.3 = [58 x i8] c"ERROR: Time stretch values are out of range (%lf to %lf)\0A\00"
@.str.4 = [63 x i8] c"ERROR: INSUFFICIENT MEMORY to reallocate input brktable data.\0A\00"
@.str.5 = [40 x i8] c"ERROR: Not enough data in brkpnt file.\0A\00"
@.str.6 = [49 x i8] c"ERROR: Data not paired correctly in brkpntfile.\0A\00"
define i32 @read_brkdata(double** %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca double**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca double*
%9 = alloca double*
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca i8*
%14 = alloca [400 x i8]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store double** %0, double*** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store double 0.000000e+00, double* %12
store i32 1, i32* %15
store i32 0, i32* %16
store i32 0, i32* %17
store i32 200, i32* %18
%19 = load i32, i32* %7
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %22
21: ; preds = %3
store double 1.200000e+02, double* %10
store double -1.200000e+02, double* %11
br label %23
22: ; preds = %3
store double 1.000000e+03, double* %10
store double 1.000000e-03, double* %11
br label %23
23: ; preds = %22, %21
%24 = load i32, i32* %18
%25 = sext i32 %24 to i64
%26 = mul i64 %25, 8
%27 = trunc i64 %26 to i32
%28 = call i64 @malloc(i32 %27)
%29 = inttoptr i64 %28 to double*
%30 = load double**, double*** %5
store double* %29, double** %30
%31 = icmp eq double* %29, null
br i1 %31, label %32, label %37
32: ; preds = %23
%33 = load i32, i32* @stdout
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%35 = load i32, i32* @stdout
%36 = call i32 @fflush(i32 %35)
store i32 0, i32* %4
br label %198
37: ; preds = %23
%38 = load double**, double*** %5
%39 = load double*, double** %38
store double* %39, double** %8
store i32 0, i32* %17
br label %40
40: ; preds = %177, %37
%41 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%42 = load i32*, i32** %6
%43 = call i8* @fgets(i8* %41, i32 200, i32* %42)
%44 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%45 = icmp eq i8* %43, %44
br i1 %45, label %46, label %178
46: ; preds = %40
%47 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
store i8* %47, i8** %13
br label %48
48: ; preds = %176, %46
%49 = load double*, double** %8
%50 = call i64 @get_float_from_within_string(i8** %13, double* %49)
%51 = icmp ne i64 %50, 0
br i1 %51, label %52, label %177
52: ; preds = %48
%53 = load i32, i32* %15
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %122
55: ; preds = %52
%56 = load i32, i32* %17
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %76
58: ; preds = %55
%59 = load double*, double** %8
%60 = load double, double* %59
%61 = fcmp olt double %60, 0.000000e+00
br i1 %61, label %62, label %69
62: ; preds = %58
%63 = load i32, i32* @stdout
%64 = load double*, double** %8
%65 = load double, double* %64
%66 = call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), double %65)
%67 = load i32, i32* @stdout
%68 = call i32 @fflush(i32 %67)
store i32 0, i32* %4
br label %198
69: ; preds = %58
%70 = load double*, double** %8
%71 = load double, double* %70
%72 = fcmp ogt double %71, 0.000000e+00
br i1 %72, label %73, label %74
73: ; preds = %69
store i32 1, i32* %16
br label %74
74: ; preds = %73, %69
br label %75
75: ; preds = %74
br label %119
76: ; preds = %55
%77 = load i32, i32* %16
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %105
79: ; preds = %76
%80 = load double*, double** %8
%81 = getelementptr inbounds double, double* %80, i64 2
store double* %81, double** %8
%82 = load i32, i32* %17
%83 = add nsw i32 %82, 2
store i32 %83, i32* %17
%84 = load double*, double** %8
store double* %84, double** %9
%85 = load double*, double** %8
%86 = getelementptr inbounds double, double* %85, i64 -2
%87 = load double, double* %86
%88 = load double*, double** %8
store double %87, double* %88
%89 = load double*, double** %8
%90 = getelementptr inbounds double, double* %89, i32 -1
store double* %90, double** %8
%91 = load double*, double** %8
%92 = getelementptr inbounds double, double* %91, i64 -2
%93 = load double, double* %92
%94 = load double*, double** %8
store double %93, double* %94
%95 = load double*, double** %8
%96 = getelementptr inbounds double, double* %95, i32 -1
store double* %96, double** %8
%97 = load double*, double** %8
%98 = getelementptr inbounds double, double* %97, i64 -2
%99 = load double, double* %98
%100 = load double*, double** %8
store double %99, double* %100
%101 = load double**, double*** %5
%102 = load double*, double** %101
%103 = getelementptr inbounds double, double* %102, i64 0
store double 0.000000e+00, double* %103
%104 = load double*, double** %9
store double* %104, double** %8
store i32 0, i32* %16
br label %105
105: ; preds = %79, %76
%106 = load double*, double** %8
%107 = load double, double* %106
%108 = load double, double* %12
%109 = fcmp ole double %107, %108
br i1 %109, label %110, label %118
110: ; preds = %105
%111 = load i32, i32* @stdout
%112 = load double*, double** %8
%113 = load double, double* %112
%114 = load double, double* %12
%115 = call i32 (i32, i8*, ...) @fprintf(i32 %111, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.2, i64 0, i64 0), double %113, double %114)
%116 = load i32, i32* @stdout
%117 = call i32 @fflush(i32 %116)
store i32 0, i32* %4
br label %198
118: ; preds = %105
br label %119
119: ; preds = %118, %75
%120 = load double*, double** %8
%121 = load double, double* %120
store double %121, double* %12
br label %140
122: ; preds = %52
%123 = load double*, double** %8
%124 = load double, double* %123
%125 = load double, double* %11
%126 = fcmp olt double %124, %125
br i1 %126, label %132, label %127
127: ; preds = %122
%128 = load double*, double** %8
%129 = load double, double* %128
%130 = load double, double* %10
%131 = fcmp ogt double %129, %130
br i1 %131, label %132, label %139
132: ; preds = %127, %122
%133 = load i32, i32* @stdout
%134 = load double, double* %11
%135 = load double, double* %10
%136 = call i32 (i32, i8*, ...) @fprintf(i32 %133, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0), double %134, double %135)
%137 = load i32, i32* @stdout
%138 = call i32 @fflush(i32 %137)
store i32 0, i32* %4
br label %198
139: ; preds = %127
br label %140
140: ; preds = %139, %119
%141 = load i32, i32* %15
%142 = icmp ne i32 %141, 0
%143 = xor i1 %142, true
%144 = zext i1 %143 to i32
store i32 %144, i32* %15
%145 = load double*, double** %8
%146 = getelementptr inbounds double, double* %145, i32 1
store double* %146, double** %8
%147 = load i32, i32* %17
%148 = add nsw i32 %147, 1
store i32 %148, i32* %17
%149 = load i32, i32* %18
%150 = icmp sge i32 %148, %149
br i1 %150, label %151, label %176
151: ; preds = %140
%152 = load i32, i32* %18
%153 = add nsw i32 %152, 200
store i32 %153, i32* %18
%154 = load double**, double*** %5
%155 = load double*, double** %154
%156 = bitcast double* %155 to i8*
%157 = load i32, i32* %18
%158 = sext i32 %157 to i64
%159 = mul i64 %158, 8
%160 = trunc i64 %159 to i32
%161 = call i64 @realloc(i8* %156, i32 %160)
%162 = inttoptr i64 %161 to double*
%163 = load double**, double*** %5
store double* %162, double** %163
%164 = icmp eq double* %162, null
br i1 %164, label %165, label %170
165: ; preds = %151
%166 = load i32, i32* @stdout
%167 = call i32 (i32, i8*, ...) @fprintf(i32 %166, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.4, i64 0, i64 0))
%168 = load i32, i32* @stdout
%169 = call i32 @fflush(i32 %168)
store i32 0, i32* %4
br label %198
170: ; preds = %151
%171 = load double**, double*** %5
%172 = load double*, double** %171
%173 = load i32, i32* %17
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double, double* %172, i64 %174
store double* %175, double** %8
br label %176
176: ; preds = %170, %140
br label %48
177: ; preds = %48
br label %40
178: ; preds = %40
%179 = load i32, i32* %17
%180 = icmp slt i32 %179, 4
br i1 %180, label %181, label %186
181: ; preds = %178
%182 = load i32, i32* @stdout
%183 = call i32 (i32, i8*, ...) @fprintf(i32 %182, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
%184 = load i32, i32* @stdout
%185 = call i32 @fflush(i32 %184)
store i32 0, i32* %4
br label %198
186: ; preds = %178
%187 = load i32, i32* %17
%188 = and i32 %187, 1
%189 = icmp ne i32 %188, 0
br i1 %189, label %190, label %195
190: ; preds = %186
%191 = load i32, i32* @stdout
%192 = call i32 (i32, i8*, ...) @fprintf(i32 %191, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0))
%193 = load i32, i32* @stdout
%194 = call i32 @fflush(i32 %193)
store i32 0, i32* %4
br label %198
195: ; preds = %186
%196 = load i32, i32* %17
%197 = sdiv i32 %196, 2
store i32 %197, i32* %4
br label %198
198: ; preds = %195, %190, %181, %165, %132, %110, %62, %32
%199 = load i32, i32* %4
ret i32 %199
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [58 x i8] c"ERROR: INSUFFICIENT MEMORY to store input brktable data.\0A\00"
@.str.1 = [61 x i8] c"ERROR: First timeval (%lf) in brkpntfile is less than zero.\0A\00"
@.str.2 = [69 x i8] c"ERROR: Times (%lf & %lf) in brkpntfile are not in increasing order.\0A\00"
@.str.3 = [58 x i8] c"ERROR: Time stretch values are out of range (%lf to %lf)\0A\00"
@.str.4 = [63 x i8] c"ERROR: INSUFFICIENT MEMORY to reallocate input brktable data.\0A\00"
@.str.5 = [40 x i8] c"ERROR: Not enough data in brkpnt file.\0A\00"
@.str.6 = [49 x i8] c"ERROR: Data not paired correctly in brkpntfile.\0A\00"
define i32 @read_brkdata(double** nocapture %0, i32* nocapture %1, i32 %2) {
%4 = alloca i8*
%5 = alloca [400 x i8]
%6 = bitcast i8** %4 to i8*
%7 = getelementptr inbounds [400 x i8], [400 x i8]* %5, i64 0, i64 0
%8 = icmp eq i32 %2, 1
%9 = select i1 %8, double 1.200000e+02, double 1.000000e+03
%10 = select i1 %8, double -1.200000e+02, double 1.000000e-03
%11 = tail call i64 @malloc(i32 1600)
%12 = inttoptr i64 %11 to double*
store double* %12, double** %0
%13 = icmp eq i64 %11, 0
br i1 %13, label %19, label %14
14: ; preds = %3
%15 = call i8* @fgets(i8* %7, i32 200, i32* %1)
%16 = icmp eq i8* %15, %7
br i1 %16, label %17, label %125
17: ; preds = %14
%18 = bitcast double** %0 to i8**
br label %33
19: ; preds = %3
%20 = load i32, i32* @stdout
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%22 = load i32, i32* @stdout
%23 = tail call i32 @fflush(i32 %22)
br label %140
24: ; preds = %118, %33
%25 = phi double* [ %39, %33 ], [ %119, %118 ]
%26 = phi double [ %38, %33 ], [ %96, %118 ]
%27 = phi i32 [ %37, %33 ], [ %99, %118 ]
%28 = phi i32 [ %36, %33 ], [ %97, %118 ]
%29 = phi i32 [ %35, %33 ], [ %101, %118 ]
%30 = phi i32 [ %34, %33 ], [ %120, %118 ]
%31 = call i8* @fgets(i8* %7, i32 200, i32* %1)
%32 = icmp eq i8* %31, %7
br i1 %32, label %33, label %123
33: ; preds = %17, %24
%34 = phi i32 [ 200, %17 ], [ %30, %24 ]
%35 = phi i32 [ 0, %17 ], [ %29, %24 ]
%36 = phi i32 [ 0, %17 ], [ %28, %24 ]
%37 = phi i32 [ 1, %17 ], [ %27, %24 ]
%38 = phi double [ 0.000000e+00, %17 ], [ %26, %24 ]
%39 = phi double* [ %12, %17 ], [ %25, %24 ]
store i8* %7, i8** %4
%40 = call i64 @get_float_from_within_string(i8** %4, double* %39)
%41 = icmp eq i64 %40, 0
br i1 %41, label %24, label %42
42: ; preds = %33, %118
%43 = phi i32 [ %120, %118 ], [ %34, %33 ]
%44 = phi i32 [ %101, %118 ], [ %35, %33 ]
%45 = phi i32 [ %97, %118 ], [ %36, %33 ]
%46 = phi i32 [ %99, %118 ], [ %37, %33 ]
%47 = phi double [ %96, %118 ], [ %38, %33 ]
%48 = phi double* [ %119, %118 ], [ %39, %33 ]
%49 = icmp eq i32 %46, 0
br i1 %49, label %84, label %50
50: ; preds = %42
%51 = icmp eq i32 %44, 0
br i1 %51, label %52, label %63
52: ; preds = %50
%53 = load double, double* %48
%54 = fcmp olt double %53, 0.000000e+00
br i1 %54, label %55, label %60
55: ; preds = %52
%56 = load i32, i32* @stdout
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), double %53)
%58 = load i32, i32* @stdout
%59 = call i32 @fflush(i32 %58)
br label %140
60: ; preds = %52
%61 = fcmp ogt double %53, 0.000000e+00
br i1 %61, label %62, label %94
62: ; preds = %60
br label %94
63: ; preds = %50
%64 = icmp eq i32 %45, 0
br i1 %64, label %74, label %65
65: ; preds = %63
%66 = getelementptr inbounds double, double* %48, i64 2
%67 = add nsw i32 %44, 2
%68 = load double, double* %48
store double %68, double* %66
%69 = getelementptr inbounds double, double* %48, i64 -2
%70 = bitcast double* %69 to <2 x double>*
%71 = load <2 x double>, <2 x double>* %70
%72 = bitcast double* %48 to <2 x double>*
store <2 x double> %71, <2 x double>* %72
%73 = load double*, double** %0
store double 0.000000e+00, double* %73
br label %74
74: ; preds = %65, %63
%75 = phi double* [ %66, %65 ], [ %48, %63 ]
%76 = phi i32 [ %67, %65 ], [ %44, %63 ]
%77 = load double, double* %75
%78 = fcmp ugt double %77, %47
br i1 %78, label %94, label %79
79: ; preds = %74
%80 = load i32, i32* @stdout
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.2, i64 0, i64 0), double %77, double %47)
%82 = load i32, i32* @stdout
%83 = call i32 @fflush(i32 %82)
br label %140
84: ; preds = %42
%85 = load double, double* %48
%86 = fcmp olt double %85, %10
%87 = fcmp ogt double %85, %9
%88 = or i1 %86, %87
br i1 %88, label %89, label %94
89: ; preds = %84
%90 = load i32, i32* @stdout
%91 = call i32 (i32, i8*, ...) @fprintf(i32 %90, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0), double %10, double %9)
%92 = load i32, i32* @stdout
%93 = call i32 @fflush(i32 %92)
br label %140
94: ; preds = %60, %62, %74, %84
%95 = phi double* [ %48, %84 ], [ %48, %62 ], [ %48, %60 ], [ %75, %74 ]
%96 = phi double [ %47, %84 ], [ %53, %62 ], [ %53, %60 ], [ %77, %74 ]
%97 = phi i32 [ %45, %84 ], [ 1, %62 ], [ %45, %60 ], [ 0, %74 ]
%98 = phi i32 [ %44, %84 ], [ 0, %62 ], [ 0, %60 ], [ %76, %74 ]
%99 = zext i1 %49 to i32
%100 = getelementptr inbounds double, double* %95, i64 1
%101 = add nsw i32 %98, 1
%102 = icmp slt i32 %101, %43
br i1 %102, label %118, label %103
103: ; preds = %94
%104 = add nsw i32 %43, 200
%105 = load i8*, i8** %18
%106 = shl i32 %104, 3
%107 = call i64 @realloc(i8* %105, i32 %106)
%108 = inttoptr i64 %107 to double*
store double* %108, double** %0
%109 = icmp eq i64 %107, 0
br i1 %109, label %110, label %115
110: ; preds = %103
%111 = load i32, i32* @stdout
%112 = call i32 (i32, i8*, ...) @fprintf(i32 %111, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.4, i64 0, i64 0))
%113 = load i32, i32* @stdout
%114 = call i32 @fflush(i32 %113)
br label %140
115: ; preds = %103
%116 = sext i32 %101 to i64
%117 = getelementptr inbounds double, double* %108, i64 %116
br label %118
118: ; preds = %115, %94
%119 = phi double* [ %117, %115 ], [ %100, %94 ]
%120 = phi i32 [ %104, %115 ], [ %43, %94 ]
%121 = call i64 @get_float_from_within_string(i8** %4, double* %119)
%122 = icmp eq i64 %121, 0
br i1 %122, label %24, label %42
123: ; preds = %24
%124 = icmp slt i32 %29, 4
br i1 %124, label %125, label %130
125: ; preds = %14, %123
%126 = load i32, i32* @stdout
%127 = call i32 (i32, i8*, ...) @fprintf(i32 %126, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
%128 = load i32, i32* @stdout
%129 = call i32 @fflush(i32 %128)
br label %140
130: ; preds = %123
%131 = and i32 %29, 1
%132 = icmp eq i32 %131, 0
br i1 %132, label %138, label %133
133: ; preds = %130
%134 = load i32, i32* @stdout
%135 = call i32 (i32, i8*, ...) @fprintf(i32 %134, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0))
%136 = load i32, i32* @stdout
%137 = call i32 @fflush(i32 %136)
br label %140
138: ; preds = %130
%139 = lshr i32 %29, 1
br label %140
140: ; preds = %138, %133, %125, %110, %89, %79, %55, %19
%141 = phi i32 [ 0, %19 ], [ 0, %55 ], [ 0, %110 ], [ 0, %79 ], [ 0, %89 ], [ 0, %125 ], [ 0, %133 ], [ %139, %138 ]
ret i32 %141
}