#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 /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int);
void encrypt1(char *normal_path, char *crypt_path) {
  FILE *normal_fp = fopen(normal_path, "r");
  FILE *crypt_fp = fopen(crypt_path, "w");
  int ch = 0;
  while ((ch = fgetc(normal_fp)) != EOF) {
    printf("read ch = %c, ", ch);
    fputc(ch ^ 9, crypt_fp);
  }
  fclose(normal_fp);
  fclose(crypt_fp);
}


x86 assembly (clang, -O0):
<encrypt1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe83(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x24(%rbp)
mov    0x2e46(%rip),%rcx
cmp    (%rcx),%eax
je     11cd <encrypt1+0x7d>
mov    -0x24(%rbp),%esi
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
mov    -0x24(%rbp),%edi
xor    $0x9,%edi
mov    -0x20(%rbp),%rsi
call   1060 <fputc@plt>
jmp    118f <encrypt1+0x3f>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encrypt1>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
lea    0xe9e(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
lea    0xe91(%rip),%rsi
mov    %rbx,%rdi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1050 <fgetc@plt>
mov    0x2e5d(%rip),%r12
cmp    (%r12),%eax
je     11c7 <encrypt1+0x77>
mov    %eax,%ebp
lea    0xe6a(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
xor    $0x9,%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    %r14,%rdi
call   1050 <fgetc@plt>
mov    %eax,%ebp
cmp    (%r12),%eax
jne    11a0 <encrypt1+0x50>
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [2 x i8] c"w\00"
@EOF = global i32 0
@.str.2 = [15 x i8] c"read ch = %c, \00"
define void @encrypt1(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 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %9, i32** %5
%10 = load i8*, i8** %4
%11 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %6
store i32 0, i32* %7
br label %12
12: ; preds = %17, %2
%13 = load i32*, i32** %5
%14 = call i32 @fgetc(i32* %13)
store i32 %14, i32* %7
%15 = load i32, i32* @EOF
%16 = icmp ne i32 %14, %15
br i1 %16, label %17, label %24
17: ; preds = %12
%18 = load i32, i32* %7
%19 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %7
%21 = xor i32 %20, 9
%22 = load i32*, i32** %6
%23 = call i32 @fputc(i32 %21, i32* %22)
br label %12
24: ; preds = %12
%25 = load i32*, i32** %5
%26 = call i32 @fclose(i32* %25)
%27 = load i32*, i32** %6
%28 = call i32 @fclose(i32* %27)
ret void
}

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