#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 user;
  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);
  while (user > 0) {
    die = rand() % 6 + 1;
    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++;
    }
    user--;
  }
  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)
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    0xe6f(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jle    1288 <main+0x138>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11ee <main+0x9e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    127a <main+0x12a>
cmpl   $0x2,-0x8(%rbp)
jne    1206 <main+0xb6>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1275 <main+0x125>
cmpl   $0x3,-0x8(%rbp)
jne    121e <main+0xce>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1270 <main+0x120>
cmpl   $0x4,-0x8(%rbp)
jne    1236 <main+0xe6>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    126b <main+0x11b>
cmpl   $0x5,-0x8(%rbp)
jne    124e <main+0xfe>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1266 <main+0x116>
cmpl   $0x6,-0x8(%rbp)
jne    1261 <main+0x111>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1266 <main+0x116>
jmp    126b <main+0x11b>
jmp    1270 <main+0x120>
jmp    1275 <main+0x125>
jmp    127a <main+0x12a>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    11b7 <main+0x67>
mov    -0x10(%rbp),%esi
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xd86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xd78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xd71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xd6a(%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
push   %rax
xor    %r12d,%r12d
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
mov    $0x0,%ebp
mov    $0x0,%ebx
mov    $0x0,%r13d
mov    $0x0,%r15d
movl   $0x0,(%rsp)
jle    122e <main+0xde>
lea    0xe4a(%rip),%r14
movl   $0x0,(%rsp)
xor    %r15d,%r15d
xor    %r13d,%r13d
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r12d,%r12d
jmp    11e0 <main+0x90>
addl   $0x1,(%rsp)
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x4(%rsp)
cmp    $0x1,%eax
jle    122e <main+0xde>
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     11d0 <main+0x80>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
add    $0x1,%r12d
jmp    11d0 <main+0x80>
add    $0x1,%ebp
jmp    11d0 <main+0x80>
add    $0x1,%ebx
jmp    11d0 <main+0x80>
add    $0x1,%r13d
jmp    11d0 <main+0x80>
add    $0x1,%r15d
jmp    11d0 <main+0x80>
lea    0xe03(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdfb(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdf4(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdef(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xde8(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xde1(%rip),%rdi
mov    (%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
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"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
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
%10 = call i32 @time(i32* null)
%11 = call i32 @srand(i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %14
14: ; preds = %61, %0
%15 = load i32, i32* %3
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %64
17: ; preds = %14
%18 = call i32 (...) @rand()
%19 = srem i32 %18, 6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %26
23: ; preds = %17
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %61
26: ; preds = %17
%27 = load i32, i32* %2
%28 = icmp eq i32 %27, 2
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %60
32: ; preds = %26
%33 = load i32, i32* %2
%34 = icmp eq i32 %33, 3
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %59
38: ; preds = %32
%39 = load i32, i32* %2
%40 = icmp eq i32 %39, 4
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
br label %58
44: ; preds = %38
%45 = load i32, i32* %2
%46 = icmp eq i32 %45, 5
br i1 %46, label %47, label %50
47: ; preds = %44
%48 = load i32, i32* %8
%49 = add nsw i32 %48, 1
store i32 %49, i32* %8
br label %57
50: ; preds = %44
%51 = load i32, i32* %2
%52 = icmp eq i32 %51, 6
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = load i32, i32* %9
%55 = add nsw i32 %54, 1
store i32 %55, i32* %9
br label %56
56: ; preds = %53, %50
br label %57
57: ; preds = %56, %47
br label %58
58: ; preds = %57, %41
br label %59
59: ; preds = %58, %35
br label %60
60: ; preds = %59, %29
br label %61
61: ; preds = %60, %23
%62 = load i32, i32* %3
%63 = add nsw i32 %62, -1
store i32 %63, i32* %3
br label %14
64: ; preds = %14
%65 = load i32, i32* %4
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %65)
%67 = load i32, i32* %5
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, 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.4, i64 0, i64 0), i32 %69)
%71 = load i32, i32* %7
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %8
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %73)
%75 = load i32, i32* %9
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %75)
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"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 ([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 %40
9: ; preds = %0, %30
%10 = phi i32 [ %36, %30 ], [ 0, %0 ]
%11 = phi i32 [ %35, %30 ], [ 0, %0 ]
%12 = phi i32 [ %34, %30 ], [ 0, %0 ]
%13 = phi i32 [ %33, %30 ], [ 0, %0 ]
%14 = phi i32 [ %32, %30 ], [ 0, %0 ]
%15 = phi i32 [ %31, %30 ], [ 0, %0 ]
%16 = call i32 (...) @rand()
%17 = srem i32 %16, 6
switch i32 %17, label %30 [
i32 0, label %18
i32 1, label %20
i32 2, label %22
i32 3, label %24
i32 4, label %26
i32 5, label %28
]
18: ; preds = %9
%19 = add nsw i32 %15, 1
br label %30
20: ; preds = %9
%21 = add nsw i32 %14, 1
br label %30
22: ; preds = %9
%23 = add nsw i32 %13, 1
br label %30
24: ; preds = %9
%25 = add nsw i32 %12, 1
br label %30
26: ; preds = %9
%27 = add nsw i32 %11, 1
br label %30
28: ; preds = %9
%29 = add nsw i32 %10, 1
br label %30
30: ; preds = %9, %20, %24, %28, %26, %22, %18
%31 = phi i32 [ %19, %18 ], [ %15, %20 ], [ %15, %22 ], [ %15, %24 ], [ %15, %26 ], [ %15, %28 ], [ %15, %9 ]
%32 = phi i32 [ %14, %18 ], [ %21, %20 ], [ %14, %22 ], [ %14, %24 ], [ %14, %26 ], [ %14, %28 ], [ %14, %9 ]
%33 = phi i32 [ %13, %18 ], [ %13, %20 ], [ %23, %22 ], [ %13, %24 ], [ %13, %26 ], [ %13, %28 ], [ %13, %9 ]
%34 = phi i32 [ %12, %18 ], [ %12, %20 ], [ %12, %22 ], [ %25, %24 ], [ %12, %26 ], [ %12, %28 ], [ %12, %9 ]
%35 = phi i32 [ %11, %18 ], [ %11, %20 ], [ %11, %22 ], [ %11, %24 ], [ %27, %26 ], [ %11, %28 ], [ %11, %9 ]
%36 = phi i32 [ %10, %18 ], [ %10, %20 ], [ %10, %22 ], [ %10, %24 ], [ %10, %26 ], [ %29, %28 ], [ %10, %9 ]
%37 = load i32, i32* %1
%38 = add nsw i32 %37, -1
store i32 %38, i32* %1
%39 = icmp sgt i32 %37, 1
br i1 %39, label %9, label %40
40: ; preds = %30, %0
%41 = phi i32 [ 0, %0 ], [ %31, %30 ]
%42 = phi i32 [ 0, %0 ], [ %32, %30 ]
%43 = phi i32 [ 0, %0 ], [ %33, %30 ]
%44 = phi i32 [ 0, %0 ], [ %34, %30 ]
%45 = phi i32 [ 0, %0 ], [ %35, %30 ]
%46 = phi i32 [ 0, %0 ], [ %36, %30 ]
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %41)
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %42)
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %43)
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %44)
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %45)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %46)
ret i32 0
}