#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 die;
  int x;
  int counter = 0;
  int Ones = 0;
  int Twos = 0;
  int Threes = 0;
  int Fours = 0;
  int Fives = 0;
  int Sixes = 0;
  printf(" How many times you want the die to roll\n");
  scanf("%d", &x);
  srand(time(NULL));
  while (counter < x) {
    die = rand() % 6 + 1;
    counter++;
    if (die == 1)
      Ones++;
    else if (die == 2)
      Twos++;
    else if (die == 3)
      Threes++;
    else if (die == 4)
      Fours++;
    else if (die == 5)
      Fives++;
    else if (die == 6)
      Sixes++;
  }
  printf(" Ones %d\n", Ones);
  printf(" Twos %d\n", Twos);
  printf(" Threes %d\n", Threes);
  printf(" Fours %d\n", Fours);
  printf(" Fives %d\n", Fives);
  printf(" Sixes %d\n", Sixes);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%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)
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe85(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1291 <main+0x141>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1200 <main+0xb0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    128c <main+0x13c>
cmpl   $0x2,-0x8(%rbp)
jne    1218 <main+0xc8>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1287 <main+0x137>
cmpl   $0x3,-0x8(%rbp)
jne    1230 <main+0xe0>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1282 <main+0x132>
cmpl   $0x4,-0x8(%rbp)
jne    1248 <main+0xf8>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    127d <main+0x12d>
cmpl   $0x5,-0x8(%rbp)
jne    1260 <main+0x110>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1278 <main+0x128>
cmpl   $0x6,-0x8(%rbp)
jne    1273 <main+0x123>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1278 <main+0x128>
jmp    127d <main+0x12d>
jmp    1282 <main+0x132>
jmp    1287 <main+0x137>
jmp    128c <main+0x13c>
jmp    11be <main+0x6e>
mov    -0x14(%rbp),%esi
lea    0xd92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xd84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xd7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xd79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xd73(%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    0xee7(%rip),%rdi
call   1030 <puts@plt>
lea    0xe97(%rip),%rdi
lea    0x14(%rsp),%rsi
call   1070 <scanf@plt>
xor    %ebx,%ebx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
cmpl   $0x0,0x14(%rsp)
mov    $0x0,%ebp
mov    $0x0,%r13d
mov    $0x0,%r12d
movl   $0x0,0xc(%rsp)
movl   $0x0,0x10(%rsp)
jle    125a <main+0xfa>
lea    0xe32(%rip),%r14
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
xor    %r12d,%r12d
xor    %r13d,%r13d
xor    %ebp,%ebp
xor    %ebx,%ebx
xor    %r15d,%r15d
jmp    1207 <main+0xa7>
addl   $0x1,0x10(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    0x14(%rsp),%r15d
jge    125a <main+0xfa>
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
add    $0x1,%r15d
cmp    $0x5,%eax
ja     1200 <main+0xa0>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
add    $0x1,%ebx
jmp    1200 <main+0xa0>
add    $0x1,%ebp
jmp    1200 <main+0xa0>
add    $0x1,%r13d
jmp    1200 <main+0xa0>
add    $0x1,%r12d
jmp    1200 <main+0xa0>
addl   $0x1,0xc(%rsp)
jmp    1200 <main+0xa0>
lea    0xdba(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdb4(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdae(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xda9(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xda3(%rip),%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd9c(%rip),%rdi
mov    0x10(%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 = [42 x i8] c" How many times you want the die to roll\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c" Ones %d\0A\00"
@.str.3 = [10 x i8] c" Twos %d\0A\00"
@.str.4 = [12 x i8] c" Threes %d\0A\00"
@.str.5 = [11 x i8] c" Fours %d\0A\00"
@.str.6 = [11 x i8] c" Fives %d\0A\00"
@.str.7 = [11 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
store i32 0, i32* %1
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 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = call i32 @time(i32* null)
%14 = call i32 @srand(i32 %13)
br label %15
15: ; preds = %65, %0
%16 = load i32, i32* %4
%17 = load i32, i32* %3
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %66
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* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
%25 = load i32, i32* %2
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %30
27: ; preds = %19
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %65
30: ; preds = %19
%31 = load i32, i32* %2
%32 = icmp eq i32 %31, 2
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %64
36: ; preds = %30
%37 = load i32, i32* %2
%38 = icmp eq i32 %37, 3
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 1
store i32 %41, i32* %7
br label %63
42: ; preds = %36
%43 = load i32, i32* %2
%44 = icmp eq i32 %43, 4
br i1 %44, label %45, label %48
45: ; preds = %42
%46 = load i32, i32* %8
%47 = add nsw i32 %46, 1
store i32 %47, i32* %8
br label %62
48: ; preds = %42
%49 = load i32, i32* %2
%50 = icmp eq i32 %49, 5
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = load i32, i32* %9
%53 = add nsw i32 %52, 1
store i32 %53, i32* %9
br label %61
54: ; preds = %48
%55 = load i32, i32* %2
%56 = icmp eq i32 %55, 6
br i1 %56, label %57, label %60
57: ; preds = %54
%58 = load i32, i32* %10
%59 = add nsw i32 %58, 1
store i32 %59, i32* %10
br label %60
60: ; preds = %57, %54
br label %61
61: ; preds = %60, %51
br label %62
62: ; preds = %61, %45
br label %63
63: ; preds = %62, %39
br label %64
64: ; preds = %63, %33
br label %65
65: ; preds = %64, %27
br label %15
66: ; preds = %15
%67 = load i32, i32* %5
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %67)
%69 = load i32, i32* %6
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %69)
%71 = load i32, i32* %7
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %8
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %73)
%75 = load i32, i32* %9
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %75)
%77 = load i32, i32* %10
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %77)
ret i32 0
}

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