#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 %c %s = %d", argv[1], *argv[2], argv[3],
             atoi(argv[1]) + atoi(argv[3]));
    if (*argv[2] == '-')
      printf("%s %c %s = %d", argv[1], *argv[2], argv[3],
             atoi(argv[1]) - atoi(argv[3]));
    if (*argv[2] == 'x')
      printf("%s %c %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 %c %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    138e <main+0x26e>
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    11db <main+0xbb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
mov    %eax,-0x1c(%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    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rcx
add    %eax,%r8d
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1252 <main+0x132>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
mov    %eax,-0x3c(%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    -0x3c(%rbp),%edx
mov    -0x38(%rbp),%rcx
sub    %eax,%r8d
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
cmp    $0x78,%eax
jne    12ca <main+0x1aa>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x68(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
mov    %eax,-0x5c(%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    -0x5c(%rbp),%edx
mov    -0x58(%rbp),%rcx
imul   %eax,%r8d
lea    0xd75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1380 <main+0x260>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <atoi@plt>
cmp    $0x0,%eax
jne    130e <main+0x1ee>
lea    0xd4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1395 <main+0x275>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x88(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
mov    %eax,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x80(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x74(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <atoi@plt>
mov    -0x88(%rbp),%rsi
mov    -0x80(%rbp),%rcx
mov    %eax,%edi
mov    -0x74(%rbp),%eax
cltd
idiv   %edi
mov    -0x70(%rbp),%edx
mov    %eax,%r8d
lea    0xcc4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1380 <main+0x260>
lea    0xcaf(%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   %rbx
push   %rax
cmp    $0x4,%edi
jne    117c <main+0x3c>
mov    %rsi,%rbx
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x10(%rbx),%rax
mov    (%rax),%al
cmp    $0x2b,%al
je     118d <main+0x4d>
cmp    $0x2d,%al
je     11cf <main+0x8f>
cmp    $0x78,%al
je     1215 <main+0xd5>
cmp    $0x2f,%al
je     1258 <main+0x118>
jmp    1295 <main+0x155>
lea    0xe9f(%rip),%rdi
call   1040 <puts@plt>
jmp    129f <main+0x15f>
mov    0x8(%rbx),%r15
mov    0x18(%rbx),%r14
mov    %r15,%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1060 <atoi@plt>
add    %eax,%ebp
lea    0xe50(%rip),%rdi
mov    %r15,%rsi
mov    $0x2b,%edx
mov    %r14,%rcx
mov    %ebp,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rbx),%rax
mov    (%rax),%al
cmp    $0x2d,%al
jne    1167 <main+0x27>
mov    0x8(%rbx),%r15
mov    0x18(%rbx),%r14
mov    %r15,%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1060 <atoi@plt>
sub    %eax,%ebp
lea    0xe0e(%rip),%rdi
mov    %r15,%rsi
mov    $0x2d,%edx
mov    %r14,%rcx
mov    %ebp,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rbx),%rax
mov    (%rax),%al
cmp    $0x78,%al
jne    116f <main+0x2f>
mov    0x8(%rbx),%r15
mov    0x18(%rbx),%r14
mov    %r15,%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1060 <atoi@plt>
imul   %eax,%ebp
lea    0xdc7(%rip),%rdi
mov    %r15,%rsi
mov    $0x78,%edx
mov    %r14,%rcx
mov    %ebp,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rbx),%rax
mov    (%rax),%al
cmp    $0x2f,%al
jne    1295 <main+0x155>
mov    0x18(%rbx),%r14
mov    %r14,%rdi
call   1060 <atoi@plt>
test   %eax,%eax
je     12ac <main+0x16c>
mov    %eax,%ebp
mov    0x8(%rbx),%rbx
mov    %rbx,%rdi
call   1060 <atoi@plt>
cltd
idiv   %ebp
lea    0xd80(%rip),%rdi
mov    %rbx,%rsi
mov    $0x2f,%edx
mov    %r14,%rcx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd5b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%eax
jmp    12a1 <main+0x161>

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 %c %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 %138
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 %40
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* %24
%26 = sext i8 %25 to i32
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 3
%29 = load i8*, i8** %28
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i32 @atoi(i8* %32)
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 3
%36 = load i8*, i8** %35
%37 = call i32 @atoi(i8* %36)
%38 = add nsw i32 %33, %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %21, i32 %26, i8* %29, i32 %38)
br label %40
40: ; preds = %18, %10
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 2
%43 = load i8*, i8** %42
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 45
br i1 %46, label %47, label %69
47: ; preds = %40
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 2
%53 = load i8*, i8** %52
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 3
%58 = load i8*, i8** %57
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 1
%61 = load i8*, i8** %60
%62 = call i32 @atoi(i8* %61)
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 3
%65 = load i8*, i8** %64
%66 = call i32 @atoi(i8* %65)
%67 = sub nsw i32 %62, %66
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %50, i32 %55, i8* %58, i32 %67)
br label %69
69: ; preds = %47, %40
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 2
%72 = load i8*, i8** %71
%73 = load i8, i8* %72
%74 = sext i8 %73 to i32
%75 = icmp eq i32 %74, 120
br i1 %75, label %76, label %98
76: ; preds = %69
%77 = load i8**, i8*** %5
%78 = getelementptr inbounds i8*, i8** %77, i64 1
%79 = load i8*, i8** %78
%80 = load i8**, i8*** %5
%81 = getelementptr inbounds i8*, i8** %80, i64 2
%82 = load i8*, i8** %81
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = load i8**, i8*** %5
%86 = getelementptr inbounds i8*, i8** %85, i64 3
%87 = load i8*, i8** %86
%88 = load i8**, i8*** %5
%89 = getelementptr inbounds i8*, i8** %88, i64 1
%90 = load i8*, i8** %89
%91 = call i32 @atoi(i8* %90)
%92 = load i8**, i8*** %5
%93 = getelementptr inbounds i8*, i8** %92, i64 3
%94 = load i8*, i8** %93
%95 = call i32 @atoi(i8* %94)
%96 = mul nsw i32 %91, %95
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %79, i32 %84, i8* %87, i32 %96)
br label %98
98: ; preds = %76, %69
%99 = load i8**, i8*** %5
%100 = getelementptr inbounds i8*, i8** %99, i64 2
%101 = load i8*, i8** %100
%102 = load i8, i8* %101
%103 = sext i8 %102 to i32
%104 = icmp eq i32 %103, 47
br i1 %104, label %105, label %136
105: ; preds = %98
%106 = load i8**, i8*** %5
%107 = getelementptr inbounds i8*, i8** %106, i64 3
%108 = load i8*, i8** %107
%109 = call i32 @atoi(i8* %108)
%110 = icmp eq i32 %109, 0
br i1 %110, label %111, label %113
111: ; preds = %105
%112 = 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 %139
113: ; preds = %105
%114 = load i8**, i8*** %5
%115 = getelementptr inbounds i8*, i8** %114, i64 1
%116 = load i8*, i8** %115
%117 = load i8**, i8*** %5
%118 = getelementptr inbounds i8*, i8** %117, i64 2
%119 = load i8*, i8** %118
%120 = load i8, i8* %119
%121 = sext i8 %120 to i32
%122 = load i8**, i8*** %5
%123 = getelementptr inbounds i8*, i8** %122, i64 3
%124 = load i8*, i8** %123
%125 = load i8**, i8*** %5
%126 = getelementptr inbounds i8*, i8** %125, i64 1
%127 = load i8*, i8** %126
%128 = call i32 @atoi(i8* %127)
%129 = load i8**, i8*** %5
%130 = getelementptr inbounds i8*, i8** %129, i64 3
%131 = load i8*, i8** %130
%132 = call i32 @atoi(i8* %131)
%133 = sdiv i32 %128, %132
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %116, i32 %121, i8* %124, i32 %133)
br label %135
135: ; preds = %113
br label %136
136: ; preds = %135, %98
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %138
138: ; preds = %136, %8
store i32 0, i32* %3
br label %139
139: ; preds = %138, %111
%140 = load i32, i32* %3
ret i32 %140
}

LLVM IR (-O2):
@.str.2 = [14 x i8] c"%s %c %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 %69
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, i32 43, 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 = icmp eq i8 %24, 45
br i1 %25, label %26, label %37
26: ; preds = %23
%27 = getelementptr inbounds i8*, i8** %1, i64 1
%28 = load i8*, i8** %27
%29 = getelementptr inbounds i8*, i8** %1, i64 3
%30 = load i8*, i8** %29
%31 = tail call i32 @atoi(i8* %28)
%32 = tail call i32 @atoi(i8* %30)
%33 = sub nsw i32 %31, %32
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %28, i32 45, i8* %30, i32 %33)
%35 = load i8*, i8** %8
%36 = load i8, i8* %35
br label %37
37: ; preds = %26, %23
%38 = phi i8 [ %36, %26 ], [ %24, %23 ]
%39 = icmp eq i8 %38, 120
br i1 %39, label %40, label %51
40: ; preds = %37
%41 = getelementptr inbounds i8*, i8** %1, i64 1
%42 = load i8*, i8** %41
%43 = getelementptr inbounds i8*, i8** %1, i64 3
%44 = load i8*, i8** %43
%45 = tail call i32 @atoi(i8* %42)
%46 = tail call i32 @atoi(i8* %44)
%47 = mul nsw i32 %46, %45
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %42, i32 120, i8* %44, i32 %47)
%49 = load i8*, i8** %8
%50 = load i8, i8* %49
br label %51
51: ; preds = %40, %37
%52 = phi i8 [ %50, %40 ], [ %38, %37 ]
%53 = icmp eq i8 %52, 47
br i1 %53, label %54, label %67
54: ; preds = %51
%55 = getelementptr inbounds i8*, i8** %1, i64 3
%56 = load i8*, i8** %55
%57 = tail call i32 @atoi(i8* %56)
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %54
%60 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %69
61: ; preds = %54
%62 = getelementptr inbounds i8*, i8** %1, i64 1
%63 = load i8*, i8** %62
%64 = tail call i32 @atoi(i8* %63)
%65 = sdiv i32 %64, %57
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %63, i32 47, i8* %56, i32 %65)
br label %67
67: ; preds = %61, %51
%68 = tail call i32 @putchar(i32 10)
br label %69
69: ; preds = %4, %67, %59
%70 = phi i32 [ 1, %59 ], [ 0, %67 ], [ 0, %4 ]
ret i32 %70
}