#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 user_input;
  int counter = 0;
  int roll;
  int ones = 0;
  int twos = 0;
  int threes = 0;
  int fours = 0;
  int fives = 0;
  int sixes = 0;
  srand(time(NULL));
  printf("Roll the die how many times?");
  scanf("%d", &user_input);
  while (counter < user_input) {
    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++;
    }
    counter++;
  }
  printf("once=%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    0xe68(%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    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xda1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xd93(%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    0xeb0(%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    0xe12(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movdqa 0x10(%rsp),%xmm0
movd   %xmm0,%esi
lea    0xe01(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
pshufd $0x55,0x10(%rsp),%xmm0
movd   %xmm0,%esi
lea    0xdf1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
pshufd $0xee,0x10(%rsp),%xmm0
movd   %xmm0,%esi
lea    0xde3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
pshufd $0xff,0x10(%rsp),%xmm0
movd   %xmm0,%esi
lea    0xdd4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdd0(%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 = [29 x i8] c"Roll the die how many times?\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"once=%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
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 ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %15
15: ; preds = %58, %0
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %61
19: ; preds = %15
%20 = call i32 (...) @rand()
%21 = srem i32 %20, 6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
%23 = load i32, i32* %4
%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 %28
28: ; preds = %25, %19
%29 = load i32, i32* %4
%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 %34
34: ; preds = %31, %28
%35 = load i32, i32* %4
%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 %40
40: ; preds = %37, %34
%41 = load i32, i32* %4
%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 %46
46: ; preds = %43, %40
%47 = load i32, i32* %4
%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 %52
52: ; preds = %49, %46
%53 = load i32, i32* %4
%54 = icmp eq i32 %53, 6
br i1 %54, label %55, label %58
55: ; preds = %52
%56 = load i32, i32* %10
%57 = add nsw i32 %56, 1
store i32 %57, i32* %10
br label %58
58: ; preds = %55, %52
%59 = load i32, i32* %3
%60 = add nsw i32 %59, 1
store i32 %60, i32* %3
br label %15
61: ; preds = %15
%62 = load i32, i32* %5
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %62)
%64 = load i32, i32* %6
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %64)
%66 = load i32, i32* %7
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %66)
%68 = load i32, i32* %8
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %68)
%70 = load i32, i32* %9
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %70)
%72 = load i32, i32* %10
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %72)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Roll the die how many times?\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"once=%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 ([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 %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
}