#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 INFINITY;
double NAN;
int /*<<< orphan*/ __VERIFIER_assert(int);
double copysign(double, double);
scalar_t__ isnan(double);
scalar_t__ signbit(double);
int main(void) {
  __VERIFIER_assert(copysign(1.0, +2.0) == 1.0);
  __VERIFIER_assert(copysign(1.0, -2.0) == -1.0);
  __VERIFIER_assert(copysign(-1.0, +2.0) == 1.0);
  __VERIFIER_assert(copysign(-1.0, -2.0) == -1.0);
  __VERIFIER_assert(copysign(INFINITY, -2.0) == -INFINITY);
  double snan = copysign(NAN, -2.0);
  __VERIFIER_assert(isnan(snan) && signbit(snan));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  0xec9(%rip),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assert@plt>
movsd  0xea3(%rip),%xmm0
movsd  0xe9b(%rip),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assert@plt>
movsd  0xe85(%rip),%xmm0
movsd  0xe7d(%rip),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assert@plt>
movsd  0xe57(%rip),%xmm0
movsd  0xe4f(%rip),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assert@plt>
mov    0x2e02(%rip),%rax
movsd  (%rax),%xmm0
movaps 0xe17(%rip),%xmm1
por    %xmm1,%xmm0
mov    0x2dec(%rip),%rax
movsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assert@plt>
mov    0x2dcc(%rip),%rax
movsd  (%rax),%xmm0
movaps 0xdc9(%rip),%xmm1
por    %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <isnan@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
je     1270 <main+0x140>
movsd  -0x10(%rbp),%xmm0
call   1040 <signbit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assert@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    $0x1,%edi
call   1050 <__VERIFIER_assert@plt>
mov    $0x1,%edi
call   1050 <__VERIFIER_assert@plt>
mov    $0x1,%edi
call   1050 <__VERIFIER_assert@plt>
mov    $0x1,%edi
call   1050 <__VERIFIER_assert@plt>
mov    0x2e7d(%rip),%rax
movsd  (%rax),%xmm0
movapd 0xe91(%rip),%xmm1
andpd  %xmm0,%xmm1
cmpeqsd %xmm0,%xmm1
movq   %xmm1,%rdi
and    $0x1,%edi
call   1050 <__VERIFIER_assert@plt>
mov    0x2e6c(%rip),%rax
movsd  (%rax),%xmm0
orps   0xe79(%rip),%xmm0
movaps %xmm0,(%rsp)
call   1030 <isnan@plt>
test   %rax,%rax
je     11b9 <main+0x89>
movaps (%rsp),%xmm0
call   1040 <signbit@plt>
xor    %edi,%edi
test   %rax,%rax
setne  %dil
jmp    11bb <main+0x8b>
xor    %edi,%edi
call   1050 <__VERIFIER_assert@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@INFINITY = global double 0.000000e+00
@NAN = global double 0.000000e+00
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
%3 = call double @llvm.copysign.f64(double 1.000000e+00, double 2.000000e+00)
%4 = fcmp oeq double %3, 1.000000e+00
%5 = zext i1 %4 to i32
%6 = call i32 @__VERIFIER_assert(i32 %5)
%7 = call double @llvm.copysign.f64(double 1.000000e+00, double -2.000000e+00)
%8 = fcmp oeq double %7, -1.000000e+00
%9 = zext i1 %8 to i32
%10 = call i32 @__VERIFIER_assert(i32 %9)
%11 = call double @llvm.copysign.f64(double -1.000000e+00, double 2.000000e+00)
%12 = fcmp oeq double %11, 1.000000e+00
%13 = zext i1 %12 to i32
%14 = call i32 @__VERIFIER_assert(i32 %13)
%15 = call double @llvm.copysign.f64(double -1.000000e+00, double -2.000000e+00)
%16 = fcmp oeq double %15, -1.000000e+00
%17 = zext i1 %16 to i32
%18 = call i32 @__VERIFIER_assert(i32 %17)
%19 = load double, double* @INFINITY
%20 = call double @llvm.copysign.f64(double %19, double -2.000000e+00)
%21 = load double, double* @INFINITY
%22 = fneg double %21
%23 = fcmp oeq double %20, %22
%24 = zext i1 %23 to i32
%25 = call i32 @__VERIFIER_assert(i32 %24)
%26 = load double, double* @NAN
%27 = call double @llvm.copysign.f64(double %26, double -2.000000e+00)
store double %27, double* %2
%28 = load double, double* %2
%29 = call i64 @isnan(double %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %0
%32 = load double, double* %2
%33 = call i64 @signbit(double %32)
%34 = icmp ne i64 %33, 0
br label %35
35: ; preds = %31, %0
%36 = phi i1 [ false, %0 ], [ %34, %31 ]
%37 = zext i1 %36 to i32
%38 = call i32 @__VERIFIER_assert(i32 %37)
%39 = load i32, i32* %1
ret i32 %39
}

LLVM IR (-O2):
@INFINITY = global double 0.000000e+00
@NAN = global double 0.000000e+00
define i32 @main() {
%1 = tail call i32 @__VERIFIER_assert(i32 1)
%2 = tail call i32 @__VERIFIER_assert(i32 1)
%3 = tail call i32 @__VERIFIER_assert(i32 1)
%4 = tail call i32 @__VERIFIER_assert(i32 1)
%5 = load double, double* @INFINITY
%6 = tail call double @llvm.fabs.f64(double %5)
%7 = fcmp oeq double %6, %5
%8 = zext i1 %7 to i32
%9 = tail call i32 @__VERIFIER_assert(i32 %8)
%10 = load double, double* @NAN
%11 = tail call double @llvm.fabs.f64(double %10)
%12 = fneg double %11
%13 = tail call i64 @isnan(double %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %0
%16 = tail call i64 @signbit(double %12)
%17 = icmp ne i64 %16, 0
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %15, %0
%20 = phi i32 [ 0, %0 ], [ %18, %15 ]
%21 = tail call i32 @__VERIFIER_assert(i32 %20)
ret i32 0
}