#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*/ printf(char *, ...);
int draw_hangman(char outputword[64], int wordsize, int option) {
  int index;
  if (option == 0) {
    printf("    ");
  }
  if (option == 1) {
    printf("Previous guesses: ");
    wordsize++;
  }
  if (option == 2) {
    printf("Incorrect guess: %d", wordsize + 1);
  }
  if (option == 1 || option == 0) {
    for (index = 0; index < wordsize; index++) {
      printf("%c", outputword[index]);
    }
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<draw_hangman>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    113a <draw_hangman+0x2a>
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x10(%rbp)
jne    115b <draw_hangman+0x4b>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x2,-0x10(%rbp)
jne    1179 <draw_hangman+0x69>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x10(%rbp)
je     118d <draw_hangman+0x7d>
cmpl   $0x0,-0x10(%rbp)
jne    11cd <draw_hangman+0xbd>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c8 <draw_hangman+0xb8>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1194 <draw_hangman+0x84>
jmp    11cd <draw_hangman+0xbd>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_hangman>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
cmp    $0x2,%edx
je     114b <draw_hangman+0x2b>
mov    %rdi,%r14
cmp    $0x1,%edx
je     1160 <draw_hangman+0x40>
test   %edx,%edx
jne    1193 <draw_hangman+0x73>
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
jg     1175 <draw_hangman+0x55>
jmp    1193 <draw_hangman+0x73>
add    $0x1,%ebp
lea    0xec3(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1193 <draw_hangman+0x73>
lea    0xe9e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
test   %ebp,%ebp
jle    1193 <draw_hangman+0x73>
mov    %ebp,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax)
movsbl (%r14,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1180 <draw_hangman+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c" \00"
@.str.1 = [19 x i8] c"Previous guesses: \00"
@.str.2 = [20 x i8] c"Incorrect guess: %d\00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @draw_hangman(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %3
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
br label %19
19: ; preds = %15, %12
%20 = load i32, i32* %6
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %26
22: ; preds = %19
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %22, %19
%27 = load i32, i32* %6
%28 = icmp eq i32 %27, 1
br i1 %28, label %32, label %29
29: ; preds = %26
%30 = load i32, i32* %6
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %49
32: ; preds = %29, %26
store i32 0, i32* %7
br label %33
33: ; preds = %45, %32
%34 = load i32, i32* %7
%35 = load i32, i32* %5
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %48
37: ; preds = %33
%38 = load i8*, i8** %4
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %37
%46 = load i32, i32* %7
%47 = add nsw i32 %46, 1
store i32 %47, i32* %7
br label %33
48: ; preds = %33
br label %49
49: ; preds = %48, %29
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c" \00"
@.str.1 = [19 x i8] c"Previous guesses: \00"
@.str.2 = [20 x i8] c"Incorrect guess: %d\00"
define i32 @draw_hangman(i8* nocapture %0, i32 %1, i32 %2) {
switch i32 %2, label %25 [
i32 0, label %4
i32 1, label %6
i32 2, label %9
]
4: ; preds = %3
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %12
6: ; preds = %3
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%8 = add nsw i32 %1, 1
br label %12
9: ; preds = %3
%10 = add nsw i32 %1, 1
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %10)
br label %25
12: ; preds = %4, %6
%13 = phi i32 [ %1, %4 ], [ %8, %6 ]
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %25
15: ; preds = %12
%16 = zext i32 %13 to i64
br label %17
17: ; preds = %15, %17
%18 = phi i64 [ 0, %15 ], [ %23, %17 ]
%19 = getelementptr inbounds i8, i8* %0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = tail call i32 @putchar(i32 %21)
%23 = add nuw nsw i64 %18, 1
%24 = icmp eq i64 %23, %16
br i1 %24, label %25, label %17
25: ; preds = %17, %12, %3, %9
%26 = tail call i32 @putchar(i32 10)
ret i32 0
}