#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 */
struct tree {
  int dummy;
};

/* Variables and functions */
struct tree *eval_affectation(char *, int *);
struct tree *eval_brace(char **, int *);
struct tree *eval_float(char *);
struct tree *eval_function(char *, int *);
struct tree *eval_operator(char *, int *);
struct tree *eval_variable(char *);
struct tree *eval(char *expr, int *error) {
  struct tree *tree = NULL;
  if (*expr == '\0')
    *error = 1;
  if (*error == 0) {
    if ((tree = eval_brace(&expr, error)))
      ;
    else if ((tree = eval_function(expr, error)))
      ;
    else if ((tree = eval_affectation(expr, error)))
      ;
    else if ((tree = eval_float(expr)))
      ;
    else if ((tree = eval_variable(expr)))
      ;
    else if ((tree = eval_operator(expr, error)))
      ;
    else {
      *error = 1;
    }
  }
  return tree;
}


x86 assembly (clang, -O0):
<eval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1192 <eval+0x32>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jne    127f <eval+0x11f>
mov    -0x10(%rbp),%rsi
lea    -0x8(%rbp),%rdi
call   1080 <eval_brace@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11bf <eval+0x5f>
jmp    127a <eval+0x11a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <eval_function@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11df <eval+0x7f>
jmp    1275 <eval+0x115>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <eval_affectation@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11ff <eval+0x9f>
jmp    1270 <eval+0x110>
mov    -0x8(%rbp),%rdi
call   1040 <eval_float@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     121b <eval+0xbb>
jmp    126b <eval+0x10b>
mov    -0x8(%rbp),%rdi
call   1030 <eval_variable@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1237 <eval+0xd7>
jmp    1266 <eval+0x106>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <eval_operator@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1257 <eval+0xf7>
jmp    1261 <eval+0x101>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    1266 <eval+0x106>
jmp    126b <eval+0x10b>
jmp    1270 <eval+0x110>
jmp    1275 <eval+0x115>
jmp    127a <eval+0x11a>
jmp    127f <eval+0x11f>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eval>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,0x8(%rsp)
cmpb   $0x0,(%rdi)
je     11dd <eval+0x7d>
cmpl   $0x0,(%rbx)
jne    11e3 <eval+0x83>
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1080 <eval_brace@plt>
test   %rax,%rax
jne    11e5 <eval+0x85>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1050 <eval_function@plt>
test   %rax,%rax
jne    11e5 <eval+0x85>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1070 <eval_affectation@plt>
test   %rax,%rax
jne    11e5 <eval+0x85>
mov    0x8(%rsp),%rdi
call   1040 <eval_float@plt>
test   %rax,%rax
jne    11e5 <eval+0x85>
mov    0x8(%rsp),%rdi
call   1030 <eval_variable@plt>
test   %rax,%rax
jne    11e5 <eval+0x85>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1060 <eval_operator@plt>
test   %rax,%rax
jne    11e5 <eval+0x85>
movl   $0x1,(%rbx)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tree = type { i32 }
define %struct.tree* @eval(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca %struct.tree*
store i8* %0, i8** %3
store i32* %1, i32** %4
store %struct.tree* null, %struct.tree** %5
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i32*, i32** %4
store i32 1, i32* %11
br label %12
12: ; preds = %10, %2
%13 = load i32*, i32** %4
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %57
16: ; preds = %12
%17 = load i32*, i32** %4
%18 = call %struct.tree* @eval_brace(i8** %3, i32* %17)
store %struct.tree* %18, %struct.tree** %5
%19 = icmp ne %struct.tree* %18, null
br i1 %19, label %20, label %21
20: ; preds = %16
br label %56
21: ; preds = %16
%22 = load i8*, i8** %3
%23 = load i32*, i32** %4
%24 = call %struct.tree* @eval_function(i8* %22, i32* %23)
store %struct.tree* %24, %struct.tree** %5
%25 = icmp ne %struct.tree* %24, null
br i1 %25, label %26, label %27
26: ; preds = %21
br label %55
27: ; preds = %21
%28 = load i8*, i8** %3
%29 = load i32*, i32** %4
%30 = call %struct.tree* @eval_affectation(i8* %28, i32* %29)
store %struct.tree* %30, %struct.tree** %5
%31 = icmp ne %struct.tree* %30, null
br i1 %31, label %32, label %33
32: ; preds = %27
br label %54
33: ; preds = %27
%34 = load i8*, i8** %3
%35 = call %struct.tree* @eval_float(i8* %34)
store %struct.tree* %35, %struct.tree** %5
%36 = icmp ne %struct.tree* %35, null
br i1 %36, label %37, label %38
37: ; preds = %33
br label %53
38: ; preds = %33
%39 = load i8*, i8** %3
%40 = call %struct.tree* @eval_variable(i8* %39)
store %struct.tree* %40, %struct.tree** %5
%41 = icmp ne %struct.tree* %40, null
br i1 %41, label %42, label %43
42: ; preds = %38
br label %52
43: ; preds = %38
%44 = load i8*, i8** %3
%45 = load i32*, i32** %4
%46 = call %struct.tree* @eval_operator(i8* %44, i32* %45)
store %struct.tree* %46, %struct.tree** %5
%47 = icmp ne %struct.tree* %46, null
br i1 %47, label %48, label %49
48: ; preds = %43
br label %51
49: ; preds = %43
%50 = load i32*, i32** %4
store i32 1, i32* %50
br label %51
51: ; preds = %49, %48
br label %52
52: ; preds = %51, %42
br label %53
53: ; preds = %52, %37
br label %54
54: ; preds = %53, %32
br label %55
55: ; preds = %54, %26
br label %56
56: ; preds = %55, %20
br label %57
57: ; preds = %56, %12
%58 = load %struct.tree*, %struct.tree** %5
ret %struct.tree* %58
}

LLVM IR (-O2):
%struct.tree = type { i32 }
define %struct.tree* @eval(i8* %0, i32* %1) {
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %32, label %6
6: ; preds = %2
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %33
9: ; preds = %6
%10 = call %struct.tree* @eval_brace(i8** %3, i32* %1)
%11 = icmp eq %struct.tree* %10, null
br i1 %11, label %12, label %33
12: ; preds = %9
%13 = load i8*, i8** %3
%14 = call %struct.tree* @eval_function(i8* %13, i32* %1)
%15 = icmp eq %struct.tree* %14, null
br i1 %15, label %16, label %33
16: ; preds = %12
%17 = load i8*, i8** %3
%18 = call %struct.tree* @eval_affectation(i8* %17, i32* %1)
%19 = icmp eq %struct.tree* %18, null
br i1 %19, label %20, label %33
20: ; preds = %16
%21 = load i8*, i8** %3
%22 = call %struct.tree* @eval_float(i8* %21)
%23 = icmp eq %struct.tree* %22, null
br i1 %23, label %24, label %33
24: ; preds = %20
%25 = load i8*, i8** %3
%26 = call %struct.tree* @eval_variable(i8* %25)
%27 = icmp eq %struct.tree* %26, null
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = load i8*, i8** %3
%30 = call %struct.tree* @eval_operator(i8* %29, i32* %1)
%31 = icmp eq %struct.tree* %30, null
br i1 %31, label %32, label %33
32: ; preds = %28, %2
store i32 1, i32* %1
br label %33
33: ; preds = %32, %9, %16, %24, %28, %20, %12, %6
%34 = phi %struct.tree* [ %10, %9 ], [ %14, %12 ], [ %18, %16 ], [ %22, %20 ], [ %26, %24 ], [ %30, %28 ], [ null, %6 ], [ null, %32 ]
ret %struct.tree* %34
}