#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 x, y = 0, numrolls = 0;
  int ones = 0, twos = 0, threes = 0, fours = 0, fives = 0, sixes = 0;
  srand(time(NULL));
  printf("How many times should I roll the die? ");
  scanf(" %d", &numrolls);
  while (y < numrolls) {
    x = rand() % 6 + 1;
    if (x == 1)
      ones++;
    else if (x == 2)
      twos++;
    else if (x == 3)
      threes++;
    else if (x == 4)
      fours++;
    else if (x == 5)
      fives++;
    else
      sixes++;
    y++;
  }
  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,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6b(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1289 <main+0x139>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11fe <main+0xae>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    127b <main+0x12b>
cmpl   $0x2,-0x8(%rbp)
jne    1216 <main+0xc6>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1276 <main+0x126>
cmpl   $0x3,-0x8(%rbp)
jne    122e <main+0xde>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1271 <main+0x121>
cmpl   $0x4,-0x8(%rbp)
jne    1246 <main+0xf6>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    126c <main+0x11c>
cmpl   $0x5,-0x8(%rbp)
jne    125e <main+0x10e>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1267 <main+0x117>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    126c <main+0x11c>
jmp    1271 <main+0x121>
jmp    1276 <main+0x126>
jmp    127b <main+0x12b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c5 <main+0x75>
mov    -0x14(%rbp),%esi
lea    0xd98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xd91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xd85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xd7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xd79(%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
movl   $0x0,0x14(%rsp)
xor    %r12d,%r12d
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xe96(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    0x14(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0x14(%rsp)
mov    $0x0,%ebp
mov    $0x0,%ebx
mov    $0x0,%r13d
movl   $0x0,0xc(%rsp)
movl   $0x0,0x10(%rsp)
jle    124a <main+0xfa>
lea    0xe38(%rip),%r14
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
xor    %r13d,%r13d
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r12d,%r12d
xor    %r15d,%r15d
jmp    11fb <main+0xab>
addl   $0x1,0x10(%rsp)
nopl   0x0(%rax)
add    $0x1,%r15d
cmp    0x14(%rsp),%r15d
jge    124a <main+0xfa>
xor    %eax,%eax
call   1070 <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    $0x4,%eax
ja     11e7 <main+0x97>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
add    $0x1,%r12d
jmp    11f0 <main+0xa0>
add    $0x1,%ebp
jmp    11f0 <main+0xa0>
add    $0x1,%ebx
jmp    11f0 <main+0xa0>
add    $0x1,%r13d
jmp    11f0 <main+0xa0>
addl   $0x1,0xc(%rsp)
jmp    11f0 <main+0xa0>
lea    0xdee(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xde7(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xde1(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xddd(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdd7(%rip),%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdd0(%rip),%rdi
mov    0x10(%rsp),%esi
xor    %eax,%eax
call   1030 <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 = [39 x i8] c"How many times should I roll the die? \00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [10 x i8] c"Ones:\09%d\0A\00"
@.str.3 = [10 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
%10 = alloca i32
store i32 0, i32* %1
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
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
%11 = call i32 @time(i32* null)
%12 = call i32 @srand(i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %4)
br label %15
15: ; preds = %59, %0
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %62
19: ; preds = %15
%20 = call i32 (...) @rand()
%21 = srem i32 %20, 6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %28
25: ; preds = %19
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %59
28: ; preds = %19
%29 = load i32, i32* %2
%30 = icmp eq i32 %29, 2
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %58
34: ; preds = %28
%35 = load i32, i32* %2
%36 = icmp eq i32 %35, 3
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
br label %57
40: ; preds = %34
%41 = load i32, i32* %2
%42 = icmp eq i32 %41, 4
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = load i32, i32* %8
%45 = add nsw i32 %44, 1
store i32 %45, i32* %8
br label %56
46: ; preds = %40
%47 = load i32, i32* %2
%48 = icmp eq i32 %47, 5
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = load i32, i32* %9
%51 = add nsw i32 %50, 1
store i32 %51, i32* %9
br label %55
52: ; preds = %46
%53 = load i32, i32* %10
%54 = add nsw i32 %53, 1
store i32 %54, i32* %10
br label %55
55: ; preds = %52, %49
br label %56
56: ; preds = %55, %43
br label %57
57: ; preds = %56, %37
br label %58
58: ; preds = %57, %31
br label %59
59: ; preds = %58, %25
%60 = load i32, i32* %3
%61 = add nsw i32 %60, 1
store i32 %61, i32* %3
br label %15
62: ; preds = %15
%63 = load i32, i32* %5
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %63)
%65 = load i32, i32* %6
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %65)
%67 = load i32, i32* %7
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %67)
%69 = load i32, i32* %8
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %69)
%71 = load i32, i32* %9
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %10
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %73)
ret i32 0
}

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