#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 int32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void printEndgameClassification(int32_t type) {
  const char *typeStr;
  if (type == 0) {
    typeStr = "unclassified";
  } else if (type == 1) {
    typeStr = "krvk_black";
  } else if (type == 2) {
    typeStr = "krvk_white";
  } else {
    typeStr = "unknown";
  }
  printf("{\"endgameType\":\"%s\"}\n", typeStr);
}


x86 assembly (clang, -O0):
<printEndgameClassification>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1135 <printEndgameClassification+0x25>
lea    0xed4(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    117e <printEndgameClassification+0x6e>
cmpl   $0x1,-0x4(%rbp)
jne    114f <printEndgameClassification+0x3f>
lea    0xec7(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1179 <printEndgameClassification+0x69>
cmpl   $0x2,-0x4(%rbp)
jne    1169 <printEndgameClassification+0x59>
lea    0xeb8(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1174 <printEndgameClassification+0x64>
lea    0xeb3(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1179 <printEndgameClassification+0x69>
jmp    117e <printEndgameClassification+0x6e>
mov    -0x10(%rbp),%rsi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printEndgameClassification>:
cmp    $0x2,%edi
ja     1132 <printEndgameClassification+0x22>
movslq %edi,%rax
lea    0xf25(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
lea    0xefe(%rip),%rdi
jmp    1030 <printf@plt>
lea    0xeea(%rip),%rsi
lea    0xeeb(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"unclassified\00"
@.str.1 = [11 x i8] c"krvk_black\00"
@.str.2 = [11 x i8] c"krvk_white\00"
@.str.3 = [8 x i8] c"unknown\00"
@.str.4 = [22 x i8] c"{\22endgameType\22:\22%s\22}\0A\00"
define void @printEndgameClassification(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %3
br label %18
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %7
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %17
11: ; preds = %7
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 2
br i1 %13, label %14, label %15
14: ; preds = %11
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %16
15: ; preds = %11
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %16
16: ; preds = %15, %14
br label %17
17: ; preds = %16, %10
br label %18
18: ; preds = %17, %6
%19 = load i8*, i8** %3
%20 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %19)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"unclassified\00"
@.str.1 = [11 x i8] c"krvk_black\00"
@.str.2 = [11 x i8] c"krvk_white\00"
@.str.3 = [8 x i8] c"unknown\00"
@.str.4 = [22 x i8] c"{\22endgameType\22:\22%s\22}\0A\00"
@reltable.printEndgameClassification = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.printEndgameClassification to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.printEndgameClassification to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.printEndgameClassification to i64)) to i32)]
define void @printEndgameClassification(i32 %0) {
%2 = icmp ult i32 %0, 3
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.printEndgameClassification to i8*), i64 %5)
br label %7
7: ; preds = %1, %3
%8 = phi i8* [ %6, %3 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %1 ]
%9 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %8)
ret void
}