#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 caseprint) {
  int index;
  switch (caseprint) {
  case 0:
    printf("    ");
    break;
  case 1:
    printf("Previous guesses: ");
    wordsize++;
    break;
  case 2:
    printf("Incorrect guess: %d", wordsize);
    break;
  }
  if (caseprint != 2) {
    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)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
test   %eax,%eax
je     1157 <draw_hangman+0x47>
jmp    1135 <draw_hangman+0x25>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
je     116a <draw_hangman+0x5a>
jmp    1146 <draw_hangman+0x36>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     1186 <draw_hangman+0x76>
jmp    1197 <draw_hangman+0x87>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1197 <draw_hangman+0x87>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1197 <draw_hangman+0x87>
mov    -0xc(%rbp),%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x2,-0x10(%rbp)
je     11e1 <draw_hangman+0xd1>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11dc <draw_hangman+0xcc>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a8 <draw_hangman+0x98>
jmp    11e1 <draw_hangman+0xd1>
lea    0xe47(%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     115d <draw_hangman+0x3d>
test   %edx,%edx
jne    1145 <draw_hangman+0x25>
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
jg     1172 <draw_hangman+0x52>
jmp    1193 <draw_hangman+0x73>
lea    0xec6(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1193 <draw_hangman+0x73>
lea    0xea1(%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
cs nopw 0x0(%rax,%rax,1)
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
switch i32 %8, label %18 [
i32 0, label %9
i32 1, label %11
i32 2, label %15
]
9: ; preds = %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %18
11: ; preds = %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 1
store i32 %14, i32* %5
br label %18
15: ; preds = %3
%16 = load i32, i32* %5
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %3, %15, %11, %9
%19 = load i32, i32* %6
%20 = icmp ne i32 %19, 2
br i1 %20, label %21, label %38
21: ; preds = %18
store i32 0, i32* %7
br label %22
22: ; preds = %34, %21
%23 = load i32, i32* %7
%24 = load i32, i32* %5
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %37
26: ; preds = %22
%27 = load i8*, i8** %4
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %26
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %22
37: ; preds = %22
br label %38
38: ; preds = %37, %18
%39 = 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 %11 [
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 %11
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 %11
9: ; preds = %3
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %1)
br label %24
11: ; preds = %3, %6, %4
%12 = phi i32 [ %1, %3 ], [ %8, %6 ], [ %1, %4 ]
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = zext i32 %12 to i64
br label %16
16: ; preds = %14, %16
%17 = phi i64 [ 0, %14 ], [ %22, %16 ]
%18 = getelementptr inbounds i8, i8* %0, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = tail call i32 @putchar(i32 %20)
%22 = add nuw nsw i64 %17, 1
%23 = icmp eq i64 %22, %15
br i1 %23, label %24, label %16
24: ; preds = %16, %11, %9
%25 = tail call i32 @putchar(i32 10)
ret i32 0
}