#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 */
char EOF;
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
void readFile(FILE *f, FILE *out1, FILE *out2, FILE *out3, FILE *out4) {
  char get, save[2];
  int i = 3;
  while ((get = fgetc(f)) != EOF) {
    save[0] = get;
    if ((get = fgetc(f)) != EOF) {
      save[1] = get;
      if ((get = fgetc(f)) != EOF) {
        switch (i) {
        case 0:
          fputc((save[0] ^ save[1] ^ get), out1);
          fputc(save[0], out2);
          fputc(save[1], out3);
          fputc(get, out4);
          i = 3;
          break;
        case 1:
          fputc(save[0], out1);
          fputc((save[0] ^ save[1] ^ get), out2);
          fputc(save[1], out3);
          fputc(get, out4);
          i--;
          break;
        case 2:
          fputc(save[0], out1);
          fputc(save[1], out2);
          fputc((save[0] ^ save[1] ^ get), out3);
          fputc(get, out4);
          i--;
          break;
        case 3:
          fputc(save[0], out1);
          fputc(save[1], out2);
          fputc(get, out3);
          fputc((save[0] ^ save[1] ^ get), out4);
          i--;
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<readFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x3,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x29(%rbp)
movsbl %al,%eax
mov    0x2e8f(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     133b <readFile+0x21b>
mov    -0x29(%rbp),%al
mov    %al,-0x2b(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x29(%rbp)
movsbl %al,%eax
mov    0x2e68(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1336 <readFile+0x216>
mov    -0x29(%rbp),%al
mov    %al,-0x2a(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x29(%rbp)
movsbl %al,%eax
mov    0x2e41(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1331 <readFile+0x211>
mov    -0x30(%rbp),%eax
mov    %rax,-0x38(%rbp)
sub    $0x3,%rax
ja     132c <readFile+0x20c>
mov    -0x38(%rbp),%rax
lea    0xe32(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsbl -0x2b(%rbp),%eax
movsbl -0x2a(%rbp),%ecx
xor    %ecx,%eax
movsbl -0x29(%rbp),%ecx
xor    %ecx,%eax
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
mov    -0x2b(%rbp),%al
mov    -0x18(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
mov    -0x2a(%rbp),%al
mov    -0x20(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
mov    -0x29(%rbp),%al
mov    -0x28(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
movl   $0x3,-0x30(%rbp)
jmp    132c <readFile+0x20c>
mov    -0x2b(%rbp),%al
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
movsbl -0x2b(%rbp),%eax
movsbl -0x2a(%rbp),%ecx
xor    %ecx,%eax
movsbl -0x29(%rbp),%ecx
xor    %ecx,%eax
mov    -0x18(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
mov    -0x2a(%rbp),%al
mov    -0x20(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
mov    -0x29(%rbp),%al
mov    -0x28(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
jmp    132c <readFile+0x20c>
mov    -0x2b(%rbp),%al
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
mov    -0x2a(%rbp),%al
mov    -0x18(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
movsbl -0x2b(%rbp),%eax
movsbl -0x2a(%rbp),%ecx
xor    %ecx,%eax
movsbl -0x29(%rbp),%ecx
xor    %ecx,%eax
mov    -0x20(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
mov    -0x29(%rbp),%al
mov    -0x28(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
jmp    132c <readFile+0x20c>
mov    -0x2b(%rbp),%al
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
mov    -0x2a(%rbp),%al
mov    -0x18(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
mov    -0x29(%rbp),%al
mov    -0x20(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
movsbl -0x2b(%rbp),%eax
movsbl -0x2a(%rbp),%ecx
xor    %ecx,%eax
movsbl -0x29(%rbp),%ecx
xor    %ecx,%eax
mov    -0x28(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
jmp    1331 <readFile+0x211>
jmp    1336 <readFile+0x216>
jmp    1143 <readFile+0x23>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readFile>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,0x20(%rsp)
mov    %rcx,0x18(%rsp)
mov    %rdx,0x10(%rsp)
mov    %rsi,0x8(%rsp)
mov    %rdi,%rbx
call   1030 <fgetc@plt>
mov    0x2e97(%rip),%r12
cmp    (%r12),%al
jne    1166 <readFile+0x46>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%r14d
mov    $0x3,%r13d
jmp    11d1 <readFile+0xb1>
movsbl %r14b,%edi
mov    0x8(%rsp),%rsi
call   1040 <fputc@plt>
movsbl %r15b,%edi
mov    0x10(%rsp),%rsi
call   1040 <fputc@plt>
movsbl %bpl,%edi
mov    0x18(%rsp),%rsi
call   1040 <fputc@plt>
xor    %r14b,%r15b
xor    %r15b,%bpl
mov    $0x2,%r13d
movsbl %bpl,%edi
mov    0x20(%rsp),%rsi
call   1040 <fputc@plt>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %eax,%r14d
cmp    (%r12),%al
je     1157 <readFile+0x37>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    (%r12),%al
je     11c0 <readFile+0xa0>
mov    %eax,%r15d
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    (%r12),%al
je     11c0 <readFile+0xa0>
cmp    $0x3,%r13d
ja     11c0 <readFile+0xa0>
mov    %eax,%ebp
mov    %r13d,%eax
lea    0xdfe(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %r15d,%eax
xor    %r14b,%al
xor    %bpl,%al
movsbl %al,%edi
mov    0x8(%rsp),%rsi
call   1040 <fputc@plt>
movsbl %r14b,%edi
mov    0x10(%rsp),%rsi
call   1040 <fputc@plt>
movsbl %r15b,%edi
mov    0x18(%rsp),%rsi
call   1040 <fputc@plt>
mov    $0x3,%r13d
jmp    11a7 <readFile+0x87>
movsbl %r14b,%edi
mov    0x8(%rsp),%rsi
call   1040 <fputc@plt>
xor    %r15b,%r14b
xor    %bpl,%r14b
movsbl %r14b,%edi
mov    0x10(%rsp),%rsi
call   1040 <fputc@plt>
movsbl %r15b,%edi
mov    0x18(%rsp),%rsi
call   1040 <fputc@plt>
xor    %r13d,%r13d
jmp    11a7 <readFile+0x87>
movsbl %r14b,%edi
mov    0x8(%rsp),%rsi
call   1040 <fputc@plt>
movsbl %r15b,%edi
mov    0x10(%rsp),%rsi
call   1040 <fputc@plt>
xor    %r14b,%r15b
xor    %bpl,%r15b
movsbl %r15b,%edi
mov    0x18(%rsp),%rsi
call   1040 <fputc@plt>
mov    $0x1,%r13d
jmp    11a7 <readFile+0x87>

LLVM IR (-O0):
@EOF = global i8 0
define void @readFile(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i8
%12 = alloca [2 x i8]
%13 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
store i32 3, i32* %13
br label %14
14: ; preds = %149, %5
%15 = load i32*, i32** %6
%16 = call signext i8 @fgetc(i32* %15)
store i8 %16, i8* %11
%17 = sext i8 %16 to i32
%18 = load i8, i8* @EOF
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %17, %19
br i1 %20, label %21, label %150
21: ; preds = %14
%22 = load i8, i8* %11
%23 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 0
store i8 %22, i8* %23
%24 = load i32*, i32** %6
%25 = call signext i8 @fgetc(i32* %24)
store i8 %25, i8* %11
%26 = sext i8 %25 to i32
%27 = load i8, i8* @EOF
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %26, %28
br i1 %29, label %30, label %149
30: ; preds = %21
%31 = load i8, i8* %11
%32 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 1
store i8 %31, i8* %32
%33 = load i32*, i32** %6
%34 = call signext i8 @fgetc(i32* %33)
store i8 %34, i8* %11
%35 = sext i8 %34 to i32
%36 = load i8, i8* @EOF
%37 = sext i8 %36 to i32
%38 = icmp ne i32 %35, %37
br i1 %38, label %39, label %148
39: ; preds = %30
%40 = load i32, i32* %13
switch i32 %40, label %147 [
i32 0, label %41
i32 1, label %66
i32 2, label %93
i32 3, label %120
]
41: ; preds = %39
%42 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 0
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 1
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = xor i32 %44, %47
%49 = load i8, i8* %11
%50 = sext i8 %49 to i32
%51 = xor i32 %48, %50
%52 = trunc i32 %51 to i8
%53 = load i32*, i32** %7
%54 = call i32 @fputc(i8 signext %52, i32* %53)
%55 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 0
%56 = load i8, i8* %55
%57 = load i32*, i32** %8
%58 = call i32 @fputc(i8 signext %56, i32* %57)
%59 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 1
%60 = load i8, i8* %59
%61 = load i32*, i32** %9
%62 = call i32 @fputc(i8 signext %60, i32* %61)
%63 = load i8, i8* %11
%64 = load i32*, i32** %10
%65 = call i32 @fputc(i8 signext %63, i32* %64)
store i32 3, i32* %13
br label %147
66: ; preds = %39
%67 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 0
%68 = load i8, i8* %67
%69 = load i32*, i32** %7
%70 = call i32 @fputc(i8 signext %68, i32* %69)
%71 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 0
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 1
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = xor i32 %73, %76
%78 = load i8, i8* %11
%79 = sext i8 %78 to i32
%80 = xor i32 %77, %79
%81 = trunc i32 %80 to i8
%82 = load i32*, i32** %8
%83 = call i32 @fputc(i8 signext %81, i32* %82)
%84 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 1
%85 = load i8, i8* %84
%86 = load i32*, i32** %9
%87 = call i32 @fputc(i8 signext %85, i32* %86)
%88 = load i8, i8* %11
%89 = load i32*, i32** %10
%90 = call i32 @fputc(i8 signext %88, i32* %89)
%91 = load i32, i32* %13
%92 = add nsw i32 %91, -1
store i32 %92, i32* %13
br label %147
93: ; preds = %39
%94 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 0
%95 = load i8, i8* %94
%96 = load i32*, i32** %7
%97 = call i32 @fputc(i8 signext %95, i32* %96)
%98 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 1
%99 = load i8, i8* %98
%100 = load i32*, i32** %8
%101 = call i32 @fputc(i8 signext %99, i32* %100)
%102 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 0
%103 = load i8, i8* %102
%104 = sext i8 %103 to i32
%105 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 1
%106 = load i8, i8* %105
%107 = sext i8 %106 to i32
%108 = xor i32 %104, %107
%109 = load i8, i8* %11
%110 = sext i8 %109 to i32
%111 = xor i32 %108, %110
%112 = trunc i32 %111 to i8
%113 = load i32*, i32** %9
%114 = call i32 @fputc(i8 signext %112, i32* %113)
%115 = load i8, i8* %11
%116 = load i32*, i32** %10
%117 = call i32 @fputc(i8 signext %115, i32* %116)
%118 = load i32, i32* %13
%119 = add nsw i32 %118, -1
store i32 %119, i32* %13
br label %147
120: ; preds = %39
%121 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 0
%122 = load i8, i8* %121
%123 = load i32*, i32** %7
%124 = call i32 @fputc(i8 signext %122, i32* %123)
%125 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 1
%126 = load i8, i8* %125
%127 = load i32*, i32** %8
%128 = call i32 @fputc(i8 signext %126, i32* %127)
%129 = load i8, i8* %11
%130 = load i32*, i32** %9
%131 = call i32 @fputc(i8 signext %129, i32* %130)
%132 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 0
%133 = load i8, i8* %132
%134 = sext i8 %133 to i32
%135 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 1
%136 = load i8, i8* %135
%137 = sext i8 %136 to i32
%138 = xor i32 %134, %137
%139 = load i8, i8* %11
%140 = sext i8 %139 to i32
%141 = xor i32 %138, %140
%142 = trunc i32 %141 to i8
%143 = load i32*, i32** %10
%144 = call i32 @fputc(i8 signext %142, i32* %143)
%145 = load i32, i32* %13
%146 = add nsw i32 %145, -1
store i32 %146, i32* %13
br label %147
147: ; preds = %120, %39, %93, %66, %41
br label %148
148: ; preds = %147, %30
br label %149
149: ; preds = %148, %21
br label %14
150: ; preds = %14
ret void
}

LLVM IR (-O2):
@EOF = global i8 0
define void @readFile(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture %3, i32* nocapture %4) {
%6 = tail call signext i8 @fgetc(i32* %0)
%7 = load i8, i8* @EOF
%8 = icmp eq i8 %6, %7
br i1 %8, label %53, label %9
9: ; preds = %5, %48
%10 = phi i8 [ %50, %48 ], [ %6, %5 ]
%11 = phi i32 [ %49, %48 ], [ 3, %5 ]
%12 = tail call signext i8 @fgetc(i32* %0)
%13 = load i8, i8* @EOF
%14 = icmp eq i8 %12, %13
br i1 %14, label %48, label %15
15: ; preds = %9
%16 = tail call signext i8 @fgetc(i32* %0)
%17 = load i8, i8* @EOF
%18 = icmp eq i8 %16, %17
br i1 %18, label %48, label %19
19: ; preds = %15
switch i32 %11, label %48 [
i32 0, label %20
i32 1, label %26
i32 2, label %32
i32 3, label %38
]
20: ; preds = %19
%21 = xor i8 %12, %10
%22 = xor i8 %21, %16
%23 = tail call i32 @fputc(i8 signext %22, i32* %1)
%24 = tail call i32 @fputc(i8 signext %10, i32* %2)
%25 = tail call i32 @fputc(i8 signext %12, i32* %3)
br label %44
26: ; preds = %19
%27 = tail call i32 @fputc(i8 signext %10, i32* %1)
%28 = xor i8 %12, %10
%29 = xor i8 %28, %16
%30 = tail call i32 @fputc(i8 signext %29, i32* %2)
%31 = tail call i32 @fputc(i8 signext %12, i32* %3)
br label %44
32: ; preds = %19
%33 = tail call i32 @fputc(i8 signext %10, i32* %1)
%34 = tail call i32 @fputc(i8 signext %12, i32* %2)
%35 = xor i8 %12, %10
%36 = xor i8 %35, %16
%37 = tail call i32 @fputc(i8 signext %36, i32* %3)
br label %44
38: ; preds = %19
%39 = tail call i32 @fputc(i8 signext %10, i32* %1)
%40 = tail call i32 @fputc(i8 signext %12, i32* %2)
%41 = tail call i32 @fputc(i8 signext %16, i32* %3)
%42 = xor i8 %12, %10
%43 = xor i8 %42, %16
br label %44
44: ; preds = %20, %26, %32, %38
%45 = phi i8 [ %43, %38 ], [ %16, %32 ], [ %16, %26 ], [ %16, %20 ]
%46 = phi i32 [ 2, %38 ], [ 1, %32 ], [ 0, %26 ], [ 3, %20 ]
%47 = tail call i32 @fputc(i8 signext %45, i32* %4)
br label %48
48: ; preds = %44, %15, %19, %9
%49 = phi i32 [ %11, %19 ], [ %11, %15 ], [ %11, %9 ], [ %46, %44 ]
%50 = tail call signext i8 @fgetc(i32* %0)
%51 = load i8, i8* @EOF
%52 = icmp eq i8 %50, %51
br i1 %52, label %53, label %9
53: ; preds = %48, %5
ret void
}