#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 VAL_cell {
  int dummy;
};
struct AST_tree {
  int dummy;
};
struct AST_parser {
  int dummy;
};

/* Variables and functions */
struct AST_tree *AST_parser_parse(struct AST_parser *);
struct VAL_cell *AST_tree_eval(struct AST_tree *, int /*<<< orphan*/ *);
int /*<<< orphan*/ VAL_cell_print(struct VAL_cell *);
int /*<<< orphan*/ del_AST_parser(struct AST_parser *);
int /*<<< orphan*/ del_AST_tree(struct AST_tree *);
int /*<<< orphan*/ del_VAL_cell(struct VAL_cell *);
struct AST_parser *new_AST_parser(char *);
int execute(char *buf) {
  struct AST_parser *x = new_AST_parser(buf);
  struct AST_tree *tree = AST_parser_parse(x);
  if (!tree) {
    del_AST_parser(x);
    return 0;
  }
  struct VAL_cell *result = AST_tree_eval(tree, NULL);
  VAL_cell_print(result);
  del_AST_tree(tree);
  del_AST_parser(x);
  del_VAL_cell(result);
  return 0;
}


x86 assembly (clang, -O0):
<execute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <new_AST_parser@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1090 <AST_parser_parse@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11b6 <execute+0x46>
mov    -0x18(%rbp),%rdi
call   1060 <del_AST_parser@plt>
movl   $0x0,-0x4(%rbp)
jmp    11f2 <execute+0x82>
mov    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <AST_tree_eval@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <VAL_cell_print@plt>
mov    -0x20(%rbp),%rdi
call   1050 <del_AST_tree@plt>
mov    -0x18(%rbp),%rdi
call   1060 <del_AST_parser@plt>
mov    -0x28(%rbp),%rdi
call   1030 <del_VAL_cell@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute>:
push   %r15
push   %r14
push   %rbx
call   1080 <new_AST_parser@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1090 <AST_parser_parse@plt>
test   %rax,%rax
je     11bc <execute+0x4c>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
call   1070 <AST_tree_eval@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1040 <VAL_cell_print@plt>
mov    %rbx,%rdi
call   1050 <del_AST_tree@plt>
mov    %r14,%rdi
call   1060 <del_AST_parser@plt>
mov    %r15,%rdi
call   1030 <del_VAL_cell@plt>
jmp    11c4 <execute+0x54>
mov    %r14,%rdi
call   1060 <del_AST_parser@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.AST_parser = type { i32 }
%struct.AST_tree = type { i32 }
%struct.VAL_cell = type { i32 }
define i32 @execute(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.AST_parser*
%5 = alloca %struct.AST_tree*
%6 = alloca %struct.VAL_cell*
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = call %struct.AST_parser* @new_AST_parser(i8* %7)
store %struct.AST_parser* %8, %struct.AST_parser** %4
%9 = load %struct.AST_parser*, %struct.AST_parser** %4
%10 = call %struct.AST_tree* @AST_parser_parse(%struct.AST_parser* %9)
store %struct.AST_tree* %10, %struct.AST_tree** %5
%11 = load %struct.AST_tree*, %struct.AST_tree** %5
%12 = icmp ne %struct.AST_tree* %11, null
br i1 %12, label %16, label %13
13: ; preds = %1
%14 = load %struct.AST_parser*, %struct.AST_parser** %4
%15 = call i32 @del_AST_parser(%struct.AST_parser* %14)
store i32 0, i32* %2
br label %27
16: ; preds = %1
%17 = load %struct.AST_tree*, %struct.AST_tree** %5
%18 = call %struct.VAL_cell* @AST_tree_eval(%struct.AST_tree* %17, i32* null)
store %struct.VAL_cell* %18, %struct.VAL_cell** %6
%19 = load %struct.VAL_cell*, %struct.VAL_cell** %6
%20 = call i32 @VAL_cell_print(%struct.VAL_cell* %19)
%21 = load %struct.AST_tree*, %struct.AST_tree** %5
%22 = call i32 @del_AST_tree(%struct.AST_tree* %21)
%23 = load %struct.AST_parser*, %struct.AST_parser** %4
%24 = call i32 @del_AST_parser(%struct.AST_parser* %23)
%25 = load %struct.VAL_cell*, %struct.VAL_cell** %6
%26 = call i32 @del_VAL_cell(%struct.VAL_cell* %25)
store i32 0, i32* %2
br label %27
27: ; preds = %16, %13
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
%struct.AST_parser = type { i32 }
%struct.AST_tree = type { i32 }
%struct.VAL_cell = type { i32 }
define i32 @execute(i8* %0) {
%2 = tail call %struct.AST_parser* @new_AST_parser(i8* %0)
%3 = tail call %struct.AST_tree* @AST_parser_parse(%struct.AST_parser* %2)
%4 = icmp eq %struct.AST_tree* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @del_AST_parser(%struct.AST_parser* %2)
br label %13
7: ; preds = %1
%8 = tail call %struct.VAL_cell* @AST_tree_eval(%struct.AST_tree* %3, i32* null)
%9 = tail call i32 @VAL_cell_print(%struct.VAL_cell* %8)
%10 = tail call i32 @del_AST_tree(%struct.AST_tree* %3)
%11 = tail call i32 @del_AST_parser(%struct.AST_parser* %2)
%12 = tail call i32 @del_VAL_cell(%struct.VAL_cell* %8)
br label %13
13: ; preds = %7, %5
ret i32 0
}