#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 die1 = 0;
  int die2 = 0;
  int die3 = 0;
  int die4 = 0;
  int die5 = 0;
  int die6 = 0;
  int count, roll, sums;
  int N;
  srand(time(NULL));
  printf("How many times do you want to roll the dice:");
  scanf("%d", &N);
  for (count = 0; count < N; count++) {
    roll = (int)(rand() % 6 + 1);
    if (roll == 1) {
      die1++;
    } else if (roll == 2) {
      die2++;
    } else if (roll == 3) {
      die3++;
    } else if (roll == 4) {
      die4++;
    } else if (roll == 5) {
      die5++;
    } else if (roll == 6) {
      die6++;
    }
  }
  printf("    ones: %d\n", die1);
  printf("     two: %d\n", die2);
  printf("  threes: %d\n", die3);
  printf("   fours: %d\n", die4);
  printf("   fives: %d\n", die5);
  printf("   sixes: %d\n", die6);
  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    0xe7f(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1296 <main+0x146>
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    11f7 <main+0xa7>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1283 <main+0x133>
cmpl   $0x2,-0x24(%rbp)
jne    120f <main+0xbf>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    127e <main+0x12e>
cmpl   $0x3,-0x24(%rbp)
jne    1227 <main+0xd7>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1279 <main+0x129>
cmpl   $0x4,-0x24(%rbp)
jne    123f <main+0xef>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1274 <main+0x124>
cmpl   $0x5,-0x24(%rbp)
jne    1257 <main+0x107>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    126f <main+0x11f>
cmpl   $0x6,-0x24(%rbp)
jne    126a <main+0x11a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    126f <main+0x11f>
jmp    1274 <main+0x124>
jmp    1279 <main+0x129>
jmp    127e <main+0x12e>
jmp    1283 <main+0x133>
jmp    1288 <main+0x138>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11be <main+0x6e>
mov    -0x8(%rbp),%esi
lea    0xd90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xd84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xd81(%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
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xe9e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
mov    $0x0,%r13d
mov    $0x0,%r12d
movl   $0x0,0x8(%rsp)
mov    $0x0,%ebx
mov    $0x0,%ebp
jle    1252 <main+0x102>
lea    0xe3e(%rip),%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
xor    %r15d,%r15d
movl   $0x0,0x8(%rsp)
xor    %r12d,%r12d
xor    %r13d,%r13d
xor    %eax,%eax
mov    %rax,0x10(%rsp)
jmp    11fb <main+0xab>
addl   $0x1,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r15d
cmp    0xc(%rsp),%r15d
jge    1252 <main+0x102>
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    $0x5,%eax
ja     11f0 <main+0xa0>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
add    $0x1,%ebp
jmp    11f0 <main+0xa0>
add    $0x1,%ebx
jmp    11f0 <main+0xa0>
mov    0x10(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x10(%rsp)
jmp    11f0 <main+0xa0>
add    $0x1,%r13d
jmp    11f0 <main+0xa0>
add    $0x1,%r12d
jmp    11f0 <main+0xa0>
lea    0xdef(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xded(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdeb(%rip),%rdi
mov    0x10(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xde6(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xde3(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xde0(%rip),%rdi
mov    0x8(%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 = [45 x i8] c"How many times do you want to roll the dice:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c" ones: %d\0A\00"
@.str.3 = [14 x i8] c" two: %d\0A\00"
@.str.4 = [14 x i8] c" threes: %d\0A\00"
@.str.5 = [14 x i8] c" fours: %d\0A\00"
@.str.6 = [14 x i8] c" fives: %d\0A\00"
@.str.7 = [14 x i8] c" sixes: %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* %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
%12 = call i32 @time(i32* null)
%13 = call i32 @srand(i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %11)
store i32 0, i32* %8
br label %16
16: ; preds = %65, %0
%17 = load i32, i32* %8
%18 = load i32, i32* %11
%19 = icmp slt 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* %9
%24 = load i32, i32* %9
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %29
26: ; preds = %20
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %64
29: ; preds = %20
%30 = load i32, i32* %9
%31 = icmp eq i32 %30, 2
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %63
35: ; preds = %29
%36 = load i32, i32* %9
%37 = icmp eq i32 %36, 3
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %62
41: ; preds = %35
%42 = load i32, i32* %9
%43 = icmp eq i32 %42, 4
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = load i32, i32* %5
%46 = add nsw i32 %45, 1
store i32 %46, i32* %5
br label %61
47: ; preds = %41
%48 = load i32, i32* %9
%49 = icmp eq i32 %48, 5
br i1 %49, label %50, label %53
50: ; preds = %47
%51 = load i32, i32* %6
%52 = add nsw i32 %51, 1
store i32 %52, i32* %6
br label %60
53: ; preds = %47
%54 = load i32, i32* %9
%55 = icmp eq i32 %54, 6
br i1 %55, label %56, label %59
56: ; preds = %53
%57 = load i32, i32* %7
%58 = add nsw i32 %57, 1
store i32 %58, i32* %7
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* %8
%67 = add nsw i32 %66, 1
store i32 %67, i32* %8
br label %16
68: ; preds = %16
%69 = load i32, i32* %2
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %69)
%71 = load i32, i32* %3
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %4
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %73)
%75 = load i32, i32* %5
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %75)
%77 = load i32, i32* %6
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %77)
%79 = load i32, i32* %7
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %79)
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"How many times do you want to roll the dice:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c" ones: %d\0A\00"
@.str.3 = [14 x i8] c" two: %d\0A\00"
@.str.4 = [14 x i8] c" threes: %d\0A\00"
@.str.5 = [14 x i8] c" fours: %d\0A\00"
@.str.6 = [14 x i8] c" fives: %d\0A\00"
@.str.7 = [14 x i8] c" sixes: %d\0A\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 (i8*, ...) @printf(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 = 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 [ %38, %31 ], [ 0, %0 ]
%13 = phi i32 [ %35, %31 ], [ 0, %0 ]
%14 = phi i32 [ %34, %31 ], [ 0, %0 ]
%15 = phi i32 [ %33, %31 ], [ 0, %0 ]
%16 = phi i32 [ %32, %31 ], [ 0, %0 ]
%17 = call i32 (...) @rand()
%18 = srem i32 %17, 6
switch i32 %18, label %31 [
i32 0, label %19
i32 1, label %21
i32 2, label %23
i32 3, label %25
i32 4, label %27
i32 5, label %29
]
19: ; preds = %9
%20 = add nsw i32 %10, 1
br label %31
21: ; preds = %9
%22 = add nsw i32 %11, 1
br label %31
23: ; preds = %9
%24 = add nsw i32 %16, 1
br label %31
25: ; preds = %9
%26 = add nsw i32 %15, 1
br label %31
27: ; preds = %9
%28 = add nsw i32 %14, 1
br label %31
29: ; preds = %9
%30 = add nsw i32 %13, 1
br label %31
31: ; preds = %9, %19, %23, %27, %29, %25, %21
%32 = phi i32 [ %16, %19 ], [ %16, %21 ], [ %24, %23 ], [ %16, %25 ], [ %16, %27 ], [ %16, %29 ], [ %16, %9 ]
%33 = phi i32 [ %15, %19 ], [ %15, %21 ], [ %15, %23 ], [ %26, %25 ], [ %15, %27 ], [ %15, %29 ], [ %15, %9 ]
%34 = phi i32 [ %14, %19 ], [ %14, %21 ], [ %14, %23 ], [ %14, %25 ], [ %28, %27 ], [ %14, %29 ], [ %14, %9 ]
%35 = phi i32 [ %13, %19 ], [ %13, %21 ], [ %13, %23 ], [ %13, %25 ], [ %13, %27 ], [ %30, %29 ], [ %13, %9 ]
%36 = phi i32 [ %11, %19 ], [ %22, %21 ], [ %11, %23 ], [ %11, %25 ], [ %11, %27 ], [ %11, %29 ], [ %11, %9 ]
%37 = phi i32 [ %20, %19 ], [ %10, %21 ], [ %10, %23 ], [ %10, %25 ], [ %10, %27 ], [ %10, %29 ], [ %10, %9 ]
%38 = add nuw nsw i32 %12, 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 ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %47)
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %46)
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %42)
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %43)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %44)
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %45)
ret i32 0
}