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

/* Variables and functions */
struct Line *Line_create_with_text(char *);
int /*<<< orphan*/ Line_destory(struct Line *);
int /*<<< orphan*/ Line_print(struct Line *);
int /*<<< orphan*/ Line_set_index(struct Line *, int);
int /*<<< orphan*/ Line_write(struct Line *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int main() {
  struct Line *line1 = Line_create_with_text("hello world\n");
  struct Line *line2 = Line_create_with_text("code is poetry\n");
  Line_set_index(line1, 1);
  Line_set_index(line2, 2);
  Line_print(line1);
  Line_print(line2);
  FILE *fp = fopen("line_test.out", "w");
  Line_write(line1, fp);
  Line_write(line2, fp);
  Line_destory(line1);
  Line_destory(line2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1070 <Line_create_with_text@plt>
mov    %rax,-0x10(%rbp)
lea    0xe87(%rip),%rdi
call   1070 <Line_create_with_text@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1030 <Line_set_index@plt>
mov    -0x18(%rbp),%rdi
mov    $0x2,%esi
call   1030 <Line_set_index@plt>
mov    -0x10(%rbp),%rdi
call   1040 <Line_print@plt>
mov    -0x18(%rbp),%rdi
call   1040 <Line_print@plt>
lea    0xe59(%rip),%rdi
lea    0xe60(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <Line_write@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <Line_write@plt>
mov    -0x10(%rbp),%rdi
call   1080 <Line_destory@plt>
mov    -0x18(%rbp),%rdi
call   1080 <Line_destory@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xe94(%rip),%rdi
call   1070 <Line_create_with_text@plt>
mov    %rax,%r14
lea    0xe92(%rip),%rdi
call   1070 <Line_create_with_text@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    $0x1,%esi
call   1030 <Line_set_index@plt>
mov    %r15,%rdi
mov    $0x2,%esi
call   1030 <Line_set_index@plt>
mov    %r14,%rdi
call   1040 <Line_print@plt>
mov    %r15,%rdi
call   1040 <Line_print@plt>
lea    0xe69(%rip),%rdi
lea    0xe70(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1050 <Line_write@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <Line_write@plt>
mov    %r14,%rdi
call   1080 <Line_destory@plt>
mov    %r15,%rdi
call   1080 <Line_destory@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.Line = type { i32 }
@.str = [13 x i8] c"hello world\0A\00"
@.str.1 = [16 x i8] c"code is poetry\0A\00"
@.str.2 = [14 x i8] c"line_test.out\00"
@.str.3 = [2 x i8] c"w\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.Line*
%3 = alloca %struct.Line*
%4 = alloca i32*
store i32 0, i32* %1
%5 = call %struct.Line* @Line_create_with_text(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store %struct.Line* %5, %struct.Line** %2
%6 = call %struct.Line* @Line_create_with_text(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
store %struct.Line* %6, %struct.Line** %3
%7 = load %struct.Line*, %struct.Line** %2
%8 = call i32 @Line_set_index(%struct.Line* %7, i32 1)
%9 = load %struct.Line*, %struct.Line** %3
%10 = call i32 @Line_set_index(%struct.Line* %9, i32 2)
%11 = load %struct.Line*, %struct.Line** %2
%12 = call i32 @Line_print(%struct.Line* %11)
%13 = load %struct.Line*, %struct.Line** %3
%14 = call i32 @Line_print(%struct.Line* %13)
%15 = 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* %15, i32** %4
%16 = load %struct.Line*, %struct.Line** %2
%17 = load i32*, i32** %4
%18 = call i32 @Line_write(%struct.Line* %16, i32* %17)
%19 = load %struct.Line*, %struct.Line** %3
%20 = load i32*, i32** %4
%21 = call i32 @Line_write(%struct.Line* %19, i32* %20)
%22 = load %struct.Line*, %struct.Line** %2
%23 = call i32 @Line_destory(%struct.Line* %22)
%24 = load %struct.Line*, %struct.Line** %3
%25 = call i32 @Line_destory(%struct.Line* %24)
ret i32 0
}

LLVM IR (-O2):
%struct.Line = type { i32 }
@.str = [13 x i8] c"hello world\0A\00"
@.str.1 = [16 x i8] c"code is poetry\0A\00"
@.str.2 = [14 x i8] c"line_test.out\00"
@.str.3 = [2 x i8] c"w\00"
define i32 @main() {
%1 = tail call %struct.Line* @Line_create_with_text(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = tail call %struct.Line* @Line_create_with_text(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @Line_set_index(%struct.Line* %1, i32 1)
%4 = tail call i32 @Line_set_index(%struct.Line* %2, i32 2)
%5 = tail call i32 @Line_print(%struct.Line* %1)
%6 = tail call i32 @Line_print(%struct.Line* %2)
%7 = 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))
%8 = tail call i32 @Line_write(%struct.Line* %1, i32* %7)
%9 = tail call i32 @Line_write(%struct.Line* %2, i32* %7)
%10 = tail call i32 @Line_destory(%struct.Line* %1)
%11 = tail call i32 @Line_destory(%struct.Line* %2)
ret i32 0
}