#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 */
char EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int main() {
  FILE *fPut, *fGet;
  fGet = fopen("myFile.txt", "rt");
  fPut = fopen("myCopy.txt", "wt");
  char c;
  while ((c = fgetc(fGet)) != EOF) {
    fputc(c, fPut);
    printf(". ");
  }
  fclose(fPut);
  fclose(fGet);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xe9e(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe91(%rip),%rdi
lea    0xe95(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x19(%rbp)
movsbl %al,%eax
mov    0x2e45(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11ce <main+0x7e>
mov    -0x19(%rbp),%al
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1060 <fputc@plt>
lea    0xe58(%rip),%rdi
call   1040 <printf@plt>
jmp    118d <main+0x3d>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xea1(%rip),%rdi
lea    0xea5(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
lea    0xe99(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1050 <fgetc@plt>
mov    0x2e55(%rip),%r12
cmp    (%r12),%al
je     11c1 <main+0x71>
lea    0xe7c(%rip),%r15
movsbl %al,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
call   1050 <fgetc@plt>
cmp    (%r12),%al
jne    11a0 <main+0x50>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"myFile.txt\00"
@.str.1 = [3 x i8] c"rt\00"
@.str.2 = [11 x i8] c"myCopy.txt\00"
@.str.3 = [3 x i8] c"wt\00"
@EOF = global i8 0
@.str.4 = [3 x i8] c". \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i8
store i32 0, i32* %1
%5 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %3
%6 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %6, i32** %2
br label %7
7: ; preds = %14, %0
%8 = load i32*, i32** %3
%9 = call signext i8 @fgetc(i32* %8)
store i8 %9, i8* %4
%10 = sext i8 %9 to i32
%11 = load i8, i8* @EOF
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %10, %12
br i1 %13, label %14, label %19
14: ; preds = %7
%15 = load i8, i8* %4
%16 = load i32*, i32** %2
%17 = call i32 @fputc(i8 signext %15, i32* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %7
19: ; preds = %7
%20 = load i32*, i32** %2
%21 = call i32 @fclose(i32* %20)
%22 = load i32*, i32** %3
%23 = call i32 @fclose(i32* %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"myFile.txt\00"
@.str.1 = [3 x i8] c"rt\00"
@.str.2 = [11 x i8] c"myCopy.txt\00"
@.str.3 = [3 x i8] c"wt\00"
@EOF = global i8 0
@.str.4 = [3 x i8] c". \00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%3 = tail call signext i8 @fgetc(i32* %1)
%4 = load i8, i8* @EOF
%5 = icmp eq i8 %3, %4
br i1 %5, label %13, label %6
6: ; preds = %0, %6
%7 = phi i8 [ %10, %6 ], [ %3, %0 ]
%8 = tail call i32 @fputc(i8 signext %7, i32* %2)
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%10 = tail call signext i8 @fgetc(i32* %1)
%11 = load i8, i8* @EOF
%12 = icmp eq i8 %10, %11
br i1 %12, label %13, label %6
13: ; preds = %6, %0
%14 = tail call i32 @fclose(i32* %2)
%15 = tail call i32 @fclose(i32* %1)
ret i32 0
}