#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 atoi(char *);
scalar_t__ isdigit(char);
int pop();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ push(int);
int main(int argc, char *argv[]) {
  int first_operand;
  while (--argc) {
    if (isdigit((*++argv)[0]) == 0 && ((*argv)[1]) == '\0') {
      switch ((*argv)[0]) {
      case '+':
        push(pop() + pop());
        break;
      case '-':
        first_operand = pop();
        push(pop() - first_operand);
        break;
      case '*':
        push(pop() * pop());
        break;
      case '/':
        first_operand = pop();
        push(pop() / first_operand);
        break;
      default:
        printf("illegal operator\n");
        break;
      }
    } else {
      push(atoi(*argv));
    }
  }
  printf("%d\n", pop());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     128e <main+0x13e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
jne    1276 <main+0x126>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    1276 <main+0x126>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x5,%eax
ja     1263 <main+0x113>
mov    -0x20(%rbp),%rax
lea    0xe28(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1050 <pop@plt>
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   1050 <pop@plt>
mov    -0x24(%rbp),%edi
add    %eax,%edi
call   1060 <push@plt>
jmp    1271 <main+0x121>
mov    $0x0,%al
call   1050 <pop@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <pop@plt>
mov    %eax,%edi
sub    -0x14(%rbp),%edi
call   1060 <push@plt>
jmp    1271 <main+0x121>
mov    $0x0,%al
call   1050 <pop@plt>
mov    %eax,-0x28(%rbp)
mov    $0x0,%al
call   1050 <pop@plt>
mov    -0x28(%rbp),%edi
imul   %eax,%edi
call   1060 <push@plt>
jmp    1271 <main+0x121>
mov    $0x0,%al
call   1050 <pop@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <pop@plt>
cltd
idivl  -0x14(%rbp)
mov    %eax,%edi
call   1060 <push@plt>
jmp    1271 <main+0x121>
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1289 <main+0x139>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,%edi
call   1060 <push@plt>
jmp    1166 <main+0x16>
mov    $0x0,%al
call   1050 <pop@plt>
mov    %eax,%esi
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x1,%edi
je     1247 <main+0xe7>
mov    %rsi,%rbx
mov    %edi,%r12d
mov    $0x1,%ebp
lea    0xe96(%rip),%r14
lea    0xe73(%rip),%r13
nopl   (%rax)
mov    (%rbx,%rbp,8),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
mov    (%rbx,%rbp,8),%rdi
test   %rax,%rax
jne    11ab <main+0x4b>
cmpb   $0x0,0x1(%rdi)
je     11c5 <main+0x65>
call   1080 <atoi@plt>
mov    %eax,%edi
call   1070 <push@plt>
add    $0x1,%rbp
cmp    %ebp,%r12d
jne    1190 <main+0x30>
jmp    1247 <main+0xe7>
movsbl (%rdi),%eax
add    $0xffffffd6,%eax
cmp    $0x5,%eax
ja     120d <main+0xad>
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
jmp    *%rax
xor    %eax,%eax
call   1060 <pop@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1060 <pop@plt>
imul   %eax,%r15d
mov    %r15d,%edi
jmp    11b2 <main+0x52>
xor    %eax,%eax
call   1060 <pop@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1060 <pop@plt>
add    %eax,%r15d
mov    %r15d,%edi
jmp    11b2 <main+0x52>
mov    %r14,%rdi
call   1040 <puts@plt>
jmp    11b7 <main+0x57>
xor    %eax,%eax
call   1060 <pop@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1060 <pop@plt>
sub    %r15d,%eax
jmp    11b0 <main+0x50>
xor    %eax,%eax
call   1060 <pop@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1060 <pop@plt>
cltd
idiv   %r15d
jmp    11b0 <main+0x50>
xor    %eax,%eax
call   1060 <pop@plt>
lea    0xdc3(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"illegal operator\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %62, %2
%8 = load i32, i32* %4
%9 = add nsw i32 %8, -1
store i32 %9, i32* %4
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %63
11: ; preds = %7
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i32 1
store i8** %13, i8*** %5
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = call i64 @isdigit(i8 signext %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %57
19: ; preds = %11
%20 = load i8**, i8*** %5
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %57
26: ; preds = %19
%27 = load i8**, i8*** %5
%28 = load i8*, i8** %27
%29 = getelementptr inbounds i8, i8* %28, i64 0
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
switch i32 %31, label %54 [
i32 43, label %32
i32 45, label %37
i32 42, label %43
i32 47, label %48
]
32: ; preds = %26
%33 = call i32 (...) @pop()
%34 = call i32 (...) @pop()
%35 = add nsw i32 %33, %34
%36 = call i32 @push(i32 %35)
br label %56
37: ; preds = %26
%38 = call i32 (...) @pop()
store i32 %38, i32* %6
%39 = call i32 (...) @pop()
%40 = load i32, i32* %6
%41 = sub nsw i32 %39, %40
%42 = call i32 @push(i32 %41)
br label %56
43: ; preds = %26
%44 = call i32 (...) @pop()
%45 = call i32 (...) @pop()
%46 = mul nsw i32 %44, %45
%47 = call i32 @push(i32 %46)
br label %56
48: ; preds = %26
%49 = call i32 (...) @pop()
store i32 %49, i32* %6
%50 = call i32 (...) @pop()
%51 = load i32, i32* %6
%52 = sdiv i32 %50, %51
%53 = call i32 @push(i32 %52)
br label %56
54: ; preds = %26
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %56
56: ; preds = %54, %48, %43, %37, %32
br label %62
57: ; preds = %19, %11
%58 = load i8**, i8*** %5
%59 = load i8*, i8** %58
%60 = call i32 @atoi(i8* %59)
%61 = call i32 @push(i32 %60)
br label %62
62: ; preds = %57, %56
br label %7
63: ; preds = %7
%64 = call i32 (...) @pop()
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %64)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
@str = [17 x i8] c"illegal operator\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add nsw i32 %0, -1
%4 = icmp eq i32 %3, 0
br i1 %4, label %49, label %5
5: ; preds = %2, %46
%6 = phi i32 [ %47, %46 ], [ %3, %2 ]
%7 = phi i8** [ %8, %46 ], [ %1, %2 ]
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = load i8, i8* %9
%11 = tail call i64 @isdigit(i8 signext %10)
%12 = icmp eq i64 %11, 0
%13 = load i8*, i8** %8
br i1 %12, label %14, label %43
14: ; preds = %5
%15 = getelementptr inbounds i8, i8* %13, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %43
18: ; preds = %14
%19 = load i8, i8* %13
%20 = sext i8 %19 to i32
switch i32 %20, label %41 [
i32 43, label %21
i32 45, label %26
i32 42, label %31
i32 47, label %36
]
21: ; preds = %18
%22 = tail call i32 (...) @pop()
%23 = tail call i32 (...) @pop()
%24 = add nsw i32 %23, %22
%25 = tail call i32 @push(i32 %24)
br label %46
26: ; preds = %18
%27 = tail call i32 (...) @pop()
%28 = tail call i32 (...) @pop()
%29 = sub nsw i32 %28, %27
%30 = tail call i32 @push(i32 %29)
br label %46
31: ; preds = %18
%32 = tail call i32 (...) @pop()
%33 = tail call i32 (...) @pop()
%34 = mul nsw i32 %33, %32
%35 = tail call i32 @push(i32 %34)
br label %46
36: ; preds = %18
%37 = tail call i32 (...) @pop()
%38 = tail call i32 (...) @pop()
%39 = sdiv i32 %38, %37
%40 = tail call i32 @push(i32 %39)
br label %46
41: ; preds = %18
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %46
43: ; preds = %5, %14
%44 = tail call i32 @atoi(i8* %13)
%45 = tail call i32 @push(i32 %44)
br label %46
46: ; preds = %21, %26, %31, %36, %41, %43
%47 = add nsw i32 %6, -1
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %5
49: ; preds = %46, %2
%50 = tail call i32 (...) @pop()
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %50)
ret i32 0
}