#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 atoi(char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ getLine(char *, char *, size_t);
int /*<<< orphan*/ getchar();
char *malloc(size_t);
int /*<<< orphan*/ print_options();
int /*<<< orphan*/ print_results(int, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  int a, b, option;
  size_t sz = sizeof(char) * 3;
  char *prompt;
  char *hold;
  if (argc < 4) {
    if (argc != 3) {
      printf("\nWelcome to Evaluator 0.1!\n");
      printf("\nEnter a value for a: ");
      scanf("%d", &a);
      getchar();
      printf("\nEnter a value for b: ");
      scanf("%d", &b);
      getchar();
    } else {
      a = atoi(argv[1]);
      b = atoi(argv[2]);
    }
    prompt = "\n\nSelect Option: \0";
    print_options();
    sz = sizeof(char) * 3;
    hold = malloc(sz);
    getLine(prompt, hold, sz);
    option = atoi(hold);
    free(hold);
  } else
    option = atoi(argv[3]);
  print_results(a, b, option);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x3,-0x28(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    128b <main+0xfb>
cmpl   $0x3,-0x8(%rbp)
je     1219 <main+0x89>
lea    0xe37(%rip),%rdi
call   1040 <printf@plt>
lea    0xe47(%rip),%rdi
call   1040 <printf@plt>
lea    0xe52(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1080 <scanf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
lea    0xe3e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe2f(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1080 <scanf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
jmp    1239 <main+0xa9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x18(%rbp)
lea    0xe0d(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   10b0 <print_options@plt>
movq   $0x3,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1070 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1090 <getLine@plt>
mov    -0x38(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
jmp    129b <main+0x10b>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1050 <print_results@plt>
lea    0xd6a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    11d6 <main+0x26>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   10c0 <atoi@plt>
mov    %eax,0x4(%rsp)
mov    0x10(%rbx),%rdi
call   10c0 <atoi@plt>
mov    %eax,(%rsp)
jmp    1227 <main+0x77>
lea    0xe54(%rip),%rdi
call   1050 <puts@plt>
lea    0xe17(%rip),%rdi
call   1060 <printf@plt>
lea    0xe22(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <scanf@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
lea    0xe0a(%rip),%rdi
call   1060 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   10a0 <scanf@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
xor    %eax,%eax
call   10d0 <print_options@plt>
mov    $0x3,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
lea    0xe0a(%rip),%rdi
mov    $0x3,%edx
mov    %rax,%rsi
call   10b0 <getLine@plt>
mov    %rbx,%rdi
call   10c0 <atoi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
mov    %ebp,%edx
call   1070 <print_results@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"\0AWelcome to Evaluator 0.1!\0A\00"
@.str.1 = [23 x i8] c"\0AEnter a value for a: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [23 x i8] c"\0AEnter a value for b: \00"
@.str.4 = [19 x i8] c"\0A\0ASelect Option: \00\00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i8*
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 3, i64* %9
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 4
br i1 %13, label %14, label %46
14: ; preds = %2
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 3
br i1 %16, label %17, label %25
17: ; preds = %14
%18 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%21 = call i32 (...) @getchar()
%22 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%24 = call i32 (...) @getchar()
br label %34
25: ; preds = %14
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @atoi(i8* %28)
store i32 %29, i32* %6
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = call i32 @atoi(i8* %32)
store i32 %33, i32* %7
br label %34
34: ; preds = %25, %17
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8** %10
%35 = call i32 (...) @print_options()
store i64 3, i64* %9
%36 = load i64, i64* %9
%37 = call i8* @malloc(i64 %36)
store i8* %37, i8** %11
%38 = load i8*, i8** %10
%39 = load i8*, i8** %11
%40 = load i64, i64* %9
%41 = call i32 @getLine(i8* %38, i8* %39, i64 %40)
%42 = load i8*, i8** %11
%43 = call i32 @atoi(i8* %42)
store i32 %43, i32* %8
%44 = load i8*, i8** %11
%45 = call i32 @free(i8* %44)
br label %51
46: ; preds = %2
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 3
%49 = load i8*, i8** %48
%50 = call i32 @atoi(i8* %49)
store i32 %50, i32* %8
br label %51
51: ; preds = %46, %34
%52 = load i32, i32* %6
%53 = load i32, i32* %7
%54 = load i32, i32* %8
%55 = call i32 @print_results(i32 %52, i32 %53, i32 %54)
%56 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [23 x i8] c"\0AEnter a value for a: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [23 x i8] c"\0AEnter a value for b: \00"
@.str.4 = [19 x i8] c"\0A\0ASelect Option: \00\00"
@str = [27 x i8] c"\0AWelcome to Evaluator 0.1!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = icmp slt i32 %0, 4
%8 = icmp eq i32 %0, 3
br i1 %8, label %17, label %9
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%13 = call i32 (...) @getchar()
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%16 = call i32 (...) @getchar()
br label %24
17: ; preds = %2
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = tail call i32 @atoi(i8* %19)
store i32 %20, i32* %3
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = tail call i32 @atoi(i8* %22)
store i32 %23, i32* %4
br label %24
24: ; preds = %17, %9
%25 = call i32 (...) @print_options()
%26 = call dereferenceable_or_null(3) i8* @malloc(i64 3)
%27 = call i32 @getLine(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %26, i64 3)
%28 = call i32 @atoi(i8* %26)
%29 = call i32 @free(i8* %26)
%30 = load i32, i32* %3
%31 = load i32, i32* %4
%32 = call i32 @print_results(i32 %30, i32 %31, i32 %28)
%33 = call i32 @putchar(i32 10)
ret i32 0
}