#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, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  int face;
  int roll;
  int frequency[7] = {0};
  srand(time(NULL));
  for (roll = 0; roll < 6000; roll++) {
    face = 1 + rand() % 6;
    frequency[face] = frequency[face] + 1;
  }
  for (face = 1; face <= 6; face++) {
    printf("%7d%7d\n", face, frequency[face]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x1c,%edx
call   1040 <memset@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x1770,-0xc(%rbp)
jge    11c9 <main+0x79>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
add    $0x1,%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1186 <main+0x36>
movl   $0x1,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jg     11ff <main+0xaf>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe14(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d0 <main+0x80>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0xc(%rsp)
movaps %xmm0,(%rsp)
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x1770,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1060 <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
cltq
addl   $0x1,0x4(%rsp,%rax,4)
add    $0xffffffff,%ebx
jne    1170 <main+0x30>
mov    0x4(%rsp),%edx
lea    0xe55(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%7d%7d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [7 x i32]
store i32 0, i32* %1
%5 = bitcast [7 x i32]* %4 to i8*
%6 = call i32 @time(i32* null)
%7 = call i32 @srand(i32 %6)
store i32 0, i32* %3
br label %8
8: ; preds = %23, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 6000
br i1 %10, label %11, label %26
11: ; preds = %8
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 6
%14 = add nsw i32 1, %13
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = add nsw i32 %18, 1
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 %21
store i32 %19, i32* %22
br label %23
23: ; preds = %11
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %8
26: ; preds = %8
store i32 1, i32* %2
br label %27
27: ; preds = %37, %26
%28 = load i32, i32* %2
%29 = icmp sle i32 %28, 6
br i1 %29, label %30, label %40
30: ; preds = %27
%31 = load i32, i32* %2
%32 = load i32, i32* %2
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %31, i32 %35)
br label %37
37: ; preds = %30
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %2
br label %27
40: ; preds = %27
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%7d%7d\0A\00"
define i32 @main() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
br label %5
5: ; preds = %0, %5
%6 = phi i32 [ 0, %0 ], [ %14, %5 ]
%7 = tail call i32 (...) @rand()
%8 = srem i32 %7, 6
%9 = add nsw i32 %8, 1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 1
store i32 %13, i32* %11
%14 = add nuw nsw i32 %6, 1
%15 = icmp eq i32 %14, 6000
br i1 %15, label %16, label %5
16: ; preds = %5
%17 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 1
%18 = load i32, i32* %17
%19 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 1, i32 %18)
%20 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 2
%21 = load i32, i32* %20
%22 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 2, i32 %21)
%23 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 3
%24 = load i32, i32* %23
%25 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 3, i32 %24)
%26 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 4
%27 = load i32, i32* %26
%28 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 4, i32 %27)
%29 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 5
%30 = load i32, i32* %29
%31 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 5, i32 %30)
%32 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 6
%33 = load i32, i32* %32
%34 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 6, i32 %33)
ret i32 0
}