#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*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  if (argc != 4)
    printf("Operators: +, -, x, / \nUsage: number1 operator number2\n");
  else {
    printf("\n");
    if (*argv[2] == '+')
      printf("%s %s %s = %d", argv[1], argv[2], argv[3],
             atoi(argv[1]) + atoi(argv[3]));
    if (*argv[2] == '-')
      printf("%s %s %s = %d", argv[1], argv[2], argv[3],
             atoi(argv[1]) - atoi(argv[3]));
    if (*argv[2] == 'x')
      printf("%s %s %s = %d", argv[1], argv[2], argv[3],
             atoi(argv[1]) * atoi(argv[3]));
    if (*argv[2] == '/') {
      if (atoi(argv[3]) == 0) {
        printf("Cannot divide by 0.");
        return 1;
      } else
        printf("%s %s %s = %d", argv[1], argv[2], argv[3],
               atoi(argv[1]) / atoi(argv[3]));
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     1156 <main+0x36>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1390 <main+0x270>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
jne    11da <main+0xba>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <atoi@plt>
mov    -0x2c(%rbp),%r8d
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
add    %eax,%r8d
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1250 <main+0x130>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <atoi@plt>
mov    -0x4c(%rbp),%r8d
mov    -0x48(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x38(%rbp),%rcx
sub    %eax,%r8d
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
cmp    $0x78,%eax
jne    12c7 <main+0x1a7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x68(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <atoi@plt>
mov    -0x6c(%rbp),%r8d
mov    -0x68(%rbp),%rsi
mov    -0x60(%rbp),%rdx
mov    -0x58(%rbp),%rcx
imul   %eax,%r8d
lea    0xd78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1382 <main+0x262>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <atoi@plt>
cmp    $0x0,%eax
jne    130b <main+0x1eb>
lea    0xd4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1397 <main+0x277>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x90(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x78(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x88(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x7c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <atoi@plt>
mov    -0x90(%rbp),%rsi
mov    -0x88(%rbp),%rcx
mov    %eax,%edi
mov    -0x7c(%rbp),%eax
cltd
idiv   %edi
mov    -0x78(%rbp),%rdx
mov    %eax,%r8d
lea    0xcc2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1382 <main+0x262>
lea    0xcad(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x4,%edi
jne    117e <main+0x3e>
mov    %rsi,%rbx
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x10(%rbx),%r14
mov    (%r14),%al
cmp    $0x2b,%al
je     118f <main+0x4f>
cmp    $0x2d,%al
je     11d0 <main+0x90>
cmp    $0x78,%al
je     1215 <main+0xd5>
cmp    $0x2f,%al
je     1257 <main+0x117>
jmp    1292 <main+0x152>
lea    0xe9d(%rip),%rdi
call   1040 <puts@plt>
jmp    129c <main+0x15c>
mov    0x8(%rbx),%r12
mov    0x18(%rbx),%r15
mov    %r12,%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1060 <atoi@plt>
add    %eax,%ebp
lea    0xe4e(%rip),%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %ebp,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rbx),%r14
mov    (%r14),%al
cmp    $0x2d,%al
jne    1169 <main+0x29>
mov    0x8(%rbx),%r12
mov    0x18(%rbx),%r15
mov    %r12,%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1060 <atoi@plt>
sub    %eax,%ebp
lea    0xe0d(%rip),%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %ebp,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rbx),%r14
mov    (%r14),%al
cmp    $0x78,%al
jne    1171 <main+0x31>
mov    0x8(%rbx),%r12
mov    0x18(%rbx),%r15
mov    %r12,%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1060 <atoi@plt>
imul   %eax,%ebp
lea    0xdc7(%rip),%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %ebp,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rbx),%r14
mov    (%r14),%al
cmp    $0x2f,%al
jne    1292 <main+0x152>
mov    0x18(%rbx),%r15
mov    %r15,%rdi
call   1060 <atoi@plt>
test   %eax,%eax
je     12a7 <main+0x167>
mov    %eax,%ebp
mov    0x8(%rbx),%rbx
mov    %rbx,%rdi
call   1060 <atoi@plt>
cltd
idiv   %ebp
lea    0xd81(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd60(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%eax
jmp    129e <main+0x15e>

LLVM IR (-O0):
@.str = [56 x i8] c"Operators: +, -, x, / \0AUsage: number1 operator number2\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [14 x i8] c"%s %s %s = %d\00"
@.str.3 = [20 x i8] c"Cannot divide by 0.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 4
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
br label %130
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 2
%14 = load i8*, i8** %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 43
br i1 %17, label %18, label %38
18: ; preds = %10
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 3
%27 = load i8*, i8** %26
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @atoi(i8* %30)
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 3
%34 = load i8*, i8** %33
%35 = call i32 @atoi(i8* %34)
%36 = add nsw i32 %31, %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %21, i8* %24, i8* %27, i32 %36)
br label %38
38: ; preds = %18, %10
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 45
br i1 %44, label %45, label %65
45: ; preds = %38
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 1
%48 = load i8*, i8** %47
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 2
%51 = load i8*, i8** %50
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 3
%54 = load i8*, i8** %53
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 1
%57 = load i8*, i8** %56
%58 = call i32 @atoi(i8* %57)
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 3
%61 = load i8*, i8** %60
%62 = call i32 @atoi(i8* %61)
%63 = sub nsw i32 %58, %62
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %48, i8* %51, i8* %54, i32 %63)
br label %65
65: ; preds = %45, %38
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 2
%68 = load i8*, i8** %67
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 120
br i1 %71, label %72, label %92
72: ; preds = %65
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 1
%75 = load i8*, i8** %74
%76 = load i8**, i8*** %5
%77 = getelementptr inbounds i8*, i8** %76, i64 2
%78 = load i8*, i8** %77
%79 = load i8**, i8*** %5
%80 = getelementptr inbounds i8*, i8** %79, i64 3
%81 = load i8*, i8** %80
%82 = load i8**, i8*** %5
%83 = getelementptr inbounds i8*, i8** %82, i64 1
%84 = load i8*, i8** %83
%85 = call i32 @atoi(i8* %84)
%86 = load i8**, i8*** %5
%87 = getelementptr inbounds i8*, i8** %86, i64 3
%88 = load i8*, i8** %87
%89 = call i32 @atoi(i8* %88)
%90 = mul nsw i32 %85, %89
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %75, i8* %78, i8* %81, i32 %90)
br label %92
92: ; preds = %72, %65
%93 = load i8**, i8*** %5
%94 = getelementptr inbounds i8*, i8** %93, i64 2
%95 = load i8*, i8** %94
%96 = load i8, i8* %95
%97 = sext i8 %96 to i32
%98 = icmp eq i32 %97, 47
br i1 %98, label %99, label %128
99: ; preds = %92
%100 = load i8**, i8*** %5
%101 = getelementptr inbounds i8*, i8** %100, i64 3
%102 = load i8*, i8** %101
%103 = call i32 @atoi(i8* %102)
%104 = icmp eq i32 %103, 0
br i1 %104, label %105, label %107
105: ; preds = %99
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %131
107: ; preds = %99
%108 = load i8**, i8*** %5
%109 = getelementptr inbounds i8*, i8** %108, i64 1
%110 = load i8*, i8** %109
%111 = load i8**, i8*** %5
%112 = getelementptr inbounds i8*, i8** %111, i64 2
%113 = load i8*, i8** %112
%114 = load i8**, i8*** %5
%115 = getelementptr inbounds i8*, i8** %114, i64 3
%116 = load i8*, i8** %115
%117 = load i8**, i8*** %5
%118 = getelementptr inbounds i8*, i8** %117, i64 1
%119 = load i8*, i8** %118
%120 = call i32 @atoi(i8* %119)
%121 = load i8**, i8*** %5
%122 = getelementptr inbounds i8*, i8** %121, i64 3
%123 = load i8*, i8** %122
%124 = call i32 @atoi(i8* %123)
%125 = sdiv i32 %120, %124
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %110, i8* %113, i8* %116, i32 %125)
br label %127
127: ; preds = %107
br label %128
128: ; preds = %127, %92
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %130
130: ; preds = %128, %8
store i32 0, i32* %3
br label %131
131: ; preds = %130, %105
%132 = load i32, i32* %3
ret i32 %132
}

LLVM IR (-O2):
@.str.2 = [14 x i8] c"%s %s %s = %d\00"
@.str.3 = [20 x i8] c"Cannot divide by 0.\00"
@str = [55 x i8] c"Operators: +, -, x, / \0AUsage: number1 operator number2\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
br label %72
6: ; preds = %2
%7 = tail call i32 @putchar(i32 10)
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 43
br i1 %11, label %12, label %23
12: ; preds = %6
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8*, i8** %1, i64 3
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %14)
%18 = tail call i32 @atoi(i8* %16)
%19 = add nsw i32 %18, %17
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %14, i8* %9, i8* %16, i32 %19)
%21 = load i8*, i8** %8
%22 = load i8, i8* %21
br label %23
23: ; preds = %12, %6
%24 = phi i8 [ %22, %12 ], [ %10, %6 ]
%25 = phi i8* [ %21, %12 ], [ %9, %6 ]
%26 = icmp eq i8 %24, 45
br i1 %26, label %27, label %38
27: ; preds = %23
%28 = getelementptr inbounds i8*, i8** %1, i64 1
%29 = load i8*, i8** %28
%30 = getelementptr inbounds i8*, i8** %1, i64 3
%31 = load i8*, i8** %30
%32 = tail call i32 @atoi(i8* %29)
%33 = tail call i32 @atoi(i8* %31)
%34 = sub nsw i32 %32, %33
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %29, i8* %25, i8* %31, i32 %34)
%36 = load i8*, i8** %8
%37 = load i8, i8* %36
br label %38
38: ; preds = %27, %23
%39 = phi i8 [ %37, %27 ], [ %24, %23 ]
%40 = phi i8* [ %36, %27 ], [ %25, %23 ]
%41 = icmp eq i8 %39, 120
br i1 %41, label %42, label %53
42: ; preds = %38
%43 = getelementptr inbounds i8*, i8** %1, i64 1
%44 = load i8*, i8** %43
%45 = getelementptr inbounds i8*, i8** %1, i64 3
%46 = load i8*, i8** %45
%47 = tail call i32 @atoi(i8* %44)
%48 = tail call i32 @atoi(i8* %46)
%49 = mul nsw i32 %48, %47
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %44, i8* %40, i8* %46, i32 %49)
%51 = load i8*, i8** %8
%52 = load i8, i8* %51
br label %53
53: ; preds = %42, %38
%54 = phi i8 [ %52, %42 ], [ %39, %38 ]
%55 = phi i8* [ %51, %42 ], [ %40, %38 ]
%56 = icmp eq i8 %54, 47
br i1 %56, label %57, label %70
57: ; preds = %53
%58 = getelementptr inbounds i8*, i8** %1, i64 3
%59 = load i8*, i8** %58
%60 = tail call i32 @atoi(i8* %59)
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %57
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %72
64: ; preds = %57
%65 = getelementptr inbounds i8*, i8** %1, i64 1
%66 = load i8*, i8** %65
%67 = tail call i32 @atoi(i8* %66)
%68 = sdiv i32 %67, %60
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %66, i8* %55, i8* %59, i32 %68)
br label %70
70: ; preds = %64, %53
%71 = tail call i32 @putchar(i32 10)
br label %72
72: ; preds = %4, %70, %62
%73 = phi i32 [ 1, %62 ], [ 0, %70 ], [ 0, %4 ]
ret i32 %73
}