#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 */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  char buf[1024];
  if (argc != 3) {
    fprintf(stderr, "missing argument\n");
    exit(1);
  }
  FILE *fp, *fpw;
  fp = fopen(argv[1], "r");
  fpw = fopen(argv[2], "w");
  if (fp && fpw) {
    while (!feof(fp)) {
      int count, i;
      count = fread(buf, 1, 1024, fp);
      for (i = 0; i < count; i++)
        buf[i] ^= 0xD8;
      fwrite(buf, 1, count, fpw);
    }
    fclose(fp);
    fclose(fpw);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11b2 <main+0x42>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe51(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x418(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe38(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x420(%rbp)
cmpq   $0x0,-0x418(%rbp)
je     12d4 <main+0x164>
cmpq   $0x0,-0x420(%rbp)
je     12d4 <main+0x164>
jmp    1209 <main+0x99>
mov    -0x418(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    122a <main+0xba>
jmp    12bc <main+0x14c>
lea    -0x410(%rbp),%rdi
mov    -0x418(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   1030 <fread@plt>
mov    %eax,-0x424(%rbp)
movl   $0x0,-0x428(%rbp)
mov    -0x428(%rbp),%eax
cmp    -0x424(%rbp),%eax
jge    1299 <main+0x129>
movslq -0x428(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%ecx
ff
xor    $0xd8,%ecx
mov    %cl,-0x410(%rbp,%rax,1)
mov    -0x428(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x428(%rbp)
jmp    1257 <main+0xe7>
lea    -0x410(%rbp),%rdi
mov    -0x424(%rbp),%edx
mov    -0x420(%rbp),%rcx
mov    $0x1,%esi
call   1090 <fwrite@plt>
jmp    1209 <main+0x99>
mov    -0x418(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x420(%rbp),%rdi
call   1040 <fclose@plt>
xor    %edi,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x408,%rsp
cmp    $0x3,%edi
jne    132c <main+0x1bc>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xe8d(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r12
mov    0x10(%r14),%rdi
lea    0xe7c(%rip),%rsi
call   1070 <fopen@plt>
test   %r12,%r12
je     135b <main+0x1eb>
mov    %rax,%r14
test   %rax,%rax
je     135b <main+0x1eb>
mov    %r12,%rdi
call   1060 <feof@plt>
test   %eax,%eax
jne    134b <main+0x1db>
mov    %rsp,%r15
movabs $0xd8d8d8d8d8d8d8d8,%rbx
d8 d8 d8
jmp    1212 <main+0xa2>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    $0x1,%esi
mov    %eax,%edx
mov    %r14,%rcx
call   1090 <fwrite@plt>
mov    %r12,%rdi
call   1060 <feof@plt>
test   %eax,%eax
jne    134b <main+0x1db>
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
test   %eax,%eax
jle    11f0 <main+0x80>
mov    %eax,%ecx
cmp    $0x8,%eax
jae    1240 <main+0xd0>
xor    %edx,%edx
jmp    1310 <main+0x1a0>
nopl   0x0(%rax)
cmp    $0x20,%eax
jae    124c <main+0xdc>
xor    %edx,%edx
jmp    12e8 <main+0x178>
mov    %ecx,%edx
and    $0xffffffe0,%edx
lea    -0x20(%rdx),%rsi
mov    %rsi,%r8
shr    $0x5,%r8
add    $0x1,%r8
test   %rsi,%rsi
movaps 0xd96(%rip),%xmm2
je     1322 <main+0x1b2>
mov    %r8,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %edi,%edi
nopl   0x0(%rax)
movaps (%rsp,%rdi,1),%xmm0
xorps  %xmm2,%xmm0
movaps 0x10(%rsp,%rdi,1),%xmm1
xorps  %xmm2,%xmm1
movaps %xmm0,(%rsp,%rdi,1)
movaps %xmm1,0x10(%rsp,%rdi,1)
movaps 0x20(%rsp,%rdi,1),%xmm0
xorps  %xmm2,%xmm0
movaps 0x30(%rsp,%rdi,1),%xmm1
xorps  %xmm2,%xmm1
movaps %xmm0,0x20(%rsp,%rdi,1)
movaps %xmm1,0x30(%rsp,%rdi,1)
add    $0x40,%rdi
add    $0xfffffffffffffffe,%rsi
jne    1280 <main+0x110>
test   $0x1,%r8b
je     12da <main+0x16a>
movaps (%rsp,%rdi,1),%xmm0
xorps  %xmm2,%xmm0
movaps 0x10(%rsp,%rdi,1),%xmm1
xorps  %xmm2,%xmm1
movaps %xmm0,(%rsp,%rdi,1)
movaps %xmm1,0x10(%rsp,%rdi,1)
cmp    %rcx,%rdx
je     11f0 <main+0x80>
test   $0x18,%cl
je     1310 <main+0x1a0>
mov    %rdx,%rsi
mov    %ecx,%edx
and    $0xfffffff8,%edx
xor    %rbx,(%rsp,%rsi,1)
add    $0x8,%rsi
cmp    %rsi,%rdx
jne    12f0 <main+0x180>
cmp    %rcx,%rdx
je     11f0 <main+0x80>
cs nopw 0x0(%rax,%rax,1)
xorb   $0xd8,(%rsp,%rdx,1)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1310 <main+0x1a0>
jmp    11f0 <main+0x80>
xor    %edi,%edi
test   $0x1,%r8b
jne    12c2 <main+0x152>
jmp    12da <main+0x16a>
mov    0x2cad(%rip),%rax
mov    (%rax),%edi
lea    0xcd4(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"missing argument\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c"w\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 3
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %21, i32** %7
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %25, i32** %8
%26 = load i32*, i32** %7
%27 = icmp ne i32* %26, null
br i1 %27, label %28, label %66
28: ; preds = %17
%29 = load i32*, i32** %8
%30 = icmp ne i32* %29, null
br i1 %30, label %31, label %66
31: ; preds = %28
br label %32
32: ; preds = %56, %31
%33 = load i32*, i32** %7
%34 = call i32 @feof(i32* %33)
%35 = icmp ne i32 %34, 0
%36 = xor i1 %35, true
br i1 %36, label %37, label %61
37: ; preds = %32
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%39 = load i32*, i32** %7
%40 = call i32 @fread(i8* %38, i32 1, i32 1024, i32* %39)
store i32 %40, i32* %9
store i32 0, i32* %10
br label %41
41: ; preds = %53, %37
%42 = load i32, i32* %10
%43 = load i32, i32* %9
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %56
45: ; preds = %41
%46 = load i32, i32* %10
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %47
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = xor i32 %50, 216
%52 = trunc i32 %51 to i8
store i8 %52, i8* %48
br label %53
53: ; preds = %45
%54 = load i32, i32* %10
%55 = add nsw i32 %54, 1
store i32 %55, i32* %10
br label %41
56: ; preds = %41
%57 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%58 = load i32, i32* %9
%59 = load i32*, i32** %8
%60 = call i32 @fwrite(i8* %57, i32 1, i32 %58, i32* %59)
br label %32
61: ; preds = %32
%62 = load i32*, i32** %7
%63 = call i32 @fclose(i32* %62)
%64 = load i32*, i32** %8
%65 = call i32 @fclose(i32* %64)
br label %66
66: ; preds = %61, %28, %17
%67 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"missing argument\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c"w\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 3
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp ne i32* %13, null
%18 = icmp ne i32* %16, null
%19 = and i1 %17, %18
br i1 %19, label %20, label %116
20: ; preds = %10
%21 = tail call i32 @feof(i32* %13)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %113
23: ; preds = %20, %109
%24 = call i32 @fread(i8* %4, i32 1, i32 1024, i32* %13)
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %109
26: ; preds = %23
%27 = zext i32 %24 to i64
%28 = icmp ult i32 %24, 8
br i1 %28, label %100, label %29
29: ; preds = %26
%30 = icmp ult i32 %24, 32
br i1 %30, label %86, label %31
31: ; preds = %29
%32 = and i64 %27, 4294967264
%33 = add nsw i64 %32, -32
%34 = lshr exact i64 %33, 5
%35 = add nuw nsw i64 %34, 1
%36 = and i64 %35, 1
%37 = icmp eq i64 %33, 0
br i1 %37, label %67, label %38
38: ; preds = %31
%39 = and i64 %35, 1152921504606846974
br label %40
40: ; preds = %40, %38
%41 = phi i64 [ 0, %38 ], [ %64, %40 ]
%42 = phi i64 [ 0, %38 ], [ %65, %40 ]
%43 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %41
%44 = bitcast i8* %43 to <16 x i8>*
%45 = load <16 x i8>, <16 x i8>* %44
%46 = getelementptr inbounds i8, i8* %43, i64 16
%47 = bitcast i8* %46 to <16 x i8>*
%48 = load <16 x i8>, <16 x i8>* %47
%49 = xor <16 x i8> %45, <i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40>
%50 = xor <16 x i8> %48, <i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40>
%51 = bitcast i8* %43 to <16 x i8>*
store <16 x i8> %49, <16 x i8>* %51
%52 = bitcast i8* %46 to <16 x i8>*
store <16 x i8> %50, <16 x i8>* %52
%53 = or i64 %41, 32
%54 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %53
%55 = bitcast i8* %54 to <16 x i8>*
%56 = load <16 x i8>, <16 x i8>* %55
%57 = getelementptr inbounds i8, i8* %54, i64 16
%58 = bitcast i8* %57 to <16 x i8>*
%59 = load <16 x i8>, <16 x i8>* %58
%60 = xor <16 x i8> %56, <i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40>
%61 = xor <16 x i8> %59, <i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40>
%62 = bitcast i8* %54 to <16 x i8>*
store <16 x i8> %60, <16 x i8>* %62
%63 = bitcast i8* %57 to <16 x i8>*
store <16 x i8> %61, <16 x i8>* %63
%64 = add nuw i64 %41, 64
%65 = add i64 %42, 2
%66 = icmp eq i64 %65, %39
br i1 %66, label %67, label %40
67: ; preds = %40, %31
%68 = phi i64 [ 0, %31 ], [ %64, %40 ]
%69 = icmp eq i64 %36, 0
br i1 %69, label %81, label %70
70: ; preds = %67
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %68
%72 = bitcast i8* %71 to <16 x i8>*
%73 = load <16 x i8>, <16 x i8>* %72
%74 = getelementptr inbounds i8, i8* %71, i64 16
%75 = bitcast i8* %74 to <16 x i8>*
%76 = load <16 x i8>, <16 x i8>* %75
%77 = xor <16 x i8> %73, <i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40>
%78 = xor <16 x i8> %76, <i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40>
%79 = bitcast i8* %71 to <16 x i8>*
store <16 x i8> %77, <16 x i8>* %79
%80 = bitcast i8* %74 to <16 x i8>*
store <16 x i8> %78, <16 x i8>* %80
br label %81
81: ; preds = %67, %70
%82 = icmp eq i64 %32, %27
br i1 %82, label %109, label %83
83: ; preds = %81
%84 = and i64 %27, 24
%85 = icmp eq i64 %84, 0
br i1 %85, label %100, label %86
86: ; preds = %29, %83
%87 = phi i64 [ %32, %83 ], [ 0, %29 ]
%88 = and i64 %27, 4294967288
br label %89
89: ; preds = %89, %86
%90 = phi i64 [ %87, %86 ], [ %96, %89 ]
%91 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %90
%92 = bitcast i8* %91 to <8 x i8>*
%93 = load <8 x i8>, <8 x i8>* %92
%94 = xor <8 x i8> %93, <i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40, i8 -40>
%95 = bitcast i8* %91 to <8 x i8>*
store <8 x i8> %94, <8 x i8>* %95
%96 = add nuw i64 %90, 8
%97 = icmp eq i64 %96, %88
br i1 %97, label %98, label %89
98: ; preds = %89
%99 = icmp eq i64 %88, %27
br i1 %99, label %109, label %100
100: ; preds = %26, %83, %98
%101 = phi i64 [ 0, %26 ], [ %32, %83 ], [ %88, %98 ]
br label %102
102: ; preds = %100, %102
%103 = phi i64 [ %107, %102 ], [ %101, %100 ]
%104 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %103
%105 = load i8, i8* %104
%106 = xor i8 %105, -40
store i8 %106, i8* %104
%107 = add nuw nsw i64 %103, 1
%108 = icmp eq i64 %107, %27
br i1 %108, label %109, label %102
109: ; preds = %102, %81, %98, %23
%110 = call i32 @fwrite(i8* %4, i32 1, i32 %24, i32* %16)
%111 = tail call i32 @feof(i32* %13)
%112 = icmp eq i32 %111, 0
br i1 %112, label %23, label %113
113: ; preds = %109, %20
%114 = tail call i32 @fclose(i32* %13)
%115 = tail call i32 @fclose(i32* %16)
br label %116
116: ; preds = %113, %10
%117 = tail call i32 @exit(i32 0)
unreachable
}