#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*/ clrscr();
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ sleep(unsigned int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void main() {
  int x, i;
  int count1 = 0, count2 = 0, count3 = 0, count4 = 0, count5 = 0, count6 = 0;
  int rolls = 100;
  clrscr();
  srand(time(NULL));
  for (i = 1; i <= rolls; i += 1) {
    x = rand() % 6 + 1;
    printf("%d ", x);
    switch (x) {
    case 1:
      count1 += 1;
      break;
    case 2:
      count2 += 1;
      break;
    case 3:
      count3 += 1;
      break;
    case 4:
      count4 += 1;
      break;
    case 5:
      count5 += 1;
      break;
    case 6:
      count6 += 1;
      break;
    }
  }
  printf("\n------\n");
  printf("1: %d\n", count1);
  printf("2: %d\n", count2);
  printf("3: %d\n", count3);
  printf("4: %d\n", count4);
  printf("5: %d\n", count5);
  printf("6: %d", count6);
  printf("\n------");
  sleep((unsigned int)3);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x64,-0x24(%rbp)
mov    $0x0,%al
call   1030 <clrscr@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     1297 <main+0x137>
xor    %eax,%eax
mov    %al,-0x31(%rbp)
call   1080 <rand@plt>
mov    %eax,%edx
mov    -0x31(%rbp),%al
movslq %edx,%rcx
imul   $0x2aaaaaab,%rcx,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rsi
add    %ecx,%esi
add    %esi,%esi
mov    %esi,%ecx
lea    (%rcx,%rcx,2),%esi
mov    %edx,%ecx
neg    %esi
mov    %esi,%edx
lea    0x1(%rcx,%rdx,1),%ecx
mov    %ecx,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe11(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x5,%eax
ja     1284 <main+0x124>
mov    -0x30(%rbp),%rax
lea    0xdd4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1284 <main+0x124>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1284 <main+0x124>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1284 <main+0x124>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1284 <main+0x124>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1284 <main+0x124>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1289 <main+0x129>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b7 <main+0x57>
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xd6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xd62(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xd4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xd44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd3c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x3,%edi
call   1070 <sleep@plt>
add    $0x40,%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    %eax,%eax
call   1030 <clrscr@plt>
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
mov    $0x64,%r15d
lea    0xe78(%rip),%r14
lea    0xe59(%rip),%r12
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    11e6 <main+0x76>
addl   $0x1,0x14(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0xffffffff,%r15d
je     124e <main+0xde>
xor    %eax,%eax
call   1090 <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,%r13d
sub    %ecx,%r13d
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x5,%r13d
ja     11e0 <main+0x70>
movslq (%r12,%r13,4),%rax
add    %r12,%rax
jmp    *%rax
add    $0x1,%ebp
jmp    11e0 <main+0x70>
add    $0x1,%ebx
jmp    11e0 <main+0x70>
addl   $0x1,0x8(%rsp)
jmp    11e0 <main+0x70>
addl   $0x1,0xc(%rsp)
jmp    11e0 <main+0x70>
addl   $0x1,0x10(%rsp)
jmp    11e0 <main+0x70>
lea    0xdf0(%rip),%r14
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xdb8(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdaf(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xda6(%rip),%rdi
mov    0x8(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd9b(%rip),%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd90(%rip),%rdi
mov    0x10(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd85(%rip),%rdi
mov    0x14(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x3,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <sleep@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [9 x i8] c"\0A------\0A\00"
@.str.2 = [7 x i8] c"1: %d\0A\00"
@.str.3 = [7 x i8] c"2: %d\0A\00"
@.str.4 = [7 x i8] c"3: %d\0A\00"
@.str.5 = [7 x i8] c"4: %d\0A\00"
@.str.6 = [7 x i8] c"5: %d\0A\00"
@.str.7 = [6 x i8] c"6: %d\00"
@.str.8 = [8 x i8] c"\0A------\00"
define void @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* %3
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 100, i32* %9
%10 = call i32 (...) @clrscr()
%11 = call i32 @time(i32* null)
%12 = call i32 @srand(i32 %11)
store i32 1, i32* %2
br label %13
13: ; preds = %43, %0
%14 = load i32, i32* %2
%15 = load i32, i32* %9
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %46
17: ; preds = %13
%18 = call i32 (...) @rand()
%19 = srem i32 %18, 6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %1
%21 = load i32, i32* %1
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %1
switch i32 %23, label %42 [
i32 1, label %24
i32 2, label %27
i32 3, label %30
i32 4, label %33
i32 5, label %36
i32 6, label %39
]
24: ; preds = %17
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %42
27: ; preds = %17
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %42
30: ; preds = %17
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %42
33: ; preds = %17
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %42
36: ; preds = %17
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %42
39: ; preds = %17
%40 = load i32, i32* %8
%41 = add nsw i32 %40, 1
store i32 %41, i32* %8
br label %42
42: ; preds = %17, %39, %36, %33, %30, %27, %24
br label %43
43: ; preds = %42
%44 = load i32, i32* %2
%45 = add nsw i32 %44, 1
store i32 %45, i32* %2
br label %13
46: ; preds = %13
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%48 = load i32, i32* %3
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %4
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %50)
%52 = load i32, i32* %5
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %52)
%54 = load i32, i32* %6
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %7
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %56)
%58 = load i32, i32* %8
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %58)
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%61 = call i32 @sleep(i32 3)
ret void
}

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