#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 _document {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ document_add(struct _document *, int /*<<< orphan*/);
struct _document *document_initial();
int /*<<< orphan*/ field_initial(char *, char *, int /*<<< orphan*/ *, int, int,
                                 int, int /*<<< orphan*/);
int /*<<< orphan*/ *fs_initial(char *, char *);
struct _document *file_document(char *_file_name) {
  struct _document *doc = document_initial();
  document_add(doc, field_initial("path", _file_name, NULL, 1, 1, 1, 0));
  document_add(doc, field_initial("modified", "date", NULL, 1, 1, 0, 0));
  document_add(doc, field_initial("contents", NULL, fs_initial(_file_name, "r"),
                                  0, 1, 1, 0));
  return doc;
}


x86 assembly (clang, -O0):
<file_document>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1060 <document_initial@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe96(%rip),%rdi
xor    %eax,%eax
mov    %eax,%edx
mov    $0x1,%r9d
xor    %eax,%eax
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
call   1030 <field_initial@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
call   1050 <document_add@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xe63(%rip),%rdi
lea    0xe65(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    $0x1,%r8d
xor    %r9d,%r9d
mov    %r8d,%ecx
movl   $0x0,(%rsp)
call   1030 <field_initial@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1050 <document_add@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe39(%rip),%rsi
call   1040 <fs_initial@plt>
mov    %rax,%rdx
lea    0xe21(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
mov    $0x1,%r9d
mov    %r9d,%r8d
movl   $0x0,(%rsp)
call   1030 <field_initial@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1050 <document_add@plt>
mov    -0x10(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_document>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1060 <document_initial@plt>
mov    %rax,%rbx
movl   $0x0,(%rsp)
lea    0xea1(%rip),%rdi
mov    %r14,%rsi
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
mov    $0x1,%r9d
call   1030 <field_initial@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <document_add@plt>
movl   $0x0,(%rsp)
lea    0xe73(%rip),%rdi
lea    0xe75(%rip),%rsi
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
xor    %r9d,%r9d
call   1030 <field_initial@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <document_add@plt>
lea    0xe5d(%rip),%rsi
mov    %r14,%rdi
call   1040 <fs_initial@plt>
movl   $0x0,(%rsp)
lea    0xe3e(%rip),%rdi
xor    %esi,%esi
mov    %rax,%rdx
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    $0x1,%r9d
call   1030 <field_initial@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <document_add@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct._document = type { i32 }
@.str = [5 x i8] c"path\00"
@.str.1 = [9 x i8] c"modified\00"
@.str.2 = [5 x i8] c"date\00"
@.str.3 = [9 x i8] c"contents\00"
@.str.4 = [2 x i8] c"r\00"
define %struct._document* @file_document(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct._document*
store i8* %0, i8** %2
%4 = call %struct._document* (...) @document_initial()
store %struct._document* %4, %struct._document** %3
%5 = load %struct._document*, %struct._document** %3
%6 = load i8*, i8** %2
%7 = call i32 @field_initial(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6, i32* null, i32 1, i32 1, i32 1, i32 0)
%8 = call i32 @document_add(%struct._document* %5, i32 %7)
%9 = load %struct._document*, %struct._document** %3
%10 = call i32 @field_initial(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32* null, i32 1, i32 1, i32 0, i32 0)
%11 = call i32 @document_add(%struct._document* %9, i32 %10)
%12 = load %struct._document*, %struct._document** %3
%13 = load i8*, i8** %2
%14 = call i32* @fs_initial(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @field_initial(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* null, i32* %14, i32 0, i32 1, i32 1, i32 0)
%16 = call i32 @document_add(%struct._document* %12, i32 %15)
%17 = load %struct._document*, %struct._document** %3
ret %struct._document* %17
}

LLVM IR (-O2):
%struct._document = type { i32 }
@.str = [5 x i8] c"path\00"
@.str.1 = [9 x i8] c"modified\00"
@.str.2 = [5 x i8] c"date\00"
@.str.3 = [9 x i8] c"contents\00"
@.str.4 = [2 x i8] c"r\00"
define %struct._document* @file_document(i8* %0) {
%2 = tail call %struct._document* (...) @document_initial()
%3 = tail call i32 @field_initial(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0, i32* null, i32 1, i32 1, i32 1, i32 0)
%4 = tail call i32 @document_add(%struct._document* %2, i32 %3)
%5 = tail call i32 @field_initial(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32* null, i32 1, i32 1, i32 0, i32 0)
%6 = tail call i32 @document_add(%struct._document* %2, i32 %5)
%7 = tail call i32* @fs_initial(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%8 = tail call i32 @field_initial(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* null, i32* %7, i32 0, i32 1, i32 1, i32 0)
%9 = tail call i32 @document_add(%struct._document* %2, i32 %8)
ret %struct._document* %2
}