#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 exp(double);
double fabs(double);
int /*<<< orphan*/ link_error();
double log(double);
double pow(double, double);
double sqrt(double);
void test2(double x, double y, double z) {
  if (sqrt(pow(x, y)) != pow(fabs(x), y * 0.5))
    link_error();
  if (log(pow(x, y)) != y * log(x))
    link_error();
  if (pow(exp(x), y) != exp(x * y))
    link_error();
  if (pow(sqrt(x), y) != pow(x, y * 0.5))
    link_error();
  if (pow(pow(x, y), z) != pow(x, y * z))
    link_error();
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1060 <pow@plt>
call   1070 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movaps 0xe84(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe68(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jne    11bf <test2+0x6f>
jp     11bf <test2+0x6f>
jmp    11c6 <test2+0x76>
mov    $0x0,%al
call   1040 <link_error@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1060 <pow@plt>
call   1050 <log@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <log@plt>
movsd  -0x30(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jne    1219 <test2+0xc9>
jp     1219 <test2+0xc9>
jmp    1220 <test2+0xd0>
mov    $0x0,%al
call   1040 <link_error@plt>
movsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movsd  -0x10(%rbp),%xmm1
call   1060 <pow@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jne    1265 <test2+0x115>
jp     1265 <test2+0x115>
jmp    126c <test2+0x11c>
mov    $0x0,%al
call   1040 <link_error@plt>
movsd  -0x8(%rbp),%xmm0
call   1070 <sqrt@plt>
movsd  -0x10(%rbp),%xmm1
call   1060 <pow@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xd6e(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jne    12b9 <test2+0x169>
jp     12b9 <test2+0x169>
jmp    12c0 <test2+0x170>
mov    $0x0,%al
call   1040 <link_error@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1060 <pow@plt>
movsd  -0x18(%rbp),%xmm1
call   1060 <pow@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jne    130f <test2+0x1bf>
jp     130f <test2+0x1bf>
jmp    1316 <test2+0x1c6>
mov    $0x0,%al
call   1040 <link_error@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
sub    $0x38,%rsp
movsd  %xmm2,0x30(%rsp)
movapd %xmm0,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
call   1060 <pow@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     117b <test2+0x2b>
sqrtsd %xmm0,%xmm0
jmp    1180 <test2+0x30>
call   1070 <sqrt@plt>
movsd  %xmm0,(%rsp)
movapd 0x10(%rsp),%xmm1
movapd 0xe6d(%rip),%xmm0
andpd  %xmm1,%xmm0
movsd  0xe71(%rip),%xmm1
mulsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x28(%rsp)
call   1060 <pow@plt>
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
jne    11bd <test2+0x6d>
jnp    11c4 <test2+0x74>
xor    %eax,%eax
call   1040 <link_error@plt>
movaps 0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1060 <pow@plt>
call   1050 <log@plt>
movsd  %xmm0,(%rsp)
movapd 0x10(%rsp),%xmm0
call   1050 <log@plt>
mulsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
jne    11fc <test2+0xac>
jnp    1203 <test2+0xb3>
xor    %eax,%eax
call   1040 <link_error@plt>
movaps 0x10(%rsp),%xmm0
call   1030 <exp@plt>
movsd  0x8(%rsp),%xmm1
call   1060 <pow@plt>
movsd  %xmm0,(%rsp)
movapd 0x10(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1030 <exp@plt>
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
jne    123b <test2+0xeb>
jnp    1242 <test2+0xf2>
xor    %eax,%eax
call   1040 <link_error@plt>
xorpd  %xmm0,%xmm0
movapd 0x10(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jb     125b <test2+0x10b>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    1264 <test2+0x114>
movapd %xmm1,%xmm0
call   1070 <sqrt@plt>
movsd  0x8(%rsp),%xmm1
call   1060 <pow@plt>
movsd  %xmm0,(%rsp)
movapd 0x10(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
call   1060 <pow@plt>
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
jne    1292 <test2+0x142>
jnp    1299 <test2+0x149>
xor    %eax,%eax
call   1040 <link_error@plt>
movaps 0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1060 <pow@plt>
movsd  0x30(%rsp),%xmm1
call   1060 <pow@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rsp),%xmm1
mulsd  0x30(%rsp),%xmm1
movapd 0x10(%rsp),%xmm0
call   1060 <pow@plt>
movsd  0x28(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jne    12df <test2+0x18f>
jnp    12ea <test2+0x19a>
xor    %eax,%eax
add    $0x38,%rsp
jmp    1040 <link_error@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
define void @test2(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = call double @pow(double %7, double %8)
%10 = call double @sqrt(double %9)
%11 = load double, double* %4
%12 = call double @llvm.fabs.f64(double %11)
%13 = load double, double* %5
%14 = fmul double %13, 5.000000e-01
%15 = call double @pow(double %12, double %14)
%16 = fcmp une double %10, %15
br i1 %16, label %17, label %19
17: ; preds = %3
%18 = call i32 (...) @link_error()
br label %19
19: ; preds = %17, %3
%20 = load double, double* %4
%21 = load double, double* %5
%22 = call double @pow(double %20, double %21)
%23 = call double @log(double %22)
%24 = load double, double* %5
%25 = load double, double* %4
%26 = call double @log(double %25)
%27 = fmul double %24, %26
%28 = fcmp une double %23, %27
br i1 %28, label %29, label %31
29: ; preds = %19
%30 = call i32 (...) @link_error()
br label %31
31: ; preds = %29, %19
%32 = load double, double* %4
%33 = call double @exp(double %32)
%34 = load double, double* %5
%35 = call double @pow(double %33, double %34)
%36 = load double, double* %4
%37 = load double, double* %5
%38 = fmul double %36, %37
%39 = call double @exp(double %38)
%40 = fcmp une double %35, %39
br i1 %40, label %41, label %43
41: ; preds = %31
%42 = call i32 (...) @link_error()
br label %43
43: ; preds = %41, %31
%44 = load double, double* %4
%45 = call double @sqrt(double %44)
%46 = load double, double* %5
%47 = call double @pow(double %45, double %46)
%48 = load double, double* %4
%49 = load double, double* %5
%50 = fmul double %49, 5.000000e-01
%51 = call double @pow(double %48, double %50)
%52 = fcmp une double %47, %51
br i1 %52, label %53, label %55
53: ; preds = %43
%54 = call i32 (...) @link_error()
br label %55
55: ; preds = %53, %43
%56 = load double, double* %4
%57 = load double, double* %5
%58 = call double @pow(double %56, double %57)
%59 = load double, double* %6
%60 = call double @pow(double %58, double %59)
%61 = load double, double* %4
%62 = load double, double* %5
%63 = load double, double* %6
%64 = fmul double %62, %63
%65 = call double @pow(double %61, double %64)
%66 = fcmp une double %60, %65
br i1 %66, label %67, label %69
67: ; preds = %55
%68 = call i32 (...) @link_error()
br label %69
69: ; preds = %67, %55
ret void
}

LLVM IR (-O2):
define void @test2(double %0, double %1, double %2) {
%4 = tail call double @pow(double %0, double %1)
%5 = tail call double @sqrt(double %4)
%6 = tail call double @llvm.fabs.f64(double %0)
%7 = fmul double %1, 5.000000e-01
%8 = tail call double @pow(double %6, double %7)
%9 = fcmp une double %5, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = tail call i32 (...) @link_error()
br label %12
12: ; preds = %10, %3
%13 = tail call double @pow(double %0, double %1)
%14 = tail call double @log(double %13)
%15 = tail call double @log(double %0)
%16 = fmul double %15, %1
%17 = fcmp une double %14, %16
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = tail call i32 (...) @link_error()
br label %20
20: ; preds = %18, %12
%21 = tail call double @exp(double %0)
%22 = tail call double @pow(double %21, double %1)
%23 = fmul double %0, %1
%24 = tail call double @exp(double %23)
%25 = fcmp une double %22, %24
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = tail call i32 (...) @link_error()
br label %28
28: ; preds = %26, %20
%29 = tail call double @sqrt(double %0)
%30 = tail call double @pow(double %29, double %1)
%31 = tail call double @pow(double %0, double %7)
%32 = fcmp une double %30, %31
br i1 %32, label %33, label %35
33: ; preds = %28
%34 = tail call i32 (...) @link_error()
br label %35
35: ; preds = %33, %28
%36 = tail call double @pow(double %0, double %1)
%37 = tail call double @pow(double %36, double %2)
%38 = fmul double %1, %2
%39 = tail call double @pow(double %0, double %38)
%40 = fcmp une double %37, %39
br i1 %40, label %41, label %43
41: ; preds = %35
%42 = tail call i32 (...) @link_error()
br label %43
43: ; preds = %41, %35
ret void
}