#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*/ code(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 main03() {
  char s[1024] = {0};
  FILE *p = fopen("D:\\temp\\a.txt", "r");
  FILE *p1 = fopen("D:\\temp\\b.txt", "w");
  while (!feof(p)) {
    memset(s, 0, sizeof(s));
    fgets(s, sizeof(s), p);
    code(s);
    fputs(s, p1);
  }
  fclose(p);
  fclose(p1);
  return 0;
}


x86 assembly (clang, -O0):
<main03>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
lea    -0x400(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
lea    0xe6b(%rip),%rdi
lea    0xe72(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x408(%rbp)
lea    0xe61(%rip),%rdi
lea    0xe68(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x410(%rbp)
mov    -0x408(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11e3 <main03+0x73>
jmp    1232 <main03+0xc2>
lea    -0x400(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
lea    -0x400(%rbp),%rdi
mov    -0x408(%rbp),%rdx
mov    $0x400,%esi
call   1060 <fgets@plt>
lea    -0x400(%rbp),%rdi
call   1090 <code@plt>
lea    -0x400(%rbp),%rdi
mov    -0x410(%rbp),%rsi
call   1040 <fputs@plt>
jmp    11c2 <main03+0x52>
mov    -0x408(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x410(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main03>:
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   1080 <fopen@plt>
mov    %rax,%r15
lea    0xe68(%rip),%rdi
lea    0xe6f(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
mov    %r15,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    120e <main03+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   1090 <code@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <fputs@plt>
mov    %r15,%rdi
call   1070 <feof@plt>
test   %eax,%eax
je     11d0 <main03+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\\a.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [14 x i8] c"D:\\temp\\b.txt\00"
@.str.3 = [2 x i8] c"w\00"
define i32 @main03() {
%1 = alloca [1024 x i8]
%2 = alloca i32*
%3 = alloca i32*
%4 = bitcast [1024 x i8]* %1 to i8*
%5 = 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* %5, i32** %2
%6 = 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* %6, i32** %3
br label %7
7: ; preds = %12, %0
%8 = load i32*, i32** %2
%9 = call i32 @feof(i32* %8)
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
br i1 %11, label %12, label %23
12: ; preds = %7
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%14 = call i32 @memset(i8* %13, i32 0, i32 1024)
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%16 = load i32*, i32** %2
%17 = call i32 @fgets(i8* %15, i32 1024, i32* %16)
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%19 = call i32 @code(i8* %18)
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%21 = load i32*, i32** %3
%22 = call i32 @fputs(i8* %20, i32* %21)
br label %7
23: ; preds = %7
%24 = load i32*, i32** %2
%25 = call i32 @fclose(i32* %24)
%26 = load i32*, i32** %3
%27 = call i32 @fclose(i32* %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"D:\\temp\\a.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [14 x i8] c"D:\\temp\\b.txt\00"
@.str.3 = [2 x i8] c"w\00"
define i32 @main03() {
%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 @code(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
}