#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 */
struct View {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ View_clear(struct View *);
struct View *View_create(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ View_destory(struct View *);
int /*<<< orphan*/ View_print(struct View *);
int /*<<< orphan*/ View_read(struct View *);
int /*<<< orphan*/ View_write(struct View *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int main() {
  FILE *fp_from = fopen("view_test.c", "r");
  FILE *fp_to = fopen("view_test.out", "w");
  struct View *view;
  view = View_create(fp_from, fp_to);
  View_read(view);
  View_print(view);
  View_write(view);
  View_clear(view);
  printf("\n---\n");
  View_read(view);
  View_print(view);
  printf("\n---\n");
  View_print(view);
  printf("\n---\n");
  View_destory(view);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe6a(%rip),%rdi
lea    0xe6f(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe61(%rip),%rdi
lea    0xe68(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <View_create@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   10a0 <View_read@plt>
mov    -0x20(%rbp),%rdi
call   1070 <View_print@plt>
mov    -0x20(%rbp),%rdi
call   1030 <View_write@plt>
mov    -0x20(%rbp),%rdi
call   1050 <View_clear@plt>
lea    0xe25(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   10a0 <View_read@plt>
mov    -0x20(%rbp),%rdi
call   1070 <View_print@plt>
lea    0xe07(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1070 <View_print@plt>
lea    0xdf2(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1080 <View_destory@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe75(%rip),%rdi
lea    0xe7a(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
lea    0xe6d(%rip),%rdi
lea    0xe74(%rip),%rsi
call   1090 <fopen@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1060 <View_create@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   10a0 <View_read@plt>
mov    %rbx,%rdi
call   1070 <View_print@plt>
mov    %rbx,%rdi
call   1030 <View_write@plt>
mov    %rbx,%rdi
call   1050 <View_clear@plt>
lea    0xe3c(%rip),%r14
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   10a0 <View_read@plt>
mov    %rbx,%rdi
call   1070 <View_print@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1070 <View_print@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1080 <View_destory@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.View = type { i32 }
@.str = [12 x i8] c"view_test.c\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [14 x i8] c"view_test.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [6 x i8] c"\0A---\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca %struct.View*
store i32 0, i32* %1
%5 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 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
%7 = load i32*, i32** %2
%8 = load i32*, i32** %3
%9 = call %struct.View* @View_create(i32* %7, i32* %8)
store %struct.View* %9, %struct.View** %4
%10 = load %struct.View*, %struct.View** %4
%11 = call i32 @View_read(%struct.View* %10)
%12 = load %struct.View*, %struct.View** %4
%13 = call i32 @View_print(%struct.View* %12)
%14 = load %struct.View*, %struct.View** %4
%15 = call i32 @View_write(%struct.View* %14)
%16 = load %struct.View*, %struct.View** %4
%17 = call i32 @View_clear(%struct.View* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%19 = load %struct.View*, %struct.View** %4
%20 = call i32 @View_read(%struct.View* %19)
%21 = load %struct.View*, %struct.View** %4
%22 = call i32 @View_print(%struct.View* %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%24 = load %struct.View*, %struct.View** %4
%25 = call i32 @View_print(%struct.View* %24)
%26 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%27 = load %struct.View*, %struct.View** %4
%28 = call i32 @View_destory(%struct.View* %27)
ret i32 0
}

LLVM IR (-O2):
%struct.View = type { i32 }
@.str = [12 x i8] c"view_test.c\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [14 x i8] c"view_test.out\00"
@.str.3 = [2 x i8] c"w\00"
@str.6 = [5 x i8] c"\0A---\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = 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))
%3 = tail call %struct.View* @View_create(i32* %1, i32* %2)
%4 = tail call i32 @View_read(%struct.View* %3)
%5 = tail call i32 @View_print(%struct.View* %3)
%6 = tail call i32 @View_write(%struct.View* %3)
%7 = tail call i32 @View_clear(%struct.View* %3)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.6, i64 0, i64 0))
%9 = tail call i32 @View_read(%struct.View* %3)
%10 = tail call i32 @View_print(%struct.View* %3)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.6, i64 0, i64 0))
%12 = tail call i32 @View_print(%struct.View* %3)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.6, i64 0, i64 0))
%14 = tail call i32 @View_destory(%struct.View* %3)
ret i32 0
}