#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 */
unsigned int atoi(char *);
int /*<<< orphan*/ errorHandler(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, unsigned int);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  FILE *fIn, *fOut, *fTmp;
  char filename[32], buffer[33], name[] = "data", title[33];
  unsigned int i, j, k, NFILES, NCOLS, NROWS;
  double data;
  if (argc == 2 && strcmp(argv[1], "-h") == 0) {
    printf("\n\nCall as:\n\n\t./break filename nFiles nCols nRows\n\n");
    printf("Breaks a data file into several. Useful when calculations for ");
    printf("several planes\nin Z are done and need to be stored in ");
    printf("independent files with only the X\nand Y information.\n\n");
    printf("Takes the filename to break as input 1 and the number of files ");
    printf("to produce as\ninput 2, followed by the number of columns to ");
    printf("read in the original file and\nthe number of rows in each of the ");
    printf("output data files. The files are saved as\n'data1, data2,...' and");
    printf(" saves columns (X,Y,Z,T).\n\n");
    exit(0);
  } else if (argc != 5) {
    printf("\n\nCorrect symtax is: ./break filename nFiles nCols nRows\n");
    errorHandler("Type './break -h' for help.\n");
  }
  fIn = fopen(argv[1], "r");
  NFILES = atoi(argv[2]);
  NCOLS = atoi(argv[3]);
  NROWS = atoi(argv[4]);
  for (i = 1; i <= NFILES; i++) {
    sprintf(buffer, "%d", i);
    strcpy(filename, name);
    strcat(filename, buffer);
    fOut = fopen(filename, "w");
    if (i > 1)
      fTmp = fopen("data1", "r");
    for (j = 0; j <= NROWS; j++) {
      if (i == 1 && j == 0) {
        for (k = 0; k < NCOLS; k++) {
          fscanf(fIn, "%s", &title);
          fprintf(fOut, "%s    ", title);
        }
      } else if (!j) {
        for (k = 0; k < NCOLS; k++) {
          fscanf(fTmp, "%s", &title);
          fprintf(fOut, "%s    ", title);
        }
      } else {
        for (k = 0; k < NCOLS; k++) {
          fscanf(fIn, "%le", &data);
          fprintf(fOut, "%le   ", data);
        }
      }
      fprintf(fOut, "\n");
    }
    fclose(fOut);
    if (i > 1)
      fclose(fTmp);
  }
  fclose(fIn);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe21(%rip),%eax
mov    %eax,-0x85(%rbp)
mov    0xe19(%rip),%al
mov    %al,-0x81(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    128c <main+0xcc>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdfb(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    128c <main+0xcc>
lea    0xde8(%rip),%rdi
call   1050 <printf@plt>
lea    0xe0f(%rip),%rdi
call   1050 <printf@plt>
lea    0xe42(%rip),%rdi
call   1050 <printf@plt>
lea    0xe6d(%rip),%rdi
call   1050 <printf@plt>
lea    0xe98(%rip),%rdi
call   1050 <printf@plt>
lea    0xecc(%rip),%rdi
call   1050 <printf@plt>
lea    0xefd(%rip),%rdi
call   1050 <printf@plt>
lea    0xf32(%rip),%rdi
call   1050 <printf@plt>
lea    0xf67(%rip),%rdi
call   1050 <printf@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
cmpl   $0x5,-0x8(%rbp)
je     12ae <main+0xee>
lea    0xf66(%rip),%rdi
call   1050 <printf@plt>
lea    0xf94(%rip),%rdi
call   10e0 <errorHandler@plt>
jmp    12b3 <main+0xf3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xf98(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0xc0(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0xc4(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0xc8(%rbp)
movl   $0x1,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
cmp    -0xc0(%rbp),%eax
ja     1567 <main+0x3a7>
lea    -0x80(%rbp),%rdi
mov    -0xb4(%rbp),%edx
lea    0xf2b(%rip),%rsi
call   10c0 <sprintf@plt>
lea    -0x50(%rbp),%rdi
lea    -0x85(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x50(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   10b0 <strcat@plt>
lea    -0x50(%rbp),%rdi
lea    0xf01(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpl   $0x1,-0xb4(%rbp)
jbe    138b <main+0x1cb>
lea    0xee6(%rip),%rdi
lea    0xed8(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0xb8(%rbp)
mov    -0xb8(%rbp),%eax
cmp    -0xc8(%rbp),%eax
ja     152f <main+0x36f>
cmpl   $0x1,-0xb4(%rbp)
jne    1428 <main+0x268>
cmpl   $0x0,-0xb8(%rbp)
jne    1428 <main+0x268>
movl   $0x0,-0xbc(%rbp)
mov    -0xbc(%rbp),%eax
cmp    -0xc4(%rbp),%eax
jae    1423 <main+0x263>
mov    -0x18(%rbp),%rdi
lea    0xe7f(%rip),%rsi
lea    -0xb0(%rbp),%rdx
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x20(%rbp),%rdi
lea    -0xb0(%rbp),%rdx
lea    0xe62(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
jmp    13cb <main+0x20b>
jmp    1509 <main+0x349>
cmpl   $0x0,-0xb8(%rbp)
jne    149c <main+0x2dc>
movl   $0x0,-0xbc(%rbp)
mov    -0xbc(%rbp),%eax
cmp    -0xc4(%rbp),%eax
jae    1497 <main+0x2d7>
mov    -0x28(%rbp),%rdi
lea    0xe0b(%rip),%rsi
lea    -0xb0(%rbp),%rdx
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x20(%rbp),%rdi
lea    -0xb0(%rbp),%rdx
lea    0xdee(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
jmp    143f <main+0x27f>
jmp    1504 <main+0x344>
movl   $0x0,-0xbc(%rbp)
mov    -0xbc(%rbp),%eax
cmp    -0xc4(%rbp),%eax
jae    14ff <main+0x33f>
mov    -0x18(%rbp),%rdi
lea    0xdae(%rip),%rsi
lea    -0xd0(%rbp),%rdx
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x20(%rbp),%rdi
movsd  -0xd0(%rbp),%xmm0
ff
lea    0xd91(%rip),%rsi
mov    $0x1,%al
call   1080 <fprintf@plt>
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
jmp    14a6 <main+0x2e6>
jmp    1504 <main+0x344>
jmp    1509 <main+0x349>
mov    -0x20(%rbp),%rdi
lea    0xced(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    1395 <main+0x1d5>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
cmpl   $0x1,-0xb4(%rbp)
jbe    154e <main+0x38e>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
jmp    1553 <main+0x393>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    130e <main+0x14e>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    $0x1,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %rsi,%r14
movb   $0x0,0x10(%rsp)
movl   $0x61746164,0xc(%rsp)
cmp    $0x5,%edi
je     123c <main+0x5c>
cmp    $0x2,%edi
jne    1224 <main+0x44>
mov    0x8(%r14),%rdi
lea    0xdef(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     145f <main+0x27f>
lea    0xf91(%rip),%rdi
call   1040 <puts@plt>
lea    0xf46(%rip),%rdi
call   1100 <errorHandler@plt>
mov    0x8(%r14),%rdi
lea    0xf53(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%rbx
mov    0x10(%r14),%rdi
call   10c0 <atoi@plt>
mov    %eax,%ebp
mov    0x18(%r14),%rdi
call   10c0 <atoi@plt>
mov    %eax,0x8(%rsp)
mov    0x20(%r14),%rdi
call   10c0 <atoi@plt>
mov    %eax,0x18(%rsp)
mov    %ebp,0x14(%rsp)
test   %ebp,%ebp
je     1440 <main+0x260>
mov    $0x1,%ebp
lea    0x50(%rsp),%r14
jmp    129d <main+0xbd>
nopl   0x0(%rax)
add    $0x1,%ebp
cmp    0x14(%rsp),%ebp
ja     1440 <main+0x260>
lea    0x80(%rsp),%r15
mov    %r15,%rdi
lea    0xeed(%rip),%rsi
mov    %ebp,%edx
call   10e0 <sprintf@plt>
lea    0x30(%rsp),%r12
mov    %r12,%rdi
lea    0xc(%rsp),%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   10d0 <strcat@plt>
mov    %r12,%rdi
lea    0xec2(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%r12
cmp    $0x2,%ebp
jb     1302 <main+0x122>
lea    0xeb0(%rip),%rdi
lea    0xea2(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,0x20(%rsp)
xor    %r15d,%r15d
mov    %ebp,0x1c(%rsp)
jmp    1330 <main+0x150>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %r12,%rsi
call   1080 <fputc@plt>
add    $0x1,%r15d
cmp    0x18(%rsp),%r15d
mov    0x1c(%rsp),%ebp
ja     1420 <main+0x240>
cmp    $0x1,%ebp
jne    1380 <main+0x1a0>
test   %r15d,%r15d
jne    1380 <main+0x1a0>
cmpl   $0x0,0x8(%rsp)
je     1310 <main+0x130>
mov    0x8(%rsp),%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
lea    0xe4d(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    %r12,%rdi
lea    0xe3c(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
add    $0xffffffff,%ebp
jne    1350 <main+0x170>
jmp    1310 <main+0x130>
nop
test   %r15d,%r15d
je     13c8 <main+0x1e8>
mov    0x8(%rsp),%eax
mov    %eax,%r13d
test   %eax,%eax
je     1310 <main+0x130>
mov    %rbx,%rdi
lea    0xe17(%rip),%rsi
lea    0x28(%rsp),%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
movsd  0x28(%rsp),%xmm0
mov    %r12,%rdi
lea    0xdff(%rip),%rsi
mov    $0x1,%al
call   10a0 <fprintf@plt>
add    $0xffffffff,%r13d
jne    1390 <main+0x1b0>
jmp    1310 <main+0x130>
cmpl   $0x0,0x8(%rsp)
je     1310 <main+0x130>
mov    0x8(%rsp),%ebp
nopw   0x0(%rax,%rax,1)
mov    0x20(%rsp),%rdi
lea    0xdbb(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    %r12,%rdi
lea    0xdaa(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
add    $0xffffffff,%ebp
jne    13e0 <main+0x200>
jmp    1310 <main+0x130>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
call   1050 <fclose@plt>
cmp    $0x2,%ebp
jb     1290 <main+0xb0>
mov    0x20(%rsp),%rdi
call   1050 <fclose@plt>
jmp    1290 <main+0xb0>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    $0x1,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd8f(%rip),%rdi
call   1040 <puts@plt>
lea    0xb96(%rip),%rdi
call   1060 <printf@plt>
lea    0xbc9(%rip),%rdi
call   1060 <printf@plt>
lea    0xd9d(%rip),%rdi
call   1040 <puts@plt>
lea    0xbe8(%rip),%rdi
call   1060 <printf@plt>
lea    0xc1c(%rip),%rdi
call   1060 <printf@plt>
lea    0xc4d(%rip),%rdi
call   1060 <printf@plt>
lea    0xc82(%rip),%rdi
call   1060 <printf@plt>
lea    0xd97(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@__const.main.name = [5 x i8] c"data\00"
@.str = [3 x i8] c"-h\00"
@.str.1 = [51 x i8] c"\0A\0ACall as:\0A\0A\09./break filename nFiles nCols nRows\0A\0A\00"
@.str.2 = [63 x i8] c"Breaks a data file into several. Useful when calculations for \00"
@.str.3 = [55 x i8] c"several planes\0Ain Z are done and need to be stored in \00"
@.str.4 = [55 x i8] c"independent files with only the X\0Aand Y information.\0A\0A\00"
@.str.5 = [64 x i8] c"Takes the filename to break as input 1 and the number of files \00"
@.str.6 = [61 x i8] c"to produce as\0Ainput 2, followed by the number of columns to \00"
@.str.7 = [65 x i8] c"read in the original file and\0Athe number of rows in each of the \00"
@.str.8 = [65 x i8] c"output data files. The files are saved as\0A'data1, data2,...' and\00"
@.str.9 = [28 x i8] c" saves columns (X,Y,Z,T).\0A\0A\00"
@.str.10 = [58 x i8] c"\0A\0ACorrect symtax is: ./break filename nFiles nCols nRows\0A\00"
@.str.11 = [29 x i8] c"Type './break -h' for help.\0A\00"
@.str.12 = [2 x i8] c"r\00"
@.str.13 = [3 x i8] c"%d\00"
@.str.14 = [2 x i8] c"w\00"
@.str.15 = [6 x i8] c"data1\00"
@.str.16 = [3 x i8] c"%s\00"
@.str.17 = [7 x i8] c"%s \00"
@.str.18 = [4 x i8] c"%le\00"
@.str.19 = [7 x i8] c"%le \00"
@.str.20 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca [32 x i8]
%10 = alloca [33 x i8]
%11 = alloca [5 x i8]
%12 = alloca [33 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = bitcast [5 x i8]* %11 to i8*
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %40
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %40
29: ; preds = %23
%30 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%31 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0))
%32 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0))
%33 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.4, i64 0, i64 0))
%34 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.5, i64 0, i64 0))
%35 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.6, i64 0, i64 0))
%36 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.7, i64 0, i64 0))
%37 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.8, i64 0, i64 0))
%38 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
%39 = call i32 @exit(i32 0)
unreachable
40: ; preds = %23, %2
%41 = load i32, i32* %4
%42 = icmp ne i32 %41, 5
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.10, i64 0, i64 0))
%45 = call i32 @errorHandler(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0))
br label %46
46: ; preds = %43, %40
br label %47
47: ; preds = %46
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
%51 = call i32* @fopen(i8* %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
store i32* %51, i32** %6
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 2
%54 = load i8*, i8** %53
%55 = call i32 @atoi(i8* %54)
store i32 %55, i32* %16
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 3
%58 = load i8*, i8** %57
%59 = call i32 @atoi(i8* %58)
store i32 %59, i32* %17
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 4
%62 = load i8*, i8** %61
%63 = call i32 @atoi(i8* %62)
store i32 %63, i32* %18
store i32 1, i32* %13
br label %64
64: ; preds = %159, %47
%65 = load i32, i32* %13
%66 = load i32, i32* %16
%67 = icmp ule i32 %65, %66
br i1 %67, label %68, label %162
68: ; preds = %64
%69 = getelementptr inbounds [33 x i8], [33 x i8]* %10, i64 0, i64 0
%70 = load i32, i32* %13
%71 = call i32 @sprintf(i8* %69, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32 %70)
%72 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%73 = getelementptr inbounds [5 x i8], [5 x i8]* %11, i64 0, i64 0
%74 = call i32 @strcpy(i8* %72, i8* %73)
%75 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%76 = getelementptr inbounds [33 x i8], [33 x i8]* %10, i64 0, i64 0
%77 = call i32 @strcat(i8* %75, i8* %76)
%78 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%79 = call i32* @fopen(i8* %78, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
store i32* %79, i32** %7
%80 = load i32, i32* %13
%81 = icmp ugt i32 %80, 1
br i1 %81, label %82, label %84
82: ; preds = %68
%83 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
store i32* %83, i32** %8
br label %84
84: ; preds = %82, %68
store i32 0, i32* %14
br label %85
85: ; preds = %147, %84
%86 = load i32, i32* %14
%87 = load i32, i32* %18
%88 = icmp ule i32 %86, %87
br i1 %88, label %89, label %150
89: ; preds = %85
%90 = load i32, i32* %13
%91 = icmp eq i32 %90, 1
br i1 %91, label %92, label %110
92: ; preds = %89
%93 = load i32, i32* %14
%94 = icmp eq i32 %93, 0
br i1 %94, label %95, label %110
95: ; preds = %92
store i32 0, i32* %15
br label %96
96: ; preds = %106, %95
%97 = load i32, i32* %15
%98 = load i32, i32* %17
%99 = icmp ult i32 %97, %98
br i1 %99, label %100, label %109
100: ; preds = %96
%101 = load i32*, i32** %6
%102 = call i32 (i32*, i8*, ...) @fscanf(i32* %101, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0), [33 x i8]* %12)
%103 = load i32*, i32** %7
%104 = getelementptr inbounds [33 x i8], [33 x i8]* %12, i64 0, i64 0
%105 = call i32 (i32*, i8*, ...) @fprintf(i32* %103, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8* %104)
br label %106
106: ; preds = %100
%107 = load i32, i32* %15
%108 = add i32 %107, 1
store i32 %108, i32* %15
br label %96
109: ; preds = %96
br label %144
110: ; preds = %92, %89
%111 = load i32, i32* %14
%112 = icmp ne i32 %111, 0
br i1 %112, label %128, label %113
113: ; preds = %110
store i32 0, i32* %15
br label %114
114: ; preds = %124, %113
%115 = load i32, i32* %15
%116 = load i32, i32* %17
%117 = icmp ult i32 %115, %116
br i1 %117, label %118, label %127
118: ; preds = %114
%119 = load i32*, i32** %8
%120 = call i32 (i32*, i8*, ...) @fscanf(i32* %119, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0), [33 x i8]* %12)
%121 = load i32*, i32** %7
%122 = getelementptr inbounds [33 x i8], [33 x i8]* %12, i64 0, i64 0
%123 = call i32 (i32*, i8*, ...) @fprintf(i32* %121, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8* %122)
br label %124
124: ; preds = %118
%125 = load i32, i32* %15
%126 = add i32 %125, 1
store i32 %126, i32* %15
br label %114
127: ; preds = %114
br label %143
128: ; preds = %110
store i32 0, i32* %15
br label %129
129: ; preds = %139, %128
%130 = load i32, i32* %15
%131 = load i32, i32* %17
%132 = icmp ult i32 %130, %131
br i1 %132, label %133, label %142
133: ; preds = %129
%134 = load i32*, i32** %6
%135 = call i32 (i32*, i8*, ...) @fscanf(i32* %134, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), double* %19)
%136 = load i32*, i32** %7
%137 = load double, double* %19
%138 = call i32 (i32*, i8*, ...) @fprintf(i32* %136, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0), double %137)
br label %139
139: ; preds = %133
%140 = load i32, i32* %15
%141 = add i32 %140, 1
store i32 %141, i32* %15
br label %129
142: ; preds = %129
br label %143
143: ; preds = %142, %127
br label %144
144: ; preds = %143, %109
%145 = load i32*, i32** %7
%146 = call i32 (i32*, i8*, ...) @fprintf(i32* %145, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0))
br label %147
147: ; preds = %144
%148 = load i32, i32* %14
%149 = add i32 %148, 1
store i32 %149, i32* %14
br label %85
150: ; preds = %85
%151 = load i32*, i32** %7
%152 = call i32 @fclose(i32* %151)
%153 = load i32, i32* %13
%154 = icmp ugt i32 %153, 1
br i1 %154, label %155, label %158
155: ; preds = %150
%156 = load i32*, i32** %8
%157 = call i32 @fclose(i32* %156)
br label %158
158: ; preds = %155, %150
br label %159
159: ; preds = %158
%160 = load i32, i32* %13
%161 = add i32 %160, 1
store i32 %161, i32* %13
br label %64
162: ; preds = %64
%163 = load i32*, i32** %6
%164 = call i32 @fclose(i32* %163)
ret i32 1
}

LLVM IR (-O2):
@__const.main.name = [5 x i8] c"data\00"
@.str = [3 x i8] c"-h\00"
@.str.2 = [63 x i8] c"Breaks a data file into several. Useful when calculations for \00"
@.str.3 = [55 x i8] c"several planes\0Ain Z are done and need to be stored in \00"
@.str.5 = [64 x i8] c"Takes the filename to break as input 1 and the number of files \00"
@.str.6 = [61 x i8] c"to produce as\0Ainput 2, followed by the number of columns to \00"
@.str.7 = [65 x i8] c"read in the original file and\0Athe number of rows in each of the \00"
@.str.8 = [65 x i8] c"output data files. The files are saved as\0A'data1, data2,...' and\00"
@.str.11 = [29 x i8] c"Type './break -h' for help.\0A\00"
@.str.12 = [2 x i8] c"r\00"
@.str.13 = [3 x i8] c"%d\00"
@.str.14 = [2 x i8] c"w\00"
@.str.15 = [6 x i8] c"data1\00"
@.str.16 = [3 x i8] c"%s\00"
@.str.17 = [7 x i8] c"%s \00"
@.str.18 = [4 x i8] c"%le\00"
@.str.19 = [7 x i8] c"%le \00"
@str = [57 x i8] c"\0A\0ACorrect symtax is: ./break filename nFiles nCols nRows\00"
@str.21 = [50 x i8] c"\0A\0ACall as:\0A\0A\09./break filename nFiles nCols nRows\0A\00"
@str.22 = [54 x i8] c"independent files with only the X\0Aand Y information.\0A\00"
@str.23 = [27 x i8] c" saves columns (X,Y,Z,T).\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [32 x i8]
%4 = alloca [33 x i8]
%5 = alloca [5 x i8]
%6 = alloca [33 x i8]
%7 = alloca double
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [33 x i8], [33 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [33 x i8], [33 x i8]* %6, i64 0, i64 0
%12 = bitcast double* %7 to i8*
switch i32 %0, label %29 [
i32 2, label %13
i32 5, label %32
]
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %29
18: ; preds = %13
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.21, i64 0, i64 0))
%20 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0))
%21 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0))
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.22, i64 0, i64 0))
%23 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.5, i64 0, i64 0))
%24 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.6, i64 0, i64 0))
%25 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.7, i64 0, i64 0))
%26 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.8, i64 0, i64 0))
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.23, i64 0, i64 0))
%28 = tail call i32 @exit(i32 0)
unreachable
29: ; preds = %13, %2
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str, i64 0, i64 0))
%31 = tail call i32 @errorHandler(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0))
br label %32
32: ; preds = %2, %29
%33 = getelementptr inbounds i8*, i8** %1, i64 1
%34 = load i8*, i8** %33
%35 = tail call i32* @fopen(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%36 = getelementptr inbounds i8*, i8** %1, i64 2
%37 = load i8*, i8** %36
%38 = tail call i32 @atoi(i8* %37)
%39 = getelementptr inbounds i8*, i8** %1, i64 3
%40 = load i8*, i8** %39
%41 = tail call i32 @atoi(i8* %40)
%42 = getelementptr inbounds i8*, i8** %1, i64 4
%43 = load i8*, i8** %42
%44 = tail call i32 @atoi(i8* %43)
%45 = icmp eq i32 %38, 0
br i1 %45, label %99, label %46
46: ; preds = %32
%47 = icmp eq i32 %41, 0
br label %48
48: ; preds = %46, %96
%49 = phi i32* [ undef, %46 ], [ %59, %96 ]
%50 = phi i32 [ 1, %46 ], [ %97, %96 ]
%51 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32 %50)
%52 = call i32 @strcpy(i8* %8, i8* %10)
%53 = call i32 @strcat(i8* %8, i8* %9)
%54 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%55 = icmp ugt i32 %50, 1
br i1 %55, label %56, label %58
56: ; preds = %48
%57 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
br label %58
58: ; preds = %56, %48
%59 = phi i32* [ %57, %56 ], [ %49, %48 ]
%60 = icmp eq i32 %50, 1
br label %61
61: ; preds = %58, %88
%62 = phi i32 [ 0, %58 ], [ %90, %88 ]
%63 = icmp eq i32 %62, 0
%64 = select i1 %60, i1 %63, i1 false
br i1 %64, label %65, label %72
65: ; preds = %61
br i1 %47, label %88, label %66
66: ; preds = %65, %66
%67 = phi i32 [ %70, %66 ], [ 0, %65 ]
%68 = call i32 (i32*, i8*, ...) @fscanf(i32* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0), [33 x i8]* %6)
%69 = call i32 (i32*, i8*, ...) @fprintf(i32* %54, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8* %11)
%70 = add nuw i32 %67, 1
%71 = icmp eq i32 %70, %41
br i1 %71, label %88, label %66
72: ; preds = %61
br i1 %63, label %74, label %73
73: ; preds = %72
br i1 %47, label %88, label %81
74: ; preds = %72
br i1 %47, label %88, label %75
75: ; preds = %74, %75
%76 = phi i32 [ %79, %75 ], [ 0, %74 ]
%77 = call i32 (i32*, i8*, ...) @fscanf(i32* %59, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0), [33 x i8]* %6)
%78 = call i32 (i32*, i8*, ...) @fprintf(i32* %54, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8* %11)
%79 = add nuw i32 %76, 1
%80 = icmp eq i32 %79, %41
br i1 %80, label %88, label %75
81: ; preds = %73, %81
%82 = phi i32 [ %86, %81 ], [ 0, %73 ]
%83 = call i32 (i32*, i8*, ...) @fscanf(i32* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), double* %7)
%84 = load double, double* %7
%85 = call i32 (i32*, i8*, ...) @fprintf(i32* %54, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0), double %84)
%86 = add nuw i32 %82, 1
%87 = icmp eq i32 %86, %41
br i1 %87, label %88, label %81
88: ; preds = %81, %75, %66, %73, %74, %65
%89 = call i32 @fputc(i32 10, i32* %54)
%90 = add i32 %62, 1
%91 = icmp ugt i32 %90, %44
br i1 %91, label %92, label %61
92: ; preds = %88
%93 = call i32 @fclose(i32* %54)
br i1 %55, label %94, label %96
94: ; preds = %92
%95 = call i32 @fclose(i32* %59)
br label %96
96: ; preds = %92, %94
%97 = add i32 %50, 1
%98 = icmp ugt i32 %97, %38
br i1 %98, label %99, label %48
99: ; preds = %96, %32
%100 = call i32 @fclose(i32* %35)
ret i32 1
}