#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 atol(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, long, long,
                           long, float, int, ...);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int get_intervals(char *input_filename, int intervals, int depth3) {
  FILE *depthfile, *tmp2file, *finalfile;
  char system_file_tmp[1000];
  char file_line[100000], chromosome[10], position[32], depth2[5];
  char chromosome_current[10];
  char *token;
  long start, stop, positions, running_total;
  sprintf(system_file_tmp, "%s.tmp", input_filename);
  depthfile = fopen(system_file_tmp, "r");
  sprintf(chromosome_current, "0x0");
  start = 0;
  stop = 0;
  positions = 1;
  running_total = 0;
  if (depthfile == NULL) {
    printf("problem opening temp depth file\n");
  } else {
    sprintf(system_file_tmp, "%s.tmp2", input_filename);
    tmp2file = fopen(system_file_tmp, "w");
    if (fgets(file_line, 100000, depthfile) == NULL) {
      printf("we have a null situation, no reported intervals\n");
      return 5;
    }
    sscanf(file_line, "%s%s%s", chromosome, position, depth2);
    sprintf(chromosome_current, "%s", chromosome);
    start = atol(position) - intervals;
    stop = atol(position) + intervals;
    running_total = atol(depth2);
    while (fgets(file_line, 100000, depthfile) != NULL) {
      sscanf(file_line, "%s%s%s", chromosome, position, depth2);
      if (strcmp(chromosome, chromosome_current) != 0) {
        fprintf(tmp2file, "%s\t%d\t%d\t%d\t%f\t%d\n", chromosome_current, start,
                stop, positions, (float)positions / (float)(1 + stop - start),
                running_total);
        sprintf(chromosome_current, "%s", chromosome);
        start = atol(position) - intervals;
        stop = atol(position) + intervals;
        positions = 1;
        running_total = atol(depth2);
      } else {
        if (((atol(position) - intervals) >= start) &&
            ((atol(position) - intervals) <= stop)) {
          stop = atol(position) + intervals;
          positions = positions + 1;
          running_total = running_total + atol(depth2);
        } else {
          fprintf(tmp2file, "%s\t%d\t%d\t%d\t%f\t%d\t%d\n", chromosome_current,
                  start, stop, positions,
                  (float)positions / (float)(1 + stop - start),
                  (1 + stop - start), running_total);
          sprintf(chromosome_current, "%s", chromosome);
          start = atol(position) - intervals;
          stop = atol(position) + intervals;
          positions = 1;
          running_total = atol(depth2);
        }
      }
    }
    fprintf(tmp2file, "%s\t%d\t%d\t%d\t%f\t%d\t%d\n", chromosome_current, start,
            stop, positions, (float)positions / (float)(1 + stop - start),
            (1 + stop - start), running_total);
    positions = 1;
    running_total = 0;
  }
  fclose(depthfile);
  fclose(tmp2file);
  return 5;
}


x86 assembly (clang, -O0):
<get_intervals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x18b40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe49(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0x420(%rbp),%rdi
lea    0xe3b(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
lea    -0x18aff(%rbp),%rdi
lea    0xe26(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
movq   $0x0,-0x18b10(%rbp)
movq   $0x0,-0x18b18(%rbp)
movq   $0x1,-0x18b20(%rbp)
movq   $0x0,-0x18b28(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1232 <get_intervals+0xa2>
lea    0xde5(%rip),%rdi
call   1040 <printf@plt>
jmp    1668 <get_intervals+0x4d8>
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xdea(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0x420(%rbp),%rdi
lea    0xddd(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
lea    -0x18ac0(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x186a0,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
jne    1299 <get_intervals+0x109>
lea    0xdb0(%rip),%rdi
call   1040 <printf@plt>
movl   $0x5,-0x4(%rbp)
jmp    1681 <get_intervals+0x4f1>
lea    -0x18ac0(%rbp),%rdi
lea    -0x18aca(%rbp),%rdx
lea    -0x18af0(%rbp),%rcx
lea    -0x18af5(%rbp),%r8
lea    0xdad(%rip),%rsi
call   1080 <sscanf@plt>
lea    -0x18aff(%rbp),%rdi
lea    -0x18aca(%rbp),%rdx
lea    0xd97(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0x18af0(%rbp),%rdi
call   1090 <atol@plt>
sub    -0x14(%rbp),%eax
cltq
mov    %rax,-0x18b10(%rbp)
lea    -0x18af0(%rbp),%rdi
call   1090 <atol@plt>
add    -0x14(%rbp),%eax
cltq
mov    %rax,-0x18b18(%rbp)
lea    -0x18af5(%rbp),%rdi
call   1090 <atol@plt>
cltq
mov    %rax,-0x18b28(%rbp)
lea    -0x18ac0(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x186a0,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     15db <get_intervals+0x44b>
lea    -0x18ac0(%rbp),%rdi
lea    -0x18aca(%rbp),%rdx
lea    -0x18af0(%rbp),%rcx
lea    -0x18af5(%rbp),%r8
lea    0xd05(%rip),%rsi
call   1080 <sscanf@plt>
lea    -0x18aca(%rbp),%rdi
lea    -0x18aff(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1453 <get_intervals+0x2c3>
mov    -0x28(%rbp),%rdi
lea    -0x18aff(%rbp),%rdx
mov    -0x18b10(%rbp),%rcx
mov    -0x18b18(%rbp),%r8
mov    -0x18b20(%rbp),%r9
cvtsi2ssq -0x18b20(%rbp),%xmm0
fe ff
mov    -0x18b18(%rbp),%rax
add    $0x1,%rax
sub    -0x18b10(%rbp),%rax
cvtsi2ss %rax,%xmm1
divss  %xmm1,%xmm0
mov    -0x18b28(%rbp),%rax
lea    0xc98(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x1,%al
call   1070 <fprintf@plt>
lea    -0x18aff(%rbp),%rdi
lea    -0x18aca(%rbp),%rdx
lea    0xc76(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0x18af0(%rbp),%rdi
call   1090 <atol@plt>
sub    -0x14(%rbp),%eax
cltq
mov    %rax,-0x18b10(%rbp)
lea    -0x18af0(%rbp),%rdi
call   1090 <atol@plt>
add    -0x14(%rbp),%eax
cltq
mov    %rax,-0x18b18(%rbp)
movq   $0x1,-0x18b20(%rbp)
lea    -0x18af5(%rbp),%rdi
call   1090 <atol@plt>
cltq
mov    %rax,-0x18b28(%rbp)
jmp    15d6 <get_intervals+0x446>
lea    -0x18af0(%rbp),%rdi
call   1090 <atol@plt>
sub    -0x14(%rbp),%eax
cltq
cmp    -0x18b10(%rbp),%rax
jl     14ee <get_intervals+0x35e>
lea    -0x18af0(%rbp),%rdi
call   1090 <atol@plt>
sub    -0x14(%rbp),%eax
cltq
cmp    -0x18b18(%rbp),%rax
jg     14ee <get_intervals+0x35e>
lea    -0x18af0(%rbp),%rdi
call   1090 <atol@plt>
add    -0x14(%rbp),%eax
cltq
mov    %rax,-0x18b18(%rbp)
mov    -0x18b20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18b20(%rbp)
mov    -0x18b28(%rbp),%rax
mov    %rax,-0x18b30(%rbp)
lea    -0x18af5(%rbp),%rdi
call   1090 <atol@plt>
mov    %eax,%ecx
mov    -0x18b30(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18b28(%rbp)
jmp    15d1 <get_intervals+0x441>
mov    -0x28(%rbp),%rdi
lea    -0x18aff(%rbp),%rdx
mov    -0x18b10(%rbp),%rcx
mov    -0x18b18(%rbp),%r8
mov    -0x18b20(%rbp),%r9
cvtsi2ssq -0x18b20(%rbp),%xmm0
fe ff
mov    -0x18b18(%rbp),%rax
add    $0x1,%rax
sub    -0x18b10(%rbp),%rax
cvtsi2ss %rax,%xmm1
divss  %xmm1,%xmm0
mov    -0x18b18(%rbp),%rax
add    $0x1,%rax
sub    -0x18b10(%rbp),%rax
mov    %eax,%r10d
mov    -0x18b28(%rbp),%rax
lea    0xb2e(%rip),%rsi
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x1,%al
call   1070 <fprintf@plt>
lea    -0x18aff(%rbp),%rdi
lea    -0x18aca(%rbp),%rdx
lea    0xaf3(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0x18af0(%rbp),%rdi
call   1090 <atol@plt>
sub    -0x14(%rbp),%eax
cltq
mov    %rax,-0x18b10(%rbp)
lea    -0x18af0(%rbp),%rdi
call   1090 <atol@plt>
add    -0x14(%rbp),%eax
cltq
mov    %rax,-0x18b18(%rbp)
movq   $0x1,-0x18b20(%rbp)
lea    -0x18af5(%rbp),%rdi
call   1090 <atol@plt>
cltq
mov    %rax,-0x18b28(%rbp)
jmp    15d6 <get_intervals+0x446>
jmp    1322 <get_intervals+0x192>
mov    -0x28(%rbp),%rdi
lea    -0x18aff(%rbp),%rdx
mov    -0x18b10(%rbp),%rcx
mov    -0x18b18(%rbp),%r8
mov    -0x18b20(%rbp),%r9
cvtsi2ssq -0x18b20(%rbp),%xmm0
fe ff
mov    -0x18b18(%rbp),%rax
add    $0x1,%rax
sub    -0x18b10(%rbp),%rax
cvtsi2ss %rax,%xmm1
divss  %xmm1,%xmm0
mov    -0x18b18(%rbp),%rax
add    $0x1,%rax
sub    -0x18b10(%rbp),%rax
mov    %eax,%r10d
mov    -0x18b28(%rbp),%rax
lea    0xa41(%rip),%rsi
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x1,%al
call   1070 <fprintf@plt>
movq   $0x1,-0x18b20(%rbp)
movq   $0x0,-0x18b28(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x18b40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_intervals>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18b18,%rsp
mov    %esi,%r13d
mov    %rdi,%rbx
lea    0xe42(%rip),%rsi
lea    0x80(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   10c0 <sprintf@plt>
lea    0xe2d(%rip),%rsi
mov    %r14,%rdi
call   10b0 <fopen@plt>
mov    %rax,%rbp
movl   $0x307830,0x3c(%rsp)
test   %rax,%rax
je     14bc <get_intervals+0x31c>
lea    0xe0c(%rip),%rsi
lea    0x80(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   10c0 <sprintf@plt>
lea    0xdf8(%rip),%rsi
mov    %r14,%rdi
call   10b0 <fopen@plt>
mov    %rax,%rbx
lea    0x470(%rsp),%rdi
mov    $0x186a0,%esi
mov    %rbp,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     14ca <get_intervals+0x32a>
mov    %rbx,0x30(%rsp)
lea    0xdc5(%rip),%rsi
lea    0x470(%rsp),%r15
lea    0x56(%rsp),%rbx
lea    0x60(%rsp),%r14
mov    %rbp,0x28(%rsp)
lea    0x13(%rsp),%r12
mov    %r15,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %r12,%r8
call   1090 <sscanf@plt>
lea    0x3c(%rsp),%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %r14,%rdi
call   10a0 <atol@plt>
mov    %eax,%r14d
sub    %r13d,%eax
movslq %eax,%rbx
mov    %r12,%rdi
call   10a0 <atol@plt>
cltq
mov    %rax,0x18(%rsp)
mov    %rbx,0x20(%rsp)
neg    %rbx
mov    %r13d,0x4(%rsp)
add    %r13d,%r14d
movslq %r14d,%r13
mov    %r15,%rdi
mov    $0x186a0,%esi
mov    0x28(%rsp),%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     14d8 <get_intervals+0x338>
mov    $0x1,%eax
mov    %rax,0x8(%rsp)
lea    0x470(%rsp),%rbp
lea    0x60(%rsp),%r12
lea    0x13(%rsp),%r15
jmp    13c0 <get_intervals+0x220>
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%r9
xorps  %xmm0,%xmm0
cvtsi2ss %r9,%xmm0
mov    0x48(%rsp),%r8
lea    (%r8,%rbx,1),%rax
add    $0x1,%rax
xorps  %xmm1,%xmm1
cvtsi2ss %rax,%xmm1
divss  %xmm1,%xmm0
sub    $0x8,%rsp
mov    0x38(%rsp),%rdi
lea    0xce4(%rip),%rsi
mov    %rbp,%rdx
mov    0x28(%rsp),%rcx
mov    $0x1,%al
push   0x20(%rsp)
call   1080 <fprintf@plt>
add    $0x10,%rsp
mov    %rbp,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
call   10a0 <atol@plt>
mov    %eax,%r14d
mov    0x4(%rsp),%ebp
sub    %ebp,%eax
movslq %eax,%rbx
mov    %r15,%rdi
call   10a0 <atol@plt>
cltq
mov    %rax,0x18(%rsp)
mov    $0x1,%eax
mov    %rax,0x8(%rsp)
mov    0x28(%rsp),%rdx
mov    %rbx,0x20(%rsp)
neg    %rbx
add    %ebp,%r14d
movslq %r14d,%r13
lea    0x470(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x186a0,%esi
call   1060 <fgets@plt>
test   %rax,%rax
lea    0x60(%rsp),%r12
lea    0x13(%rsp),%r15
je     14e2 <get_intervals+0x342>
mov    %r13,0x48(%rsp)
mov    %rbp,%rdi
lea    0xc44(%rip),%rsi
lea    0x56(%rsp),%r13
mov    %r13,%rdx
mov    %r12,%rcx
mov    %r15,%r8
call   1090 <sscanf@plt>
mov    %r13,%rdi
lea    0x3c(%rsp),%rbp
mov    %rbp,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1300 <get_intervals+0x160>
mov    %r12,%rdi
call   10a0 <atol@plt>
mov    %eax,%r12d
sub    0x4(%rsp),%eax
movslq %eax,%rcx
cmp    %rcx,0x20(%rsp)
jg     1446 <get_intervals+0x2a6>
cmp    %r14d,%eax
jg     1446 <get_intervals+0x2a6>
addq   $0x1,0x8(%rsp)
lea    0x13(%rsp),%rdi
call   10a0 <atol@plt>
cltq
add    %rax,0x18(%rsp)
mov    %r12d,%r14d
mov    0x28(%rsp),%rdx
mov    0x4(%rsp),%ebp
mov    0x20(%rsp),%rbx
jmp    138a <get_intervals+0x1ea>
mov    0x8(%rsp),%r9
xorps  %xmm0,%xmm0
cvtsi2ss %r9,%xmm0
mov    0x48(%rsp),%r8
add    %r8,%rbx
add    $0x1,%rbx
cvtsi2ss %rbx,%xmm1
divss  %xmm1,%xmm0
mov    0x30(%rsp),%rdi
lea    0xbb9(%rip),%rsi
lea    0x3c(%rsp),%rbp
mov    %rbp,%rdx
mov    0x20(%rsp),%rcx
mov    $0x1,%al
push   0x18(%rsp)
push   %rbx
call   1080 <fprintf@plt>
add    $0x10,%rsp
mov    %rbp,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
lea    0x60(%rsp),%rdi
call   10a0 <atol@plt>
mov    %eax,%r14d
mov    0x4(%rsp),%ebp
sub    %ebp,%eax
movslq %eax,%rbx
lea    0x13(%rsp),%rdi
jmp    136f <get_intervals+0x1cf>
lea    0xbb0(%rip),%rdi
call   1040 <puts@plt>
jmp    1535 <get_intervals+0x395>
lea    0xb72(%rip),%rdi
call   1040 <puts@plt>
jmp    1545 <get_intervals+0x3a5>
mov    $0x1,%eax
mov    %rax,0x8(%rsp)
mov    0x8(%rsp),%r9
xorps  %xmm0,%xmm0
cvtsi2ss %r9,%xmm0
lea    (%rbx,%r13,1),%r10
add    $0x1,%r10
xorps  %xmm1,%xmm1
cvtsi2ss %r10,%xmm1
divss  %xmm1,%xmm0
lea    0xb23(%rip),%rsi
lea    0x3c(%rsp),%rdx
mov    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    0x20(%rsp),%rcx
mov    %r13,%r8
mov    $0x1,%al
push   0x18(%rsp)
push   %r10
call   1080 <fprintf@plt>
add    $0x10,%rsp
mov    0x28(%rsp),%rbp
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    $0x5,%eax
add    $0x18b18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s.tmp\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"0x0\00"
@.str.3 = [33 x i8] c"problem opening temp depth file\0A\00"
@.str.4 = [8 x i8] c"%s.tmp2\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [49 x i8] c"we have a null situation, no reported intervals\0A\00"
@.str.7 = [7 x i8] c"%s%s%s\00"
@.str.8 = [3 x i8] c"%s\00"
@.str.9 = [19 x i8] c"%s\09%d\09%d\09%d\09%f\09%d\0A\00"
@.str.10 = [22 x i8] c"%s\09%d\09%d\09%d\09%f\09%d\09%d\0A\00"
define i32 @get_intervals(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca [1000 x i8]
%12 = alloca [100000 x i8]
%13 = alloca [10 x i8]
%14 = alloca [32 x i8]
%15 = alloca [5 x i8]
%16 = alloca [10 x i8]
%17 = alloca i8*
%18 = alloca i64
%19 = alloca i64
%20 = alloca i64
%21 = alloca i64
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%22 = getelementptr inbounds [1000 x i8], [1000 x i8]* %11, i64 0, i64 0
%23 = load i8*, i8** %5
%24 = call i32 (i8*, i8*, ...) @sprintf(i8* %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds [1000 x i8], [1000 x i8]* %11, i64 0, i64 0
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %26, i32** %8
%27 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 0
%28 = call i32 (i8*, i8*, ...) @sprintf(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i64 0, i64* %18
store i64 0, i64* %19
store i64 1, i64* %20
store i64 0, i64* %21
%29 = load i32*, i32** %8
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %33
31: ; preds = %3
%32 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %204
33: ; preds = %3
%34 = getelementptr inbounds [1000 x i8], [1000 x i8]* %11, i64 0, i64 0
%35 = load i8*, i8** %5
%36 = call i32 (i8*, i8*, ...) @sprintf(i8* %34, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %35)
%37 = getelementptr inbounds [1000 x i8], [1000 x i8]* %11, i64 0, i64 0
%38 = call i32* @fopen(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %38, i32** %9
%39 = getelementptr inbounds [100000 x i8], [100000 x i8]* %12, i64 0, i64 0
%40 = load i32*, i32** %8
%41 = call i32* @fgets(i8* %39, i32 100000, i32* %40)
%42 = icmp eq i32* %41, null
br i1 %42, label %43, label %45
43: ; preds = %33
%44 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0))
store i32 5, i32* %4
br label %209
45: ; preds = %33
%46 = getelementptr inbounds [100000 x i8], [100000 x i8]* %12, i64 0, i64 0
%47 = getelementptr inbounds [10 x i8], [10 x i8]* %13, i64 0, i64 0
%48 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
%49 = getelementptr inbounds [5 x i8], [5 x i8]* %15, i64 0, i64 0
%50 = call i32 @sscanf(i8* %46, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* %47, i8* %48, i8* %49)
%51 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 0
%52 = getelementptr inbounds [10 x i8], [10 x i8]* %13, i64 0, i64 0
%53 = call i32 (i8*, i8*, ...) @sprintf(i8* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %52)
%54 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
%55 = call i32 @atol(i8* %54)
%56 = load i32, i32* %6
%57 = sub nsw i32 %55, %56
%58 = sext i32 %57 to i64
store i64 %58, i64* %18
%59 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
%60 = call i32 @atol(i8* %59)
%61 = load i32, i32* %6
%62 = add nsw i32 %60, %61
%63 = sext i32 %62 to i64
store i64 %63, i64* %19
%64 = getelementptr inbounds [5 x i8], [5 x i8]* %15, i64 0, i64 0
%65 = call i32 @atol(i8* %64)
%66 = sext i32 %65 to i64
store i64 %66, i64* %21
br label %67
67: ; preds = %182, %45
%68 = getelementptr inbounds [100000 x i8], [100000 x i8]* %12, i64 0, i64 0
%69 = load i32*, i32** %8
%70 = call i32* @fgets(i8* %68, i32 100000, i32* %69)
%71 = icmp ne i32* %70, null
br i1 %71, label %72, label %183
72: ; preds = %67
%73 = getelementptr inbounds [100000 x i8], [100000 x i8]* %12, i64 0, i64 0
%74 = getelementptr inbounds [10 x i8], [10 x i8]* %13, i64 0, i64 0
%75 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
%76 = getelementptr inbounds [5 x i8], [5 x i8]* %15, i64 0, i64 0
%77 = call i32 @sscanf(i8* %73, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* %74, i8* %75, i8* %76)
%78 = getelementptr inbounds [10 x i8], [10 x i8]* %13, i64 0, i64 0
%79 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 0
%80 = call i64 @strcmp(i8* %78, i8* %79)
%81 = icmp ne i64 %80, 0
br i1 %81, label %82, label %115
82: ; preds = %72
%83 = load i32*, i32** %9
%84 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 0
%85 = load i64, i64* %18
%86 = load i64, i64* %19
%87 = load i64, i64* %20
%88 = load i64, i64* %20
%89 = sitofp i64 %88 to float
%90 = load i64, i64* %19
%91 = add nsw i64 1, %90
%92 = load i64, i64* %18
%93 = sub nsw i64 %91, %92
%94 = sitofp i64 %93 to float
%95 = fdiv float %89, %94
%96 = load i64, i64* %21
%97 = trunc i64 %96 to i32
%98 = call i32 (i32*, i8*, i8*, i64, i64, i64, float, i32, ...) @fprintf(i32* %83, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i8* %84, i64 %85, i64 %86, i64 %87, float %95, i32 %97)
%99 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 0
%100 = getelementptr inbounds [10 x i8], [10 x i8]* %13, i64 0, i64 0
%101 = call i32 (i8*, i8*, ...) @sprintf(i8* %99, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %100)
%102 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
%103 = call i32 @atol(i8* %102)
%104 = load i32, i32* %6
%105 = sub nsw i32 %103, %104
%106 = sext i32 %105 to i64
store i64 %106, i64* %18
%107 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
%108 = call i32 @atol(i8* %107)
%109 = load i32, i32* %6
%110 = add nsw i32 %108, %109
%111 = sext i32 %110 to i64
store i64 %111, i64* %19
store i64 1, i64* %20
%112 = getelementptr inbounds [5 x i8], [5 x i8]* %15, i64 0, i64 0
%113 = call i32 @atol(i8* %112)
%114 = sext i32 %113 to i64
store i64 %114, i64* %21
br label %182
115: ; preds = %72
%116 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
%117 = call i32 @atol(i8* %116)
%118 = load i32, i32* %6
%119 = sub nsw i32 %117, %118
%120 = sext i32 %119 to i64
%121 = load i64, i64* %18
%122 = icmp sge i64 %120, %121
br i1 %122, label %123, label %144
123: ; preds = %115
%124 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
%125 = call i32 @atol(i8* %124)
%126 = load i32, i32* %6
%127 = sub nsw i32 %125, %126
%128 = sext i32 %127 to i64
%129 = load i64, i64* %19
%130 = icmp sle i64 %128, %129
br i1 %130, label %131, label %144
131: ; preds = %123
%132 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
%133 = call i32 @atol(i8* %132)
%134 = load i32, i32* %6
%135 = add nsw i32 %133, %134
%136 = sext i32 %135 to i64
store i64 %136, i64* %19
%137 = load i64, i64* %20
%138 = add nsw i64 %137, 1
store i64 %138, i64* %20
%139 = load i64, i64* %21
%140 = getelementptr inbounds [5 x i8], [5 x i8]* %15, i64 0, i64 0
%141 = call i32 @atol(i8* %140)
%142 = sext i32 %141 to i64
%143 = add nsw i64 %139, %142
store i64 %143, i64* %21
br label %181
144: ; preds = %123, %115
%145 = load i32*, i32** %9
%146 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 0
%147 = load i64, i64* %18
%148 = load i64, i64* %19
%149 = load i64, i64* %20
%150 = load i64, i64* %20
%151 = sitofp i64 %150 to float
%152 = load i64, i64* %19
%153 = add nsw i64 1, %152
%154 = load i64, i64* %18
%155 = sub nsw i64 %153, %154
%156 = sitofp i64 %155 to float
%157 = fdiv float %151, %156
%158 = load i64, i64* %19
%159 = add nsw i64 1, %158
%160 = load i64, i64* %18
%161 = sub nsw i64 %159, %160
%162 = trunc i64 %161 to i32
%163 = load i64, i64* %21
%164 = call i32 (i32*, i8*, i8*, i64, i64, i64, float, i32, ...) @fprintf(i32* %145, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i8* %146, i64 %147, i64 %148, i64 %149, float %157, i32 %162, i64 %163)
%165 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 0
%166 = getelementptr inbounds [10 x i8], [10 x i8]* %13, i64 0, i64 0
%167 = call i32 (i8*, i8*, ...) @sprintf(i8* %165, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %166)
%168 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
%169 = call i32 @atol(i8* %168)
%170 = load i32, i32* %6
%171 = sub nsw i32 %169, %170
%172 = sext i32 %171 to i64
store i64 %172, i64* %18
%173 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
%174 = call i32 @atol(i8* %173)
%175 = load i32, i32* %6
%176 = add nsw i32 %174, %175
%177 = sext i32 %176 to i64
store i64 %177, i64* %19
store i64 1, i64* %20
%178 = getelementptr inbounds [5 x i8], [5 x i8]* %15, i64 0, i64 0
%179 = call i32 @atol(i8* %178)
%180 = sext i32 %179 to i64
store i64 %180, i64* %21
br label %181
181: ; preds = %144, %131
br label %182
182: ; preds = %181, %82
br label %67
183: ; preds = %67
%184 = load i32*, i32** %9
%185 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 0
%186 = load i64, i64* %18
%187 = load i64, i64* %19
%188 = load i64, i64* %20
%189 = load i64, i64* %20
%190 = sitofp i64 %189 to float
%191 = load i64, i64* %19
%192 = add nsw i64 1, %191
%193 = load i64, i64* %18
%194 = sub nsw i64 %192, %193
%195 = sitofp i64 %194 to float
%196 = fdiv float %190, %195
%197 = load i64, i64* %19
%198 = add nsw i64 1, %197
%199 = load i64, i64* %18
%200 = sub nsw i64 %198, %199
%201 = trunc i64 %200 to i32
%202 = load i64, i64* %21
%203 = call i32 (i32*, i8*, i8*, i64, i64, i64, float, i32, ...) @fprintf(i32* %184, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i8* %185, i64 %186, i64 %187, i64 %188, float %196, i32 %201, i64 %202)
store i64 1, i64* %20
store i64 0, i64* %21
br label %204
204: ; preds = %183, %31
%205 = load i32*, i32** %8
%206 = call i32 @fclose(i32* %205)
%207 = load i32*, i32** %9
%208 = call i32 @fclose(i32* %207)
store i32 5, i32* %4
br label %209
209: ; preds = %204, %43
%210 = load i32, i32* %4
ret i32 %210
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s.tmp\00"
@.str.1 = [2 x i8] c"r\00"
@.str.4 = [8 x i8] c"%s.tmp2\00"
@.str.5 = [2 x i8] c"w\00"
@.str.7 = [7 x i8] c"%s%s%s\00"
@.str.9 = [19 x i8] c"%s\09%d\09%d\09%d\09%f\09%d\0A\00"
@.str.10 = [22 x i8] c"%s\09%d\09%d\09%d\09%f\09%d\09%d\0A\00"
@str = [48 x i8] c"we have a null situation, no reported intervals\00"
@str.11 = [32 x i8] c"problem opening temp depth file\00"
define i32 @get_intervals(i8* %0, i32 %1, i32 %2) {
%4 = alloca [1000 x i8]
%5 = alloca [100000 x i8]
%6 = alloca [10 x i8]
%7 = alloca [32 x i8]
%8 = alloca [5 x i8]
%9 = alloca [10 x i8]
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [100000 x i8], [100000 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%16 = call i32 (i8*, i8*, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0)
%17 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = bitcast [10 x i8]* %9 to i32*
store i32 3176496, i32* %18
%19 = icmp eq i32* %17, null
br i1 %19, label %20, label %22
20: ; preds = %3
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.11, i64 0, i64 0))
br label %115
22: ; preds = %3
%23 = call i32 (i8*, i8*, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %0)
%24 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%25 = call i32* @fgets(i8* %11, i32 100000, i32* %17)
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
br label %119
29: ; preds = %22
%30 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* %12, i8* %13, i8* %14)
%31 = call i8* @strcpy(i8* %15, i8* %12)
%32 = call i32 @atol(i8* %13)
%33 = sub nsw i32 %32, %1
%34 = sext i32 %33 to i64
%35 = call i32 @atol(i8* %14)
%36 = sext i32 %35 to i64
%37 = sub nsw i64 0, %34
%38 = add nsw i32 %32, %1
%39 = sext i32 %38 to i64
%40 = call i32* @fgets(i8* %11, i32 100000, i32* %17)
%41 = icmp eq i32* %40, null
br i1 %41, label %102, label %42
42: ; preds = %29, %92
%43 = phi i64 [ %99, %92 ], [ %39, %29 ]
%44 = phi i32 [ %98, %92 ], [ %38, %29 ]
%45 = phi i64 [ %97, %92 ], [ %37, %29 ]
%46 = phi i64 [ %96, %92 ], [ %36, %29 ]
%47 = phi i64 [ %95, %92 ], [ 1, %29 ]
%48 = phi i64 [ %93, %92 ], [ %34, %29 ]
%49 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* %12, i8* %13, i8* %14)
%50 = call i64 @strcmp(i8* %12, i8* %15)
%51 = icmp eq i64 %50, 0
br i1 %51, label %66, label %52
52: ; preds = %42
%53 = sitofp i64 %47 to float
%54 = add nsw i64 %43, 1
%55 = add i64 %54, %45
%56 = sitofp i64 %55 to float
%57 = fdiv float %53, %56
%58 = trunc i64 %46 to i32
%59 = call i32 (i32*, i8*, i8*, i64, i64, i64, float, i32, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i8* %15, i64 %48, i64 %43, i64 %47, float %57, i32 %58)
%60 = call i8* @strcpy(i8* %15, i8* %12)
%61 = call i32 @atol(i8* %13)
%62 = sub nsw i32 %61, %1
%63 = sext i32 %62 to i64
%64 = call i32 @atol(i8* %14)
%65 = sext i32 %64 to i64
br label %92
66: ; preds = %42
%67 = call i32 @atol(i8* %13)
%68 = sub nsw i32 %67, %1
%69 = sext i32 %68 to i64
%70 = icmp sgt i64 %48, %69
%71 = icmp sgt i32 %68, %44
%72 = select i1 %70, i1 true, i1 %71
br i1 %72, label %78, label %73
73: ; preds = %66
%74 = add nsw i64 %47, 1
%75 = call i32 @atol(i8* %14)
%76 = sext i32 %75 to i64
%77 = add nsw i64 %46, %76
br label %92
78: ; preds = %66
%79 = sitofp i64 %47 to float
%80 = add nsw i64 %43, 1
%81 = add i64 %80, %45
%82 = sitofp i64 %81 to float
%83 = fdiv float %79, %82
%84 = trunc i64 %81 to i32
%85 = call i32 (i32*, i8*, i8*, i64, i64, i64, float, i32, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i8* %15, i64 %48, i64 %43, i64 %47, float %83, i32 %84, i64 %46)
%86 = call i8* @strcpy(i8* %15, i8* %12)
%87 = call i32 @atol(i8* %13)
%88 = sub nsw i32 %87, %1
%89 = sext i32 %88 to i64
%90 = call i32 @atol(i8* %14)
%91 = sext i32 %90 to i64
br label %92
92: ; preds = %73, %78, %52
%93 = phi i64 [ %63, %52 ], [ %48, %73 ], [ %89, %78 ]
%94 = phi i32 [ %61, %52 ], [ %67, %73 ], [ %87, %78 ]
%95 = phi i64 [ 1, %52 ], [ %74, %73 ], [ 1, %78 ]
%96 = phi i64 [ %65, %52 ], [ %77, %73 ], [ %91, %78 ]
%97 = sub i64 0, %93
%98 = add nsw i32 %94, %1
%99 = sext i32 %98 to i64
%100 = call i32* @fgets(i8* %11, i32 100000, i32* %17)
%101 = icmp eq i32* %100, null
br i1 %101, label %102, label %42
102: ; preds = %92, %29
%103 = phi i64 [ %34, %29 ], [ %93, %92 ]
%104 = phi i64 [ 1, %29 ], [ %95, %92 ]
%105 = phi i64 [ %36, %29 ], [ %96, %92 ]
%106 = phi i64 [ %37, %29 ], [ %97, %92 ]
%107 = phi i64 [ %39, %29 ], [ %99, %92 ]
%108 = sitofp i64 %104 to float
%109 = add nsw i64 %107, 1
%110 = add i64 %109, %106
%111 = sitofp i64 %110 to float
%112 = fdiv float %108, %111
%113 = trunc i64 %110 to i32
%114 = call i32 (i32*, i8*, i8*, i64, i64, i64, float, i32, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i8* %15, i64 %103, i64 %107, i64 %104, float %112, i32 %113, i64 %105)
br label %115
115: ; preds = %102, %20
%116 = phi i32* [ undef, %20 ], [ %24, %102 ]
%117 = call i32 @fclose(i32* %17)
%118 = call i32 @fclose(i32* %116)
br label %119
119: ; preds = %115, %27
ret i32 5
}