#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*/ s;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ decode(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int main() {
  char s[1024] = {0};
  FILE *p = fopen("D:\\temp\\b.txt", "r");
  FILE *p1 = fopen("D:\\temp\\c.txt", "w");
  while (!feof(p)) {
    memset(s, 0, sizeof(s));
    fgets(s, sizeof(s), p);
    decode(s);
    fputs(s, p1);
  }
  fclose(p);
  fclose(p1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
lea    0xe64(%rip),%rdi
lea    0xe6b(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x418(%rbp)
lea    0xe5a(%rip),%rdi
lea    0xe61(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x420(%rbp)
mov    -0x418(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11ea <main+0x7a>
jmp    1239 <main+0xc9>
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
lea    -0x410(%rbp),%rdi
mov    -0x418(%rbp),%rdx
mov    $0x400,%esi
call   1060 <fgets@plt>
lea    -0x410(%rbp),%rdi
call   1080 <decode@plt>
lea    -0x410(%rbp),%rdi
mov    -0x420(%rbp),%rsi
call   1040 <fputs@plt>
jmp    11c9 <main+0x59>
mov    -0x418(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x420(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsp,%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    0xe6e(%rip),%rdi
lea    0xe75(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r15
lea    0xe68(%rip),%rdi
lea    0xe6f(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r14
mov    %r15,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    120e <main+0x9e>
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
mov    %rbx,%rdi
call   1080 <decode@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <fputs@plt>
mov    %r15,%rdi
call   1070 <feof@plt>
test   %eax,%eax
je     11d0 <main+0x60>
mov    %r15,%rdi
call   1030 <fclose@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"D:\\temp\\b.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [14 x i8] c"D:\\temp\\c.txt\00"
@.str.3 = [2 x i8] c"w\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca i32*
%4 = alloca i32*
store i32 0, i32* %1
%5 = bitcast [1024 x i8]* %2 to i8*
%6 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %3
%7 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %7, i32** %4
br label %8
8: ; preds = %13, %0
%9 = load i32*, i32** %3
%10 = call i32 @feof(i32* %9)
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
br i1 %12, label %13, label %24
13: ; preds = %8
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%15 = call i32 @memset(i8* %14, i32 0, i32 1024)
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%17 = load i32*, i32** %3
%18 = call i32 @fgets(i8* %16, i32 1024, i32* %17)
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%20 = call i32 @decode(i8* %19)
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%22 = load i32*, i32** %4
%23 = call i32 @fputs(i8* %21, i32* %22)
br label %8
24: ; preds = %8
%25 = load i32*, i32** %3
%26 = call i32 @fclose(i32* %25)
%27 = load i32*, i32** %4
%28 = call i32 @fclose(i32* %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"D:\\temp\\b.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [14 x i8] c"D:\\temp\\c.txt\00"
@.str.3 = [2 x i8] c"w\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @feof(i32* %3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %0, %7
%8 = call i32 @memset(i8* %2, i32 0, i32 1024)
%9 = call i32 @fgets(i8* %2, i32 1024, i32* %3)
%10 = call i32 @decode(i8* %2)
%11 = call i32 @fputs(i8* %2, i32* %4)
%12 = call i32 @feof(i32* %3)
%13 = icmp eq i32 %12, 0
br i1 %13, label %7, label %14
14: ; preds = %7, %0
%15 = call i32 @fclose(i32* %3)
%16 = call i32 @fclose(i32* %4)
ret i32 0
}