#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 EOF;
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
void fileSimpleEncryptDecrypt(const char *sourcePath, const char *targetPath) {
  if (sourcePath == NULL || targetPath == NULL) {
    return;
  }
  FILE *rfile = fopen(sourcePath, "r");
  FILE *wfile = fopen(targetPath, "w");
  if (rfile == NULL || wfile == NULL) {
    return;
  }
  int ch;
  while ((ch = fgetc(rfile)) != EOF) {
    ch ^= 10;
    fputc(ch, wfile);
  }
}


x86 assembly (clang, -O0):
<fileSimpleEncryptDecrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1156 <fileSimpleEncryptDecrypt+0x26>
cmpq   $0x0,-0x10(%rbp)
jne    115b <fileSimpleEncryptDecrypt+0x2b>
jmp    11d8 <fileSimpleEncryptDecrypt+0xa8>
mov    -0x8(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1199 <fileSimpleEncryptDecrypt+0x69>
cmpq   $0x0,-0x20(%rbp)
jne    119e <fileSimpleEncryptDecrypt+0x6e>
jmp    11d8 <fileSimpleEncryptDecrypt+0xa8>
jmp    11a3 <fileSimpleEncryptDecrypt+0x73>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x24(%rbp)
mov    0x2e32(%rip),%rcx
cmp    (%rcx),%eax
je     11d8 <fileSimpleEncryptDecrypt+0xa8>
mov    -0x24(%rbp),%eax
xor    $0xa,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1040 <fputc@plt>
jmp    11a3 <fileSimpleEncryptDecrypt+0x73>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileSimpleEncryptDecrypt>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     11aa <fileSimpleEncryptDecrypt+0x7a>
mov    %rsi,%rbx
test   %rsi,%rsi
je     11aa <fileSimpleEncryptDecrypt+0x7a>
lea    0xeb7(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r14
lea    0xeaa(%rip),%rsi
mov    %rbx,%rdi
call   1050 <fopen@plt>
test   %r14,%r14
je     11aa <fileSimpleEncryptDecrypt+0x7a>
mov    %rax,%rbx
test   %rax,%rax
je     11aa <fileSimpleEncryptDecrypt+0x7a>
mov    %r14,%rdi
call   1030 <fgetc@plt>
mov    0x2e6c(%rip),%r15
cmp    (%r15),%eax
je     11aa <fileSimpleEncryptDecrypt+0x7a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    $0xa,%eax
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
mov    %r14,%rdi
call   1030 <fgetc@plt>
cmp    (%r15),%eax
jne    1190 <fileSimpleEncryptDecrypt+0x60>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [2 x i8] c"w\00"
@EOF = global i32 0
define void @fileSimpleEncryptDecrypt(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = icmp eq i8* %8, null
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %10, %2
br label %37
14: ; preds = %10
%15 = load i8*, i8** %3
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %16, i32** %5
%17 = load i8*, i8** %4
%18 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %18, i32** %6
%19 = load i32*, i32** %5
%20 = icmp eq i32* %19, null
br i1 %20, label %24, label %21
21: ; preds = %14
%22 = load i32*, i32** %6
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %25
24: ; preds = %21, %14
br label %37
25: ; preds = %21
br label %26
26: ; preds = %31, %25
%27 = load i32*, i32** %5
%28 = call i32 @fgetc(i32* %27)
store i32 %28, i32* %7
%29 = load i32, i32* @EOF
%30 = icmp ne i32 %28, %29
br i1 %30, label %31, label %37
31: ; preds = %26
%32 = load i32, i32* %7
%33 = xor i32 %32, 10
store i32 %33, i32* %7
%34 = load i32, i32* %7
%35 = load i32*, i32** %6
%36 = call i32 @fputc(i32 %34, i32* %35)
br label %26
37: ; preds = %13, %24, %26
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [2 x i8] c"w\00"
@EOF = global i32 0
define void @fileSimpleEncryptDecrypt(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = or i1 %3, %4
br i1 %5, label %23, label %6
6: ; preds = %2
%7 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32* %7, null
%10 = icmp eq i32* %8, null
%11 = or i1 %9, %10
br i1 %11, label %23, label %12
12: ; preds = %6
%13 = tail call i32 @fgetc(i32* %7)
%14 = load i32, i32* @EOF
%15 = icmp eq i32 %13, %14
br i1 %15, label %23, label %16
16: ; preds = %12, %16
%17 = phi i32 [ %20, %16 ], [ %13, %12 ]
%18 = xor i32 %17, 10
%19 = tail call i32 @fputc(i32 %18, i32* %8)
%20 = tail call i32 @fgetc(i32* %7)
%21 = load i32, i32* @EOF
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %16
23: ; preds = %16, %12, %6, %2
ret void
}