#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 */
typedef int /*<<< orphan*/ b;
typedef int /*<<< orphan*/ a;

/* Variables and functions */
scalar_t__ memcmp(unsigned long long *, unsigned long long *, int);
int /*<<< orphan*/ memcpy(unsigned long long *, double *, int);
int test(double x, double y) {
  unsigned long long a, b;
  memcpy(&a, &x, sizeof(a));
  memcpy(&b, &y, sizeof(b));
  if ((a & 0x7ff8000000000000ULL) == 0x7ff8000000000000ULL)
    return (b & 0x7ff8000000000000ULL) != 0x7ff8000000000000ULL;
  return memcmp(&a, &b, sizeof(a)) != 0;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
lea    -0x28(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
movabs $0x7ff8000000000000,%rax
and    -0x20(%rbp),%rax
movabs $0x7ff8000000000000,%rcx
cmp    %rcx,%rax
jne    11a2 <test+0x82>
movabs $0x7ff8000000000000,%rax
and    -0x28(%rbp),%rax
movabs $0x7ff8000000000000,%rcx
cmp    %rcx,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11c3 <test+0xa3>
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x8,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbx
sub    $0x20,%rsp
movabs $0x7ff8000000000000,%rbx
movsd  %xmm0,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
lea    0x8(%rsp),%rdi
lea    0x18(%rsp),%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    %rsp,%rdi
lea    0x10(%rsp),%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    0x8(%rsp),%rax
not    %rax
test   %rbx,%rax
jne    117a <test+0x5a>
mov    (%rsp),%rax
not    %rax
test   %rax,%rbx
jmp    118f <test+0x6f>
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x8,%edx
call   1030 <memcmp@plt>
test   %rax,%rax
setne  %al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @test(double %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca i64
%7 = alloca i64
store double %0, double* %4
store double %1, double* %5
%8 = call i32 @memcpy(i64* %6, double* %4, i32 8)
%9 = call i32 @memcpy(i64* %7, double* %5, i32 8)
%10 = load i64, i64* %6
%11 = and i64 %10, 9221120237041090560
%12 = icmp eq i64 %11, 9221120237041090560
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i64, i64* %7
%15 = and i64 %14, 9221120237041090560
%16 = icmp ne i64 %15, 9221120237041090560
%17 = zext i1 %16 to i32
store i32 %17, i32* %3
br label %22
18: ; preds = %2
%19 = call i64 @memcmp(i64* %6, i64* %7, i32 8)
%20 = icmp ne i64 %19, 0
%21 = zext i1 %20 to i32
store i32 %21, i32* %3
br label %22
22: ; preds = %18, %13
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @test(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i64
%6 = alloca i64
store double %0, double* %3
store double %1, double* %4
%7 = bitcast i64* %5 to i8*
%8 = bitcast i64* %6 to i8*
%9 = call i32 @memcpy(i64* %5, double* %3, i32 8)
%10 = call i32 @memcpy(i64* %6, double* %4, i32 8)
%11 = load i64, i64* %5
%12 = and i64 %11, 9221120237041090560
%13 = icmp eq i64 %12, 9221120237041090560
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = load i64, i64* %6
%16 = and i64 %15, 9221120237041090560
%17 = icmp ne i64 %16, 9221120237041090560
br label %21
18: ; preds = %2
%19 = call i64 @memcmp(i64* %5, i64* %6, i32 8)
%20 = icmp ne i64 %19, 0
br label %21
21: ; preds = %18, %14
%22 = phi i1 [ %17, %14 ], [ %20, %18 ]
%23 = zext i1 %22 to i32
ret i32 %23
}