#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 */
char *eval_expr(char *, char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ my_putchar(char);
int /*<<< orphan*/ my_putstr(char *);
char *my_strcldup(char *);
int /*<<< orphan*/ my_strlen(char *);
int main(int argc, char **argv) {
  char *str;
  char *argv1;
  argv1 = my_strcldup(argv[1]);
  str = eval_expr("0123456789", "()+-*/%", argv1, my_strlen(argv[1]));
  if (str != NULL)
    my_putstr(str);
  my_putchar('\n');
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <my_strcldup@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <my_strlen@plt>
mov    -0x28(%rbp),%rdx
mov    %eax,%ecx
lea    0xe67(%rip),%rdi
lea    0xe6b(%rip),%rsi
call   1070 <eval_expr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11bd <main+0x6d>
mov    -0x18(%rbp),%rdi
call   1050 <my_putstr@plt>
mov    $0xa,%edi
call   1040 <my_putchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1060 <my_strcldup@plt>
mov    %rax,%r14
mov    0x8(%rbx),%rdi
call   1030 <my_strlen@plt>
lea    0xe8d(%rip),%rdi
lea    0xe91(%rip),%rsi
mov    %r14,%rdx
mov    %eax,%ecx
call   1070 <eval_expr@plt>
test   %rax,%rax
je     1191 <main+0x41>
mov    %rax,%rdi
call   1050 <my_putstr@plt>
mov    $0xa,%edi
call   1040 <my_putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c"0123456789\00"
@.str.1 = [8 x i8] c"()+-*/%\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i8* @my_strcldup(i8* %10)
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @my_strlen(i8* %15)
%17 = call i8* @eval_expr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %12, i32 %16)
store i8* %17, i8** %6
%18 = load i8*, i8** %6
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %23
20: ; preds = %2
%21 = load i8*, i8** %6
%22 = call i32 @my_putstr(i8* %21)
br label %23
23: ; preds = %20, %2
%24 = call i32 @my_putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"0123456789\00"
@.str.1 = [8 x i8] c"()+-*/%\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 i8* @my_strcldup(i8* %4)
%6 = load i8*, i8** %3
%7 = tail call i32 @my_strlen(i8* %6)
%8 = tail call i8* @eval_expr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %5, i32 %7)
%9 = icmp eq i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = tail call i32 @my_putstr(i8* %8)
br label %12
12: ; preds = %10, %2
%13 = tail call i32 @my_putchar(i8 signext 10)
ret i32 0
}