#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*/ addstr(char *);
int /*<<< orphan*/ clear();
int /*<<< orphan*/ printw(char *, int);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ standend();
int /*<<< orphan*/ standout();
void game_finished(int deal) {
  clear();
  (void)printw("You finished the game in %d deals. This is ", deal);
  standout();
  if (deal < 2)
    (void)addstr("excellent");
  else if (deal < 4)
    (void)addstr("good");
  else if (deal < 8)
    (void)addstr("average");
  else
    (void)addstr("poor");
  standend();
  (void)addstr(".         ");
  refresh();
}


x86 assembly (clang, -O0):
<game_finished>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1080 <clear@plt>
mov    -0x4(%rbp),%esi
lea    0xe84(%rip),%rdi
call   1040 <printw@plt>
mov    $0x0,%al
call   1050 <standout@plt>
cmpl   $0x2,-0x4(%rbp)
jge    11a3 <game_finished+0x43>
lea    0xe93(%rip),%rdi
call   1070 <addstr@plt>
jmp    11ef <game_finished+0x8f>
cmpl   $0x4,-0x4(%rbp)
jge    11be <game_finished+0x5e>
lea    0xe82(%rip),%rdi
call   1070 <addstr@plt>
jmp    11ea <game_finished+0x8a>
cmpl   $0x8,-0x4(%rbp)
jge    11d9 <game_finished+0x79>
lea    0xe6c(%rip),%rdi
call   1070 <addstr@plt>
jmp    11e5 <game_finished+0x85>
lea    0xe63(%rip),%rdi
call   1070 <addstr@plt>
jmp    11ea <game_finished+0x8a>
jmp    11ef <game_finished+0x8f>
mov    $0x0,%al
call   1030 <standend@plt>
lea    0xe4b(%rip),%rdi
call   1070 <addstr@plt>
mov    $0x0,%al
call   1060 <refresh@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<game_finished>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1080 <clear@plt>
lea    0xe8f(%rip),%rdi
mov    %ebx,%esi
call   1040 <printw@plt>
xor    %eax,%eax
call   1050 <standout@plt>
cmp    $0x2,%ebx
jge    118d <game_finished+0x2d>
lea    0xea1(%rip),%rdi
jmp    11b0 <game_finished+0x50>
cmp    $0x4,%ebx
jae    119b <game_finished+0x3b>
lea    0xe9d(%rip),%rdi
jmp    11b0 <game_finished+0x50>
cmp    $0x8,%ebx
lea    0xe96(%rip),%rax
lea    0xe97(%rip),%rdi
cmovb  %rax,%rdi
call   1070 <addstr@plt>
xor    %eax,%eax
call   1030 <standend@plt>
lea    0xe85(%rip),%rdi
call   1070 <addstr@plt>
xor    %eax,%eax
pop    %rbx
jmp    1060 <refresh@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"You finished the game in %d deals. This is \00"
@.str.1 = [10 x i8] c"excellent\00"
@.str.2 = [5 x i8] c"good\00"
@.str.3 = [8 x i8] c"average\00"
@.str.4 = [5 x i8] c"poor\00"
@.str.5 = [11 x i8] c". \00"
define void @game_finished(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @clear()
%4 = load i32, i32* %2
%5 = call i32 @printw(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 (...) @standout()
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @addstr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %25
11: ; preds = %1
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 4
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 @addstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %24
16: ; preds = %11
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 8
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 @addstr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %23
21: ; preds = %16
%22 = call i32 @addstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %23
23: ; preds = %21, %19
br label %24
24: ; preds = %23, %14
br label %25
25: ; preds = %24, %9
%26 = call i32 (...) @standend()
%27 = call i32 @addstr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%28 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
@.str = [44 x i8] c"You finished the game in %d deals. This is \00"
@.str.1 = [10 x i8] c"excellent\00"
@.str.2 = [5 x i8] c"good\00"
@.str.3 = [8 x i8] c"average\00"
@.str.4 = [5 x i8] c"poor\00"
@.str.5 = [11 x i8] c". \00"
define void @game_finished(i32 %0) {
%2 = tail call i32 (...) @clear()
%3 = tail call i32 @printw(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = tail call i32 (...) @standout()
%5 = icmp slt i32 %0, 2
br i1 %5, label %11, label %6
6: ; preds = %1
%7 = icmp ult i32 %0, 4
br i1 %7, label %11, label %8
8: ; preds = %6
%9 = icmp ult i32 %0, 8
%10 = select i1 %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
br label %11
11: ; preds = %8, %6, %1
%12 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %1 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %6 ], [ %10, %8 ]
%13 = tail call i32 @addstr(i8* %12)
%14 = tail call i32 (...) @standend()
%15 = tail call i32 @addstr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%16 = tail call i32 (...) @refresh()
ret void
}