#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 */
float pow(float, int);
int /*<<< orphan*/ printf(char *, ...);
float toPower(float baseNum, int exponentNum) {
  if (exponentNum == 1) {
    return baseNum;
  } else if (exponentNum == -1) {
    return 1 / baseNum;
  } else if (exponentNum > 0 && exponentNum % 2 == 0) {
    return pow(toPower(baseNum, exponentNum / 2), 2);
  } else if (exponentNum > 0 && exponentNum > 1 && exponentNum % 2 == 1) {
    return baseNum * pow(toPower(baseNum, (exponentNum - 1) / 2), 2);
  } else if (exponentNum < 0 && exponentNum % 2 == -0) {
    printf("We get here (even)\n");
    return toPower(baseNum, exponentNum / 2) / baseNum;
  } else if (exponentNum < 1 && exponentNum % 2 == -1) {
    printf("We get here (odd)\t%d\n", exponentNum);
    return toPower(baseNum, (exponentNum - 1) / 2) / baseNum;
  } else if (exponentNum == 0) {
    return 1;
  }
  return 100;
}


x86 assembly (clang, -O0):
<toPower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1159 <toPower+0x29>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1320 <toPower+0x1f0>
cmpl   $0xffffffff,-0xc(%rbp)
jne    117a <toPower+0x4a>
movss  0xe99(%rip),%xmm0
divss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1320 <toPower+0x1f0>
cmpl   $0x0,-0xc(%rbp)
jle    11c3 <toPower+0x93>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11c3 <toPower+0x93>
movss  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <toPower@plt>
mov    $0x2,%edi
call   1050 <pow@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1320 <toPower+0x1f0>
cmpl   $0x0,-0xc(%rbp)
jle    122f <toPower+0xff>
cmpl   $0x1,-0xc(%rbp)
jle    122f <toPower+0xff>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    122f <toPower+0xff>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <toPower@plt>
mov    $0x2,%edi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1320 <toPower+0x1f0>
cmpl   $0x0,-0xc(%rbp)
jge    1281 <toPower+0x151>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1281 <toPower+0x151>
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <toPower@plt>
divss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1320 <toPower+0x1f0>
cmpl   $0x1,-0xc(%rbp)
jge    12d9 <toPower+0x1a9>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0xffffffff,%edx
jne    12d9 <toPower+0x1a9>
mov    -0xc(%rbp),%esi
lea    0xd73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <toPower@plt>
divss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1320 <toPower+0x1f0>
cmpl   $0x0,-0xc(%rbp)
jne    12f5 <toPower+0x1c5>
movss  0xd19(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1320 <toPower+0x1f0>
jmp    12fa <toPower+0x1ca>
jmp    12ff <toPower+0x1cf>
jmp    1304 <toPower+0x1d4>
jmp    1309 <toPower+0x1d9>
jmp    130e <toPower+0x1de>
jmp    1313 <toPower+0x1e3>
movss  0xce5(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toPower>:
push   %rbx
sub    $0x10,%rsp
movaps %xmm0,%xmm1
cmp    $0x1,%edi
je     1163 <toPower+0x23>
mov    %edi,%ebx
cmp    $0xffffffff,%edi
jne    116c <toPower+0x2c>
movss  0xea4(%rip),%xmm0
divss  %xmm1,%xmm0
movaps %xmm0,%xmm1
movaps %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret
test   %ebx,%ebx
jle    1192 <toPower+0x52>
mov    %ebx,%eax
and    $0x1,%eax
jne    1192 <toPower+0x52>
shr    %ebx
movaps %xmm1,%xmm0
mov    %ebx,%edi
call   1050 <toPower@plt>
mov    $0x2,%edi
add    $0x10,%rsp
pop    %rbx
jmp    1060 <pow@plt>
mov    %ebx,%ecx
shr    $0x1f,%ecx
add    %ebx,%ecx
and    $0xfffffffe,%ecx
mov    %ebx,%eax
sub    %ecx,%eax
cmp    $0x2,%ebx
jl     11d5 <toPower+0x95>
cmp    $0x1,%eax
jne    11d5 <toPower+0x95>
add    $0xffffffff,%ebx
shr    %ebx
movaps %xmm1,%xmm0
mov    %ebx,%edi
movss  %xmm1,0xc(%rsp)
call   1050 <toPower@plt>
mov    $0x2,%edi
call   1060 <pow@plt>
movss  0xc(%rsp),%xmm1
mulss  %xmm0,%xmm1
jmp    1163 <toPower+0x23>
mov    %ebx,%ecx
and    $0x80000001,%ecx
cmp    $0x80000000,%ecx
jne    1207 <toPower+0xc7>
lea    0xe36(%rip),%rdi
movss  %xmm1,0xc(%rsp)
call   1030 <puts@plt>
neg    %ebx
shr    %ebx
neg    %ebx
movss  0xc(%rsp),%xmm0
mov    %ebx,%edi
jmp    1237 <toPower+0xf7>
test   %ebx,%ebx
jg     124a <toPower+0x10a>
cmp    $0xffffffff,%eax
jne    124a <toPower+0x10a>
lea    0xdf5(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
movss  %xmm1,0xc(%rsp)
call   1040 <printf@plt>
mov    $0x1,%edi
sub    %ebx,%edi
shr    %edi
neg    %edi
movss  0xc(%rsp),%xmm0
call   1050 <toPower@plt>
movaps %xmm0,%xmm1
divss  0xc(%rsp),%xmm1
jmp    1163 <toPower+0x23>
xor    %eax,%eax
test   %ebx,%ebx
sete   %al
lea    0xdac(%rip),%rcx
movss  (%rcx,%rax,4),%xmm1
jmp    1163 <toPower+0x23>

LLVM IR (-O0):
@.str = [20 x i8] c"We get here (even)\0A\00"
@.str.1 = [22 x i8] c"We get here (odd)\09%d\0A\00"
define float @toPower(float %0, i32 %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store float %0, float* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load float, float* %4
store float %9, float* %3
br label %91
10: ; preds = %2
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load float, float* %4
%15 = fdiv float 1.000000e+00, %14
store float %15, float* %3
br label %91
16: ; preds = %10
%17 = load i32, i32* %5
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %29
19: ; preds = %16
%20 = load i32, i32* %5
%21 = srem i32 %20, 2
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %19
%24 = load float, float* %4
%25 = load i32, i32* %5
%26 = sdiv i32 %25, 2
%27 = call float @toPower(float %24, i32 %26)
%28 = call float @pow(float %27, i32 2)
store float %28, float* %3
br label %91
29: ; preds = %19, %16
%30 = load i32, i32* %5
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %48
32: ; preds = %29
%33 = load i32, i32* %5
%34 = icmp sgt i32 %33, 1
br i1 %34, label %35, label %48
35: ; preds = %32
%36 = load i32, i32* %5
%37 = srem i32 %36, 2
%38 = icmp eq i32 %37, 1
br i1 %38, label %39, label %48
39: ; preds = %35
%40 = load float, float* %4
%41 = load float, float* %4
%42 = load i32, i32* %5
%43 = sub nsw i32 %42, 1
%44 = sdiv i32 %43, 2
%45 = call float @toPower(float %41, i32 %44)
%46 = call float @pow(float %45, i32 2)
%47 = fmul float %40, %46
store float %47, float* %3
br label %91
48: ; preds = %35, %32, %29
%49 = load i32, i32* %5
%50 = icmp slt i32 %49, 0
br i1 %50, label %51, label %63
51: ; preds = %48
%52 = load i32, i32* %5
%53 = srem i32 %52, 2
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %63
55: ; preds = %51
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%57 = load float, float* %4
%58 = load i32, i32* %5
%59 = sdiv i32 %58, 2
%60 = call float @toPower(float %57, i32 %59)
%61 = load float, float* %4
%62 = fdiv float %60, %61
store float %62, float* %3
br label %91
63: ; preds = %51, %48
%64 = load i32, i32* %5
%65 = icmp slt i32 %64, 1
br i1 %65, label %66, label %80
66: ; preds = %63
%67 = load i32, i32* %5
%68 = srem i32 %67, 2
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %80
70: ; preds = %66
%71 = load i32, i32* %5
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %71)
%73 = load float, float* %4
%74 = load i32, i32* %5
%75 = sub nsw i32 %74, 1
%76 = sdiv i32 %75, 2
%77 = call float @toPower(float %73, i32 %76)
%78 = load float, float* %4
%79 = fdiv float %77, %78
store float %79, float* %3
br label %91
80: ; preds = %66, %63
%81 = load i32, i32* %5
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %84
83: ; preds = %80
store float 1.000000e+00, float* %3
br label %91
84: ; preds = %80
br label %85
85: ; preds = %84
br label %86
86: ; preds = %85
br label %87
87: ; preds = %86
br label %88
88: ; preds = %87
br label %89
89: ; preds = %88
br label %90
90: ; preds = %89
store float 1.000000e+02, float* %3
br label %91
91: ; preds = %90, %83, %70, %55, %39, %23, %13, %8
%92 = load float, float* %3
ret float %92
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"We get here (odd)\09%d\0A\00"
@str = [19 x i8] c"We get here (even)\00"
define float @toPower(float %0, i32 %1) {
switch i32 %1, label %5 [
i32 1, label %10
i32 -1, label %3
]
3: ; preds = %2
%4 = fdiv float 1.000000e+00, %0
br label %10
5: ; preds = %2
%6 = icmp sgt i32 %1, 0
%7 = and i32 %1, 1
%8 = icmp eq i32 %7, 0
%9 = and i1 %6, %8
br i1 %9, label %12, label %16
10: ; preds = %3, %2, %48, %41, %30, %21, %12
%11 = phi float [ %15, %12 ], [ %26, %21 ], [ %36, %30 ], [ %47, %41 ], [ %4, %3 ], [ %0, %2 ], [ %50, %48 ]
ret float %11
12: ; preds = %5
%13 = lshr i32 %1, 1
%14 = tail call float @toPower(float %0, i32 %13)
%15 = tail call float @pow(float %14, i32 2)
br label %10
16: ; preds = %5
%17 = icmp sgt i32 %1, 1
%18 = srem i32 %1, 2
%19 = icmp eq i32 %18, 1
%20 = and i1 %17, %19
br i1 %20, label %21, label %27
21: ; preds = %16
%22 = add nsw i32 %1, -1
%23 = lshr i32 %22, 1
%24 = tail call float @toPower(float %0, i32 %23)
%25 = tail call float @pow(float %24, i32 2)
%26 = fmul float %25, %0
br label %10
27: ; preds = %16
%28 = and i32 %1, -2147483647
%29 = icmp eq i32 %28, -2147483648
br i1 %29, label %30, label %37
30: ; preds = %27
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%32 = sub i32 0, %1
%33 = lshr i32 %32, 1
%34 = sub nsw i32 0, %33
%35 = tail call float @toPower(float %0, i32 %34)
%36 = fdiv float %35, %0
br label %10
37: ; preds = %27
%38 = icmp slt i32 %1, 1
%39 = icmp eq i32 %18, -1
%40 = and i1 %38, %39
br i1 %40, label %41, label %48
41: ; preds = %37
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%43 = sub i32 1, %1
%44 = lshr i32 %43, 1
%45 = sub nsw i32 0, %44
%46 = tail call float @toPower(float %0, i32 %45)
%47 = fdiv float %46, %0
br label %10
48: ; preds = %37
%49 = icmp eq i32 %1, 0
%50 = select i1 %49, float 1.000000e+00, float 1.000000e+02
br label %10
}