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

/* Variables and functions */
int /*<<< orphan*/ do_binop(struct stack *, char);
int /*<<< orphan*/ do_clear(struct stack *);
int /*<<< orphan*/ do_print(struct stack *);
int /*<<< orphan*/ err_operator(char *);
void do_operator(struct stack *stackRpn, char *oper) {
  switch (*oper) {
  case '+':
    do_binop(stackRpn, '+');
    break;
  case '-':
    do_binop(stackRpn, '-');
    break;
  case '*':
    do_binop(stackRpn, '*');
    break;
  case '/':
    do_binop(stackRpn, '/');
    break;
  case ';':
    do_print(stackRpn);
    break;
  case '@':
    do_clear(stackRpn);
    break;
  default:
    err_operator(oper);
    break;
  }
}


x86 assembly (clang, -O0):
<do_operator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x16,%eax
ja     11e5 <do_operator+0xa5>
mov    -0x18(%rbp),%rax
lea    0xe8c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
mov    $0x2b,%esi
call   1040 <do_binop@plt>
jmp    11ee <do_operator+0xae>
mov    -0x8(%rbp),%rdi
mov    $0x2d,%esi
call   1040 <do_binop@plt>
jmp    11ee <do_operator+0xae>
mov    -0x8(%rbp),%rdi
mov    $0x2a,%esi
call   1040 <do_binop@plt>
jmp    11ee <do_operator+0xae>
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <do_binop@plt>
jmp    11ee <do_operator+0xae>
mov    -0x8(%rbp),%rdi
call   1060 <do_print@plt>
jmp    11ee <do_operator+0xae>
mov    -0x8(%rbp),%rdi
call   1030 <do_clear@plt>
jmp    11ee <do_operator+0xae>
mov    -0x10(%rbp),%rdi
call   1050 <err_operator@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_operator>:
movsbl (%rsi),%eax
add    $0xffffffd6,%eax
cmp    $0x16,%eax
ja     116f <do_operator+0x2f>
lea    0xeae(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x2a,%esi
jmp    1040 <do_binop@plt>
mov    $0x2b,%esi
jmp    1040 <do_binop@plt>
mov    %rsi,%rdi
jmp    1050 <err_operator@plt>
mov    $0x2d,%esi
jmp    1040 <do_binop@plt>
mov    $0x2f,%esi
jmp    1040 <do_binop@plt>
jmp    1060 <do_print@plt>
jmp    1030 <do_clear@plt>

LLVM IR (-O0):
%struct.stack = type { i32 }
define void @do_operator(%struct.stack* %0, i8* %1) {
%3 = alloca %struct.stack*
%4 = alloca i8*
store %struct.stack* %0, %struct.stack** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
switch i32 %7, label %26 [
i32 43, label %8
i32 45, label %11
i32 42, label %14
i32 47, label %17
i32 59, label %20
i32 64, label %23
]
8: ; preds = %2
%9 = load %struct.stack*, %struct.stack** %3
%10 = call i32 @do_binop(%struct.stack* %9, i8 signext 43)
br label %29
11: ; preds = %2
%12 = load %struct.stack*, %struct.stack** %3
%13 = call i32 @do_binop(%struct.stack* %12, i8 signext 45)
br label %29
14: ; preds = %2
%15 = load %struct.stack*, %struct.stack** %3
%16 = call i32 @do_binop(%struct.stack* %15, i8 signext 42)
br label %29
17: ; preds = %2
%18 = load %struct.stack*, %struct.stack** %3
%19 = call i32 @do_binop(%struct.stack* %18, i8 signext 47)
br label %29
20: ; preds = %2
%21 = load %struct.stack*, %struct.stack** %3
%22 = call i32 @do_print(%struct.stack* %21)
br label %29
23: ; preds = %2
%24 = load %struct.stack*, %struct.stack** %3
%25 = call i32 @do_clear(%struct.stack* %24)
br label %29
26: ; preds = %2
%27 = load i8*, i8** %4
%28 = call i32 @err_operator(i8* %27)
br label %29
29: ; preds = %26, %23, %20, %17, %14, %11, %8
ret void
}

LLVM IR (-O2):
%struct.stack = type { i32 }
define void @do_operator(%struct.stack* %0, i8* %1) {
%3 = load i8, i8* %1
%4 = sext i8 %3 to i32
switch i32 %4, label %17 [
i32 43, label %5
i32 45, label %7
i32 42, label %9
i32 47, label %11
i32 59, label %13
i32 64, label %15
]
5: ; preds = %2
%6 = tail call i32 @do_binop(%struct.stack* %0, i8 signext 43)
br label %19
7: ; preds = %2
%8 = tail call i32 @do_binop(%struct.stack* %0, i8 signext 45)
br label %19
9: ; preds = %2
%10 = tail call i32 @do_binop(%struct.stack* %0, i8 signext 42)
br label %19
11: ; preds = %2
%12 = tail call i32 @do_binop(%struct.stack* %0, i8 signext 47)
br label %19
13: ; preds = %2
%14 = tail call i32 @do_print(%struct.stack* %0)
br label %19
15: ; preds = %2
%16 = tail call i32 @do_clear(%struct.stack* %0)
br label %19
17: ; preds = %2
%18 = tail call i32 @err_operator(i8* %1)
br label %19
19: ; preds = %17, %15, %13, %11, %9, %7, %5
ret void
}