#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);
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(" Congratulations, you rolled a %d \n", dice);
  }
  if (dice == 2) {
    printf(" Congratulations, you rolled a %d \n", dice);
  }
  if (dice == 3) {
    printf(" Congratulations, you rolled a %d \n", dice);
  }
  if (dice == 4) {
    printf(" Congratulations, you rolled a %d \n", dice);
  }
  if (dice == 5) {
    printf(" Congratulations, you rolled a %d \n", dice);
  }
  if (dice == 6) {
    printf(" Congratulations, you rolled a %d \n", dice);
  }
}


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    118d <main+0x4d>
mov    -0x8(%rbp),%esi
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jne    11a6 <main+0x66>
mov    -0x8(%rbp),%esi
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
jne    11bf <main+0x7f>
mov    -0x8(%rbp),%esi
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x4,-0x8(%rbp)
jne    11d8 <main+0x98>
mov    -0x8(%rbp),%esi
lea    0xe2d(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x5,-0x8(%rbp)
jne    11f1 <main+0xb1>
mov    -0x8(%rbp),%esi
lea    0xe14(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x6,-0x8(%rbp)
jne    120a <main+0xca>
mov    -0x8(%rbp),%esi
lea    0xdfb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%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>
movslq %eax,%rsi
imul   $0x2aaaaaab,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%esi
cmp    $0x5,%esi
ja     1188 <main+0x48>
add    $0x1,%esi
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c" Congratulations, you rolled a %d \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 %13
10: ; preds = %0
%11 = load i32, i32* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %10, %0
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* %2
%18 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %16, %13
%20 = load i32, i32* %2
%21 = icmp eq i32 %20, 3
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32, i32* %2
%24 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %22, %19
%26 = load i32, i32* %2
%27 = icmp eq i32 %26, 4
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %2
%30 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %28, %25
%32 = load i32, i32* %2
%33 = icmp eq i32 %32, 5
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load i32, i32* %2
%36 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %34, %31
%38 = load i32, i32* %2
%39 = icmp eq i32 %38, 6
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = load i32, i32* %2
%42 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %41)
br label %43
43: ; preds = %40, %37
%44 = load i32, i32* %1
ret i32 %44
}

LLVM IR (-O2):
@.str = [36 x i8] c" Congratulations, you rolled a %d \0A\00"
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 %9
6: ; preds = %0
%7 = add nsw i32 %4, 1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %0, %6
ret i32 0
}