#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 a;
  int counter = 0;
  int flip;
  int ones = 0;
  int twos = 0;
  int threes = 0;
  int fours = 0;
  int fives = 0;
  int sixes = 0;
  srand(time(NULL));
  printf("For how many times you are going to flip a dice?\n");
  scanf("%d", &a);
  while (counter < a) {
    flip = rand() % 6 + 1;
    if (flip == 1) {
      ones++;
    } else if (flip == 2) {
      twos++;
    } else if (flip == 3) {
      threes++;
    } else if (flip == 4) {
      fours++;
    } else if (flip == 5) {
      fives++;
    } else if (flip == 6) {
      sixes++;
    }
    counter++;
  }
  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    0xe7d(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1291 <main+0x141>
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    11f7 <main+0xa7>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1283 <main+0x133>
cmpl   $0x2,-0x10(%rbp)
jne    120f <main+0xbf>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    127e <main+0x12e>
cmpl   $0x3,-0x10(%rbp)
jne    1227 <main+0xd7>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1279 <main+0x129>
cmpl   $0x4,-0x10(%rbp)
jne    123f <main+0xef>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1274 <main+0x124>
cmpl   $0x5,-0x10(%rbp)
jne    1257 <main+0x107>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    126f <main+0x11f>
cmpl   $0x6,-0x10(%rbp)
jne    126a <main+0x11a>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    126f <main+0x11f>
jmp    1274 <main+0x124>
jmp    1279 <main+0x129>
jmp    127e <main+0x12e>
jmp    1283 <main+0x133>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11be <main+0x6e>
mov    -0x14(%rbp),%esi
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xd94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xd85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xd80(%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    %r12d,%r12d
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0xedc(%rip),%rdi
call   1030 <puts@plt>
lea    0xe86(%rip),%rdi
lea    0x14(%rsp),%rsi
call   1070 <scanf@plt>
cmpl   $0x0,0x14(%rsp)
mov    $0x0,%ebp
mov    $0x0,%ebx
mov    $0x0,%r13d
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    %r13d,%r13d
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r12d,%r12d
xor    %r15d,%r15d
jmp    120b <main+0xab>
addl   $0x1,0x10(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r15d
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
cmp    $0x5,%eax
ja     1200 <main+0xa0>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
add    $0x1,%r12d
jmp    1200 <main+0xa0>
add    $0x1,%ebp
jmp    1200 <main+0xa0>
add    $0x1,%ebx
jmp    1200 <main+0xa0>
add    $0x1,%r13d
jmp    1200 <main+0xa0>
addl   $0x1,0xc(%rsp)
jmp    1200 <main+0xa0>
lea    0xdba(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdb4(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdaf(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdac(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xda7(%rip),%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xda1(%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 = [50 x i8] c"For how many times you are going to flip a dice?\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"Ones = %d\0A\00"
@.str.3 = [11 x i8] c"Twos = %d\0A\00"
@.str.4 = [13 x i8] c"Threes = %d\0A\00"
@.str.5 = [12 x i8] c"Fours = %d\0A\00"
@.str.6 = [12 x i8] c"Fives = %d\0A\00"
@.str.7 = [12 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 ([50 x i8], [50 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 = %63, %0
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%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* %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 %63
28: ; preds = %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 %62
34: ; preds = %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 %61
40: ; preds = %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 %60
46: ; preds = %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 %59
52: ; preds = %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
br label %59
59: ; preds = %58, %49
br label %60
60: ; preds = %59, %43
br label %61
61: ; preds = %60, %37
br label %62
62: ; preds = %61, %31
br label %63
63: ; preds = %62, %25
%64 = load i32, i32* %3
%65 = add nsw i32 %64, 1
store i32 %65, i32* %3
br label %15
66: ; preds = %15
%67 = load i32, i32* %5
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %67)
%69 = load i32, i32* %6
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %69)
%71 = load i32, i32* %7
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %8
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %73)
%75 = load i32, i32* %9
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %75)
%77 = load i32, i32* %10
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 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 = [11 x i8] c"Ones = %d\0A\00"
@.str.3 = [11 x i8] c"Twos = %d\0A\00"
@.str.4 = [13 x i8] c"Threes = %d\0A\00"
@.str.5 = [12 x i8] c"Fours = %d\0A\00"
@.str.6 = [12 x i8] c"Fives = %d\0A\00"
@.str.7 = [12 x i8] c"Sixes = %d\0A\00"
@str = [49 x i8] c"For how many times you are going to flip a dice?\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 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 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 [ %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 %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 %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 = %9, %21, %25, %29, %27, %23, %19
%32 = phi i32 [ %20, %19 ], [ %15, %21 ], [ %15, %23 ], [ %15, %25 ], [ %15, %27 ], [ %15, %29 ], [ %15, %9 ]
%33 = phi i32 [ %14, %19 ], [ %22, %21 ], [ %14, %23 ], [ %14, %25 ], [ %14, %27 ], [ %14, %29 ], [ %14, %9 ]
%34 = phi i32 [ %13, %19 ], [ %13, %21 ], [ %24, %23 ], [ %13, %25 ], [ %13, %27 ], [ %13, %29 ], [ %13, %9 ]
%35 = phi i32 [ %12, %19 ], [ %12, %21 ], [ %12, %23 ], [ %26, %25 ], [ %12, %27 ], [ %12, %29 ], [ %12, %9 ]
%36 = phi i32 [ %11, %19 ], [ %11, %21 ], [ %11, %23 ], [ %11, %25 ], [ %28, %27 ], [ %11, %29 ], [ %11, %9 ]
%37 = phi i32 [ %10, %19 ], [ %10, %21 ], [ %10, %23 ], [ %10, %25 ], [ %10, %27 ], [ %30, %29 ], [ %10, %9 ]
%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 ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %42)
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %43)
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %44)
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %45)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %46)
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 %47)
ret i32 0
}