#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 /*<<< orphan*/);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int main() {
  char line[120];
  FILE *instream, *outstream;
  instream = fopen("file.in", "r");
  outstream = fopen("p118file.out", "w");
  while (fgets(line, 121, instream))
    fprintf(outstream, "%s", line);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    0xea8(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x88(%rbp)
lea    0xe97(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x90(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x88(%rbp),%rdx
mov    $0x79,%esi
call   1030 <fgets@plt>
cmp    $0x0,%rax
je     11c1 <main+0x81>
mov    -0x90(%rbp),%rdi
lea    -0x80(%rbp),%rdx
lea    0xe62(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1186 <main+0x46>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
lea    0xead(%rip),%rdi
lea    0xeae(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r14
lea    0xea1(%rip),%rdi
lea    0xea7(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r15
mov    %rsp,%rdi
mov    $0x79,%esi
mov    %r14,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     11b0 <main+0x70>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <fputs@plt>
mov    %rbx,%rdi
mov    $0x79,%esi
mov    %r14,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
jne    1190 <main+0x50>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"file.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [13 x i8] c"p118file.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [120 x i8]
%3 = alloca i32*
%4 = alloca i32*
store i32 0, i32* %1
%5 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 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** %3
%6 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 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** %4
br label %7
7: ; preds = %12, %0
%8 = getelementptr inbounds [120 x i8], [120 x i8]* %2, i64 0, i64 0
%9 = load i32*, i32** %3
%10 = call i64 @fgets(i8* %8, i32 121, i32* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %7
%13 = load i32*, i32** %4
%14 = getelementptr inbounds [120 x i8], [120 x i8]* %2, i64 0, i64 0
%15 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %14)
br label %7
16: ; preds = %7
%17 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"file.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [13 x i8] c"p118file.out\00"
@.str.3 = [2 x i8] c"w\00"
define i32 @main() {
%1 = alloca [120 x i8]
%2 = getelementptr inbounds [120 x i8], [120 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 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 ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%5 = call i64 @fgets(i8* %2, i32 121, i32* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %0, %7
%8 = call i32 @fputs(i8* %2, i32* %4)
%9 = call i64 @fgets(i8* %2, i32 121, i32* %3)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %7
11: ; preds = %7, %0
%12 = call i32 @exit(i32 0)
unreachable
}