#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 */
long __builtin_lfloor(scalar_t__);
scalar_t__ fabs(double);
scalar_t__ floor(scalar_t__);
int /*<<< orphan*/ link_error();
scalar_t__ trunc(scalar_t__);
void test(double x) {
  if (floor(fabs(x)) != trunc(fabs(x)))
    link_error();
  if (__builtin_lfloor(fabs(x)) != (long)fabs(x))
    link_error();
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rdi
call   1070 <floor@plt>
mov    %rax,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rdi
call   1050 <trunc@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     119c <test+0x4c>
mov    $0x0,%al
call   1060 <link_error@plt>
movsd  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rdi
call   1040 <__builtin_lfloor@plt>
mov    %rax,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
je     11d3 <test+0x83>
mov    $0x0,%al
call   1060 <link_error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
call   1030 <fabs@plt>
mov    %rax,%rdi
call   1070 <floor@plt>
mov    %rax,%rbx
movsd  0x8(%rsp),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rdi
call   1050 <trunc@plt>
cmp    %rax,%rbx
je     118a <test+0x3a>
xor    %eax,%eax
call   1060 <link_error@plt>
movsd  0x8(%rsp),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rdi
call   1040 <__builtin_lfloor@plt>
mov    %rax,%rbx
movsd  0x8(%rsp),%xmm0
call   1030 <fabs@plt>
cmp    %rax,%rbx
jne    11b6 <test+0x66>
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1060 <link_error@plt>

LLVM IR (-O0):
define void @test(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @fabs(double %3)
%5 = call i64 @floor(i64 %4)
%6 = load double, double* %2
%7 = call i64 @fabs(double %6)
%8 = call i64 @trunc(i64 %7)
%9 = icmp ne i64 %5, %8
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 (...) @link_error()
br label %12
12: ; preds = %10, %1
%13 = load double, double* %2
%14 = call i64 @fabs(double %13)
%15 = call i64 @__builtin_lfloor(i64 %14)
%16 = load double, double* %2
%17 = call i64 @fabs(double %16)
%18 = icmp ne i64 %15, %17
br i1 %18, label %19, label %21
19: ; preds = %12
%20 = call i32 (...) @link_error()
br label %21
21: ; preds = %19, %12
ret void
}

LLVM IR (-O2):
define void @test(double %0) {
%2 = tail call i64 @fabs(double %0)
%3 = tail call i64 @floor(i64 %2)
%4 = tail call i64 @fabs(double %0)
%5 = tail call i64 @trunc(i64 %4)
%6 = icmp eq i64 %3, %5
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 (...) @link_error()
br label %9
9: ; preds = %7, %1
%10 = tail call i64 @fabs(double %0)
%11 = tail call i64 @__builtin_lfloor(i64 %10)
%12 = tail call i64 @fabs(double %0)
%13 = icmp eq i64 %11, %12
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = tail call i32 (...) @link_error()
br label %16
16: ; preds = %14, %9
ret void
}