#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\nSYNTAX\nbreak filename nFiles nCols nRows\n\n");
    printf("DESCRIPTION\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");
    printf("EXAMPLE\n");
    printf("break potential.dat 4 5 400\n\n");
    printf("Breaks the file 'potential.dat', which has 1600 rows, into 4 ");
    printf("files, each\nof them with 5 columns (same number as the input");
    printf(" file) and 400 rows of\ndata.\n\n");
    exit(0);
  } else if (argc != 5) {
    printf("\n\nError: Incorrect syntax\n\nTry: break filename nFiles nCols "
           "nRows\n");
    errorHandler("or 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, "%u", 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 0;
}


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    12d4 <main+0x114>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdfb(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    12d4 <main+0x114>
lea    0xde8(%rip),%rdi
call   1050 <printf@plt>
lea    0xe09(%rip),%rdi
call   1050 <printf@plt>
lea    0xe0a(%rip),%rdi
call   1050 <printf@plt>
lea    0xe3d(%rip),%rdi
call   1050 <printf@plt>
lea    0xe68(%rip),%rdi
call   1050 <printf@plt>
lea    0xe93(%rip),%rdi
call   1050 <printf@plt>
lea    0xec7(%rip),%rdi
call   1050 <printf@plt>
lea    0xef8(%rip),%rdi
call   1050 <printf@plt>
lea    0xf2d(%rip),%rdi
call   1050 <printf@plt>
lea    0xf62(%rip),%rdi
call   1050 <printf@plt>
lea    0xf72(%rip),%rdi
call   1050 <printf@plt>
lea    0xf6f(%rip),%rdi
call   1050 <printf@plt>
lea    0xf81(%rip),%rdi
call   1050 <printf@plt>
lea    0xfb3(%rip),%rdi
call   1050 <printf@plt>
lea    0xfe4(%rip),%rdi
call   1050 <printf@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
cmpl   $0x5,-0x8(%rbp)
je     12f6 <main+0x136>
lea    0xfe6(%rip),%rdi
call   1050 <printf@plt>
lea    0x101d(%rip),%rdi
call   10e0 <errorHandler@plt>
jmp    12fb <main+0x13b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0x1022(%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     15af <main+0x3ef>
lea    -0x80(%rbp),%rdi
mov    -0xb4(%rbp),%edx
lea    0xfb5(%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    0xf8b(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpl   $0x1,-0xb4(%rbp)
jbe    13d3 <main+0x213>
lea    0xf70(%rip),%rdi
lea    0xf62(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0xb8(%rbp)
mov    -0xb8(%rbp),%eax
cmp    -0xc8(%rbp),%eax
ja     1577 <main+0x3b7>
cmpl   $0x1,-0xb4(%rbp)
jne    1470 <main+0x2b0>
cmpl   $0x0,-0xb8(%rbp)
jne    1470 <main+0x2b0>
movl   $0x0,-0xbc(%rbp)
mov    -0xbc(%rbp),%eax
cmp    -0xc4(%rbp),%eax
jae    146b <main+0x2ab>
mov    -0x18(%rbp),%rdi
lea    -0xb0(%rbp),%rdx
lea    0xf02(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x20(%rbp),%rdi
lea    -0xb0(%rbp),%rdx
lea    0xeec(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
jmp    1413 <main+0x253>
jmp    1551 <main+0x391>
cmpl   $0x0,-0xb8(%rbp)
jne    14e4 <main+0x324>
movl   $0x0,-0xbc(%rbp)
mov    -0xbc(%rbp),%eax
cmp    -0xc4(%rbp),%eax
jae    14df <main+0x31f>
mov    -0x28(%rbp),%rdi
lea    -0xb0(%rbp),%rdx
lea    0xe8e(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x20(%rbp),%rdi
lea    -0xb0(%rbp),%rdx
lea    0xe78(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
jmp    1487 <main+0x2c7>
jmp    154c <main+0x38c>
movl   $0x0,-0xbc(%rbp)
mov    -0xbc(%rbp),%eax
cmp    -0xc4(%rbp),%eax
jae    1547 <main+0x387>
mov    -0x18(%rbp),%rdi
lea    0xe38(%rip),%rsi
lea    -0xd0(%rbp),%rdx
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x20(%rbp),%rdi
movsd  -0xd0(%rbp),%xmm0
ff
lea    0xe1b(%rip),%rsi
mov    $0x1,%al
call   1080 <fprintf@plt>
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
jmp    14ee <main+0x32e>
jmp    154c <main+0x38c>
jmp    1551 <main+0x391>
mov    -0x20(%rbp),%rdi
lea    0xcac(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    13dd <main+0x21d>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
cmpl   $0x1,-0xb4(%rbp)
jbe    1596 <main+0x3d6>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
jmp    159b <main+0x3db>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    1356 <main+0x196>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%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     145c <main+0x27c>
lea    0x100d(%rip),%rdi
call   1040 <puts@plt>
lea    0xfc1(%rip),%rdi
call   1100 <errorHandler@plt>
mov    0x8(%r14),%rdi
lea    0xfcf(%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    0xf69(%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    0xf3e(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%r12
cmp    $0x2,%ebp
jb     1302 <main+0x122>
lea    0xf2c(%rip),%rdi
lea    0xf1e(%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    0xec9(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    %r12,%rdi
lea    0xeb8(%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    0xe93(%rip),%rsi
lea    0x28(%rsp),%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
movsd  0x28(%rsp),%xmm0
mov    %r12,%rdi
lea    0xe7b(%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    0xe37(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    %r12,%rdi
lea    0xe26(%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>
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe17(%rip),%rdi
call   1040 <puts@plt>
lea    0xe37(%rip),%rdi
call   1040 <puts@plt>
lea    0xb8d(%rip),%rdi
call   1060 <printf@plt>
lea    0xbc0(%rip),%rdi
call   1060 <printf@plt>
lea    0xe1f(%rip),%rdi
call   1040 <puts@plt>
lea    0xbdf(%rip),%rdi
call   1060 <printf@plt>
lea    0xc13(%rip),%rdi
call   1060 <printf@plt>
lea    0xc44(%rip),%rdi
call   1060 <printf@plt>
lea    0xc79(%rip),%rdi
call   1060 <printf@plt>
lea    0xe19(%rip),%rdi
call   1040 <puts@plt>
lea    0xe28(%rip),%rdi
call   1040 <puts@plt>
lea    0xe24(%rip),%rdi
call   1040 <puts@plt>
lea    0xc8a(%rip),%rdi
call   1060 <printf@plt>
lea    0xcbc(%rip),%rdi
call   1060 <printf@plt>
lea    0xe1d(%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 = [45 x i8] c"\0A\0ASYNTAX\0Abreak filename nFiles nCols nRows\0A\0A\00"
@.str.2 = [13 x i8] c"DESCRIPTION\0A\00"
@.str.3 = [63 x i8] c"Breaks a data file into several. Useful when calculations for \00"
@.str.4 = [55 x i8] c"several planes\0Ain Z are done and need to be stored in \00"
@.str.5 = [55 x i8] c"independent files with only the X\0Aand Y information.\0A\0A\00"
@.str.6 = [64 x i8] c"Takes the filename to break as input 1 and the number of files \00"
@.str.7 = [61 x i8] c"to produce as\0Ainput 2, followed by the number of columns to \00"
@.str.8 = [65 x i8] c"read in the original file and\0Athe number of rows in each of the \00"
@.str.9 = [65 x i8] c"output data files. The files are saved as\0A'data1, data2,...' and\00"
@.str.10 = [28 x i8] c" saves columns (X,Y,Z,T).\0A\0A\00"
@.str.11 = [9 x i8] c"EXAMPLE\0A\00"
@.str.12 = [30 x i8] c"break potential.dat 4 5 400\0A\0A\00"
@.str.13 = [62 x i8] c"Breaks the file 'potential.dat', which has 1600 rows, into 4 \00"
@.str.14 = [61 x i8] c"files, each\0Aof them with 5 columns (same number as the input\00"
@.str.15 = [31 x i8] c" file) and 400 rows of\0Adata.\0A\0A\00"
@.str.16 = [67 x i8] c"\0A\0AError: Incorrect syntax\0A\0ATry: break filename nFiles nCols nRows\0A\00"
@.str.17 = [30 x i8] c"or type 'break -h' for help.\0A\00"
@.str.18 = [2 x i8] c"r\00"
@.str.19 = [3 x i8] c"%u\00"
@.str.20 = [2 x i8] c"w\00"
@.str.21 = [6 x i8] c"data1\00"
@.str.22 = [3 x i8] c"%s\00"
@.str.23 = [7 x i8] c"%s \00"
@.str.24 = [4 x i8] c"%le\00"
@.str.25 = [7 x i8] c"%le \00"
@.str.26 = [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 %46
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 %46
29: ; preds = %23
%30 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%31 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%32 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 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 ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
%35 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.6, i64 0, i64 0))
%36 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 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 ([65 x i8], [65 x i8]* @.str.9, i64 0, i64 0))
%39 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0))
%40 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%41 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0))
%42 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.13, i64 0, i64 0))
%43 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.14, i64 0, i64 0))
%44 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.15, i64 0, i64 0))
%45 = call i32 @exit(i32 0)
unreachable
46: ; preds = %23, %2
%47 = load i32, i32* %4
%48 = icmp ne i32 %47, 5
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.16, i64 0, i64 0))
%51 = call i32 @errorHandler(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.17, i64 0, i64 0))
br label %52
52: ; preds = %49, %46
br label %53
53: ; preds = %52
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 1
%56 = load i8*, i8** %55
%57 = call i32* @fopen(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i64 0, i64 0))
store i32* %57, i32** %6
%58 = load i8**, i8*** %5
%59 = getelementptr inbounds i8*, i8** %58, i64 2
%60 = load i8*, i8** %59
%61 = call i32 @atoi(i8* %60)
store i32 %61, i32* %16
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 3
%64 = load i8*, i8** %63
%65 = call i32 @atoi(i8* %64)
store i32 %65, i32* %17
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 4
%68 = load i8*, i8** %67
%69 = call i32 @atoi(i8* %68)
store i32 %69, i32* %18
store i32 1, i32* %13
br label %70
70: ; preds = %167, %53
%71 = load i32, i32* %13
%72 = load i32, i32* %16
%73 = icmp ule i32 %71, %72
br i1 %73, label %74, label %170
74: ; preds = %70
%75 = getelementptr inbounds [33 x i8], [33 x i8]* %10, i64 0, i64 0
%76 = load i32, i32* %13
%77 = call i32 @sprintf(i8* %75, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i64 0, i64 0), i32 %76)
%78 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%79 = getelementptr inbounds [5 x i8], [5 x i8]* %11, i64 0, i64 0
%80 = call i32 @strcpy(i8* %78, i8* %79)
%81 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%82 = getelementptr inbounds [33 x i8], [33 x i8]* %10, i64 0, i64 0
%83 = call i32 @strcat(i8* %81, i8* %82)
%84 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%85 = call i32* @fopen(i8* %84, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0))
store i32* %85, i32** %7
%86 = load i32, i32* %13
%87 = icmp ugt i32 %86, 1
br i1 %87, label %88, label %90
88: ; preds = %74
%89 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i64 0, i64 0))
store i32* %89, i32** %8
br label %90
90: ; preds = %88, %74
store i32 0, i32* %14
br label %91
91: ; preds = %155, %90
%92 = load i32, i32* %14
%93 = load i32, i32* %18
%94 = icmp ule i32 %92, %93
br i1 %94, label %95, label %158
95: ; preds = %91
%96 = load i32, i32* %13
%97 = icmp eq i32 %96, 1
br i1 %97, label %98, label %117
98: ; preds = %95
%99 = load i32, i32* %14
%100 = icmp eq i32 %99, 0
br i1 %100, label %101, label %117
101: ; preds = %98
store i32 0, i32* %15
br label %102
102: ; preds = %113, %101
%103 = load i32, i32* %15
%104 = load i32, i32* %17
%105 = icmp ult i32 %103, %104
br i1 %105, label %106, label %116
106: ; preds = %102
%107 = load i32*, i32** %6
%108 = getelementptr inbounds [33 x i8], [33 x i8]* %12, i64 0, i64 0
%109 = call i32 (i32*, i8*, ...) @fscanf(i32* %107, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0), i8* %108)
%110 = load i32*, i32** %7
%111 = getelementptr inbounds [33 x i8], [33 x i8]* %12, i64 0, i64 0
%112 = call i32 (i32*, i8*, ...) @fprintf(i32* %110, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.23, i64 0, i64 0), i8* %111)
br label %113
113: ; preds = %106
%114 = load i32, i32* %15
%115 = add i32 %114, 1
store i32 %115, i32* %15
br label %102
116: ; preds = %102
br label %152
117: ; preds = %98, %95
%118 = load i32, i32* %14
%119 = icmp ne i32 %118, 0
br i1 %119, label %136, label %120
120: ; preds = %117
store i32 0, i32* %15
br label %121
121: ; preds = %132, %120
%122 = load i32, i32* %15
%123 = load i32, i32* %17
%124 = icmp ult i32 %122, %123
br i1 %124, label %125, label %135
125: ; preds = %121
%126 = load i32*, i32** %8
%127 = getelementptr inbounds [33 x i8], [33 x i8]* %12, i64 0, i64 0
%128 = call i32 (i32*, i8*, ...) @fscanf(i32* %126, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0), i8* %127)
%129 = load i32*, i32** %7
%130 = getelementptr inbounds [33 x i8], [33 x i8]* %12, i64 0, i64 0
%131 = call i32 (i32*, i8*, ...) @fprintf(i32* %129, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.23, i64 0, i64 0), i8* %130)
br label %132
132: ; preds = %125
%133 = load i32, i32* %15
%134 = add i32 %133, 1
store i32 %134, i32* %15
br label %121
135: ; preds = %121
br label %151
136: ; preds = %117
store i32 0, i32* %15
br label %137
137: ; preds = %147, %136
%138 = load i32, i32* %15
%139 = load i32, i32* %17
%140 = icmp ult i32 %138, %139
br i1 %140, label %141, label %150
141: ; preds = %137
%142 = load i32*, i32** %6
%143 = call i32 (i32*, i8*, ...) @fscanf(i32* %142, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.24, i64 0, i64 0), double* %19)
%144 = load i32*, i32** %7
%145 = load double, double* %19
%146 = call i32 (i32*, i8*, ...) @fprintf(i32* %144, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.25, i64 0, i64 0), double %145)
br label %147
147: ; preds = %141
%148 = load i32, i32* %15
%149 = add i32 %148, 1
store i32 %149, i32* %15
br label %137
150: ; preds = %137
br label %151
151: ; preds = %150, %135
br label %152
152: ; preds = %151, %116
%153 = load i32*, i32** %7
%154 = call i32 (i32*, i8*, ...) @fprintf(i32* %153, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.26, i64 0, i64 0))
br label %155
155: ; preds = %152
%156 = load i32, i32* %14
%157 = add i32 %156, 1
store i32 %157, i32* %14
br label %91
158: ; preds = %91
%159 = load i32*, i32** %7
%160 = call i32 @fclose(i32* %159)
%161 = load i32, i32* %13
%162 = icmp ugt i32 %161, 1
br i1 %162, label %163, label %166
163: ; preds = %158
%164 = load i32*, i32** %8
%165 = call i32 @fclose(i32* %164)
br label %166
166: ; preds = %163, %158
br label %167
167: ; preds = %166
%168 = load i32, i32* %13
%169 = add i32 %168, 1
store i32 %169, i32* %13
br label %70
170: ; preds = %70
%171 = load i32*, i32** %6
%172 = call i32 @fclose(i32* %171)
ret i32 0
}

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