#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_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  if (argv[1] == "-h") {
    printf("Usage:\n\n\thangman [-h]");
    return 0;
  }
  FILE *list = fopen("wordlist.hangman", "r");
  if (!list) {
    exit(EXIT_FAILURE);
  }
  char *word;
  fgets(word, 64, list);
  fclose(list);
  printf("Wordlist: %s", word);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
lea    0xe8f(%rip),%rcx
cmp    %rcx,0x8(%rax)
jne    1195 <main+0x45>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11f9 <main+0xa9>
lea    0xe7d(%rip),%rdi
lea    0xe87(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11c5 <main+0x75>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x40,%esi
call   1050 <fgets@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rsi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xea8(%rip),%rax
cmp    %rax,0x8(%rsi)
je     119e <main+0x4e>
lea    0xeb4(%rip),%rdi
lea    0xebe(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11b0 <main+0x60>
mov    %rax,%rbx
mov    $0x40,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
lea    0xe97(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11ac <main+0x5c>
lea    0xe5e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [22 x i8] c"Usage:\0A\0A\09hangman [-h]\00"
@.str.2 = [17 x i8] c"wordlist.hangman\00"
@.str.3 = [2 x i8] c"r\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [13 x i8] c"Wordlist: %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = icmp eq i8* %10, getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %29
14: ; preds = %2
%15 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 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** %6
%16 = load i32*, i32** %6
%17 = icmp ne i32* %16, null
br i1 %17, label %21, label %18
18: ; preds = %14
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %14
%22 = load i8*, i8** %7
%23 = load i32*, i32** %6
%24 = call i32 @fgets(i8* %22, i32 64, i32* %23)
%25 = load i32*, i32** %6
%26 = call i32 @fclose(i32* %25)
%27 = load i8*, i8** %7
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* %27)
store i32 0, i32* %3
br label %29
29: ; preds = %21, %12
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [22 x i8] c"Usage:\0A\0A\09hangman [-h]\00"
@.str.2 = [17 x i8] c"wordlist.hangman\00"
@.str.3 = [2 x i8] c"r\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [13 x i8] c"Wordlist: %s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %18
8: ; preds = %2
%9 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* @EXIT_FAILURE
%13 = tail call i32 @exit(i32 %12)
unreachable
14: ; preds = %8
%15 = tail call i32 @fgets(i8* undef, i32 64, i32* %9)
%16 = tail call i32 @fclose(i32* %9)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* undef)
br label %18
18: ; preds = %14, %6
ret i32 0
}