#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*/ assert(int);
void *create_addition(void *, void *);
void *create_literal(int);
void *create_negation(void *);
int /*<<< orphan*/ dispose_expression(void *);
int evaluate(void *);
int main() {
  void *e1 = create_literal(1);
  void *e2 = create_literal(5);
  void *e3 = create_literal(3);
  void *e4 = create_addition(e2, e3);
  void *e5 = create_negation(e4);
  void *e6 = create_addition(e1, e5);
  int value = evaluate(e6);
  assert(value == 0 - 7);
  dispose_expression(e6);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1070 <create_literal@plt>
mov    %rax,-0x10(%rbp)
mov    $0x5,%edi
call   1070 <create_literal@plt>
mov    %rax,-0x18(%rbp)
mov    $0x3,%edi
call   1070 <create_literal@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <create_addition@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1080 <create_negation@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <create_addition@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1060 <evaluate@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0xfffffff9,-0x3c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x38(%rbp),%rdi
call   1050 <dispose_expression@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%edi
call   1070 <create_literal@plt>
mov    %rax,%r14
mov    $0x5,%edi
call   1070 <create_literal@plt>
mov    %rax,%rbx
mov    $0x3,%edi
call   1070 <create_literal@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <create_addition@plt>
mov    %rax,%rdi
call   1080 <create_negation@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <create_addition@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <evaluate@plt>
xor    %edi,%edi
cmp    $0xfffffff9,%eax
sete   %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1050 <dispose_expression@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %1
%9 = call i8* @create_literal(i32 1)
store i8* %9, i8** %2
%10 = call i8* @create_literal(i32 5)
store i8* %10, i8** %3
%11 = call i8* @create_literal(i32 3)
store i8* %11, i8** %4
%12 = load i8*, i8** %3
%13 = load i8*, i8** %4
%14 = call i8* @create_addition(i8* %12, i8* %13)
store i8* %14, i8** %5
%15 = load i8*, i8** %5
%16 = call i8* @create_negation(i8* %15)
store i8* %16, i8** %6
%17 = load i8*, i8** %2
%18 = load i8*, i8** %6
%19 = call i8* @create_addition(i8* %17, i8* %18)
store i8* %19, i8** %7
%20 = load i8*, i8** %7
%21 = call i32 @evaluate(i8* %20)
store i32 %21, i32* %8
%22 = load i32, i32* %8
%23 = icmp eq i32 %22, -7
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = load i8*, i8** %7
%27 = call i32 @dispose_expression(i8* %26)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i8* @create_literal(i32 1)
%2 = tail call i8* @create_literal(i32 5)
%3 = tail call i8* @create_literal(i32 3)
%4 = tail call i8* @create_addition(i8* %2, i8* %3)
%5 = tail call i8* @create_negation(i8* %4)
%6 = tail call i8* @create_addition(i8* %1, i8* %5)
%7 = tail call i32 @evaluate(i8* %6)
%8 = icmp eq i32 %7, -7
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = tail call i32 @dispose_expression(i8* %6)
ret i32 0
}