#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free_ivector(int *, int, int);
int *ivector(int, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ read_line(int /*<<< orphan*/ *, int *, int *, int, int, int);
int vector_overlap(int *, int, int, int *);
int read_scan_file_v2(char *filename, int *transcripts, int *positions,
                      int neg2pos, int sortpos, int max_overlap) {
  FILE *input_file;
  int t[3];
  int *m_p;
  int max_occur = 10000;
  int curr_tr;
  int curr_n;
  int running_n = 0;
  int i;
  int togoon = 1;
  float *d;
  int *positions_no_overlap;
  int n_no_overlap;
  input_file = fopen(filename, "r");
  if (!input_file) {
    printf("error! i could not open %s\n", filename);
    return running_n;
  }
  m_p = ivector(1, max_occur);
  positions_no_overlap = ivector(1, max_occur);
  while (togoon >= 1) {
    read_line(input_file, t, m_p, max_occur, neg2pos, sortpos);
    curr_tr = t[0];
    curr_n = t[1];
    togoon = t[2];
    if (curr_n > 0) {
      if (max_overlap > 0) {
        n_no_overlap =
            vector_overlap(m_p, curr_n, max_overlap, positions_no_overlap);
        for (i = 1; i <= n_no_overlap; i++) {
          running_n++;
          transcripts[running_n] = curr_tr;
          positions[running_n] = positions_no_overlap[i];
        }
      } else {
        for (i = 1; i <= curr_n; i++) {
          running_n++;
          transcripts[running_n] = curr_tr;
          positions[running_n] = m_p[i];
        }
      }
    }
  }
  fclose(input_file);
  free_ivector(m_p, 1, max_occur);
  free_ivector(positions_no_overlap, 1, max_occur);
  return running_n;
}


x86 assembly (clang, -O0):
<read_scan_file_v2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
movl   $0x2710,-0x54(%rbp)
movl   $0x0,-0x60(%rbp)
movl   $0x1,-0x68(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe4e(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    11e1 <read_scan_file_v2+0x71>
mov    -0x10(%rbp),%rsi
lea    0xe31(%rip),%rdi
call   1040 <printf@plt>
mov    -0x60(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1346 <read_scan_file_v2+0x1d6>
mov    -0x54(%rbp),%esi
mov    $0x1,%edi
call   1080 <ivector@plt>
mov    %rax,-0x50(%rbp)
mov    -0x54(%rbp),%esi
mov    $0x1,%edi
call   1080 <ivector@plt>
mov    %rax,-0x78(%rbp)
cmpl   $0x1,-0x68(%rbp)
jl     1315 <read_scan_file_v2+0x1a5>
mov    -0x38(%rbp),%rdi
lea    -0x44(%rbp),%rsi
mov    -0x50(%rbp),%rdx
mov    -0x54(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%r9d
call   1070 <read_line@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x68(%rbp)
cmpl   $0x0,-0x5c(%rbp)
jle    1310 <read_scan_file_v2+0x1a0>
cmpl   $0x0,-0x2c(%rbp)
jle    12b8 <read_scan_file_v2+0x148>
mov    -0x50(%rbp),%rdi
mov    -0x5c(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x78(%rbp),%rcx
call   1050 <vector_overlap@plt>
mov    %eax,-0x7c(%rbp)
movl   $0x1,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x7c(%rbp),%eax
jg     12b3 <read_scan_file_v2+0x143>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
mov    -0x58(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x78(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x20(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    126c <read_scan_file_v2+0xfc>
jmp    130b <read_scan_file_v2+0x19b>
movl   $0x1,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x5c(%rbp),%eax
jg     1306 <read_scan_file_v2+0x196>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
mov    -0x58(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x50(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x20(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    12bf <read_scan_file_v2+0x14f>
jmp    130b <read_scan_file_v2+0x19b>
jmp    1310 <read_scan_file_v2+0x1a0>
jmp    1203 <read_scan_file_v2+0x93>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x50(%rbp),%rdi
mov    -0x54(%rbp),%edx
mov    $0x1,%esi
call   1060 <free_ivector@plt>
mov    -0x78(%rbp),%rdi
mov    -0x54(%rbp),%edx
mov    $0x1,%esi
call   1060 <free_ivector@plt>
mov    -0x60(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_scan_file_v2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r9d,0x8(%rsp)
mov    %r8d,0x24(%rsp)
mov    %ecx,0x20(%rsp)
mov    %rdx,%rbp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xe61(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,0x68(%rsp)
test   %rax,%rax
je     1760 <read_scan_file_v2+0x5f0>
mov    $0x1,%edi
mov    $0x2710,%esi
call   1080 <ivector@plt>
mov    %rax,%r15
mov    $0x1,%edi
mov    $0x2710,%esi
call   1080 <ivector@plt>
mov    %rax,%r12
lea    0x4(%r14),%rax
mov    %rax,0x60(%rsp)
lea    0x4(%rbp),%rax
mov    %rax,0x58(%rsp)
lea    0x4(%r12),%rax
mov    %rax,0x50(%rsp)
lea    0x4(%r15),%rax
mov    %rax,0x48(%rsp)
lea    0x34(%rbp),%rax
mov    %rax,0x30(%rsp)
lea    0x34(%r14),%rax
mov    %rax,0x28(%rsp)
mov    %rbp,0x18(%rsp)
lea    0x8(%rbp),%rax
mov    %rax,0x40(%rsp)
mov    %r14,0x10(%rsp)
lea    0x8(%r14),%rax
mov    %rax,0x38(%rsp)
xor    %r14d,%r14d
mov    0x8(%rsp),%ebp
jmp    1248 <read_scan_file_v2+0xd8>
mov    0xc(%rsp),%ebx
cs nopw 0x0(%rax,%rax,1)
test   %ebx,%ebx
jle    1730 <read_scan_file_v2+0x5c0>
mov    0x68(%rsp),%rdi
lea    0x74(%rsp),%rsi
mov    %r15,%rdx
mov    $0x2710,%ecx
mov    0x20(%rsp),%r8d
mov    0x24(%rsp),%r9d
call   1070 <read_line@plt>
mov    0x78(%rsp),%esi
mov    0x7c(%rsp),%ebx
test   %esi,%esi
jle    1240 <read_scan_file_v2+0xd0>
mov    0x74(%rsp),%r13d
test   %ebp,%ebp
jle    12e0 <read_scan_file_v2+0x170>
mov    %ebx,0xc(%rsp)
mov    %r15,%rdi
mov    %ebp,%edx
mov    %r12,%rcx
call   1050 <vector_overlap@plt>
test   %eax,%eax
jle    1232 <read_scan_file_v2+0xc2>
movslq %r14d,%r11
mov    %eax,%ecx
lea    0x1(%rcx),%rdx
mov    $0x1,%esi
cmp    $0x8,%eax
jae    1411 <read_scan_file_v2+0x2a1>
test   $0x1,%dl
jne    1577 <read_scan_file_v2+0x407>
lea    0x1(%r11),%r14
mov    0x10(%rsp),%rax
mov    %r13d,0x4(%rax,%r11,4)
mov    (%r12,%rsi,4),%eax
mov    0x18(%rsp),%rcx
mov    %eax,0x4(%rcx,%r11,4)
lea    0x1(%rsi),%rax
mov    %r14,%r11
jmp    157a <read_scan_file_v2+0x40a>
nopl   0x0(%rax,%rax,1)
movslq %r14d,%r9
lea    0x1(%rsi),%rcx
mov    $0x1,%edx
cmp    $0x8,%rsi
jb     1539 <read_scan_file_v2+0x3c9>
mov    %ebx,0xc(%rsp)
mov    0x60(%rsp),%rax
lea    (%rax,%r9,4),%rax
lea    (%r9,%rcx,1),%rdi
mov    0x10(%rsp),%rbp
lea    0x0(%rbp,%rdi,4),%rbp
mov    0x58(%rsp),%rbx
lea    (%rbx,%r9,4),%r10
mov    0x18(%rsp),%rbx
lea    (%rbx,%rdi,4),%r8
lea    (%r15,%rcx,4),%rdi
cmp    %r8,%rax
setb   %r11b
cmp    %rbp,%r10
setb   %r14b
cmp    %rdi,%rax
setb   %al
mov    0x48(%rsp),%rbx
cmp    %rbp,%rbx
setb   %bpl
cmp    %rdi,%r10
setb   %dil
cmp    %r8,%rbx
setb   %r8b
test   %r14b,%r11b
jne    1531 <read_scan_file_v2+0x3c1>
and    %bpl,%al
jne    1531 <read_scan_file_v2+0x3c1>
and    %r8b,%dil
jne    1531 <read_scan_file_v2+0x3c1>
mov    %esi,%edx
and    $0xfffffff8,%edx
movd   %r13d,%xmm0
pshufd $0x0,%xmm0,%xmm0
lea    -0x8(%rdx),%rax
mov    %rax,%r8
shr    $0x3,%r8
add    $0x1,%r8
test   %rax,%rax
je     164e <read_scan_file_v2+0x4de>
mov    %r8,%rdi
movabs $0x3ffffffffffffffe,%rax
ff ff 3f
and    %rax,%rdi
mov    0x30(%rsp),%rax
lea    (%rax,%r9,4),%rbx
mov    0x28(%rsp),%rax
lea    (%rax,%r9,4),%rax
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movdqu %xmm0,-0x30(%rax,%rbp,4)
movdqu %xmm0,-0x20(%rax,%rbp,4)
movups 0x4(%r15,%rbp,4),%xmm1
movups 0x14(%r15,%rbp,4),%xmm2
movups %xmm1,-0x30(%rbx,%rbp,4)
movups %xmm2,-0x20(%rbx,%rbp,4)
movdqu %xmm0,-0x10(%rax,%rbp,4)
movdqu %xmm0,(%rax,%rbp,4)
movups 0x24(%r15,%rbp,4),%xmm1
movups 0x34(%r15,%rbp,4),%xmm2
movups %xmm1,-0x10(%rbx,%rbp,4)
movups %xmm2,(%rbx,%rbp,4)
add    $0x10,%rbp
add    $0xfffffffffffffffe,%rdi
jne    13c0 <read_scan_file_v2+0x250>
jmp    1650 <read_scan_file_v2+0x4e0>
mov    %rcx,0x80(%rsp)
mov    0x60(%rsp),%rax
lea    (%rax,%r11,4),%rax
lea    (%r11,%rdx,1),%rdi
mov    0x10(%rsp),%rcx
lea    (%rcx,%rdi,4),%rbp
mov    0x58(%rsp),%rcx
lea    (%rcx,%r11,4),%rbx
mov    0x18(%rsp),%rcx
lea    (%rcx,%rdi,4),%rdi
lea    (%r12,%rdx,4),%rcx
cmp    %rdi,%rax
setb   %r14b
cmp    %rbp,%rbx
setb   %r8b
cmp    %rcx,%rax
setb   %r9b
mov    0x50(%rsp),%rax
cmp    %rbp,%rax
setb   %r10b
cmp    %rcx,%rbx
setb   %bl
cmp    %rdi,%rax
setb   %al
test   %r8b,%r14b
jne    171e <read_scan_file_v2+0x5ae>
and    %r10b,%r9b
jne    156a <read_scan_file_v2+0x3fa>
and    %al,%bl
jne    156a <read_scan_file_v2+0x3fa>
mov    0x80(%rsp),%r8
mov    %r8d,%esi
and    $0xfffffff8,%esi
movd   %r13d,%xmm0
pshufd $0x0,%xmm0,%xmm0
lea    -0x8(%rsi),%rax
mov    %rax,%r9
shr    $0x3,%r9
add    $0x1,%r9
test   %rax,%rax
je     15dc <read_scan_file_v2+0x46c>
mov    %r9,%rax
movabs $0x3ffffffffffffffe,%rcx
ff ff 3f
and    %rcx,%rax
mov    0x30(%rsp),%rcx
lea    (%rcx,%r11,4),%rdi
mov    0x28(%rsp),%rcx
lea    (%rcx,%r11,4),%rbx
xor    %ebp,%ebp
movdqu %xmm0,-0x30(%rbx,%rbp,4)
movdqu %xmm0,-0x20(%rbx,%rbp,4)
movups 0x4(%r12,%rbp,4),%xmm1
movups 0x14(%r12,%rbp,4),%xmm2
movups %xmm1,-0x30(%rdi,%rbp,4)
movups %xmm2,-0x20(%rdi,%rbp,4)
movdqu %xmm0,-0x10(%rbx,%rbp,4)
movdqu %xmm0,(%rbx,%rbp,4)
movups 0x24(%r12,%rbp,4),%xmm1
movups 0x34(%r12,%rbp,4),%xmm2
movups %xmm1,-0x10(%rdi,%rbp,4)
movups %xmm2,(%rdi,%rbp,4)
add    $0x10,%rbp
add    $0xfffffffffffffffe,%rax
jne    14e0 <read_scan_file_v2+0x370>
jmp    15de <read_scan_file_v2+0x46e>
mov    0x8(%rsp),%ebp
mov    0xc(%rsp),%ebx
test   $0x1,%cl
jne    16b3 <read_scan_file_v2+0x543>
lea    0x1(%r9),%r14
mov    0x10(%rsp),%rax
mov    %r13d,0x4(%rax,%r9,4)
mov    (%r15,%rdx,4),%eax
mov    0x18(%rsp),%rsi
mov    %eax,0x4(%rsi,%r9,4)
lea    0x1(%rdx),%rax
mov    %r14,%r9
jmp    16b6 <read_scan_file_v2+0x546>
mov    0x8(%rsp),%ebp
test   $0x1,%dl
je     12b3 <read_scan_file_v2+0x143>
mov    %rsi,%rax
mov    0xc(%rsp),%ebx
not    %rsi
add    %rdx,%rsi
je     1240 <read_scan_file_v2+0xd0>
mov    %ebp,%r8d
sub    %rax,%rdx
mov    0x50(%rsp),%rcx
lea    (%rcx,%rax,4),%rax
mov    0x40(%rsp),%rcx
lea    (%rcx,%r11,4),%rsi
mov    0x38(%rsp),%rcx
lea    (%rcx,%r11,4),%rbp
xor    %edi,%edi
nopl   (%rax)
mov    %r13d,-0x4(%rbp,%rdi,4)
mov    -0x4(%rax,%rdi,4),%ecx
mov    %ecx,-0x4(%rsi,%rdi,4)
mov    %r13d,0x0(%rbp,%rdi,4)
mov    (%rax,%rdi,4),%ecx
mov    %ecx,(%rsi,%rdi,4)
add    $0x2,%rdi
cmp    %rdi,%rdx
jne    15b0 <read_scan_file_v2+0x440>
add    %rdi,%r11
mov    %r11,%r14
jmp    1716 <read_scan_file_v2+0x5a6>
xor    %ebp,%ebp
test   $0x1,%r9b
mov    0x8(%rsp),%edi
je     1624 <read_scan_file_v2+0x4b4>
lea    0x0(,%rbp,4),%rax
add    %r11,%rbp
mov    0x10(%rsp),%rcx
movdqu %xmm0,0x4(%rcx,%rbp,4)
movdqu %xmm0,0x14(%rcx,%rbp,4)
or     $0x4,%rax
movdqu (%r12,%rax,1),%xmm0
movups 0x10(%r12,%rax,1),%xmm1
mov    0x18(%rsp),%rax
movdqu %xmm0,0x4(%rax,%rbp,4)
movups %xmm1,0x14(%rax,%rbp,4)
add    %rsi,%r11
cmp    %rsi,%r8
jne    163a <read_scan_file_v2+0x4ca>
mov    %r11,%r14
mov    0xc(%rsp),%ebx
mov    %edi,%ebp
jmp    1240 <read_scan_file_v2+0xd0>
or     $0x1,%rsi
mov    %edi,%ebp
test   $0x1,%dl
je     12b3 <read_scan_file_v2+0x143>
jmp    1577 <read_scan_file_v2+0x407>
xor    %ebp,%ebp
test   $0x1,%r8b
mov    0x8(%rsp),%r8d
je     1697 <read_scan_file_v2+0x527>
lea    0x0(,%rbp,4),%rax
add    %r9,%rbp
mov    0x10(%rsp),%rdi
movdqu %xmm0,0x4(%rdi,%rbp,4)
movdqu %xmm0,0x14(%rdi,%rbp,4)
or     $0x4,%rax
movdqu (%r15,%rax,1),%xmm0
movups 0x10(%r15,%rax,1),%xmm1
mov    0x18(%rsp),%rax
movdqu %xmm0,0x4(%rax,%rbp,4)
movups %xmm1,0x14(%rax,%rbp,4)
add    %rdx,%r9
cmp    %rdx,%rsi
mov    0xc(%rsp),%ebx
je     1713 <read_scan_file_v2+0x5a3>
or     $0x1,%rdx
mov    %r8d,%ebp
test   $0x1,%cl
je     1542 <read_scan_file_v2+0x3d2>
mov    %rdx,%rax
not    %rdx
add    %rcx,%rdx
je     1240 <read_scan_file_v2+0xd0>
mov    %ebp,%r8d
sub    %rax,%rcx
mov    0x48(%rsp),%rdx
lea    (%rdx,%rax,4),%rax
mov    0x40(%rsp),%rdx
lea    (%rdx,%r9,4),%rdx
mov    0x38(%rsp),%rsi
lea    (%rsi,%r9,4),%rdi
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13d,-0x4(%rdi,%rsi,4)
mov    -0x4(%rax,%rsi,4),%ebp
mov    %ebp,-0x4(%rdx,%rsi,4)
mov    %r13d,(%rdi,%rsi,4)
mov    (%rax,%rsi,4),%ebp
mov    %ebp,(%rdx,%rsi,4)
add    $0x2,%rsi
cmp    %rsi,%rcx
jne    16f0 <read_scan_file_v2+0x580>
add    %rsi,%r9
mov    %r9,%r14
mov    %r8d,%ebp
jmp    1240 <read_scan_file_v2+0xd0>
mov    0x8(%rsp),%ebp
test   $0x1,%dl
jne    1577 <read_scan_file_v2+0x407>
jmp    12b3 <read_scan_file_v2+0x143>
mov    0x68(%rsp),%rdi
call   1030 <fclose@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x2710,%edx
call   1060 <free_ivector@plt>
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0x2710,%edx
call   1060 <free_ivector@plt>
jmp    1772 <read_scan_file_v2+0x602>
lea    0x89b(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x88,%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_v2(i8* %0, i32* %1, i32* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32*
%15 = alloca [3 x i32]
%16 = alloca i32*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca float*
%24 = alloca i32*
%25 = alloca i32
store i8* %0, i8** %8
store i32* %1, i32** %9
store i32* %2, i32** %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 10000, i32* %17
store i32 0, i32* %20
store i32 1, i32* %22
%26 = load i8*, i8** %8
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %27, i32** %14
%28 = load i32*, i32** %14
%29 = icmp ne i32* %28, null
br i1 %29, label %34, label %30
30: ; preds = %6
%31 = load i8*, i8** %8
%32 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = load i32, i32* %20
store i32 %33, i32* %7
br label %130
34: ; preds = %6
%35 = load i32, i32* %17
%36 = call i32* @ivector(i32 1, i32 %35)
store i32* %36, i32** %16
%37 = load i32, i32* %17
%38 = call i32* @ivector(i32 1, i32 %37)
store i32* %38, i32** %24
br label %39
39: ; preds = %119, %34
%40 = load i32, i32* %22
%41 = icmp sge i32 %40, 1
br i1 %41, label %42, label %120
42: ; preds = %39
%43 = load i32*, i32** %14
%44 = getelementptr inbounds [3 x i32], [3 x i32]* %15, i64 0, i64 0
%45 = load i32*, i32** %16
%46 = load i32, i32* %17
%47 = load i32, i32* %11
%48 = load i32, i32* %12
%49 = call i32 @read_line(i32* %43, i32* %44, i32* %45, i32 %46, i32 %47, i32 %48)
%50 = getelementptr inbounds [3 x i32], [3 x i32]* %15, i64 0, i64 0
%51 = load i32, i32* %50
store i32 %51, i32* %18
%52 = getelementptr inbounds [3 x i32], [3 x i32]* %15, i64 0, i64 1
%53 = load i32, i32* %52
store i32 %53, i32* %19
%54 = getelementptr inbounds [3 x i32], [3 x i32]* %15, i64 0, i64 2
%55 = load i32, i32* %54
store i32 %55, i32* %22
%56 = load i32, i32* %19
%57 = icmp sgt i32 %56, 0
br i1 %57, label %58, label %119
58: ; preds = %42
%59 = load i32, i32* %13
%60 = icmp sgt i32 %59, 0
br i1 %60, label %61, label %92
61: ; preds = %58
%62 = load i32*, i32** %16
%63 = load i32, i32* %19
%64 = load i32, i32* %13
%65 = load i32*, i32** %24
%66 = call i32 @vector_overlap(i32* %62, i32 %63, i32 %64, i32* %65)
store i32 %66, i32* %25
store i32 1, i32* %21
br label %67
67: ; preds = %88, %61
%68 = load i32, i32* %21
%69 = load i32, i32* %25
%70 = icmp sle i32 %68, %69
br i1 %70, label %71, label %91
71: ; preds = %67
%72 = load i32, i32* %20
%73 = add nsw i32 %72, 1
store i32 %73, i32* %20
%74 = load i32, i32* %18
%75 = load i32*, i32** %9
%76 = load i32, i32* %20
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i32, i32* %75, i64 %77
store i32 %74, i32* %78
%79 = load i32*, i32** %24
%80 = load i32, i32* %21
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i32, i32* %79, i64 %81
%83 = load i32, i32* %82
%84 = load i32*, i32** %10
%85 = load i32, i32* %20
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i32, i32* %84, i64 %86
store i32 %83, i32* %87
br label %88
88: ; preds = %71
%89 = load i32, i32* %21
%90 = add nsw i32 %89, 1
store i32 %90, i32* %21
br label %67
91: ; preds = %67
br label %118
92: ; preds = %58
store i32 1, i32* %21
br label %93
93: ; preds = %114, %92
%94 = load i32, i32* %21
%95 = load i32, i32* %19
%96 = icmp sle i32 %94, %95
br i1 %96, label %97, label %117
97: ; preds = %93
%98 = load i32, i32* %20
%99 = add nsw i32 %98, 1
store i32 %99, i32* %20
%100 = load i32, i32* %18
%101 = load i32*, i32** %9
%102 = load i32, i32* %20
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i32, i32* %101, i64 %103
store i32 %100, i32* %104
%105 = load i32*, i32** %16
%106 = load i32, i32* %21
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i32, i32* %105, i64 %107
%109 = load i32, i32* %108
%110 = load i32*, i32** %10
%111 = load i32, i32* %20
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i32, i32* %110, i64 %112
store i32 %109, i32* %113
br label %114
114: ; preds = %97
%115 = load i32, i32* %21
%116 = add nsw i32 %115, 1
store i32 %116, i32* %21
br label %93
117: ; preds = %93
br label %118
118: ; preds = %117, %91
br label %119
119: ; preds = %118, %42
br label %39
120: ; preds = %39
%121 = load i32*, i32** %14
%122 = call i32 @fclose(i32* %121)
%123 = load i32*, i32** %16
%124 = load i32, i32* %17
%125 = call i32 @free_ivector(i32* %123, i32 1, i32 %124)
%126 = load i32*, i32** %24
%127 = load i32, i32* %17
%128 = call i32 @free_ivector(i32* %126, i32 1, i32 %127)
%129 = load i32, i32* %20
store i32 %129, i32* %7
br label %130
130: ; preds = %120, %30
%131 = load i32, i32* %7
ret i32 %131
}

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_v2(i8* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca [3 x i32]
%8 = bitcast [3 x i32]* %7 to i8*
%9 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %326
13: ; preds = %6
%14 = tail call i32* @ivector(i32 1, i32 10000)
%15 = tail call i32* @ivector(i32 1, i32 10000)
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 1
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 2
%19 = icmp sgt i32 %5, 0
%20 = getelementptr i32, i32* %1, i64 1
%21 = getelementptr i32, i32* %2, i64 1
%22 = getelementptr i32, i32* %15, i64 1
%23 = getelementptr i32, i32* %1, i64 1
%24 = getelementptr i32, i32* %2, i64 1
%25 = getelementptr i32, i32* %14, i64 1
br label %26
26: ; preds = %13, %319
%27 = phi i32 [ 0, %13 ], [ %320, %319 ]
%28 = call i32 @read_line(i32* %9, i32* %16, i32* %14, i32 10000, i32 %3, i32 %4)
%29 = load i32, i32* %16
%30 = load i32, i32* %17
%31 = load i32, i32* %18
%32 = icmp sgt i32 %30, 0
br i1 %32, label %33, label %319
33: ; preds = %26
br i1 %19, label %156, label %34
34: ; preds = %33
%35 = sext i32 %27 to i64
%36 = add nuw i32 %30, 1
%37 = zext i32 %36 to i64
%38 = add nsw i64 %37, -1
%39 = icmp ult i64 %38, 8
br i1 %39, label %137, label %40
40: ; preds = %34
%41 = getelementptr i32, i32* %23, i64 %35
%42 = add nsw i64 %35, %37
%43 = getelementptr i32, i32* %1, i64 %42
%44 = getelementptr i32, i32* %24, i64 %35
%45 = getelementptr i32, i32* %2, i64 %42
%46 = getelementptr i32, i32* %14, i64 %37
%47 = icmp ult i32* %41, %45
%48 = icmp ult i32* %44, %43
%49 = and i1 %47, %48
%50 = icmp ult i32* %41, %46
%51 = icmp ult i32* %25, %43
%52 = and i1 %50, %51
%53 = or i1 %49, %52
%54 = icmp ult i32* %44, %46
%55 = icmp ult i32* %25, %45
%56 = and i1 %54, %55
%57 = or i1 %53, %56
br i1 %57, label %137, label %58
58: ; preds = %40
%59 = and i64 %38, -8
%60 = or i64 %59, 1
%61 = add nsw i64 %59, %35
%62 = insertelement <4 x i32> poison, i32 %29, i64 0
%63 = shufflevector <4 x i32> %62, <4 x i32> poison, <4 x i32> zeroinitializer
%64 = insertelement <4 x i32> poison, i32 %29, i64 0
%65 = shufflevector <4 x i32> %64, <4 x i32> poison, <4 x i32> zeroinitializer
%66 = add nsw i64 %59, -8
%67 = lshr exact i64 %66, 3
%68 = add nuw nsw i64 %67, 1
%69 = and i64 %68, 1
%70 = icmp eq i64 %66, 0
br i1 %70, label %114, label %71
71: ; preds = %58
%72 = and i64 %68, 4611686018427387902
br label %73
73: ; preds = %73, %71
%74 = phi i64 [ 0, %71 ], [ %111, %73 ]
%75 = phi i64 [ 0, %71 ], [ %112, %73 ]
%76 = or i64 %74, 1
%77 = add i64 %74, %35
%78 = add nsw i64 %77, 1
%79 = getelementptr inbounds i32, i32* %1, i64 %78
%80 = bitcast i32* %79 to <4 x i32>*
store <4 x i32> %63, <4 x i32>* %80
%81 = getelementptr inbounds i32, i32* %79, i64 4
%82 = bitcast i32* %81 to <4 x i32>*
store <4 x i32> %65, <4 x i32>* %82
%83 = getelementptr inbounds i32, i32* %14, i64 %76
%84 = bitcast i32* %83 to <4 x i32>*
%85 = load <4 x i32>, <4 x i32>* %84
%86 = getelementptr inbounds i32, i32* %83, i64 4
%87 = bitcast i32* %86 to <4 x i32>*
%88 = load <4 x i32>, <4 x i32>* %87
%89 = getelementptr inbounds i32, i32* %2, i64 %78
%90 = bitcast i32* %89 to <4 x i32>*
store <4 x i32> %85, <4 x i32>* %90
%91 = getelementptr inbounds i32, i32* %89, i64 4
%92 = bitcast i32* %91 to <4 x i32>*
store <4 x i32> %88, <4 x i32>* %92
%93 = or i64 %74, 8
%94 = or i64 %74, 9
%95 = add i64 %93, %35
%96 = add nsw i64 %95, 1
%97 = getelementptr inbounds i32, i32* %1, i64 %96
%98 = bitcast i32* %97 to <4 x i32>*
store <4 x i32> %63, <4 x i32>* %98
%99 = getelementptr inbounds i32, i32* %97, i64 4
%100 = bitcast i32* %99 to <4 x i32>*
store <4 x i32> %65, <4 x i32>* %100
%101 = getelementptr inbounds i32, i32* %14, i64 %94
%102 = bitcast i32* %101 to <4 x i32>*
%103 = load <4 x i32>, <4 x i32>* %102
%104 = getelementptr inbounds i32, i32* %101, i64 4
%105 = bitcast i32* %104 to <4 x i32>*
%106 = load <4 x i32>, <4 x i32>* %105
%107 = getelementptr inbounds i32, i32* %2, i64 %96
%108 = bitcast i32* %107 to <4 x i32>*
store <4 x i32> %103, <4 x i32>* %108
%109 = getelementptr inbounds i32, i32* %107, i64 4
%110 = bitcast i32* %109 to <4 x i32>*
store <4 x i32> %106, <4 x i32>* %110
%111 = add nuw i64 %74, 16
%112 = add i64 %75, 2
%113 = icmp eq i64 %112, %72
br i1 %113, label %114, label %73
114: ; preds = %73, %58
%115 = phi i64 [ 0, %58 ], [ %111, %73 ]
%116 = icmp eq i64 %69, 0
br i1 %116, label %135, label %117
117: ; preds = %114
%118 = or i64 %115, 1
%119 = add i64 %115, %35
%120 = add nsw i64 %119, 1
%121 = getelementptr inbounds i32, i32* %1, i64 %120
%122 = bitcast i32* %121 to <4 x i32>*
store <4 x i32> %63, <4 x i32>* %122
%123 = getelementptr inbounds i32, i32* %121, i64 4
%124 = bitcast i32* %123 to <4 x i32>*
store <4 x i32> %65, <4 x i32>* %124
%125 = getelementptr inbounds i32, i32* %14, i64 %118
%126 = bitcast i32* %125 to <4 x i32>*
%127 = load <4 x i32>, <4 x i32>* %126
%128 = getelementptr inbounds i32, i32* %125, i64 4
%129 = bitcast i32* %128 to <4 x i32>*
%130 = load <4 x i32>, <4 x i32>* %129
%131 = getelementptr inbounds i32, i32* %2, i64 %120
%132 = bitcast i32* %131 to <4 x i32>*
store <4 x i32> %127, <4 x i32>* %132
%133 = getelementptr inbounds i32, i32* %131, i64 4
%134 = bitcast i32* %133 to <4 x i32>*
store <4 x i32> %130, <4 x i32>* %134
br label %135
135: ; preds = %114, %117
%136 = icmp eq i64 %38, %59
br i1 %136, label %316, label %137
137: ; preds = %40, %34, %135
%138 = phi i64 [ 1, %40 ], [ 1, %34 ], [ %60, %135 ]
%139 = phi i64 [ %35, %40 ], [ %35, %34 ], [ %61, %135 ]
%140 = xor i64 %138, -1
%141 = and i64 %37, 1
%142 = icmp eq i64 %141, 0
br i1 %142, label %143, label %150
143: ; preds = %137
%144 = add nsw i64 %139, 1
%145 = getelementptr inbounds i32, i32* %1, i64 %144
store i32 %29, i32* %145
%146 = getelementptr inbounds i32, i32* %14, i64 %138
%147 = load i32, i32* %146
%148 = getelementptr inbounds i32, i32* %2, i64 %144
store i32 %147, i32* %148
%149 = add nuw nsw i64 %138, 1
br label %150
150: ; preds = %143, %137
%151 = phi i64 [ undef, %137 ], [ %144, %143 ]
%152 = phi i64 [ %138, %137 ], [ %149, %143 ]
%153 = phi i64 [ %139, %137 ], [ %144, %143 ]
%154 = sub nsw i64 0, %37
%155 = icmp eq i64 %140, %154
br i1 %155, label %316, label %297
156: ; preds = %33
%157 = call i32 @vector_overlap(i32* %14, i32 %30, i32 %5, i32* %15)
%158 = icmp slt i32 %157, 1
br i1 %158, label %319, label %159
159: ; preds = %156
%160 = sext i32 %27 to i64
%161 = add nuw i32 %157, 1
%162 = zext i32 %161 to i64
%163 = add nsw i64 %162, -1
%164 = icmp ult i64 %163, 8
br i1 %164, label %262, label %165
165: ; preds = %159
%166 = getelementptr i32, i32* %20, i64 %160
%167 = add nsw i64 %160, %162
%168 = getelementptr i32, i32* %1, i64 %167
%169 = getelementptr i32, i32* %21, i64 %160
%170 = getelementptr i32, i32* %2, i64 %167
%171 = getelementptr i32, i32* %15, i64 %162
%172 = icmp ult i32* %166, %170
%173 = icmp ult i32* %169, %168
%174 = and i1 %172, %173
%175 = icmp ult i32* %166, %171
%176 = icmp ult i32* %22, %168
%177 = and i1 %175, %176
%178 = or i1 %174, %177
%179 = icmp ult i32* %169, %171
%180 = icmp ult i32* %22, %170
%181 = and i1 %179, %180
%182 = or i1 %178, %181
br i1 %182, label %262, label %183
183: ; preds = %165
%184 = and i64 %163, -8
%185 = or i64 %184, 1
%186 = add nsw i64 %184, %160
%187 = insertelement <4 x i32> poison, i32 %29, i64 0
%188 = shufflevector <4 x i32> %187, <4 x i32> poison, <4 x i32> zeroinitializer
%189 = insertelement <4 x i32> poison, i32 %29, i64 0
%190 = shufflevector <4 x i32> %189, <4 x i32> poison, <4 x i32> zeroinitializer
%191 = add nsw i64 %184, -8
%192 = lshr exact i64 %191, 3
%193 = add nuw nsw i64 %192, 1
%194 = and i64 %193, 1
%195 = icmp eq i64 %191, 0
br i1 %195, label %239, label %196
196: ; preds = %183
%197 = and i64 %193, 4611686018427387902
br label %198
198: ; preds = %198, %196
%199 = phi i64 [ 0, %196 ], [ %236, %198 ]
%200 = phi i64 [ 0, %196 ], [ %237, %198 ]
%201 = or i64 %199, 1
%202 = add i64 %199, %160
%203 = add nsw i64 %202, 1
%204 = getelementptr inbounds i32, i32* %1, i64 %203
%205 = bitcast i32* %204 to <4 x i32>*
store <4 x i32> %188, <4 x i32>* %205
%206 = getelementptr inbounds i32, i32* %204, i64 4
%207 = bitcast i32* %206 to <4 x i32>*
store <4 x i32> %190, <4 x i32>* %207
%208 = getelementptr inbounds i32, i32* %15, i64 %201
%209 = bitcast i32* %208 to <4 x i32>*
%210 = load <4 x i32>, <4 x i32>* %209
%211 = getelementptr inbounds i32, i32* %208, i64 4
%212 = bitcast i32* %211 to <4 x i32>*
%213 = load <4 x i32>, <4 x i32>* %212
%214 = getelementptr inbounds i32, i32* %2, i64 %203
%215 = bitcast i32* %214 to <4 x i32>*
store <4 x i32> %210, <4 x i32>* %215
%216 = getelementptr inbounds i32, i32* %214, i64 4
%217 = bitcast i32* %216 to <4 x i32>*
store <4 x i32> %213, <4 x i32>* %217
%218 = or i64 %199, 8
%219 = or i64 %199, 9
%220 = add i64 %218, %160
%221 = add nsw i64 %220, 1
%222 = getelementptr inbounds i32, i32* %1, i64 %221
%223 = bitcast i32* %222 to <4 x i32>*
store <4 x i32> %188, <4 x i32>* %223
%224 = getelementptr inbounds i32, i32* %222, i64 4
%225 = bitcast i32* %224 to <4 x i32>*
store <4 x i32> %190, <4 x i32>* %225
%226 = getelementptr inbounds i32, i32* %15, i64 %219
%227 = bitcast i32* %226 to <4 x i32>*
%228 = load <4 x i32>, <4 x i32>* %227
%229 = getelementptr inbounds i32, i32* %226, i64 4
%230 = bitcast i32* %229 to <4 x i32>*
%231 = load <4 x i32>, <4 x i32>* %230
%232 = getelementptr inbounds i32, i32* %2, i64 %221
%233 = bitcast i32* %232 to <4 x i32>*
store <4 x i32> %228, <4 x i32>* %233
%234 = getelementptr inbounds i32, i32* %232, i64 4
%235 = bitcast i32* %234 to <4 x i32>*
store <4 x i32> %231, <4 x i32>* %235
%236 = add nuw i64 %199, 16
%237 = add i64 %200, 2
%238 = icmp eq i64 %237, %197
br i1 %238, label %239, label %198
239: ; preds = %198, %183
%240 = phi i64 [ 0, %183 ], [ %236, %198 ]
%241 = icmp eq i64 %194, 0
br i1 %241, label %260, label %242
242: ; preds = %239
%243 = or i64 %240, 1
%244 = add i64 %240, %160
%245 = add nsw i64 %244, 1
%246 = getelementptr inbounds i32, i32* %1, i64 %245
%247 = bitcast i32* %246 to <4 x i32>*
store <4 x i32> %188, <4 x i32>* %247
%248 = getelementptr inbounds i32, i32* %246, i64 4
%249 = bitcast i32* %248 to <4 x i32>*
store <4 x i32> %190, <4 x i32>* %249
%250 = getelementptr inbounds i32, i32* %15, i64 %243
%251 = bitcast i32* %250 to <4 x i32>*
%252 = load <4 x i32>, <4 x i32>* %251
%253 = getelementptr inbounds i32, i32* %250, i64 4
%254 = bitcast i32* %253 to <4 x i32>*
%255 = load <4 x i32>, <4 x i32>* %254
%256 = getelementptr inbounds i32, i32* %2, i64 %245
%257 = bitcast i32* %256 to <4 x i32>*
store <4 x i32> %252, <4 x i32>* %257
%258 = getelementptr inbounds i32, i32* %256, i64 4
%259 = bitcast i32* %258 to <4 x i32>*
store <4 x i32> %255, <4 x i32>* %259
br label %260
260: ; preds = %239, %242
%261 = icmp eq i64 %163, %184
br i1 %261, label %313, label %262
262: ; preds = %165, %159, %260
%263 = phi i64 [ 1, %165 ], [ 1, %159 ], [ %185, %260 ]
%264 = phi i64 [ %160, %165 ], [ %160, %159 ], [ %186, %260 ]
%265 = xor i64 %263, -1
%266 = and i64 %162, 1
%267 = icmp eq i64 %266, 0
br i1 %267, label %268, label %275
268: ; preds = %262
%269 = add nsw i64 %264, 1
%270 = getelementptr inbounds i32, i32* %1, i64 %269
store i32 %29, i32* %270
%271 = getelementptr inbounds i32, i32* %15, i64 %263
%272 = load i32, i32* %271
%273 = getelementptr inbounds i32, i32* %2, i64 %269
store i32 %272, i32* %273
%274 = add nuw nsw i64 %263, 1
br label %275
275: ; preds = %268, %262
%276 = phi i64 [ undef, %262 ], [ %269, %268 ]
%277 = phi i64 [ %263, %262 ], [ %274, %268 ]
%278 = phi i64 [ %264, %262 ], [ %269, %268 ]
%279 = sub nsw i64 0, %162
%280 = icmp eq i64 %265, %279
br i1 %280, label %313, label %281
281: ; preds = %275, %281
%282 = phi i64 [ %295, %281 ], [ %277, %275 ]
%283 = phi i64 [ %290, %281 ], [ %278, %275 ]
%284 = add nsw i64 %283, 1
%285 = getelementptr inbounds i32, i32* %1, i64 %284
store i32 %29, i32* %285
%286 = getelementptr inbounds i32, i32* %15, i64 %282
%287 = load i32, i32* %286
%288 = getelementptr inbounds i32, i32* %2, i64 %284
store i32 %287, i32* %288
%289 = add nuw nsw i64 %282, 1
%290 = add nsw i64 %283, 2
%291 = getelementptr inbounds i32, i32* %1, i64 %290
store i32 %29, i32* %291
%292 = getelementptr inbounds i32, i32* %15, i64 %289
%293 = load i32, i32* %292
%294 = getelementptr inbounds i32, i32* %2, i64 %290
store i32 %293, i32* %294
%295 = add nuw nsw i64 %282, 2
%296 = icmp eq i64 %295, %162
br i1 %296, label %313, label %281
297: ; preds = %150, %297
%298 = phi i64 [ %311, %297 ], [ %152, %150 ]
%299 = phi i64 [ %306, %297 ], [ %153, %150 ]
%300 = add nsw i64 %299, 1
%301 = getelementptr inbounds i32, i32* %1, i64 %300
store i32 %29, i32* %301
%302 = getelementptr inbounds i32, i32* %14, i64 %298
%303 = load i32, i32* %302
%304 = getelementptr inbounds i32, i32* %2, i64 %300
store i32 %303, i32* %304
%305 = add nuw nsw i64 %298, 1
%306 = add nsw i64 %299, 2
%307 = getelementptr inbounds i32, i32* %1, i64 %306
store i32 %29, i32* %307
%308 = getelementptr inbounds i32, i32* %14, i64 %305
%309 = load i32, i32* %308
%310 = getelementptr inbounds i32, i32* %2, i64 %306
store i32 %309, i32* %310
%311 = add nuw nsw i64 %298, 2
%312 = icmp eq i64 %311, %37
br i1 %312, label %316, label %297
313: ; preds = %275, %281, %260
%314 = phi i64 [ %186, %260 ], [ %276, %275 ], [ %290, %281 ]
%315 = trunc i64 %314 to i32
br label %319
316: ; preds = %150, %297, %135
%317 = phi i64 [ %61, %135 ], [ %151, %150 ], [ %306, %297 ]
%318 = trunc i64 %317 to i32
br label %319
319: ; preds = %316, %313, %156, %26
%320 = phi i32 [ %27, %26 ], [ %27, %156 ], [ %315, %313 ], [ %318, %316 ]
%321 = icmp sgt i32 %31, 0
br i1 %321, label %26, label %322
322: ; preds = %319
%323 = call i32 @fclose(i32* %9)
%324 = call i32 @free_ivector(i32* %14, i32 1, i32 10000)
%325 = call i32 @free_ivector(i32* %15, i32 1, i32 10000)
br label %326
326: ; preds = %322, %11
%327 = phi i32 [ %320, %322 ], [ 0, %11 ]
ret i32 %327
}