#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, roll, ones, twos, threes, fours, fives, sixes;
  y = 0;
  roll;
  ones = 0;
  twos = 0;
  threes = 0;
  fours = 0;
  fives = 0;
  sixes = 0;
  srand(time(NULL));
  printf("How many times do you want to roll a die?");
  scanf("%d", &x);
  while (y < x) {
    roll = rand() % 6 + 1;
    if (roll == 1) {
      ones++;
    }
    if (roll == 2) {
      twos++;
    }
    if (roll == 3) {
      threes++;
    }
    if (roll == 4) {
      fours++;
    }
    if (roll == 5) {
      fives++;
    }
    if (roll == 6) {
      sixes++;
    }
    y++;
  }
  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,-0xc(%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    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe75(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    125f <main+0x10f>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    11f2 <main+0xa2>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x2,-0x10(%rbp)
jne    1205 <main+0xb5>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x3,-0x10(%rbp)
jne    1218 <main+0xc8>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x4,-0x10(%rbp)
jne    122b <main+0xdb>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x5,-0x10(%rbp)
jne    123e <main+0xee>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x6,-0x10(%rbp)
jne    1251 <main+0x101>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11be <main+0x6e>
mov    -0x14(%rbp),%esi
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xda0(%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   %r14
push   %rbx
sub    $0x20,%rsp
xor    %ebx,%ebx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xea1(%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)
jle    120a <main+0xba>
pxor   %xmm0,%xmm0
movdqa %xmm0,0x10(%rsp)
xor    %r14d,%r14d
xor    %ebx,%ebx
xor    %ebp,%ebp
nop
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
mov    %eax,%edx
sub    %ecx,%edx
neg    %ecx
cmp    $0x1,%edx
adc    $0x0,%ebx
add    %ecx,%eax
add    $0x1,%eax
movd   %eax,%xmm0
pshufd $0x0,%xmm0,%xmm0
pcmpeqd 0xe1c(%rip),%xmm0
movdqa 0x10(%rsp),%xmm1
psubd  %xmm0,%xmm1
movdqa %xmm1,0x10(%rsp)
xor    %ecx,%ecx
cmp    $0x6,%eax
sete   %cl
add    %ecx,%r14d
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     11a0 <main+0x50>
jmp    1217 <main+0xc7>
pxor   %xmm0,%xmm0
movdqa %xmm0,0x10(%rsp)
xor    %r14d,%r14d
lea    0xe1f(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movdqa 0x10(%rsp),%xmm0
movd   %xmm0,%esi
lea    0xe0e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
pshufd $0x55,0x10(%rsp),%xmm0
movd   %xmm0,%esi
lea    0xdfe(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
pshufd $0xee,0x10(%rsp),%xmm0
movd   %xmm0,%esi
lea    0xdf0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
pshufd $0xff,0x10(%rsp),%xmm0
movd   %xmm0,%esi
lea    0xde1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xddd(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [42 x i8] c"How many times do you want to roll a die?\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"Ones=%d\0A\00"
@.str.3 = [9 x i8] c"Twos=%d\0A\00"
@.str.4 = [11 x i8] c"Threes=%d\0A\00"
@.str.5 = [10 x i8] c"Fours=%d\0A\00"
@.str.6 = [10 x i8] c"Fives=%d\0A\00"
@.str.7 = [10 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 ([42 x i8], [42 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 %31
9: ; preds = %0, %9
%10 = phi i32 [ %27, %9 ], [ 0, %0 ]
%11 = phi i32 [ %19, %9 ], [ 0, %0 ]
%12 = phi i32 [ %28, %9 ], [ 0, %0 ]
%13 = phi <4 x i32> [ %24, %9 ], [ zeroinitializer, %0 ]
%14 = call i32 (...) @rand()
%15 = srem i32 %14, 6
%16 = add nsw i32 %15, 1
%17 = icmp eq i32 %15, 0
%18 = zext i1 %17 to i32
%19 = add nuw nsw i32 %11, %18
%20 = insertelement <4 x i32> poison, i32 %16, i64 0
%21 = shufflevector <4 x i32> %20, <4 x i32> poison, <4 x i32> zeroinitializer
%22 = icmp eq <4 x i32> %21, <i32 2, i32 3, i32 4, i32 5>
%23 = zext <4 x i1> %22 to <4 x i32>
%24 = add nuw nsw <4 x i32> %13, %23
%25 = icmp eq i32 %16, 6
%26 = zext i1 %25 to i32
%27 = add nuw nsw i32 %10, %26
%28 = add nuw nsw i32 %12, 1
%29 = load i32, i32* %1
%30 = icmp slt i32 %28, %29
br i1 %30, label %9, label %31
31: ; preds = %9, %0
%32 = phi i32 [ 0, %0 ], [ %19, %9 ]
%33 = phi i32 [ 0, %0 ], [ %27, %9 ]
%34 = phi <4 x i32> [ zeroinitializer, %0 ], [ %24, %9 ]
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%36 = extractelement <4 x i32> %34, i64 0
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%38 = extractelement <4 x i32> %34, i64 1
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %38)
%40 = extractelement <4 x i32> %34, i64 2
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %40)
%42 = extractelement <4 x i32> %34, i64 3
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %42)
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %33)
ret i32 0
}