#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 pow(double, double);
double do_next_op(char operator, double operand, double *akkumulator,
                  double *q) {
  if (operator!= 'q') {
    if (operator== '+') {
      *akkumulator = *akkumulator + operand;
    }
    if (operator== '-') {
      *akkumulator = *akkumulator - operand;
    }
    if (operator== '*') {
      *akkumulator = *akkumulator * operand;
    }
    if (operator== '/') {
      *akkumulator = *akkumulator / operand;
    }
    if (operator== '^') {
      *akkumulator = pow(*akkumulator, operand);
    }
    if (operator== 'q') {
      *q = 0;
    }
  }
}


x86 assembly (clang, -O0):
<do_next_op>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x71,%eax
je     1204 <do_next_op+0xf4>
movsbl -0x9(%rbp),%eax
cmp    $0x2b,%eax
jne    115a <do_next_op+0x4a>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
addsd  -0x18(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsbl -0x9(%rbp),%eax
cmp    $0x2d,%eax
jne    117c <do_next_op+0x6c>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x18(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsbl -0x9(%rbp),%eax
cmp    $0x2a,%eax
jne    119e <do_next_op+0x8e>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mulsd  -0x18(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsbl -0x9(%rbp),%eax
cmp    $0x2f,%eax
jne    11c0 <do_next_op+0xb0>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x18(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsbl -0x9(%rbp),%eax
cmp    $0x5e,%eax
jne    11e7 <do_next_op+0xd7>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1030 <pow@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsbl -0x9(%rbp),%eax
cmp    $0x71,%eax
jne    11ff <do_next_op+0xef>
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    1204 <do_next_op+0xf4>
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_next_op>:
push   %rbx
mov    %rsi,%rbx
movapd %xmm0,%xmm1
lea    -0x2a(%rdi),%eax
cmp    $0x5,%al
ja     1138 <do_next_op+0x28>
movzbl %al,%eax
lea    0xed7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mulsd  (%rbx),%xmm1
jmp    1165 <do_next_op+0x55>
cmp    $0x5e,%dil
jne    1169 <do_next_op+0x59>
movsd  (%rbx),%xmm0
call   1030 <pow@plt>
jmp    1161 <do_next_op+0x51>
addsd  (%rbx),%xmm1
jmp    1165 <do_next_op+0x55>
movsd  (%rbx),%xmm0
subsd  %xmm1,%xmm0
jmp    1161 <do_next_op+0x51>
movsd  (%rbx),%xmm0
divsd  %xmm1,%xmm0
movapd %xmm0,%xmm1
movsd  %xmm1,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define double @do_next_op(i8 signext %0, double %1, double* %2, double* %3) {
%5 = alloca double
%6 = alloca i8
%7 = alloca double
%8 = alloca double*
%9 = alloca double*
store i8 %0, i8* %6
store double %1, double* %7
store double* %2, double** %8
store double* %3, double** %9
%10 = load i8, i8* %6
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 113
br i1 %12, label %13, label %70
13: ; preds = %4
%14 = load i8, i8* %6
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 43
br i1 %16, label %17, label %23
17: ; preds = %13
%18 = load double*, double** %8
%19 = load double, double* %18
%20 = load double, double* %7
%21 = fadd double %19, %20
%22 = load double*, double** %8
store double %21, double* %22
br label %23
23: ; preds = %17, %13
%24 = load i8, i8* %6
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 45
br i1 %26, label %27, label %33
27: ; preds = %23
%28 = load double*, double** %8
%29 = load double, double* %28
%30 = load double, double* %7
%31 = fsub double %29, %30
%32 = load double*, double** %8
store double %31, double* %32
br label %33
33: ; preds = %27, %23
%34 = load i8, i8* %6
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 42
br i1 %36, label %37, label %43
37: ; preds = %33
%38 = load double*, double** %8
%39 = load double, double* %38
%40 = load double, double* %7
%41 = fmul double %39, %40
%42 = load double*, double** %8
store double %41, double* %42
br label %43
43: ; preds = %37, %33
%44 = load i8, i8* %6
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 47
br i1 %46, label %47, label %53
47: ; preds = %43
%48 = load double*, double** %8
%49 = load double, double* %48
%50 = load double, double* %7
%51 = fdiv double %49, %50
%52 = load double*, double** %8
store double %51, double* %52
br label %53
53: ; preds = %47, %43
%54 = load i8, i8* %6
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 94
br i1 %56, label %57, label %63
57: ; preds = %53
%58 = load double*, double** %8
%59 = load double, double* %58
%60 = load double, double* %7
%61 = call double @pow(double %59, double %60)
%62 = load double*, double** %8
store double %61, double* %62
br label %63
63: ; preds = %57, %53
%64 = load i8, i8* %6
%65 = sext i8 %64 to i32
%66 = icmp eq i32 %65, 113
br i1 %66, label %67, label %69
67: ; preds = %63
%68 = load double*, double** %9
store double 0.000000e+00, double* %68
br label %69
69: ; preds = %67, %63
br label %70
70: ; preds = %69, %4
%71 = load double, double* %5
ret double %71
}

LLVM IR (-O2):
define double @do_next_op(i8 signext %0, double %1, double* nocapture %2, double* nocapture readnone %3) {
switch i8 %0, label %22 [
i8 94, label %17
i8 43, label %5
i8 45, label %8
i8 42, label %11
i8 47, label %14
]
5: ; preds = %4
%6 = load double, double* %2
%7 = fadd double %6, %1
br label %20
8: ; preds = %4
%9 = load double, double* %2
%10 = fsub double %9, %1
br label %20
11: ; preds = %4
%12 = load double, double* %2
%13 = fmul double %12, %1
br label %20
14: ; preds = %4
%15 = load double, double* %2
%16 = fdiv double %15, %1
br label %20
17: ; preds = %4
%18 = load double, double* %2
%19 = tail call double @pow(double %18, double %1)
br label %20
20: ; preds = %5, %8, %11, %14, %17
%21 = phi double [ %19, %17 ], [ %16, %14 ], [ %13, %11 ], [ %10, %8 ], [ %7, %5 ]
store double %21, double* %2
br label %22
22: ; preds = %20, %4
ret double undef
}