#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 /*<<< orphan*/ error(char *);
double pop();
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ push(double);
int main(int argc, char **argv) {
  int i;
  double value;
  for (i = 1; i < argc; i++) {
    switch (argv[i][0]) {
    case '\0':
      error("arguments errors");
      break;
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':
      push(atof(&argv[i][0]));
      break;
    case '+':
      push(pop() + pop());
      break;
    case '-':
      value = pop();
      push(pop() - value);
      break;
    case '*':
      push(pop() * pop());
      break;
    case '/':
      value = pop();
      if (value == 0) {
        error("zero devider");
      } else {
        push(pop() / value);
        break;
      }
    default:
      error("op is not supportted");
      break;
    }
  }
  printf("%f\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,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12ba <main+0x16a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x39,%eax
ja     129b <main+0x14b>
mov    -0x28(%rbp),%rax
lea    0xe5e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf36(%rip),%rdi
call   1060 <error@plt>
jmp    12a7 <main+0x157>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <atof@plt>
call   1070 <push@plt>
jmp    12a7 <main+0x157>
mov    $0x0,%al
call   1050 <pop@plt>
movsd  %xmm0,-0x30(%rbp)
mov    $0x0,%al
call   1050 <pop@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
addsd  %xmm1,%xmm0
call   1070 <push@plt>
jmp    12a7 <main+0x157>
mov    $0x0,%al
call   1050 <pop@plt>
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1050 <pop@plt>
subsd  -0x20(%rbp),%xmm0
call   1070 <push@plt>
jmp    12a7 <main+0x157>
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
mulsd  %xmm1,%xmm0
call   1070 <push@plt>
jmp    12a7 <main+0x157>
mov    $0x0,%al
call   1050 <pop@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1280 <main+0x130>
jp     1280 <main+0x130>
lea    0xe83(%rip),%rdi
call   1060 <error@plt>
jmp    1296 <main+0x146>
mov    $0x0,%al
call   1050 <pop@plt>
divsd  -0x20(%rbp),%xmm0
call   1070 <push@plt>
jmp    12a7 <main+0x157>
jmp    129b <main+0x14b>
lea    0xe64(%rip),%rdi
call   1060 <error@plt>
jmp    12ac <main+0x15c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116d <main+0x1d>
mov    $0x0,%al
call   1050 <pop@plt>
lea    0xe53(%rip),%rdi
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     126e <main+0x11e>
mov    %rsi,%rbx
mov    %edi,%r13d
mov    $0x1,%ebp
lea    0xf98(%rip),%r14
lea    0xe8b(%rip),%r12
lea    0xf6c(%rip),%r15
jmp    11cd <main+0x7d>
xor    %eax,%eax
call   1050 <pop@plt>
ucomisd 0xe6b(%rip),%xmm0
jne    1253 <main+0x103>
jp     1253 <main+0x103>
lea    0xf59(%rip),%rdi
call   1060 <error@plt>
mov    %r14,%rdi
call   1060 <error@plt>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbp
cmp    %rbp,%r13
je     126e <main+0x11e>
mov    (%rbx,%rbp,8),%rdi
movsbl (%rdi),%eax
cmp    $0x39,%eax
ja     11ad <main+0x5d>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
call   1030 <atof@plt>
call   1070 <push@plt>
jmp    11c0 <main+0x70>
mov    %r15,%rdi
jmp    11b0 <main+0x60>
xor    %eax,%eax
call   1050 <pop@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1050 <pop@plt>
mulsd  (%rsp),%xmm0
call   1070 <push@plt>
jmp    11c0 <main+0x70>
xor    %eax,%eax
call   1050 <pop@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1050 <pop@plt>
addsd  (%rsp),%xmm0
call   1070 <push@plt>
jmp    11c0 <main+0x70>
xor    %eax,%eax
call   1050 <pop@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1050 <pop@plt>
subsd  (%rsp),%xmm0
call   1070 <push@plt>
jmp    11c0 <main+0x70>
xor    %eax,%eax
movsd  %xmm0,(%rsp)
call   1050 <pop@plt>
divsd  (%rsp),%xmm0
call   1070 <push@plt>
jmp    11c0 <main+0x70>
xor    %eax,%eax
call   1050 <pop@plt>
lea    0xea7(%rip),%rdi
call   1040 <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 = [17 x i8] c"arguments errors\00"
@.str.1 = [13 x i8] c"zero devider\00"
@.str.2 = [21 x i8] c"op is not supportted\00"
@.str.3 = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
br label %8
8: ; preds = %63, %2
%9 = load i32, i32* %6
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %66
12: ; preds = %8
%13 = load i8**, i8*** %5
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = getelementptr inbounds i8, i8* %17, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
switch i32 %20, label %60 [
i32 0, label %21
i32 49, label %23
i32 50, label %23
i32 51, label %23
i32 52, label %23
i32 53, label %23
i32 54, label %23
i32 55, label %23
i32 56, label %23
i32 57, label %23
i32 43, label %32
i32 45, label %37
i32 42, label %43
i32 47, label %48
]
21: ; preds = %12
%22 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %62
23: ; preds = %12, %12, %12, %12, %12, %12, %12, %12, %12
%24 = load i8**, i8*** %5
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = getelementptr inbounds i8, i8* %28, i64 0
%30 = call double @atof(i8* %29)
%31 = call i32 @push(double %30)
br label %62
32: ; preds = %12
%33 = call double (...) @pop()
%34 = call double (...) @pop()
%35 = fadd double %33, %34
%36 = call i32 @push(double %35)
br label %62
37: ; preds = %12
%38 = call double (...) @pop()
store double %38, double* %7
%39 = call double (...) @pop()
%40 = load double, double* %7
%41 = fsub double %39, %40
%42 = call i32 @push(double %41)
br label %62
43: ; preds = %12
%44 = call double (...) @pop()
%45 = call double (...) @pop()
%46 = fmul double %44, %45
%47 = call i32 @push(double %46)
br label %62
48: ; preds = %12
%49 = call double (...) @pop()
store double %49, double* %7
%50 = load double, double* %7
%51 = fcmp oeq double %50, 0.000000e+00
br i1 %51, label %52, label %54
52: ; preds = %48
%53 = call i32 @error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %59
54: ; preds = %48
%55 = call double (...) @pop()
%56 = load double, double* %7
%57 = fdiv double %55, %56
%58 = call i32 @push(double %57)
br label %62
59: ; preds = %52
br label %60
60: ; preds = %12, %59
%61 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %62
62: ; preds = %60, %54, %43, %37, %32, %23, %21
br label %63
63: ; preds = %62
%64 = load i32, i32* %6
%65 = add nsw i32 %64, 1
store i32 %65, i32* %6
br label %8
66: ; preds = %8
%67 = call double (...) @pop()
%68 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double %67)
ret i32 0
}

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