int main(void) {
  int a, b, result;
  char ch;
  printf("Enter 2 numbers as arguments to basic math operations\n\t\t-> ");
  scanf("%d %d", &a, &b);
  while (getchar() != '\n')
    ;
  puts("\nNow what do you want to do with them, my man?:");
  puts("\tB - Who's bigger");
  puts("\tA - Add");
  puts("\tS - Substract");
  puts("\tD - Division");
  printf("\tM - Multiplication\n\t\t");
  ch = getchar();
  while (getchar() != '\n')
    ;
  if (ch >= 'a' && ch <= 'z')
    ch += 'A' - 'a';
  switch (ch) {
    break;
  case 'A':
    result = ((a) + (b));
    break;
  case 'S':
    result = ((a) - (b));
    break;
  case 'D':
    result = ((a) / (b));
    break;
  case 'M':
    result = ((a) * (b));
    break;
  case 'B':
    result = ((a) > (b) ? (a) : (b));
    ;
    printf("ch is %c\n", ch);
    break;
  default:
    puts("Sorry, can't do that!\n");
    break;
  }
  puts("\nSure!");
  printf("The result is %d.\n\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xef6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf24(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
cmp    $0xa,%eax
je     1188 <main+0x48>
jmp    1173 <main+0x33>
lea    0xeff(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    0xf21(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    0xf25(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    0xf20(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    0xf21(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    0xf21(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x11(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
cmp    $0xa,%eax
je     11fb <main+0xbb>
jmp    11e6 <main+0xa6>
movsbl -0x11(%rbp),%eax
cmp    $0x61,%eax
jl     121f <main+0xdf>
movsbl -0x11(%rbp),%eax
cmp    $0x7a,%eax
jg     121f <main+0xdf>
movsbl -0x11(%rbp),%eax
add    $0xffffffe0,%eax
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x12,%eax
ja     12bd <main+0x17d>
mov    -0x20(%rbp),%rax
lea    0xdc0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    12cb <main+0x18b>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    12cb <main+0x18b>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x10(%rbp)
jmp    12cb <main+0x18b>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    12cb <main+0x18b>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    129a <main+0x15a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    12a0 <main+0x160>
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x10(%rbp)
movsbl -0x11(%rbp),%esi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12cb <main+0x18b>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
mov    -0x10(%rbp),%esi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf00(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf2e(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
jne    1170 <main+0x30>
lea    0xf0b(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
lea    0xf2d(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
lea    0xf31(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
lea    0xf2c(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
lea    0xf2d(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
lea    0xf2d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
jne    11e0 <main+0xa0>
shl    $0x18,%ebx
lea    -0x60000001(%rbx),%ecx
lea    -0x20000000(%rbx),%eax
cmp    $0x1affffff,%ecx
cmovae %ebx,%eax
sar    $0x18,%eax
add    $0xffffffbf,%eax
cmp    $0x12,%eax
ja     124b <main+0x10b>
lea    0xdea(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x8(%rsp),%ebx
add    0xc(%rsp),%ebx
jmp    127b <main+0x13b>
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%ebx
cmp    %ebx,%eax
cmovg  %eax,%ebx
lea    0xed0(%rip),%rdi
mov    $0x42,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    127b <main+0x13b>
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
jmp    127b <main+0x13b>
mov    0xc(%rsp),%eax
cltd
idivl  0x8(%rsp)
mov    %eax,%ebx
jmp    127b <main+0x13b>
mov    0x8(%rsp),%ebx
imul   0xc(%rsp),%ebx
jmp    127b <main+0x13b>
mov    0xc(%rsp),%ebx
sub    0x8(%rsp),%ebx
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
lea    0xea5(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [60 x i8] c"Enter 2 numbers as arguments to basic math operations\0A\09\09-> \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [48 x i8] c"\0ANow what do you want to do with them, my man?:\00"
@.str.3 = [18 x i8] c"\09B - Who's bigger\00"
@.str.4 = [9 x i8] c"\09A - Add\00"
@.str.5 = [15 x i8] c"\09S - Substract\00"
@.str.6 = [14 x i8] c"\09D - Division\00"
@.str.7 = [23 x i8] c"\09M - Multiplication\0A\09\09\00"
@.str.8 = [10 x i8] c"ch is %c\0A\00"
@.str.9 = [23 x i8] c"Sorry, can't do that!\0A\00"
@.str.10 = [7 x i8] c"\0ASure!\00"
@.str.11 = [20 x i8] c"The result is %d.\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
br label %8
8: ; preds = %11, %0
%9 = call i32 (...) @getchar()
%10 = icmp ne i32 %9, 10
br i1 %10, label %11, label %12
11: ; preds = %8
br label %8
12: ; preds = %8
%13 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
%19 = call i32 (...) @getchar()
%20 = trunc i32 %19 to i8
store i8 %20, i8* %5
br label %21
21: ; preds = %24, %12
%22 = call i32 (...) @getchar()
%23 = icmp ne i32 %22, 10
br i1 %23, label %24, label %25
24: ; preds = %21
br label %21
25: ; preds = %21
%26 = load i8, i8* %5
%27 = sext i8 %26 to i32
%28 = icmp sge i32 %27, 97
br i1 %28, label %29, label %38
29: ; preds = %25
%30 = load i8, i8* %5
%31 = sext i8 %30 to i32
%32 = icmp sle i32 %31, 122
br i1 %32, label %33, label %38
33: ; preds = %29
%34 = load i8, i8* %5
%35 = sext i8 %34 to i32
%36 = add nsw i32 %35, -32
%37 = trunc i32 %36 to i8
store i8 %37, i8* %5
br label %38
38: ; preds = %33, %29, %25
%39 = load i8, i8* %5
%40 = sext i8 %39 to i32
switch i32 %40, label %70 [
i32 65, label %41
i32 83, label %45
i32 68, label %49
i32 77, label %53
i32 66, label %57
]
41: ; preds = %38
%42 = load i32, i32* %2
%43 = load i32, i32* %3
%44 = add nsw i32 %42, %43
store i32 %44, i32* %4
br label %72
45: ; preds = %38
%46 = load i32, i32* %2
%47 = load i32, i32* %3
%48 = sub nsw i32 %46, %47
store i32 %48, i32* %4
br label %72
49: ; preds = %38
%50 = load i32, i32* %2
%51 = load i32, i32* %3
%52 = sdiv i32 %50, %51
store i32 %52, i32* %4
br label %72
53: ; preds = %38
%54 = load i32, i32* %2
%55 = load i32, i32* %3
%56 = mul nsw i32 %54, %55
store i32 %56, i32* %4
br label %72
57: ; preds = %38
%58 = load i32, i32* %2
%59 = load i32, i32* %3
%60 = icmp sgt i32 %58, %59
br i1 %60, label %61, label %63
61: ; preds = %57
%62 = load i32, i32* %2
br label %65
63: ; preds = %57
%64 = load i32, i32* %3
br label %65
65: ; preds = %63, %61
%66 = phi i32 [ %62, %61 ], [ %64, %63 ]
store i32 %66, i32* %4
%67 = load i8, i8* %5
%68 = sext i8 %67 to i32
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 %68)
br label %72
70: ; preds = %38
%71 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
br label %72
72: ; preds = %70, %65, %53, %49, %45, %41
%73 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%74 = load i32, i32* %4
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i32 %74)
ret i32 0
}

LLVM IR (-O2):
@.str = [60 x i8] c"Enter 2 numbers as arguments to basic math operations\0A\09\09-> \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [48 x i8] c"\0ANow what do you want to do with them, my man?:\00"
@.str.3 = [18 x i8] c"\09B - Who's bigger\00"
@.str.4 = [9 x i8] c"\09A - Add\00"
@.str.5 = [15 x i8] c"\09S - Substract\00"
@.str.6 = [14 x i8] c"\09D - Division\00"
@.str.7 = [23 x i8] c"\09M - Multiplication\0A\09\09\00"
@.str.8 = [10 x i8] c"ch is %c\0A\00"
@.str.9 = [23 x i8] c"Sorry, can't do that!\0A\00"
@.str.10 = [7 x i8] c"\0ASure!\00"
@.str.11 = [20 x i8] c"The result is %d.\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
br label %7
7: ; preds = %7, %0
%8 = call i32 (...) @getchar()
%9 = icmp eq i32 %8, 10
br i1 %9, label %10, label %7
10: ; preds = %7
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
%17 = call i32 (...) @getchar()
br label %18
18: ; preds = %18, %10
%19 = call i32 (...) @getchar()
%20 = icmp eq i32 %19, 10
br i1 %20, label %21, label %18
21: ; preds = %18
%22 = shl i32 %17, 24
%23 = add i32 %22, -1610612737
%24 = icmp ult i32 %23, 452984831
%25 = add i32 %22, -536870912
%26 = select i1 %24, i32 %25, i32 %22
%27 = ashr exact i32 %26, 24
switch i32 %27, label %50 [
i32 65, label %28
i32 83, label %32
i32 68, label %36
i32 77, label %40
i32 66, label %44
]
28: ; preds = %21
%29 = load i32, i32* %1
%30 = load i32, i32* %2
%31 = add nsw i32 %30, %29
br label %52
32: ; preds = %21
%33 = load i32, i32* %1
%34 = load i32, i32* %2
%35 = sub nsw i32 %33, %34
br label %52
36: ; preds = %21
%37 = load i32, i32* %1
%38 = load i32, i32* %2
%39 = sdiv i32 %37, %38
br label %52
40: ; preds = %21
%41 = load i32, i32* %1
%42 = load i32, i32* %2
%43 = mul nsw i32 %42, %41
br label %52
44: ; preds = %21
%45 = load i32, i32* %1
%46 = load i32, i32* %2
%47 = icmp sgt i32 %45, %46
%48 = select i1 %47, i32 %45, i32 %46
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 66)
br label %52
50: ; preds = %21
%51 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
br label %52
52: ; preds = %50, %44, %40, %36, %32, %28
%53 = phi i32 [ undef, %50 ], [ %48, %44 ], [ %43, %40 ], [ %39, %36 ], [ %35, %32 ], [ %31, %28 ]
%54 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i32 %53)
ret i32 0
}