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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12b0 <main+0x170>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rax
movsbl (%rax),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x98(%rbp)
sub    $0x5,%eax
ja     1291 <main+0x151>
mov    -0x98(%rbp),%rax
lea    0xe4a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1050 <pop@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
mov    $0x0,%al
call   1050 <pop@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
call   1060 <push@plt>
jmp    12a2 <main+0x162>
mov    $0x0,%al
call   1050 <pop@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
mov    $0x0,%al
call   1050 <pop@plt>
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
call   1060 <push@plt>
jmp    12a2 <main+0x162>
mov    $0x0,%al
call   1050 <pop@plt>
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1050 <pop@plt>
subsd  -0x20(%rbp),%xmm0
call   1060 <push@plt>
jmp    12a2 <main+0x162>
mov    $0x0,%al
call   1050 <pop@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1268 <main+0x128>
jp     1268 <main+0x128>
jmp    127e <main+0x13e>
mov    $0x0,%al
call   1050 <pop@plt>
divsd  -0x20(%rbp),%xmm0
call   1060 <push@plt>
jmp    128c <main+0x14c>
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12a2 <main+0x162>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <atof@plt>
call   1060 <push@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1171 <main+0x31>
mov    $0x0,%al
call   1050 <pop@plt>
lea    0xd8f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r15
mov    %edi,%ebp
lea    0xeb8(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x2,%ebp
jl     126d <main+0x11d>
mov    %ebp,%ebp
mov    $0x1,%ebx
lea    0xe80(%rip),%r12
lea    0xeb8(%rip),%r14
nop
mov    (%r15,%rbx,8),%rdi
movsbl (%rdi),%eax
add    $0xffffffd6,%eax
cmp    $0x5,%eax
ja     11f0 <main+0xa0>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
xor    %eax,%eax
call   1060 <pop@plt>
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1060 <pop@plt>
mulsd  0x8(%rsp),%xmm0
jmp    1250 <main+0x100>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <pop@plt>
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1060 <pop@plt>
addsd  0x8(%rsp),%xmm0
jmp    1250 <main+0x100>
nopl   0x0(%rax)
call   1040 <atof@plt>
jmp    1250 <main+0x100>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <pop@plt>
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1060 <pop@plt>
subsd  0x8(%rsp),%xmm0
jmp    1250 <main+0x100>
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <pop@plt>
ucomisd 0xdd1(%rip),%xmm0
jne    1233 <main+0xe3>
jnp    1263 <main+0x113>
xor    %eax,%eax
movsd  %xmm0,0x8(%rsp)
call   1060 <pop@plt>
divsd  0x8(%rsp),%xmm0
cs nopw 0x0(%rax,%rax,1)
call   1070 <push@plt>
add    $0x1,%rbx
cmp    %ebx,%ebp
jne    1190 <main+0x40>
jmp    126d <main+0x11d>
mov    %r14,%rdi
call   1030 <puts@plt>
jmp    1255 <main+0x105>
xor    %eax,%eax
call   1060 <pop@plt>
lea    0xdc5(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"total commod line arguments:%d\0A\00"
@.str.1 = [21 x i8] c"error: zero divisor\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 double
%8 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
%9 = load i32, i32* %4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %54, %2
%12 = load i32, i32* %6
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %57
15: ; preds = %11
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i32 1
store i8** %17, i8*** %5
%18 = load i8*, i8** %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
switch i32 %20, label %49 [
i32 43, label %21
i32 42, label %26
i32 45, label %31
i32 47, label %37
]
21: ; preds = %15
%22 = call double (...) @pop()
%23 = call double (...) @pop()
%24 = fadd double %22, %23
%25 = call i32 @push(double %24)
br label %54
26: ; preds = %15
%27 = call double (...) @pop()
%28 = call double (...) @pop()
%29 = fmul double %27, %28
%30 = call i32 @push(double %29)
br label %54
31: ; preds = %15
%32 = call double (...) @pop()
store double %32, double* %7
%33 = call double (...) @pop()
%34 = load double, double* %7
%35 = fsub double %33, %34
%36 = call i32 @push(double %35)
br label %54
37: ; preds = %15
%38 = call double (...) @pop()
store double %38, double* %7
%39 = load double, double* %7
%40 = fcmp une double %39, 0.000000e+00
br i1 %40, label %41, label %46
41: ; preds = %37
%42 = call double (...) @pop()
%43 = load double, double* %7
%44 = fdiv double %42, %43
%45 = call i32 @push(double %44)
br label %48
46: ; preds = %37
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %48
48: ; preds = %46, %41
br label %54
49: ; preds = %15
%50 = load i8**, i8*** %5
%51 = load i8*, i8** %50
%52 = call double @atof(i8* %51)
%53 = call i32 @push(double %52)
br label %54
54: ; preds = %49, %48, %31, %26, %21
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 1
store i32 %56, i32* %6
br label %11
57: ; preds = %11
%58 = call double (...) @pop()
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %58)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"total commod line arguments:%d\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 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %42
5: ; preds = %2, %39
%6 = phi i8** [ %8, %39 ], [ %1, %2 ]
%7 = phi i32 [ %40, %39 ], [ 1, %2 ]
%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 %36 [
i32 43, label %12
i32 42, label %17
i32 45, label %22
i32 47, label %27
]
12: ; preds = %5
%13 = tail call double (...) @pop()
%14 = tail call double (...) @pop()
%15 = fadd double %13, %14
%16 = tail call i32 @push(double %15)
br label %39
17: ; preds = %5
%18 = tail call double (...) @pop()
%19 = tail call double (...) @pop()
%20 = fmul double %18, %19
%21 = tail call i32 @push(double %20)
br label %39
22: ; preds = %5
%23 = tail call double (...) @pop()
%24 = tail call double (...) @pop()
%25 = fsub double %24, %23
%26 = tail call i32 @push(double %25)
br label %39
27: ; preds = %5
%28 = tail call double (...) @pop()
%29 = fcmp une double %28, 0.000000e+00
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = tail call double (...) @pop()
%32 = fdiv double %31, %28
%33 = tail call i32 @push(double %32)
br label %39
34: ; preds = %27
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %39
36: ; preds = %5
%37 = tail call double @atof(i8* %9)
%38 = tail call i32 @push(double %37)
br label %39
39: ; preds = %30, %34, %36, %22, %17, %12
%40 = add nuw nsw i32 %7, 1
%41 = icmp eq i32 %40, %0
br i1 %41, label %42, label %5
42: ; preds = %39, %2
%43 = tail call double (...) @pop()
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %43)
ret i32 0
}