#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 getRandomNum(int, int);
int /*<<< orphan*/ printf(char *);
void printRandomComment() {
  int comment = getRandomNum(1, 6);
  switch (comment) {
  case 1:
    printf("\n\"Oh, you're going for broke, huh?\"\n\n");
    break;
  case 2:
    printf("\n\"Aw cmon, take a chance.\"\n\n");
    break;
  case 3:
    printf("\n\"Are you shikkun?\"\n\n");
    break;
  case 4:
    printf("\n\"Last of the big betters, I don't think.\"\n\n");
    break;
  case 5:
    printf("\n\"You probably should have just cashed in your chips.\"\n\n");
    break;
  case 6:
    printf("\n\"Now that's better.\"\n\n");
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<printRandomComment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
mov    $0x6,%esi
call   1030 <getRandomNum@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x5,%eax
ja     11c9 <printRandomComment+0xa9>
mov    -0x10(%rbp),%rax
lea    0xea6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
jmp    11ce <printRandomComment+0xae>
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
jmp    11ce <printRandomComment+0xae>
lea    0xecf(%rip),%rdi
call   1040 <printf@plt>
jmp    11ce <printRandomComment+0xae>
lea    0xed4(%rip),%rdi
call   1040 <printf@plt>
jmp    11ce <printRandomComment+0xae>
lea    0xef0(%rip),%rdi
call   1040 <printf@plt>
jmp    11ce <printRandomComment+0xae>
lea    0xf18(%rip),%rdi
call   1040 <printf@plt>
jmp    11ce <printRandomComment+0xae>
jmp    11ce <printRandomComment+0xae>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printRandomComment>:
push   %rax
mov    $0x1,%edi
mov    $0x6,%esi
call   1040 <getRandomNum@plt>
add    $0xffffffff,%eax
cmp    $0x5,%eax
ja     114e <printRandomComment+0x2e>
cltq
lea    0xf93(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
pop    %rax
jmp    1030 <puts@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [38 x i8] c"\0A\22Oh, you're going for broke, huh?\22\0A\0A\00"
@.str.1 = [29 x i8] c"\0A\22Aw cmon, take a chance.\22\0A\0A\00"
@.str.2 = [22 x i8] c"\0A\22Are you shikkun?\22\0A\0A\00"
@.str.3 = [45 x i8] c"\0A\22Last of the big betters, I don't think.\22\0A\0A\00"
@.str.4 = [57 x i8] c"\0A\22You probably should have just cashed in your chips.\22\0A\0A\00"
@.str.5 = [24 x i8] c"\0A\22Now that's better.\22\0A\0A\00"
define void @printRandomComment() {
%1 = alloca i32
%2 = call i32 @getRandomNum(i32 1, i32 6)
store i32 %2, i32* %1
%3 = load i32, i32* %1
switch i32 %3, label %16 [
i32 1, label %4
i32 2, label %6
i32 3, label %8
i32 4, label %10
i32 5, label %12
i32 6, label %14
]
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %17
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
br label %17
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %17
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
br label %17
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.4, i64 0, i64 0))
br label %17
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
br label %17
16: ; preds = %0
br label %17
17: ; preds = %16, %14, %12, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
@str = [23 x i8] c"\0A\22Now that's better.\22\0A\00"
@str.6 = [56 x i8] c"\0A\22You probably should have just cashed in your chips.\22\0A\00"
@str.7 = [44 x i8] c"\0A\22Last of the big betters, I don't think.\22\0A\00"
@str.8 = [21 x i8] c"\0A\22Are you shikkun?\22\0A\00"
@str.9 = [28 x i8] c"\0A\22Aw cmon, take a chance.\22\0A\00"
@str.10 = [37 x i8] c"\0A\22Oh, you're going for broke, huh?\22\0A\00"
@reltable.printRandomComment = [6 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([37 x i8]* @str.10 to i64), i64 ptrtoint ([6 x i32]* @reltable.printRandomComment to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([28 x i8]* @str.9 to i64), i64 ptrtoint ([6 x i32]* @reltable.printRandomComment to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @str.8 to i64), i64 ptrtoint ([6 x i32]* @reltable.printRandomComment to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([44 x i8]* @str.7 to i64), i64 ptrtoint ([6 x i32]* @reltable.printRandomComment to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([56 x i8]* @str.6 to i64), i64 ptrtoint ([6 x i32]* @reltable.printRandomComment to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @str to i64), i64 ptrtoint ([6 x i32]* @reltable.printRandomComment to i64)) to i32)]
define void @printRandomComment() {
%1 = tail call i32 @getRandomNum(i32 1, i32 6)
%2 = add i32 %1, -1
%3 = icmp ult i32 %2, 6
br i1 %3, label %4, label %9
4: ; preds = %0
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([6 x i32]* @reltable.printRandomComment to i8*), i64 %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
br label %9
9: ; preds = %0, %4
ret void
}