#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 random();
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, roll, NUM = 17;
  int counts[13];
  for (i = 0; i < 13; i++)
    counts[i] = 0;
  printf("Please enter the number of times you'd like to throw 2 dice\n");
  scanf("%d", &NUM);
  for (i = 0; i < NUM; i++) {
    roll = (random() % 6) + (random() % 6) + 2;
    counts[roll]++;
  }
  for (i = 2; i < 13; i++)
    printf("%d throws yielded %d rolls of %d\n", NUM, counts[i], i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x11,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xd,-0x8(%rbp)
jge    1171 <main+0x41>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x50(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114d <main+0x1d>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11eb <main+0xbb>
mov    $0x0,%al
call   1040 <random@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    %edx,-0x54(%rbp)
mov    $0x0,%al
call   1040 <random@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    -0x54(%rbp),%eax
add    %edx,%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1196 <main+0x66>
movl   $0x2,-0x8(%rbp)
cmpl   $0xd,-0x8(%rbp)
jge    1226 <main+0xf6>
mov    -0x10(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edx
mov    -0x8(%rbp),%ecx
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11f2 <main+0xc2>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movl   $0x11,0x4(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x40(%rsp)
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7d(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    122e <main+0xee>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <random@plt>
movslq %eax,%rbp
imul   $0x2aaaaaab,%rbp,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%ebp
xor    %eax,%eax
call   1050 <random@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
add    %ebp,%eax
add    $0x2,%eax
cltq
addl   $0x1,0x10(%rsp,%rax,4)
add    $0x1,%ebx
mov    0x4(%rsp),%esi
cmp    %esi,%ebx
jl     11a0 <main+0x60>
mov    0x18(%rsp),%edx
mov    0x1c(%rsp),%r15d
mov    0x20(%rsp),%r14d
mov    0x24(%rsp),%ebp
mov    0x28(%rsp),%r13d
mov    0x2c(%rsp),%r12d
mov    0x30(%rsp),%eax
mov    %eax,0x8(%rsp)
mov    0x34(%rsp),%eax
mov    %eax,0xc(%rsp)
jmp    124e <main+0x10e>
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
xor    %r12d,%r12d
xor    %r13d,%r13d
xor    %ebp,%ebp
xor    %r14d,%r14d
xor    %r15d,%r15d
xor    %edx,%edx
lea    0xdae(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
mov    %r15d,%edx
mov    $0x3,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
mov    %r14d,%edx
mov    $0x4,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
mov    %ebp,%edx
mov    $0x5,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
mov    %r13d,%edx
mov    $0x6,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
mov    %r12d,%edx
mov    $0x7,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
mov    0x8(%rsp),%edx
mov    $0x8,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
mov    0xc(%rsp),%edx
mov    $0x9,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    0x38(%rsp),%edx
mov    %rbx,%rdi
mov    $0xa,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    0x3c(%rsp),%edx
mov    %rbx,%rdi
mov    $0xb,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    0x40(%rsp),%edx
mov    %rbx,%rdi
mov    $0xc,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [61 x i8] c"Please enter the number of times you'd like to throw 2 dice\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [34 x i8] c"%d throws yielded %d rolls of %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [13 x i32]
store i32 0, i32* %1
store i32 17, i32* %4
store i32 0, i32* %2
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 13
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [13 x i32], [13 x i32]* %5, i64 0, i64 %11
store i32 0, i32* %12
br label %13
13: ; preds = %9
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %6
16: ; preds = %6
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
store i32 0, i32* %2
br label %19
19: ; preds = %35, %16
%20 = load i32, i32* %2
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %38
23: ; preds = %19
%24 = call i32 (...) @random()
%25 = srem i32 %24, 6
%26 = call i32 (...) @random()
%27 = srem i32 %26, 6
%28 = add nsw i32 %25, %27
%29 = add nsw i32 %28, 2
store i32 %29, i32* %3
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [13 x i32], [13 x i32]* %5, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = add nsw i32 %33, 1
store i32 %34, i32* %32
br label %35
35: ; preds = %23
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %19
38: ; preds = %19
store i32 2, i32* %2
br label %39
39: ; preds = %50, %38
%40 = load i32, i32* %2
%41 = icmp slt i32 %40, 13
br i1 %41, label %42, label %53
42: ; preds = %39
%43 = load i32, i32* %4
%44 = load i32, i32* %2
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [13 x i32], [13 x i32]* %5, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = load i32, i32* %2
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %43, i32 %47, i32 %48)
br label %50
50: ; preds = %42
%51 = load i32, i32* %2
%52 = add nsw i32 %51, 1
store i32 %52, i32* %2
br label %39
53: ; preds = %39
%54 = load i32, i32* %1
ret i32 %54
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [34 x i8] c"%d throws yielded %d rolls of %d\0A\00"
@str = [60 x i8] c"Please enter the number of times you'd like to throw 2 dice\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x i32]
%3 = bitcast [13 x i32]* %2 to i8*
%4 = bitcast i32* %1 to i8*
store i32 17, i32* %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 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 %63, label %26
9: ; preds = %63
%10 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 2
%11 = load i32, i32* %10
%12 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 3
%13 = load i32, i32* %12
%14 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 4
%15 = load i32, i32* %14
%16 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 5
%17 = load i32, i32* %16
%18 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 6
%19 = load i32, i32* %18
%20 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 7
%21 = load i32, i32* %20
%22 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 8
%23 = load i32, i32* %22
%24 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 9
%25 = load i32, i32* %24
br label %26
26: ; preds = %9, %0
%27 = phi i32 [ %25, %9 ], [ 0, %0 ]
%28 = phi i32 [ %23, %9 ], [ 0, %0 ]
%29 = phi i32 [ %21, %9 ], [ 0, %0 ]
%30 = phi i32 [ %19, %9 ], [ 0, %0 ]
%31 = phi i32 [ %17, %9 ], [ 0, %0 ]
%32 = phi i32 [ %15, %9 ], [ 0, %0 ]
%33 = phi i32 [ %13, %9 ], [ 0, %0 ]
%34 = phi i32 [ %11, %9 ], [ 0, %0 ]
%35 = phi i32 [ %76, %9 ], [ %7, %0 ]
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %35, i32 %34, i32 2)
%37 = load i32, i32* %1
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %37, i32 %33, i32 3)
%39 = load i32, i32* %1
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %39, i32 %32, i32 4)
%41 = load i32, i32* %1
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %41, i32 %31, i32 5)
%43 = load i32, i32* %1
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %43, i32 %30, i32 6)
%45 = load i32, i32* %1
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %45, i32 %29, i32 7)
%47 = load i32, i32* %1
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %47, i32 %28, i32 8)
%49 = load i32, i32* %1
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %49, i32 %27, i32 9)
%51 = load i32, i32* %1
%52 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 10
%53 = load i32, i32* %52
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %51, i32 %53, i32 10)
%55 = load i32, i32* %1
%56 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 11
%57 = load i32, i32* %56
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %55, i32 %57, i32 11)
%59 = load i32, i32* %1
%60 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 12
%61 = load i32, i32* %60
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %59, i32 %61, i32 12)
ret i32 0
63: ; preds = %0, %63
%64 = phi i32 [ %75, %63 ], [ 0, %0 ]
%65 = call i32 (...) @random()
%66 = srem i32 %65, 6
%67 = call i32 (...) @random()
%68 = srem i32 %67, 6
%69 = add nsw i32 %66, 2
%70 = add nsw i32 %69, %68
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 %71
%73 = load i32, i32* %72
%74 = add nsw i32 %73, 1
store i32 %74, i32* %72
%75 = add nuw nsw i32 %64, 1
%76 = load i32, i32* %1
%77 = icmp slt i32 %75, %76
br i1 %77, label %63, label %9
}