#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*/ my_putnbr(int);
int /*<<< orphan*/ my_putstr(char *);
void print_winner(int mode, int winner) {
  my_putstr("Winner: ");
  my_putstr((winner == 1) ? "\033[34m" : "\033[31m");
  my_putstr("Player ");
  my_putnbr(winner);
  my_putstr(" (");
  if ((winner == 1 && mode == 0) || (winner == 2 && mode < 2))
    my_putstr("IA");
  else
    my_putstr("human");
  my_putstr(")\033[0m\n");
}


x86 assembly (clang, -O0):
<print_winner>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xecb(%rip),%rdi
call   1030 <my_putstr@plt>
mov    -0x8(%rbp),%ecx
lea    0xecb(%rip),%rdi
lea    0xebe(%rip),%rax
cmp    $0x1,%ecx
cmove  %rax,%rdi
call   1030 <my_putstr@plt>
lea    0xeb7(%rip),%rdi
call   1030 <my_putstr@plt>
mov    -0x8(%rbp),%edi
call   1040 <my_putnbr@plt>
lea    0xeab(%rip),%rdi
call   1030 <my_putstr@plt>
cmpl   $0x1,-0x8(%rbp)
jne    118b <print_winner+0x6b>
cmpl   $0x0,-0x4(%rbp)
je     119f <print_winner+0x7f>
cmpl   $0x2,-0x8(%rbp)
jne    11b0 <print_winner+0x90>
cmpl   $0x2,-0x4(%rbp)
jge    11b0 <print_winner+0x90>
lea    0xe7a(%rip),%rdi
call   1030 <my_putstr@plt>
jmp    11bc <print_winner+0x9c>
lea    0xe6c(%rip),%rdi
call   1030 <my_putstr@plt>
lea    0xe66(%rip),%rdi
call   1030 <my_putstr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_winner>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r13d
mov    %edi,%r14d
lea    0xec8(%rip),%rdi
call   1030 <my_putstr@plt>
cmp    $0x2,%r13d
lea    0xed8(%rip),%rbx
lea    0xed4(%rip),%rax
mov    %rax,%rbp
cmove  %rbx,%rbp
cmp    $0x2,%r14d
cmovge %rax,%rbp
cmp    $0x1,%r13d
lea    0xea0(%rip),%rax
lea    0xe9f(%rip),%rdi
cmove  %rax,%rdi
lea    0xe9a(%rip),%r15
lea    0xe9b(%rip),%r12
cmovne %rbp,%rbx
call   1030 <my_putstr@plt>
mov    %r15,%rdi
call   1030 <my_putstr@plt>
mov    %r13d,%edi
call   1040 <my_putnbr@plt>
mov    %r12,%rdi
call   1030 <my_putstr@plt>
test   %r14d,%r14d
cmovne %rbp,%rbx
mov    %rbx,%rdi
call   1030 <my_putstr@plt>
lea    0xe70(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <my_putstr@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"Winner: \00"
@.str.1 = [6 x i8] c"\1B[34m\00"
@.str.2 = [6 x i8] c"\1B[31m\00"
@.str.3 = [8 x i8] c"Player \00"
@.str.4 = [3 x i8] c" (\00"
@.str.5 = [3 x i8] c"IA\00"
@.str.6 = [6 x i8] c"human\00"
@.str.7 = [7 x i8] c")\1B[0m\0A\00"
define void @print_winner(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @my_putstr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 1
%8 = zext i1 %7 to i64
%9 = select i1 %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%10 = call i32 @my_putstr(i8* %9)
%11 = call i32 @my_putstr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%12 = load i32, i32* %4
%13 = call i32 @my_putnbr(i32 %12)
%14 = call i32 @my_putstr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load i32, i32* %3
%19 = icmp eq i32 %18, 0
br i1 %19, label %26, label %20
20: ; preds = %17, %2
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i32, i32* %3
%25 = icmp slt i32 %24, 2
br i1 %25, label %26, label %28
26: ; preds = %23, %17
%27 = call i32 @my_putstr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %30
28: ; preds = %23, %20
%29 = call i32 @my_putstr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %30
30: ; preds = %28, %26
%31 = call i32 @my_putstr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"Winner: \00"
@.str.1 = [6 x i8] c"\1B[34m\00"
@.str.2 = [6 x i8] c"\1B[31m\00"
@.str.3 = [8 x i8] c"Player \00"
@.str.4 = [3 x i8] c" (\00"
@.str.5 = [3 x i8] c"IA\00"
@.str.6 = [6 x i8] c"human\00"
@.str.7 = [7 x i8] c")\1B[0m\0A\00"
define void @print_winner(i32 %0, i32 %1) {
%3 = tail call i32 @my_putstr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %1, 1
%5 = select i1 %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%6 = tail call i32 @my_putstr(i8* %5)
%7 = tail call i32 @my_putstr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @my_putnbr(i32 %1)
%9 = tail call i32 @my_putstr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%10 = icmp eq i32 %0, 0
%11 = and i1 %10, %4
%12 = icmp eq i32 %1, 2
%13 = icmp slt i32 %0, 2
%14 = and i1 %13, %12
%15 = or i1 %11, %14
%16 = select i1 %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0)
%17 = tail call i32 @my_putstr(i8* %16)
%18 = tail call i32 @my_putstr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
ret void
}