#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 rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int dice;
  srand(time(NULL));
  dice = rand() % 6 + 1;
  if (dice == 1) {
    printf("ONE!\n");
  } else if (dice == 2) {
    printf("TWO!\n");
  } else if (dice == 3) {
    printf("THREE!\n");
  } else if (dice == 4) {
    printf("FOUR!\n");
  } else if (dice == 5) {
    printf("FIVE!\n");
  } else if (dice == 6) {
    printf("SIX!\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    118f <main+0x4f>
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
jmp    122a <main+0xea>
cmpl   $0x2,-0x8(%rbp)
jne    11aa <main+0x6a>
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
jmp    1225 <main+0xe5>
cmpl   $0x3,-0x8(%rbp)
jne    11c5 <main+0x85>
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
jmp    1220 <main+0xe0>
cmpl   $0x4,-0x8(%rbp)
jne    11e0 <main+0xa0>
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
jmp    121b <main+0xdb>
cmpl   $0x5,-0x8(%rbp)
jne    11fb <main+0xbb>
lea    0xe2a(%rip),%rdi
call   1030 <printf@plt>
jmp    1216 <main+0xd6>
cmpl   $0x6,-0x8(%rbp)
jne    1211 <main+0xd1>
lea    0xe16(%rip),%rdi
call   1030 <printf@plt>
jmp    1216 <main+0xd6>
jmp    121b <main+0xdb>
jmp    1220 <main+0xe0>
jmp    1225 <main+0xe5>
jmp    122a <main+0xea>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
cmp    $0x5,%eax
ja     118d <main+0x4d>
cltq
lea    0xea3(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"ONE!\0A\00"
@.str.1 = [6 x i8] c"TWO!\0A\00"
@.str.2 = [8 x i8] c"THREE!\0A\00"
@.str.3 = [7 x i8] c"FOUR!\0A\00"
@.str.4 = [7 x i8] c"FIVE!\0A\00"
@.str.5 = [6 x i8] c"SIX!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @time(i32* null)
%4 = call i32 @srand(i32 %3)
%5 = call i32 (...) @rand()
%6 = srem i32 %5, 6
%7 = add nsw i32 %6, 1
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %42
12: ; preds = %0
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %41
17: ; preds = %12
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 3
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %40
22: ; preds = %17
%23 = load i32, i32* %2
%24 = icmp eq i32 %23, 4
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %39
27: ; preds = %22
%28 = load i32, i32* %2
%29 = icmp eq i32 %28, 5
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %38
32: ; preds = %27
%33 = load i32, i32* %2
%34 = icmp eq i32 %33, 6
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %37
37: ; preds = %35, %32
br label %38
38: ; preds = %37, %30
br label %39
39: ; preds = %38, %25
br label %40
40: ; preds = %39, %20
br label %41
41: ; preds = %40, %15
br label %42
42: ; preds = %41, %10
ret i32 0
}

LLVM IR (-O2):
@str = [5 x i8] c"SIX!\00"
@str.6 = [6 x i8] c"FIVE!\00"
@str.7 = [6 x i8] c"FOUR!\00"
@str.8 = [7 x i8] c"THREE!\00"
@str.9 = [5 x i8] c"TWO!\00"
@str.10 = [5 x i8] c"ONE!\00"
@reltable.main = [6 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @str.10 to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @str.9 to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @str.8 to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @str.7 to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @str.6 to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @str to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 6
%5 = icmp ult i32 %4, 6
br i1 %5, label %6, label %11
6: ; preds = %0
%7 = sext i32 %4 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([6 x i32]* @reltable.main to i8*), i64 %8)
%10 = tail call i32 @puts(i8* dereferenceable(1) %9)
br label %11
11: ; preds = %0, %6
ret i32 0
}