#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int vFirstArg, vSecondArg;
  char vOperation;
  bool vFinished;
  int przyklad[50];
  int i;
  vFinished = false;
  while (vFinished != true) {
    printf("What operation do you want to do?\n");
    scanf("%c", &vOperation);
    if (vOperation == '+') {
      printf("Enter left argument: ");
      scanf("%d", &vFirstArg);
      printf("\nEnter right argument: ");
      scanf("%d", &vSecondArg);
      printf("\n%d + %d = %d\n", vFirstArg, vSecondArg, vFirstArg + vSecondArg);
    }
    if (vOperation == '-') {
      printf("Enter first number:");
      scanf("%d", &vFirstArg);
      printf("Enter secend number:");
      scanf("%d", &vSecondArg);
      printf("%d - %d = %d", vFirstArg, vSecondArg, vFirstArg - vSecondArg);
    }
    if (vOperation == '*') {
      printf("Enter first number");
      scanf("%d", &vFirstArg);
      printf("Enter second number");
      scanf("%d", &vSecondArg);
      printf("%d * %d = %d", vFirstArg, vSecondArg, vFirstArg * vSecondArg);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
je     129e <main+0x17e>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    -0xd(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0xd(%rbp),%eax
cmp    $0x2b,%eax
jne    11ca <main+0xaa>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf45(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf25(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
add    -0xc(%rbp),%ecx
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0xd(%rbp),%eax
cmp    $0x2d,%eax
jne    1231 <main+0x111>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0xd(%rbp),%eax
cmp    $0x2a,%eax
jne    1299 <main+0x179>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe77(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe57(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1139 <main+0x19>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xf65(%rip),%r14
lea    0xeb4(%rip),%r15
lea    0xf(%rsp),%r13
lea    0xf4f(%rip),%rbx
lea    0x14(%rsp),%rbp
lea    0x10(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movzbl 0xf(%rsp),%eax
cmp    $0x2b,%al
jne    11e2 <main+0xb2>
lea    0xe6e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe69(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
lea    (%rdx,%rsi,1),%ecx
lea    0xe5b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xf(%rsp),%eax
cmp    $0x2d,%al
jne    123b <main+0x10b>
lea    0xe53(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe4c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %esi,%ecx
sub    %edx,%ecx
lea    0xe3a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xf(%rsp),%eax
cmp    $0x2a,%al
jne    1170 <main+0x40>
lea    0xe2c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe24(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %edx,%ecx
imul   %esi,%ecx
lea    0xe10(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1170 <main+0x40>

LLVM IR (-O0):
@.str = [35 x i8] c"What operation do you want to do?\0A\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [22 x i8] c"Enter left argument: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [24 x i8] c"\0AEnter right argument: \00"
@.str.5 = [15 x i8] c"\0A%d + %d = %d\0A\00"
@.str.6 = [20 x i8] c"Enter first number:\00"
@.str.7 = [21 x i8] c"Enter secend number:\00"
@.str.8 = [13 x i8] c"%d - %d = %d\00"
@.str.9 = [19 x i8] c"Enter first number\00"
@.str.10 = [20 x i8] c"Enter second number\00"
@.str.11 = [13 x i8] c"%d * %d = %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = alloca i32
%6 = alloca [50 x i32]
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
br label %8
8: ; preds = %58, %0
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 1
br i1 %10, label %11, label %59
11: ; preds = %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%14 = load i8, i8* %4
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 43
br i1 %16, label %17, label %28
17: ; preds = %11
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = load i32, i32* %2
%25 = load i32, i32* %3
%26 = add nsw i32 %24, %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %22, i32 %23, i32 %26)
br label %28
28: ; preds = %17, %11
%29 = load i8, i8* %4
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 45
br i1 %31, label %32, label %43
32: ; preds = %28
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%34 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%36 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%37 = load i32, i32* %2
%38 = load i32, i32* %3
%39 = load i32, i32* %2
%40 = load i32, i32* %3
%41 = sub nsw i32 %39, %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 %37, i32 %38, i32 %41)
br label %43
43: ; preds = %32, %28
%44 = load i8, i8* %4
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 42
br i1 %46, label %47, label %58
47: ; preds = %43
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%49 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
%51 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%52 = load i32, i32* %2
%53 = load i32, i32* %3
%54 = load i32, i32* %2
%55 = load i32, i32* %3
%56 = mul nsw i32 %54, %55
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i32 %52, i32 %53, i32 %56)
br label %58
58: ; preds = %47, %43
br label %8
59: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [22 x i8] c"Enter left argument: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [24 x i8] c"\0AEnter right argument: \00"
@.str.5 = [15 x i8] c"\0A%d + %d = %d\0A\00"
@.str.6 = [20 x i8] c"Enter first number:\00"
@.str.7 = [21 x i8] c"Enter secend number:\00"
@.str.8 = [13 x i8] c"%d - %d = %d\00"
@.str.9 = [19 x i8] c"Enter first number\00"
@.str.10 = [20 x i8] c"Enter second number\00"
@.str.11 = [13 x i8] c"%d * %d = %d\00"
@str = [34 x i8] c"What operation do you want to do?\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
br label %6
6: ; preds = %46, %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%9 = load i8, i8* %3
%10 = icmp eq i8 %9, 43
br i1 %10, label %11, label %21
11: ; preds = %6
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%16 = load i32, i32* %1
%17 = load i32, i32* %2
%18 = add nsw i32 %17, %16
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %16, i32 %17, i32 %18)
%20 = load i8, i8* %3
br label %21
21: ; preds = %11, %6
%22 = phi i8 [ %20, %11 ], [ %9, %6 ]
%23 = icmp eq i8 %22, 45
br i1 %23, label %24, label %34
24: ; preds = %21
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%29 = load i32, i32* %1
%30 = load i32, i32* %2
%31 = sub nsw i32 %29, %30
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 %29, i32 %30, i32 %31)
%33 = load i8, i8* %3
br label %34
34: ; preds = %24, %21
%35 = phi i8 [ %33, %24 ], [ %22, %21 ]
%36 = icmp eq i8 %35, 42
br i1 %36, label %37, label %46
37: ; preds = %34
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%39 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
%41 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%42 = load i32, i32* %1
%43 = load i32, i32* %2
%44 = mul nsw i32 %43, %42
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i32 %42, i32 %43, i32 %44)
br label %46
46: ; preds = %37, %34
br label %6
}