#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 /*<<< orphan*/ exit(int);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ puts(char *);
void Print(void) {
  FILE *fp, *print_fp;
  char str[51];
  fp = fopen("CodeFile.txt", "r");
  print_fp = fopen("CodePrin.txt", "w+");
  if (NULL == fp)
    exit(-1);
  while (!feof(fp)) {
    str[50] = '\0';
    fread(str, sizeof(char), 50, fp);
    puts(str);
    fwrite(str, sizeof(char), 50, print_fp);
  }
  return;
}


x86 assembly (clang, -O0):
<Print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    0xe91(%rip),%rdi
lea    0xe97(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
lea    0xe89(%rip),%rdi
lea    0xe8f(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
jne    11ac <Print+0x4c>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
jmp    11b1 <Print+0x51>
mov    -0x8(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11cf <Print+0x6f>
jmp    120f <Print+0xaf>
movb   $0x0,-0x1e(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x32,%edx
call   1040 <fread@plt>
lea    -0x50(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
mov    $0x32,%edx
call   1080 <fwrite@plt>
jmp    11b1 <Print+0x51>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Print>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
lea    0xe90(%rip),%rdi
lea    0xe96(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xe89(%rip),%rdi
lea    0xe8f(%rip),%rsi
call   1060 <fopen@plt>
test   %rbx,%rbx
je     11fd <Print+0x9d>
mov    %rax,%r14
mov    %rbx,%rdi
call   1050 <feof@plt>
test   %eax,%eax
jne    11f3 <Print+0x93>
mov    %rsp,%r15
nopl   0x0(%rax)
movb   $0x0,0x32(%rsp)
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x32,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x32,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <feof@plt>
test   %eax,%eax
je     11b0 <Print+0x50>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    $0xffffffff,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"CodeFile.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [13 x i8] c"CodePrin.txt\00"
@.str.3 = [3 x i8] c"w+\00"
define void @Print() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca [51 x i8]
%4 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %1
%5 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 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* %5, i32** %2
%6 = load i32*, i32** %1
%7 = icmp eq i32* null, %6
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @exit(i32 -1)
unreachable
10: ; preds = %0
br label %11
11: ; preds = %16, %10
%12 = load i32*, i32** %1
%13 = call i32 @feof(i32* %12)
%14 = icmp ne i32 %13, 0
%15 = xor i1 %14, true
br i1 %15, label %16, label %26
16: ; preds = %11
%17 = getelementptr inbounds [51 x i8], [51 x i8]* %3, i64 0, i64 50
store i8 0, i8* %17
%18 = getelementptr inbounds [51 x i8], [51 x i8]* %3, i64 0, i64 0
%19 = load i32*, i32** %1
%20 = call i32 @fread(i8* %18, i32 1, i32 50, i32* %19)
%21 = getelementptr inbounds [51 x i8], [51 x i8]* %3, i64 0, i64 0
%22 = call i32 @puts(i8* %21)
%23 = getelementptr inbounds [51 x i8], [51 x i8]* %3, i64 0, i64 0
%24 = load i32*, i32** %2
%25 = call i32 @fwrite(i8* %23, i32 1, i32 50, i32* %24)
br label %11
26: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"CodeFile.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [13 x i8] c"CodePrin.txt\00"
@.str.3 = [3 x i8] c"w+\00"
define void @Print() {
%1 = alloca [51 x i8]
%2 = getelementptr inbounds [51 x i8], [51 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 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 ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%5 = icmp eq i32* %3, null
br i1 %5, label %11, label %6
6: ; preds = %0
%7 = tail call i32 @feof(i32* %3)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = getelementptr inbounds [51 x i8], [51 x i8]* %1, i64 0, i64 50
br label %13
11: ; preds = %0
%12 = tail call i32 @exit(i32 -1)
unreachable
13: ; preds = %9, %13
store i8 0, i8* %10
%14 = call i32 @fread(i8* %2, i32 1, i32 50, i32* %3)
%15 = call i32 @puts(i8* %2)
%16 = call i32 @fwrite(i8* %2, i32 1, i32 50, i32* %4)
%17 = tail call i32 @feof(i32* %3)
%18 = icmp eq i32 %17, 0
br i1 %18, label %13, label %19
19: ; preds = %13, %6
ret void
}