#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*/ scanf(char *, int *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int ones = 0;
  int twos = 0;
  int threes = 0;
  int fours = 0;
  int fives = 0;
  int sixes = 0;
  int number, dice;
  srand(time(NULL));
  printf("Roll the die how many times?\n");
  scanf("%d", &number);
  while (number > 0) {
    dice = rand() % 6 + 1;
    if (dice == 1) {
      ones++;
    } else if (dice == 2) {
      twos++;
    } else if (dice == 3) {
      threes++;
    } else if (dice == 4) {
      fours++;
    } else if (dice == 5) {
      fives++;
    } else if (dice == 6) {
      sixes++;
    }
    number--;
  }
  printf("ones:\t%d \n", ones);
  printf("twos:\t%d \n", twos);
  printf("threes:\t%d\n", threes);
  printf("fours:\t%d\n", fours);
  printf("fives:\t%d\n", fives);
  printf("sixes:\t%d\n", sixes);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe70(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,-0x20(%rbp)
jle    1288 <main+0x138>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
jne    11ee <main+0x9e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    127a <main+0x12a>
cmpl   $0x2,-0x24(%rbp)
jne    1206 <main+0xb6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1275 <main+0x125>
cmpl   $0x3,-0x24(%rbp)
jne    121e <main+0xce>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1270 <main+0x120>
cmpl   $0x4,-0x24(%rbp)
jne    1236 <main+0xe6>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    126b <main+0x11b>
cmpl   $0x5,-0x24(%rbp)
jne    124e <main+0xfe>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1266 <main+0x116>
cmpl   $0x6,-0x24(%rbp)
jne    1261 <main+0x111>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1266 <main+0x116>
jmp    126b <main+0x11b>
jmp    1270 <main+0x120>
jmp    1275 <main+0x125>
jmp    127a <main+0x12a>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    11b7 <main+0x67>
mov    -0x8(%rbp),%esi
lea    0xd8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xd83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xd78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xd72(%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
push   %rax
xor    %r15d,%r15d
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xe89(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
mov    $0x0,%ebp
mov    $0x0,%r13d
mov    $0x0,%r12d
movl   $0x0,(%rsp)
mov    $0x0,%ebx
jle    124e <main+0xee>
lea    0xe38(%rip),%r14
xor    %ebx,%ebx
movl   $0x0,(%rsp)
xor    %r12d,%r12d
xor    %r13d,%r13d
xor    %ebp,%ebp
xor    %r15d,%r15d
jmp    1200 <main+0xa0>
addl   $0x1,(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x4(%rsp)
cmp    $0x1,%eax
jle    124e <main+0xee>
xor    %eax,%eax
call   1080 <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     11f0 <main+0x90>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
add    $0x1,%ebx
jmp    11f0 <main+0x90>
add    $0x1,%r15d
jmp    11f0 <main+0x90>
add    $0x1,%ebp
jmp    11f0 <main+0x90>
add    $0x1,%r13d
jmp    11f0 <main+0x90>
add    $0x1,%r12d
jmp    11f0 <main+0x90>
lea    0xdc6(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdc1(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdbb(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdb7(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdb1(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdab(%rip),%rdi
mov    (%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Roll the die how many times?\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"ones:\09%d \0A\00"
@.str.3 = [11 x i8] c"twos:\09%d \0A\00"
@.str.4 = [12 x i8] c"threes:\09%d\0A\00"
@.str.5 = [11 x i8] c"fours:\09%d\0A\00"
@.str.6 = [11 x i8] c"fives:\09%d\0A\00"
@.str.7 = [11 x i8] c"sixes:\09%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
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
%10 = call i32 @time(i32* null)
%11 = call i32 @srand(i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 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* %8)
br label %14
14: ; preds = %61, %0
%15 = load i32, i32* %8
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %64
17: ; preds = %14
%18 = call i32 (...) @rand()
%19 = srem i32 %18, 6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %9
%21 = load i32, i32* %9
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %26
23: ; preds = %17
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %61
26: ; preds = %17
%27 = load i32, i32* %9
%28 = icmp eq i32 %27, 2
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %60
32: ; preds = %26
%33 = load i32, i32* %9
%34 = icmp eq i32 %33, 3
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %59
38: ; preds = %32
%39 = load i32, i32* %9
%40 = icmp eq i32 %39, 4
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* %5
%43 = add nsw i32 %42, 1
store i32 %43, i32* %5
br label %58
44: ; preds = %38
%45 = load i32, i32* %9
%46 = icmp eq i32 %45, 5
br i1 %46, label %47, label %50
47: ; preds = %44
%48 = load i32, i32* %6
%49 = add nsw i32 %48, 1
store i32 %49, i32* %6
br label %57
50: ; preds = %44
%51 = load i32, i32* %9
%52 = icmp eq i32 %51, 6
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = load i32, i32* %7
%55 = add nsw i32 %54, 1
store i32 %55, i32* %7
br label %56
56: ; preds = %53, %50
br label %57
57: ; preds = %56, %47
br label %58
58: ; preds = %57, %41
br label %59
59: ; preds = %58, %35
br label %60
60: ; preds = %59, %29
br label %61
61: ; preds = %60, %23
%62 = load i32, i32* %8
%63 = add nsw i32 %62, -1
store i32 %63, i32* %8
br label %14
64: ; preds = %14
%65 = load i32, i32* %2
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %65)
%67 = load i32, i32* %3
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %67)
%69 = load i32, i32* %4
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %69)
%71 = load i32, i32* %5
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %6
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %73)
%75 = load i32, i32* %7
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %75)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"ones:\09%d \0A\00"
@.str.3 = [11 x i8] c"twos:\09%d \0A\00"
@.str.4 = [12 x i8] c"threes:\09%d\0A\00"
@.str.5 = [11 x i8] c"fours:\09%d\0A\00"
@.str.6 = [11 x i8] c"fives:\09%d\0A\00"
@.str.7 = [11 x i8] c"sixes:\09%d\0A\00"
@str = [29 x i8] c"Roll the die how many times?\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 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 = load i32, i32* %1
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %40
9: ; preds = %0, %30
%10 = phi i32 [ %36, %30 ], [ 0, %0 ]
%11 = phi i32 [ %35, %30 ], [ 0, %0 ]
%12 = phi i32 [ %34, %30 ], [ 0, %0 ]
%13 = phi i32 [ %33, %30 ], [ 0, %0 ]
%14 = phi i32 [ %32, %30 ], [ 0, %0 ]
%15 = phi i32 [ %31, %30 ], [ 0, %0 ]
%16 = call i32 (...) @rand()
%17 = srem i32 %16, 6
switch i32 %17, label %30 [
i32 0, label %18
i32 1, label %20
i32 2, label %22
i32 3, label %24
i32 4, label %26
i32 5, label %28
]
18: ; preds = %9
%19 = add nsw i32 %10, 1
br label %30
20: ; preds = %9
%21 = add nsw i32 %15, 1
br label %30
22: ; preds = %9
%23 = add nsw i32 %14, 1
br label %30
24: ; preds = %9
%25 = add nsw i32 %13, 1
br label %30
26: ; preds = %9
%27 = add nsw i32 %12, 1
br label %30
28: ; preds = %9
%29 = add nsw i32 %11, 1
br label %30
30: ; preds = %9, %20, %24, %28, %26, %22, %18
%31 = phi i32 [ %15, %18 ], [ %21, %20 ], [ %15, %22 ], [ %15, %24 ], [ %15, %26 ], [ %15, %28 ], [ %15, %9 ]
%32 = phi i32 [ %14, %18 ], [ %14, %20 ], [ %23, %22 ], [ %14, %24 ], [ %14, %26 ], [ %14, %28 ], [ %14, %9 ]
%33 = phi i32 [ %13, %18 ], [ %13, %20 ], [ %13, %22 ], [ %25, %24 ], [ %13, %26 ], [ %13, %28 ], [ %13, %9 ]
%34 = phi i32 [ %12, %18 ], [ %12, %20 ], [ %12, %22 ], [ %12, %24 ], [ %27, %26 ], [ %12, %28 ], [ %12, %9 ]
%35 = phi i32 [ %11, %18 ], [ %11, %20 ], [ %11, %22 ], [ %11, %24 ], [ %11, %26 ], [ %29, %28 ], [ %11, %9 ]
%36 = phi i32 [ %19, %18 ], [ %10, %20 ], [ %10, %22 ], [ %10, %24 ], [ %10, %26 ], [ %10, %28 ], [ %10, %9 ]
%37 = load i32, i32* %1
%38 = add nsw i32 %37, -1
store i32 %38, i32* %1
%39 = icmp sgt i32 %37, 1
br i1 %39, label %9, label %40
40: ; preds = %30, %0
%41 = phi i32 [ 0, %0 ], [ %31, %30 ]
%42 = phi i32 [ 0, %0 ], [ %32, %30 ]
%43 = phi i32 [ 0, %0 ], [ %33, %30 ]
%44 = phi i32 [ 0, %0 ], [ %34, %30 ]
%45 = phi i32 [ 0, %0 ], [ %35, %30 ]
%46 = phi i32 [ 0, %0 ], [ %36, %30 ]
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %46)
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %41)
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %42)
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %43)
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %44)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %45)
ret i32 0
}