#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*/ exit(int);
int /*<<< orphan*/ flush();
double getDouble();
int getInt();
int getchar();
int /*<<< orphan*/ introduceOperators();
scalar_t__ pow(double, double);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  signed int num1, num2, result;
  double result_double, cert1, cert2, result_cert;
  int choice_in_range = 0;
  signed int prompt_choice;
  char operator;
  int num_options = 6;
  srand(time(NULL));
  printf("*************************************\n");
  printf("         Welcome to Calculator!\n");
  printf("*************************************\n");
  printf("\n");
  do {
    introduceOperators();
    prompt_choice = getchar();
    flush();
    prompt_choice = prompt_choice - '0';
    if (prompt_choice > 0 && prompt_choice <= num_options) {
      choice_in_range = 1;
    } else {
      printf("\n");
      printf("ERROR: choice not in range: %d\n", prompt_choice);
      printf("\n");
    }
  } while (choice_in_range != 1);
  printf("\n");
  printf("Operator %d chosen.\n", prompt_choice);
  if (prompt_choice == num_options) {
    prompt_choice = (rand() % (num_options - 1)) + 1;
    printf("The die rolls... and we're using option %d!\n", prompt_choice);
  }
  printf("\n");
  printf("Integer 1: ");
  num1 = getInt();
  printf("Uncertainty 1 (absolute): +- ");
  cert1 = getDouble();
  printf("Integer 2: ");
  num2 = getInt();
  printf("Uncertainty 2 (absolute): +- ");
  cert2 = getDouble();
  printf("\n");
  switch (prompt_choice) {
  case 1:
    result = num1 + num2;
    result_cert = cert1 + cert2;
    operator= '+';
    break;
  case 2:
    result = num1 - num2;
    result_cert = cert1 + cert2;
    operator= '-';
    break;
  case 3:
    result = num1 * num2;
    result_cert =
        (((double)num1 / cert1) + ((double)num2 / cert2)) * (double)result;
    operator= '*';
    break;
  case 4:
    result_double = (double)num1 / (double)num2;
    result_cert =
        (((double)num1 / cert1) + ((double)num2 / cert2)) * (double)result;
    operator= '/';
    break;
  case 5:
    result = (int)pow((double)num1, (double)num2);
    operator= '^';
    break;
  default:
    printf("ERROR: nothing to do for choice: %d", prompt_choice);
    exit(1);
    break;
  }
  if (prompt_choice == 4) {
    printf("(%d +- %f) %c (%d +- %f) = %f +- %f!\n", num1, cert1, operator,
           num2, cert2, result_double, result_cert);
  } else {
    printf("(%d +- %f) %c (%d +- %f) = %d +- %f!\n", num1, cert1, operator,
           num2, cert2, result, result_cert);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x6,-0x40(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   10c0 <introduceOperators@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %eax,-0x38(%rbp)
mov    $0x0,%al
call   1030 <flush@plt>
mov    -0x38(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jle    1258 <main+0xa8>
mov    -0x38(%rbp),%eax
cmp    -0x40(%rbp),%eax
jg     1258 <main+0xa8>
movl   $0x1,-0x34(%rbp)
jmp    1285 <main+0xd5>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%esi
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    128a <main+0xda>
cmpl   $0x1,-0x34(%rbp)
jne    1215 <main+0x65>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%esi
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%eax
cmp    -0x40(%rbp),%eax
jne    12e6 <main+0x136>
mov    $0x0,%al
call   10d0 <rand@plt>
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x38(%rbp)
mov    -0x38(%rbp),%esi
lea    0xdb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdcf(%rip),%rdi
mov    %rdi,-0x58(%rbp)
xor    %eax,%eax
mov    %al,-0x49(%rbp)
call   1040 <printf@plt>
mov    -0x49(%rbp),%al
lea    0xdb9(%rip),%rdi
call   1040 <printf@plt>
mov    -0x49(%rbp),%al
call   10a0 <getInt@plt>
mov    %eax,%ecx
mov    -0x49(%rbp),%al
mov    %ecx,-0x8(%rbp)
lea    0xda9(%rip),%rdi
call   1040 <printf@plt>
mov    -0x49(%rbp),%al
call   1060 <getDouble@plt>
mov    -0x49(%rbp),%al
movsd  %xmm0,-0x20(%rbp)
lea    0xdab(%rip),%rdi
call   1040 <printf@plt>
mov    -0x49(%rbp),%al
call   10a0 <getInt@plt>
mov    %eax,%ecx
mov    -0x49(%rbp),%al
mov    %ecx,-0xc(%rbp)
lea    0xd9b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x49(%rbp),%al
call   1060 <getDouble@plt>
mov    -0x58(%rbp),%rdi
mov    -0x49(%rbp),%al
movsd  %xmm0,-0x28(%rbp)
call   1040 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x48(%rbp)
sub    $0x4,%eax
ja     1478 <main+0x2c8>
mov    -0x48(%rbp),%rax
lea    0xc69(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movb   $0x2b,-0x39(%rbp)
jmp    1493 <main+0x2e3>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movb   $0x2d,-0x39(%rbp)
jmp    1493 <main+0x2e3>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  -0x28(%rbp),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movb   $0x2a,-0x39(%rbp)
jmp    1493 <main+0x2e3>
cvtsi2sdl -0x8(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  -0x28(%rbp),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movb   $0x2f,-0x39(%rbp)
jmp    1493 <main+0x2e3>
cvtsi2sdl -0x8(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
call   1090 <pow@plt>
mov    %eax,-0x10(%rbp)
movb   $0x5e,-0x39(%rbp)
jmp    1493 <main+0x2e3>
mov    -0x38(%rbp),%esi
lea    0xc90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
cmpl   $0x4,-0x38(%rbp)
jne    14ce <main+0x31e>
mov    -0x8(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
movsbl -0x39(%rbp),%edx
mov    -0xc(%rbp),%ecx
movsd  -0x28(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
lea    0xc74(%rip),%rdi
mov    $0x4,%al
call   1040 <printf@plt>
jmp    14f9 <main+0x349>
mov    -0x8(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
movsbl -0x39(%rbp),%edx
mov    -0xc(%rbp),%ecx
movsd  -0x28(%rbp),%xmm1
mov    -0x10(%rbp),%r8d
movsd  -0x30(%rbp),%xmm2
lea    0xc6a(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
lea    0xbbc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
xor    %edi,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
lea    0xf6d(%rip),%rbx
mov    %rbx,%rdi
call   1050 <puts@plt>
lea    0xf3e(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
call   10e0 <introduceOperators@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <flush@plt>
lea    -0x30(%rbp),%ebx
add    $0xffffffcf,%ebp
cmp    $0x6,%ebp
jb     1282 <main+0xb2>
lea    0xdd8(%rip),%r14
nopl   0x0(%rax)
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
call   10e0 <introduceOperators@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <flush@plt>
lea    -0x30(%rbp),%ebx
add    $0xffffffcf,%ebp
cmp    $0x5,%ebp
ja     1240 <main+0x70>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xda1(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0x6,%ebx
jne    12d9 <main+0x109>
xor    %eax,%eax
call   10f0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebx
add    $0x1,%ebx
lea    0xd79(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xd8c(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   10c0 <getInt@plt>
mov    %eax,%r14d
lea    0xd80(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1080 <getDouble@plt>
movaps %xmm0,0x10(%rsp)
lea    0xd84(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   10c0 <getInt@plt>
mov    %eax,%ebp
lea    0xd79(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1080 <getDouble@plt>
movaps %xmm0,(%rsp)
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    -0x1(%rbx),%eax
cmp    $0x4,%eax
ja     148b <main+0x2bb>
lea    0xc9e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %ebp,%r8d
add    %r14d,%r8d
movapd 0x10(%rsp),%xmm0
movapd %xmm0,%xmm2
movapd (%rsp),%xmm1
addsd  %xmm1,%xmm2
mov    $0x2b,%edx
jmp    1463 <main+0x293>
movd   %ebp,%xmm0
mov    %ebp,%r8d
imul   %r14d,%r8d
movd   %r14d,%xmm1
punpckldq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm2
movapd 0x10(%rsp),%xmm0
movapd %xmm0,%xmm3
movapd (%rsp),%xmm1
unpcklpd %xmm1,%xmm3
divpd  %xmm3,%xmm2
movapd %xmm2,%xmm3
unpckhpd %xmm2,%xmm3
addsd  %xmm2,%xmm3
xorps  %xmm2,%xmm2
cvtsi2sd %r8d,%xmm2
mulsd  %xmm3,%xmm2
mov    $0x2a,%edx
jmp    1463 <main+0x293>
movd   %ebp,%xmm0
movd   %r14d,%xmm1
punpckldq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm3
movapd %xmm3,%xmm1
unpckhpd %xmm3,%xmm1
movapd %xmm3,%xmm2
divsd  %xmm1,%xmm2
movapd 0x10(%rsp),%xmm0
movapd %xmm0,%xmm4
movapd (%rsp),%xmm1
unpcklpd %xmm1,%xmm4
divpd  %xmm4,%xmm3
movapd %xmm3,%xmm4
unpckhpd %xmm3,%xmm4
addsd  %xmm3,%xmm4
xorpd  %xmm3,%xmm3
mulsd  %xmm4,%xmm3
lea    0xcbc(%rip),%rdi
mov    %r14d,%esi
mov    $0x2f,%edx
mov    %ebp,%ecx
mov    $0x4,%al
call   1060 <printf@plt>
jmp    1476 <main+0x2a6>
mov    %r14d,%r8d
sub    %ebp,%r8d
movapd 0x10(%rsp),%xmm0
movapd %xmm0,%xmm2
movapd (%rsp),%xmm1
addsd  %xmm1,%xmm2
mov    $0x2d,%edx
lea    0xcaa(%rip),%rdi
mov    %r14d,%esi
mov    %ebp,%ecx
mov    $0x3,%al
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xc38(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
cvtsi2sd %ebp,%xmm1
call   10b0 <pow@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"*************************************\0A\00"
@.str.1 = [33 x i8] c" Welcome to Calculator!\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [32 x i8] c"ERROR: choice not in range: %d\0A\00"
@.str.4 = [21 x i8] c"Operator %d chosen.\0A\00"
@.str.5 = [45 x i8] c"The die rolls... and we're using option %d!\0A\00"
@.str.6 = [12 x i8] c"Integer 1: \00"
@.str.7 = [30 x i8] c"Uncertainty 1 (absolute): +- \00"
@.str.8 = [12 x i8] c"Integer 2: \00"
@.str.9 = [30 x i8] c"Uncertainty 2 (absolute): +- \00"
@.str.10 = [36 x i8] c"ERROR: nothing to do for choice: %d\00"
@.str.11 = [38 x i8] c"(%d +- %f) %c (%d +- %f) = %f +- %f!\0A\00"
@.str.12 = [38 x i8] c"(%d +- %f) %c (%d +- %f) = %d +- %f!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8
%12 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %9
store i32 6, i32* %12
%13 = call i32 @time(i32* null)
%14 = call i32 @srand(i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %38, %0
%20 = call i32 (...) @introduceOperators()
%21 = call i32 (...) @getchar()
store i32 %21, i32* %10
%22 = call i32 (...) @flush()
%23 = load i32, i32* %10
%24 = sub nsw i32 %23, 48
store i32 %24, i32* %10
%25 = load i32, i32* %10
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %32
27: ; preds = %19
%28 = load i32, i32* %10
%29 = load i32, i32* %12
%30 = icmp sle i32 %28, %29
br i1 %30, label %31, label %32
31: ; preds = %27
store i32 1, i32* %9
br label %37
32: ; preds = %27, %19
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%34 = load i32, i32* %10
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %37
37: ; preds = %32, %31
br label %38
38: ; preds = %37
%39 = load i32, i32* %9
%40 = icmp ne i32 %39, 1
br i1 %40, label %19, label %41
41: ; preds = %38
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%43 = load i32, i32* %10
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %43)
%45 = load i32, i32* %10
%46 = load i32, i32* %12
%47 = icmp eq i32 %45, %46
br i1 %47, label %48, label %56
48: ; preds = %41
%49 = call i32 (...) @rand()
%50 = load i32, i32* %12
%51 = sub nsw i32 %50, 1
%52 = srem i32 %49, %51
%53 = add nsw i32 %52, 1
store i32 %53, i32* %10
%54 = load i32, i32* %10
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i32 %54)
br label %56
56: ; preds = %48, %41
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%59 = call i32 (...) @getInt()
store i32 %59, i32* %2
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%61 = call double (...) @getDouble()
store double %61, double* %6
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%63 = call i32 (...) @getInt()
store i32 %63, i32* %3
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
%65 = call double (...) @getDouble()
store double %65, double* %7
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%67 = load i32, i32* %10
switch i32 %67, label %123 [
i32 1, label %68
i32 2, label %75
i32 3, label %82
i32 4, label %98
i32 5, label %116
]
68: ; preds = %56
%69 = load i32, i32* %2
%70 = load i32, i32* %3
%71 = add nsw i32 %69, %70
store i32 %71, i32* %4
%72 = load double, double* %6
%73 = load double, double* %7
%74 = fadd double %72, %73
store double %74, double* %8
store i8 43, i8* %11
br label %127
75: ; preds = %56
%76 = load i32, i32* %2
%77 = load i32, i32* %3
%78 = sub nsw i32 %76, %77
store i32 %78, i32* %4
%79 = load double, double* %6
%80 = load double, double* %7
%81 = fadd double %79, %80
store double %81, double* %8
store i8 45, i8* %11
br label %127
82: ; preds = %56
%83 = load i32, i32* %2
%84 = load i32, i32* %3
%85 = mul nsw i32 %83, %84
store i32 %85, i32* %4
%86 = load i32, i32* %2
%87 = sitofp i32 %86 to double
%88 = load double, double* %6
%89 = fdiv double %87, %88
%90 = load i32, i32* %3
%91 = sitofp i32 %90 to double
%92 = load double, double* %7
%93 = fdiv double %91, %92
%94 = fadd double %89, %93
%95 = load i32, i32* %4
%96 = sitofp i32 %95 to double
%97 = fmul double %94, %96
store double %97, double* %8
store i8 42, i8* %11
br label %127
98: ; preds = %56
%99 = load i32, i32* %2
%100 = sitofp i32 %99 to double
%101 = load i32, i32* %3
%102 = sitofp i32 %101 to double
%103 = fdiv double %100, %102
store double %103, double* %5
%104 = load i32, i32* %2
%105 = sitofp i32 %104 to double
%106 = load double, double* %6
%107 = fdiv double %105, %106
%108 = load i32, i32* %3
%109 = sitofp i32 %108 to double
%110 = load double, double* %7
%111 = fdiv double %109, %110
%112 = fadd double %107, %111
%113 = load i32, i32* %4
%114 = sitofp i32 %113 to double
%115 = fmul double %112, %114
store double %115, double* %8
store i8 47, i8* %11
br label %127
116: ; preds = %56
%117 = load i32, i32* %2
%118 = sitofp i32 %117 to double
%119 = load i32, i32* %3
%120 = sitofp i32 %119 to double
%121 = call i64 @pow(double %118, double %120)
%122 = trunc i64 %121 to i32
store i32 %122, i32* %4
store i8 94, i8* %11
br label %127
123: ; preds = %56
%124 = load i32, i32* %10
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0), i32 %124)
%126 = call i32 @exit(i32 1)
unreachable
127: ; preds = %116, %98, %82, %75, %68
%128 = load i32, i32* %10
%129 = icmp eq i32 %128, 4
br i1 %129, label %130, label %140
130: ; preds = %127
%131 = load i32, i32* %2
%132 = load double, double* %6
%133 = load i8, i8* %11
%134 = sext i8 %133 to i32
%135 = load i32, i32* %3
%136 = load double, double* %7
%137 = load double, double* %5
%138 = load double, double* %8
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i32 %131, double %132, i32 %134, i32 %135, double %136, double %137, double %138)
br label %150
140: ; preds = %127
%141 = load i32, i32* %2
%142 = load double, double* %6
%143 = load i8, i8* %11
%144 = sext i8 %143 to i32
%145 = load i32, i32* %3
%146 = load double, double* %7
%147 = load i32, i32* %4
%148 = load double, double* %8
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i32 %141, double %142, i32 %144, i32 %145, double %146, i32 %147, double %148)
br label %150
150: ; preds = %140, %130
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [32 x i8] c"ERROR: choice not in range: %d\0A\00"
@.str.4 = [21 x i8] c"Operator %d chosen.\0A\00"
@.str.5 = [45 x i8] c"The die rolls... and we're using option %d!\0A\00"
@.str.6 = [12 x i8] c"Integer 1: \00"
@.str.7 = [30 x i8] c"Uncertainty 1 (absolute): +- \00"
@.str.8 = [12 x i8] c"Integer 2: \00"
@.str.9 = [30 x i8] c"Uncertainty 2 (absolute): +- \00"
@.str.10 = [36 x i8] c"ERROR: nothing to do for choice: %d\00"
@.str.11 = [38 x i8] c"(%d +- %f) %c (%d +- %f) = %f +- %f!\0A\00"
@.str.12 = [38 x i8] c"(%d +- %f) %c (%d +- %f) = %d +- %f!\0A\00"
@str.13 = [32 x i8] c" Welcome to Calculator!\00"
@str.14 = [38 x i8] c"*************************************\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.14, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.13, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.14, i64 0, i64 0))
%6 = tail call i32 @putchar(i32 10)
%7 = tail call i32 (...) @introduceOperators()
%8 = tail call i32 (...) @getchar()
%9 = tail call i32 (...) @flush()
%10 = add nsw i32 %8, -48
%11 = add i32 %8, -49
%12 = icmp ult i32 %11, 6
br i1 %12, label %24, label %13
13: ; preds = %0, %13
%14 = phi i32 [ %21, %13 ], [ %10, %0 ]
%15 = tail call i32 @putchar(i32 10)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%17 = tail call i32 @putchar(i32 10)
%18 = tail call i32 (...) @introduceOperators()
%19 = tail call i32 (...) @getchar()
%20 = tail call i32 (...) @flush()
%21 = add nsw i32 %19, -48
%22 = add i32 %19, -49
%23 = icmp ult i32 %22, 6
br i1 %23, label %24, label %13
24: ; preds = %13, %0
%25 = phi i32 [ %10, %0 ], [ %21, %13 ]
%26 = tail call i32 @putchar(i32 10)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %25)
%28 = icmp eq i32 %25, 6
br i1 %28, label %29, label %34
29: ; preds = %24
%30 = tail call i32 (...) @rand()
%31 = srem i32 %30, 5
%32 = add nsw i32 %31, 1
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %29, %24
%35 = phi i32 [ %32, %29 ], [ %25, %24 ]
%36 = tail call i32 @putchar(i32 10)
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%38 = tail call i32 (...) @getInt()
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%40 = tail call double (...) @getDouble()
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%42 = tail call i32 (...) @getInt()
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
%44 = tail call double (...) @getDouble()
%45 = tail call i32 @putchar(i32 10)
switch i32 %35, label %69 [
i32 1, label %46
i32 2, label %49
i32 3, label %52
i32 4, label %72
i32 5, label %65
]
46: ; preds = %34
%47 = add nsw i32 %42, %38
%48 = fadd double %40, %44
br label %87
49: ; preds = %34
%50 = sub nsw i32 %38, %42
%51 = fadd double %40, %44
br label %87
52: ; preds = %34
%53 = mul nsw i32 %42, %38
%54 = insertelement <2 x i32> poison, i32 %38, i64 0
%55 = insertelement <2 x i32> %54, i32 %42, i64 1
%56 = sitofp <2 x i32> %55 to <2 x double>
%57 = insertelement <2 x double> poison, double %40, i64 0
%58 = insertelement <2 x double> %57, double %44, i64 1
%59 = fdiv <2 x double> %56, %58
%60 = shufflevector <2 x double> %59, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%61 = fadd <2 x double> %59, %60
%62 = extractelement <2 x double> %61, i64 0
%63 = sitofp i32 %53 to double
%64 = fmul double %62, %63
br label %87
65: ; preds = %34
%66 = sitofp i32 %38 to double
%67 = sitofp i32 %42 to double
%68 = tail call i64 @pow(double %66, double %67)
unreachable
69: ; preds = %34
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0), i32 %35)
%71 = tail call i32 @exit(i32 1)
unreachable
72: ; preds = %34
%73 = insertelement <2 x i32> poison, i32 %38, i64 0
%74 = insertelement <2 x i32> %73, i32 %42, i64 1
%75 = sitofp <2 x i32> %74 to <2 x double>
%76 = extractelement <2 x double> %75, i64 0
%77 = extractelement <2 x double> %75, i64 1
%78 = fdiv double %76, %77
%79 = insertelement <2 x double> poison, double %40, i64 0
%80 = insertelement <2 x double> %79, double %44, i64 1
%81 = fdiv <2 x double> %75, %80
%82 = shufflevector <2 x double> %81, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%83 = fadd <2 x double> %81, %82
%84 = extractelement <2 x double> %83, i64 0
%85 = fmul double %84, 0.000000e+00
%86 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i32 %38, double %40, i32 47, i32 %42, double %44, double %78, double %85)
br label %92
87: ; preds = %52, %49, %46
%88 = phi i32 [ %47, %46 ], [ %50, %49 ], [ %53, %52 ]
%89 = phi double [ %48, %46 ], [ %51, %49 ], [ %64, %52 ]
%90 = phi i32 [ 43, %46 ], [ 45, %49 ], [ 42, %52 ]
%91 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i32 %38, double %40, i32 %90, i32 %42, double %44, i32 %88, double %89)
br label %92
92: ; preds = %87, %72
%93 = tail call i32 @putchar(i32 10)
ret i32 0
}