#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 */
struct hand {
  int dummy;
};

/* Variables and functions */
int __doFlopBet(struct hand *);
int __doPreflopBet(struct hand *);
int __doRiverBet(struct hand *);
int __doTurnBet(struct hand *);
int bet(struct hand *thishand, int which) {
  switch (which) {
  case 0:
    return __doPreflopBet(thishand);
  case 1:
    return __doFlopBet(thishand);
  case 2:
    return __doTurnBet(thishand);
  case 3:
    return __doRiverBet(thishand);
  }
  return 0;
}


x86 assembly (clang, -O0):
<bet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x3,%rax
ja     11b8 <bet+0x78>
mov    -0x20(%rbp),%rax
lea    0xe95(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
call   1050 <__doPreflopBet@plt>
mov    %eax,-0x4(%rbp)
jmp    11bf <bet+0x7f>
mov    -0x10(%rbp),%rdi
call   1060 <__doFlopBet@plt>
mov    %eax,-0x4(%rbp)
jmp    11bf <bet+0x7f>
mov    -0x10(%rbp),%rdi
call   1030 <__doTurnBet@plt>
mov    %eax,-0x4(%rbp)
jmp    11bf <bet+0x7f>
mov    -0x10(%rbp),%rdi
call   1040 <__doRiverBet@plt>
mov    %eax,-0x4(%rbp)
jmp    11bf <bet+0x7f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bet>:
cmp    $0x3,%esi
ja     115c <bet+0x1c>
mov    %esi,%eax
lea    0xeb2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1050 <__doPreflopBet@plt>
xor    %eax,%eax
ret
jmp    1060 <__doFlopBet@plt>
jmp    1030 <__doTurnBet@plt>
jmp    1040 <__doRiverBet@plt>

LLVM IR (-O0):
%struct.hand = type { i32 }
define i32 @bet(%struct.hand* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.hand*
%5 = alloca i32
store %struct.hand* %0, %struct.hand** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
switch i32 %6, label %19 [
i32 0, label %7
i32 1, label %10
i32 2, label %13
i32 3, label %16
]
7: ; preds = %2
%8 = load %struct.hand*, %struct.hand** %4
%9 = call i32 @__doPreflopBet(%struct.hand* %8)
store i32 %9, i32* %3
br label %20
10: ; preds = %2
%11 = load %struct.hand*, %struct.hand** %4
%12 = call i32 @__doFlopBet(%struct.hand* %11)
store i32 %12, i32* %3
br label %20
13: ; preds = %2
%14 = load %struct.hand*, %struct.hand** %4
%15 = call i32 @__doTurnBet(%struct.hand* %14)
store i32 %15, i32* %3
br label %20
16: ; preds = %2
%17 = load %struct.hand*, %struct.hand** %4
%18 = call i32 @__doRiverBet(%struct.hand* %17)
store i32 %18, i32* %3
br label %20
19: ; preds = %2
store i32 0, i32* %3
br label %20
20: ; preds = %19, %16, %13, %10, %7
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
%struct.hand = type { i32 }
define i32 @bet(%struct.hand* %0, i32 %1) {
switch i32 %1, label %11 [
i32 0, label %3
i32 1, label %5
i32 2, label %7
i32 3, label %9
]
3: ; preds = %2
%4 = tail call i32 @__doPreflopBet(%struct.hand* %0)
br label %11
5: ; preds = %2
%6 = tail call i32 @__doFlopBet(%struct.hand* %0)
br label %11
7: ; preds = %2
%8 = tail call i32 @__doTurnBet(%struct.hand* %0)
br label %11
9: ; preds = %2
%10 = tail call i32 @__doRiverBet(%struct.hand* %0)
br label %11
11: ; preds = %2, %9, %7, %5, %3
%12 = phi i32 [ %10, %9 ], [ %8, %7 ], [ %6, %5 ], [ %4, %3 ], [ 0, %2 ]
ret i32 %12
}