#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 atoi(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
char *malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
void main(int argc, char **argv) {
  FILE *InFile = NULL;
  FILE *OutFile = NULL;
  char *CopyFlags = NULL;
  char *SourceRow = NULL;
  int RowLength;
  int Count;
  int ColNumber;
  if (argc < 5) {
    printf("Usage: %s <InFile> <OutFile> <RowLength> <CopyCol1> [<CopyCol2> "
           "[<CopyCol3> [...]]]\nColumn numbers start at 1\n",
           argv[0]);
    return;
  }
  RowLength = atoi(argv[3]);
  if (!RowLength) {
    printf("Row length must be greater than Zero!!!\n");
    goto Exit;
  }
  CopyFlags = malloc(RowLength);
  SourceRow = malloc(RowLength);
  if ((!CopyFlags) || (!SourceRow)) {
    printf("Error allocating working memory\n");
    goto Exit;
  }
  memset(CopyFlags, 0, RowLength);
  for (Count = 4; Count < argc; Count++) {
    ColNumber = atoi(argv[Count]);
    printf("Adding column number %d\n", ColNumber);
    if ((ColNumber < 1) || (ColNumber > RowLength)) {
      printf("Invalid column number %d\n", ColNumber);
      goto Exit;
    }
    CopyFlags[ColNumber - 1] = 1;
  }
  InFile = fopen(argv[1], "rb");
  if (!InFile) {
    printf("Cannot open input file %s\n", argv[1]);
    goto Exit;
  }
  OutFile = fopen(argv[2], "wb");
  if (!OutFile) {
    printf("Cannot open output file %s\n", argv[2]);
    goto Exit;
  }
  while (fread(SourceRow, RowLength, 1, InFile)) {
    for (Count = 0; Count < RowLength; Count++)
      if (CopyFlags[Count])
        if (!fwrite(SourceRow + Count, 1, 1, OutFile)) {
          printf("Error writing to output file\n");
          goto Exit;
        }
  }
Exit:
  if (InFile)
    fclose(InFile);
  if (OutFile)
    fclose(OutFile);
  if (CopyFlags)
    free(CopyFlags);
  if (SourceRow)
    free(SourceRow);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
cmpl   $0x5,-0x4(%rbp)
jge    11e3 <main+0x53>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1450 <main+0x2c0>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    1210 <main+0x80>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1400 <main+0x270>
mov    -0x34(%rbp),%edi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x34(%rbp),%edi
call   1080 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     123e <main+0xae>
cmpq   $0x0,-0x30(%rbp)
jne    1251 <main+0xc1>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1400 <main+0x270>
mov    -0x28(%rbp),%rdi
mov    -0x34(%rbp),%edx
xor    %esi,%esi
call   1070 <memset@plt>
movl   $0x4,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12e2 <main+0x152>
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%esi
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0x1,-0x3c(%rbp)
jl     12ad <main+0x11d>
mov    -0x3c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jle    12c3 <main+0x133>
mov    -0x3c(%rbp),%esi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1400 <main+0x270>
mov    -0x28(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x1,(%rax,%rcx,1)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1266 <main+0xd6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdfb(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1320 <main+0x190>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1400 <main+0x270>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xddb(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    135e <main+0x1ce>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1400 <main+0x270>
jmp    1363 <main+0x1d3>
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x18(%rbp),%rcx
mov    $0x1,%edx
call   1040 <fread@plt>
cmp    $0x0,%rax
je     13fb <main+0x26b>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    13f6 <main+0x266>
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     13e3 <main+0x253>
mov    -0x30(%rbp),%rdi
movslq -0x38(%rbp),%rax
add    %rax,%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   10b0 <fwrite@plt>
cmp    $0x0,%eax
jne    13de <main+0x24e>
lea    0xd57(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1400 <main+0x270>
jmp    13e3 <main+0x253>
jmp    13e8 <main+0x258>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1389 <main+0x1f9>
jmp    1363 <main+0x1d3>
jmp    1400 <main+0x270>
cmpq   $0x0,-0x18(%rbp)
je     1414 <main+0x284>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
cmpq   $0x0,-0x20(%rbp)
je     1428 <main+0x298>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
cmpq   $0x0,-0x28(%rbp)
je     143c <main+0x2ac>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x30(%rbp)
je     1450 <main+0x2c0>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
cmp    $0x4,%edi
jg     11d5 <main+0x35>
mov    (%rbx),%rsi
lea    0xe40(%rip),%rdi
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <printf@plt>
mov    %edi,%ebp
mov    0x18(%rbx),%rdi
call   10b0 <atoi@plt>
test   %eax,%eax
je     12db <main+0x13b>
mov    %eax,%r12d
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,%r14
mov    %r12d,%edi
call   1090 <malloc@plt>
mov    %rax,%r15
test   %r14,%r14
je     12f5 <main+0x155>
test   %r15,%r15
je     12f5 <main+0x155>
mov    %r15,0x10(%rsp)
mov    %r14,0x8(%rsp)
mov    %r14,%rdi
xor    %esi,%esi
mov    %r12d,%edx
call   1080 <memset@plt>
mov    %ebp,%r14d
mov    $0x4,%r15d
lea    0xe36(%rip),%r13
nopl   0x0(%rax)
mov    (%rbx,%r15,8),%rdi
call   10b0 <atoi@plt>
mov    %eax,%ebp
mov    %r13,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
test   %ebp,%ebp
jle    130f <main+0x16f>
cmp    %r12d,%ebp
jg     130f <main+0x16f>
add    $0xffffffff,%ebp
mov    0x8(%rsp),%rax
movb   $0x1,(%rax,%rbp,1)
add    $0x1,%r15
cmp    %r15,%r14
jne    1240 <main+0xa0>
mov    0x8(%rbx),%rdi
lea    0xe1a(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     13bf <main+0x21f>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
lea    0xe1c(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
mov    0x10(%rsp),%r15
je     13d8 <main+0x238>
mov    %rax,%r13
mov    %r15,%rdi
mov    %r12d,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fread@plt>
test   %rax,%rax
je     138a <main+0x1ea>
mov    %r12d,%ebx
jmp    133e <main+0x19e>
lea    0xdfd(%rip),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>
lea    0xe0b(%rip),%rdi
call   1040 <puts@plt>
test   %r14,%r14
jne    13f7 <main+0x257>
jmp    13a4 <main+0x204>
lea    0xd72(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x10(%rsp),%r15
jmp    139a <main+0x1fa>
mov    %r15,%rdi
mov    %r12d,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fread@plt>
test   %rax,%rax
je     138a <main+0x1ea>
test   %r12d,%r12d
jle    1326 <main+0x186>
xor    %ebp,%ebp
jmp    1359 <main+0x1b9>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
je     1326 <main+0x186>
mov    0x8(%rsp),%rax
cmpb   $0x0,(%rax,%rbp,1)
je     1350 <main+0x1b0>
lea    (%r15,%rbp,1),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10c0 <fwrite@plt>
test   %eax,%eax
jne    1350 <main+0x1b0>
lea    0xda2(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1060 <fclose@plt>
mov    %r13,%rdi
call   1060 <fclose@plt>
mov    0x8(%rsp),%r14
test   %r14,%r14
jne    13f7 <main+0x257>
test   %r15,%r15
je     1404 <main+0x264>
mov    %r15,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
mov    0x8(%rbx),%rsi
lea    0xcdb(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x10(%rsp),%r15
jmp    13f2 <main+0x252>
mov    0x10(%rbx),%rsi
lea    0xce0(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14,%rdi
call   1060 <fclose@plt>
mov    0x8(%rsp),%r14
mov    %r14,%rdi
call   1030 <free@plt>
test   %r15,%r15
jne    13a9 <main+0x209>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [111 x i8] c"Usage: %s <InFile> <OutFile> <RowLength> <CopyCol1> [<CopyCol2> [<CopyCol3> [...]]]\0AColumn numbers start at 1\0A\00"
@.str.1 = [41 x i8] c"Row length must be greater than Zero!!!\0A\00"
@.str.2 = [33 x i8] c"Error allocating working memory\0A\00"
@.str.3 = [25 x i8] c"Adding column number %d\0A\00"
@.str.4 = [26 x i8] c"Invalid column number %d\0A\00"
@.str.5 = [3 x i8] c"rb\00"
@.str.6 = [27 x i8] c"Cannot open input file %s\0A\00"
@.str.7 = [3 x i8] c"wb\00"
@.str.8 = [28 x i8] c"Cannot open output file %s\0A\00"
@.str.9 = [30 x i8] c"Error writing to output file\0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32* null, i32** %5
store i32* null, i32** %6
store i8* null, i8** %7
store i8* null, i8** %8
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 5
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = load i8**, i8*** %4
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([111 x i8], [111 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %159
19: ; preds = %2
%20 = load i8**, i8*** %4
%21 = getelementptr inbounds i8*, i8** %20, i64 3
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %9
%24 = load i32, i32* %9
%25 = icmp ne i32 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %19
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
br label %135
28: ; preds = %19
%29 = load i32, i32* %9
%30 = call i8* @malloc(i32 %29)
store i8* %30, i8** %7
%31 = load i32, i32* %9
%32 = call i8* @malloc(i32 %31)
store i8* %32, i8** %8
%33 = load i8*, i8** %7
%34 = icmp ne i8* %33, null
br i1 %34, label %35, label %38
35: ; preds = %28
%36 = load i8*, i8** %8
%37 = icmp ne i8* %36, null
br i1 %37, label %40, label %38
38: ; preds = %35, %28
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %135
40: ; preds = %35
%41 = load i8*, i8** %7
%42 = load i32, i32* %9
%43 = call i32 @memset(i8* %41, i32 0, i32 %42)
store i32 4, i32* %10
br label %44
44: ; preds = %72, %40
%45 = load i32, i32* %10
%46 = load i32, i32* %3
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %75
48: ; preds = %44
%49 = load i8**, i8*** %4
%50 = load i32, i32* %10
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8*, i8** %49, i64 %51
%53 = load i8*, i8** %52
%54 = call i32 @atoi(i8* %53)
store i32 %54, i32* %11
%55 = load i32, i32* %11
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %55)
%57 = load i32, i32* %11
%58 = icmp slt i32 %57, 1
br i1 %58, label %63, label %59
59: ; preds = %48
%60 = load i32, i32* %11
%61 = load i32, i32* %9
%62 = icmp sgt i32 %60, %61
br i1 %62, label %63, label %66
63: ; preds = %59, %48
%64 = load i32, i32* %11
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32 %64)
br label %135
66: ; preds = %59
%67 = load i8*, i8** %7
%68 = load i32, i32* %11
%69 = sub nsw i32 %68, 1
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8, i8* %67, i64 %70
store i8 1, i8* %71
br label %72
72: ; preds = %66
%73 = load i32, i32* %10
%74 = add nsw i32 %73, 1
store i32 %74, i32* %10
br label %44
75: ; preds = %44
%76 = load i8**, i8*** %4
%77 = getelementptr inbounds i8*, i8** %76, i64 1
%78 = load i8*, i8** %77
%79 = call i32* @fopen(i8* %78, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32* %79, i32** %5
%80 = load i32*, i32** %5
%81 = icmp ne i32* %80, null
br i1 %81, label %87, label %82
82: ; preds = %75
%83 = load i8**, i8*** %4
%84 = getelementptr inbounds i8*, i8** %83, i64 1
%85 = load i8*, i8** %84
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %85)
br label %135
87: ; preds = %75
%88 = load i8**, i8*** %4
%89 = getelementptr inbounds i8*, i8** %88, i64 2
%90 = load i8*, i8** %89
%91 = call i32* @fopen(i8* %90, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
store i32* %91, i32** %6
%92 = load i32*, i32** %6
%93 = icmp ne i32* %92, null
br i1 %93, label %99, label %94
94: ; preds = %87
%95 = load i8**, i8*** %4
%96 = getelementptr inbounds i8*, i8** %95, i64 2
%97 = load i8*, i8** %96
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8* %97)
br label %135
99: ; preds = %87
br label %100
100: ; preds = %133, %99
%101 = load i8*, i8** %8
%102 = load i32, i32* %9
%103 = load i32*, i32** %5
%104 = call i64 @fread(i8* %101, i32 %102, i32 1, i32* %103)
%105 = icmp ne i64 %104, 0
br i1 %105, label %106, label %134
106: ; preds = %100
store i32 0, i32* %10
br label %107
107: ; preds = %130, %106
%108 = load i32, i32* %10
%109 = load i32, i32* %9
%110 = icmp slt i32 %108, %109
br i1 %110, label %111, label %133
111: ; preds = %107
%112 = load i8*, i8** %7
%113 = load i32, i32* %10
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds i8, i8* %112, i64 %114
%116 = load i8, i8* %115
%117 = icmp ne i8 %116, 0
br i1 %117, label %118, label %129
118: ; preds = %111
%119 = load i8*, i8** %8
%120 = load i32, i32* %10
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds i8, i8* %119, i64 %121
%123 = load i32*, i32** %6
%124 = call i32 @fwrite(i8* %122, i32 1, i32 1, i32* %123)
%125 = icmp ne i32 %124, 0
br i1 %125, label %128, label %126
126: ; preds = %118
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
br label %135
128: ; preds = %118
br label %129
129: ; preds = %128, %111
br label %130
130: ; preds = %129
%131 = load i32, i32* %10
%132 = add nsw i32 %131, 1
store i32 %132, i32* %10
br label %107
133: ; preds = %107
br label %100
134: ; preds = %100
br label %135
135: ; preds = %134, %126, %94, %82, %63, %38, %26
%136 = load i32*, i32** %5
%137 = icmp ne i32* %136, null
br i1 %137, label %138, label %141
138: ; preds = %135
%139 = load i32*, i32** %5
%140 = call i32 @fclose(i32* %139)
br label %141
141: ; preds = %138, %135
%142 = load i32*, i32** %6
%143 = icmp ne i32* %142, null
br i1 %143, label %144, label %147
144: ; preds = %141
%145 = load i32*, i32** %6
%146 = call i32 @fclose(i32* %145)
br label %147
147: ; preds = %144, %141
%148 = load i8*, i8** %7
%149 = icmp ne i8* %148, null
br i1 %149, label %150, label %153
150: ; preds = %147
%151 = load i8*, i8** %7
%152 = call i32 @free(i8* %151)
br label %153
153: ; preds = %150, %147
%154 = load i8*, i8** %8
%155 = icmp ne i8* %154, null
br i1 %155, label %156, label %159
156: ; preds = %153
%157 = load i8*, i8** %8
%158 = call i32 @free(i8* %157)
br label %159
159: ; preds = %14, %156, %153
ret void
}

LLVM IR (-O2):
@.str = [111 x i8] c"Usage: %s <InFile> <OutFile> <RowLength> <CopyCol1> [<CopyCol2> [<CopyCol3> [...]]]\0AColumn numbers start at 1\0A\00"
@.str.3 = [25 x i8] c"Adding column number %d\0A\00"
@.str.4 = [26 x i8] c"Invalid column number %d\0A\00"
@.str.5 = [3 x i8] c"rb\00"
@.str.6 = [27 x i8] c"Cannot open input file %s\0A\00"
@.str.7 = [3 x i8] c"wb\00"
@.str.8 = [28 x i8] c"Cannot open output file %s\0A\00"
@str = [40 x i8] c"Row length must be greater than Zero!!!\00"
@str.10 = [32 x i8] c"Error allocating working memory\00"
@str.11 = [29 x i8] c"Error writing to output file\00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 5
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([111 x i8], [111 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %94
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 3
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
br label %94
14: ; preds = %7
%15 = tail call i8* @malloc(i32 %10)
%16 = tail call i8* @malloc(i32 %10)
%17 = icmp ne i8* %15, null
%18 = icmp ne i8* %16, null
%19 = and i1 %17, %18
br i1 %19, label %22, label %20
20: ; preds = %14
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.10, i64 0, i64 0))
br label %86
22: ; preds = %14
%23 = tail call i32 @memset(i8* %15, i32 0, i32 %10)
%24 = zext i32 %0 to i64
br label %25
25: ; preds = %22, %36
%26 = phi i64 [ 4, %22 ], [ %40, %36 ]
%27 = getelementptr inbounds i8*, i8** %1, i64 %26
%28 = load i8*, i8** %27
%29 = tail call i32 @atoi(i8* %28)
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %29)
%31 = icmp slt i32 %29, 1
%32 = icmp sgt i32 %29, %10
%33 = select i1 %31, i1 true, i1 %32
br i1 %33, label %34, label %36
34: ; preds = %25
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32 %29)
br label %86
36: ; preds = %25
%37 = add nsw i32 %29, -1
%38 = zext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %15, i64 %38
store i8 1, i8* %39
%40 = add nuw nsw i64 %26, 1
%41 = icmp eq i64 %40, %24
br i1 %41, label %42, label %25
42: ; preds = %36
%43 = getelementptr inbounds i8*, i8** %1, i64 1
%44 = load i8*, i8** %43
%45 = tail call i32* @fopen(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %50
47: ; preds = %42
%48 = load i8*, i8** %43
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %48)
br label %88
50: ; preds = %42
%51 = getelementptr inbounds i8*, i8** %1, i64 2
%52 = load i8*, i8** %51
%53 = tail call i32* @fopen(i8* %52, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%54 = icmp eq i32* %53, null
br i1 %54, label %61, label %55
55: ; preds = %50
%56 = tail call i64 @fread(i8* %16, i32 %10, i32 1, i32* %45)
%57 = icmp eq i64 %56, 0
br i1 %57, label %83, label %58
58: ; preds = %55
%59 = icmp sgt i32 %10, 0
%60 = zext i32 %10 to i64
br label %68
61: ; preds = %50
%62 = load i8*, i8** %51
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8* %62)
%64 = tail call i32 @fclose(i32* %45)
br label %88
65: ; preds = %80, %68
%66 = tail call i64 @fread(i8* %16, i32 %10, i32 1, i32* %45)
%67 = icmp eq i64 %66, 0
br i1 %67, label %83, label %68
68: ; preds = %58, %65
br i1 %59, label %69, label %65
69: ; preds = %68, %80
%70 = phi i64 [ %81, %80 ], [ 0, %68 ]
%71 = getelementptr inbounds i8, i8* %15, i64 %70
%72 = load i8, i8* %71
%73 = icmp eq i8 %72, 0
br i1 %73, label %80, label %74
74: ; preds = %69
%75 = getelementptr inbounds i8, i8* %16, i64 %70
%76 = tail call i32 @fwrite(i8* %75, i32 1, i32 1, i32* %53)
%77 = icmp eq i32 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %74
%79 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.11, i64 0, i64 0))
br label %83
80: ; preds = %69, %74
%81 = add nuw nsw i64 %70, 1
%82 = icmp eq i64 %81, %60
br i1 %82, label %65, label %69
83: ; preds = %65, %78, %55
%84 = tail call i32 @fclose(i32* %45)
%85 = tail call i32 @fclose(i32* %53)
br label %86
86: ; preds = %34, %20, %83
%87 = icmp eq i8* %15, null
br i1 %87, label %90, label %88
88: ; preds = %61, %47, %86
%89 = tail call i32 @free(i8* %15)
br label %90
90: ; preds = %88, %86
%91 = icmp eq i8* %16, null
br i1 %91, label %94, label %92
92: ; preds = %90
%93 = tail call i32 @free(i8* %16)
br label %94
94: ; preds = %12, %90, %92, %4
ret void
}