#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 EOF;
int /*<<< orphan*/ *fopen(char *, char *);
int fscanf(int /*<<< orphan*/ *, char *, char *, char *, char *, double *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *);
int strcmp(char *, char *);
int system(char *);
void insnp(char *filename, char *tmpdir, int *nchip, char **chip_id, int *nsnps,
           char **snp_id, char *codes[3], double *threshold, char *gtypes,
           int counts[2], int *iferror) {
  char sort_command[160];
  int i = 0, j = 0;
  sprintf(sort_command, "sort  -k 2,2 -k 1,1 -T \"%s\" -o \"%s\" \"%s\"",
          tmpdir, filename, filename);
  int error = system(sort_command);
  if (error)
    goto sort_error;
  FILE *infile = fopen(filename, "r");
  if (!infile)
    goto open_error;
  int not_called = 0;
  int called = 0;
  char *code_aa = codes[0];
  char *code_ab = codes[1];
  char *code_bb = codes[2];
  char chip_in[128], snp_in[128], gt_in[16];
  double thr_in;
  if (fscanf(infile, " %s %s %s %lf", chip_in, snp_in, gt_in, &thr_in) != 4)
    goto read_error;
  int ij = 0;
  for (j = 0; j < (*nsnps); j++) {
    char *snp_target = snp_id[j];
    int jcmp;
    while ((jcmp = strcmp(snp_in, snp_target)) < 0) {
      int scanned =
          fscanf(infile, " %s %s %s %lf", chip_in, snp_in, gt_in, &thr_in);
      if (scanned == EOF)
        goto normal;
      else if (scanned != 4)
        goto read_error;
    }
    for (i = 0; i < (*nchip); i++, ij++) {
      char *chip_target = chip_id[i];
      int icmp;
      if (!jcmp) {
        while ((icmp = strcmp(chip_in, chip_target)) < 0) {
          int scanned =
              fscanf(infile, " %s %s %s %lf", chip_in, snp_in, gt_in, &thr_in);
          if (scanned == EOF)
            goto normal;
          else if (scanned != 4)
            goto read_error;
        }
        if (!icmp) {
          if (!strcmp(code_aa, gt_in)) {
            gtypes[ij] = (char)1;
            called++;
          } else if (!strcmp(code_ab, gt_in)) {
            gtypes[ij] = (char)2;
            called++;
          } else if (!strcmp(code_bb, gt_in)) {
            gtypes[ij] = (char)3;
            called++;
          } else {
            gtypes[ij] = (char)0;
            not_called++;
          }
        }
      } else {
        gtypes[ij] = (char)0;
      }
    }
  }
normal : {
  int full = (*nsnps) * (*nchip);
  while (ij < full)
    gtypes[ij++] = (char)0;
  counts[0] = called;
  counts[1] = not_called;
  *iferror = 0;
  return;
}
sort_error:
  *iferror = 1;
  return;
open_error:
  *iferror = 2;
  return;
read_error:
  *iferror = 3;
  return;
}


x86 assembly (clang, -O0):
<insnp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0xd4(%rbp)
movl   $0x0,-0xd8(%rbp)
lea    -0xd0(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x8(%rbp),%r8
lea    0xe4b(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0xd0(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0xdc(%rbp)
cmpl   $0x0,-0xdc(%rbp)
je     11de <insnp+0x8e>
jmp    15de <insnp+0x48e>
mov    -0x8(%rbp),%rdi
lea    0xe40(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0xe8(%rbp)
cmpq   $0x0,-0xe8(%rbp)
jne    1208 <insnp+0xb8>
jmp    15ed <insnp+0x49d>
movl   $0x0,-0xec(%rbp)
movl   $0x0,-0xf0(%rbp)
mov    0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xf8(%rbp)
mov    0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x100(%rbp)
mov    0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x108(%rbp)
mov    -0xe8(%rbp),%rdi
lea    -0x190(%rbp),%rdx
lea    -0x210(%rbp),%rcx
lea    -0x220(%rbp),%r8
lea    0xdc0(%rip),%rsi
lea    -0x228(%rbp),%r9
call   1040 <fscanf@plt>
cmp    $0x4,%eax
je     1285 <insnp+0x135>
jmp    15fc <insnp+0x4ac>
movl   $0x0,-0x22c(%rbp)
movl   $0x0,-0xd8(%rbp)
mov    -0xd8(%rbp),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jge    156b <insnp+0x41b>
mov    -0x30(%rbp),%rax
movslq -0xd8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x238(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x238(%rbp),%rsi
call   1050 <strcmp@plt>
mov    %eax,-0x23c(%rbp)
cmp    $0x0,%eax
jge    134e <insnp+0x1fe>
mov    -0xe8(%rbp),%rdi
lea    -0x190(%rbp),%rdx
lea    -0x210(%rbp),%rcx
lea    -0x220(%rbp),%r8
lea    0xd25(%rip),%rsi
lea    -0x228(%rbp),%r9
call   1040 <fscanf@plt>
mov    %eax,-0x240(%rbp)
mov    -0x240(%rbp),%eax
mov    0x2cc3(%rip),%rcx
cmp    (%rcx),%eax
jne    1332 <insnp+0x1e2>
jmp    1570 <insnp+0x420>
cmpl   $0x4,-0x240(%rbp)
je     1344 <insnp+0x1f4>
jmp    15fc <insnp+0x4ac>
jmp    1349 <insnp+0x1f9>
jmp    12c1 <insnp+0x171>
movl   $0x0,-0xd4(%rbp)
mov    -0xd4(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    1552 <insnp+0x402>
mov    -0x20(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x248(%rbp)
cmpl   $0x0,-0x23c(%rbp)
jne    151b <insnp+0x3cb>
jmp    1392 <insnp+0x242>
lea    -0x190(%rbp),%rdi
mov    -0x248(%rbp),%rsi
call   1050 <strcmp@plt>
mov    %eax,-0x24c(%rbp)
cmp    $0x0,%eax
jge    141f <insnp+0x2cf>
mov    -0xe8(%rbp),%rdi
lea    -0x190(%rbp),%rdx
lea    -0x210(%rbp),%rcx
lea    -0x220(%rbp),%r8
lea    0xc54(%rip),%rsi
lea    -0x228(%rbp),%r9
call   1040 <fscanf@plt>
mov    %eax,-0x250(%rbp)
mov    -0x250(%rbp),%eax
mov    0x2bf2(%rip),%rcx
cmp    (%rcx),%eax
jne    1403 <insnp+0x2b3>
jmp    1570 <insnp+0x420>
cmpl   $0x4,-0x250(%rbp)
je     1415 <insnp+0x2c5>
jmp    15fc <insnp+0x4ac>
jmp    141a <insnp+0x2ca>
jmp    1392 <insnp+0x242>
cmpl   $0x0,-0x24c(%rbp)
jne    1516 <insnp+0x3c6>
mov    -0xf8(%rbp),%rdi
lea    -0x220(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    146b <insnp+0x31b>
mov    0x20(%rbp),%rax
movslq -0x22c(%rbp),%rcx
movb   $0x1,(%rax,%rcx,1)
mov    -0xf0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf0(%rbp)
jmp    1511 <insnp+0x3c1>
mov    -0x100(%rbp),%rdi
lea    -0x220(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    14aa <insnp+0x35a>
mov    0x20(%rbp),%rax
movslq -0x22c(%rbp),%rcx
movb   $0x2,(%rax,%rcx,1)
mov    -0xf0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf0(%rbp)
jmp    150c <insnp+0x3bc>
mov    -0x108(%rbp),%rdi
lea    -0x220(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    14e9 <insnp+0x399>
mov    0x20(%rbp),%rax
movslq -0x22c(%rbp),%rcx
movb   $0x3,(%rax,%rcx,1)
mov    -0xf0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf0(%rbp)
jmp    1507 <insnp+0x3b7>
mov    0x20(%rbp),%rax
movslq -0x22c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xec(%rbp)
jmp    150c <insnp+0x3bc>
jmp    1511 <insnp+0x3c1>
jmp    1516 <insnp+0x3c6>
jmp    152a <insnp+0x3da>
mov    0x20(%rbp),%rax
movslq -0x22c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    152f <insnp+0x3df>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
mov    -0x22c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x22c(%rbp)
jmp    1358 <insnp+0x208>
jmp    1557 <insnp+0x407>
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    1299 <insnp+0x149>
jmp    1570 <insnp+0x420>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
imul   (%rcx),%eax
mov    %eax,-0x254(%rbp)
mov    -0x22c(%rbp),%eax
cmp    -0x254(%rbp),%eax
jge    15b6 <insnp+0x466>
mov    0x20(%rbp),%rax
mov    -0x22c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x22c(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1583 <insnp+0x433>
mov    -0xf0(%rbp),%ecx
mov    0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xec(%rbp),%ecx
mov    0x28(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    0x30(%rbp),%rax
movl   $0x0,(%rax)
jmp    1606 <insnp+0x4b6>
mov    0x30(%rbp),%rax
movl   $0x1,(%rax)
jmp    1606 <insnp+0x4b6>
mov    0x30(%rbp),%rax
movl   $0x2,(%rax)
jmp    1606 <insnp+0x4b6>
mov    0x30(%rbp),%rax
movl   $0x3,(%rax)
add    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insnp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
mov    %r9,0x38(%rsp)
mov    %r8,%r14
mov    %rcx,%r13
mov    %rdx,%r12
mov    %rsi,%rdx
mov    %rdi,%rbx
mov    0x280(%rsp),%r15
lea    0xe6c(%rip),%rsi
lea    0x180(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rcx
mov    %rbx,%r8
call   1080 <sprintf@plt>
mov    %rbp,%rdi
call   1030 <system@plt>
mov    $0x1,%ecx
test   %eax,%eax
jne    14df <insnp+0x37f>
mov    %r13,0x20(%rsp)
lea    0xe5e(%rip),%rsi
mov    %rbx,%rdi
call   1070 <fopen@plt>
test   %rax,%rax
je     146c <insnp+0x30c>
mov    %rax,%rbp
mov    0x260(%rsp),%rax
mov    (%rax),%r13
mov    0x8(%rax),%r15
mov    0x10(%rax),%rbx
lea    0xe32(%rip),%rsi
lea    0x100(%rsp),%rdx
lea    0x80(%rsp),%rcx
lea    0x70(%rsp),%r8
lea    0x48(%rsp),%r9
mov    %rbp,%rdi
call   1050 <fscanf@plt>
mov    $0x3,%ecx
cmp    $0x4,%eax
jne    14d7 <insnp+0x377>
mov    %rbx,0x68(%rsp)
mov    %r12,0x28(%rsp)
mov    0x270(%rsp),%rdi
mov    %r14,0x30(%rsp)
cmpl   $0x0,(%r14)
jle    1473 <insnp+0x313>
mov    %rbp,0x40(%rsp)
mov    %r15,0x50(%rsp)
mov    %r13,0x58(%rsp)
xor    %ecx,%ecx
lea    0x80(%rsp),%rbx
lea    0x100(%rsp),%r13
lea    0x70(%rsp),%r14
movl   $0x0,0x1c(%rsp)
movl   $0x0,0xc(%rsp)
xor    %r15d,%r15d
mov    0x38(%rsp),%rax
mov    %r15,0x10(%rsp)
mov    %rcx,0x60(%rsp)
mov    (%rax,%rcx,8),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
jns    12e7 <insnp+0x187>
mov    0x40(%rsp),%rdi
lea    0xd70(%rip),%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %r14,%r8
lea    0x48(%rsp),%r9
call   1050 <fscanf@plt>
mov    0x2d13(%rip),%rcx
cmp    (%rcx),%eax
je     1488 <insnp+0x328>
cmp    $0x4,%eax
je     12a0 <insnp+0x140>
jmp    14f4 <insnp+0x394>
mov    %eax,%r12d
mov    0x28(%rsp),%rax
cmpl   $0x0,(%rax)
jle    1436 <insnp+0x2d6>
mov    0x10(%rsp),%r15
movslq %r15d,%r15
xor    %ebx,%ebx
mov    0x20(%rsp),%rcx
mov    0x270(%rsp),%rdi
test   %r12d,%r12d
je     1333 <insnp+0x1d3>
movb   $0x0,(%rdi,%r15,1)
add    $0x1,%rbx
add    $0x1,%r15
mov    0x28(%rsp),%rax
movslq (%rax),%rax
cmp    %rax,%rbx
jl     130f <insnp+0x1af>
jmp    1443 <insnp+0x2e3>
mov    %r15,0x10(%rsp)
mov    (%rcx,%rbx,8),%r15
nopl   0x0(%rax)
mov    %r13,%rbp
mov    %r13,%rdi
mov    %r15,%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
jns    138f <insnp+0x22f>
mov    0x40(%rsp),%rdi
lea    0xccd(%rip),%rsi
mov    %rbp,%rdx
lea    0x80(%rsp),%rcx
mov    %r14,%r8
lea    0x48(%rsp),%r9
call   1050 <fscanf@plt>
mov    0x2c6b(%rip),%rcx
cmp    (%rcx),%eax
je     1488 <insnp+0x328>
cmp    $0x4,%eax
je     1340 <insnp+0x1e0>
jmp    14f4 <insnp+0x394>
je     13a8 <insnp+0x248>
mov    0x20(%rsp),%rcx
mov    0x270(%rsp),%rdi
mov    0x10(%rsp),%r15
jmp    1319 <insnp+0x1b9>
mov    0x58(%rsp),%rdi
mov    %r14,%rbp
mov    %r14,%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
mov    0x270(%rsp),%rdi
je     1407 <insnp+0x2a7>
mov    0x50(%rsp),%rdi
mov    %rbp,%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
mov    0x10(%rsp),%r15
je     1413 <insnp+0x2b3>
mov    0x68(%rsp),%rdi
mov    %rbp,%rsi
call   1060 <strcmp@plt>
mov    0x270(%rsp),%rdi
test   %eax,%eax
je     1422 <insnp+0x2c2>
movb   $0x0,(%rdi,%r15,1)
addl   $0x1,0x1c(%rsp)
mov    0x20(%rsp),%rcx
jmp    1319 <insnp+0x1b9>
mov    0x10(%rsp),%r15
movb   $0x1,(%rdi,%r15,1)
jmp    1427 <insnp+0x2c7>
mov    0x270(%rsp),%rdi
movb   $0x2,(%rdi,%r15,1)
jmp    1427 <insnp+0x2c7>
movb   $0x3,(%rdi,%r15,1)
addl   $0x1,0xc(%rsp)
mov    0x20(%rsp),%rcx
jmp    1319 <insnp+0x1b9>
mov    0x270(%rsp),%rdi
mov    0x10(%rsp),%r15
mov    0x60(%rsp),%rcx
add    $0x1,%rcx
mov    0x30(%rsp),%rax
movslq (%rax),%rax
cmp    %rax,%rcx
mov    0x38(%rsp),%rax
lea    0x80(%rsp),%rbx
jl     1288 <insnp+0x128>
jmp    1495 <insnp+0x335>
mov    $0x2,%ecx
jmp    14d7 <insnp+0x377>
xor    %r15d,%r15d
movl   $0x0,0xc(%rsp)
movl   $0x0,0x1c(%rsp)
jmp    1495 <insnp+0x335>
mov    0x270(%rsp),%rdi
mov    0x10(%rsp),%r15
mov    0x278(%rsp),%rbx
mov    0x28(%rsp),%rax
mov    (%rax),%edx
mov    0x30(%rsp),%rax
imul   (%rax),%edx
cmp    %edx,%r15d
jge    14c8 <insnp+0x368>
movslq %r15d,%rax
add    %rax,%rdi
not    %r15d
add    %r15d,%edx
add    $0x1,%rdx
xor    %esi,%esi
call   1040 <memset@plt>
mov    0xc(%rsp),%eax
mov    %eax,(%rbx)
mov    0x1c(%rsp),%eax
mov    %eax,0x4(%rbx)
xor    %ecx,%ecx
mov    0x280(%rsp),%r15
mov    %ecx,(%r15)
add    $0x228,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x280(%rsp),%r15
mov    $0x3,%ecx
jmp    14df <insnp+0x37f>

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

LLVM IR (-O2):
@.str = [41 x i8] c"sort -k 2,2 -k 1,1 -T \22%s\22 -o \22%s\22 \22%s\22\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [14 x i8] c" %s %s %s %lf\00"
@EOF = global i32 0
define void @insnp(i8* %0, i8* %1, i32* nocapture %2, i8** nocapture %3, i32* nocapture %4, i8** nocapture %5, i8** nocapture %6, double* nocapture readnone %7, i8* nocapture writeonly %8, i32* nocapture writeonly %9, i32* nocapture writeonly %10) {
%12 = alloca [160 x i8]
%13 = alloca [128 x i8]
%14 = alloca [128 x i8]
%15 = alloca [16 x i8]
%16 = alloca double
%17 = getelementptr inbounds [160 x i8], [160 x i8]* %12, i64 0, i64 0
%18 = call i32 @sprintf(i8* %17, i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0, i8* %0)
%19 = call i32 @system(i8* %17)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %137
21: ; preds = %11
%22 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %137, label %24
24: ; preds = %21
%25 = load i8*, i8** %6
%26 = getelementptr inbounds i8*, i8** %6, i64 1
%27 = load i8*, i8** %26
%28 = getelementptr inbounds i8*, i8** %6, i64 2
%29 = load i8*, i8** %28
%30 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%31 = getelementptr inbounds [128 x i8], [128 x i8]* %14, i64 0, i64 0
%32 = getelementptr inbounds [16 x i8], [16 x i8]* %15, i64 0, i64 0
%33 = call i32 @fscanf(i32* %22, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %30, i8* %31, i8* %32, double* %16)
%34 = icmp eq i32 %33, 4
br i1 %34, label %35, label %137
35: ; preds = %24
%36 = load i32, i32* %4
%37 = icmp sgt i32 %36, 0
br i1 %37, label %38, label %120
38: ; preds = %35, %110
%39 = phi i64 [ %114, %110 ], [ 0, %35 ]
%40 = phi i32 [ %113, %110 ], [ 0, %35 ]
%41 = phi i32 [ %112, %110 ], [ 0, %35 ]
%42 = phi i32 [ %111, %110 ], [ 0, %35 ]
%43 = getelementptr inbounds i8*, i8** %5, i64 %39
%44 = load i8*, i8** %43
br label %45
45: ; preds = %58, %38
%46 = call i32 @strcmp(i8* %31, i8* dereferenceable(1) %44)
%47 = icmp slt i32 %46, 0
br i1 %47, label %54, label %48
48: ; preds = %45
%49 = load i32, i32* %2
%50 = icmp sgt i32 %49, 0
br i1 %50, label %51, label %110
51: ; preds = %48
%52 = icmp eq i32 %46, 0
%53 = sext i32 %42 to i64
br label %60
54: ; preds = %45
%55 = call i32 @fscanf(i32* %22, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %30, i8* %31, i8* %32, double* %16)
%56 = load i32, i32* @EOF
%57 = icmp eq i32 %55, %56
br i1 %57, label %120, label %58
58: ; preds = %54
%59 = icmp eq i32 %55, 4
br i1 %59, label %45, label %137
60: ; preds = %51, %100
%61 = phi i64 [ %53, %51 ], [ %104, %100 ]
%62 = phi i64 [ 0, %51 ], [ %103, %100 ]
%63 = phi i32 [ %40, %51 ], [ %101, %100 ]
%64 = phi i32 [ %41, %51 ], [ %102, %100 ]
%65 = getelementptr inbounds i8*, i8** %3, i64 %62
%66 = load i8*, i8** %65
br i1 %52, label %67, label %98
67: ; preds = %60, %74
%68 = call i32 @strcmp(i8* %30, i8* dereferenceable(1) %66)
%69 = icmp slt i32 %68, 0
br i1 %69, label %70, label %76
70: ; preds = %67
%71 = call i32 @fscanf(i32* %22, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %30, i8* %31, i8* %32, double* %16)
%72 = load i32, i32* @EOF
%73 = icmp eq i32 %71, %72
br i1 %73, label %118, label %74
74: ; preds = %70
%75 = icmp eq i32 %71, 4
br i1 %75, label %67, label %137
76: ; preds = %67
%77 = icmp eq i32 %68, 0
br i1 %77, label %78, label %100
78: ; preds = %76
%79 = call i32 @strcmp(i8* dereferenceable(1) %25, i8* %32)
%80 = icmp eq i32 %79, 0
br i1 %80, label %81, label %84
81: ; preds = %78
%82 = getelementptr inbounds i8, i8* %8, i64 %61
store i8 1, i8* %82
%83 = add nsw i32 %64, 1
br label %100
84: ; preds = %78
%85 = call i32 @strcmp(i8* dereferenceable(1) %27, i8* %32)
%86 = icmp eq i32 %85, 0
br i1 %86, label %87, label %90
87: ; preds = %84
%88 = getelementptr inbounds i8, i8* %8, i64 %61
store i8 2, i8* %88
%89 = add nsw i32 %64, 1
br label %100
90: ; preds = %84
%91 = call i32 @strcmp(i8* dereferenceable(1) %29, i8* %32)
%92 = icmp eq i32 %91, 0
%93 = getelementptr inbounds i8, i8* %8, i64 %61
br i1 %92, label %94, label %96
94: ; preds = %90
store i8 3, i8* %93
%95 = add nsw i32 %64, 1
br label %100
96: ; preds = %90
store i8 0, i8* %93
%97 = add nsw i32 %63, 1
br label %100
98: ; preds = %60
%99 = getelementptr inbounds i8, i8* %8, i64 %61
store i8 0, i8* %99
br label %100
100: ; preds = %98, %81, %94, %96, %87, %76
%101 = phi i32 [ %63, %81 ], [ %63, %87 ], [ %63, %94 ], [ %97, %96 ], [ %63, %76 ], [ %63, %98 ]
%102 = phi i32 [ %83, %81 ], [ %89, %87 ], [ %95, %94 ], [ %64, %96 ], [ %64, %76 ], [ %64, %98 ]
%103 = add nuw nsw i64 %62, 1
%104 = add nsw i64 %61, 1
%105 = load i32, i32* %2
%106 = sext i32 %105 to i64
%107 = icmp slt i64 %103, %106
br i1 %107, label %60, label %108
108: ; preds = %100
%109 = trunc i64 %104 to i32
br label %110
110: ; preds = %108, %48
%111 = phi i32 [ %42, %48 ], [ %109, %108 ]
%112 = phi i32 [ %41, %48 ], [ %102, %108 ]
%113 = phi i32 [ %40, %48 ], [ %101, %108 ]
%114 = add nuw nsw i64 %39, 1
%115 = load i32, i32* %4
%116 = sext i32 %115 to i64
%117 = icmp slt i64 %114, %116
br i1 %117, label %38, label %120
118: ; preds = %70
%119 = trunc i64 %61 to i32
br label %120
120: ; preds = %110, %54, %118, %35
%121 = phi i32 [ 0, %35 ], [ %119, %118 ], [ %42, %54 ], [ %111, %110 ]
%122 = phi i32 [ 0, %35 ], [ %64, %118 ], [ %41, %54 ], [ %112, %110 ]
%123 = phi i32 [ 0, %35 ], [ %63, %118 ], [ %40, %54 ], [ %113, %110 ]
%124 = load i32, i32* %4
%125 = load i32, i32* %2
%126 = mul i32 %125, %124
%127 = icmp slt i32 %121, %126
br i1 %127, label %128, label %135
128: ; preds = %120
%129 = sext i32 %121 to i64
%130 = getelementptr i8, i8* %8, i64 %129
%131 = xor i32 %121, -1
%132 = add i32 %126, %131
%133 = zext i32 %132 to i64
%134 = add nuw nsw i64 %133, 1
br label %135
135: ; preds = %128, %120
store i32 %122, i32* %9
%136 = getelementptr inbounds i32, i32* %9, i64 1
store i32 %123, i32* %136
br label %137
137: ; preds = %58, %74, %24, %21, %11, %135
%138 = phi i32 [ 0, %135 ], [ 1, %11 ], [ 2, %21 ], [ 3, %24 ], [ 3, %74 ], [ 3, %58 ]
store i32 %138, i32* %10
ret void
}