#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 */
typedef int /*<<< orphan*/ rpn1;
typedef int /*<<< orphan*/ rpn0;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int evalRPN(char **, int);
int main() {
  char *rpn0[] = {"2", "1", "+", "3", "*"};
  int len0 = sizeof(rpn0) / sizeof(char *);
  assert(9 == evalRPN(rpn0, len0));
  char *rpn1[] = {"4", "13", "5", "/", "+"};
  int len1 = sizeof(rpn1) / sizeof(char *);
  assert(6 == evalRPN(rpn1, len1));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
lea    0xeaa(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xea1(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xe98(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xe94(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xe84(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x5,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1050 <evalRPN@plt>
mov    %eax,%ecx
mov    $0x9,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
lea    0xe42(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xe39(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xe31(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0xe28(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xe12(%rip),%rax
mov    %rax,-0x40(%rbp)
movl   $0x5,-0x64(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   1050 <evalRPN@plt>
mov    %eax,%ecx
mov    $0x6,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
lea    0xed4(%rip),%rax
mov    %rax,0x30(%rsp)
lea    0xeca(%rip),%rax
mov    %rax,0x38(%rsp)
lea    0xec0(%rip),%rbx
mov    %rbx,0x40(%rsp)
lea    0xebb(%rip),%rax
mov    %rax,0x48(%rsp)
lea    0xeaa(%rip),%rax
mov    %rax,0x50(%rsp)
lea    0x30(%rsp),%rdi
mov    $0x5,%esi
call   1040 <evalRPN@plt>
xor    %edi,%edi
cmp    $0x9,%eax
sete   %dil
call   1030 <assert@plt>
lea    0xe83(%rip),%rax
mov    %rax,(%rsp)
lea    0xe7a(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xe71(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xe67(%rip),%rax
mov    %rax,0x18(%rsp)
mov    %rbx,0x20(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1040 <evalRPN@plt>
xor    %edi,%edi
cmp    $0x6,%eax
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"2\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [2 x i8] c"+\00"
@.str.3 = [2 x i8] c"3\00"
@.str.4 = [2 x i8] c"*\00"
@.str.5 = [2 x i8] c"4\00"
@.str.6 = [3 x i8] c"13\00"
@.str.7 = [2 x i8] c"5\00"
@.str.8 = [2 x i8] c"/\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i8*]
%3 = alloca i32
%4 = alloca [5 x i8*]
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [5 x i8*]* %2 to i8*
%7 = bitcast i8* %6 to [5 x i8*]*
%8 = getelementptr inbounds [5 x i8*], [5 x i8*]* %7, i32 0, i32 0
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8** %8
%9 = getelementptr inbounds [5 x i8*], [5 x i8*]* %7, i32 0, i32 1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8** %9
%10 = getelementptr inbounds [5 x i8*], [5 x i8*]* %7, i32 0, i32 2
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8** %10
%11 = getelementptr inbounds [5 x i8*], [5 x i8*]* %7, i32 0, i32 3
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0), i8** %11
%12 = getelementptr inbounds [5 x i8*], [5 x i8*]* %7, i32 0, i32 4
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0), i8** %12
store i32 5, i32* %3
%13 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 0
%14 = load i32, i32* %3
%15 = call i32 @evalRPN(i8** %13, i32 %14)
%16 = icmp eq i32 9, %15
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = bitcast [5 x i8*]* %4 to i8*
%20 = bitcast i8* %19 to [5 x i8*]*
%21 = getelementptr inbounds [5 x i8*], [5 x i8*]* %20, i32 0, i32 0
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8** %21
%22 = getelementptr inbounds [5 x i8*], [5 x i8*]* %20, i32 0, i32 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0), i8** %22
%23 = getelementptr inbounds [5 x i8*], [5 x i8*]* %20, i32 0, i32 2
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i32 0, i32 0), i8** %23
%24 = getelementptr inbounds [5 x i8*], [5 x i8*]* %20, i32 0, i32 3
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i32 0, i32 0), i8** %24
%25 = getelementptr inbounds [5 x i8*], [5 x i8*]* %20, i32 0, i32 4
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8** %25
store i32 5, i32* %5
%26 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 0
%27 = load i32, i32* %5
%28 = call i32 @evalRPN(i8** %26, i32 %27)
%29 = icmp eq i32 6, %28
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"2\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [2 x i8] c"+\00"
@.str.3 = [2 x i8] c"3\00"
@.str.4 = [2 x i8] c"*\00"
@.str.5 = [2 x i8] c"4\00"
@.str.6 = [3 x i8] c"13\00"
@.str.7 = [2 x i8] c"5\00"
@.str.8 = [2 x i8] c"/\00"
define i32 @main() {
%1 = alloca [5 x i8*]
%2 = alloca [5 x i8*]
%3 = bitcast [5 x i8*]* %1 to i8*
%4 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 0
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %4
%5 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 2
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 3
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 4
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8** %8
%9 = call i32 @evalRPN(i8** %4, i32 5)
%10 = icmp eq i32 %9, 9
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = bitcast [5 x i8*]* %2 to i8*
%14 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 0
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8** %14
%15 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %15
%16 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 2
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i8** %16
%17 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 3
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i8** %17
%18 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 4
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %18
%19 = call i32 @evalRPN(i8** %14, i32 5)
%20 = icmp eq i32 %19, 6
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
ret i32 0
}