#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*/ allcaps(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
void main() {
  FILE *inFile;
  FILE *outFile;
  inFile = fopen("fileIO.in", "r");
  outFile = fopen("fileIO.out", "w");
  char input[256];
  char output[256];
  fgets(input, 256, inFile);
  printf("Your file contains: %s", input);
  fgets(output, 256, inFile);
  fclose(inFile);
  allcaps(output);
  fprintf(outFile, "%s\n", output);
  fclose(outFile);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
lea    0xe8e(%rip),%rdi
lea    0xe91(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x8(%rbp)
lea    0xe83(%rip),%rdi
lea    0xe87(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1060 <fgets@plt>
lea    -0x110(%rbp),%rsi
lea    0xe5d(%rip),%rdi
call   1050 <printf@plt>
lea    -0x210(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1060 <fgets@plt>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x210(%rbp),%rdi
call   1030 <allcaps@plt>
mov    -0x10(%rbp),%rdi
lea    -0x210(%rbp),%rdx
lea    0xe33(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
lea    0xe8d(%rip),%rdi
lea    0xe90(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0xe83(%rip),%rdi
lea    0xe87(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
lea    0x100(%rsp),%r15
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
lea    0xe62(%rip),%rdi
mov    %r15,%rsi
call   1050 <printf@plt>
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r15,%rdi
call   1030 <allcaps@plt>
lea    0xe47(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
call   1070 <fprintf@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"fileIO.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"fileIO.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [23 x i8] c"Your file contains: %s\00"
@.str.5 = [4 x i8] c"%s\0A\00"
define void @main() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 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** %1
%6 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 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** %2
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = load i32*, i32** %1
%9 = call i32 @fgets(i8* %7, i32 256, i32* %8)
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%11 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%13 = load i32*, i32** %1
%14 = call i32 @fgets(i8* %12, i32 256, i32* %13)
%15 = load i32*, i32** %1
%16 = call i32 @fclose(i32* %15)
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%18 = call i32 @allcaps(i8* %17)
%19 = load i32*, i32** %2
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%21 = call i32 @fprintf(i32* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %20)
%22 = load i32*, i32** %2
%23 = call i32 @fclose(i32* %22)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"fileIO.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"fileIO.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [23 x i8] c"Your file contains: %s\00"
@.str.5 = [4 x i8] c"%s\0A\00"
define void @main() {
%1 = alloca [256 x i8]
%2 = alloca [256 x i8]
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 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 ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%7 = call i32 @fgets(i8* %5, i32 256, i32* %3)
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %5)
%9 = call i32 @fgets(i8* %6, i32 256, i32* %3)
%10 = call i32 @fclose(i32* %3)
%11 = call i32 @allcaps(i8* %6)
%12 = call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%13 = call i32 @fclose(i32* %4)
ret void
}