#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  int trials;
  int contatoreJ;
  unsigned int outcomes[2 * 6 + 1] = {0};
  unsigned int d1;
  unsigned int d2;
  srand(time(NULL));
  printf("%s", "\nInserisci il numero di tentativi: ");
  scanf("%d", &trials);
  contatoreJ = 0;
  while (contatoreJ < trials) {
    outcomes[(d1 = (rand() % 6 + 1)) + (d2 = (rand() % 6 + 1))]++;
    contatoreJ++;
  }
  printf("probabilita'\n");
  contatoreJ = 2;
  while (contatoreJ < 2 * 6 + 1) {
    printf("giocata = %d p = %lf\n", contatoreJ,
           (double)outcomes[contatoreJ] / trials);
    contatoreJ++;
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x34,%edx
call   1040 <memset@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0xe6a(%rip),%rdi
lea    0xe66(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7c(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1214 <main+0xb4>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x4c(%rbp)
mov    %edx,-0x44(%rbp)
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    -0x4c(%rbp),%eax
add    $0x1,%edx
mov    %edx,-0x48(%rbp)
add    %edx,%eax
mov    %eax,%eax
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11bb <main+0x5b>
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0xc(%rbp)
cmpl   $0xd,-0xc(%rbp)
jge    1267 <main+0x107>
movslq -0xc(%rbp),%rax
mov    %eax,%esi
mov    -0x40(%rbp,%rax,4),%eax
cvtsi2sd %rax,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
lea    0xde6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1229 <main+0xc9>
mov    0x2d72(%rip),%rax
mov    (%rax),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x88,%rsp
xorpd  %xmm0,%xmm0
movapd %xmm0,0x70(%rsp)
movapd %xmm0,0x60(%rsp)
movapd %xmm0,0x50(%rsp)
movl   $0x0,0x80(%rsp)
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0xe60(%rip),%rdi
lea    0xe5c(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe72(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    12c2 <main+0x162>
xor    %ebx,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%r14
imul   $0x2aaaaaab,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%r14d
xor    %eax,%eax
call   1080 <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
add    %r14d,%eax
add    $0x2,%eax
addl   $0x1,0x50(%rsp,%rax,4)
add    $0x1,%ebx
cmp    0xc(%rsp),%ebx
jl     11d0 <main+0x70>
mov    0x58(%rsp),%r8d
mov    0x5c(%rsp),%r9d
mov    0x60(%rsp),%edx
mov    0x64(%rsp),%esi
mov    0x68(%rsp),%edi
mov    0x6c(%rsp),%ebx
mov    0x70(%rsp),%eax
mov    0x74(%rsp),%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %r8,%xmm0
movsd  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r9,%xmm0
movsd  %xmm0,0x18(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %rdx,%xmm0
movsd  %xmm0,0x20(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %rsi,%xmm0
movsd  %xmm0,0x28(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %rdi,%xmm0
movsd  %xmm0,0x30(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  %xmm0,0x38(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,0x40(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %rcx,%xmm0
movsd  %xmm0,0x48(%rsp)
jmp    1312 <main+0x1b2>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x48(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x40(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x38(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x30(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0xd27(%rip),%rdi
call   1030 <puts@plt>
cvtsi2sdl 0xc(%rsp),%xmm1
movsd  0x10(%rsp),%xmm0
divsd  %xmm1,%xmm0
lea    0xcf5(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x1,%al
call   1040 <printf@plt>
xorps  %xmm1,%xmm1
cvtsi2sdl 0xc(%rsp),%xmm1
movsd  0x18(%rsp),%xmm0
divsd  %xmm1,%xmm0
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x1,%al
call   1040 <printf@plt>
xorps  %xmm1,%xmm1
cvtsi2sdl 0xc(%rsp),%xmm1
movsd  0x20(%rsp),%xmm0
divsd  %xmm1,%xmm0
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x1,%al
call   1040 <printf@plt>
xorps  %xmm1,%xmm1
cvtsi2sdl 0xc(%rsp),%xmm1
movsd  0x28(%rsp),%xmm0
divsd  %xmm1,%xmm0
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x1,%al
call   1040 <printf@plt>
xorps  %xmm1,%xmm1
cvtsi2sdl 0xc(%rsp),%xmm1
movsd  0x30(%rsp),%xmm0
divsd  %xmm1,%xmm0
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x1,%al
call   1040 <printf@plt>
xorps  %xmm1,%xmm1
cvtsi2sdl 0xc(%rsp),%xmm1
movsd  0x38(%rsp),%xmm0
divsd  %xmm1,%xmm0
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x1,%al
call   1040 <printf@plt>
xorps  %xmm1,%xmm1
cvtsi2sdl 0xc(%rsp),%xmm1
movsd  0x40(%rsp),%xmm0
divsd  %xmm1,%xmm0
mov    %rbx,%rdi
mov    $0x8,%esi
mov    $0x1,%al
call   1040 <printf@plt>
xorps  %xmm1,%xmm1
cvtsi2sdl 0xc(%rsp),%xmm1
movsd  0x48(%rsp),%xmm0
divsd  %xmm1,%xmm0
mov    %rbx,%rdi
mov    $0x9,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    0x78(%rsp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0xc(%rsp),%xmm1
divsd  %xmm1,%xmm0
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    0x7c(%rsp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0xc(%rsp),%xmm1
divsd  %xmm1,%xmm0
mov    %rbx,%rdi
mov    $0xb,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    0x80(%rsp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0xc(%rsp),%xmm1
divsd  %xmm1,%xmm0
mov    %rbx,%rdi
mov    $0xc,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    0x2b2c(%rip),%rax
mov    (%rax),%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [36 x i8] c"\0AInserisci il numero di tentativi: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [14 x i8] c"probabilita'\0A\00"
@.str.4 = [22 x i8] c"giocata = %d p = %lf\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [13 x i32]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [13 x i32]* %4 to i8*
%8 = call i32 @time(i32* null)
%9 = call i32 @srand(i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %12
12: ; preds = %16, %0
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %30
16: ; preds = %12
%17 = call i32 (...) @rand()
%18 = srem i32 %17, 6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
%20 = call i32 (...) @rand()
%21 = srem i32 %20, 6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
%23 = add i32 %19, %22
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds [13 x i32], [13 x i32]* %4, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = add i32 %26, 1
store i32 %27, i32* %25
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %12
30: ; preds = %12
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
store i32 2, i32* %3
br label %32
32: ; preds = %35, %30
%33 = load i32, i32* %3
%34 = icmp slt i32 %33, 13
br i1 %34, label %35, label %48
35: ; preds = %32
%36 = load i32, i32* %3
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [13 x i32], [13 x i32]* %4, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = uitofp i32 %40 to double
%42 = load i32, i32* %2
%43 = sitofp i32 %42 to double
%44 = fdiv double %41, %43
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %36, double %44)
%46 = load i32, i32* %3
%47 = add nsw i32 %46, 1
store i32 %47, i32* %3
br label %32
48: ; preds = %32
%49 = load i32, i32* @EXIT_SUCCESS
ret i32 %49
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [36 x i8] c"\0AInserisci il numero di tentativi: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.4 = [22 x i8] c"giocata = %d p = %lf\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [13 x i8] c"probabilita'\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x i32]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [13 x i32]* %2 to i8*
%5 = tail call i32 @time(i32* null)
%6 = tail call i32 @srand(i32 %5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %51
11: ; preds = %0, %11
%12 = phi i32 [ %23, %11 ], [ 0, %0 ]
%13 = call i32 (...) @rand()
%14 = srem i32 %13, 6
%15 = call i32 (...) @rand()
%16 = srem i32 %15, 6
%17 = add nsw i32 %14, 2
%18 = add nsw i32 %17, %16
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = add i32 %21, 1
store i32 %22, i32* %20
%23 = add nuw nsw i32 %12, 1
%24 = load i32, i32* %1
%25 = icmp slt i32 %23, %24
br i1 %25, label %11, label %26
26: ; preds = %11
%27 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 2
%28 = load i32, i32* %27
%29 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 3
%30 = load i32, i32* %29
%31 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 4
%32 = load i32, i32* %31
%33 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 5
%34 = load i32, i32* %33
%35 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 6
%36 = load i32, i32* %35
%37 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 7
%38 = load i32, i32* %37
%39 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 8
%40 = load i32, i32* %39
%41 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 9
%42 = load i32, i32* %41
%43 = uitofp i32 %28 to double
%44 = uitofp i32 %30 to double
%45 = uitofp i32 %32 to double
%46 = uitofp i32 %34 to double
%47 = uitofp i32 %36 to double
%48 = uitofp i32 %38 to double
%49 = uitofp i32 %40 to double
%50 = uitofp i32 %42 to double
br label %51
51: ; preds = %26, %0
%52 = phi double [ %50, %26 ], [ 0.000000e+00, %0 ]
%53 = phi double [ %49, %26 ], [ 0.000000e+00, %0 ]
%54 = phi double [ %48, %26 ], [ 0.000000e+00, %0 ]
%55 = phi double [ %47, %26 ], [ 0.000000e+00, %0 ]
%56 = phi double [ %46, %26 ], [ 0.000000e+00, %0 ]
%57 = phi double [ %45, %26 ], [ 0.000000e+00, %0 ]
%58 = phi double [ %44, %26 ], [ 0.000000e+00, %0 ]
%59 = phi double [ %43, %26 ], [ 0.000000e+00, %0 ]
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%61 = load i32, i32* %1
%62 = sitofp i32 %61 to double
%63 = fdiv double %59, %62
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 2, double %63)
%65 = load i32, i32* %1
%66 = sitofp i32 %65 to double
%67 = fdiv double %58, %66
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 3, double %67)
%69 = load i32, i32* %1
%70 = sitofp i32 %69 to double
%71 = fdiv double %57, %70
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 4, double %71)
%73 = load i32, i32* %1
%74 = sitofp i32 %73 to double
%75 = fdiv double %56, %74
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 5, double %75)
%77 = load i32, i32* %1
%78 = sitofp i32 %77 to double
%79 = fdiv double %55, %78
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 6, double %79)
%81 = load i32, i32* %1
%82 = sitofp i32 %81 to double
%83 = fdiv double %54, %82
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 7, double %83)
%85 = load i32, i32* %1
%86 = sitofp i32 %85 to double
%87 = fdiv double %53, %86
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 8, double %87)
%89 = load i32, i32* %1
%90 = sitofp i32 %89 to double
%91 = fdiv double %52, %90
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 9, double %91)
%93 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 10
%94 = load i32, i32* %93
%95 = uitofp i32 %94 to double
%96 = load i32, i32* %1
%97 = sitofp i32 %96 to double
%98 = fdiv double %95, %97
%99 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 10, double %98)
%100 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 11
%101 = load i32, i32* %100
%102 = uitofp i32 %101 to double
%103 = load i32, i32* %1
%104 = sitofp i32 %103 to double
%105 = fdiv double %102, %104
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 11, double %105)
%107 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 12
%108 = load i32, i32* %107
%109 = uitofp i32 %108 to double
%110 = load i32, i32* %1
%111 = sitofp i32 %110 to double
%112 = fdiv double %109, %111
%113 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 12, double %112)
%114 = load i32, i32* @EXIT_SUCCESS
ret i32 %114
}