int main(int argc, char *argv[]) {
  void push(double);
  double pop(void);
  double op2;
  while (--argc > 0) {
    switch ((*++argv)[0]) {
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':
      push(atof(*argv));
      break;
    case '+':
      push(pop() + pop());
      break;
    case '*':
      push(pop() * pop());
      break;
    case '-':
      op2 = pop();
      push(pop() - op2);
      break;
    case '/':
      op2 = pop();
      push(pop() / op2);
      break;
    case '%':
      op2 = pop();
      push(pop() / op2);
      break;
    case 'n':
      push(-1.0 * pop());
      break;
    case 's':
      push(sin(pop()));
      break;
    case 'c':
      push(cos(pop()));
      break;
    case 't':
      push(tan(pop()));
      break;
    case 'l':
      push(log(pop()));
      break;
    case 'e':
      push(exp(pop()));
      break;
    case 'p':
      op2 = pop();
      push(pow(pop(), op2));
      break;
    default:
      printf("error: unknown command %s\n", *argv);
      break;
    }
  }
  printf("%g\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
jle    1383 <main+0x1e3>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rax
movsbl (%rax),%eax
add    $0xffffffdb,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x4f,%eax
ja     1369 <main+0x1c9>
mov    -0x20(%rbp),%rax
lea    0xe0d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x0,%al
call   1030 <atof@plt>
cvtsi2sd %eax,%xmm0
call   10a0 <push@plt>
jmp    137e <main+0x1de>
call   1050 <pop@plt>
movsd  %xmm0,-0x28(%rbp)
call   1050 <pop@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  %xmm1,%xmm0
call   10a0 <push@plt>
jmp    137e <main+0x1de>
call   1050 <pop@plt>
movsd  %xmm0,-0x30(%rbp)
call   1050 <pop@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   10a0 <push@plt>
jmp    137e <main+0x1de>
call   1050 <pop@plt>
movsd  %xmm0,-0x18(%rbp)
call   1050 <pop@plt>
subsd  -0x18(%rbp),%xmm0
call   10a0 <push@plt>
jmp    137e <main+0x1de>
call   1050 <pop@plt>
movsd  %xmm0,-0x18(%rbp)
call   1050 <pop@plt>
divsd  -0x18(%rbp),%xmm0
call   10a0 <push@plt>
jmp    137e <main+0x1de>
call   1050 <pop@plt>
movsd  %xmm0,-0x18(%rbp)
call   1050 <pop@plt>
divsd  -0x18(%rbp),%xmm0
call   10a0 <push@plt>
jmp    137e <main+0x1de>
call   1050 <pop@plt>
movaps %xmm0,%xmm1
movsd  0xd2c(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   10a0 <push@plt>
jmp    137e <main+0x1de>
call   1050 <pop@plt>
call   1060 <sin@plt>
call   10a0 <push@plt>
jmp    137e <main+0x1de>
call   1050 <pop@plt>
call   1090 <cos@plt>
call   10a0 <push@plt>
jmp    137e <main+0x1de>
call   1050 <pop@plt>
call   1080 <tan@plt>
call   10a0 <push@plt>
jmp    137e <main+0x1de>
call   1050 <pop@plt>
call   10b0 <log@plt>
call   10a0 <push@plt>
jmp    137e <main+0x1de>
call   1050 <pop@plt>
call   1070 <exp@plt>
call   10a0 <push@plt>
jmp    137e <main+0x1de>
call   1050 <pop@plt>
movsd  %xmm0,-0x18(%rbp)
call   1050 <pop@plt>
movsd  -0x18(%rbp),%xmm1
call   10c0 <pow@plt>
call   10a0 <push@plt>
jmp    137e <main+0x1de>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11b6 <main+0x16>
call   1050 <pop@plt>
lea    0xdd4(%rip),%rdi
mov    $0x1,%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   %rbx
push   %rax
cmp    $0x2,%edi
jl     12ed <main+0x14d>
mov    %rsi,%rbx
mov    %edi,%ebp
add    $0x1,%ebp
add    $0x8,%rbx
lea    0xf8d(%rip),%r14
lea    0xe46(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%rsi
movsbl (%rsi),%eax
add    $0xffffffdb,%eax
cmp    $0x4f,%eax
ja     1224 <main+0x84>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
mov    %rsi,%rdi
xor    %eax,%eax
call   1030 <atof@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
call   10a0 <push@plt>
add    $0xffffffff,%ebp
add    $0x8,%rbx
cmp    $0x2,%ebp
ja     11d0 <main+0x30>
jmp    12ed <main+0x14d>
call   1050 <pop@plt>
movsd  %xmm0,(%rsp)
call   1050 <pop@plt>
divsd  (%rsp),%xmm0
jmp    11f8 <main+0x58>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11fd <main+0x5d>
call   1050 <pop@plt>
movsd  %xmm0,(%rsp)
call   1050 <pop@plt>
mulsd  (%rsp),%xmm0
jmp    11f8 <main+0x58>
call   1050 <pop@plt>
movsd  %xmm0,(%rsp)
call   1050 <pop@plt>
addsd  (%rsp),%xmm0
jmp    11f8 <main+0x58>
call   1050 <pop@plt>
movsd  %xmm0,(%rsp)
call   1050 <pop@plt>
subsd  (%rsp),%xmm0
jmp    11f8 <main+0x58>
call   1050 <pop@plt>
call   1090 <cos@plt>
jmp    11f8 <main+0x58>
call   1050 <pop@plt>
call   1070 <exp@plt>
jmp    11f8 <main+0x58>
call   1050 <pop@plt>
call   10b0 <log@plt>
jmp    11f8 <main+0x58>
call   1050 <pop@plt>
xorpd  0xd54(%rip),%xmm0
jmp    11f8 <main+0x58>
call   1050 <pop@plt>
movsd  %xmm0,(%rsp)
call   1050 <pop@plt>
movsd  (%rsp),%xmm1
call   10c0 <pow@plt>
jmp    11f8 <main+0x58>
call   1050 <pop@plt>
call   1060 <sin@plt>
jmp    11f8 <main+0x58>
call   1050 <pop@plt>
call   1080 <tan@plt>
jmp    11f8 <main+0x58>
call   1050 <pop@plt>
lea    0xe72(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"error: unknown command %s\0A\00"
@.str.1 = [4 x i8] c"%g\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %73, %2
%8 = load i32, i32* %4
%9 = add nsw i32 %8, -1
store i32 %9, i32* %4
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %74
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 = sext i8 %16 to i32
switch i32 %17, label %69 [
i32 48, label %18
i32 49, label %18
i32 50, label %18
i32 51, label %18
i32 52, label %18
i32 53, label %18
i32 54, label %18
i32 55, label %18
i32 56, label %18
i32 57, label %18
i32 43, label %23
i32 42, label %27
i32 45, label %31
i32 47, label %36
i32 37, label %41
i32 110, label %46
i32 115, label %49
i32 99, label %52
i32 116, label %55
i32 108, label %58
i32 101, label %61
i32 112, label %64
]
18: ; preds = %11, %11, %11, %11, %11, %11, %11, %11, %11, %11
%19 = load i8**, i8*** %5
%20 = load i8*, i8** %19
%21 = call i32 (i8*, ...) bitcast (i32 (...)* @atof to i32 (i8*, ...)*)(i8* %20)
%22 = sitofp i32 %21 to double
br label %73
23: ; preds = %11
%24 = call double @pop()
%25 = call double @pop()
%26 = fadd double %24, %25
br label %73
27: ; preds = %11
%28 = call double @pop()
%29 = call double @pop()
%30 = fmul double %28, %29
br label %73
31: ; preds = %11
%32 = call double @pop()
store double %32, double* %6
%33 = call double @pop()
%34 = load double, double* %6
%35 = fsub double %33, %34
br label %73
36: ; preds = %11
%37 = call double @pop()
store double %37, double* %6
%38 = call double @pop()
%39 = load double, double* %6
%40 = fdiv double %38, %39
br label %73
41: ; preds = %11
%42 = call double @pop()
store double %42, double* %6
%43 = call double @pop()
%44 = load double, double* %6
%45 = fdiv double %43, %44
br label %73
46: ; preds = %11
%47 = call double @pop()
%48 = fmul double -1.000000e+00, %47
br label %73
49: ; preds = %11
%50 = call double @pop()
%51 = call double @sin(double %50)
br label %73
52: ; preds = %11
%53 = call double @pop()
%54 = call double @cos(double %53)
br label %73
55: ; preds = %11
%56 = call double @pop()
%57 = call double @tan(double %56)
br label %73
58: ; preds = %11
%59 = call double @pop()
%60 = call double @log(double %59)
br label %73
61: ; preds = %11
%62 = call double @pop()
%63 = call double @exp(double %62)
br label %73
64: ; preds = %11
%65 = call double @pop()
store double %65, double* %6
%66 = call double @pop()
%67 = load double, double* %6
%68 = call double @pow(double %66, double %67)
br label %73
69: ; preds = %11
%70 = load i8**, i8*** %5
%71 = load i8*, i8** %70
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %71)
br label %73
73: ; preds = %69, %64, %61, %58, %55, %52, %49, %46, %41, %36, %31, %27, %23, %18
br label %7
74: ; preds = %7
%75 = call double @pop()
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %75)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"error: unknown command %s\0A\00"
@.str.1 = [4 x i8] c"%g\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %61
4: ; preds = %2, %59
%5 = phi i32 [ %7, %59 ], [ %0, %2 ]
%6 = phi i8** [ %8, %59 ], [ %1, %2 ]
%7 = add nsw i32 %5, -1
%8 = getelementptr inbounds i8*, i8** %6, i64 1
%9 = load i8*, i8** %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
switch i32 %11, label %57 [
i32 48, label %12
i32 49, label %12
i32 50, label %12
i32 51, label %12
i32 52, label %12
i32 53, label %12
i32 54, label %12
i32 55, label %12
i32 56, label %12
i32 57, label %12
i32 43, label %15
i32 42, label %19
i32 45, label %23
i32 47, label %27
i32 37, label %31
i32 110, label %35
i32 115, label %38
i32 99, label %41
i32 116, label %44
i32 108, label %47
i32 101, label %50
i32 112, label %53
]
12: ; preds = %4, %4, %4, %4, %4, %4, %4, %4, %4, %4
%13 = tail call i32 (i8*, ...) bitcast (i32 (...)* @atof to i32 (i8*, ...)*)(i8* %9)
%14 = sitofp i32 %13 to double
tail call void @push(double %14)
br label %59
15: ; preds = %4
%16 = tail call double @pop()
%17 = tail call double @pop()
%18 = fadd double %16, %17
tail call void @push(double %18)
br label %59
19: ; preds = %4
%20 = tail call double @pop()
%21 = tail call double @pop()
%22 = fmul double %20, %21
tail call void @push(double %22)
br label %59
23: ; preds = %4
%24 = tail call double @pop()
%25 = tail call double @pop()
%26 = fsub double %25, %24
tail call void @push(double %26)
br label %59
27: ; preds = %4
%28 = tail call double @pop()
%29 = tail call double @pop()
%30 = fdiv double %29, %28
tail call void @push(double %30)
br label %59
31: ; preds = %4
%32 = tail call double @pop()
%33 = tail call double @pop()
%34 = fdiv double %33, %32
tail call void @push(double %34)
br label %59
35: ; preds = %4
%36 = tail call double @pop()
%37 = fneg double %36
tail call void @push(double %37)
br label %59
38: ; preds = %4
%39 = tail call double @pop()
%40 = tail call double @sin(double %39)
tail call void @push(double %40)
br label %59
41: ; preds = %4
%42 = tail call double @pop()
%43 = tail call double @cos(double %42)
tail call void @push(double %43)
br label %59
44: ; preds = %4
%45 = tail call double @pop()
%46 = tail call double @tan(double %45)
tail call void @push(double %46)
br label %59
47: ; preds = %4
%48 = tail call double @pop()
%49 = tail call double @log(double %48)
tail call void @push(double %49)
br label %59
50: ; preds = %4
%51 = tail call double @pop()
%52 = tail call double @exp(double %51)
tail call void @push(double %52)
br label %59
53: ; preds = %4
%54 = tail call double @pop()
%55 = tail call double @pop()
%56 = tail call double @pow(double %55, double %54)
tail call void @push(double %56)
br label %59
57: ; preds = %4
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %59
59: ; preds = %57, %53, %50, %47, %44, %41, %38, %35, %31, %27, %23, %19, %15, %12
%60 = icmp ugt i32 %5, 2
br i1 %60, label %4, label %61
61: ; preds = %59, %2
%62 = tail call double @pop()
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %62)
ret i32 0
}