#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 */
scalar_t__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fileno(int /*<<< orphan*/ *);
char *malloc(int);
int read(int /*<<< orphan*/, char *, int);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int const);
int /*<<< orphan*/ write(int, char *, int);
int codepeel(FILE *fsrc, FILE *fcod, FILE *fcom, char *comstr) {
  if (fsrc == NULL || fcod == NULL || fcom == NULL)
    return 1;
  char *raw_buff = malloc(1024 * sizeof(char));
  char *cod_buff = malloc(1024 * sizeof(char));
  char *com_buff = malloc(1024 * sizeof(char));
  char *ss, *mb, *me, *rbufp = raw_buff, *ptr_buff = cod_buff;
  char *cod_buff_svp = cod_buff, *com_buff_svp = com_buff;
  int brkcom(char *, char **, char **, char **);
  int n_read;
  brkcom(comstr, &ss, &mb, &me);
  const int SSLEN = strlen(ss);
  const int MBLEN = strlen(mb);
  const int MELEN = strlen(me);
  int IN = 0, INC = 0;
  char *tokbuf = malloc(
      sizeof(char) *
      ((SSLEN) > (MBLEN) ? (SSLEN) : ((MELEN) > (MBLEN) ? (MELEN) : (MBLEN))));
  while ((n_read = read(fileno(fsrc), raw_buff, 1024)) > 0) {
    if (feof(fsrc))
      break;
    cod_buff_svp = cod_buff;
    com_buff_svp = com_buff;
    ptr_buff = cod_buff;
    for (rbufp = raw_buff; rbufp < raw_buff + n_read; rbufp++) {
      if (*rbufp == '\"') {
        if (IN == 0)
          IN = 1;
        else
          IN = 0;
      }
      if (*rbufp != *ss && *rbufp != *mb && *rbufp != *me || IN) {
        *ptr_buff++ = *rbufp;
      } else {
        strncpy(tokbuf, rbufp, SSLEN);
        *(tokbuf + SSLEN) = '\0';
        if (strcmp(tokbuf, ss) == 0) {
          cod_buff_svp = ptr_buff;
          ptr_buff = com_buff_svp;
          rbufp += SSLEN;
          while (*rbufp != '\n') {
            *ptr_buff++ = *rbufp++;
          }
          if (*rbufp == '\n')
            *ptr_buff++ = '\n';
          com_buff_svp = ptr_buff;
          ptr_buff = cod_buff_svp;
        } else {
          strncpy(tokbuf, rbufp, MBLEN);
          *(tokbuf + MBLEN) = '\0';
          if (strcmp(tokbuf, mb) == 0) {
            cod_buff_svp = ptr_buff;
            ptr_buff = com_buff_svp;
            rbufp += MBLEN - 1;
          } else {
            strncpy(tokbuf, rbufp, MELEN);
            *(tokbuf + MELEN) = '\0';
            if (strcmp(tokbuf, me) == 0) {
              com_buff_svp = ptr_buff;
              ptr_buff = cod_buff_svp;
              rbufp += MELEN - 1;
            } else
              *ptr_buff++ = *rbufp;
          }
        }
      }
    }
    write(1, cod_buff, 1024);
    write(2, com_buff, 1024);
  }
  return 0;
}


x86 assembly (clang, -O0):
<codepeel>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11cc <codepeel+0x3c>
cmpq   $0x0,-0x18(%rbp)
je     11cc <codepeel+0x3c>
cmpq   $0x0,-0x20(%rbp)
jne    11d8 <codepeel+0x48>
movl   $0x1,-0x4(%rbp)
jmp    1617 <codepeel+0x487>
mov    $0x400,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    $0x400,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    $0x400,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x48(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x58(%rbp),%rcx
call   10b0 <brkcom@plt>
mov    -0x48(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x80(%rbp)
mov    -0x50(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x84(%rbp)
mov    -0x58(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x88(%rbp)
movl   $0x0,-0x8c(%rbp)
movl   $0x0,-0x90(%rbp)
mov    -0x80(%rbp),%eax
cmp    -0x84(%rbp),%eax
jle    1292 <codepeel+0x102>
mov    -0x80(%rbp),%eax
mov    %eax,-0x9c(%rbp)
jmp    12cd <codepeel+0x13d>
mov    -0x88(%rbp),%eax
cmp    -0x84(%rbp),%eax
jle    12b5 <codepeel+0x125>
mov    -0x88(%rbp),%eax
mov    %eax,-0xa0(%rbp)
jmp    12c1 <codepeel+0x131>
mov    -0x84(%rbp),%eax
mov    %eax,-0xa0(%rbp)
mov    -0xa0(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x9c(%rbp),%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x98(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <fileno@plt>
mov    %eax,%edi
mov    -0x30(%rbp),%rsi
mov    $0x400,%edx
call   1060 <read@plt>
mov    %eax,-0x7c(%rbp)
cmp    $0x0,%eax
jle    1610 <codepeel+0x480>
mov    -0x10(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%rax
je     1324 <codepeel+0x194>
jmp    1610 <codepeel+0x480>
mov    -0x38(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq -0x7c(%rbp),%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    15e5 <codepeel+0x455>
mov    -0x60(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1397 <codepeel+0x207>
cmpl   $0x0,-0x8c(%rbp)
jne    1388 <codepeel+0x1f8>
movl   $0x1,-0x8c(%rbp)
jmp    1392 <codepeel+0x202>
movl   $0x0,-0x8c(%rbp)
jmp    1397 <codepeel+0x207>
mov    -0x60(%rbp),%rax
movsbl (%rax),%eax
mov    -0x48(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     13d9 <codepeel+0x249>
mov    -0x60(%rbp),%rax
movsbl (%rax),%eax
mov    -0x50(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     13d9 <codepeel+0x249>
mov    -0x60(%rbp),%rax
movsbl (%rax),%eax
mov    -0x58(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    13e6 <codepeel+0x256>
cmpl   $0x0,-0x8c(%rbp)
je     1402 <codepeel+0x272>
mov    -0x60(%rbp),%rax
mov    (%rax),%cl
mov    -0x68(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x68(%rbp)
mov    %cl,(%rax)
jmp    15cf <codepeel+0x43f>
mov    -0x98(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0x80(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x98(%rbp),%rax
movslq -0x80(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x98(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    14cd <codepeel+0x33d>
mov    -0x68(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x80(%rbp),%ecx
mov    -0x60(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     1496 <codepeel+0x306>
mov    -0x60(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x60(%rbp)
mov    (%rax),%cl
mov    -0x68(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x68(%rbp)
mov    %cl,(%rax)
jmp    145f <codepeel+0x2cf>
mov    -0x60(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    14b8 <codepeel+0x328>
mov    -0x68(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x68(%rbp)
movb   $0xa,(%rax)
mov    -0x68(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x68(%rbp)
jmp    15ca <codepeel+0x43a>
mov    -0x98(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0x84(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x98(%rbp),%rax
movslq -0x84(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x98(%rbp),%rdi
mov    -0x50(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    153b <codepeel+0x3ab>
mov    -0x68(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x84(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x60(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
jmp    15c5 <codepeel+0x435>
mov    -0x98(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0x88(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x98(%rbp),%rax
movslq -0x88(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x98(%rbp),%rdi
mov    -0x58(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    15a9 <codepeel+0x419>
mov    -0x68(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x88(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x60(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
jmp    15c0 <codepeel+0x430>
mov    -0x60(%rbp),%rax
mov    (%rax),%cl
mov    -0x68(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x68(%rbp)
mov    %cl,(%rax)
jmp    15c5 <codepeel+0x435>
jmp    15ca <codepeel+0x43a>
jmp    15cf <codepeel+0x43f>
jmp    15d4 <codepeel+0x444>
mov    -0x60(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x60(%rbp)
jmp    1344 <codepeel+0x1b4>
mov    -0x38(%rbp),%rsi
mov    $0x1,%edi
mov    $0x400,%edx
call   1040 <write@plt>
mov    -0x40(%rbp),%rsi
mov    $0x2,%edi
mov    $0x400,%edx
call   1040 <write@plt>
jmp    12e7 <codepeel+0x157>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<codepeel>:
mov    $0x1,%eax
test   %rdi,%rdi
je     14b0 <codepeel+0x320>
test   %rsi,%rsi
je     14b0 <codepeel+0x320>
test   %rdx,%rdx
je     14b0 <codepeel+0x320>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rcx,%rbx
mov    %rdi,%r12
mov    $0x400,%edi
call   10a0 <malloc@plt>
mov    %rax,%r13
mov    $0x400,%edi
call   10a0 <malloc@plt>
mov    %rax,0x48(%rsp)
mov    $0x400,%edi
call   10a0 <malloc@plt>
mov    %rax,0x40(%rsp)
lea    0x38(%rsp),%rsi
lea    0x30(%rsp),%rdx
lea    0x28(%rsp),%rcx
mov    %rbx,%rdi
call   10b0 <brkcom@plt>
mov    0x38(%rsp),%rdi
call   1050 <strlen@plt>
mov    %eax,%r14d
mov    0x30(%rsp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ebx
mov    0x28(%rsp),%rdi
call   1050 <strlen@plt>
cmp    %ebx,%eax
mov    %ebx,%edi
mov    %eax,0x14(%rsp)
cmovg  %eax,%edi
mov    %ebx,0x18(%rsp)
cmp    %ebx,%r14d
mov    %r14d,0x1c(%rsp)
cmovg  %r14d,%edi
call   10a0 <malloc@plt>
mov    %rax,%r14
mov    %r12,%rdi
call   1090 <fileno@plt>
mov    %eax,%edi
mov    %r13,%rsi
mov    $0x400,%edx
call   1060 <read@plt>
test   %eax,%eax
jle    149d <codepeel+0x30d>
mov    %eax,%ebx
movslq 0x1c(%rsp),%rax
mov    %rax,0x80(%rsp)
mov    0x18(%rsp),%ecx
movslq %ecx,%rax
mov    %rax,0x78(%rsp)
mov    0x14(%rsp),%eax
movslq %eax,%rdx
mov    %rdx,0x70(%rsp)
add    $0xffffffff,%eax
cltq
mov    %rax,0x60(%rsp)
mov    %ecx,%eax
add    $0xffffffff,%eax
cltq
mov    %rax,0x68(%rsp)
xor    %r15d,%r15d
mov    %r12,0x58(%rsp)
mov    %r13,0x50(%rsp)
jmp    1313 <codepeel+0x183>
nopw   0x0(%rax,%rax,1)
mov    $0x1,%edi
mov    0x48(%rsp),%rsi
mov    $0x400,%edx
call   1040 <write@plt>
mov    $0x2,%edi
mov    0x40(%rsp),%rsi
mov    $0x400,%edx
call   1040 <write@plt>
mov    0x58(%rsp),%r12
mov    %r12,%rdi
call   1090 <fileno@plt>
mov    %eax,%edi
mov    0x50(%rsp),%r13
mov    %r13,%rsi
mov    $0x400,%edx
call   1060 <read@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    149d <codepeel+0x30d>
mov    %r12,%rdi
call   1080 <feof@plt>
test   %rax,%rax
jne    149d <codepeel+0x30d>
mov    %ebx,%edx
add    %r13,%rdx
mov    0x48(%rsp),%rax
mov    %rax,%r12
mov    %rax,0x20(%rsp)
mov    0x40(%rsp),%rbp
mov    %rdx,0x8(%rsp)
jmp    136a <codepeel+0x1da>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %r15d,%r15d
je     13a0 <codepeel+0x210>
mov    %al,(%r12)
add    $0x1,%r12
add    $0x1,%r13
cmp    %rdx,%r13
jae    12c0 <codepeel+0x130>
mov    %r15d,%ecx
mov    0x0(%r13),%al
xor    %r15d,%r15d
test   %ecx,%ecx
sete   %r15b
cmp    $0x22,%al
cmovne %ecx,%r15d
mov    0x38(%rsp),%rcx
cmp    (%rcx),%al
je     1350 <codepeel+0x1c0>
mov    0x30(%rsp),%rcx
cmp    (%rcx),%al
je     1350 <codepeel+0x1c0>
mov    0x28(%rsp),%rcx
cmp    (%rcx),%al
je     1350 <codepeel+0x1c0>
jmp    1355 <codepeel+0x1c5>
nopl   (%rax)
mov    %r14,%rdi
mov    %r13,%rsi
mov    0x1c(%rsp),%edx
call   1030 <strncpy@plt>
mov    0x80(%rsp),%rbx
movb   $0x0,(%r14,%rbx,1)
mov    0x38(%rsp),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1432 <codepeel+0x2a2>
mov    %r14,%rdi
mov    %r13,%rsi
mov    0x18(%rsp),%edx
call   1030 <strncpy@plt>
mov    0x78(%rsp),%rax
movb   $0x0,(%r14,%rax,1)
mov    0x30(%rsp),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1445 <codepeel+0x2b5>
mov    %r14,%rdi
mov    %r13,%rsi
mov    0x14(%rsp),%edx
call   1030 <strncpy@plt>
mov    0x70(%rsp),%rax
movb   $0x0,(%r14,%rax,1)
mov    0x28(%rsp),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1486 <codepeel+0x2f6>
mov    0x0(%r13),%al
mov    %al,(%r12)
add    $0x1,%r12
jmp    1493 <codepeel+0x303>
mov    0x0(%r13,%rbx,1),%al
add    %rbx,%r13
cmp    $0xa,%al
jne    1454 <codepeel+0x2c4>
mov    0x8(%rsp),%rdx
jmp    1474 <codepeel+0x2e4>
add    0x68(%rsp),%r13
mov    %r12,0x20(%rsp)
mov    %rbp,%r12
jmp    1493 <codepeel+0x303>
mov    0x8(%rsp),%rdx
nopl   0x0(%rax)
mov    %al,0x0(%rbp)
add    $0x1,%rbp
movzbl 0x1(%r13),%eax
add    $0x1,%r13
cmp    $0xa,%al
jne    1460 <codepeel+0x2d0>
movb   $0xa,0x0(%rbp)
add    $0x1,%rbp
mov    %r12,0x20(%rsp)
jmp    135d <codepeel+0x1cd>
add    0x60(%rsp),%r13
mov    %r12,%rbp
mov    0x20(%rsp),%r12
mov    0x8(%rsp),%rdx
jmp    135d <codepeel+0x1cd>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @codepeel(i32* %0, i32* %1, i32* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i8*
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i8* %3, i8** %9
%27 = load i32*, i32** %6
%28 = icmp eq i32* %27, null
br i1 %28, label %35, label %29
29: ; preds = %4
%30 = load i32*, i32** %7
%31 = icmp eq i32* %30, null
br i1 %31, label %35, label %32
32: ; preds = %29
%33 = load i32*, i32** %8
%34 = icmp eq i32* %33, null
br i1 %34, label %35, label %36
35: ; preds = %32, %29, %4
store i32 1, i32* %5
br label %241
36: ; preds = %32
%37 = call i8* @malloc(i32 1024)
store i8* %37, i8** %10
%38 = call i8* @malloc(i32 1024)
store i8* %38, i8** %11
%39 = call i8* @malloc(i32 1024)
store i8* %39, i8** %12
%40 = load i8*, i8** %10
store i8* %40, i8** %16
%41 = load i8*, i8** %11
store i8* %41, i8** %17
%42 = load i8*, i8** %11
store i8* %42, i8** %18
%43 = load i8*, i8** %12
store i8* %43, i8** %19
%44 = load i8*, i8** %9
%45 = call i32 @brkcom(i8* %44, i8** %13, i8** %14, i8** %15)
%46 = load i8*, i8** %13
%47 = call i32 @strlen(i8* %46)
store i32 %47, i32* %21
%48 = load i8*, i8** %14
%49 = call i32 @strlen(i8* %48)
store i32 %49, i32* %22
%50 = load i8*, i8** %15
%51 = call i32 @strlen(i8* %50)
store i32 %51, i32* %23
store i32 0, i32* %24
store i32 0, i32* %25
%52 = load i32, i32* %21
%53 = load i32, i32* %22
%54 = icmp sgt i32 %52, %53
br i1 %54, label %55, label %57
55: ; preds = %36
%56 = load i32, i32* %21
br label %67
57: ; preds = %36
%58 = load i32, i32* %23
%59 = load i32, i32* %22
%60 = icmp sgt i32 %58, %59
br i1 %60, label %61, label %63
61: ; preds = %57
%62 = load i32, i32* %23
br label %65
63: ; preds = %57
%64 = load i32, i32* %22
br label %65
65: ; preds = %63, %61
%66 = phi i32 [ %62, %61 ], [ %64, %63 ]
br label %67
67: ; preds = %65, %55
%68 = phi i32 [ %56, %55 ], [ %66, %65 ]
%69 = sext i32 %68 to i64
%70 = mul i64 1, %69
%71 = trunc i64 %70 to i32
%72 = call i8* @malloc(i32 %71)
store i8* %72, i8** %26
br label %73
73: ; preds = %235, %67
%74 = load i32*, i32** %6
%75 = call i32 @fileno(i32* %74)
%76 = load i8*, i8** %10
%77 = call i32 @read(i32 %75, i8* %76, i32 1024)
store i32 %77, i32* %20
%78 = icmp sgt i32 %77, 0
br i1 %78, label %79, label %240
79: ; preds = %73
%80 = load i32*, i32** %6
%81 = call i64 @feof(i32* %80)
%82 = icmp ne i64 %81, 0
br i1 %82, label %83, label %84
83: ; preds = %79
br label %240
84: ; preds = %79
%85 = load i8*, i8** %11
store i8* %85, i8** %18
%86 = load i8*, i8** %12
store i8* %86, i8** %19
%87 = load i8*, i8** %11
store i8* %87, i8** %17
%88 = load i8*, i8** %10
store i8* %88, i8** %16
br label %89
89: ; preds = %232, %84
%90 = load i8*, i8** %16
%91 = load i8*, i8** %10
%92 = load i32, i32* %20
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8, i8* %91, i64 %93
%95 = icmp ult i8* %90, %94
br i1 %95, label %96, label %235
96: ; preds = %89
%97 = load i8*, i8** %16
%98 = load i8, i8* %97
%99 = sext i8 %98 to i32
%100 = icmp eq i32 %99, 34
br i1 %100, label %101, label %107
101: ; preds = %96
%102 = load i32, i32* %24
%103 = icmp eq i32 %102, 0
br i1 %103, label %104, label %105
104: ; preds = %101
store i32 1, i32* %24
br label %106
105: ; preds = %101
store i32 0, i32* %24
br label %106
106: ; preds = %105, %104
br label %107
107: ; preds = %106, %96
%108 = load i8*, i8** %16
%109 = load i8, i8* %108
%110 = sext i8 %109 to i32
%111 = load i8*, i8** %13
%112 = load i8, i8* %111
%113 = sext i8 %112 to i32
%114 = icmp ne i32 %110, %113
br i1 %114, label %115, label %131
115: ; preds = %107
%116 = load i8*, i8** %16
%117 = load i8, i8* %116
%118 = sext i8 %117 to i32
%119 = load i8*, i8** %14
%120 = load i8, i8* %119
%121 = sext i8 %120 to i32
%122 = icmp ne i32 %118, %121
br i1 %122, label %123, label %131
123: ; preds = %115
%124 = load i8*, i8** %16
%125 = load i8, i8* %124
%126 = sext i8 %125 to i32
%127 = load i8*, i8** %15
%128 = load i8, i8* %127
%129 = sext i8 %128 to i32
%130 = icmp ne i32 %126, %129
br i1 %130, label %134, label %131
131: ; preds = %123, %115, %107
%132 = load i32, i32* %24
%133 = icmp ne i32 %132, 0
br i1 %133, label %134, label %139
134: ; preds = %131, %123
%135 = load i8*, i8** %16
%136 = load i8, i8* %135
%137 = load i8*, i8** %17
%138 = getelementptr inbounds i8, i8* %137, i32 1
store i8* %138, i8** %17
store i8 %136, i8* %137
br label %231
139: ; preds = %131
%140 = load i8*, i8** %26
%141 = load i8*, i8** %16
%142 = load i32, i32* %21
%143 = call i32 @strncpy(i8* %140, i8* %141, i32 %142)
%144 = load i8*, i8** %26
%145 = load i32, i32* %21
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds i8, i8* %144, i64 %146
store i8 0, i8* %147
%148 = load i8*, i8** %26
%149 = load i8*, i8** %13
%150 = call i64 @strcmp(i8* %148, i8* %149)
%151 = icmp eq i64 %150, 0
br i1 %151, label %152, label %181
152: ; preds = %139
%153 = load i8*, i8** %17
store i8* %153, i8** %18
%154 = load i8*, i8** %19
store i8* %154, i8** %17
%155 = load i32, i32* %21
%156 = load i8*, i8** %16
%157 = sext i32 %155 to i64
%158 = getelementptr inbounds i8, i8* %156, i64 %157
store i8* %158, i8** %16
br label %159
159: ; preds = %164, %152
%160 = load i8*, i8** %16
%161 = load i8, i8* %160
%162 = sext i8 %161 to i32
%163 = icmp ne i32 %162, 10
br i1 %163, label %164, label %170
164: ; preds = %159
%165 = load i8*, i8** %16
%166 = getelementptr inbounds i8, i8* %165, i32 1
store i8* %166, i8** %16
%167 = load i8, i8* %165
%168 = load i8*, i8** %17
%169 = getelementptr inbounds i8, i8* %168, i32 1
store i8* %169, i8** %17
store i8 %167, i8* %168
br label %159
170: ; preds = %159
%171 = load i8*, i8** %16
%172 = load i8, i8* %171
%173 = sext i8 %172 to i32
%174 = icmp eq i32 %173, 10
br i1 %174, label %175, label %178
175: ; preds = %170
%176 = load i8*, i8** %17
%177 = getelementptr inbounds i8, i8* %176, i32 1
store i8* %177, i8** %17
store i8 10, i8* %176
br label %178
178: ; preds = %175, %170
%179 = load i8*, i8** %17
store i8* %179, i8** %19
%180 = load i8*, i8** %18
store i8* %180, i8** %17
br label %230
181: ; preds = %139
%182 = load i8*, i8** %26
%183 = load i8*, i8** %16
%184 = load i32, i32* %22
%185 = call i32 @strncpy(i8* %182, i8* %183, i32 %184)
%186 = load i8*, i8** %26
%187 = load i32, i32* %22
%188 = sext i32 %187 to i64
%189 = getelementptr inbounds i8, i8* %186, i64 %188
store i8 0, i8* %189
%190 = load i8*, i8** %26
%191 = load i8*, i8** %14
%192 = call i64 @strcmp(i8* %190, i8* %191)
%193 = icmp eq i64 %192, 0
br i1 %193, label %194, label %202
194: ; preds = %181
%195 = load i8*, i8** %17
store i8* %195, i8** %18
%196 = load i8*, i8** %19
store i8* %196, i8** %17
%197 = load i32, i32* %22
%198 = sub nsw i32 %197, 1
%199 = load i8*, i8** %16
%200 = sext i32 %198 to i64
%201 = getelementptr inbounds i8, i8* %199, i64 %200
store i8* %201, i8** %16
br label %229
202: ; preds = %181
%203 = load i8*, i8** %26
%204 = load i8*, i8** %16
%205 = load i32, i32* %23
%206 = call i32 @strncpy(i8* %203, i8* %204, i32 %205)
%207 = load i8*, i8** %26
%208 = load i32, i32* %23
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds i8, i8* %207, i64 %209
store i8 0, i8* %210
%211 = load i8*, i8** %26
%212 = load i8*, i8** %15
%213 = call i64 @strcmp(i8* %211, i8* %212)
%214 = icmp eq i64 %213, 0
br i1 %214, label %215, label %223
215: ; preds = %202
%216 = load i8*, i8** %17
store i8* %216, i8** %19
%217 = load i8*, i8** %18
store i8* %217, i8** %17
%218 = load i32, i32* %23
%219 = sub nsw i32 %218, 1
%220 = load i8*, i8** %16
%221 = sext i32 %219 to i64
%222 = getelementptr inbounds i8, i8* %220, i64 %221
store i8* %222, i8** %16
br label %228
223: ; preds = %202
%224 = load i8*, i8** %16
%225 = load i8, i8* %224
%226 = load i8*, i8** %17
%227 = getelementptr inbounds i8, i8* %226, i32 1
store i8* %227, i8** %17
store i8 %225, i8* %226
br label %228
228: ; preds = %223, %215
br label %229
229: ; preds = %228, %194
br label %230
230: ; preds = %229, %178
br label %231
231: ; preds = %230, %134
br label %232
232: ; preds = %231
%233 = load i8*, i8** %16
%234 = getelementptr inbounds i8, i8* %233, i32 1
store i8* %234, i8** %16
br label %89
235: ; preds = %89
%236 = load i8*, i8** %11
%237 = call i32 @write(i32 1, i8* %236, i32 1024)
%238 = load i8*, i8** %12
%239 = call i32 @write(i32 2, i8* %238, i32 1024)
br label %73
240: ; preds = %83, %73
store i32 0, i32* %5
br label %241
241: ; preds = %240, %35
%242 = load i32, i32* %5
ret i32 %242
}

LLVM IR (-O2):
define i32 @codepeel(i32* %0, i32* readnone %1, i32* readnone %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = icmp eq i32* %0, null
%9 = icmp eq i32* %1, null
%10 = or i1 %8, %9
%11 = icmp eq i32* %2, null
%12 = or i1 %10, %11
br i1 %12, label %134, label %13
13: ; preds = %4
%14 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%15 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%16 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%17 = bitcast i8** %5 to i8*
%18 = bitcast i8** %6 to i8*
%19 = bitcast i8** %7 to i8*
%20 = call i32 @brkcom(i8* %3, i8** %5, i8** %6, i8** %7)
%21 = load i8*, i8** %5
%22 = call i32 @strlen(i8* %21)
%23 = load i8*, i8** %6
%24 = call i32 @strlen(i8* %23)
%25 = load i8*, i8** %7
%26 = call i32 @strlen(i8* %25)
%27 = icmp sgt i32 %22, %24
%28 = icmp sgt i32 %26, %24
%29 = select i1 %28, i32 %26, i32 %24
%30 = select i1 %27, i32 %22, i32 %29
%31 = call i8* @malloc(i32 %30)
%32 = call i32 @fileno(i32* %0)
%33 = call i32 @read(i32 %32, i8* %14, i32 1024)
%34 = icmp sgt i32 %33, 0
br i1 %34, label %35, label %133
35: ; preds = %13
%36 = sext i32 %22 to i64
%37 = getelementptr inbounds i8, i8* %31, i64 %36
%38 = sext i32 %24 to i64
%39 = getelementptr inbounds i8, i8* %31, i64 %38
%40 = sext i32 %26 to i64
%41 = getelementptr inbounds i8, i8* %31, i64 %40
%42 = add nsw i32 %26, -1
%43 = sext i32 %42 to i64
%44 = add nsw i32 %24, -1
%45 = sext i32 %44 to i64
br label %46
46: ; preds = %35, %127
%47 = phi i32 [ %33, %35 ], [ %131, %127 ]
%48 = phi i32 [ 0, %35 ], [ %64, %127 ]
%49 = call i64 @feof(i32* %0)
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %133
51: ; preds = %46
%52 = zext i32 %47 to i64
%53 = getelementptr inbounds i8, i8* %14, i64 %52
br label %54
54: ; preds = %51, %120
%55 = phi i8* [ %125, %120 ], [ %14, %51 ]
%56 = phi i32 [ %64, %120 ], [ %48, %51 ]
%57 = phi i8* [ %123, %120 ], [ %15, %51 ]
%58 = phi i8* [ %122, %120 ], [ %15, %51 ]
%59 = phi i8* [ %121, %120 ], [ %16, %51 ]
%60 = load i8, i8* %55
%61 = icmp eq i8 %60, 34
%62 = icmp eq i32 %56, 0
%63 = zext i1 %62 to i32
%64 = select i1 %61, i32 %63, i32 %56
%65 = load i8*, i8** %5
%66 = load i8, i8* %65
%67 = icmp eq i8 %60, %66
br i1 %67, label %78, label %68
68: ; preds = %54
%69 = load i8*, i8** %6
%70 = load i8, i8* %69
%71 = icmp eq i8 %60, %70
br i1 %71, label %78, label %72
72: ; preds = %68
%73 = load i8*, i8** %7
%74 = load i8, i8* %73
%75 = icmp ne i8 %60, %74
%76 = icmp ne i32 %64, 0
%77 = select i1 %75, i1 true, i1 %76
br i1 %77, label %80, label %82
78: ; preds = %68, %54
%79 = icmp eq i32 %64, 0
br i1 %79, label %82, label %80
80: ; preds = %78, %72
%81 = getelementptr inbounds i8, i8* %57, i64 1
store i8 %60, i8* %57
br label %120
82: ; preds = %72, %78
%83 = call i32 @strncpy(i8* %31, i8* %55, i32 %22)
store i8 0, i8* %37
%84 = load i8*, i8** %5
%85 = call i64 @strcmp(i8* %31, i8* %84)
%86 = icmp eq i64 %85, 0
br i1 %86, label %87, label %103
87: ; preds = %82
%88 = getelementptr inbounds i8, i8* %55, i64 %36
%89 = load i8, i8* %88
%90 = icmp eq i8 %89, 10
br i1 %90, label %99, label %91
91: ; preds = %87, %91
%92 = phi i8 [ %97, %91 ], [ %89, %87 ]
%93 = phi i8* [ %95, %91 ], [ %88, %87 ]
%94 = phi i8* [ %96, %91 ], [ %59, %87 ]
%95 = getelementptr inbounds i8, i8* %93, i64 1
%96 = getelementptr inbounds i8, i8* %94, i64 1
store i8 %92, i8* %94
%97 = load i8, i8* %95
%98 = icmp eq i8 %97, 10
br i1 %98, label %99, label %91
99: ; preds = %91, %87
%100 = phi i8* [ %59, %87 ], [ %96, %91 ]
%101 = phi i8* [ %88, %87 ], [ %95, %91 ]
store i8 10, i8* %100
%102 = getelementptr inbounds i8, i8* %100, i64 1
br label %120
103: ; preds = %82
%104 = call i32 @strncpy(i8* %31, i8* %55, i32 %24)
store i8 0, i8* %39
%105 = load i8*, i8** %6
%106 = call i64 @strcmp(i8* %31, i8* %105)
%107 = icmp eq i64 %106, 0
br i1 %107, label %108, label %110
108: ; preds = %103
%109 = getelementptr inbounds i8, i8* %55, i64 %45
br label %120
110: ; preds = %103
%111 = call i32 @strncpy(i8* %31, i8* %55, i32 %26)
store i8 0, i8* %41
%112 = load i8*, i8** %7
%113 = call i64 @strcmp(i8* %31, i8* %112)
%114 = icmp eq i64 %113, 0
br i1 %114, label %115, label %117
115: ; preds = %110
%116 = getelementptr inbounds i8, i8* %55, i64 %43
br label %120
117: ; preds = %110
%118 = load i8, i8* %55
%119 = getelementptr inbounds i8, i8* %57, i64 1
store i8 %118, i8* %57
br label %120
120: ; preds = %80, %108, %117, %115, %99
%121 = phi i8* [ %59, %80 ], [ %102, %99 ], [ %59, %108 ], [ %57, %115 ], [ %59, %117 ]
%122 = phi i8* [ %58, %80 ], [ %57, %99 ], [ %57, %108 ], [ %58, %115 ], [ %58, %117 ]
%123 = phi i8* [ %81, %80 ], [ %57, %99 ], [ %59, %108 ], [ %58, %115 ], [ %119, %117 ]
%124 = phi i8* [ %55, %80 ], [ %101, %99 ], [ %109, %108 ], [ %116, %115 ], [ %55, %117 ]
%125 = getelementptr inbounds i8, i8* %124, i64 1
%126 = icmp ult i8* %125, %53
br i1 %126, label %54, label %127
127: ; preds = %120
%128 = call i32 @write(i32 1, i8* %15, i32 1024)
%129 = call i32 @write(i32 2, i8* %16, i32 1024)
%130 = call i32 @fileno(i32* %0)
%131 = call i32 @read(i32 %130, i8* %14, i32 1024)
%132 = icmp sgt i32 %131, 0
br i1 %132, label %46, label %133
133: ; preds = %127, %46, %13
br label %134
134: ; preds = %4, %133
%135 = phi i32 [ 0, %133 ], [ 1, %4 ]
ret i32 %135
}