#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 my_exper(float, int);
double my_exper2(float, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *, int *);
int main(void) {
  printf("请输入底数和幂指数（例如：3.14, 2）代表求3.14的平方：");
  float base;
  int exp;
  scanf("%f, %d", &base, &exp);
  if (base == 0 && exp == 0)
    printf("0的0次方无意义！\n");
  if (base == 0 && exp != 0)
    printf("%f^%d = 0\n", base, exp);
  else if (base != 0 && exp == 0)
    printf("%f^%d = 1\n", base, exp);
  else if (exp < 0) {
    exp *= -1;
    printf("%f^%d = %.6f\n", base, exp, 1 / my_exper(base, exp));
    printf("%f^%d = %.6f\n", base, exp, 1 / my_exper2(base, exp));
  } else {
    printf("%f^%d = %.6f\n", base, exp, my_exper(base, exp));
    printf("%f^%d = %.6f\n", base, exp, my_exper2(base, exp));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1060 <scanf@plt>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11a0 <main+0x60>
jp     11a0 <main+0x60>
cmpl   $0x0,-0xc(%rbp)
jne    11a0 <main+0x60>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11e0 <main+0xa0>
jp     11e0 <main+0xa0>
cmpl   $0x0,-0xc(%rbp)
je     11e0 <main+0xa0>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0xc(%rbp),%esi
lea    0xe9f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1345 <main+0x205>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11fc <main+0xbc>
jp     11fc <main+0xbc>
jmp    1225 <main+0xe5>
cmpl   $0x0,-0xc(%rbp)
jne    1225 <main+0xe5>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0xc(%rbp),%esi
lea    0xe65(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1340 <main+0x200>
cmpl   $0x0,-0xc(%rbp)
jge    12c7 <main+0x187>
imul   $0xffffffff,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
movss  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1040 <my_exper@plt>
mov    -0x2c(%rbp),%esi
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
movsd  0xd96(%rip),%xmm1
divsd  %xmm2,%xmm1
lea    0xe14(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1050 <my_exper2@plt>
mov    -0x1c(%rbp),%esi
movaps %xmm0,%xmm2
movsd  -0x18(%rbp),%xmm0
movsd  0xd50(%rip),%xmm1
divsd  %xmm2,%xmm1
lea    0xdce(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    133b <main+0x1fb>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4c(%rbp)
movss  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1040 <my_exper@plt>
mov    -0x4c(%rbp),%esi
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
lea    0xd8f(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x3c(%rbp)
movss  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1050 <my_exper2@plt>
mov    -0x3c(%rbp),%esi
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
lea    0xd55(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    1340 <main+0x200>
jmp    1345 <main+0x205>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee7(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1070 <scanf@plt>
movss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
mov    0x8(%rsp),%ebx
jne    11ac <main+0x5c>
jp     11ac <main+0x5c>
test   %ebx,%ebx
jne    11ac <main+0x5c>
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
xorps  %xmm1,%xmm1
mov    0x8(%rsp),%ebx
movss  0xc(%rsp),%xmm0
ucomiss %xmm1,%xmm0
jne    11c6 <main+0x76>
jp     11c6 <main+0x76>
test   %ebx,%ebx
je     11c6 <main+0x76>
cvtss2sd %xmm0,%xmm0
lea    0xe98(%rip),%rdi
mov    %ebx,%esi
jmp    11e1 <main+0x91>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11d0 <main+0x80>
jnp    11ed <main+0x9d>
test   %ebx,%ebx
jne    11ed <main+0x9d>
cvtss2sd %xmm0,%xmm0
lea    0xe86(%rip),%rdi
xor    %esi,%esi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    12bf <main+0x16f>
test   %ebx,%ebx
js     1244 <main+0xf4>
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
mov    %ebx,%edi
call   1050 <my_exper@plt>
movaps %xmm0,%xmm1
lea    0xe61(%rip),%r14
mov    %r14,%rdi
movsd  0x10(%rsp),%xmm0
mov    %ebx,%esi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
mov    0x8(%rsp),%ebx
mov    %ebx,%edi
call   1060 <my_exper2@plt>
movaps %xmm0,%xmm1
jmp    12ad <main+0x15d>
neg    %ebx
mov    %ebx,0x8(%rsp)
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
mov    %ebx,%edi
call   1050 <my_exper@plt>
movsd  0xd9a(%rip),%xmm1
divsd  %xmm0,%xmm1
lea    0xdff(%rip),%r14
mov    %r14,%rdi
movsd  0x10(%rsp),%xmm0
mov    %ebx,%esi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
mov    0x8(%rsp),%ebx
mov    %ebx,%edi
call   1060 <my_exper2@plt>
movsd  0xd57(%rip),%xmm1
divsd  %xmm0,%xmm1
mov    %r14,%rdi
movsd  0x10(%rsp),%xmm0
mov    %ebx,%esi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [75 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E5\BA\95\E6\95\B0\E5\92\8C\E5\B9\82\E6\8C\87\E6\95\B0\EF\BC\88\E4\BE\8B\E5\A6\82\EF\BC\9A3.14, 2\EF\BC\89\E4\BB\A3\E8\A1\A8\E6\B1\823.14\E7\9A\84\E5\B9\B3\E6\96\B9\EF\BC\9A\00"
@.str.1 = [7 x i8] c"%f, %d\00"
@.str.2 = [25 x i8] c"0\E7\9A\840\E6\AC\A1\E6\96\B9\E6\97\A0\E6\84\8F\E4\B9\89\EF\BC\81\0A\00"
@.str.3 = [11 x i8] c"%f^%d = 0\0A\00"
@.str.4 = [11 x i8] c"%f^%d = 1\0A\00"
@.str.5 = [14 x i8] c"%f^%d = %.6f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), float* %2, i32* %3)
%6 = load float, float* %2
%7 = fcmp oeq float %6, 0.000000e+00
br i1 %7, label %8, label %13
8: ; preds = %0
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %11, %8, %0
%14 = load float, float* %2
%15 = fcmp oeq float %14, 0.000000e+00
br i1 %15, label %16, label %24
16: ; preds = %13
%17 = load i32, i32* %3
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load float, float* %2
%21 = fpext float %20 to double
%22 = load i32, i32* %3
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), double %21, i32 %22)
br label %74
24: ; preds = %16, %13
%25 = load float, float* %2
%26 = fcmp une float %25, 0.000000e+00
br i1 %26, label %27, label %35
27: ; preds = %24
%28 = load i32, i32* %3
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %27
%31 = load float, float* %2
%32 = fpext float %31 to double
%33 = load i32, i32* %3
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), double %32, i32 %33)
br label %73
35: ; preds = %27, %24
%36 = load i32, i32* %3
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %57
38: ; preds = %35
%39 = load i32, i32* %3
%40 = mul nsw i32 %39, -1
store i32 %40, i32* %3
%41 = load float, float* %2
%42 = fpext float %41 to double
%43 = load i32, i32* %3
%44 = load float, float* %2
%45 = load i32, i32* %3
%46 = call double @my_exper(float %44, i32 %45)
%47 = fdiv double 1.000000e+00, %46
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %42, i32 %43, double %47)
%49 = load float, float* %2
%50 = fpext float %49 to double
%51 = load i32, i32* %3
%52 = load float, float* %2
%53 = load i32, i32* %3
%54 = call double @my_exper2(float %52, i32 %53)
%55 = fdiv double 1.000000e+00, %54
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %50, i32 %51, double %55)
br label %72
57: ; preds = %35
%58 = load float, float* %2
%59 = fpext float %58 to double
%60 = load i32, i32* %3
%61 = load float, float* %2
%62 = load i32, i32* %3
%63 = call double @my_exper(float %61, i32 %62)
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %59, i32 %60, double %63)
%65 = load float, float* %2
%66 = fpext float %65 to double
%67 = load i32, i32* %3
%68 = load float, float* %2
%69 = load i32, i32* %3
%70 = call double @my_exper2(float %68, i32 %69)
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %66, i32 %67, double %70)
br label %72
72: ; preds = %57, %38
br label %73
73: ; preds = %72, %30
br label %74
74: ; preds = %73, %19
ret i32 0
}

LLVM IR (-O2):
@.str = [75 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E5\BA\95\E6\95\B0\E5\92\8C\E5\B9\82\E6\8C\87\E6\95\B0\EF\BC\88\E4\BE\8B\E5\A6\82\EF\BC\9A3.14, 2\EF\BC\89\E4\BB\A3\E8\A1\A8\E6\B1\823.14\E7\9A\84\E5\B9\B3\E6\96\B9\EF\BC\9A\00"
@.str.1 = [7 x i8] c"%f, %d\00"
@.str.3 = [11 x i8] c"%f^%d = 0\0A\00"
@.str.4 = [11 x i8] c"%f^%d = 1\0A\00"
@.str.5 = [14 x i8] c"%f^%d = %.6f\0A\00"
@str = [24 x i8] c"0\E7\9A\840\E6\AC\A1\E6\96\B9\E6\97\A0\E6\84\8F\E4\B9\89\EF\BC\81\00"
define i32 @main() {
%1 = alloca float
%2 = alloca i32
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0))
%4 = bitcast float* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), float* %1, i32* %2)
%7 = load float, float* %1
%8 = fcmp oeq float %7, 0.000000e+00
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 0
%11 = select i1 %8, i1 %10, i1 false
br i1 %11, label %12, label %16
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%14 = load i32, i32* %2
%15 = load float, float* %1
br label %16
16: ; preds = %12, %0
%17 = phi float [ %15, %12 ], [ %7, %0 ]
%18 = phi i32 [ %14, %12 ], [ %9, %0 ]
%19 = fcmp oeq float %17, 0.000000e+00
%20 = icmp ne i32 %18, 0
%21 = select i1 %19, i1 %20, i1 false
br i1 %21, label %22, label %25
22: ; preds = %16
%23 = fpext float %17 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), double %23, i32 %18)
br label %55
25: ; preds = %16
%26 = fcmp une float %17, 0.000000e+00
%27 = icmp eq i32 %18, 0
%28 = select i1 %26, i1 %27, i1 false
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = fpext float %17 to double
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), double %30, i32 0)
br label %55
32: ; preds = %25
%33 = icmp slt i32 %18, 0
br i1 %33, label %34, label %46
34: ; preds = %32
%35 = sub nsw i32 0, %18
store i32 %35, i32* %2
%36 = fpext float %17 to double
%37 = call double @my_exper(float %17, i32 %35)
%38 = fdiv double 1.000000e+00, %37
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %36, i32 %35, double %38)
%40 = load float, float* %1
%41 = fpext float %40 to double
%42 = load i32, i32* %2
%43 = call double @my_exper2(float %40, i32 %42)
%44 = fdiv double 1.000000e+00, %43
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %41, i32 %42, double %44)
br label %55
46: ; preds = %32
%47 = fpext float %17 to double
%48 = call double @my_exper(float %17, i32 %18)
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %47, i32 %18, double %48)
%50 = load float, float* %1
%51 = fpext float %50 to double
%52 = load i32, i32* %2
%53 = call double @my_exper2(float %50, i32 %52)
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %51, i32 %52, double %53)
br label %55
55: ; preds = %29, %46, %34, %22
ret i32 0
}