#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 __builtin_powi(double, int);
int /*<<< orphan*/ link_error();
void test(double x, int n) {
  if (__builtin_powi(x, -1.0) != 1.0 / x)
    link_error();
  if (__builtin_powi(x, 0.0) != 1.0)
    link_error();
  if (__builtin_powi(x, 1.0) != x)
    link_error();
  if (__builtin_powi(1.0, n) != 1.0)
    link_error();
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  0xed3(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  0xec7(%rip),%xmm1
divsd  -0x8(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jne    1153 <test+0x43>
jp     1153 <test+0x43>
jmp    115a <test+0x4a>
mov    $0x0,%al
call   1030 <link_error@plt>
movsd  -0x8(%rbp),%xmm0
movsd  0xe99(%rip),%xmm0
movsd  0xe91(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1184 <test+0x74>
jp     1184 <test+0x74>
jmp    118b <test+0x7b>
mov    $0x0,%al
call   1030 <link_error@plt>
movsd  -0x8(%rbp),%xmm0
ucomisd -0x8(%rbp),%xmm0
jne    11a6 <test+0x96>
jp     11a6 <test+0x96>
jmp    11ad <test+0x9d>
mov    $0x0,%al
call   1030 <link_error@plt>
mov    -0xc(%rbp),%edi
movsd  0xe48(%rip),%xmm0
call   11f0 <__powidf2>
movsd  0xe3b(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11da <test+0xca>
jp     11da <test+0xca>
jmp    11e1 <test+0xd1>
mov    $0x0,%al
call   1030 <link_error@plt>
add    $0x10,%rsp
pop    %rbp
ret
nopw   0x0(%rax,%rax,1)

x86 assembly (clang, -O2):
<test>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movapd %xmm0,%xmm2
movsd  0xedd(%rip),%xmm0
movapd %xmm0,%xmm1
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm1
jp     115c <test+0x4c>
ucomisd %xmm2,%xmm2
jp     117d <test+0x6d>
mov    %ebx,%edi
call   1190 <__powidf2>
ucomisd 0xeba(%rip),%xmm0
jne    114a <test+0x3a>
jnp    1156 <test+0x46>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1030 <link_error@plt>
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
movsd  %xmm2,0x8(%rsp)
call   1030 <link_error@plt>
movsd  0x8(%rsp),%xmm2
movsd  0xe89(%rip),%xmm0
ucomisd %xmm2,%xmm2
jnp    1137 <test+0x27>
xor    %eax,%eax
call   1030 <link_error@plt>
movsd  0xe74(%rip),%xmm0
jmp    1137 <test+0x27>
xchg   %ax,%ax

LLVM IR (-O0):
define void @test(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
%5 = load double, double* %3
%6 = call double @llvm.powi.f64.i32(double %5, i32 -1)
%7 = load double, double* %3
%8 = fdiv double 1.000000e+00, %7
%9 = fcmp une double %6, %8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @link_error()
br label %12
12: ; preds = %10, %2
%13 = load double, double* %3
%14 = call double @llvm.powi.f64.i32(double %13, i32 0)
%15 = fcmp une double %14, 1.000000e+00
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 (...) @link_error()
br label %18
18: ; preds = %16, %12
%19 = load double, double* %3
%20 = call double @llvm.powi.f64.i32(double %19, i32 1)
%21 = load double, double* %3
%22 = fcmp une double %20, %21
br i1 %22, label %23, label %25
23: ; preds = %18
%24 = call i32 (...) @link_error()
br label %25
25: ; preds = %23, %18
%26 = load i32, i32* %4
%27 = call double @llvm.powi.f64.i32(double 1.000000e+00, i32 %26)
%28 = fcmp une double %27, 1.000000e+00
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 (...) @link_error()
br label %31
31: ; preds = %29, %25
ret void
}

LLVM IR (-O2):
define void @test(double %0, i32 %1) {
%3 = fdiv double 1.000000e+00, %0
%4 = fcmp uno double %3, 0.000000e+00
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @link_error()
br label %7
7: ; preds = %2, %5
%8 = fcmp uno double %0, 0.000000e+00
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 (...) @link_error()
br label %11
11: ; preds = %9, %7
%12 = tail call double @llvm.powi.f64.i32(double 1.000000e+00, i32 %1)
%13 = fcmp une double %12, 1.000000e+00
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 (...) @link_error()
br label %16
16: ; preds = %14, %11
ret void
}