#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*/ a_sint(char *);
int /*<<< orphan*/ print(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  char *input;
  if (argc == 2) {
    input = argv[1];
  } else {
    printf("Usage: ./calc \"mathematical expression to evaluate\"\n\tCurrently "
           "only +,-,*,/ with or without parenthesis are accepted.\n\tBoth "
           "integer and floating point expressions are acceptable.\n");
    return -1;
  }
  print(input, a_sint(input));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1161 <main+0x31>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1179 <main+0x49>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    119c <main+0x6c>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <a_sint@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1040 <print@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    1150 <main+0x20>
mov    0x8(%rsi),%rbx
mov    %rbx,%rdi
call   1050 <a_sint@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <print@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [180 x i8] c"Usage: ./calc \22mathematical expression to evaluate\22\0A\09Currently only +,-,*,/ with or without parenthesis are accepted.\0A\09Both integer and floating point expressions are acceptable.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
store i8* %12, i8** %6
br label %15
13: ; preds = %2
%14 = call i32 @printf(i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %20
15: ; preds = %9
%16 = load i8*, i8** %6
%17 = load i8*, i8** %6
%18 = call i32 @a_sint(i8* %17)
%19 = call i32 @print(i8* %16, i32 %18)
store i32 0, i32* %3
br label %20
20: ; preds = %15, %13
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@str = [179 x i8] c"Usage: ./calc \22mathematical expression to evaluate\22\0A\09Currently only +,-,*,/ with or without parenthesis are accepted.\0A\09Both integer and floating point expressions are acceptable.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @a_sint(i8* %6)
%8 = tail call i32 @print(i8* %6, i32 %7)
br label %11
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([179 x i8], [179 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %4, %9
%12 = phi i32 [ 0, %4 ], [ -1, %9 ]
ret i32 %12
}