#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 modf(double, double *);
long C_number(long **ptr, double n) {
  long *p = *ptr, *p0;
  double m;
  if (n <= (double)0x3fffffffffffffffL &&
      n >= (double)(-0x3fffffffffffffffL - 1) && modf(n, &m) == 0.0)
    return (((long)(n) << 1) | 0x00000001);
  p0 = p;
  *(p++) = ((0x0500000000000000L | 0x4000000000000000L | 0x1000000000000000L) |
            sizeof(double));
  *((double *)p) = n;
  *ptr = p + sizeof(double) / sizeof(long);
  return (long)p0;
}


x86 assembly (clang, -O0):
<C_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
movsd  0xecc(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     118e <C_number+0x7e>
movsd  -0x18(%rbp),%xmm0
movsd  0xebc(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     118e <C_number+0x7e>
movsd  -0x18(%rbp),%xmm0
lea    -0x30(%rbp),%rdi
call   1030 <modf@plt>
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    118e <C_number+0x7e>
jp     118e <C_number+0x7e>
cvttsd2si -0x18(%rbp),%rax
shl    $0x1,%rax
or     $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11d6 <C_number+0xc6>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x20(%rbp)
movabs $0x5500000000000008,%rcx
mov    %rcx,(%rax)
movsd  -0x18(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rcx
add    $0x8,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<C_number>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
mov    (%rdi),%rbx
movsd  0xedb(%rip),%xmm1
ucomisd %xmm0,%xmm1
jb     1166 <C_number+0x56>
ucomisd 0xed5(%rip),%xmm0
jb     1166 <C_number+0x56>
lea    0x10(%rsp),%rdi
movsd  %xmm0,0x8(%rsp)
call   1030 <modf@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
movsd  0x8(%rsp),%xmm0
jne    1166 <C_number+0x56>
jp     1166 <C_number+0x56>
cvttsd2si %xmm0,%rax
lea    (%rax,%rax,1),%rbx
add    $0x1,%rbx
jmp    117f <C_number+0x6f>
movabs $0x5500000000000008,%rax
mov    %rax,(%rbx)
movsd  %xmm0,0x8(%rbx)
lea    0x10(%rbx),%rax
mov    %rax,(%r14)
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @C_number(i64** %0, double %1) {
%3 = alloca i64
%4 = alloca i64**
%5 = alloca double
%6 = alloca i64*
%7 = alloca i64*
%8 = alloca double
store i64** %0, i64*** %4
store double %1, double* %5
%9 = load i64**, i64*** %4
%10 = load i64*, i64** %9
store i64* %10, i64** %6
%11 = load double, double* %5
%12 = fcmp ole double %11, 0x43D0000000000000
br i1 %12, label %13, label %25
13: ; preds = %2
%14 = load double, double* %5
%15 = fcmp oge double %14, 0xC3D0000000000000
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = load double, double* %5
%18 = call double @modf(double %17, double* %8)
%19 = fcmp oeq double %18, 0.000000e+00
br i1 %19, label %20, label %25
20: ; preds = %16
%21 = load double, double* %5
%22 = fptosi double %21 to i64
%23 = shl i64 %22, 1
%24 = or i64 %23, 1
store i64 %24, i64* %3
br label %37
25: ; preds = %16, %13, %2
%26 = load i64*, i64** %6
store i64* %26, i64** %7
%27 = load i64*, i64** %6
%28 = getelementptr inbounds i64, i64* %27, i32 1
store i64* %28, i64** %6
store i64 6124895493223874568, i64* %27
%29 = load double, double* %5
%30 = load i64*, i64** %6
%31 = bitcast i64* %30 to double*
store double %29, double* %31
%32 = load i64*, i64** %6
%33 = getelementptr inbounds i64, i64* %32, i64 1
%34 = load i64**, i64*** %4
store i64* %33, i64** %34
%35 = load i64*, i64** %7
%36 = ptrtoint i64* %35 to i64
store i64 %36, i64* %3
br label %37
37: ; preds = %25, %20
%38 = load i64, i64* %3
ret i64 %38
}

LLVM IR (-O2):
define i64 @C_number(i64** nocapture %0, double %1) {
%3 = alloca double
%4 = load i64*, i64** %0
%5 = bitcast double* %3 to i8*
%6 = fcmp ole double %1, 0x43D0000000000000
%7 = fcmp oge double %1, 0xC3D0000000000000
%8 = and i1 %6, %7
br i1 %8, label %9, label %16
9: ; preds = %2
%10 = call double @modf(double %1, double* %3)
%11 = fcmp oeq double %10, 0.000000e+00
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = fptosi double %1 to i64
%14 = shl i64 %13, 1
%15 = or i64 %14, 1
br label %21
16: ; preds = %9, %2
%17 = getelementptr inbounds i64, i64* %4, i64 1
store i64 6124895493223874568, i64* %4
%18 = bitcast i64* %17 to double*
store double %1, double* %18
%19 = getelementptr inbounds i64, i64* %4, i64 2
store i64* %19, i64** %0
%20 = ptrtoint i64* %4 to i64
br label %21
21: ; preds = %16, %12
%22 = phi i64 [ %15, %12 ], [ %20, %16 ]
ret i64 %22
}