#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);
int do_next_op(char operator, double operand, double *akkumulatoren) {
  switch (operator) {
  case '+':
    *akkumulatoren += operand;
    return 0;
  case '-':
    *akkumulatoren -= operand;
    return 0;
  case '*':
    *akkumulatoren *= operand;
    return 0;
  case '/':
    *akkumulatoren /= operand;
    return 0;
  case '^':
    *akkumulatoren = pow(*akkumulatoren, operand);
    return 0;
  default:
    return 1;
  }
}


x86 assembly (clang, -O0):
<do_next_op>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x2a,%eax
je     11be <do_next_op+0xae>
jmp    113c <do_next_op+0x2c>
mov    -0x1c(%rbp),%eax
sub    $0x2b,%eax
je     1180 <do_next_op+0x70>
jmp    114d <do_next_op+0x3d>
mov    -0x1c(%rbp),%eax
sub    $0x2d,%eax
je     119d <do_next_op+0x8d>
jmp    115e <do_next_op+0x4e>
mov    -0x1c(%rbp),%eax
sub    $0x2f,%eax
je     11db <do_next_op+0xcb>
jmp    116f <do_next_op+0x5f>
mov    -0x1c(%rbp),%eax
sub    $0x5e,%eax
je     11fc <do_next_op+0xec>
jmp    1222 <do_next_op+0x112>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1229 <do_next_op+0x119>
movsd  -0x10(%rbp),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1229 <do_next_op+0x119>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1229 <do_next_op+0x119>
movsd  -0x10(%rbp),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1229 <do_next_op+0x119>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <pow@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1229 <do_next_op+0x119>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_next_op>:
push   %rbx
mov    %rsi,%rbx
movapd %xmm0,%xmm1
mov    $0x1,%eax
lea    -0x2a(%rdi),%ecx
cmp    $0x5,%ecx
ja     113b <do_next_op+0x2b>
lea    0xed4(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mulsd  (%rbx),%xmm1
jmp    1167 <do_next_op+0x57>
cmp    $0x5e,%edi
jne    116d <do_next_op+0x5d>
movsd  (%rbx),%xmm0
call   1030 <pow@plt>
jmp    1163 <do_next_op+0x53>
addsd  (%rbx),%xmm1
jmp    1167 <do_next_op+0x57>
movsd  (%rbx),%xmm0
subsd  %xmm1,%xmm0
jmp    1163 <do_next_op+0x53>
movsd  (%rbx),%xmm0
divsd  %xmm1,%xmm0
movapd %xmm0,%xmm1
movsd  %xmm1,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @do_next_op(i8 signext %0, double %1, double* %2) {
%4 = alloca i32
%5 = alloca i8
%6 = alloca double
%7 = alloca double*
store i8 %0, i8* %5
store double %1, double* %6
store double* %2, double** %7
%8 = load i8, i8* %5
%9 = sext i8 %8 to i32
switch i32 %9, label %36 [
i32 43, label %10
i32 45, label %15
i32 42, label %20
i32 47, label %25
i32 94, label %30
]
10: ; preds = %3
%11 = load double, double* %6
%12 = load double*, double** %7
%13 = load double, double* %12
%14 = fadd double %13, %11
store double %14, double* %12
store i32 0, i32* %4
br label %37
15: ; preds = %3
%16 = load double, double* %6
%17 = load double*, double** %7
%18 = load double, double* %17
%19 = fsub double %18, %16
store double %19, double* %17
store i32 0, i32* %4
br label %37
20: ; preds = %3
%21 = load double, double* %6
%22 = load double*, double** %7
%23 = load double, double* %22
%24 = fmul double %23, %21
store double %24, double* %22
store i32 0, i32* %4
br label %37
25: ; preds = %3
%26 = load double, double* %6
%27 = load double*, double** %7
%28 = load double, double* %27
%29 = fdiv double %28, %26
store double %29, double* %27
store i32 0, i32* %4
br label %37
30: ; preds = %3
%31 = load double*, double** %7
%32 = load double, double* %31
%33 = load double, double* %6
%34 = call double @pow(double %32, double %33)
%35 = load double*, double** %7
store double %34, double* %35
store i32 0, i32* %4
br label %37
36: ; preds = %3
store i32 1, i32* %4
br label %37
37: ; preds = %36, %30, %25, %20, %15, %10
%38 = load i32, i32* %4
ret i32 %38
}

LLVM IR (-O2):
define i32 @do_next_op(i8 signext %0, double %1, double* nocapture %2) {
%4 = sext i8 %0 to i32
switch i32 %4, label %22 [
i32 43, label %5
i32 45, label %8
i32 42, label %11
i32 47, label %14
i32 94, label %17
]
5: ; preds = %3
%6 = load double, double* %2
%7 = fadd double %6, %1
br label %20
8: ; preds = %3
%9 = load double, double* %2
%10 = fsub double %9, %1
br label %20
11: ; preds = %3
%12 = load double, double* %2
%13 = fmul double %12, %1
br label %20
14: ; preds = %3
%15 = load double, double* %2
%16 = fdiv double %15, %1
br label %20
17: ; preds = %3
%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, %3
%23 = phi i32 [ 1, %3 ], [ 0, %20 ]
ret i32 %23
}