#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*/ EXIT_FAILURE;
int base_n_bit(int, int, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int floor(int);
int pow(int, int);
int player_response(int player, int strategy, int input) {
  if (player == 0) {
    return base_n_bit(2, strategy, input);
  } else if (player == 1) {
    return base_n_bit(3, floor(strategy / pow(2, 2)), input);
  } else {
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<player_response>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1173 <player_response+0x33>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    $0x2,%edi
call   1030 <base_n_bit@plt>
mov    %eax,-0x4(%rbp)
jmp    11c3 <player_response+0x83>
cmpl   $0x1,-0x8(%rbp)
jne    11b5 <player_response+0x75>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x2,%esi
mov    %esi,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%edi
call   1060 <floor@plt>
mov    %eax,%esi
mov    -0x10(%rbp),%edx
mov    $0x3,%edi
call   1030 <base_n_bit@plt>
mov    %eax,-0x4(%rbp)
jmp    11c3 <player_response+0x83>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<player_response>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%ebp
cmp    $0x1,%edi
je     1159 <player_response+0x19>
test   %edi,%edi
jne    118a <player_response+0x4a>
mov    $0x2,%edi
mov    %ebp,%esi
jmp    117d <player_response+0x3d>
mov    $0x2,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %eax,%edi
call   1060 <floor@plt>
mov    $0x3,%edi
mov    %eax,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <base_n_bit@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define i32 @player_response(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = call i32 @base_n_bit(i32 2, i32 %11, i32 %12)
store i32 %13, i32* %4
br label %27
14: ; preds = %3
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %24
17: ; preds = %14
%18 = load i32, i32* %6
%19 = call i32 @pow(i32 2, i32 2)
%20 = sdiv i32 %18, %19
%21 = call i32 @floor(i32 %20)
%22 = load i32, i32* %7
%23 = call i32 @base_n_bit(i32 3, i32 %21, i32 %22)
store i32 %23, i32* %4
br label %27
24: ; preds = %14
%25 = load i32, i32* @EXIT_FAILURE
%26 = call i32 @exit(i32 %25)
unreachable
27: ; preds = %17, %10
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define i32 @player_response(i32 %0, i32 %1, i32 %2) {
switch i32 %0, label %11 [
i32 0, label %4
i32 1, label %6
]
4: ; preds = %3
%5 = tail call i32 @base_n_bit(i32 2, i32 %1, i32 %2)
br label %14
6: ; preds = %3
%7 = tail call i32 @pow(i32 2, i32 2)
%8 = sdiv i32 %1, %7
%9 = tail call i32 @floor(i32 %8)
%10 = tail call i32 @base_n_bit(i32 3, i32 %9, i32 %2)
br label %14
11: ; preds = %3
%12 = load i32, i32* @EXIT_FAILURE
%13 = tail call i32 @exit(i32 %12)
unreachable
14: ; preds = %6, %4
%15 = phi i32 [ %5, %4 ], [ %10, %6 ]
ret i32 %15
}