#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 score(int, int);
void game(int s0, int r0, int s1, int r1) {
  int p1 = score(s0, r0), p2 = score(s1, r1);
  printf(p1 > p2
             ? "Player 1 wins.\n"
             : (p1 < p2 ? "Player 2 wins.\n"
                        : (p1 == 100 ? (s0 > s1 ? "Player 1 wins.\n"
                                                : (s0 < s1 ? "Player 2 wins.\n"
                                                           : "Tie.\n"))
                                     : "Tie.\n")));
}


x86 assembly (clang, -O0):
<game>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <score@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <score@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    116c <game+0x4c>
lea    0xe9d(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11f9 <game+0xd9>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1188 <game+0x68>
lea    0xe91(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    11f1 <game+0xd1>
cmpl   $0x64,-0x14(%rbp)
jne    11d9 <game+0xb9>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11ae <game+0x8e>
lea    0xe5b(%rip),%rax
mov    %rax,-0x30(%rbp)
jmp    11cc <game+0xac>
mov    -0x4(%rbp),%edx
mov    -0xc(%rbp),%esi
lea    0xe65(%rip),%rax
lea    0xe4e(%rip),%rcx
cmp    %esi,%edx
cmovl  %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    11e9 <game+0xc9>
lea    0xe40(%rip),%rax
mov    %rax,-0x38(%rbp)
jmp    11e9 <game+0xc9>
mov    -0x38(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<game>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %edx,%r14d
mov    %edi,%r15d
call   1040 <score@plt>
mov    %eax,%ebx
mov    %r14d,%edi
mov    %ebp,%esi
call   1040 <score@plt>
lea    0xeb9(%rip),%rdi
cmp    %eax,%ebx
jg     117b <game+0x5b>
jge    1156 <game+0x36>
lea    0xebc(%rip),%rdi
jmp    117b <game+0x5b>
cmp    $0x64,%ebx
jne    1174 <game+0x54>
cmp    %r14d,%r15d
jg     117b <game+0x5b>
lea    0xea9(%rip),%rax
lea    0xeb2(%rip),%rdi
cmovl  %rax,%rdi
jmp    117b <game+0x5b>
lea    0xea5(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Player 1 wins.\0A\00"
@.str.1 = [16 x i8] c"Player 2 wins.\0A\00"
@.str.2 = [6 x i8] c"Tie.\0A\00"
define void @game(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = call i32 @score(i32 %11, i32 %12)
store i32 %13, i32* %9
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = call i32 @score(i32 %14, i32 %15)
store i32 %16, i32* %10
%17 = load i32, i32* %9
%18 = load i32, i32* %10
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %21
20: ; preds = %4
br label %47
21: ; preds = %4
%22 = load i32, i32* %9
%23 = load i32, i32* %10
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %26
25: ; preds = %21
br label %45
26: ; preds = %21
%27 = load i32, i32* %9
%28 = icmp eq i32 %27, 100
br i1 %28, label %29, label %42
29: ; preds = %26
%30 = load i32, i32* %5
%31 = load i32, i32* %7
%32 = icmp sgt i32 %30, %31
br i1 %32, label %33, label %34
33: ; preds = %29
br label %40
34: ; preds = %29
%35 = load i32, i32* %5
%36 = load i32, i32* %7
%37 = icmp slt i32 %35, %36
%38 = zext i1 %37 to i64
%39 = select i1 %37, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
br label %40
40: ; preds = %34, %33
%41 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), %33 ], [ %39, %34 ]
br label %43
42: ; preds = %26
br label %43
43: ; preds = %42, %40
%44 = phi i8* [ %41, %40 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %42 ]
br label %45
45: ; preds = %43, %25
%46 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), %25 ], [ %44, %43 ]
br label %47
47: ; preds = %45, %20
%48 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), %20 ], [ %46, %45 ]
%49 = call i32 @printf(i8* %48)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Player 1 wins.\0A\00"
@.str.1 = [16 x i8] c"Player 2 wins.\0A\00"
@.str.2 = [6 x i8] c"Tie.\0A\00"
define void @game(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @score(i32 %0, i32 %1)
%6 = tail call i32 @score(i32 %2, i32 %3)
%7 = icmp sgt i32 %5, %6
br i1 %7, label %17, label %8
8: ; preds = %4
%9 = icmp slt i32 %5, %6
br i1 %9, label %17, label %10
10: ; preds = %8
%11 = icmp eq i32 %5, 100
br i1 %11, label %12, label %17
12: ; preds = %10
%13 = icmp sgt i32 %0, %2
br i1 %13, label %17, label %14
14: ; preds = %12
%15 = icmp slt i32 %0, %2
%16 = select i1 %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
br label %17
17: ; preds = %8, %10, %14, %12, %4
%18 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), %4 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), %8 ], [ %16, %14 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), %12 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %10 ]
%19 = tail call i32 @printf(i8* dereferenceable(1) %18)
ret void
}