#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*/ cos(double);
int /*<<< orphan*/ exp(double);
double pop();
int /*<<< orphan*/ pow(double, double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ push(int /*<<< orphan*/);
int /*<<< orphan*/ sin(double);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ tan(double);
void execute_function(char *name) {
  if (strcmp(name, "sin") == 0)
    push(sin(pop()));
  else if (strcmp(name, "cos") == 0)
    push(cos(pop()));
  else if (strcmp(name, "tan") == 0)
    push(tan(pop()));
  else if (strcmp(name, "exp") == 0)
    push(exp(pop()));
  else if (strcmp(name, "pow") == 0) {
    double op2 = pop();
    double op1 = pop();
    if (op1 == 0 && op2 <= 0)
      printf("error: trying to get \'%f^%f\'\n", op1, op2);
    else
      push(pow(op1, op2));
  } else
    printf("error: unknown command \'%s\'\n", name);
}


x86 assembly (clang, -O0):
<execute_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe59(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11ce <execute_function+0x3e>
mov    $0x0,%al
call   1040 <pop@plt>
call   1060 <sin@plt>
mov    %eax,%edi
call   10a0 <push@plt>
jmp    131a <execute_function+0x18a>
mov    -0x8(%rbp),%rdi
lea    0xe2b(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1200 <execute_function+0x70>
mov    $0x0,%al
call   1040 <pop@plt>
call   1090 <cos@plt>
mov    %eax,%edi
call   10a0 <push@plt>
jmp    1315 <execute_function+0x185>
mov    -0x8(%rbp),%rdi
lea    0xdfd(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1232 <execute_function+0xa2>
mov    $0x0,%al
call   1040 <pop@plt>
call   1080 <tan@plt>
mov    %eax,%edi
call   10a0 <push@plt>
jmp    1310 <execute_function+0x180>
mov    -0x8(%rbp),%rdi
lea    0xdcf(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1264 <execute_function+0xd4>
mov    $0x0,%al
call   1040 <pop@plt>
call   1070 <exp@plt>
mov    %eax,%edi
call   10a0 <push@plt>
jmp    130b <execute_function+0x17b>
mov    -0x8(%rbp),%rdi
lea    0xda1(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12f4 <execute_function+0x164>
mov    $0x0,%al
call   1040 <pop@plt>
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <pop@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12d9 <execute_function+0x149>
jp     12d9 <execute_function+0x149>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     12d9 <execute_function+0x149>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    0xd47(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    12ef <execute_function+0x15f>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   10b0 <pow@plt>
mov    %eax,%edi
call   10a0 <push@plt>
jmp    1306 <execute_function+0x176>
mov    -0x8(%rbp),%rsi
lea    0xd33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    130b <execute_function+0x17b>
jmp    1310 <execute_function+0x180>
jmp    1315 <execute_function+0x185>
jmp    131a <execute_function+0x18a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute_function>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xe61(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     120f <execute_function+0x7f>
lea    0xe54(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     121d <execute_function+0x8d>
lea    0xe44(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     122b <execute_function+0x9b>
lea    0xe34(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1239 <execute_function+0xa9>
lea    0xe24(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1247 <execute_function+0xb7>
lea    0xe32(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1030 <printf@plt>
xor    %eax,%eax
call   1040 <pop@plt>
call   1060 <sin@plt>
jmp    128b <execute_function+0xfb>
xor    %eax,%eax
call   1040 <pop@plt>
call   1090 <cos@plt>
jmp    128b <execute_function+0xfb>
xor    %eax,%eax
call   1040 <pop@plt>
call   1080 <tan@plt>
jmp    128b <execute_function+0xfb>
xor    %eax,%eax
call   1040 <pop@plt>
call   1070 <exp@plt>
jmp    128b <execute_function+0xfb>
xor    %eax,%eax
call   1040 <pop@plt>
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1040 <pop@plt>
movsd  0x8(%rsp),%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jne    1286 <execute_function+0xf6>
jp     1286 <execute_function+0xf6>
ucomisd %xmm1,%xmm2
jb     1286 <execute_function+0xf6>
lea    0xd9a(%rip),%rdi
mov    $0x2,%al
add    $0x10,%rsp
pop    %rbx
jmp    1030 <printf@plt>
call   10b0 <pow@plt>
mov    %eax,%edi
add    $0x10,%rsp
pop    %rbx
jmp    10a0 <push@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"sin\00"
@.str.1 = [4 x i8] c"cos\00"
@.str.2 = [4 x i8] c"tan\00"
@.str.3 = [4 x i8] c"exp\00"
@.str.4 = [4 x i8] c"pow\00"
@.str.5 = [30 x i8] c"error: trying to get '%f^%f'\0A\00"
@.str.6 = [29 x i8] c"error: unknown command '%s'\0A\00"
define void @execute_function(i8* %0) {
%2 = alloca i8*
%3 = alloca double
%4 = alloca double
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = call double (...) @pop()
%10 = call i32 @sin(double %9)
%11 = call i32 @push(i32 %10)
br label %65
12: ; preds = %1
%13 = load i8*, i8** %2
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = call double (...) @pop()
%18 = call i32 @cos(double %17)
%19 = call i32 @push(i32 %18)
br label %64
20: ; preds = %12
%21 = load i8*, i8** %2
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = call double (...) @pop()
%26 = call i32 @tan(double %25)
%27 = call i32 @push(i32 %26)
br label %63
28: ; preds = %20
%29 = load i8*, i8** %2
%30 = call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = call double (...) @pop()
%34 = call i32 @exp(double %33)
%35 = call i32 @push(i32 %34)
br label %62
36: ; preds = %28
%37 = load i8*, i8** %2
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %58
40: ; preds = %36
%41 = call double (...) @pop()
store double %41, double* %3
%42 = call double (...) @pop()
store double %42, double* %4
%43 = load double, double* %4
%44 = fcmp oeq double %43, 0.000000e+00
br i1 %44, label %45, label %52
45: ; preds = %40
%46 = load double, double* %3
%47 = fcmp ole double %46, 0.000000e+00
br i1 %47, label %48, label %52
48: ; preds = %45
%49 = load double, double* %4
%50 = load double, double* %3
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double %49, double %50)
br label %57
52: ; preds = %45, %40
%53 = load double, double* %4
%54 = load double, double* %3
%55 = call i32 @pow(double %53, double %54)
%56 = call i32 @push(i32 %55)
br label %57
57: ; preds = %52, %48
br label %61
58: ; preds = %36
%59 = load i8*, i8** %2
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %59)
br label %61
61: ; preds = %58, %57
br label %62
62: ; preds = %61, %32
br label %63
63: ; preds = %62, %24
br label %64
64: ; preds = %63, %16
br label %65
65: ; preds = %64, %8
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"sin\00"
@.str.1 = [4 x i8] c"cos\00"
@.str.2 = [4 x i8] c"tan\00"
@.str.3 = [4 x i8] c"exp\00"
@.str.4 = [4 x i8] c"pow\00"
@.str.5 = [30 x i8] c"error: trying to get '%f^%f'\0A\00"
@.str.6 = [29 x i8] c"error: unknown command '%s'\0A\00"
define void @execute_function(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call double (...) @pop()
%6 = tail call i32 @sin(double %5)
%7 = tail call i32 @push(i32 %6)
br label %45
8: ; preds = %1
%9 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = tail call double (...) @pop()
%13 = tail call i32 @cos(double %12)
%14 = tail call i32 @push(i32 %13)
br label %45
15: ; preds = %8
%16 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = tail call double (...) @pop()
%20 = tail call i32 @tan(double %19)
%21 = tail call i32 @push(i32 %20)
br label %45
22: ; preds = %15
%23 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %22
%26 = tail call double (...) @pop()
%27 = tail call i32 @exp(double %26)
%28 = tail call i32 @push(i32 %27)
br label %45
29: ; preds = %22
%30 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %43
32: ; preds = %29
%33 = tail call double (...) @pop()
%34 = tail call double (...) @pop()
%35 = fcmp oeq double %34, 0.000000e+00
%36 = fcmp ole double %33, 0.000000e+00
%37 = select i1 %35, i1 %36, i1 false
br i1 %37, label %38, label %40
38: ; preds = %32
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double %34, double %33)
br label %45
40: ; preds = %32
%41 = tail call i32 @pow(double %34, double %33)
%42 = tail call i32 @push(i32 %41)
br label %45
43: ; preds = %29
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %0)
br label %45
45: ; preds = %38, %40, %11, %25, %43, %18, %4
ret void
}