#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 token {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int eval(struct token *, size_t, size_t *);
scalar_t__ get_next_token(struct token *);
int /*<<< orphan*/ printf(char *, int);
void execute(char *buf, size_t size) {
  struct token *tok = (struct token *)buf;
  assert((char *)get_next_token(tok) <= buf + size);
  size_t used;
  int res = eval(tok, size, &used);
  printf(" -> %d\n", res);
}


x86 assembly (clang, -O0):
<execute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <get_next_token@plt>
mov    -0x8(%rbp),%rcx
add    -0x10(%rbp),%rcx
cmp    %rcx,%rax
setbe  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1060 <eval@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1050 <get_next_token@plt>
lea    (%rbx,%r14,1),%rcx
xor    %edi,%edi
cmp    %rax,%rcx
setae  %dil
call   1040 <assert@plt>
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <eval@plt>
lea    0xe8a(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.token = type { i32 }
@.str = [8 x i8] c" -> %d\0A\00"
define void @execute(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca %struct.token*
%6 = alloca i64
%7 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to %struct.token*
store %struct.token* %9, %struct.token** %5
%10 = load %struct.token*, %struct.token** %5
%11 = call i64 @get_next_token(%struct.token* %10)
%12 = inttoptr i64 %11 to i8*
%13 = load i8*, i8** %3
%14 = load i64, i64* %4
%15 = getelementptr inbounds i8, i8* %13, i64 %14
%16 = icmp ule i8* %12, %15
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load %struct.token*, %struct.token** %5
%20 = load i64, i64* %4
%21 = call i32 @eval(%struct.token* %19, i64 %20, i64* %6)
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %22)
ret void
}

LLVM IR (-O2):
%struct.token = type { i32 }
@.str = [8 x i8] c" -> %d\0A\00"
define void @execute(i8* %0, i64 %1) {
%3 = alloca i64
%4 = bitcast i8* %0 to %struct.token*
%5 = tail call i64 @get_next_token(%struct.token* %4)
%6 = inttoptr i64 %5 to i8*
%7 = getelementptr inbounds i8, i8* %0, i64 %1
%8 = icmp uge i8* %7, %6
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = bitcast i64* %3 to i8*
%12 = call i32 @eval(%struct.token* %4, i64 %1, i64* %3)
%13 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %12)
ret void
}