#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 */
typedef int /*<<< orphan*/ count;

/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ memset(double *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ scanf(char *, unsigned long *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
main() {
  srand(time(NULL));
  unsigned short d1, d2, d3, roll;
  unsigned long i, MAX;
  double count[19];
  memset(count, '0', sizeof(count));
  printf("Input desired accuracy (1-5 <--> (low-high)): ");
  scanf("%d", &MAX);
  getchar();
  switch (MAX) {
  case 1:
    MAX = 50;
    break;
  case 2:
    MAX = 500;
    break;
  case 3:
    MAX = 10000;
    break;
  case 4:
    MAX = 500000;
    break;
  case 5:
    MAX = 50000000;
    break;
  default:
    MAX = 50;
    printf("Invalid input. Set to low.\n");
  }
  printf("\nPercentage dice roll chance (three dice, %ld rolls):\n\n", MAX);
  for (i = 0; i < MAX; i++) {
    d1 = (rand() % 6) + 1;
    d2 = (rand() % 6) + 1;
    d3 = (rand() % 6) + 1;
    roll = d1 + d2 + d3;
    switch (roll) {
    case 3:
      count[3] = count[3] + 1;
      break;
    case 4:
      count[4] = count[4] + 1;
      break;
    case 5:
      count[5] = count[5] + 1;
      break;
    case 6:
      count[6] = count[6] + 1;
      break;
    case 7:
      count[7] = count[7] + 1;
      break;
    case 8:
      count[8] = count[8] + 1;
      break;
    case 9:
      count[9] = count[9] + 1;
      break;
    case 10:
      count[10] = count[10] + 1;
      break;
    case 11:
      count[11] = count[11] + 1;
      break;
    case 12:
      count[12] = count[12] + 1;
      break;
    case 13:
      count[13] = count[13] + 1;
      break;
    case 14:
      count[14] = count[14] + 1;
      break;
    case 15:
      count[15] = count[15] + 1;
      break;
    case 16:
      count[16] = count[16] + 1;
      break;
    case 17:
      count[17] = count[17] + 1;
      break;
    case 18:
      count[18] = count[18] + 1;
      break;
    default:
      printf("Roll Error.");
      getchar();
      break;
    }
  }
  for (i = 3; i < 19; i++) {
    printf("Roll %hd:   %.2lf%%\n", i, ((count[i] / MAX) * 100));
  }
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,-0xd0(%rbp)
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    -0xc0(%rbp),%rdi
mov    $0x30,%esi
mov    $0x98,%edx
call   1040 <memset@plt>
mov    -0xd0(%rbp),%eax
lea    0xec9(%rip),%rdi
mov    %al,-0xc9(%rbp)
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0xc9(%rbp),%al
call   1060 <getchar@plt>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0xc8(%rbp)
sub    $0x4,%rax
ja     1252 <main+0xe2>
mov    -0xc8(%rbp),%rax
lea    0xe28(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movq   $0x32,-0x20(%rbp)
jmp    1268 <main+0xf8>
movq   $0x1f4,-0x20(%rbp)
jmp    1268 <main+0xf8>
movq   $0x2710,-0x20(%rbp)
jmp    1268 <main+0xf8>
movq   $0x7a120,-0x20(%rbp)
jmp    1268 <main+0xf8>
movq   $0x2faf080,-0x20(%rbp)
02
jmp    1268 <main+0xf8>
movq   $0x32,-0x20(%rbp)
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    153a <main+0x3ca>
xor    %eax,%eax
mov    %al,-0xd9(%rbp)
call   1090 <rand@plt>
mov    %eax,%edx
mov    -0xd9(%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    %cx,-0x6(%rbp)
call   1090 <rand@plt>
mov    %eax,%edx
mov    -0xd9(%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    %cx,-0x8(%rbp)
call   1090 <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    %ax,-0xa(%rbp)
movzwl -0x6(%rbp),%eax
movzwl -0x8(%rbp),%ecx
add    %ecx,%eax
movzwl -0xa(%rbp),%ecx
add    %ecx,%eax
mov    %ax,-0xc(%rbp)
movzwl -0xc(%rbp),%eax
add    $0xfffffffd,%eax
mov    %eax,%ecx
mov    %rcx,-0xd8(%rbp)
sub    $0xf,%eax
ja     150f <main+0x39f>
mov    -0xd8(%rbp),%rax
lea    0xccc(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  0xc7f(%rip),%xmm0
addsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
jmp    1524 <main+0x3b4>
movsd  0xc62(%rip),%xmm0
addsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    1524 <main+0x3b4>
movsd  0xc45(%rip),%xmm0
addsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
jmp    1524 <main+0x3b4>
movsd  0xc28(%rip),%xmm0
addsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
jmp    1524 <main+0x3b4>
movsd  0xc0b(%rip),%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
jmp    1524 <main+0x3b4>
movsd  0xbee(%rip),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    1524 <main+0x3b4>
movsd  0xbd7(%rip),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    1524 <main+0x3b4>
movsd  0xbc0(%rip),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    1524 <main+0x3b4>
movsd  0xba9(%rip),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    1524 <main+0x3b4>
movsd  0xb92(%rip),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    1524 <main+0x3b4>
movsd  0xb7b(%rip),%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    1524 <main+0x3b4>
movsd  0xb64(%rip),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1524 <main+0x3b4>
movsd  0xb4d(%rip),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1524 <main+0x3b4>
movsd  0xb36(%rip),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1524 <main+0x3b4>
movsd  0xb1f(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1524 <main+0x3b4>
movsd  0xb08(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1524 <main+0x3b4>
lea    0xbf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
jmp    1529 <main+0x3b9>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1282 <main+0x112>
movq   $0x3,-0x18(%rbp)
cmpq   $0x13,-0x18(%rbp)
jae    15b0 <main+0x440>
mov    -0x18(%rbp),%rsi
movsd  -0xc0(%rbp,%rsi,8),%xmm0
ff ff
movaps 0xaaf(%rip),%xmm2
movq   -0x20(%rbp),%xmm1
punpckldq %xmm2,%xmm1
movapd 0xaae(%rip),%xmm2
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  0xa73(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xb7e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1542 <main+0x3d2>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb0,%rsp
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
lea    0x10(%rsp),%rdi
mov    $0x30,%esi
mov    $0x98,%edx
call   1050 <memset@plt>
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeec(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1090 <scanf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    0x8(%rsp),%rax
add    $0xffffffffffffffff,%rax
cmp    $0x4,%rax
ja     1207 <main+0x87>
lea    0xe42(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movq   $0x32,0x8(%rsp)
mov    $0x32,%esi
jmp    1261 <main+0xe1>
movq   $0x32,0x8(%rsp)
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%rsi
jmp    1261 <main+0xe1>
movq   $0x1f4,0x8(%rsp)
mov    $0x1f4,%esi
jmp    1261 <main+0xe1>
movq   $0x2710,0x8(%rsp)
mov    $0x2710,%esi
jmp    1261 <main+0xe1>
movq   $0x7a120,0x8(%rsp)
mov    $0x7a120,%esi
jmp    1261 <main+0xe1>
movq   $0x2faf080,0x8(%rsp)
fa 02
mov    $0x2faf080,%esi
lea    0xe4e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpq   $0x0,0x8(%rsp)
je     150d <main+0x38d>
lea    0xe6c(%rip),%r14
lea    0xdbb(%rip),%r15
xor    %r12d,%r12d
jmp    12b2 <main+0x132>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
nop
add    $0x1,%r12
mov    0x8(%rsp),%rax
cmp    %rax,%r12
jae    14ea <main+0x36a>
xor    %eax,%eax
call   10a0 <rand@plt>
movslq %eax,%r13
imul   $0x2aaaaaab,%r13,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%r13d
xor    %eax,%eax
call   10a0 <rand@plt>
movslq %eax,%rbx
imul   $0x2aaaaaab,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%ebx
add    %r13d,%ebx
xor    %eax,%eax
call   10a0 <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    %ebx,%eax
cmp    $0xf,%ax
ja     128e <main+0x10e>
movzwl %ax,%eax
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
movsd  0x28(%rsp),%xmm0
addsd  0xcb6(%rip),%xmm0
movsd  %xmm0,0x28(%rsp)
jmp    12a0 <main+0x120>
movsd  0x30(%rsp),%xmm0
addsd  0xc9d(%rip),%xmm0
movsd  %xmm0,0x30(%rsp)
jmp    12a0 <main+0x120>
movsd  0x38(%rsp),%xmm0
addsd  0xc84(%rip),%xmm0
movsd  %xmm0,0x38(%rsp)
jmp    12a0 <main+0x120>
movsd  0x40(%rsp),%xmm0
addsd  0xc6b(%rip),%xmm0
movsd  %xmm0,0x40(%rsp)
jmp    12a0 <main+0x120>
movsd  0x48(%rsp),%xmm0
addsd  0xc52(%rip),%xmm0
movsd  %xmm0,0x48(%rsp)
jmp    12a0 <main+0x120>
movsd  0x50(%rsp),%xmm0
addsd  0xc39(%rip),%xmm0
movsd  %xmm0,0x50(%rsp)
jmp    12a0 <main+0x120>
movsd  0x58(%rsp),%xmm0
addsd  0xc20(%rip),%xmm0
movsd  %xmm0,0x58(%rsp)
jmp    12a0 <main+0x120>
movsd  0x60(%rsp),%xmm0
addsd  0xc07(%rip),%xmm0
movsd  %xmm0,0x60(%rsp)
jmp    12a0 <main+0x120>
movsd  0x68(%rsp),%xmm0
addsd  0xbee(%rip),%xmm0
movsd  %xmm0,0x68(%rsp)
jmp    12a0 <main+0x120>
movsd  0x70(%rsp),%xmm0
addsd  0xbd5(%rip),%xmm0
movsd  %xmm0,0x70(%rsp)
jmp    12a0 <main+0x120>
movsd  0x78(%rsp),%xmm0
addsd  0xbbc(%rip),%xmm0
movsd  %xmm0,0x78(%rsp)
jmp    12a0 <main+0x120>
movsd  0x80(%rsp),%xmm0
addsd  0xba0(%rip),%xmm0
movsd  %xmm0,0x80(%rsp)
jmp    12a0 <main+0x120>
movsd  0x88(%rsp),%xmm0
addsd  0xb81(%rip),%xmm0
movsd  %xmm0,0x88(%rsp)
jmp    12a0 <main+0x120>
movsd  0x90(%rsp),%xmm0
addsd  0xb62(%rip),%xmm0
movsd  %xmm0,0x90(%rsp)
jmp    12a0 <main+0x120>
movsd  0x98(%rsp),%xmm0
addsd  0xb43(%rip),%xmm0
movsd  %xmm0,0x98(%rsp)
jmp    12a0 <main+0x120>
movsd  0xa0(%rsp),%xmm0
addsd  0xb24(%rip),%xmm0
movsd  %xmm0,0xa0(%rsp)
jmp    12a0 <main+0x120>
movq   %rax,%xmm0
punpckldq 0xb19(%rip),%xmm0
subpd  0xb21(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
jmp    1511 <main+0x391>
xorpd  %xmm1,%xmm1
movsd  0x28(%rsp),%xmm0
divsd  %xmm1,%xmm0
mulsd  0xae5(%rip),%xmm0
lea    0xbd0(%rip),%r14
mov    $0x3,%esi
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x4,%ebx
xchg   %ax,%ax
movsd  0x10(%rsp,%rbx,8),%xmm0
movsd  0x8(%rsp),%xmm1
unpcklps 0xabd(%rip),%xmm1
subpd  0xac5(%rip),%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
mulsd  0xa95(%rip),%xmm0
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x13,%rbx
jne    1540 <main+0x3c0>
xor    %eax,%eax
call   1070 <getchar@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Input desired accuracy (1-5 <--> (low-high)): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"Invalid input. Set to low.\0A\00"
@.str.3 = [56 x i8] c"\0APercentage dice roll chance (three dice, %ld rolls):\0A\0A\00"
@.str.4 = [12 x i8] c"Roll Error.\00"
@.str.5 = [21 x i8] c"Roll %hd: %.2lf%%\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca i16
%4 = alloca i16
%5 = alloca i16
%6 = alloca i64
%7 = alloca i64
%8 = alloca [19 x double]
store i32 0, i32* %1
%9 = call i32 @time(i32* null)
%10 = call i32 @srand(i32 %9)
%11 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 0
%12 = call i32 @memset(double* %11, i32 48, i32 152)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64* %7)
%15 = call i32 (...) @getchar()
%16 = load i64, i64* %7
switch i64 %16, label %22 [
i64 1, label %17
i64 2, label %18
i64 3, label %19
i64 4, label %20
i64 5, label %21
]
17: ; preds = %0
store i64 50, i64* %7
br label %24
18: ; preds = %0
store i64 500, i64* %7
br label %24
19: ; preds = %0
store i64 10000, i64* %7
br label %24
20: ; preds = %0
store i64 500000, i64* %7
br label %24
21: ; preds = %0
store i64 50000000, i64* %7
br label %24
22: ; preds = %0
store i64 50, i64* %7
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %22, %21, %20, %19, %18, %17
%25 = load i64, i64* %7
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0), i64 %25)
store i64 0, i64* %6
br label %27
27: ; preds = %139, %24
%28 = load i64, i64* %6
%29 = load i64, i64* %7
%30 = icmp ult i64 %28, %29
br i1 %30, label %31, label %142
31: ; preds = %27
%32 = call i32 (...) @rand()
%33 = srem i32 %32, 6
%34 = add nsw i32 %33, 1
%35 = trunc i32 %34 to i16
store i16 %35, i16* %2
%36 = call i32 (...) @rand()
%37 = srem i32 %36, 6
%38 = add nsw i32 %37, 1
%39 = trunc i32 %38 to i16
store i16 %39, i16* %3
%40 = call i32 (...) @rand()
%41 = srem i32 %40, 6
%42 = add nsw i32 %41, 1
%43 = trunc i32 %42 to i16
store i16 %43, i16* %4
%44 = load i16, i16* %2
%45 = zext i16 %44 to i32
%46 = load i16, i16* %3
%47 = zext i16 %46 to i32
%48 = add nsw i32 %45, %47
%49 = load i16, i16* %4
%50 = zext i16 %49 to i32
%51 = add nsw i32 %48, %50
%52 = trunc i32 %51 to i16
store i16 %52, i16* %5
%53 = load i16, i16* %5
%54 = zext i16 %53 to i32
switch i32 %54, label %135 [
i32 3, label %55
i32 4, label %60
i32 5, label %65
i32 6, label %70
i32 7, label %75
i32 8, label %80
i32 9, label %85
i32 10, label %90
i32 11, label %95
i32 12, label %100
i32 13, label %105
i32 14, label %110
i32 15, label %115
i32 16, label %120
i32 17, label %125
i32 18, label %130
]
55: ; preds = %31
%56 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 3
%57 = load double, double* %56
%58 = fadd double %57, 1.000000e+00
%59 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 3
store double %58, double* %59
br label %138
60: ; preds = %31
%61 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 4
%62 = load double, double* %61
%63 = fadd double %62, 1.000000e+00
%64 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 4
store double %63, double* %64
br label %138
65: ; preds = %31
%66 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 5
%67 = load double, double* %66
%68 = fadd double %67, 1.000000e+00
%69 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 5
store double %68, double* %69
br label %138
70: ; preds = %31
%71 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 6
%72 = load double, double* %71
%73 = fadd double %72, 1.000000e+00
%74 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 6
store double %73, double* %74
br label %138
75: ; preds = %31
%76 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 7
%77 = load double, double* %76
%78 = fadd double %77, 1.000000e+00
%79 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 7
store double %78, double* %79
br label %138
80: ; preds = %31
%81 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 8
%82 = load double, double* %81
%83 = fadd double %82, 1.000000e+00
%84 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 8
store double %83, double* %84
br label %138
85: ; preds = %31
%86 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 9
%87 = load double, double* %86
%88 = fadd double %87, 1.000000e+00
%89 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 9
store double %88, double* %89
br label %138
90: ; preds = %31
%91 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 10
%92 = load double, double* %91
%93 = fadd double %92, 1.000000e+00
%94 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 10
store double %93, double* %94
br label %138
95: ; preds = %31
%96 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 11
%97 = load double, double* %96
%98 = fadd double %97, 1.000000e+00
%99 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 11
store double %98, double* %99
br label %138
100: ; preds = %31
%101 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 12
%102 = load double, double* %101
%103 = fadd double %102, 1.000000e+00
%104 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 12
store double %103, double* %104
br label %138
105: ; preds = %31
%106 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 13
%107 = load double, double* %106
%108 = fadd double %107, 1.000000e+00
%109 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 13
store double %108, double* %109
br label %138
110: ; preds = %31
%111 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 14
%112 = load double, double* %111
%113 = fadd double %112, 1.000000e+00
%114 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 14
store double %113, double* %114
br label %138
115: ; preds = %31
%116 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 15
%117 = load double, double* %116
%118 = fadd double %117, 1.000000e+00
%119 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 15
store double %118, double* %119
br label %138
120: ; preds = %31
%121 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 16
%122 = load double, double* %121
%123 = fadd double %122, 1.000000e+00
%124 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 16
store double %123, double* %124
br label %138
125: ; preds = %31
%126 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 17
%127 = load double, double* %126
%128 = fadd double %127, 1.000000e+00
%129 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 17
store double %128, double* %129
br label %138
130: ; preds = %31
%131 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 18
%132 = load double, double* %131
%133 = fadd double %132, 1.000000e+00
%134 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 18
store double %133, double* %134
br label %138
135: ; preds = %31
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%137 = call i32 (...) @getchar()
br label %138
138: ; preds = %135, %130, %125, %120, %115, %110, %105, %100, %95, %90, %85, %80, %75, %70, %65, %60, %55
br label %139
139: ; preds = %138
%140 = load i64, i64* %6
%141 = add i64 %140, 1
store i64 %141, i64* %6
br label %27
142: ; preds = %27
store i64 3, i64* %6
br label %143
143: ; preds = %156, %142
%144 = load i64, i64* %6
%145 = icmp ult i64 %144, 19
br i1 %145, label %146, label %159
146: ; preds = %143
%147 = load i64, i64* %6
%148 = load i64, i64* %6
%149 = getelementptr inbounds [19 x double], [19 x double]* %8, i64 0, i64 %148
%150 = load double, double* %149
%151 = load i64, i64* %7
%152 = uitofp i64 %151 to double
%153 = fdiv double %150, %152
%154 = fmul double %153, 1.000000e+02
%155 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 %147, double %154)
br label %156
156: ; preds = %146
%157 = load i64, i64* %6
%158 = add i64 %157, 1
store i64 %158, i64* %6
br label %143
159: ; preds = %143
%160 = call i32 (...) @getchar()
%161 = load i32, i32* %1
ret i32 %161
}

LLVM IR (-O2):
@.str = [47 x i8] c"Input desired accuracy (1-5 <--> (low-high)): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [56 x i8] c"\0APercentage dice roll chance (three dice, %ld rolls):\0A\0A\00"
@.str.4 = [12 x i8] c"Roll Error.\00"
@.str.5 = [21 x i8] c"Roll %hd: %.2lf%%\0A\00"
@str = [27 x i8] c"Invalid input. Set to low.\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca [19 x double]
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = bitcast i64* %1 to i8*
%6 = bitcast [19 x double]* %2 to i8*
%7 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 0
%8 = call i32 @memset(double* %7, i32 48, i32 152)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%11 = call i32 (...) @getchar()
%12 = load i64, i64* %1
switch i64 %12, label %18 [
i64 1, label %13
i64 2, label %14
i64 3, label %15
i64 4, label %16
i64 5, label %17
]
13: ; preds = %0
store i64 50, i64* %1
br label %21
14: ; preds = %0
store i64 500, i64* %1
br label %21
15: ; preds = %0
store i64 10000, i64* %1
br label %21
16: ; preds = %0
store i64 500000, i64* %1
br label %21
17: ; preds = %0
store i64 50000000, i64* %1
br label %21
18: ; preds = %0
store i64 50, i64* %1
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%20 = load i64, i64* %1
br label %21
21: ; preds = %18, %17, %16, %15, %14, %13
%22 = phi i64 [ %20, %18 ], [ 50000000, %17 ], [ 500000, %16 ], [ 10000, %15 ], [ 500, %14 ], [ 50, %13 ]
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0), i64 %22)
%24 = load i64, i64* %1
%25 = icmp eq i64 %24, 0
br i1 %25, label %45, label %26
26: ; preds = %21
%27 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 18
%28 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 17
%29 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 16
%30 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 15
%31 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 14
%32 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 13
%33 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 12
%34 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 11
%35 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 10
%36 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 9
%37 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 8
%38 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 7
%39 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 6
%40 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 5
%41 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 4
%42 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 3
br label %52
43: ; preds = %114
%44 = uitofp i64 %116 to double
br label %45
45: ; preds = %43, %21
%46 = phi double [ 0.000000e+00, %21 ], [ %44, %43 ]
%47 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 3
%48 = load double, double* %47
%49 = fdiv double %48, %46
%50 = fmul double %49, 1.000000e+02
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 3, double %50)
br label %118
52: ; preds = %26, %114
%53 = phi i64 [ 0, %26 ], [ %115, %114 ]
%54 = call i32 (...) @rand()
%55 = srem i32 %54, 6
%56 = call i32 (...) @rand()
%57 = srem i32 %56, 6
%58 = call i32 (...) @rand()
%59 = srem i32 %58, 6
%60 = add nsw i32 %57, %55
%61 = add nsw i32 %60, %59
%62 = trunc i32 %61 to i16
switch i16 %62, label %111 [
i16 0, label %63
i16 1, label %66
i16 2, label %69
i16 3, label %72
i16 4, label %75
i16 5, label %78
i16 6, label %81
i16 7, label %84
i16 8, label %87
i16 9, label %90
i16 10, label %93
i16 11, label %96
i16 12, label %99
i16 13, label %102
i16 14, label %105
i16 15, label %108
]
63: ; preds = %52
%64 = load double, double* %42
%65 = fadd double %64, 1.000000e+00
store double %65, double* %42
br label %114
66: ; preds = %52
%67 = load double, double* %41
%68 = fadd double %67, 1.000000e+00
store double %68, double* %41
br label %114
69: ; preds = %52
%70 = load double, double* %40
%71 = fadd double %70, 1.000000e+00
store double %71, double* %40
br label %114
72: ; preds = %52
%73 = load double, double* %39
%74 = fadd double %73, 1.000000e+00
store double %74, double* %39
br label %114
75: ; preds = %52
%76 = load double, double* %38
%77 = fadd double %76, 1.000000e+00
store double %77, double* %38
br label %114
78: ; preds = %52
%79 = load double, double* %37
%80 = fadd double %79, 1.000000e+00
store double %80, double* %37
br label %114
81: ; preds = %52
%82 = load double, double* %36
%83 = fadd double %82, 1.000000e+00
store double %83, double* %36
br label %114
84: ; preds = %52
%85 = load double, double* %35
%86 = fadd double %85, 1.000000e+00
store double %86, double* %35
br label %114
87: ; preds = %52
%88 = load double, double* %34
%89 = fadd double %88, 1.000000e+00
store double %89, double* %34
br label %114
90: ; preds = %52
%91 = load double, double* %33
%92 = fadd double %91, 1.000000e+00
store double %92, double* %33
br label %114
93: ; preds = %52
%94 = load double, double* %32
%95 = fadd double %94, 1.000000e+00
store double %95, double* %32
br label %114
96: ; preds = %52
%97 = load double, double* %31
%98 = fadd double %97, 1.000000e+00
store double %98, double* %31
br label %114
99: ; preds = %52
%100 = load double, double* %30
%101 = fadd double %100, 1.000000e+00
store double %101, double* %30
br label %114
102: ; preds = %52
%103 = load double, double* %29
%104 = fadd double %103, 1.000000e+00
store double %104, double* %29
br label %114
105: ; preds = %52
%106 = load double, double* %28
%107 = fadd double %106, 1.000000e+00
store double %107, double* %28
br label %114
108: ; preds = %52
%109 = load double, double* %27
%110 = fadd double %109, 1.000000e+00
store double %110, double* %27
br label %114
111: ; preds = %52
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%113 = call i32 (...) @getchar()
br label %114
114: ; preds = %63, %66, %69, %72, %75, %78, %81, %84, %87, %90, %93, %96, %99, %102, %105, %108, %111
%115 = add nuw i64 %53, 1
%116 = load i64, i64* %1
%117 = icmp ult i64 %115, %116
br i1 %117, label %52, label %43
118: ; preds = %45, %118
%119 = phi i64 [ 4, %45 ], [ %127, %118 ]
%120 = load i64, i64* %1
%121 = getelementptr inbounds [19 x double], [19 x double]* %2, i64 0, i64 %119
%122 = load double, double* %121
%123 = uitofp i64 %120 to double
%124 = fdiv double %122, %123
%125 = fmul double %124, 1.000000e+02
%126 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 %119, double %125)
%127 = add nuw nsw i64 %119, 1
%128 = icmp eq i64 %127, 19
br i1 %128, label %129, label %118
129: ; preds = %118
%130 = call i32 (...) @getchar()
ret i32 0
}