#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 */
double atof(char *);
int getop(char *);
double pop();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ push(double);
int main(int argc, char *argv[]) {
  int type;
  int i = 1, j = 0;
  double op2;
  while (i < argc) {
    type = getop(argv[i]);
    switch (type) {
    case '0':
      push(atof(argv[i]));
      j++;
      break;
    case '+':
      push(pop() + pop());
      j--;
      break;
    case '*':
      push(pop() * pop());
      j--;
      break;
    case '-':
      op2 = pop();
      push(pop() - op2);
      j--;
      break;
    case '/':
      op2 = pop();
      j--;
      if (op2 != 0.0)
        push(pop() / op2);
      else
        printf("error: zero divisor\n");
      break;
    default:
      printf("error: unknown command %s\n", argv[i]);
      break;
    }
    i++;
  }
  if (j > 0)
    printf("\t%.8g\n", pop());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12f3 <main+0x1a3>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <getop@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x6,%eax
ja     12cb <main+0x17b>
mov    -0x30(%rbp),%rax
lea    0xe4c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <atof@plt>
call   1070 <push@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12e5 <main+0x195>
mov    $0x0,%al
call   1050 <pop@plt>
movsd  %xmm0,-0x38(%rbp)
mov    $0x0,%al
call   1050 <pop@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
addsd  %xmm1,%xmm0
call   1070 <push@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    12e5 <main+0x195>
mov    $0x0,%al
call   1050 <pop@plt>
movsd  %xmm0,-0x40(%rbp)
mov    $0x0,%al
call   1050 <pop@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1070 <push@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    12e5 <main+0x195>
mov    $0x0,%al
call   1050 <pop@plt>
movsd  %xmm0,-0x28(%rbp)
mov    $0x0,%al
call   1050 <pop@plt>
subsd  -0x28(%rbp),%xmm0
call   1070 <push@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    12e5 <main+0x195>
mov    $0x0,%al
call   1050 <pop@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12a2 <main+0x152>
jp     12a2 <main+0x152>
jmp    12b8 <main+0x168>
mov    $0x0,%al
call   1050 <pop@plt>
divsd  -0x28(%rbp),%xmm0
call   1070 <push@plt>
jmp    12c6 <main+0x176>
lea    0xd5d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12e5 <main+0x195>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd53(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1174 <main+0x24>
cmpl   $0x0,-0x1c(%rbp)
jle    1312 <main+0x1c2>
mov    $0x0,%al
call   1050 <pop@plt>
lea    0xd41(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     1296 <main+0x136>
mov    %rsi,%r13
mov    %edi,%r12d
mov    $0x1,%ebx
lea    0xe9e(%rip),%r14
lea    0xe7b(%rip),%rbp
xor    %r15d,%r15d
jmp    11c0 <main+0x60>
xor    %eax,%eax
call   1060 <pop@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1060 <pop@plt>
addsd  (%rsp),%xmm0
call   1080 <push@plt>
add    $0xffffffff,%r15d
add    $0x1,%rbx
cmp    %rbx,%r12
je     127c <main+0x11c>
mov    0x0(%r13,%rbx,8),%rdi
call   1070 <getop@plt>
add    $0xffffffd6,%eax
cmp    $0x6,%eax
ja     11f6 <main+0x96>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
xor    %eax,%eax
call   1060 <pop@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1060 <pop@plt>
mulsd  (%rsp),%xmm0
jmp    11aa <main+0x4a>
mov    0x0(%r13,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11b3 <main+0x53>
xor    %eax,%eax
call   1060 <pop@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1060 <pop@plt>
subsd  (%rsp),%xmm0
jmp    11aa <main+0x4a>
xor    %eax,%eax
call   1060 <pop@plt>
add    $0xffffffff,%r15d
ucomisd 0xdcc(%rip),%xmm0
jne    1238 <main+0xd8>
jnp    126b <main+0x10b>
xor    %eax,%eax
movsd  %xmm0,(%rsp)
call   1060 <pop@plt>
divsd  (%rsp),%xmm0
call   1080 <push@plt>
jmp    11b3 <main+0x53>
mov    0x0(%r13,%rbx,8),%rdi
call   1040 <atof@plt>
call   1080 <push@plt>
add    $0x1,%r15d
jmp    11b3 <main+0x53>
lea    0xdd4(%rip),%rdi
call   1030 <puts@plt>
jmp    11b3 <main+0x53>
test   %r15d,%r15d
jle    1296 <main+0x136>
xor    %eax,%eax
call   1060 <pop@plt>
lea    0xdb0(%rip),%rdi
mov    $0x1,%al
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 = [21 x i8] c"error: zero divisor\0A\00"
@.str.1 = [27 x i8] c"error: unknown command %s\0A\00"
@.str.2 = [7 x i8] c"\09%.8g\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %7
store i32 0, i32* %8
br label %10
10: ; preds = %75, %2
%11 = load i32, i32* %7
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %78
14: ; preds = %10
%15 = load i8**, i8*** %5
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @getop(i8* %19)
store i32 %20, i32* %6
%21 = load i32, i32* %6
switch i32 %21, label %68 [
i32 48, label %22
i32 43, label %32
i32 42, label %39
i32 45, label %46
i32 47, label %54
]
22: ; preds = %14
%23 = load i8**, i8*** %5
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = call double @atof(i8* %27)
%29 = call i32 @push(double %28)
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
store i32 %31, i32* %8
br label %75
32: ; preds = %14
%33 = call double (...) @pop()
%34 = call double (...) @pop()
%35 = fadd double %33, %34
%36 = call i32 @push(double %35)
%37 = load i32, i32* %8
%38 = add nsw i32 %37, -1
store i32 %38, i32* %8
br label %75
39: ; preds = %14
%40 = call double (...) @pop()
%41 = call double (...) @pop()
%42 = fmul double %40, %41
%43 = call i32 @push(double %42)
%44 = load i32, i32* %8
%45 = add nsw i32 %44, -1
store i32 %45, i32* %8
br label %75
46: ; preds = %14
%47 = call double (...) @pop()
store double %47, double* %9
%48 = call double (...) @pop()
%49 = load double, double* %9
%50 = fsub double %48, %49
%51 = call i32 @push(double %50)
%52 = load i32, i32* %8
%53 = add nsw i32 %52, -1
store i32 %53, i32* %8
br label %75
54: ; preds = %14
%55 = call double (...) @pop()
store double %55, double* %9
%56 = load i32, i32* %8
%57 = add nsw i32 %56, -1
store i32 %57, i32* %8
%58 = load double, double* %9
%59 = fcmp une double %58, 0.000000e+00
br i1 %59, label %60, label %65
60: ; preds = %54
%61 = call double (...) @pop()
%62 = load double, double* %9
%63 = fdiv double %61, %62
%64 = call i32 @push(double %63)
br label %67
65: ; preds = %54
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %67
67: ; preds = %65, %60
br label %75
68: ; preds = %14
%69 = load i8**, i8*** %5
%70 = load i32, i32* %7
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8*, i8** %69, i64 %71
%73 = load i8*, i8** %72
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %73)
br label %75
75: ; preds = %68, %67, %46, %39, %32, %22
%76 = load i32, i32* %7
%77 = add nsw i32 %76, 1
store i32 %77, i32* %7
br label %10
78: ; preds = %10
%79 = load i32, i32* %8
%80 = icmp sgt i32 %79, 0
br i1 %80, label %81, label %84
81: ; preds = %78
%82 = call double (...) @pop()
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %82)
br label %84
84: ; preds = %81, %78
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [27 x i8] c"error: unknown command %s\0A\00"
@.str.2 = [7 x i8] c"\09%.8g\0A\00"
@str = [20 x i8] c"error: zero divisor\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %57
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %48
%7 = phi i64 [ 1, %4 ], [ %50, %48 ]
%8 = phi i32 [ 0, %4 ], [ %49, %48 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %7
%10 = load i8*, i8** %9
%11 = tail call i32 @getop(i8* %10)
switch i32 %11, label %45 [
i32 48, label %12
i32 43, label %17
i32 42, label %23
i32 45, label %29
i32 47, label %35
]
12: ; preds = %6
%13 = load i8*, i8** %9
%14 = tail call double @atof(i8* %13)
%15 = tail call i32 @push(double %14)
%16 = add nsw i32 %8, 1
br label %48
17: ; preds = %6
%18 = tail call double (...) @pop()
%19 = tail call double (...) @pop()
%20 = fadd double %18, %19
%21 = tail call i32 @push(double %20)
%22 = add nsw i32 %8, -1
br label %48
23: ; preds = %6
%24 = tail call double (...) @pop()
%25 = tail call double (...) @pop()
%26 = fmul double %24, %25
%27 = tail call i32 @push(double %26)
%28 = add nsw i32 %8, -1
br label %48
29: ; preds = %6
%30 = tail call double (...) @pop()
%31 = tail call double (...) @pop()
%32 = fsub double %31, %30
%33 = tail call i32 @push(double %32)
%34 = add nsw i32 %8, -1
br label %48
35: ; preds = %6
%36 = tail call double (...) @pop()
%37 = add nsw i32 %8, -1
%38 = fcmp une double %36, 0.000000e+00
br i1 %38, label %39, label %43
39: ; preds = %35
%40 = tail call double (...) @pop()
%41 = fdiv double %40, %36
%42 = tail call i32 @push(double %41)
br label %48
43: ; preds = %35
%44 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %48
45: ; preds = %6
%46 = load i8*, i8** %9
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %46)
br label %48
48: ; preds = %39, %43, %45, %29, %23, %17, %12
%49 = phi i32 [ %8, %45 ], [ %37, %39 ], [ %37, %43 ], [ %34, %29 ], [ %28, %23 ], [ %22, %17 ], [ %16, %12 ]
%50 = add nuw nsw i64 %7, 1
%51 = icmp eq i64 %50, %5
br i1 %51, label %52, label %6
52: ; preds = %48
%53 = icmp sgt i32 %49, 0
br i1 %53, label %54, label %57
54: ; preds = %52
%55 = tail call double (...) @pop()
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %55)
br label %57
57: ; preds = %2, %54, %52
ret i32 0
}