#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 scalar_t__ off_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ SEEK_CUR;
scalar_t__ atol(char *);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ exit_with_error(char *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fseeko(int /*<<< orphan*/ *, scalar_t__, int /*<<< orphan*/);
scalar_t__ realloc(char *, int);
scalar_t__ starts_with(char *, char *);
char *strcat(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
scalar_t__ strlen(char *);
int main(int argc, char **argv) {
  int i, ch;
  int in = 0;
  int out = 0;
  int cur_len = 0;
  int cur_max = 80;
  int reading_node = 0;
  off_t con_len;
  FILE *infile = NULL;
  FILE *outfile = NULL;
  char *current_line;
  if ((current_line = (char *)calloc(cur_max, 1)) == NULL) {
    exit_with_error("calloc failed", 2);
  }
  for (i = 1; i < argc; ++i) {
    if (starts_with(argv[i], "-")) {
      in = (!strcmp(argv[i], "--infile") || !strcmp(argv[i], "-i"));
      out = (!strcmp(argv[i], "--outfile") || !strcmp(argv[i], "-o"));
    } else if (in && infile == NULL) {
      infile = fopen(argv[i], "rb");
      if (infile == NULL) {
        exit_with_error(strcat(argv[i], " can not be opened as infile"), 3);
      }
    } else if (out && outfile == NULL) {
      outfile = fopen(argv[i], "wb");
      if (outfile == NULL) {
        exit_with_error(strcat(argv[i], " can not be opened as outfile"), 3);
      }
    } else {
      exit_with_error(strcat(argv[i], " is not a valid parameter"), 1);
    }
  }
  if (infile == NULL) {
    exit_with_error("You must specify an infile", 1);
  }
  if (outfile == NULL) {
    exit_with_error("You must specify an outfile", 1);
  }
  reading_node = 0;
  while ((ch = fgetc(infile)) != EOF) {
    if (ch == 10) {
      if (reading_node) {
        if (strlen(current_line) == 0) {
          reading_node = 0;
        } else if (starts_with(current_line, "Content-length: ")) {
          con_len = (off_t)atol(&current_line[16]);
          fseeko(infile, con_len + 2, SEEK_CUR);
          reading_node = 0;
        }
      } else if (starts_with(current_line, "Node-path: ")) {
        reading_node = 1;
      }
      fprintf(outfile, "%s\n", current_line);
      current_line[0] = '\0';
      cur_len = 0;
    } else {
      if (cur_len == cur_max - 1) {
        cur_max += 10;
        if ((current_line = (char *)realloc(current_line, cur_max)) == NULL) {
          exit_with_error("realloc failed", 2);
        }
      }
      current_line[cur_len] = ch;
      ++cur_len;
      current_line[cur_len] = '\0';
    }
  }
  fclose(infile);
  fclose(outfile);
  free(current_line);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x50,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0x28(%rbp),%edi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    %rax,-0x50(%rbp)
cmp    $0x0,%rax
jne    1255 <main+0x75>
lea    0xdb5(%rip),%rdi
mov    $0x2,%esi
call   10b0 <exit_with_error@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1449 <main+0x269>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd93(%rip),%rsi
call   10d0 <starts_with@plt>
cmp    $0x0,%rax
je     133b <main+0x15b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd73(%rip),%rsi
call   1080 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x51(%rbp)
je     12d5 <main+0xf5>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd54(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd29(%rip),%rsi
call   1080 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x52(%rbp)
je     132b <main+0x14b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd0b(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x52(%rbp)
mov    -0x52(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x20(%rbp)
jmp    1436 <main+0x256>
cmpl   $0x0,-0x1c(%rbp)
je     13a1 <main+0x1c1>
cmpq   $0x0,-0x40(%rbp)
jne    13a1 <main+0x1c1>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xcc6(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    139c <main+0x1bc>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xca2(%rip),%rsi
call   1100 <strcat@plt>
mov    %rax,%rdi
mov    $0x3,%esi
call   10b0 <exit_with_error@plt>
jmp    1431 <main+0x251>
cmpl   $0x0,-0x20(%rbp)
je     1407 <main+0x227>
cmpq   $0x0,-0x48(%rbp)
jne    1407 <main+0x227>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xc80(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    1402 <main+0x222>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xc5c(%rip),%rsi
call   1100 <strcat@plt>
mov    %rax,%rdi
mov    $0x3,%esi
call   10b0 <exit_with_error@plt>
jmp    142c <main+0x24c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xc50(%rip),%rsi
call   1100 <strcat@plt>
mov    %rax,%rdi
mov    $0x1,%esi
call   10b0 <exit_with_error@plt>
jmp    1431 <main+0x251>
jmp    1436 <main+0x256>
jmp    143b <main+0x25b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    125c <main+0x7c>
cmpq   $0x0,-0x40(%rbp)
jne    1465 <main+0x285>
lea    0xc29(%rip),%rdi
mov    $0x1,%esi
call   10b0 <exit_with_error@plt>
cmpq   $0x0,-0x48(%rbp)
jne    1481 <main+0x2a1>
lea    0xc28(%rip),%rdi
mov    $0x1,%esi
call   10b0 <exit_with_error@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x40(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %eax,-0x18(%rbp)
mov    0x2b45(%rip),%rcx
cmp    (%rcx),%eax
je     15ed <main+0x40d>
cmpl   $0xa,-0x18(%rbp)
jne    1579 <main+0x399>
cmpl   $0x0,-0x2c(%rbp)
je     152c <main+0x34c>
mov    -0x50(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%rax
jne    14d6 <main+0x2f6>
movl   $0x0,-0x2c(%rbp)
jmp    1527 <main+0x347>
mov    -0x50(%rbp),%rdi
lea    0xbda(%rip),%rsi
call   10d0 <starts_with@plt>
cmp    $0x0,%rax
je     1522 <main+0x342>
mov    -0x50(%rbp),%rdi
add    $0x10,%rdi
call   10c0 <atol@plt>
mov    %rax,-0x38(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
add    $0x2,%rsi
mov    0x2ad4(%rip),%rax
mov    (%rax),%edx
call   10e0 <fseeko@plt>
movl   $0x0,-0x2c(%rbp)
jmp    1527 <main+0x347>
jmp    1552 <main+0x372>
mov    -0x50(%rbp),%rdi
lea    0xb95(%rip),%rsi
call   10d0 <starts_with@plt>
cmp    $0x0,%rax
je     154d <main+0x36d>
movl   $0x1,-0x2c(%rbp)
jmp    1552 <main+0x372>
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rdx
lea    0xb77(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x50(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x0,-0x24(%rbp)
jmp    15e8 <main+0x408>
mov    -0x24(%rbp),%eax
mov    -0x28(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    15c3 <main+0x3e3>
mov    -0x28(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x28(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   10a0 <realloc@plt>
mov    %rax,-0x50(%rbp)
cmp    $0x0,%rax
jne    15be <main+0x3de>
lea    0xb28(%rip),%rdi
mov    $0x2,%esi
call   10b0 <exit_with_error@plt>
jmp    15c3 <main+0x3e3>
mov    -0x18(%rbp),%eax
mov    %al,%dl
mov    -0x50(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x50(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1488 <main+0x2a8>
mov    -0x40(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x48(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x60,%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,%r12
mov    %edi,%ebp
mov    $0x50,%edi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    %rax,%r13
test   %rax,%rax
jne    120b <main+0x3b>
lea    0xdff(%rip),%rdi
mov    $0x2,%esi
call   10b0 <exit_with_error@plt>
xor    %r15d,%r15d
cmp    $0x2,%ebp
jl     13e2 <main+0x212>
mov    %ebp,%eax
mov    %rax,0x10(%rsp)
mov    $0x1,%r14d
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %eax,%eax
mov    %rax,(%rsp)
xor    %ebx,%ebx
jmp    1256 <main+0x86>
cs nopw 0x0(%rax,%rax,1)
nop
movzbl %bl,%ebx
movzbl %r15b,%r15d
add    $0x1,%r14
cmp    %r14,0x10(%rsp)
je     13eb <main+0x21b>
mov    (%r12,%r14,8),%rdi
lea    0xdad(%rip),%rsi
call   10d0 <starts_with@plt>
test   %rax,%rax
je     12d0 <main+0x100>
mov    (%r12,%r14,8),%rbp
mov    %rbp,%rdi
lea    0xd97(%rip),%rsi
call   1080 <strcmp@plt>
mov    $0x1,%r15b
mov    $0x1,%bl
test   %eax,%eax
je     129b <main+0xcb>
mov    %rbp,%rdi
lea    0xd88(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
sete   %bl
mov    %rbp,%rdi
lea    0xd77(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1240 <main+0x70>
mov    %rbp,%rdi
lea    0xd6e(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
sete   %r15b
jmp    1240 <main+0x70>
nopl   0x0(%rax,%rax,1)
test   %ebx,%ebx
je     133c <main+0x16c>
cmpq   $0x0,(%rsp)
jne    133c <main+0x16c>
mov    (%r12,%r14,8),%rdi
lea    0xd43(%rip),%rsi
call   10f0 <fopen@plt>
mov    $0x1,%ebx
mov    %rax,%rcx
mov    %rax,(%rsp)
test   %rax,%rax
jne    1247 <main+0x77>
mov    (%r12,%r14,8),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
movups 0xd19(%rip),%xmm0
movups %xmm0,0x0(%rbp,%rax,1)
movups 0xd1a(%rip),%xmm0
movups %xmm0,0xd(%rbp,%rax,1)
mov    %rbp,%rdi
mov    $0x3,%esi
call   10b0 <exit_with_error@plt>
xor    %eax,%eax
mov    %rax,(%rsp)
jmp    1247 <main+0x77>
mov    (%r12,%r14,8),%rbp
test   %r15d,%r15d
je     13b0 <main+0x1e0>
cmpq   $0x0,0x8(%rsp)
jne    13b0 <main+0x1e0>
mov    %rbp,%rdi
lea    0xcf2(%rip),%rsi
call   10f0 <fopen@plt>
mov    $0x1,%r15d
mov    %rax,%rcx
mov    %rax,0x8(%rsp)
test   %rax,%rax
jne    1247 <main+0x77>
mov    (%r12,%r14,8),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
movups 0xcc6(%rip),%xmm0
movups %xmm0,0x0(%rbp,%rax,1)
movups 0xcc8(%rip),%xmm0
movups %xmm0,0xe(%rbp,%rax,1)
mov    %rbp,%rdi
mov    $0x3,%esi
call   10b0 <exit_with_error@plt>
xor    %eax,%eax
mov    %rax,0x8(%rsp)
jmp    1247 <main+0x77>
mov    %rbp,%rdi
call   1050 <strlen@plt>
movups 0xcab(%rip),%xmm0
movups %xmm0,0x0(%rbp,%rax,1)
movups 0xca9(%rip),%xmm0
movups %xmm0,0xa(%rbp,%rax,1)
mov    %rbp,%rdi
mov    $0x1,%esi
call   10b0 <exit_with_error@plt>
jmp    1247 <main+0x77>
xor    %eax,%eax
mov    %rax,0x8(%rsp)
jmp    143e <main+0x26e>
cmpq   $0x0,(%rsp)
je     143e <main+0x26e>
cmpq   $0x0,0x8(%rsp)
je     145d <main+0x28d>
mov    (%rsp),%rdi
call   1060 <fgetc@plt>
mov    %eax,%r12d
mov    0x2bd3(%rip),%rax
cmp    (%rax),%r12d
jne    1470 <main+0x2a0>
mov    (%rsp),%rdi
call   1040 <fclose@plt>
mov    0x8(%rsp),%rdi
call   1040 <fclose@plt>
mov    %r13,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc3f(%rip),%rdi
mov    $0x1,%esi
call   10b0 <exit_with_error@plt>
xor    %eax,%eax
mov    %rax,(%rsp)
cmpq   $0x0,0x8(%rsp)
jne    13fa <main+0x22a>
lea    0xc3b(%rip),%rdi
mov    $0x1,%esi
call   10b0 <exit_with_error@plt>
jmp    13fa <main+0x22a>
mov    $0x50,%r15d
xor    %r14d,%r14d
mov    %r13,%rbx
xor    %ebp,%ebp
jmp    14d6 <main+0x306>
lea    0xc55(%rip),%rdi
mov    $0x2,%esi
call   10b0 <exit_with_error@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%r13
movslq %ebp,%rax
mov    %r12b,(%rbx,%rax,1)
add    $0x1,%ebp
add    %rax,%rbx
add    $0x1,%rbx
movb   $0x0,(%rbx)
mov    (%rsp),%rdi
call   1060 <fgetc@plt>
mov    %eax,%r12d
mov    %r13,%rbx
mov    0x2b13(%rip),%rax
cmp    (%rax),%r12d
je     1412 <main+0x242>
cmp    $0xa,%r12d
jne    1520 <main+0x350>
test   %r14d,%r14d
jne    154c <main+0x37c>
mov    %rbx,%rdi
lea    0xbe1(%rip),%rsi
call   10d0 <starts_with@plt>
xor    %r14d,%r14d
test   %rax,%rax
setne  %r14b
mov    0x8(%rsp),%rdi
lea    0xbd2(%rip),%rsi
mov    %rbx,%rdx
call   1090 <fprintf@plt>
xor    %ebp,%ebp
mov    %rbx,%r13
jmp    14b4 <main+0x2e4>
cs nopw 0x0(%rax,%rax,1)
nop
lea    -0x1(%r15),%eax
cmp    %eax,%ebp
jne    14a0 <main+0x2d0>
add    $0xa,%r15d
mov    %rbx,%rdi
mov    %r15d,%esi
call   10a0 <realloc@plt>
test   %rax,%rax
je     1480 <main+0x2b0>
mov    %rax,%rbx
jmp    14a0 <main+0x2d0>
xor    %r14d,%r14d
cmpb   $0x0,(%rbx)
je     14fa <main+0x32a>
mov    %rbx,%rdi
lea    0xb5d(%rip),%rsi
call   10d0 <starts_with@plt>
test   %rax,%rax
je     158c <main+0x3bc>
lea    0x10(%rbx),%rdi
call   10c0 <atol@plt>
lea    0x2(%rax),%rsi
mov    0x2a6c(%rip),%rax
mov    (%rax),%edx
mov    (%rsp),%rdi
call   10e0 <fseeko@plt>
jmp    14fa <main+0x32a>
mov    $0x1,%r14d
jmp    14fa <main+0x32a>

LLVM IR (-O0):
@.str = [14 x i8] c"calloc failed\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [9 x i8] c"--infile\00"
@.str.3 = [3 x i8] c"-i\00"
@.str.4 = [10 x i8] c"--outfile\00"
@.str.5 = [3 x i8] c"-o\00"
@.str.6 = [3 x i8] c"rb\00"
@.str.7 = [29 x i8] c" can not be opened as infile\00"
@.str.8 = [3 x i8] c"wb\00"
@.str.9 = [30 x i8] c" can not be opened as outfile\00"
@.str.10 = [26 x i8] c" is not a valid parameter\00"
@.str.11 = [27 x i8] c"You must specify an infile\00"
@.str.12 = [28 x i8] c"You must specify an outfile\00"
@EOF = global i32 0
@.str.13 = [17 x i8] c"Content-length: \00"
@SEEK_CUR = global i32 0
@.str.14 = [12 x i8] c"Node-path: \00"
@.str.15 = [4 x i8] c"%s\0A\00"
@.str.16 = [15 x i8] c"realloc failed\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 i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i64
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 80, i32* %11
store i32 0, i32* %12
store i32* null, i32** %14
store i32* null, i32** %15
%17 = load i32, i32* %11
%18 = call i64 @calloc(i32 %17, i32 1)
%19 = inttoptr i64 %18 to i8*
store i8* %19, i8** %16
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %23
21: ; preds = %2
%22 = call i32 @exit_with_error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 2)
br label %23
23: ; preds = %21, %2
store i32 1, i32* %6
br label %24
24: ; preds = %134, %23
%25 = load i32, i32* %6
%26 = load i32, i32* %4
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %137
28: ; preds = %24
%29 = load i8**, i8*** %5
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = call i64 @starts_with(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %75
36: ; preds = %28
%37 = load i8**, i8*** %5
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %37, i64 %39
%41 = load i8*, i8** %40
%42 = call i32 @strcmp(i8* %41, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %53
44: ; preds = %36
%45 = load i8**, i8*** %5
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %45, i64 %47
%49 = load i8*, i8** %48
%50 = call i32 @strcmp(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%51 = icmp ne i32 %50, 0
%52 = xor i1 %51, true
br label %53
53: ; preds = %44, %36
%54 = phi i1 [ true, %36 ], [ %52, %44 ]
%55 = zext i1 %54 to i32
store i32 %55, i32* %8
%56 = load i8**, i8*** %5
%57 = load i32, i32* %6
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8*, i8** %56, i64 %58
%60 = load i8*, i8** %59
%61 = call i32 @strcmp(i8* %60, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%62 = icmp ne i32 %61, 0
br i1 %62, label %63, label %72
63: ; preds = %53
%64 = load i8**, i8*** %5
%65 = load i32, i32* %6
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8*, i8** %64, i64 %66
%68 = load i8*, i8** %67
%69 = call i32 @strcmp(i8* %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%70 = icmp ne i32 %69, 0
%71 = xor i1 %70, true
br label %72
72: ; preds = %63, %53
%73 = phi i1 [ true, %53 ], [ %71, %63 ]
%74 = zext i1 %73 to i32
store i32 %74, i32* %9
br label %133
75: ; preds = %28
%76 = load i32, i32* %8
%77 = icmp ne i32 %76, 0
br i1 %77, label %78, label %99
78: ; preds = %75
%79 = load i32*, i32** %14
%80 = icmp eq i32* %79, null
br i1 %80, label %81, label %99
81: ; preds = %78
%82 = load i8**, i8*** %5
%83 = load i32, i32* %6
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i8*, i8** %82, i64 %84
%86 = load i8*, i8** %85
%87 = call i32* @fopen(i8* %86, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
store i32* %87, i32** %14
%88 = load i32*, i32** %14
%89 = icmp eq i32* %88, null
br i1 %89, label %90, label %98
90: ; preds = %81
%91 = load i8**, i8*** %5
%92 = load i32, i32* %6
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8*, i8** %91, i64 %93
%95 = load i8*, i8** %94
%96 = call i8* @strcat(i8* %95, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%97 = call i32 @exit_with_error(i8* %96, i32 3)
br label %98
98: ; preds = %90, %81
br label %132
99: ; preds = %78, %75
%100 = load i32, i32* %9
%101 = icmp ne i32 %100, 0
br i1 %101, label %102, label %123
102: ; preds = %99
%103 = load i32*, i32** %15
%104 = icmp eq i32* %103, null
br i1 %104, label %105, label %123
105: ; preds = %102
%106 = load i8**, i8*** %5
%107 = load i32, i32* %6
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i8*, i8** %106, i64 %108
%110 = load i8*, i8** %109
%111 = call i32* @fopen(i8* %110, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
store i32* %111, i32** %15
%112 = load i32*, i32** %15
%113 = icmp eq i32* %112, null
br i1 %113, label %114, label %122
114: ; preds = %105
%115 = load i8**, i8*** %5
%116 = load i32, i32* %6
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds i8*, i8** %115, i64 %117
%119 = load i8*, i8** %118
%120 = call i8* @strcat(i8* %119, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
%121 = call i32 @exit_with_error(i8* %120, i32 3)
br label %122
122: ; preds = %114, %105
br label %131
123: ; preds = %102, %99
%124 = load i8**, i8*** %5
%125 = load i32, i32* %6
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i8*, i8** %124, i64 %126
%128 = load i8*, i8** %127
%129 = call i8* @strcat(i8* %128, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0))
%130 = call i32 @exit_with_error(i8* %129, i32 1)
br label %131
131: ; preds = %123, %122
br label %132
132: ; preds = %131, %98
br label %133
133: ; preds = %132, %72
br label %134
134: ; preds = %133
%135 = load i32, i32* %6
%136 = add nsw i32 %135, 1
store i32 %136, i32* %6
br label %24
137: ; preds = %24
%138 = load i32*, i32** %14
%139 = icmp eq i32* %138, null
br i1 %139, label %140, label %142
140: ; preds = %137
%141 = call i32 @exit_with_error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), i32 1)
br label %142
142: ; preds = %140, %137
%143 = load i32*, i32** %15
%144 = icmp eq i32* %143, null
br i1 %144, label %145, label %147
145: ; preds = %142
%146 = call i32 @exit_with_error(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i32 1)
br label %147
147: ; preds = %145, %142
store i32 0, i32* %12
br label %148
148: ; preds = %220, %147
%149 = load i32*, i32** %14
%150 = call i32 @fgetc(i32* %149)
store i32 %150, i32* %7
%151 = load i32, i32* @EOF
%152 = icmp ne i32 %150, %151
br i1 %152, label %153, label %221
153: ; preds = %148
%154 = load i32, i32* %7
%155 = icmp eq i32 %154, 10
br i1 %155, label %156, label %191
156: ; preds = %153
%157 = load i32, i32* %12
%158 = icmp ne i32 %157, 0
br i1 %158, label %159, label %179
159: ; preds = %156
%160 = load i8*, i8** %16
%161 = call i64 @strlen(i8* %160)
%162 = icmp eq i64 %161, 0
br i1 %162, label %163, label %164
163: ; preds = %159
store i32 0, i32* %12
br label %178
164: ; preds = %159
%165 = load i8*, i8** %16
%166 = call i64 @starts_with(i8* %165, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
%167 = icmp ne i64 %166, 0
br i1 %167, label %168, label %177
168: ; preds = %164
%169 = load i8*, i8** %16
%170 = getelementptr inbounds i8, i8* %169, i64 16
%171 = call i64 @atol(i8* %170)
store i64 %171, i64* %13
%172 = load i32*, i32** %14
%173 = load i64, i64* %13
%174 = add nsw i64 %173, 2
%175 = load i32, i32* @SEEK_CUR
%176 = call i32 @fseeko(i32* %172, i64 %174, i32 %175)
store i32 0, i32* %12
br label %177
177: ; preds = %168, %164
br label %178
178: ; preds = %177, %163
br label %185
179: ; preds = %156
%180 = load i8*, i8** %16
%181 = call i64 @starts_with(i8* %180, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0))
%182 = icmp ne i64 %181, 0
br i1 %182, label %183, label %184
183: ; preds = %179
store i32 1, i32* %12
br label %184
184: ; preds = %183, %179
br label %185
185: ; preds = %184, %178
%186 = load i32*, i32** %15
%187 = load i8*, i8** %16
%188 = call i32 @fprintf(i32* %186, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i8* %187)
%189 = load i8*, i8** %16
%190 = getelementptr inbounds i8, i8* %189, i64 0
store i8 0, i8* %190
store i32 0, i32* %10
br label %220
191: ; preds = %153
%192 = load i32, i32* %10
%193 = load i32, i32* %11
%194 = sub nsw i32 %193, 1
%195 = icmp eq i32 %192, %194
br i1 %195, label %196, label %207
196: ; preds = %191
%197 = load i32, i32* %11
%198 = add nsw i32 %197, 10
store i32 %198, i32* %11
%199 = load i8*, i8** %16
%200 = load i32, i32* %11
%201 = call i64 @realloc(i8* %199, i32 %200)
%202 = inttoptr i64 %201 to i8*
store i8* %202, i8** %16
%203 = icmp eq i8* %202, null
br i1 %203, label %204, label %206
204: ; preds = %196
%205 = call i32 @exit_with_error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.16, i64 0, i64 0), i32 2)
br label %206
206: ; preds = %204, %196
br label %207
207: ; preds = %206, %191
%208 = load i32, i32* %7
%209 = trunc i32 %208 to i8
%210 = load i8*, i8** %16
%211 = load i32, i32* %10
%212 = sext i32 %211 to i64
%213 = getelementptr inbounds i8, i8* %210, i64 %212
store i8 %209, i8* %213
%214 = load i32, i32* %10
%215 = add nsw i32 %214, 1
store i32 %215, i32* %10
%216 = load i8*, i8** %16
%217 = load i32, i32* %10
%218 = sext i32 %217 to i64
%219 = getelementptr inbounds i8, i8* %216, i64 %218
store i8 0, i8* %219
br label %220
220: ; preds = %207, %185
br label %148
221: ; preds = %148
%222 = load i32*, i32** %14
%223 = call i32 @fclose(i32* %222)
%224 = load i32*, i32** %15
%225 = call i32 @fclose(i32* %224)
%226 = load i8*, i8** %16
%227 = call i32 @free(i8* %226)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"calloc failed\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [9 x i8] c"--infile\00"
@.str.3 = [3 x i8] c"-i\00"
@.str.4 = [10 x i8] c"--outfile\00"
@.str.5 = [3 x i8] c"-o\00"
@.str.6 = [3 x i8] c"rb\00"
@.str.7 = [29 x i8] c" can not be opened as infile\00"
@.str.8 = [3 x i8] c"wb\00"
@.str.9 = [30 x i8] c" can not be opened as outfile\00"
@.str.10 = [26 x i8] c" is not a valid parameter\00"
@.str.11 = [27 x i8] c"You must specify an infile\00"
@.str.12 = [28 x i8] c"You must specify an outfile\00"
@EOF = global i32 0
@.str.13 = [17 x i8] c"Content-length: \00"
@SEEK_CUR = global i32 0
@.str.14 = [12 x i8] c"Node-path: \00"
@.str.15 = [4 x i8] c"%s\0A\00"
@.str.16 = [15 x i8] c"realloc failed\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i64 @calloc(i32 80, i32 1)
%4 = inttoptr i64 %3 to i8*
%5 = icmp eq i64 %3, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @exit_with_error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 2)
br label %8
8: ; preds = %6, %2
%9 = icmp sgt i32 %0, 1
br i1 %9, label %10, label %79
10: ; preds = %8
%11 = zext i32 %0 to i64
br label %12
12: ; preds = %10, %70
%13 = phi i64 [ 1, %10 ], [ %75, %70 ]
%14 = phi i32* [ null, %10 ], [ %74, %70 ]
%15 = phi i32* [ null, %10 ], [ %73, %70 ]
%16 = phi i32 [ 0, %10 ], [ %72, %70 ]
%17 = phi i32 [ 0, %10 ], [ %71, %70 ]
%18 = getelementptr inbounds i8*, i8** %1, i64 %13
%19 = load i8*, i8** %18
%20 = tail call i64 @starts_with(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %40, label %22
22: ; preds = %12
%23 = load i8*, i8** %18
%24 = tail call i32 @strcmp(i8* dereferenceable(1) %23, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %22
%27 = tail call i32 @strcmp(i8* dereferenceable(1) %23, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp eq i32 %27, 0
br label %29
29: ; preds = %26, %22
%30 = phi i1 [ true, %22 ], [ %28, %26 ]
%31 = zext i1 %30 to i32
%32 = tail call i32 @strcmp(i8* dereferenceable(1) %23, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%33 = icmp eq i32 %32, 0
br i1 %33, label %37, label %34
34: ; preds = %29
%35 = tail call i32 @strcmp(i8* dereferenceable(1) %23, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%36 = icmp eq i32 %35, 0
br label %37
37: ; preds = %34, %29
%38 = phi i1 [ true, %29 ], [ %36, %34 ]
%39 = zext i1 %38 to i32
br label %70
40: ; preds = %12
%41 = icmp ne i32 %17, 0
%42 = icmp eq i32* %15, null
%43 = select i1 %41, i1 %42, i1 false
br i1 %43, label %44, label %53
44: ; preds = %40
%45 = load i8*, i8** %18
%46 = tail call i32* @fopen(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%47 = icmp eq i32* %46, null
br i1 %47, label %48, label %70
48: ; preds = %44
%49 = load i8*, i8** %18
%50 = tail call i64 @strlen(i8* dereferenceable(1) %49)
%51 = getelementptr i8, i8* %49, i64 %50
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(29) %51, i8* align 1 dereferenceable(29) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i64 29, i1 false)
%52 = tail call i32 @exit_with_error(i8* %49, i32 3)
br label %70
53: ; preds = %40
%54 = icmp ne i32 %16, 0
%55 = icmp eq i32* %14, null
%56 = select i1 %54, i1 %55, i1 false
%57 = load i8*, i8** %18
br i1 %56, label %58, label %66
58: ; preds = %53
%59 = tail call i32* @fopen(i8* %57, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%60 = icmp eq i32* %59, null
br i1 %60, label %61, label %70
61: ; preds = %58
%62 = load i8*, i8** %18
%63 = tail call i64 @strlen(i8* dereferenceable(1) %62)
%64 = getelementptr i8, i8* %62, i64 %63
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(30) %64, i8* align 1 dereferenceable(30) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0), i64 30, i1 false)
%65 = tail call i32 @exit_with_error(i8* %62, i32 3)
br label %70
66: ; preds = %53
%67 = tail call i64 @strlen(i8* dereferenceable(1) %57)
%68 = getelementptr i8, i8* %57, i64 %67
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(26) %68, i8* align 1 dereferenceable(26) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i64 26, i1 false)
%69 = tail call i32 @exit_with_error(i8* %57, i32 1)
br label %70
70: ; preds = %37, %66, %61, %58, %44, %48
%71 = phi i32 [ %31, %37 ], [ 1, %48 ], [ 1, %44 ], [ %17, %61 ], [ %17, %58 ], [ %17, %66 ]
%72 = phi i32 [ %39, %37 ], [ %16, %48 ], [ %16, %44 ], [ 1, %61 ], [ 1, %58 ], [ %16, %66 ]
%73 = phi i32* [ %15, %37 ], [ null, %48 ], [ %46, %44 ], [ %15, %61 ], [ %15, %58 ], [ %15, %66 ]
%74 = phi i32* [ %14, %37 ], [ %14, %48 ], [ %14, %44 ], [ null, %61 ], [ %59, %58 ], [ %14, %66 ]
%75 = add nuw nsw i64 %13, 1
%76 = icmp eq i64 %75, %11
br i1 %76, label %77, label %12
77: ; preds = %70
%78 = icmp eq i32* %73, null
br i1 %78, label %79, label %82
79: ; preds = %8, %77
%80 = phi i32* [ %74, %77 ], [ null, %8 ]
%81 = tail call i32 @exit_with_error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), i32 1)
br label %82
82: ; preds = %79, %77
%83 = phi i32* [ %80, %79 ], [ %74, %77 ]
%84 = phi i32* [ null, %79 ], [ %73, %77 ]
%85 = icmp eq i32* %83, null
br i1 %85, label %86, label %88
86: ; preds = %82
%87 = tail call i32 @exit_with_error(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i32 1)
br label %88
88: ; preds = %86, %82
%89 = tail call i32 @fgetc(i32* %84)
%90 = load i32, i32* @EOF
%91 = icmp eq i32 %89, %90
br i1 %91, label %148, label %92
92: ; preds = %88, %139
%93 = phi i32 [ %145, %139 ], [ %89, %88 ]
%94 = phi i8* [ %144, %139 ], [ %4, %88 ]
%95 = phi i32 [ %143, %139 ], [ 0, %88 ]
%96 = phi i32 [ %142, %139 ], [ 80, %88 ]
%97 = phi i32 [ %141, %139 ], [ 0, %88 ]
%98 = icmp eq i32 %93, 10
br i1 %98, label %99, label %120
99: ; preds = %92
%100 = icmp eq i32 %95, 0
br i1 %100, label %113, label %101
101: ; preds = %99
%102 = load i8, i8* %94
%103 = icmp eq i8 %102, 0
br i1 %103, label %117, label %104
104: ; preds = %101
%105 = tail call i64 @starts_with(i8* %94, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
%106 = icmp eq i64 %105, 0
br i1 %106, label %117, label %107
107: ; preds = %104
%108 = getelementptr inbounds i8, i8* %94, i64 16
%109 = tail call i64 @atol(i8* %108)
%110 = add nsw i64 %109, 2
%111 = load i32, i32* @SEEK_CUR
%112 = tail call i32 @fseeko(i32* %84, i64 %110, i32 %111)
br label %117
113: ; preds = %99
%114 = tail call i64 @starts_with(i8* %94, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0))
%115 = icmp ne i64 %114, 0
%116 = zext i1 %115 to i32
br label %117
117: ; preds = %113, %101, %107, %104
%118 = phi i32 [ 0, %107 ], [ 1, %104 ], [ 0, %101 ], [ %116, %113 ]
%119 = tail call i32 @fprintf(i32* %83, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i8* %94)
br label %139
120: ; preds = %92
%121 = add nsw i32 %96, -1
%122 = icmp eq i32 %97, %121
br i1 %122, label %123, label %130
123: ; preds = %120
%124 = add nsw i32 %96, 10
%125 = tail call i64 @realloc(i8* %94, i32 %124)
%126 = inttoptr i64 %125 to i8*
%127 = icmp eq i64 %125, 0
br i1 %127, label %128, label %130
128: ; preds = %123
%129 = tail call i32 @exit_with_error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.16, i64 0, i64 0), i32 2)
br label %130
130: ; preds = %123, %128, %120
%131 = phi i32 [ %124, %128 ], [ %124, %123 ], [ %96, %120 ]
%132 = phi i8* [ null, %128 ], [ %126, %123 ], [ %94, %120 ]
%133 = trunc i32 %93 to i8
%134 = sext i32 %97 to i64
%135 = getelementptr inbounds i8, i8* %132, i64 %134
store i8 %133, i8* %135
%136 = add nsw i32 %97, 1
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds i8, i8* %132, i64 %137
br label %139
139: ; preds = %130, %117
%140 = phi i8* [ %138, %130 ], [ %94, %117 ]
%141 = phi i32 [ %136, %130 ], [ 0, %117 ]
%142 = phi i32 [ %131, %130 ], [ %96, %117 ]
%143 = phi i32 [ %95, %130 ], [ %118, %117 ]
%144 = phi i8* [ %132, %130 ], [ %94, %117 ]
store i8 0, i8* %140
%145 = tail call i32 @fgetc(i32* %84)
%146 = load i32, i32* @EOF
%147 = icmp eq i32 %145, %146
br i1 %147, label %148, label %92
148: ; preds = %139, %88
%149 = phi i8* [ %4, %88 ], [ %144, %139 ]
%150 = tail call i32 @fclose(i32* %84)
%151 = tail call i32 @fclose(i32* %83)
%152 = tail call i32 @free(i8* %149)
ret i32 0
}