#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*/ eval_expr(char *);
int /*<<< orphan*/ my_putchar(char);
int /*<<< orphan*/ my_putnbr(int /*<<< orphan*/);
int /*<<< orphan*/ my_putstr_error(char *);
int my_str_isnum_ope(char *);
int main(int ac, char **av) {
  if (my_str_isnum_ope(av[1]) == 1) {
    my_putstr_error("The argument must only contain digits and operators\n");
    return (84);
  }
  if (ac == 2) {
    my_putnbr(eval_expr(av[1]));
    my_putchar('\n');
  } else {
    my_putstr_error("Invalid number of arguments\n");
    return (84);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <my_str_isnum_ope@plt>
cmp    $0x1,%eax
jne    1194 <main+0x44>
lea    0xe7d(%rip),%rdi
call   1040 <my_putstr_error@plt>
movl   $0x54,-0x4(%rbp)
jmp    11e0 <main+0x90>
cmpl   $0x2,-0x8(%rbp)
jne    11c1 <main+0x71>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <eval_expr@plt>
mov    %eax,%edi
call   1070 <my_putnbr@plt>
mov    $0xa,%edi
call   1050 <my_putchar@plt>
jmp    11d9 <main+0x89>
lea    0xe6d(%rip),%rdi
call   1040 <my_putstr_error@plt>
movl   $0x54,-0x4(%rbp)
jmp    11e0 <main+0x90>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
call   1030 <my_str_isnum_ope@plt>
cmp    $0x1,%eax
jne    116f <main+0x1f>
lea    0xe93(%rip),%rdi
jmp    1199 <main+0x49>
cmp    $0x2,%ebp
jne    1192 <main+0x42>
mov    0x8(%rbx),%rdi
call   1060 <eval_expr@plt>
mov    %eax,%edi
call   1070 <my_putnbr@plt>
mov    $0xa,%edi
call   1050 <my_putchar@plt>
xor    %eax,%eax
jmp    11a3 <main+0x53>
lea    0xe9c(%rip),%rdi
call   1040 <my_putstr_error@plt>
mov    $0x54,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [53 x i8] c"The argument must only contain digits and operators\0A\00"
@.str.1 = [29 x i8] c"Invalid number of arguments\0A\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 i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @my_str_isnum_ope(i8* %8)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @my_putstr_error(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
store i32 84, i32* %3
br label %26
13: ; preds = %2
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %23
16: ; preds = %13
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @eval_expr(i8* %19)
%21 = call i32 @my_putnbr(i32 %20)
%22 = call i32 @my_putchar(i8 signext 10)
br label %25
23: ; preds = %13
%24 = call i32 @my_putstr_error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
store i32 84, i32* %3
br label %26
25: ; preds = %16
store i32 0, i32* %3
br label %26
26: ; preds = %25, %23, %11
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [53 x i8] c"The argument must only contain digits and operators\0A\00"
@.str.1 = [29 x i8] c"Invalid number of arguments\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @my_str_isnum_ope(i8* %4)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @my_putstr_error(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
br label %18
9: ; preds = %2
%10 = icmp eq i32 %0, 2
br i1 %10, label %11, label %16
11: ; preds = %9
%12 = load i8*, i8** %3
%13 = tail call i32 @eval_expr(i8* %12)
%14 = tail call i32 @my_putnbr(i32 %13)
%15 = tail call i32 @my_putchar(i8 signext 10)
br label %18
16: ; preds = %9
%17 = tail call i32 @my_putstr_error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %11, %16, %7
%19 = phi i32 [ 84, %7 ], [ 0, %11 ], [ 84, %16 ]
ret i32 %19
}