#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 main(void) {
  int frequency1 = 0;
  int frequency2 = 0;
  int frequency3 = 0;
  int frequency4 = 0;
  int frequency5 = 0;
  int frequency6 = 0;
  int roll;
  int face;
  for (roll = 1; roll <= 6000; roll++) {
    face = 1 + rand() % 6;
    switch (face) {
    case 1:
      ++frequency1;
      break;
    case 2:
      ++frequency2;
      break;
    case 3:
      ++frequency3;
      break;
    case 4:
      ++frequency4;
      break;
    case 5:
      ++frequency5;
      break;
    case 6:
      ++frequency6;
      break;
    }
  }
  printf("%s%13s\n", "Face", "Frequency");
  printf("   1%13d\n", frequency1);
  printf("   2%13d\n", frequency2);
  printf("   3%13d\n", frequency3);
  printf("   4%13d\n", frequency4);
  printf("   5%13d\n", frequency5);
  printf("   6%13d\n", frequency6);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
cmpl   $0x1770,-0x20(%rbp)
jg     122c <main+0x10c>
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%ecx
movslq %ecx,%rax
imul   $0x2aaaaaab,%rax,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0x20,%rdx
add    %eax,%edx
add    %edx,%edx
mov    %edx,%eax
lea    (%rax,%rax,2),%edx
mov    %ecx,%eax
neg    %edx
mov    %edx,%ecx
lea    0x1(%rax,%rcx,1),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x5,%eax
ja     1219 <main+0xf9>
mov    -0x30(%rbp),%rax
lea    0xe3f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1219 <main+0xf9>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1219 <main+0xf9>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1219 <main+0xf9>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1219 <main+0xf9>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1219 <main+0xf9>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    121e <main+0xfe>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1160 <main+0x40>
lea    0xde5(%rip),%rdi
lea    0xde6(%rip),%rsi
lea    0xde4(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xdba(%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
mov    $0x1770,%r14d
lea    0xec8(%rip),%r15
xor    %ebp,%ebp
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
xor    %r12d,%r12d
xor    %r13d,%r13d
xor    %ebx,%ebx
jmp    1166 <main+0x46>
addl   $0x1,0x4(%rsp)
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%r14d
je     11b4 <main+0x94>
xor    %eax,%eax
call   1040 <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     1160 <main+0x40>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
add    $0x1,%ebp
jmp    1160 <main+0x40>
add    $0x1,%ebx
jmp    1160 <main+0x40>
add    $0x1,%r13d
jmp    1160 <main+0x40>
add    $0x1,%r12d
jmp    1160 <main+0x40>
addl   $0x1,(%rsp)
jmp    1160 <main+0x40>
lea    0xe5d(%rip),%rdi
lea    0xe5e(%rip),%rsi
lea    0xe5c(%rip),%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe58(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe52(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe4c(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe45(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe3e(%rip),%rdi
mov    (%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe37(%rip),%rdi
mov    0x4(%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 = [8 x i8] c"%s%13s\0A\00"
@.str.1 = [5 x i8] c"Face\00"
@.str.2 = [10 x i8] c"Frequency\00"
@.str.3 = [10 x i8] c" 1%13d\0A\00"
@.str.4 = [10 x i8] c" 2%13d\0A\00"
@.str.5 = [10 x i8] c" 3%13d\0A\00"
@.str.6 = [10 x i8] c" 4%13d\0A\00"
@.str.7 = [10 x i8] c" 5%13d\0A\00"
@.str.8 = [10 x i8] c" 6%13d\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* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 1, i32* %8
br label %10
10: ; preds = %37, %0
%11 = load i32, i32* %8
%12 = icmp sle i32 %11, 6000
br i1 %12, label %13, label %40
13: ; preds = %10
%14 = call i32 (...) @rand()
%15 = srem i32 %14, 6
%16 = add nsw i32 1, %15
store i32 %16, i32* %9
%17 = load i32, i32* %9
switch i32 %17, label %36 [
i32 1, label %18
i32 2, label %21
i32 3, label %24
i32 4, label %27
i32 5, label %30
i32 6, label %33
]
18: ; preds = %13
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %36
21: ; preds = %13
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %36
24: ; preds = %13
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %36
27: ; preds = %13
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %36
30: ; preds = %13
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %36
33: ; preds = %13
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %36
36: ; preds = %13, %33, %30, %27, %24, %21, %18
br label %37
37: ; preds = %36
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
store i32 %39, i32* %8
br label %10
40: ; preds = %10
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%42 = load i32, i32* %2
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %3
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %4
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %5
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %6
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %50)
%52 = load i32, i32* %7
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 %52)
ret i32 0
}

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