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


x86 assembly (clang, -O0):
<operations>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
cmpq   $0x0,0x8(%rax)
je     1337 <operations+0x1c7>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1070 <getop@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffde,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0xe,%eax
ja     131d <operations+0x1ad>
mov    -0x20(%rbp),%rax
lea    0xe3b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <atof@plt>
call   1080 <push@plt>
jmp    1332 <operations+0x1c2>
mov    $0x0,%al
call   1060 <pop@plt>
movsd  %xmm0,-0x28(%rbp)
mov    $0x0,%al
call   1060 <pop@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  %xmm1,%xmm0
call   1080 <push@plt>
jmp    1332 <operations+0x1c2>
mov    $0x0,%al
call   1060 <pop@plt>
movsd  %xmm0,-0x30(%rbp)
mov    $0x0,%al
call   1060 <pop@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1080 <push@plt>
jmp    1332 <operations+0x1c2>
mov    $0x0,%al
call   1060 <pop@plt>
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1060 <pop@plt>
subsd  -0x18(%rbp),%xmm0
call   1080 <push@plt>
jmp    1332 <operations+0x1c2>
mov    $0x0,%al
call   1060 <pop@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1281 <operations+0x111>
jp     1281 <operations+0x111>
jmp    1297 <operations+0x127>
mov    $0x0,%al
call   1060 <pop@plt>
divsd  -0x18(%rbp),%xmm0
call   1080 <push@plt>
jmp    12a5 <operations+0x135>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1332 <operations+0x1c2>
mov    $0x0,%al
call   1060 <pop@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12d3 <operations+0x163>
jp     12d3 <operations+0x163>
jmp    12ee <operations+0x17e>
mov    $0x0,%al
call   1060 <pop@plt>
movsd  -0x18(%rbp),%xmm1
call   1050 <fmod@plt>
call   1080 <push@plt>
jmp    12fc <operations+0x18c>
lea    0xd47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1332 <operations+0x1c2>
lea    0xd49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2cca(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    0xd40(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    117c <operations+0xc>
mov    $0x0,%al
call   1060 <pop@plt>
lea    0xd41(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<operations>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x8(%rdi),%rdi
test   %rdi,%rdi
je     12cb <operations+0x14b>
add    $0x8,%rbx
lea    0xea1(%rip),%r14
lea    0xe5e(%rip),%r12
lea    0xece(%rip),%r15
jmp    11d1 <operations+0x51>
mov    (%rbx),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
je     12cb <operations+0x14b>
call   1080 <getop@plt>
add    $0xffffffde,%eax
cmp    $0xe,%eax
ja     11b3 <operations+0x33>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
xor    %eax,%eax
call   1070 <pop@plt>
ucomisd 0xe0a(%rip),%xmm0
jne    11fe <operations+0x7e>
jnp    12be <operations+0x13e>
xor    %eax,%eax
movsd  %xmm0,(%rsp)
call   1070 <pop@plt>
movsd  (%rsp),%xmm1
call   1060 <fmod@plt>
call   1090 <push@plt>
jmp    11c0 <operations+0x40>
xor    %eax,%eax
call   1070 <pop@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <pop@plt>
mulsd  (%rsp),%xmm0
call   1090 <push@plt>
jmp    11c0 <operations+0x40>
xor    %eax,%eax
call   1070 <pop@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <pop@plt>
addsd  (%rsp),%xmm0
call   1090 <push@plt>
jmp    11c0 <operations+0x40>
xor    %eax,%eax
call   1070 <pop@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <pop@plt>
subsd  (%rsp),%xmm0
call   1090 <push@plt>
jmp    11c0 <operations+0x40>
xor    %eax,%eax
call   1070 <pop@plt>
ucomisd 0xd73(%rip),%xmm0
jne    1291 <operations+0x111>
jnp    12be <operations+0x13e>
xor    %eax,%eax
movsd  %xmm0,(%rsp)
call   1070 <pop@plt>
divsd  (%rsp),%xmm0
call   1090 <push@plt>
jmp    11c0 <operations+0x40>
mov    (%rbx),%rdi
call   1040 <atof@plt>
call   1090 <push@plt>
jmp    11c0 <operations+0x40>
mov    %r15,%rdi
call   1030 <puts@plt>
jmp    11c0 <operations+0x40>
xor    %eax,%eax
call   1070 <pop@plt>
lea    0xd86(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xd71(%rip),%rdi
call   1030 <puts@plt>
mov    0x2cdf(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"error: zero divisor\0A\00"
@.str.1 = [26 x i8] c"Error: Mismatch argument\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [27 x i8] c"error: unknown command %s\0A\00"
@.str.3 = [7 x i8] c"\09%.8g\0A\00"
define i32 @operations(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
%4 = alloca double
store i8** %0, i8*** %2
br label %5
5: ; preds = %68, %1
%6 = load i8**, i8*** %2
%7 = getelementptr inbounds i8*, i8** %6, i32 1
store i8** %7, i8*** %2
%8 = load i8*, i8** %7
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %69
10: ; preds = %5
%11 = load i8**, i8*** %2
%12 = load i8*, i8** %11
%13 = call i32 @getop(i8* %12)
store i32 %13, i32* %3
%14 = load i32, i32* %3
switch i32 %14, label %64 [
i32 48, label %15
i32 43, label %20
i32 42, label %25
i32 45, label %30
i32 47, label %36
i32 37, label %48
i32 34, label %60
]
15: ; preds = %10
%16 = load i8**, i8*** %2
%17 = load i8*, i8** %16
%18 = call double @atof(i8* %17)
%19 = call i32 @push(double %18)
br label %68
20: ; preds = %10
%21 = call double (...) @pop()
%22 = call double (...) @pop()
%23 = fadd double %21, %22
%24 = call i32 @push(double %23)
br label %68
25: ; preds = %10
%26 = call double (...) @pop()
%27 = call double (...) @pop()
%28 = fmul double %26, %27
%29 = call i32 @push(double %28)
br label %68
30: ; preds = %10
%31 = call double (...) @pop()
store double %31, double* %4
%32 = call double (...) @pop()
%33 = load double, double* %4
%34 = fsub double %32, %33
%35 = call i32 @push(double %34)
br label %68
36: ; preds = %10
%37 = call double (...) @pop()
store double %37, double* %4
%38 = load double, double* %4
%39 = fcmp une double %38, 0.000000e+00
br i1 %39, label %40, label %45
40: ; preds = %36
%41 = call double (...) @pop()
%42 = load double, double* %4
%43 = fdiv double %41, %42
%44 = call i32 @push(double %43)
br label %47
45: ; preds = %36
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %47
47: ; preds = %45, %40
br label %68
48: ; preds = %10
%49 = call double (...) @pop()
store double %49, double* %4
%50 = load double, double* %4
%51 = fcmp une double %50, 0.000000e+00
br i1 %51, label %52, label %57
52: ; preds = %48
%53 = call double (...) @pop()
%54 = load double, double* %4
%55 = call double @fmod(double %53, double %54)
%56 = call i32 @push(double %55)
br label %59
57: ; preds = %48
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %59
59: ; preds = %57, %52
br label %68
60: ; preds = %10
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%62 = load i32, i32* @EXIT_FAILURE
%63 = call i32 @exit(i32 %62)
unreachable
64: ; preds = %10
%65 = load i8**, i8*** %2
%66 = load i8*, i8** %65
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %66)
br label %68
68: ; preds = %64, %59, %47, %30, %25, %20, %15
br label %5
69: ; preds = %5
%70 = call double (...) @pop()
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %70)
ret i32 0
}

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