#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, roll;
  unsigned long i, MAX;
  double count[13];
  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 (two dice, %ld rolls):\n\n", MAX);
  for (i = 0; i < MAX; i++) {
    d1 = (rand() % 6) + 1;
    d2 = (rand() % 6) + 1;
    roll = d1 + d2;
    switch (roll) {
    case 2:
      count[2] = count[2] + 1;
      break;
    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;
    default:
      printf("Roll Error.");
      getchar();
      break;
    }
  }
  for (i = 2; i < 13; i++) {
    printf("Roll %hd:   %.2lf%%\n", i, ((count[i] / MAX) * 100));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,-0xa0(%rbp)
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    -0x90(%rbp),%rdi
mov    $0x30,%esi
mov    $0x68,%edx
call   1040 <memset@plt>
mov    -0xa0(%rbp),%eax
lea    0xeb5(%rip),%rdi
mov    %al,-0x99(%rbp)
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x99(%rbp),%al
call   1060 <getchar@plt>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x98(%rbp)
sub    $0x4,%rax
ja     1252 <main+0xe2>
mov    -0x98(%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    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    146a <main+0x2fa>
xor    %eax,%eax
mov    %al,-0xa9(%rbp)
call   1090 <rand@plt>
mov    %eax,%edx
mov    -0xa9(%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,%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,-0x8(%rbp)
movzwl -0x6(%rbp),%eax
movzwl -0x8(%rbp),%ecx
add    %ecx,%eax
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
add    $0xfffffffe,%eax
mov    %eax,%ecx
mov    %rcx,-0xa8(%rbp)
sub    $0xa,%eax
ja     143f <main+0x2cf>
mov    -0xa8(%rbp),%rax
lea    0xd0b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  0xcbe(%rip),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    1454 <main+0x2e4>
movsd  0xca7(%rip),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    1454 <main+0x2e4>
movsd  0xc90(%rip),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    1454 <main+0x2e4>
movsd  0xc79(%rip),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    1454 <main+0x2e4>
movsd  0xc62(%rip),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    1454 <main+0x2e4>
movsd  0xc4b(%rip),%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    1454 <main+0x2e4>
movsd  0xc34(%rip),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1454 <main+0x2e4>
movsd  0xc1d(%rip),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1454 <main+0x2e4>
movsd  0xc06(%rip),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1454 <main+0x2e4>
movsd  0xbef(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1454 <main+0x2e4>
movsd  0xbd8(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1454 <main+0x2e4>
lea    0xcae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
jmp    1459 <main+0x2e9>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1282 <main+0x112>
movq   $0x2,-0x18(%rbp)
cmpq   $0xd,-0x18(%rbp)
jae    14e0 <main+0x370>
mov    -0x18(%rbp),%rsi
movsd  -0x90(%rbp,%rsi,8),%xmm0
ff ff
movaps 0xb7f(%rip),%xmm2
movq   -0x20(%rbp),%xmm1
punpckldq %xmm2,%xmm1
movapd 0xb7e(%rip),%xmm2
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  0xb43(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xc38(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1472 <main+0x302>
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x78,%rsp
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
lea    0x10(%rsp),%rdi
mov    $0x30,%esi
mov    $0x68,%edx
call   1050 <memset@plt>
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedd(%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     1202 <main+0x82>
lea    0xe47(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movq   $0x32,0x8(%rsp)
mov    $0x32,%esi
jmp    125c <main+0xdc>
movq   $0x32,0x8(%rsp)
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%rsi
jmp    125c <main+0xdc>
movq   $0x1f4,0x8(%rsp)
mov    $0x1f4,%esi
jmp    125c <main+0xdc>
movq   $0x2710,0x8(%rsp)
mov    $0x2710,%esi
jmp    125c <main+0xdc>
movq   $0x7a120,0x8(%rsp)
mov    $0x7a120,%esi
jmp    125c <main+0xdc>
movq   $0x2faf080,0x8(%rsp)
fa 02
mov    $0x2faf080,%esi
lea    0xe3f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpq   $0x0,0x8(%rsp)
je     1446 <main+0x2c6>
lea    0xe5b(%rip),%r14
lea    0xdc0(%rip),%r15
xor    %r12d,%r12d
jmp    12b2 <main+0x132>
movsd  0x70(%rsp),%xmm0
addsd  0xd69(%rip),%xmm0
movsd  %xmm0,0x70(%rsp)
nopl   (%rax)
add    $0x1,%r12
mov    0x8(%rsp),%rax
cmp    %rax,%r12
jae    1423 <main+0x2a3>
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
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    $0xa,%ax
ja     140d <main+0x28d>
movzwl %ax,%eax
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
movsd  0x20(%rsp),%xmm0
addsd  0xcdf(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
jmp    12a0 <main+0x120>
movsd  0x28(%rsp),%xmm0
addsd  0xcc6(%rip),%xmm0
movsd  %xmm0,0x28(%rsp)
jmp    12a0 <main+0x120>
movsd  0x30(%rsp),%xmm0
addsd  0xcad(%rip),%xmm0
movsd  %xmm0,0x30(%rsp)
jmp    12a0 <main+0x120>
movsd  0x38(%rsp),%xmm0
addsd  0xc94(%rip),%xmm0
movsd  %xmm0,0x38(%rsp)
jmp    12a0 <main+0x120>
movsd  0x40(%rsp),%xmm0
addsd  0xc7b(%rip),%xmm0
movsd  %xmm0,0x40(%rsp)
jmp    12a0 <main+0x120>
movsd  0x48(%rsp),%xmm0
addsd  0xc62(%rip),%xmm0
movsd  %xmm0,0x48(%rsp)
jmp    12a0 <main+0x120>
movsd  0x50(%rsp),%xmm0
addsd  0xc49(%rip),%xmm0
movsd  %xmm0,0x50(%rsp)
jmp    12a0 <main+0x120>
movsd  0x58(%rsp),%xmm0
addsd  0xc30(%rip),%xmm0
movsd  %xmm0,0x58(%rsp)
jmp    12a0 <main+0x120>
movsd  0x60(%rsp),%xmm0
addsd  0xc17(%rip),%xmm0
movsd  %xmm0,0x60(%rsp)
jmp    12a0 <main+0x120>
movsd  0x68(%rsp),%xmm0
addsd  0xbfe(%rip),%xmm0
movsd  %xmm0,0x68(%rsp)
jmp    12a0 <main+0x120>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
jmp    12a0 <main+0x120>
movq   %rax,%xmm0
punpckldq 0xbe0(%rip),%xmm0
subpd  0xbe8(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
jmp    144a <main+0x2ca>
xorpd  %xmm1,%xmm1
movsd  0x20(%rsp),%xmm0
divsd  %xmm1,%xmm0
mulsd  0xbac(%rip),%xmm0
lea    0xc81(%rip),%rbx
mov    $0x2,%esi
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x28(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
unpcklps 0xb8b(%rip),%xmm1
subpd  0xb93(%rip),%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
mulsd  0xb63(%rip),%xmm0
mov    $0x3,%esi
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x30(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
unpcklps 0xb49(%rip),%xmm1
subpd  0xb51(%rip),%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
mulsd  0xb21(%rip),%xmm0
mov    $0x4,%esi
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x38(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
unpcklps 0xb07(%rip),%xmm1
subpd  0xb0f(%rip),%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
mulsd  0xadf(%rip),%xmm0
mov    $0x5,%esi
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x40(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
unpcklps 0xac5(%rip),%xmm1
subpd  0xacd(%rip),%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
mulsd  0xa9d(%rip),%xmm0
mov    $0x6,%esi
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x48(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
unpcklps 0xa83(%rip),%xmm1
subpd  0xa8b(%rip),%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
mulsd  0xa5b(%rip),%xmm0
mov    $0x7,%esi
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x50(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
unpcklps 0xa41(%rip),%xmm1
subpd  0xa49(%rip),%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
mulsd  0xa19(%rip),%xmm0
mov    $0x8,%esi
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x58(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
unpcklps 0x9ff(%rip),%xmm1
subpd  0xa07(%rip),%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
mulsd  0x9d7(%rip),%xmm0
mov    $0x9,%esi
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x60(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
unpcklps 0x9bd(%rip),%xmm1
subpd  0x9c5(%rip),%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
mulsd  0x995(%rip),%xmm0
mov    $0xa,%esi
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x68(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
unpcklps 0x97b(%rip),%xmm1
subpd  0x983(%rip),%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
mulsd  0x953(%rip),%xmm0
mov    $0xb,%esi
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x70(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
unpcklps 0x939(%rip),%xmm1
subpd  0x941(%rip),%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
mulsd  0x911(%rip),%xmm0
mov    $0xc,%esi
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
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 = [54 x i8] c"\0APercentage dice roll chance (two 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 i64
%6 = alloca i64
%7 = alloca [13 x double]
store i32 0, i32* %1
%8 = call i32 @time(i32* null)
%9 = call i32 @srand(i32 %8)
%10 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 0
%11 = call i32 @memset(double* %10, i32 48, i32 104)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64* %6)
%14 = call i32 (...) @getchar()
%15 = load i64, i64* %6
switch i64 %15, label %21 [
i64 1, label %16
i64 2, label %17
i64 3, label %18
i64 4, label %19
i64 5, label %20
]
16: ; preds = %0
store i64 50, i64* %6
br label %23
17: ; preds = %0
store i64 500, i64* %6
br label %23
18: ; preds = %0
store i64 10000, i64* %6
br label %23
19: ; preds = %0
store i64 500000, i64* %6
br label %23
20: ; preds = %0
store i64 50000000, i64* %6
br label %23
21: ; preds = %0
store i64 50, i64* %6
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %20, %19, %18, %17, %16
%24 = load i64, i64* %6
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i64 %24)
store i64 0, i64* %5
br label %26
26: ; preds = %106, %23
%27 = load i64, i64* %5
%28 = load i64, i64* %6
%29 = icmp ult i64 %27, %28
br i1 %29, label %30, label %109
30: ; preds = %26
%31 = call i32 (...) @rand()
%32 = srem i32 %31, 6
%33 = add nsw i32 %32, 1
%34 = trunc i32 %33 to i16
store i16 %34, i16* %2
%35 = call i32 (...) @rand()
%36 = srem i32 %35, 6
%37 = add nsw i32 %36, 1
%38 = trunc i32 %37 to i16
store i16 %38, i16* %3
%39 = load i16, i16* %2
%40 = zext i16 %39 to i32
%41 = load i16, i16* %3
%42 = zext i16 %41 to i32
%43 = add nsw i32 %40, %42
%44 = trunc i32 %43 to i16
store i16 %44, i16* %4
%45 = load i16, i16* %4
%46 = zext i16 %45 to i32
switch i32 %46, label %102 [
i32 2, label %47
i32 3, label %52
i32 4, label %57
i32 5, label %62
i32 6, label %67
i32 7, label %72
i32 8, label %77
i32 9, label %82
i32 10, label %87
i32 11, label %92
i32 12, label %97
]
47: ; preds = %30
%48 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 2
%49 = load double, double* %48
%50 = fadd double %49, 1.000000e+00
%51 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 2
store double %50, double* %51
br label %105
52: ; preds = %30
%53 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 3
%54 = load double, double* %53
%55 = fadd double %54, 1.000000e+00
%56 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 3
store double %55, double* %56
br label %105
57: ; preds = %30
%58 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 4
%59 = load double, double* %58
%60 = fadd double %59, 1.000000e+00
%61 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 4
store double %60, double* %61
br label %105
62: ; preds = %30
%63 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 5
%64 = load double, double* %63
%65 = fadd double %64, 1.000000e+00
%66 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 5
store double %65, double* %66
br label %105
67: ; preds = %30
%68 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 6
%69 = load double, double* %68
%70 = fadd double %69, 1.000000e+00
%71 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 6
store double %70, double* %71
br label %105
72: ; preds = %30
%73 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 7
%74 = load double, double* %73
%75 = fadd double %74, 1.000000e+00
%76 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 7
store double %75, double* %76
br label %105
77: ; preds = %30
%78 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 8
%79 = load double, double* %78
%80 = fadd double %79, 1.000000e+00
%81 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 8
store double %80, double* %81
br label %105
82: ; preds = %30
%83 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 9
%84 = load double, double* %83
%85 = fadd double %84, 1.000000e+00
%86 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 9
store double %85, double* %86
br label %105
87: ; preds = %30
%88 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 10
%89 = load double, double* %88
%90 = fadd double %89, 1.000000e+00
%91 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 10
store double %90, double* %91
br label %105
92: ; preds = %30
%93 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 11
%94 = load double, double* %93
%95 = fadd double %94, 1.000000e+00
%96 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 11
store double %95, double* %96
br label %105
97: ; preds = %30
%98 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 12
%99 = load double, double* %98
%100 = fadd double %99, 1.000000e+00
%101 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 12
store double %100, double* %101
br label %105
102: ; preds = %30
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%104 = call i32 (...) @getchar()
br label %105
105: ; preds = %102, %97, %92, %87, %82, %77, %72, %67, %62, %57, %52, %47
br label %106
106: ; preds = %105
%107 = load i64, i64* %5
%108 = add i64 %107, 1
store i64 %108, i64* %5
br label %26
109: ; preds = %26
store i64 2, i64* %5
br label %110
110: ; preds = %123, %109
%111 = load i64, i64* %5
%112 = icmp ult i64 %111, 13
br i1 %112, label %113, label %126
113: ; preds = %110
%114 = load i64, i64* %5
%115 = load i64, i64* %5
%116 = getelementptr inbounds [13 x double], [13 x double]* %7, i64 0, i64 %115
%117 = load double, double* %116
%118 = load i64, i64* %6
%119 = uitofp i64 %118 to double
%120 = fdiv double %117, %119
%121 = fmul double %120, 1.000000e+02
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 %114, double %121)
br label %123
123: ; preds = %113
%124 = load i64, i64* %5
%125 = add i64 %124, 1
store i64 %125, i64* %5
br label %110
126: ; preds = %110
%127 = load i32, i32* %1
ret i32 %127
}

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 = [54 x i8] c"\0APercentage dice roll chance (two 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 [13 x double]
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = bitcast i64* %1 to i8*
%6 = bitcast [13 x double]* %2 to i8*
%7 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 0
%8 = call i32 @memset(double* %7, i32 48, i32 104)
%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 ([54 x i8], [54 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 %40, label %26
26: ; preds = %21
%27 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 12
%28 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 11
%29 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 10
%30 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 9
%31 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 8
%32 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 7
%33 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 6
%34 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 5
%35 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 4
%36 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 3
%37 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 2
br label %117
38: ; preds = %161
%39 = uitofp i64 %163 to double
br label %40
40: ; preds = %38, %21
%41 = phi double [ %39, %38 ], [ 0.000000e+00, %21 ]
%42 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 2
%43 = load double, double* %42
%44 = fdiv double %43, %41
%45 = fmul double %44, 1.000000e+02
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 2, double %45)
%47 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 3
%48 = load double, double* %47
%49 = load i64, i64* %1
%50 = uitofp i64 %49 to double
%51 = fdiv double %48, %50
%52 = fmul double %51, 1.000000e+02
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 3, double %52)
%54 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 4
%55 = load double, double* %54
%56 = load i64, i64* %1
%57 = uitofp i64 %56 to double
%58 = fdiv double %55, %57
%59 = fmul double %58, 1.000000e+02
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 4, double %59)
%61 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 5
%62 = load double, double* %61
%63 = load i64, i64* %1
%64 = uitofp i64 %63 to double
%65 = fdiv double %62, %64
%66 = fmul double %65, 1.000000e+02
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 5, double %66)
%68 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 6
%69 = load double, double* %68
%70 = load i64, i64* %1
%71 = uitofp i64 %70 to double
%72 = fdiv double %69, %71
%73 = fmul double %72, 1.000000e+02
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 6, double %73)
%75 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 7
%76 = load double, double* %75
%77 = load i64, i64* %1
%78 = uitofp i64 %77 to double
%79 = fdiv double %76, %78
%80 = fmul double %79, 1.000000e+02
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 7, double %80)
%82 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 8
%83 = load double, double* %82
%84 = load i64, i64* %1
%85 = uitofp i64 %84 to double
%86 = fdiv double %83, %85
%87 = fmul double %86, 1.000000e+02
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 8, double %87)
%89 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 9
%90 = load double, double* %89
%91 = load i64, i64* %1
%92 = uitofp i64 %91 to double
%93 = fdiv double %90, %92
%94 = fmul double %93, 1.000000e+02
%95 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 9, double %94)
%96 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 10
%97 = load double, double* %96
%98 = load i64, i64* %1
%99 = uitofp i64 %98 to double
%100 = fdiv double %97, %99
%101 = fmul double %100, 1.000000e+02
%102 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 10, double %101)
%103 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 11
%104 = load double, double* %103
%105 = load i64, i64* %1
%106 = uitofp i64 %105 to double
%107 = fdiv double %104, %106
%108 = fmul double %107, 1.000000e+02
%109 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 11, double %108)
%110 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 12
%111 = load double, double* %110
%112 = load i64, i64* %1
%113 = uitofp i64 %112 to double
%114 = fdiv double %111, %113
%115 = fmul double %114, 1.000000e+02
%116 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 12, double %115)
ret i32 0
117: ; preds = %26, %161
%118 = phi i64 [ 0, %26 ], [ %162, %161 ]
%119 = call i32 (...) @rand()
%120 = srem i32 %119, 6
%121 = call i32 (...) @rand()
%122 = srem i32 %121, 6
%123 = add nsw i32 %122, %120
%124 = trunc i32 %123 to i16
switch i16 %124, label %158 [
i16 0, label %125
i16 1, label %128
i16 2, label %131
i16 3, label %134
i16 4, label %137
i16 5, label %140
i16 6, label %143
i16 7, label %146
i16 8, label %149
i16 9, label %152
i16 10, label %155
]
125: ; preds = %117
%126 = load double, double* %37
%127 = fadd double %126, 1.000000e+00
store double %127, double* %37
br label %161
128: ; preds = %117
%129 = load double, double* %36
%130 = fadd double %129, 1.000000e+00
store double %130, double* %36
br label %161
131: ; preds = %117
%132 = load double, double* %35
%133 = fadd double %132, 1.000000e+00
store double %133, double* %35
br label %161
134: ; preds = %117
%135 = load double, double* %34
%136 = fadd double %135, 1.000000e+00
store double %136, double* %34
br label %161
137: ; preds = %117
%138 = load double, double* %33
%139 = fadd double %138, 1.000000e+00
store double %139, double* %33
br label %161
140: ; preds = %117
%141 = load double, double* %32
%142 = fadd double %141, 1.000000e+00
store double %142, double* %32
br label %161
143: ; preds = %117
%144 = load double, double* %31
%145 = fadd double %144, 1.000000e+00
store double %145, double* %31
br label %161
146: ; preds = %117
%147 = load double, double* %30
%148 = fadd double %147, 1.000000e+00
store double %148, double* %30
br label %161
149: ; preds = %117
%150 = load double, double* %29
%151 = fadd double %150, 1.000000e+00
store double %151, double* %29
br label %161
152: ; preds = %117
%153 = load double, double* %28
%154 = fadd double %153, 1.000000e+00
store double %154, double* %28
br label %161
155: ; preds = %117
%156 = load double, double* %27
%157 = fadd double %156, 1.000000e+00
store double %157, double* %27
br label %161
158: ; preds = %117
%159 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%160 = call i32 (...) @getchar()
br label %161
161: ; preds = %125, %128, %131, %134, %137, %140, %143, %146, %149, %152, %155, %158
%162 = add nuw i64 %118, 1
%163 = load i64, i64* %1
%164 = icmp ult i64 %162, %163
br i1 %164, label %117, label %38
}