#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 */
char *cvector(int, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free_cvector(char *, int, int);
int /*<<< orphan*/ free_ivector(int *, int, int);
int *ivector(int, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ read_line_wstrand_v2(int /*<<< orphan*/ *,
                                        int /*<<< orphan*/ *, int *, int *,
                                        char *, int, int, int, int, int, int,
                                        int **, int, int, int, int);
int /*<<< orphan*/ read_line_wstrand_v3(int /*<<< orphan*/ *,
                                        int /*<<< orphan*/ *, int *, int *,
                                        char *, int, int, int, int, int, int,
                                        int **, int **, int, int, int, int);
int read_scan_file_v4(char *filename_positions, char *filename_strands,
                      int *transcripts, int *positions, char *strands,
                      int neg2pos, int sortpos, int max_overlap, int max_ul,
                      int max_el, int max_il, int **transcript_lengths,
                      int **transcript_map, int seq_ul, int seq_el, int seq_il,
                      int *out) {
  FILE *input_file_pos;
  FILE *input_file_strand;
  int t[5];
  int *m_p;
  char *m_s;
  int max_occur = 10000;
  int curr_tr;
  int curr_n;
  int running_n = 0;
  int running_np = 0;
  int running_nm = 0;
  int i;
  int togoon = 1;
  int call2or3 = 2;
  int n_orig;
  int n_after_filter;
  int cumul_filter_out = 0;
  int cumul_overlap_out = 0;
  i = 1;
  while ((i < 10000) & (call2or3 == 2)) {
    if (transcript_map[i][1] > 0)
      call2or3 = 3;
    if (transcript_map[i][2] > 0)
      call2or3 = 3;
    i++;
  }
  input_file_pos = fopen(filename_positions, "r");
  if (!input_file_pos) {
    printf("error! i could not open %s\n", filename_positions);
    return running_n;
  }
  input_file_strand = fopen(filename_strands, "r");
  if (!input_file_strand) {
    printf("error! i could not open %s\n", filename_strands);
    return running_n;
  }
  m_p = ivector(1, max_occur);
  m_s = cvector(1, max_occur);
  while (togoon >= 0) {
    if (call2or3 == 3) {
      read_line_wstrand_v3(input_file_pos, input_file_strand, t, m_p, m_s,
                           max_occur, neg2pos, sortpos, max_ul, max_el, max_il,
                           transcript_lengths, transcript_map, max_overlap,
                           seq_ul, seq_el, seq_il);
    } else {
      read_line_wstrand_v2(input_file_pos, input_file_strand, t, m_p, m_s,
                           max_occur, neg2pos, sortpos, max_ul, max_el, max_il,
                           transcript_lengths, max_overlap, seq_ul, seq_el,
                           seq_il);
    }
    curr_tr = t[0];
    curr_n = t[1];
    togoon = t[2];
    n_orig = t[3];
    n_after_filter = t[4];
    cumul_filter_out += (n_orig - n_after_filter);
    cumul_overlap_out += (n_orig - curr_n);
    if (curr_n > 0) {
      for (i = 1; i <= curr_n; i++) {
        running_n++;
        transcripts[running_n] = curr_tr;
        positions[running_n] = m_p[i];
        strands[running_n] = m_s[i];
        if (m_s[i] > 0)
          running_np++;
        if (m_s[i] == 0)
          running_nm++;
      }
    }
  }
  fclose(input_file_pos);
  fclose(input_file_strand);
  out[0] = cumul_filter_out;
  out[1] = cumul_overlap_out;
  out[2] = running_np;
  out[3] = running_nm;
  free_ivector(m_p, 1, max_occur);
  free_cvector(m_s, 1, max_occur);
  return running_n;
}


x86 assembly (clang, -O0):
<read_scan_file_v4>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
mov    0x60(%rbp),%rax
mov    0x58(%rbp),%eax
mov    0x50(%rbp),%eax
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%rax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x38(%rbp)
mov    %rsi,-0x40(%rbp)
mov    %rdx,-0x48(%rbp)
mov    %rcx,-0x50(%rbp)
mov    %r8,-0x58(%rbp)
mov    %r9d,-0x5c(%rbp)
movl   $0x2710,-0xa4(%rbp)
movl   $0x0,-0xb0(%rbp)
movl   $0x0,-0xb4(%rbp)
movl   $0x0,-0xb8(%rbp)
movl   $0x1,-0xc0(%rbp)
movl   $0x2,-0xc4(%rbp)
movl   $0x0,-0xd0(%rbp)
movl   $0x0,-0xd4(%rbp)
movl   $0x1,-0xbc(%rbp)
cmpl   $0x2710,-0xbc(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%eax
cmpl   $0x2,-0xc4(%rbp)
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     12c1 <read_scan_file_v4+0x131>
mov    0x40(%rbp),%rax
movslq -0xbc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmpl   $0x0,0x4(%rax)
jle    128a <read_scan_file_v4+0xfa>
movl   $0x3,-0xc4(%rbp)
mov    0x40(%rbp),%rax
movslq -0xbc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmpl   $0x0,0x8(%rax)
jle    12ad <read_scan_file_v4+0x11d>
movl   $0x3,-0xc4(%rbp)
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
jmp    123a <read_scan_file_v4+0xaa>
mov    -0x38(%rbp),%rdi
lea    0xd34(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
jne    12fe <read_scan_file_v4+0x16e>
mov    -0x38(%rbp),%rsi
lea    0xd17(%rip),%rdi
call   1050 <printf@plt>
mov    -0xb0(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    16bd <read_scan_file_v4+0x52d>
mov    -0x40(%rbp),%rdi
lea    0xcf7(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
jne    133b <read_scan_file_v4+0x1ab>
mov    -0x40(%rbp),%rsi
lea    0xcda(%rip),%rdi
call   1050 <printf@plt>
mov    -0xb0(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    16bd <read_scan_file_v4+0x52d>
mov    -0xa4(%rbp),%esi
mov    $0x1,%edi
call   10a0 <ivector@plt>
mov    %rax,-0x98(%rbp)
mov    -0xa4(%rbp),%esi
mov    $0x1,%edi
call   1060 <cvector@plt>
mov    %rax,-0xa0(%rbp)
cmpl   $0x0,-0xc0(%rbp)
jl     1641 <read_scan_file_v4+0x4b1>
cmpl   $0x3,-0xc4(%rbp)
jne    1439 <read_scan_file_v4+0x2a9>
mov    -0x68(%rbp),%rdi
mov    -0x70(%rbp),%rsi
lea    -0x90(%rbp),%rdx
mov    -0x98(%rbp),%rcx
mov    -0xa0(%rbp),%r8
mov    -0xa4(%rbp),%r9d
mov    -0x5c(%rbp),%eax
mov    %eax,-0xe4(%rbp)
mov    0x10(%rbp),%eax
mov    %eax,-0xe0(%rbp)
mov    0x20(%rbp),%eax
mov    %eax,-0xdc(%rbp)
mov    0x28(%rbp),%r13d
mov    0x30(%rbp),%r12d
mov    0x38(%rbp),%r15
mov    0x40(%rbp),%r14
mov    0x18(%rbp),%ebx
mov    0x48(%rbp),%r11d
mov    0x50(%rbp),%r10d
mov    0x58(%rbp),%eax
mov    %eax,-0xd8(%rbp)
mov    -0xe4(%rbp),%eax
mov    %eax,(%rsp)
mov    -0xe0(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0xdc(%rbp),%eax
mov    %eax,0x10(%rsp)
mov    -0xd8(%rbp),%eax
mov    %r13d,0x18(%rsp)
mov    %r12d,0x20(%rsp)
mov    %r15,0x28(%rsp)
mov    %r14,0x30(%rsp)
mov    %ebx,0x38(%rsp)
mov    %r11d,0x40(%rsp)
mov    %r10d,0x48(%rsp)
mov    %eax,0x50(%rsp)
call   1030 <read_line_wstrand_v3@plt>
jmp    14d7 <read_scan_file_v4+0x347>
mov    -0x68(%rbp),%rdi
mov    -0x70(%rbp),%rsi
lea    -0x90(%rbp),%rdx
mov    -0x98(%rbp),%rcx
mov    -0xa0(%rbp),%r8
mov    -0xa4(%rbp),%r9d
mov    -0x5c(%rbp),%eax
mov    %eax,-0xf0(%rbp)
mov    0x10(%rbp),%eax
mov    %eax,-0xec(%rbp)
mov    0x20(%rbp),%r13d
mov    0x28(%rbp),%r12d
mov    0x30(%rbp),%r15d
mov    0x38(%rbp),%r14
mov    0x18(%rbp),%ebx
mov    0x48(%rbp),%r11d
mov    0x50(%rbp),%r10d
mov    0x58(%rbp),%eax
mov    %eax,-0xe8(%rbp)
mov    -0xf0(%rbp),%eax
mov    %eax,(%rsp)
mov    -0xec(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0xe8(%rbp),%eax
mov    %r13d,0x10(%rsp)
mov    %r12d,0x18(%rsp)
mov    %r15d,0x20(%rsp)
mov    %r14,0x28(%rsp)
mov    %ebx,0x30(%rsp)
mov    %r11d,0x38(%rsp)
mov    %r10d,0x40(%rsp)
mov    %eax,0x48(%rsp)
call   1080 <read_line_wstrand_v2@plt>
mov    -0x90(%rbp),%eax
mov    %eax,-0xa8(%rbp)
mov    -0x8c(%rbp),%eax
mov    %eax,-0xac(%rbp)
mov    -0x88(%rbp),%eax
mov    %eax,-0xc0(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0xc8(%rbp)
mov    -0x80(%rbp),%eax
mov    %eax,-0xcc(%rbp)
mov    -0xc8(%rbp),%eax
sub    -0xcc(%rbp),%eax
add    -0xd0(%rbp),%eax
mov    %eax,-0xd0(%rbp)
mov    -0xc8(%rbp),%eax
sub    -0xac(%rbp),%eax
add    -0xd4(%rbp),%eax
mov    %eax,-0xd4(%rbp)
cmpl   $0x0,-0xac(%rbp)
jle    163c <read_scan_file_v4+0x4ac>
movl   $0x1,-0xbc(%rbp)
mov    -0xbc(%rbp),%eax
cmp    -0xac(%rbp),%eax
jg     1637 <read_scan_file_v4+0x4a7>
mov    -0xb0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb0(%rbp)
mov    -0xa8(%rbp),%edx
mov    -0x48(%rbp),%rax
movslq -0xb0(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x98(%rbp),%rax
movslq -0xbc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x50(%rbp),%rax
movslq -0xb0(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xa0(%rbp),%rax
movslq -0xbc(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x58(%rbp),%rax
movslq -0xb0(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xa0(%rbp),%rax
movslq -0xbc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jle    15f4 <read_scan_file_v4+0x464>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
mov    -0xa0(%rbp),%rax
movslq -0xbc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    161e <read_scan_file_v4+0x48e>
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    1623 <read_scan_file_v4+0x493>
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
jmp    1557 <read_scan_file_v4+0x3c7>
jmp    163c <read_scan_file_v4+0x4ac>
jmp    1369 <read_scan_file_v4+0x1d9>
mov    -0x68(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x70(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0xd0(%rbp),%ecx
mov    0x60(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xd4(%rbp),%ecx
mov    0x60(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0xb4(%rbp),%ecx
mov    0x60(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0xb8(%rbp),%ecx
mov    0x60(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x98(%rbp),%rdi
mov    -0xa4(%rbp),%edx
mov    $0x1,%esi
call   1090 <free_ivector@plt>
mov    -0xa0(%rbp),%rdi
mov    -0xa4(%rbp),%edx
mov    $0x1,%esi
call   1070 <free_cvector@plt>
mov    -0xb0(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_scan_file_v4>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r9,0x38(%rsp)
mov    %r8,0x30(%rsp)
mov    %rcx,0x28(%rsp)
mov    %rdx,0x20(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0xd0(%rsp),%rsi
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rsi,%rax,8),%rcx
cmpl   $0x0,0x4(%rcx)
setg   %dl
cmpl   $0x0,0x8(%rcx)
setg   %r15b
or     %dl,%r15b
jne    11f7 <read_scan_file_v4+0x67>
lea    0x1(%rax),%rcx
cmp    $0x270f,%rax
mov    %rcx,%rax
jb     11d0 <read_scan_file_v4+0x40>
lea    0xe02(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <fopen@plt>
mov    %rax,0x18(%rsp)
test   %rax,%rax
je     149e <read_scan_file_v4+0x30e>
lea    0xde5(%rip),%rsi
mov    %r14,%rdi
call   10b0 <fopen@plt>
mov    %rax,0x10(%rsp)
test   %rax,%rax
je     14aa <read_scan_file_v4+0x31a>
mov    $0x1,%edi
mov    $0x2710,%esi
call   10a0 <ivector@plt>
mov    %rax,%rbp
mov    $0x1,%edi
mov    $0x2710,%esi
call   1060 <cvector@plt>
mov    %rax,%r12
addq   $0x4,0x20(%rsp)
addq   $0x4,0x28(%rsp)
addq   $0x1,0x30(%rsp)
xor    %ebx,%ebx
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
xor    %r13d,%r13d
xor    %r14d,%r14d
jmp    129c <read_scan_file_v4+0x10c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    %r9d,%ebx
test   %r8d,%r8d
js     1447 <read_scan_file_v4+0x2b7>
test   %r15b,%r15b
je     1330 <read_scan_file_v4+0x1a0>
sub    $0x8,%rsp
mov    0x20(%rsp),%rdi
mov    0x18(%rsp),%rsi
lea    0x48(%rsp),%rdx
mov    %rbp,%rcx
mov    %r12,%r8
mov    $0x2710,%r9d
mov    0xf0(%rsp),%eax
push   %rax
mov    0xf0(%rsp),%eax
push   %rax
mov    0xf0(%rsp),%eax
push   %rax
mov    0xc8(%rsp),%eax
push   %rax
push   0xf8(%rsp)
push   0xf8(%rsp)
mov    0xf8(%rsp),%eax
push   %rax
mov    0xf8(%rsp),%eax
push   %rax
mov    0xf8(%rsp),%eax
push   %rax
mov    0xf0(%rsp),%eax
push   %rax
push   0x90(%rsp)
call   1030 <read_line_wstrand_v3@plt>
add    $0x60,%rsp
jmp    13a2 <read_scan_file_v4+0x212>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x18(%rsp),%rdi
mov    0x10(%rsp),%rsi
lea    0x40(%rsp),%rdx
mov    %rbp,%rcx
mov    %r12,%r8
mov    $0x2710,%r9d
mov    0xe8(%rsp),%eax
push   %rax
mov    0xe8(%rsp),%eax
push   %rax
mov    0xe8(%rsp),%eax
push   %rax
mov    0xc0(%rsp),%eax
push   %rax
push   0xe8(%rsp)
mov    0xe8(%rsp),%eax
push   %rax
mov    0xe8(%rsp),%eax
push   %rax
mov    0xe8(%rsp),%eax
push   %rax
mov    0xe0(%rsp),%eax
push   %rax
push   0x80(%rsp)
call   1080 <read_line_wstrand_v2@plt>
add    $0x50,%rsp
mov    0x44(%rsp),%r10d
mov    0x48(%rsp),%r8d
mov    0x4c(%rsp),%r9d
mov    0xc(%rsp),%eax
add    %r9d,%eax
sub    0x50(%rsp),%eax
mov    %eax,0xc(%rsp)
sub    %r10d,%ebx
test   %r10d,%r10d
jle    1290 <read_scan_file_v4+0x100>
mov    %rbx,0x60(%rsp)
mov    0x40(%rsp),%esi
movslq 0x8(%rsp),%rdi
mov    0x20(%rsp),%rax
lea    (%rax,%rdi,4),%rax
mov    0x28(%rsp),%rcx
lea    (%rcx,%rdi,4),%rcx
add    0x30(%rsp),%rdi
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %esi,(%rax,%rbx,4)
mov    %rbp,%r11
mov    0x4(%rbp,%rbx,4),%ebp
mov    %ebp,(%rcx,%rbx,4)
movzbl 0x1(%r12,%rbx,1),%edx
mov    %dl,(%rdi,%rbx,1)
xor    %edx,%edx
xor    %ebp,%ebp
cmpb   $0x0,0x1(%r12,%rbx,1)
setg   %dl
sete   %bpl
add    %edx,%r14d
add    %ebp,%r13d
mov    %r11,%rbp
add    $0x1,%rbx
cmp    %rbx,%r10
jne    1400 <read_scan_file_v4+0x270>
add    %ebx,0x8(%rsp)
mov    0x60(%rsp),%rbx
jmp    1290 <read_scan_file_v4+0x100>
mov    0x18(%rsp),%rdi
call   1040 <fclose@plt>
mov    0x10(%rsp),%rdi
call   1040 <fclose@plt>
mov    0xf0(%rsp),%rax
mov    0xc(%rsp),%ecx
mov    %ecx,(%rax)
mov    %ebx,0x4(%rax)
mov    %r14d,0x8(%rax)
mov    %r13d,0xc(%rax)
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x2710,%edx
call   1090 <free_ivector@plt>
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0x2710,%edx
call   1070 <free_cvector@plt>
mov    0x8(%rsp),%eax
jmp    14bb <read_scan_file_v4+0x32b>
lea    0xb5d(%rip),%rdi
mov    %rbx,%rsi
jmp    14b4 <read_scan_file_v4+0x324>
lea    0xb51(%rip),%rdi
mov    %r14,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [28 x i8] c"error! i could not open %s\0A\00"
define i32 @read_scan_file_v4(i8* %0, i8* %1, i32* %2, i32* %3, i8* %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32** %11, i32** %12, i32 %13, i32 %14, i32 %15, i32* %16) {
%18 = alloca i32
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i32*
%22 = alloca i32*
%23 = alloca i8*
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32**
%31 = alloca i32**
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32*
%36 = alloca i32*
%37 = alloca i32*
%38 = alloca [5 x i32]
%39 = alloca i32*
%40 = alloca i8*
%41 = alloca i32
%42 = alloca i32
%43 = alloca i32
%44 = alloca i32
%45 = alloca i32
%46 = alloca i32
%47 = alloca i32
%48 = alloca i32
%49 = alloca i32
%50 = alloca i32
%51 = alloca i32
%52 = alloca i32
%53 = alloca i32
store i8* %0, i8** %19
store i8* %1, i8** %20
store i32* %2, i32** %21
store i32* %3, i32** %22
store i8* %4, i8** %23
store i32 %5, i32* %24
store i32 %6, i32* %25
store i32 %7, i32* %26
store i32 %8, i32* %27
store i32 %9, i32* %28
store i32 %10, i32* %29
store i32** %11, i32*** %30
store i32** %12, i32*** %31
store i32 %13, i32* %32
store i32 %14, i32* %33
store i32 %15, i32* %34
store i32* %16, i32** %35
store i32 10000, i32* %41
store i32 0, i32* %44
store i32 0, i32* %45
store i32 0, i32* %46
store i32 1, i32* %48
store i32 2, i32* %49
store i32 0, i32* %52
store i32 0, i32* %53
store i32 1, i32* %47
br label %54
54: ; preds = %83, %17
%55 = load i32, i32* %47
%56 = icmp slt i32 %55, 10000
%57 = zext i1 %56 to i32
%58 = load i32, i32* %49
%59 = icmp eq i32 %58, 2
%60 = zext i1 %59 to i32
%61 = and i32 %57, %60
%62 = icmp ne i32 %61, 0
br i1 %62, label %63, label %86
63: ; preds = %54
%64 = load i32**, i32*** %31
%65 = load i32, i32* %47
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i32*, i32** %64, i64 %66
%68 = load i32*, i32** %67
%69 = getelementptr inbounds i32, i32* %68, i64 1
%70 = load i32, i32* %69
%71 = icmp sgt i32 %70, 0
br i1 %71, label %72, label %73
72: ; preds = %63
store i32 3, i32* %49
br label %73
73: ; preds = %72, %63
%74 = load i32**, i32*** %31
%75 = load i32, i32* %47
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i32*, i32** %74, i64 %76
%78 = load i32*, i32** %77
%79 = getelementptr inbounds i32, i32* %78, i64 2
%80 = load i32, i32* %79
%81 = icmp sgt i32 %80, 0
br i1 %81, label %82, label %83
82: ; preds = %73
store i32 3, i32* %49
br label %83
83: ; preds = %82, %73
%84 = load i32, i32* %47
%85 = add nsw i32 %84, 1
store i32 %85, i32* %47
br label %54
86: ; preds = %54
%87 = load i8*, i8** %19
%88 = call i32* @fopen(i8* %87, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %88, i32** %36
%89 = load i32*, i32** %36
%90 = icmp ne i32* %89, null
br i1 %90, label %95, label %91
91: ; preds = %86
%92 = load i8*, i8** %19
%93 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %92)
%94 = load i32, i32* %44
store i32 %94, i32* %18
br label %257
95: ; preds = %86
%96 = load i8*, i8** %20
%97 = call i32* @fopen(i8* %96, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %97, i32** %37
%98 = load i32*, i32** %37
%99 = icmp ne i32* %98, null
br i1 %99, label %104, label %100
100: ; preds = %95
%101 = load i8*, i8** %20
%102 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %101)
%103 = load i32, i32* %44
store i32 %103, i32* %18
br label %257
104: ; preds = %95
%105 = load i32, i32* %41
%106 = call i32* @ivector(i32 1, i32 %105)
store i32* %106, i32** %39
%107 = load i32, i32* %41
%108 = call i8* @cvector(i32 1, i32 %107)
store i8* %108, i8** %40
br label %109
109: ; preds = %232, %104
%110 = load i32, i32* %48
%111 = icmp sge i32 %110, 0
br i1 %111, label %112, label %233
112: ; preds = %109
%113 = load i32, i32* %49
%114 = icmp eq i32 %113, 3
br i1 %114, label %115, label %134
115: ; preds = %112
%116 = load i32*, i32** %36
%117 = load i32*, i32** %37
%118 = getelementptr inbounds [5 x i32], [5 x i32]* %38, i64 0, i64 0
%119 = load i32*, i32** %39
%120 = load i8*, i8** %40
%121 = load i32, i32* %41
%122 = load i32, i32* %24
%123 = load i32, i32* %25
%124 = load i32, i32* %27
%125 = load i32, i32* %28
%126 = load i32, i32* %29
%127 = load i32**, i32*** %30
%128 = load i32**, i32*** %31
%129 = load i32, i32* %26
%130 = load i32, i32* %32
%131 = load i32, i32* %33
%132 = load i32, i32* %34
%133 = call i32 @read_line_wstrand_v3(i32* %116, i32* %117, i32* %118, i32* %119, i8* %120, i32 %121, i32 %122, i32 %123, i32 %124, i32 %125, i32 %126, i32** %127, i32** %128, i32 %129, i32 %130, i32 %131, i32 %132)
br label %152
134: ; preds = %112
%135 = load i32*, i32** %36
%136 = load i32*, i32** %37
%137 = getelementptr inbounds [5 x i32], [5 x i32]* %38, i64 0, i64 0
%138 = load i32*, i32** %39
%139 = load i8*, i8** %40
%140 = load i32, i32* %41
%141 = load i32, i32* %24
%142 = load i32, i32* %25
%143 = load i32, i32* %27
%144 = load i32, i32* %28
%145 = load i32, i32* %29
%146 = load i32**, i32*** %30
%147 = load i32, i32* %26
%148 = load i32, i32* %32
%149 = load i32, i32* %33
%150 = load i32, i32* %34
%151 = call i32 @read_line_wstrand_v2(i32* %135, i32* %136, i32* %137, i32* %138, i8* %139, i32 %140, i32 %141, i32 %142, i32 %143, i32 %144, i32 %145, i32** %146, i32 %147, i32 %148, i32 %149, i32 %150)
br label %152
152: ; preds = %134, %115
%153 = getelementptr inbounds [5 x i32], [5 x i32]* %38, i64 0, i64 0
%154 = load i32, i32* %153
store i32 %154, i32* %42
%155 = getelementptr inbounds [5 x i32], [5 x i32]* %38, i64 0, i64 1
%156 = load i32, i32* %155
store i32 %156, i32* %43
%157 = getelementptr inbounds [5 x i32], [5 x i32]* %38, i64 0, i64 2
%158 = load i32, i32* %157
store i32 %158, i32* %48
%159 = getelementptr inbounds [5 x i32], [5 x i32]* %38, i64 0, i64 3
%160 = load i32, i32* %159
store i32 %160, i32* %50
%161 = getelementptr inbounds [5 x i32], [5 x i32]* %38, i64 0, i64 4
%162 = load i32, i32* %161
store i32 %162, i32* %51
%163 = load i32, i32* %50
%164 = load i32, i32* %51
%165 = sub nsw i32 %163, %164
%166 = load i32, i32* %52
%167 = add nsw i32 %166, %165
store i32 %167, i32* %52
%168 = load i32, i32* %50
%169 = load i32, i32* %43
%170 = sub nsw i32 %168, %169
%171 = load i32, i32* %53
%172 = add nsw i32 %171, %170
store i32 %172, i32* %53
%173 = load i32, i32* %43
%174 = icmp sgt i32 %173, 0
br i1 %174, label %175, label %232
175: ; preds = %152
store i32 1, i32* %47
br label %176
176: ; preds = %228, %175
%177 = load i32, i32* %47
%178 = load i32, i32* %43
%179 = icmp sle i32 %177, %178
br i1 %179, label %180, label %231
180: ; preds = %176
%181 = load i32, i32* %44
%182 = add nsw i32 %181, 1
store i32 %182, i32* %44
%183 = load i32, i32* %42
%184 = load i32*, i32** %21
%185 = load i32, i32* %44
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds i32, i32* %184, i64 %186
store i32 %183, i32* %187
%188 = load i32*, i32** %39
%189 = load i32, i32* %47
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds i32, i32* %188, i64 %190
%192 = load i32, i32* %191
%193 = load i32*, i32** %22
%194 = load i32, i32* %44
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds i32, i32* %193, i64 %195
store i32 %192, i32* %196
%197 = load i8*, i8** %40
%198 = load i32, i32* %47
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds i8, i8* %197, i64 %199
%201 = load i8, i8* %200
%202 = load i8*, i8** %23
%203 = load i32, i32* %44
%204 = sext i32 %203 to i64
%205 = getelementptr inbounds i8, i8* %202, i64 %204
store i8 %201, i8* %205
%206 = load i8*, i8** %40
%207 = load i32, i32* %47
%208 = sext i32 %207 to i64
%209 = getelementptr inbounds i8, i8* %206, i64 %208
%210 = load i8, i8* %209
%211 = sext i8 %210 to i32
%212 = icmp sgt i32 %211, 0
br i1 %212, label %213, label %216
213: ; preds = %180
%214 = load i32, i32* %45
%215 = add nsw i32 %214, 1
store i32 %215, i32* %45
br label %216
216: ; preds = %213, %180
%217 = load i8*, i8** %40
%218 = load i32, i32* %47
%219 = sext i32 %218 to i64
%220 = getelementptr inbounds i8, i8* %217, i64 %219
%221 = load i8, i8* %220
%222 = sext i8 %221 to i32
%223 = icmp eq i32 %222, 0
br i1 %223, label %224, label %227
224: ; preds = %216
%225 = load i32, i32* %46
%226 = add nsw i32 %225, 1
store i32 %226, i32* %46
br label %227
227: ; preds = %224, %216
br label %228
228: ; preds = %227
%229 = load i32, i32* %47
%230 = add nsw i32 %229, 1
store i32 %230, i32* %47
br label %176
231: ; preds = %176
br label %232
232: ; preds = %231, %152
br label %109
233: ; preds = %109
%234 = load i32*, i32** %36
%235 = call i32 @fclose(i32* %234)
%236 = load i32*, i32** %37
%237 = call i32 @fclose(i32* %236)
%238 = load i32, i32* %52
%239 = load i32*, i32** %35
%240 = getelementptr inbounds i32, i32* %239, i64 0
store i32 %238, i32* %240
%241 = load i32, i32* %53
%242 = load i32*, i32** %35
%243 = getelementptr inbounds i32, i32* %242, i64 1
store i32 %241, i32* %243
%244 = load i32, i32* %45
%245 = load i32*, i32** %35
%246 = getelementptr inbounds i32, i32* %245, i64 2
store i32 %244, i32* %246
%247 = load i32, i32* %46
%248 = load i32*, i32** %35
%249 = getelementptr inbounds i32, i32* %248, i64 3
store i32 %247, i32* %249
%250 = load i32*, i32** %39
%251 = load i32, i32* %41
%252 = call i32 @free_ivector(i32* %250, i32 1, i32 %251)
%253 = load i8*, i8** %40
%254 = load i32, i32* %41
%255 = call i32 @free_cvector(i8* %253, i32 1, i32 %254)
%256 = load i32, i32* %44
store i32 %256, i32* %18
br label %257
257: ; preds = %233, %100, %91
%258 = load i32, i32* %18
ret i32 %258
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [28 x i8] c"error! i could not open %s\0A\00"
define i32 @read_scan_file_v4(i8* %0, i8* %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i8* nocapture writeonly %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32** %11, i32** %12, i32 %13, i32 %14, i32 %15, i32* nocapture writeonly %16) {
%18 = alloca [5 x i32]
%19 = bitcast [5 x i32]* %18 to i8*
br label %20
20: ; preds = %17, %20
%21 = phi i64 [ 1, %17 ], [ %31, %20 ]
%22 = getelementptr inbounds i32*, i32** %12, i64 %21
%23 = load i32*, i32** %22
%24 = getelementptr inbounds i32, i32* %23, i64 1
%25 = load i32, i32* %24
%26 = icmp sgt i32 %25, 0
%27 = getelementptr inbounds i32, i32* %23, i64 2
%28 = load i32, i32* %27
%29 = icmp sgt i32 %28, 0
%30 = select i1 %29, i1 true, i1 %26
%31 = add nuw nsw i64 %21, 1
%32 = icmp ugt i64 %21, 9998
%33 = or i1 %30, %32
br i1 %33, label %34, label %20
34: ; preds = %20
%35 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %114
39: ; preds = %34
%40 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%41 = icmp eq i32* %40, null
br i1 %41, label %42, label %44
42: ; preds = %39
%43 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %114
44: ; preds = %39
%45 = tail call i32* @ivector(i32 1, i32 10000)
%46 = tail call i8* @cvector(i32 1, i32 10000)
%47 = getelementptr inbounds [5 x i32], [5 x i32]* %18, i64 0, i64 0
%48 = getelementptr inbounds [5 x i32], [5 x i32]* %18, i64 0, i64 1
%49 = getelementptr inbounds [5 x i32], [5 x i32]* %18, i64 0, i64 2
%50 = getelementptr inbounds [5 x i32], [5 x i32]* %18, i64 0, i64 3
%51 = getelementptr inbounds [5 x i32], [5 x i32]* %18, i64 0, i64 4
br label %52
52: ; preds = %44, %101
%53 = phi i32 [ 0, %44 ], [ %71, %101 ]
%54 = phi i32 [ 0, %44 ], [ %69, %101 ]
%55 = phi i32 [ 0, %44 ], [ %104, %101 ]
%56 = phi i32 [ 0, %44 ], [ %103, %101 ]
%57 = phi i32 [ 0, %44 ], [ %102, %101 ]
br i1 %30, label %58, label %60
58: ; preds = %52
%59 = call i32 @read_line_wstrand_v3(i32* %35, i32* %40, i32* %47, i32* %45, i8* %46, i32 10000, i32 %5, i32 %6, i32 %8, i32 %9, i32 %10, i32** %11, i32** %12, i32 %7, i32 %13, i32 %14, i32 %15)
br label %62
60: ; preds = %52
%61 = call i32 @read_line_wstrand_v2(i32* %35, i32* %40, i32* %47, i32* %45, i8* %46, i32 10000, i32 %5, i32 %6, i32 %8, i32 %9, i32 %10, i32** %11, i32 %7, i32 %13, i32 %14, i32 %15)
br label %62
62: ; preds = %60, %58
%63 = load i32, i32* %47
%64 = load i32, i32* %48
%65 = load i32, i32* %49
%66 = load i32, i32* %50
%67 = load i32, i32* %51
%68 = add i32 %66, %54
%69 = sub i32 %68, %67
%70 = sub i32 %53, %64
%71 = add i32 %70, %66
%72 = icmp slt i32 %64, 1
br i1 %72, label %101, label %73
73: ; preds = %62
%74 = sext i32 %55 to i64
%75 = add nuw i32 %64, 1
%76 = zext i32 %75 to i64
br label %77
77: ; preds = %73, %77
%78 = phi i64 [ 1, %73 ], [ %97, %77 ]
%79 = phi i64 [ %74, %73 ], [ %82, %77 ]
%80 = phi i32 [ %56, %73 ], [ %96, %77 ]
%81 = phi i32 [ %57, %73 ], [ %93, %77 ]
%82 = add nsw i64 %79, 1
%83 = getelementptr inbounds i32, i32* %2, i64 %82
store i32 %63, i32* %83
%84 = getelementptr inbounds i32, i32* %45, i64 %78
%85 = load i32, i32* %84
%86 = getelementptr inbounds i32, i32* %3, i64 %82
store i32 %85, i32* %86
%87 = getelementptr inbounds i8, i8* %46, i64 %78
%88 = load i8, i8* %87
%89 = getelementptr inbounds i8, i8* %4, i64 %82
store i8 %88, i8* %89
%90 = load i8, i8* %87
%91 = icmp sgt i8 %90, 0
%92 = zext i1 %91 to i32
%93 = add nsw i32 %81, %92
%94 = icmp eq i8 %90, 0
%95 = zext i1 %94 to i32
%96 = add nsw i32 %80, %95
%97 = add nuw nsw i64 %78, 1
%98 = icmp eq i64 %97, %76
br i1 %98, label %99, label %77
99: ; preds = %77
%100 = trunc i64 %82 to i32
br label %101
101: ; preds = %99, %62
%102 = phi i32 [ %57, %62 ], [ %93, %99 ]
%103 = phi i32 [ %56, %62 ], [ %96, %99 ]
%104 = phi i32 [ %55, %62 ], [ %100, %99 ]
%105 = icmp sgt i32 %65, -1
br i1 %105, label %52, label %106
106: ; preds = %101
%107 = call i32 @fclose(i32* %35)
%108 = call i32 @fclose(i32* %40)
store i32 %69, i32* %16
%109 = getelementptr inbounds i32, i32* %16, i64 1
store i32 %71, i32* %109
%110 = getelementptr inbounds i32, i32* %16, i64 2
store i32 %102, i32* %110
%111 = getelementptr inbounds i32, i32* %16, i64 3
store i32 %103, i32* %111
%112 = call i32 @free_ivector(i32* %45, i32 1, i32 10000)
%113 = call i32 @free_cvector(i8* %46, i32 1, i32 10000)
br label %114
114: ; preds = %106, %42, %37
%115 = phi i32 [ %104, %106 ], [ 0, %42 ], [ 0, %37 ]
ret i32 %115
}