#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*/ drawfilledBox(int /*<<< orphan*/, int /*<<< orphan*/, int,
                                 int, int);
int /*<<< orphan*/ write_line(char *, int, int);
void blink(int player) {
  if (player == 1) {
    drawfilledBox(0, 0, 50, 10, 0xf800);
    write_line("Player 1", 1, 1);
  } else if (player == 0) {
    drawfilledBox(0, 0, 50, 10, 0x000f);
    write_line("Player 2", 1, 1);
  } else if (player == 2) {
    drawfilledBox(0, 0, 50, 10, 0x00ff);
    write_line("GAMEOVER", 1, 1);
  }
}


x86 assembly (clang, -O0):
<blink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1166 <blink+0x46>
xor    %esi,%esi
mov    $0x32,%edx
mov    $0xa,%ecx
mov    $0xf800,%r8d
mov    %esi,%edi
call   1030 <drawfilledBox@plt>
lea    0xeab(%rip),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <write_line@plt>
jmp    11e1 <blink+0xc1>
cmpl   $0x0,-0x4(%rbp)
jne    11a1 <blink+0x81>
xor    %esi,%esi
mov    $0x32,%edx
mov    $0xa,%ecx
mov    $0xf,%r8d
mov    %esi,%edi
call   1030 <drawfilledBox@plt>
lea    0xe79(%rip),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <write_line@plt>
jmp    11dc <blink+0xbc>
cmpl   $0x2,-0x4(%rbp)
jne    11d7 <blink+0xb7>
xor    %esi,%esi
mov    $0x32,%edx
mov    $0xa,%ecx
mov    $0xff,%r8d
mov    %esi,%edi
call   1030 <drawfilledBox@plt>
lea    0xe47(%rip),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <write_line@plt>
jmp    11dc <blink+0xbc>
jmp    11e1 <blink+0xc1>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blink>:
cmp    $0x2,%edi
ja     1168 <blink+0x48>
push   %rbx
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%r8d
lea    0xeed(%rip),%rcx
movslq (%rcx,%rax,4),%rbx
add    %rcx,%rbx
xor    %edi,%edi
xor    %esi,%esi
mov    $0x32,%edx
mov    $0xa,%ecx
call   1030 <drawfilledBox@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
pop    %rbx
jmp    1040 <write_line@plt>
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Player 1\00"
@.str.1 = [9 x i8] c"Player 2\00"
@.str.2 = [9 x i8] c"GAMEOVER\00"
define void @blink(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = call i32 @drawfilledBox(i32 0, i32 0, i32 50, i32 10, i32 63488)
%7 = call i32 @write_line(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1, i32 1)
br label %22
8: ; preds = %1
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = call i32 @drawfilledBox(i32 0, i32 0, i32 50, i32 10, i32 15)
%13 = call i32 @write_line(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 1)
br label %21
14: ; preds = %8
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = call i32 @drawfilledBox(i32 0, i32 0, i32 50, i32 10, i32 255)
%19 = call i32 @write_line(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 1)
br label %20
20: ; preds = %17, %14
br label %21
21: ; preds = %20, %11
br label %22
22: ; preds = %21, %5
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"Player 1\00"
@.str.1 = [9 x i8] c"Player 2\00"
@.str.2 = [9 x i8] c"GAMEOVER\00"
@switch.table.blink = [3 x i32] [i32 15, i32 63488, i32 255]
@reltable.blink = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.blink to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.blink to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.blink to i64)) to i32)]
define void @blink(i32 %0) {
%2 = icmp ult i32 %0, 3
br i1 %2, label %3, label %12
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.blink, i64 0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %0 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.blink to i8*), i64 %8)
%10 = tail call i32 @drawfilledBox(i32 0, i32 0, i32 50, i32 10, i32 %6)
%11 = tail call i32 @write_line(i8* %9, i32 1, i32 1)
br label %12
12: ; preds = %1, %3
ret void
}