#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 */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int num_rolls, num_six, num_five, num_four, num_three, num_two, num_one, n,
      dice_num;
  num_six = num_five = num_four = num_three = num_two = num_one = dice_num = 0;
  time_t t;
  printf("How many time you would like to roll a dice?\n");
  scanf("%d", &num_rolls);
  srand(time(&t));
  n = 0;
  for (; num_rolls > n; n++) {
    dice_num = (rand() % 6 + 1);
    if (dice_num == 6) {
      num_six++;
    } else if (dice_num == 5) {
      num_five++;
    } else if (dice_num == 4) {
      num_four++;
    } else if (dice_num == 3) {
      num_three++;
    } else if (dice_num == 2) {
      num_two++;
    } else if (dice_num == 1) {
      num_one++;
    }
  }
  printf("Number rolled\n");
  printf("#1: %d\n", num_one);
  printf("#2: %d\n", num_two);
  printf("#3: %d\n", num_three);
  printf("#4: %d\n", num_four);
  printf("#5: %d\n", num_five);
  printf("#6: %d\n", num_six);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe89(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
lea    -0x2c(%rbp),%rdi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x24(%rbp),%eax
jle    129d <main+0x14d>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x28(%rbp)
cmpl   $0x6,-0x28(%rbp)
jne    11fe <main+0xae>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    128a <main+0x13a>
cmpl   $0x5,-0x28(%rbp)
jne    1216 <main+0xc6>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1285 <main+0x135>
cmpl   $0x4,-0x28(%rbp)
jne    122e <main+0xde>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1280 <main+0x130>
cmpl   $0x3,-0x28(%rbp)
jne    1246 <main+0xf6>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    127b <main+0x12b>
cmpl   $0x2,-0x28(%rbp)
jne    125e <main+0x10e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1276 <main+0x126>
cmpl   $0x1,-0x28(%rbp)
jne    1271 <main+0x121>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1276 <main+0x126>
jmp    127b <main+0x12b>
jmp    1280 <main+0x130>
jmp    1285 <main+0x135>
jmp    128a <main+0x13a>
jmp    128f <main+0x13f>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11c5 <main+0x75>
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xd82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xd79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xd70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xd67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xd5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
lea    0xe93(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1070 <scanf@plt>
lea    0x14(%rsp),%rdi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
cmpl   $0x0,0x10(%rsp)
jle    1244 <main+0xe4>
lea    0xe52(%rip),%r14
xor    %r15d,%r15d
xor    %ebp,%ebp
xor    %ebx,%ebx
xor    %r13d,%r13d
xor    %r12d,%r12d
movl   $0x0,0x8(%rsp)
movl   $0x0,0xc(%rsp)
jmp    11eb <main+0x8b>
sub    %ecx,%eax
cmp    $0x1,%eax
adc    $0x0,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r15d
cmp    %r15d,0x10(%rsp)
jle    125e <main+0xfe>
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%rcx
imul   $0x2aaaaaab,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
mov    %ecx,%edx
neg    %edx
add    %eax,%edx
add    $0xffffffff,%edx
cmp    $0x4,%edx
ja     11cd <main+0x6d>
movslq (%r14,%rdx,4),%rax
add    %r14,%rax
jmp    *%rax
add    $0x1,%ebx
jmp    11e0 <main+0x80>
add    $0x1,%r13d
jmp    11e0 <main+0x80>
add    $0x1,%r12d
jmp    11e0 <main+0x80>
addl   $0x1,0x8(%rsp)
jmp    11e0 <main+0x80>
addl   $0x1,0xc(%rsp)
jmp    11e0 <main+0x80>
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
xor    %r12d,%r12d
xor    %r13d,%r13d
xor    %ebx,%ebx
xor    %ebp,%ebp
lea    0xe0f(%rip),%rdi
call   1030 <puts@plt>
lea    0xda6(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd9e(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd96(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd8d(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd84(%rip),%rdi
mov    0x8(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd7a(%rip),%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"How many time you would like to roll a dice?\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"Number rolled\0A\00"
@.str.3 = [8 x i8] c": %d\0A\00"
@.str.4 = [8 x i8] c": %d\0A\00"
@.str.5 = [8 x i8] c": %d\0A\00"
@.str.6 = [8 x i8] c": %d\0A\00"
@.str.7 = [8 x i8] c": %d\0A\00"
@.str.8 = [8 x i8] c": %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %10
store i32 0, i32* %8
store i32 0, i32* %7
store i32 0, i32* %6
store i32 0, i32* %5
store i32 0, i32* %4
store i32 0, i32* %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%14 = call i32 @time(i32* %11)
%15 = call i32 @srand(i32 %14)
store i32 0, i32* %9
br label %16
16: ; preds = %65, %0
%17 = load i32, i32* %2
%18 = load i32, i32* %9
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %68
20: ; preds = %16
%21 = call i32 (...) @rand()
%22 = srem i32 %21, 6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %10
%24 = load i32, i32* %10
%25 = icmp eq i32 %24, 6
br i1 %25, label %26, label %29
26: ; preds = %20
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %64
29: ; preds = %20
%30 = load i32, i32* %10
%31 = icmp eq i32 %30, 5
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
br label %63
35: ; preds = %29
%36 = load i32, i32* %10
%37 = icmp eq i32 %36, 4
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %62
41: ; preds = %35
%42 = load i32, i32* %10
%43 = icmp eq i32 %42, 3
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = load i32, i32* %6
%46 = add nsw i32 %45, 1
store i32 %46, i32* %6
br label %61
47: ; preds = %41
%48 = load i32, i32* %10
%49 = icmp eq i32 %48, 2
br i1 %49, label %50, label %53
50: ; preds = %47
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 1
store i32 %52, i32* %7
br label %60
53: ; preds = %47
%54 = load i32, i32* %10
%55 = icmp eq i32 %54, 1
br i1 %55, label %56, label %59
56: ; preds = %53
%57 = load i32, i32* %8
%58 = add nsw i32 %57, 1
store i32 %58, i32* %8
br label %59
59: ; preds = %56, %53
br label %60
60: ; preds = %59, %50
br label %61
61: ; preds = %60, %44
br label %62
62: ; preds = %61, %38
br label %63
63: ; preds = %62, %32
br label %64
64: ; preds = %63, %26
br label %65
65: ; preds = %64
%66 = load i32, i32* %9
%67 = add nsw i32 %66, 1
store i32 %67, i32* %9
br label %16
68: ; preds = %16
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%70 = load i32, i32* %8
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %70)
%72 = load i32, i32* %7
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 %72)
%74 = load i32, i32* %6
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 %74)
%76 = load i32, i32* %5
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 %76)
%78 = load i32, i32* %4
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %78)
%80 = load i32, i32* %3
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 %80)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [8 x i8] c": %d\0A\00"
@.str.4 = [8 x i8] c": %d\0A\00"
@.str.5 = [8 x i8] c": %d\0A\00"
@.str.6 = [8 x i8] c": %d\0A\00"
@.str.7 = [8 x i8] c": %d\0A\00"
@.str.8 = [8 x i8] c": %d\0A\00"
@str = [45 x i8] c"How many time you would like to roll a dice?\00"
@str.9 = [14 x i8] c"Number rolled\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 @time(i32* %2)
%8 = call i32 @srand(i32 %7)
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %45
11: ; preds = %0, %35
%12 = phi i32 [ %42, %35 ], [ 0, %0 ]
%13 = phi i32 [ %41, %35 ], [ 0, %0 ]
%14 = phi i32 [ %40, %35 ], [ 0, %0 ]
%15 = phi i32 [ %39, %35 ], [ 0, %0 ]
%16 = phi i32 [ %38, %35 ], [ 0, %0 ]
%17 = phi i32 [ %37, %35 ], [ 0, %0 ]
%18 = phi i32 [ %36, %35 ], [ 0, %0 ]
%19 = call i32 (...) @rand()
%20 = srem i32 %19, 6
switch i32 %20, label %31 [
i32 5, label %21
i32 4, label %23
i32 3, label %25
i32 2, label %27
i32 1, label %29
]
21: ; preds = %11
%22 = add nsw i32 %18, 1
br label %35
23: ; preds = %11
%24 = add nsw i32 %17, 1
br label %35
25: ; preds = %11
%26 = add nsw i32 %16, 1
br label %35
27: ; preds = %11
%28 = add nsw i32 %15, 1
br label %35
29: ; preds = %11
%30 = add nsw i32 %14, 1
br label %35
31: ; preds = %11
%32 = icmp eq i32 %20, 0
%33 = zext i1 %32 to i32
%34 = add nsw i32 %13, %33
br label %35
35: ; preds = %31, %21, %25, %29, %27, %23
%36 = phi i32 [ %22, %21 ], [ %18, %23 ], [ %18, %25 ], [ %18, %27 ], [ %18, %29 ], [ %18, %31 ]
%37 = phi i32 [ %17, %21 ], [ %24, %23 ], [ %17, %25 ], [ %17, %27 ], [ %17, %29 ], [ %17, %31 ]
%38 = phi i32 [ %16, %21 ], [ %16, %23 ], [ %26, %25 ], [ %16, %27 ], [ %16, %29 ], [ %16, %31 ]
%39 = phi i32 [ %15, %21 ], [ %15, %23 ], [ %15, %25 ], [ %28, %27 ], [ %15, %29 ], [ %15, %31 ]
%40 = phi i32 [ %14, %21 ], [ %14, %23 ], [ %14, %25 ], [ %14, %27 ], [ %30, %29 ], [ %14, %31 ]
%41 = phi i32 [ %13, %21 ], [ %13, %23 ], [ %13, %25 ], [ %13, %27 ], [ %13, %29 ], [ %34, %31 ]
%42 = add nuw nsw i32 %12, 1
%43 = load i32, i32* %1
%44 = icmp sgt i32 %43, %42
br i1 %44, label %11, label %45
45: ; preds = %35, %0
%46 = phi i32 [ 0, %0 ], [ %36, %35 ]
%47 = phi i32 [ 0, %0 ], [ %37, %35 ]
%48 = phi i32 [ 0, %0 ], [ %38, %35 ]
%49 = phi i32 [ 0, %0 ], [ %39, %35 ]
%50 = phi i32 [ 0, %0 ], [ %40, %35 ]
%51 = phi i32 [ 0, %0 ], [ %41, %35 ]
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.9, i64 0, i64 0))
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %51)
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 %50)
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 %49)
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 %48)
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %47)
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 %46)
ret i32 0
}