#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 */

/* Variables and functions */
int /*<<< orphan*/ flockfile(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ funlockfile(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int main(void) {
  flockfile(stdout);
  fputs("List of treasure:\n", stdout);
  fputs("  (1) 500 gold coins\n", stdout);
  fputs("  (2) Wonderfully ornate dishware\n", stdout);
  funlockfile(stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
call   1050 <flockfile@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%esi
lea    0xea3(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%esi
lea    0xea1(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%esi
lea    0xea2(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
call   1030 <funlockfile@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ea8(%rip),%rbx
mov    (%rbx),%edi
call   1050 <flockfile@plt>
mov    (%rbx),%esi
lea    0xeb8(%rip),%rdi
call   1040 <fputs@plt>
mov    (%rbx),%esi
lea    0xebd(%rip),%rdi
call   1040 <fputs@plt>
mov    (%rbx),%esi
lea    0xec5(%rip),%rdi
call   1040 <fputs@plt>
mov    (%rbx),%edi
call   1030 <funlockfile@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [19 x i8] c"List of treasure:\0A\00"
@.str.1 = [22 x i8] c" (1) 500 gold coins\0A\00"
@.str.2 = [35 x i8] c" (2) Wonderfully ornate dishware\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @stdout
%3 = call i32 @flockfile(i32 %2)
%4 = load i32, i32* @stdout
%5 = call i32 @fputs(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* @stdout
%7 = call i32 @fputs(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @stdout
%9 = call i32 @fputs(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @stdout
%11 = call i32 @funlockfile(i32 %10)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [19 x i8] c"List of treasure:\0A\00"
@.str.1 = [22 x i8] c" (1) 500 gold coins\0A\00"
@.str.2 = [35 x i8] c" (2) Wonderfully ornate dishware\0A\00"
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @flockfile(i32 %1)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fputs(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fputs(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @stdout
%8 = tail call i32 @fputs(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @stdout
%10 = tail call i32 @funlockfile(i32 %9)
ret i32 0
}