#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 */
int /*<<< orphan*/ abort();
double d(unsigned long long);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
double s(unsigned long long);
main() {
  unsigned long long int k;
  double x;
  if (sizeof(double) >= 8) {
    k = 0x8693ba6d7d220401ULL;
    x = d(k);
    k = (unsigned long long)x;
    if (k != 0x8693ba6d7d220800ULL)
      abort();
  }
  k = 0x8234508000000001ULL;
  x = s(k);
  k = (unsigned long long)x;
  if (k != 0x8234510000000000ULL)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movabs $0x8693ba6d7d220401,%rax
ba 93 86
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <d@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe88(%rip),%xmm2
movaps %xmm0,%xmm1
subsd  %xmm2,%xmm1
cvttsd2si %xmm1,%rcx
cvttsd2si %xmm0,%rax
mov    %rax,%rdx
sar    $0x3f,%rdx
and    %rdx,%rcx
or     %rcx,%rax
mov    %rax,-0x10(%rbp)
movabs $0x8693ba6d7d220800,%rax
ba 93 86
cmp    %rax,-0x10(%rbp)
je     11b5 <main+0x75>
mov    $0x0,%al
call   1030 <abort@plt>
movabs $0x8234508000000001,%rax
50 34 82
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <s@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe22(%rip),%xmm2
movaps %xmm0,%xmm1
subsd  %xmm2,%xmm1
cvttsd2si %xmm1,%rcx
cvttsd2si %xmm0,%rax
mov    %rax,%rdx
sar    $0x3f,%rdx
and    %rdx,%rcx
or     %rcx,%rax
mov    %rax,-0x10(%rbp)
movabs $0x8234510000000000,%rax
51 34 82
cmp    %rax,-0x10(%rbp)
je     121b <main+0xdb>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
movabs $0x8693ba6d7d220401,%rbx
ba 93 86
mov    %rbx,%rdi
call   1040 <d@plt>
cvttsd2si %xmm0,%rax
mov    %rax,%rcx
sar    $0x3f,%rcx
subsd  0xe99(%rip),%xmm0
cvttsd2si %xmm0,%rdx
and    %rcx,%rdx
or     %rax,%rdx
add    $0x3ff,%rbx
cmp    %rbx,%rdx
jne    11c2 <main+0x82>
movabs $0x8234508000000001,%rdi
50 34 82
call   1050 <s@plt>
cvttsd2si %xmm0,%rax
mov    %rax,%rcx
sar    $0x3f,%rcx
subsd  0xe5f(%rip),%xmm0
cvttsd2si %xmm0,%rdx
and    %rcx,%rdx
or     %rax,%rdx
movabs $0x8234510000000000,%rax
51 34 82
cmp    %rax,%rdx
jne    11c2 <main+0x82>
xor    %edi,%edi
call   1060 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca double
store i32 0, i32* %1
store i64 -8749444671637158911, i64* %2
%4 = load i64, i64* %2
%5 = call double @d(i64 %4)
store double %5, double* %3
%6 = load double, double* %3
%7 = fptoui double %6 to i64
store i64 %7, i64* %2
%8 = load i64, i64* %2
%9 = icmp ne i64 %8, -8749444671637157888
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %0
store i64 -9064531639303929855, i64* %2
%13 = load i64, i64* %2
%14 = call double @s(i64 %13)
store double %14, double* %3
%15 = load double, double* %3
%16 = fptoui double %15 to i64
store i64 %16, i64* %2
%17 = load i64, i64* %2
%18 = icmp ne i64 %17, -9064531089548115968
br i1 %18, label %19, label %21
19: ; preds = %12
%20 = call i32 (...) @abort()
unreachable
21: ; preds = %12
%22 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call double @d(i64 -8749444671637158911)
%2 = fptoui double %1 to i64
%3 = icmp eq i64 %2, -8749444671637157888
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = tail call double @s(i64 -9064531639303929855)
%8 = fptoui double %7 to i64
%9 = icmp eq i64 %8, -9064531089548115968
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = tail call i32 (...) @abort()
unreachable
12: ; preds = %6
%13 = tail call i32 @exit(i32 0)
unreachable
}