#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 uint8_t;
typedef int uint32_t;
typedef void *off_t;
typedef int /*<<< orphan*/ argBuf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
char **alloc_array(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(char **);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
void *ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ *stdout;
int /*<<< orphan*/ strncpy(char *, char *, unsigned long);
int main() {
  FILE *fd = NULL;
  FILE *out = NULL;
  if ((fd = fopen("pedestal_ramp.script", "r")) < 0) {
    fprintf(stderr, "unable to open file\n");
    exit(-1);
  }
  if ((out = fopen("out.txt", "w")) < 0) {
    fprintf(stderr, "unable to open file\n");
    exit(-1);
  }
  off_t fileSize;
  fseek(fd, 0, SEEK_END);
  fileSize = ftell(fd);
  rewind(fd);
  fprintf(stdout, "fileSize: %d\n", (uint32_t)fileSize);
  int kar, space_kar;
  uint32_t newline_count = 0;
  unsigned long karteller = 0;
  uint32_t strengteller = 0;
  uint32_t biggest = 0;
  uint32_t storkar = 0;
  uint8_t comment = 0;
  uint32_t current_pos = 0;
  uint32_t last_pos = ftell(fd);
  while ((kar = fgetc(fd)) != EOF) {
    if (kar == '#')
      comment = 1;
    if ((kar != ' ') && (!comment) && (kar != '\r')) {
      karteller++;
      space_kar = 0;
    }
    if ((kar == ' ') && (!comment)) {
      if (space_kar < 1) {
        strengteller++;
      }
      ++space_kar;
      if (karteller > storkar)
        storkar = karteller;
      karteller = 0;
    }
    if (kar == '\n') {
      strengteller++;
      newline_count++;
      if (strengteller > biggest)
        biggest = strengteller;
      strengteller = 0;
      karteller = 0;
      comment = 0;
      current_pos = ftell(fd);
      char vikar[storkar];
      char **argBuf;
      argBuf = alloc_array(biggest);
      fseek(fd, last_pos, SEEK_SET);
      last_pos = current_pos;
      while ((kar = fgetc(fd)) != '\n') {
        if (kar == '#')
          comment = 1;
        if ((kar != ' ') && (!comment) && (kar != '\r')) {
          vikar[karteller] = kar;
          karteller++;
        }
        if ((kar == ' ') && (!comment)) {
          strncpy(argBuf[strengteller], vikar, karteller);
          strengteller++;
          karteller = 0;
          vikar[0] = '\0';
        }
      }
      strncpy(argBuf[strengteller], vikar, karteller);
      fseek(fd, last_pos, SEEK_SET);
      int b;
      for (b = 0; b != biggest; b++) {
        fprintf(stdout, "a[%d]: %s ", b, argBuf[b]);
        fprintf(out, "a[%d]: %s ", b, argBuf[b]);
      }
      fprintf(stdout, "size: %lu", sizeof(argBuf));
      fprintf(stdout, "\n");
      fprintf(out, "\n");
      biggest = 0;
      storkar = 0;
      karteller = 0;
      comment = 0;
      strengteller = 0;
      free(argBuf);
    }
  }
  if (fd >= 0) {
    fclose(fd);
  }
  if (out >= 0) {
    fclose(out);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    0xe27(%rip),%rdi
lea    0xe35(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jae    1215 <main+0x65>
mov    0x2dd6(%rip),%rax
mov    (%rax),%rdi
lea    0xe13(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>
lea    0xe10(%rip),%rdi
lea    0xe11(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jae    1258 <main+0xa8>
mov    0x2d93(%rip),%rax
mov    (%rax),%rdi
lea    0xdd0(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rdi
mov    0x2d85(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <ftell@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <rewind@plt>
mov    0x2d37(%rip),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rax
mov    %eax,%edx
lea    0xd9d(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x2c(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x10(%rbp),%rdi
call   10a0 <ftell@plt>
mov    %eax,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <fgetc@plt>
mov    %eax,-0x24(%rbp)
mov    0x2cef(%rip),%rcx
cmp    (%rcx),%eax
je     15e9 <main+0x439>
cmpl   $0x23,-0x24(%rbp)
jne    130a <main+0x15a>
movl   $0x1,-0x48(%rbp)
cmpl   $0x20,-0x24(%rbp)
je     133b <main+0x18b>
cmpl   $0x0,-0x48(%rbp)
jne    133b <main+0x18b>
cmpl   $0xd,-0x24(%rbp)
je     133b <main+0x18b>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x20,-0x24(%rbp)
jne    138b <main+0x1db>
cmpl   $0x0,-0x48(%rbp)
jne    138b <main+0x1db>
cmpl   $0x1,-0x28(%rbp)
jge    1362 <main+0x1b2>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
cmp    %rcx,%rax
jbe    1383 <main+0x1d3>
mov    -0x38(%rbp),%rax
mov    %eax,-0x44(%rbp)
movq   $0x0,-0x38(%rbp)
cmpl   $0xa,-0x24(%rbp)
jne    15e4 <main+0x434>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x40(%rbp),%eax
jle    13b9 <main+0x209>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x40(%rbp)
movl   $0x0,-0x3c(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
call   10a0 <ftell@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x44(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x78(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x60(%rbp)
mov    -0x40(%rbp),%edi
call   1060 <alloc_array@plt>
mov    %rax,-0x68(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x50(%rbp),%esi
mov    0x2bad(%rip),%rax
mov    (%rax),%edx
call   10b0 <fseek@plt>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <fgetc@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xa,%eax
je     14d2 <main+0x322>
cmpl   $0x23,-0x24(%rbp)
jne    144e <main+0x29e>
movl   $0x1,-0x48(%rbp)
cmpl   $0x20,-0x24(%rbp)
je     1488 <main+0x2d8>
cmpl   $0x0,-0x48(%rbp)
jne    1488 <main+0x2d8>
cmpl   $0xd,-0x24(%rbp)
je     1488 <main+0x2d8>
mov    -0x78(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    %cl,%dl
mov    -0x38(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
cmpl   $0x20,-0x24(%rbp)
jne    14cd <main+0x31d>
cmpl   $0x0,-0x48(%rbp)
jne    14cd <main+0x31d>
mov    -0x78(%rbp),%rsi
mov    -0x68(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x38(%rbp),%rdx
call   1040 <strncpy@plt>
mov    -0x78(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x3c(%rbp)
movq   $0x0,-0x38(%rbp)
movb   $0x0,(%rax)
jmp    1428 <main+0x278>
mov    -0x78(%rbp),%rsi
mov    -0x68(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x38(%rbp),%rdx
call   1040 <strncpy@plt>
mov    -0x10(%rbp),%rdi
mov    -0x50(%rbp),%esi
mov    0x2acf(%rip),%rax
mov    (%rax),%edx
call   10b0 <fseek@plt>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x40(%rbp),%eax
je     1569 <main+0x3b9>
mov    0x2aa6(%rip),%rax
mov    (%rax),%rdi
mov    -0x6c(%rbp),%edx
mov    -0x68(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xb11(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x6c(%rbp),%edx
mov    -0x68(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xaf0(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1507 <main+0x357>
mov    0x2a50(%rip),%rax
mov    (%rax),%rdi
lea    0xad5(%rip),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2a33(%rip),%rax
mov    (%rax),%rdi
lea    0xaab(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xa99(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rax
mov    %rax,%rsp
jmp    12de <main+0x12e>
cmpq   $0x0,-0x10(%rbp)
jb     15fd <main+0x44d>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
cmpq   $0x0,-0x18(%rbp)
jb     1611 <main+0x461>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xe38(%rip),%rdi
lea    0xe46(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,%r14
lea    0xe39(%rip),%rdi
lea    0xe3a(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x40(%rbp)
mov    0x2df3(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
xor    %esi,%esi
call   10c0 <fseek@plt>
mov    %r14,%rdi
call   10b0 <ftell@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1070 <rewind@plt>
mov    0x2dad(%rip),%rax
mov    (%rax),%rdi
lea    0xdfc(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %r14,%rdi
call   10b0 <ftell@plt>
mov    %rax,%r13
mov    %r14,%rdi
call   1080 <fgetc@plt>
mov    0x2d98(%rip),%rcx
cmp    (%rcx),%eax
jne    126e <main+0xbe>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    -0x40(%rbp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r15d,%r15d
xor    %r12d,%r12d
xor    %ecx,%ecx
mov    %rcx,-0x30(%rbp)
xor    %ebx,%ebx
mov    %r14,-0x50(%rbp)
jmp    12c9 <main+0x119>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
test   %edx,%edx
setle  %al
mov    -0x30(%rbp),%rcx
add    %eax,%ecx
mov    %rcx,-0x30(%rbp)
add    $0x1,%edx
mov    %edx,-0x38(%rbp)
movslq %r12d,%rax
cmp    %rax,%rbx
cmova  %ebx,%r12d
xor    %ebx,%ebx
xor    %r15d,%r15d
mov    %r14,%rdi
call   1080 <fgetc@plt>
mov    0x2d1b(%rip),%rcx
cmp    (%rcx),%eax
je     124c <main+0x9c>
mov    %rbx,%rsi
cmp    $0x23,%eax
mov    $0x1,%ecx
cmove  %ecx,%r15d
cmp    $0x20,%eax
sete   %dl
test   %r15d,%r15d
setne  %bl
cmp    $0xd,%eax
sete   %cl
or     %dl,%cl
or     %bl,%cl
mov    -0x38(%rbp),%edx
mov    $0x0,%edi
cmove  %edi,%edx
xor    $0x1,%cl
movzbl %cl,%ebx
add    %rsi,%rbx
cmp    $0x20,%eax
jne    130c <main+0x15c>
test   %r15d,%r15d
je     1290 <main+0xe0>
mov    %edx,-0x38(%rbp)
cmp    $0xa,%eax
jne    12b6 <main+0x106>
mov    -0x30(%rbp),%rcx
lea    0x1(%rcx),%ebx
xor    %eax,%eax
test   %ecx,%ecx
movl   $0x0,-0x34(%rbp)
cmovs  %eax,%ebx
mov    %r14,%rdi
call   10b0 <ftell@plt>
mov    %rax,-0x48(%rbp)
mov    %rsp,-0x58(%rbp)
mov    %r12d,%eax
mov    %ebx,%r12d
mov    %rsp,%rcx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %ebx,%edi
call   1060 <alloc_array@plt>
mov    %rax,%r15
mov    0x2c6b(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    %r13d,%esi
call   10c0 <fseek@plt>
xor    %r13d,%r13d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1080 <fgetc@plt>
cmp    $0xa,%eax
je     13f0 <main+0x240>
cmp    $0x23,%eax
je     1399 <main+0x1e9>
test   $0x1,%bl
jne    1380 <main+0x1d0>
jmp    13a0 <main+0x1f0>
mov    $0x1,%bl
jmp    1380 <main+0x1d0>
nopl   (%rax)
cmp    $0xd,%eax
je     13b6 <main+0x206>
cmp    $0x20,%eax
je     13b6 <main+0x206>
mov    -0x30(%rbp),%rcx
mov    %al,(%rcx,%r13,1)
add    $0x1,%r13
cmp    $0x20,%eax
setne  %al
or     %al,%bl
test   $0x1,%bl
jne    1375 <main+0x1c5>
mov    -0x34(%rbp),%ebx
mov    %ebx,%eax
mov    (%r15,%rax,8),%rdi
mov    -0x30(%rbp),%rsi
mov    %r13,%rdx
call   1040 <strncpy@plt>
add    $0x1,%ebx
mov    %ebx,-0x34(%rbp)
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
jmp    1372 <main+0x1c2>
nopw   0x0(%rax,%rax,1)
mov    -0x34(%rbp),%eax
mov    (%r15,%rax,8),%rdi
mov    -0x30(%rbp),%rsi
mov    %r13,%rdx
call   1040 <strncpy@plt>
mov    0x2bc6(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    -0x48(%rbp),%rsi
call   10c0 <fseek@plt>
test   %r12d,%r12d
mov    %r12d,%eax
mov    0x2ba3(%rip),%rcx
lea    0xc03(%rip),%r14
mov    %r15,%r12
je     1476 <main+0x2c6>
mov    %eax,%r13d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%rcx),%rdi
mov    %rcx,%r15
mov    (%r12,%rbx,8),%rcx
mov    %r14,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    (%r12,%rbx,8),%rcx
mov    -0x40(%rbp),%rdi
mov    %r14,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %r15,%rcx
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1440 <main+0x290>
mov    (%rcx),%rdi
xor    %ebx,%ebx
mov    $0x8,%edx
lea    0xbb3(%rip),%rsi
xor    %eax,%eax
mov    %rcx,%r14
call   10a0 <fprintf@plt>
mov    (%r14),%rsi
mov    $0xa,%edi
call   1090 <fputc@plt>
mov    $0xa,%edi
mov    -0x40(%rbp),%rsi
call   1090 <fputc@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rsp
xor    %eax,%eax
mov    %rax,-0x30(%rbp)
xor    %r12d,%r12d
xor    %r15d,%r15d
mov    -0x50(%rbp),%r14
mov    -0x48(%rbp),%r13
jmp    12b6 <main+0x106>

LLVM IR (-O0):
@.str = [21 x i8] c"pedestal_ramp.script\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32* null
@.str.2 = [21 x i8] c"unable to open file\0A\00"
@.str.3 = [8 x i8] c"out.txt\00"
@.str.4 = [2 x i8] c"w\00"
@SEEK_END = global i32 0
@stdout = global i32* null
@.str.5 = [14 x i8] c"fileSize: %d\0A\00"
@EOF = global i32 0
@SEEK_SET = global i32 0
@.str.6 = [11 x i8] c"a[%d]: %s \00"
@.str.7 = [10 x i8] c"size: %lu\00"
@.str.8 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i8**
%18 = alloca i32
store i32 0, i32* %1
store i32* null, i32** %2
store i32* null, i32** %3
%19 = call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %19, i32** %2
%20 = icmp ult i32* %19, null
br i1 %20, label %21, label %25
21: ; preds = %0
%22 = load i32*, i32** @stderr
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 @exit(i32 -1)
unreachable
25: ; preds = %0
%26 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %26, i32** %3
%27 = icmp ult i32* %26, null
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = load i32*, i32** @stderr
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 @exit(i32 -1)
unreachable
32: ; preds = %25
%33 = load i32*, i32** %2
%34 = load i32, i32* @SEEK_END
%35 = call i32 @fseek(i32* %33, i32 0, i32 %34)
%36 = load i32*, i32** %2
%37 = call i8* @ftell(i32* %36)
store i8* %37, i8** %4
%38 = load i32*, i32** %2
%39 = call i32 @rewind(i32* %38)
%40 = load i32*, i32** @stdout
%41 = load i8*, i8** %4
%42 = ptrtoint i8* %41 to i32
%43 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %42)
store i32 0, i32* %7
store i64 0, i64* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
%44 = load i32*, i32** %2
%45 = call i8* @ftell(i32* %44)
%46 = ptrtoint i8* %45 to i32
store i32 %46, i32* %14
br label %47
47: ; preds = %207, %32
%48 = load i32*, i32** %2
%49 = call i32 @fgetc(i32* %48)
store i32 %49, i32* %5
%50 = load i32, i32* @EOF
%51 = icmp ne i32 %49, %50
br i1 %51, label %52, label %208
52: ; preds = %47
%53 = load i32, i32* %5
%54 = icmp eq i32 %53, 35
br i1 %54, label %55, label %56
55: ; preds = %52
store i32 1, i32* %12
br label %56
56: ; preds = %55, %52
%57 = load i32, i32* %5
%58 = icmp ne i32 %57, 32
br i1 %58, label %59, label %68
59: ; preds = %56
%60 = load i32, i32* %12
%61 = icmp ne i32 %60, 0
br i1 %61, label %68, label %62
62: ; preds = %59
%63 = load i32, i32* %5
%64 = icmp ne i32 %63, 13
br i1 %64, label %65, label %68
65: ; preds = %62
%66 = load i64, i64* %8
%67 = add i64 %66, 1
store i64 %67, i64* %8
store i32 0, i32* %6
br label %68
68: ; preds = %65, %62, %59, %56
%69 = load i32, i32* %5
%70 = icmp eq i32 %69, 32
br i1 %70, label %71, label %91
71: ; preds = %68
%72 = load i32, i32* %12
%73 = icmp ne i32 %72, 0
br i1 %73, label %91, label %74
74: ; preds = %71
%75 = load i32, i32* %6
%76 = icmp slt i32 %75, 1
br i1 %76, label %77, label %80
77: ; preds = %74
%78 = load i32, i32* %9
%79 = add nsw i32 %78, 1
store i32 %79, i32* %9
br label %80
80: ; preds = %77, %74
%81 = load i32, i32* %6
%82 = add nsw i32 %81, 1
store i32 %82, i32* %6
%83 = load i64, i64* %8
%84 = load i32, i32* %11
%85 = sext i32 %84 to i64
%86 = icmp ugt i64 %83, %85
br i1 %86, label %87, label %90
87: ; preds = %80
%88 = load i64, i64* %8
%89 = trunc i64 %88 to i32
store i32 %89, i32* %11
br label %90
90: ; preds = %87, %80
store i64 0, i64* %8
br label %91
91: ; preds = %90, %71, %68
%92 = load i32, i32* %5
%93 = icmp eq i32 %92, 10
br i1 %93, label %94, label %207
94: ; preds = %91
%95 = load i32, i32* %9
%96 = add nsw i32 %95, 1
store i32 %96, i32* %9
%97 = load i32, i32* %7
%98 = add nsw i32 %97, 1
store i32 %98, i32* %7
%99 = load i32, i32* %9
%100 = load i32, i32* %10
%101 = icmp sgt i32 %99, %100
br i1 %101, label %102, label %104
102: ; preds = %94
%103 = load i32, i32* %9
store i32 %103, i32* %10
br label %104
104: ; preds = %102, %94
store i32 0, i32* %9
store i64 0, i64* %8
store i32 0, i32* %12
%105 = load i32*, i32** %2
%106 = call i8* @ftell(i32* %105)
%107 = ptrtoint i8* %106 to i32
store i32 %107, i32* %13
%108 = load i32, i32* %11
%109 = zext i32 %108 to i64
%110 = call i8* @llvm.stacksave()
store i8* %110, i8** %15
%111 = alloca i8, i64 %109
store i64 %109, i64* %16
%112 = load i32, i32* %10
%113 = call i8** @alloc_array(i32 %112)
store i8** %113, i8*** %17
%114 = load i32*, i32** %2
%115 = load i32, i32* %14
%116 = load i32, i32* @SEEK_SET
%117 = call i32 @fseek(i32* %114, i32 %115, i32 %116)
%118 = load i32, i32* %13
store i32 %118, i32* %14
br label %119
119: ; preds = %160, %104
%120 = load i32*, i32** %2
%121 = call i32 @fgetc(i32* %120)
store i32 %121, i32* %5
%122 = icmp ne i32 %121, 10
br i1 %122, label %123, label %161
123: ; preds = %119
%124 = load i32, i32* %5
%125 = icmp eq i32 %124, 35
br i1 %125, label %126, label %127
126: ; preds = %123
store i32 1, i32* %12
br label %127
127: ; preds = %126, %123
%128 = load i32, i32* %5
%129 = icmp ne i32 %128, 32
br i1 %129, label %130, label %143
130: ; preds = %127
%131 = load i32, i32* %12
%132 = icmp ne i32 %131, 0
br i1 %132, label %143, label %133
133: ; preds = %130
%134 = load i32, i32* %5
%135 = icmp ne i32 %134, 13
br i1 %135, label %136, label %143
136: ; preds = %133
%137 = load i32, i32* %5
%138 = trunc i32 %137 to i8
%139 = load i64, i64* %8
%140 = getelementptr inbounds i8, i8* %111, i64 %139
store i8 %138, i8* %140
%141 = load i64, i64* %8
%142 = add i64 %141, 1
store i64 %142, i64* %8
br label %143
143: ; preds = %136, %133, %130, %127
%144 = load i32, i32* %5
%145 = icmp eq i32 %144, 32
br i1 %145, label %146, label %160
146: ; preds = %143
%147 = load i32, i32* %12
%148 = icmp ne i32 %147, 0
br i1 %148, label %160, label %149
149: ; preds = %146
%150 = load i8**, i8*** %17
%151 = load i32, i32* %9
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds i8*, i8** %150, i64 %152
%154 = load i8*, i8** %153
%155 = load i64, i64* %8
%156 = call i32 @strncpy(i8* %154, i8* %111, i64 %155)
%157 = load i32, i32* %9
%158 = add nsw i32 %157, 1
store i32 %158, i32* %9
store i64 0, i64* %8
%159 = getelementptr inbounds i8, i8* %111, i64 0
store i8 0, i8* %159
br label %160
160: ; preds = %149, %146, %143
br label %119
161: ; preds = %119
%162 = load i8**, i8*** %17
%163 = load i32, i32* %9
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds i8*, i8** %162, i64 %164
%166 = load i8*, i8** %165
%167 = load i64, i64* %8
%168 = call i32 @strncpy(i8* %166, i8* %111, i64 %167)
%169 = load i32*, i32** %2
%170 = load i32, i32* %14
%171 = load i32, i32* @SEEK_SET
%172 = call i32 @fseek(i32* %169, i32 %170, i32 %171)
store i32 0, i32* %18
br label %173
173: ; preds = %194, %161
%174 = load i32, i32* %18
%175 = load i32, i32* %10
%176 = icmp ne i32 %174, %175
br i1 %176, label %177, label %197
177: ; preds = %173
%178 = load i32*, i32** @stdout
%179 = load i32, i32* %18
%180 = load i8**, i8*** %17
%181 = load i32, i32* %18
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds i8*, i8** %180, i64 %182
%184 = load i8*, i8** %183
%185 = call i32 (i32*, i8*, ...) @fprintf(i32* %178, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %179, i8* %184)
%186 = load i32*, i32** %3
%187 = load i32, i32* %18
%188 = load i8**, i8*** %17
%189 = load i32, i32* %18
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds i8*, i8** %188, i64 %190
%192 = load i8*, i8** %191
%193 = call i32 (i32*, i8*, ...) @fprintf(i32* %186, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %187, i8* %192)
br label %194
194: ; preds = %177
%195 = load i32, i32* %18
%196 = add nsw i32 %195, 1
store i32 %196, i32* %18
br label %173
197: ; preds = %173
%198 = load i32*, i32** @stdout
%199 = call i32 (i32*, i8*, ...) @fprintf(i32* %198, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i64 8)
%200 = load i32*, i32** @stdout
%201 = call i32 (i32*, i8*, ...) @fprintf(i32* %200, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%202 = load i32*, i32** %3
%203 = call i32 (i32*, i8*, ...) @fprintf(i32* %202, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %10
store i32 0, i32* %11
store i64 0, i64* %8
store i32 0, i32* %12
store i32 0, i32* %9
%204 = load i8**, i8*** %17
%205 = call i32 @free(i8** %204)
%206 = load i8*, i8** %15
br label %207
207: ; preds = %197, %91
br label %47
208: ; preds = %47
%209 = load i32*, i32** %2
%210 = icmp uge i32* %209, null
br i1 %210, label %211, label %214
211: ; preds = %208
%212 = load i32*, i32** %2
%213 = call i32 @fclose(i32* %212)
br label %214
214: ; preds = %211, %208
%215 = load i32*, i32** %3
%216 = icmp uge i32* %215, null
br i1 %216, label %217, label %220
217: ; preds = %214
%218 = load i32*, i32** %3
%219 = call i32 @fclose(i32* %218)
br label %220
220: ; preds = %217, %214
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"pedestal_ramp.script\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32* null
@.str.3 = [8 x i8] c"out.txt\00"
@.str.4 = [2 x i8] c"w\00"
@SEEK_END = global i32 0
@stdout = global i32* null
@.str.5 = [14 x i8] c"fileSize: %d\0A\00"
@EOF = global i32 0
@SEEK_SET = global i32 0
@.str.6 = [11 x i8] c"a[%d]: %s \00"
@.str.7 = [10 x i8] c"size: %lu\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%3 = load i32, i32* @SEEK_END
%4 = tail call i32 @fseek(i32* %1, i32 0, i32 %3)
%5 = tail call i8* @ftell(i32* %1)
%6 = tail call i32 @rewind(i32* %1)
%7 = load i32*, i32** @stdout
%8 = ptrtoint i8* %5 to i64
%9 = trunc i64 %8 to i32
%10 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %9)
%11 = tail call i8* @ftell(i32* %1)
%12 = call i32 @fgetc(i32* %1)
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %125, label %15
15: ; preds = %0
%16 = ptrtoint i8* %11 to i64
%17 = trunc i64 %16 to i32
br label %18
18: ; preds = %15, %115
%19 = phi i32 [ %122, %115 ], [ %12, %15 ]
%20 = phi i32 [ %121, %115 ], [ %17, %15 ]
%21 = phi i32 [ %120, %115 ], [ 0, %15 ]
%22 = phi i32 [ %119, %115 ], [ 0, %15 ]
%23 = phi i32 [ %118, %115 ], [ 0, %15 ]
%24 = phi i64 [ %117, %115 ], [ 0, %15 ]
%25 = phi i32 [ %116, %115 ], [ undef, %15 ]
%26 = icmp eq i32 %19, 35
%27 = select i1 %26, i32 1, i32 %21
%28 = icmp eq i32 %19, 32
%29 = icmp ne i32 %27, 0
%30 = select i1 %28, i1 true, i1 %29
%31 = icmp eq i32 %19, 13
%32 = or i1 %31, %30
%33 = select i1 %32, i32 %25, i32 0
%34 = xor i1 %32, true
%35 = zext i1 %34 to i64
%36 = add i64 %24, %35
%37 = icmp ne i32 %19, 32
%38 = select i1 %37, i1 true, i1 %29
br i1 %38, label %48, label %39
39: ; preds = %18
%40 = icmp slt i32 %33, 1
%41 = zext i1 %40 to i32
%42 = add nsw i32 %23, %41
%43 = add nsw i32 %33, 1
%44 = sext i32 %22 to i64
%45 = icmp ugt i64 %36, %44
%46 = trunc i64 %36 to i32
%47 = select i1 %45, i32 %46, i32 %22
br label %115
48: ; preds = %18
%49 = icmp eq i32 %19, 10
br i1 %49, label %50, label %115
50: ; preds = %48
%51 = add nsw i32 %23, 1
%52 = icmp slt i32 %23, 0
%53 = select i1 %52, i32 0, i32 %51
%54 = call i8* @ftell(i32* %1)
%55 = ptrtoint i8* %54 to i64
%56 = zext i32 %22 to i64
%57 = call i8* @llvm.stacksave()
%58 = alloca i8, i64 %56
%59 = call i8** @alloc_array(i32 %53)
%60 = load i32, i32* @SEEK_SET
%61 = call i32 @fseek(i32* %1, i32 %20, i32 %60)
br label %62
62: ; preds = %50, %80
%63 = phi i32 [ 0, %50 ], [ %85, %80 ]
br label %64
64: ; preds = %62, %76
%65 = phi i64 [ %77, %76 ], [ 0, %62 ]
br label %66
66: ; preds = %68, %64
%67 = phi i1 [ false, %64 ], [ true, %68 ]
br label %68
68: ; preds = %66, %70
%69 = call i32 @fgetc(i32* %1)
switch i32 %69, label %70 [
i32 10, label %86
i32 35, label %66
]
70: ; preds = %68
br i1 %67, label %68, label %71
71: ; preds = %70
switch i32 %69, label %72 [
i32 32, label %76
i32 13, label %76
]
72: ; preds = %71
%73 = trunc i32 %69 to i8
%74 = getelementptr inbounds i8, i8* %58, i64 %65
store i8 %73, i8* %74
%75 = add i64 %65, 1
br label %76
76: ; preds = %71, %71, %72
%77 = phi i64 [ %75, %72 ], [ %65, %71 ], [ %65, %71 ]
%78 = icmp ne i32 %69, 32
%79 = or i1 %67, %78
br i1 %79, label %64, label %80
80: ; preds = %76
%81 = zext i32 %63 to i64
%82 = getelementptr inbounds i8*, i8** %59, i64 %81
%83 = load i8*, i8** %82
%84 = call i32 @strncpy(i8* %83, i8* %58, i64 %77)
%85 = add nuw nsw i32 %63, 1
store i8 0, i8* %58
br label %62
86: ; preds = %68
%87 = trunc i64 %55 to i32
%88 = zext i32 %63 to i64
%89 = getelementptr inbounds i8*, i8** %59, i64 %88
%90 = load i8*, i8** %89
%91 = call i32 @strncpy(i8* %90, i8* %58, i64 %65)
%92 = load i32, i32* @SEEK_SET
%93 = call i32 @fseek(i32* %1, i32 %87, i32 %92)
%94 = icmp eq i32 %53, 0
br i1 %94, label %108, label %95
95: ; preds = %86
%96 = zext i32 %53 to i64
br label %97
97: ; preds = %95, %97
%98 = phi i64 [ 0, %95 ], [ %106, %97 ]
%99 = load i32*, i32** @stdout
%100 = getelementptr inbounds i8*, i8** %59, i64 %98
%101 = load i8*, i8** %100
%102 = trunc i64 %98 to i32
%103 = call i32 (i32*, i8*, ...) @fprintf(i32* %99, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %102, i8* %101)
%104 = load i8*, i8** %100
%105 = call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %102, i8* %104)
%106 = add nuw nsw i64 %98, 1
%107 = icmp eq i64 %106, %96
br i1 %107, label %108, label %97
108: ; preds = %97, %86
%109 = load i32*, i32** @stdout
%110 = call i32 (i32*, i8*, ...) @fprintf(i32* %109, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i64 8)
%111 = load i32*, i32** @stdout
%112 = call i32 @fputc(i32 10, i32* %111)
%113 = call i32 @fputc(i32 10, i32* %2)
%114 = call i32 @free(i8** %59)
br label %115
115: ; preds = %39, %108, %48
%116 = phi i32 [ %33, %108 ], [ %33, %48 ], [ %43, %39 ]
%117 = phi i64 [ 0, %108 ], [ %36, %48 ], [ 0, %39 ]
%118 = phi i32 [ 0, %108 ], [ %23, %48 ], [ %42, %39 ]
%119 = phi i32 [ 0, %108 ], [ %22, %48 ], [ %47, %39 ]
%120 = phi i32 [ 0, %108 ], [ %27, %48 ], [ 0, %39 ]
%121 = phi i32 [ %87, %108 ], [ %20, %48 ], [ %20, %39 ]
%122 = call i32 @fgetc(i32* %1)
%123 = load i32, i32* @EOF
%124 = icmp eq i32 %122, %123
br i1 %124, label %125, label %18
125: ; preds = %115, %0
%126 = call i32 @fclose(i32* %1)
%127 = call i32 @fclose(i32* %2)
ret i32 0
}