#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 uint_fast64_t;
typedef int uint64_t;
typedef int int_fast64_t;

/* Variables and functions */
int INT64_C(int);
int UINT64_C(int);
int rand();
void f64ToRecF64(uint64_t in, bool addRandomness, uint64_t *outPtr) {
  bool sign;
  int exp;
  int_fast64_t fract;
  sign = in >> 63 & 1;
  exp = in >> 52 & 0x7FF;
  fract = in & UINT64_C(0xFFFFFFFFFFFFF);
  if (exp == 0x7FF) {
    if (fract) {
      exp = 0xE00;
    } else {
      exp = 0xC00;
      if (addRandomness) {
        fract = (((uint_fast64_t)rand() << 45) + ((uint_fast64_t)rand() << 30) +
                 ((uint_fast64_t)rand() << 15) + rand()) &
                UINT64_C(0xFFFFFFFFFFFFF);
      }
    }
    if (addRandomness)
      exp |= rand() & 0x1FF;
  } else {
    if (exp == 0) {
      if (fract < 0x100000) {
        if (!fract) {
          if (addRandomness)
            exp = rand() & 0x1FF;
          goto done;
        }
        exp -= 32;
        fract <<= 32;
      }
      if (fract < INT64_C(0x1000000000)) {
        exp -= 16;
        fract <<= 16;
      }
      if (fract < INT64_C(0x100000000000)) {
        exp -= 8;
        fract <<= 8;
      }
      if (fract < INT64_C(0x1000000000000)) {
        exp -= 4;
        fract <<= 4;
      }
      if (fract < INT64_C(0x4000000000000)) {
        exp -= 2;
        fract <<= 2;
      }
      if (!(fract & INT64_C(0x8000000000000))) {
        --exp;
        fract <<= 1;
      }
      fract = (fract << 1) - INT64_C(0x10000000000000);
    }
    exp += 0x401;
  }
done:
  outPtr[1] = sign;
  outPtr[0] = (uint_fast64_t)exp << 52 | fract;
}


x86 assembly (clang, -O0):
<f64ToRecF64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3f,%ecx
sar    %cl,%eax
and    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x34,%ecx
sar    %cl,%eax
and    $0x7ff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x7ff,-0x18(%rbp)
jne    1236 <f64ToRecF64+0x106>
cmpl   $0x0,-0x1c(%rbp)
je     11a1 <f64ToRecF64+0x71>
movl   $0xe00,-0x18(%rbp)
jmp    1215 <f64ToRecF64+0xe5>
movl   $0xc00,-0x18(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1210 <f64ToRecF64+0xe0>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x2d,%ecx
shl    %cl,%eax
mov    %eax,-0x30(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
shl    $0x1e,%ecx
add    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
shl    $0xf,%ecx
add    %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x1c(%rbp)
jmp    1215 <f64ToRecF64+0xe5>
cmpl   $0x0,-0x8(%rbp)
je     1231 <f64ToRecF64+0x101>
mov    $0x0,%al
call   1050 <rand@plt>
and    $0x1ff,%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    138f <f64ToRecF64+0x25f>
cmpl   $0x0,-0x18(%rbp)
jne    1384 <f64ToRecF64+0x254>
cmpl   $0x100000,-0x1c(%rbp)
jge    128b <f64ToRecF64+0x15b>
cmpl   $0x0,-0x1c(%rbp)
jne    1275 <f64ToRecF64+0x145>
cmpl   $0x0,-0x8(%rbp)
je     1270 <f64ToRecF64+0x140>
mov    $0x0,%al
call   1050 <rand@plt>
and    $0x1ff,%eax
mov    %eax,-0x18(%rbp)
jmp    1394 <f64ToRecF64+0x264>
mov    -0x18(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x20,%ecx
shl    %cl,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x34(%rbp)
xor    %edi,%edi
call   1040 <INT64_C@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
cmp    %ecx,%eax
jge    12b7 <f64ToRecF64+0x187>
mov    -0x18(%rbp),%eax
sub    $0x10,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x10,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x38(%rbp)
xor    %edi,%edi
call   1040 <INT64_C@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
cmp    %ecx,%eax
jge    12e3 <f64ToRecF64+0x1b3>
mov    -0x18(%rbp),%eax
sub    $0x8,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
xor    %edi,%edi
call   1040 <INT64_C@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
cmp    %ecx,%eax
jge    130f <f64ToRecF64+0x1df>
mov    -0x18(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x40(%rbp)
xor    %edi,%edi
call   1040 <INT64_C@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
cmp    %ecx,%eax
jge    133b <f64ToRecF64+0x20b>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x44(%rbp)
xor    %edi,%edi
call   1040 <INT64_C@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
and    %ecx,%eax
cmp    $0x0,%eax
jne    136a <f64ToRecF64+0x23a>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x48(%rbp)
xor    %edi,%edi
call   1040 <INT64_C@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x401,%eax
mov    %eax,-0x18(%rbp)
jmp    1394 <f64ToRecF64+0x264>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x18(%rbp),%eax
mov    $0x34,%ecx
shl    %cl,%eax
mov    %eax,%ecx
or     -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f64ToRecF64>:
mov    $0xffffffff,%edi
jmp    1030 <UINT64_C@plt>

LLVM IR (-O0):
define void @f64ToRecF64(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%10 = load i32, i32* %4
%11 = ashr i32 %10, 63
%12 = and i32 %11, 1
store i32 %12, i32* %7
%13 = load i32, i32* %4
%14 = ashr i32 %13, 52
%15 = and i32 %14, 2047
store i32 %15, i32* %8
%16 = load i32, i32* %4
%17 = call i32 @UINT64_C(i32 -1)
%18 = and i32 %16, %17
store i32 %18, i32* %9
%19 = load i32, i32* %8
%20 = icmp eq i32 %19, 2047
br i1 %20, label %21, label %51
21: ; preds = %3
%22 = load i32, i32* %9
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %21
store i32 3584, i32* %8
br label %42
25: ; preds = %21
store i32 3072, i32* %8
%26 = load i32, i32* %5
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %41
28: ; preds = %25
%29 = call i32 (...) @rand()
%30 = shl i32 %29, 45
%31 = call i32 (...) @rand()
%32 = shl i32 %31, 30
%33 = add nsw i32 %30, %32
%34 = call i32 (...) @rand()
%35 = shl i32 %34, 15
%36 = add nsw i32 %33, %35
%37 = call i32 (...) @rand()
%38 = add nsw i32 %36, %37
%39 = call i32 @UINT64_C(i32 -1)
%40 = and i32 %38, %39
store i32 %40, i32* %9
br label %41
41: ; preds = %28, %25
br label %42
42: ; preds = %41, %24
%43 = load i32, i32* %5
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %50
45: ; preds = %42
%46 = call i32 (...) @rand()
%47 = and i32 %46, 511
%48 = load i32, i32* %8
%49 = or i32 %48, %47
store i32 %49, i32* %8
br label %50
50: ; preds = %45, %42
br label %126
51: ; preds = %3
%52 = load i32, i32* %8
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %123
54: ; preds = %51
%55 = load i32, i32* %9
%56 = icmp slt i32 %55, 1048576
br i1 %56, label %57, label %72
57: ; preds = %54
%58 = load i32, i32* %9
%59 = icmp ne i32 %58, 0
br i1 %59, label %67, label %60
60: ; preds = %57
%61 = load i32, i32* %5
%62 = icmp ne i32 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %60
%64 = call i32 (...) @rand()
%65 = and i32 %64, 511
store i32 %65, i32* %8
br label %66
66: ; preds = %63, %60
br label %127
67: ; preds = %57
%68 = load i32, i32* %8
%69 = sub nsw i32 %68, 32
store i32 %69, i32* %8
%70 = load i32, i32* %9
%71 = shl i32 %70, 32
store i32 %71, i32* %9
br label %72
72: ; preds = %67, %54
%73 = load i32, i32* %9
%74 = call i32 @INT64_C(i32 0)
%75 = icmp slt i32 %73, %74
br i1 %75, label %76, label %81
76: ; preds = %72
%77 = load i32, i32* %8
%78 = sub nsw i32 %77, 16
store i32 %78, i32* %8
%79 = load i32, i32* %9
%80 = shl i32 %79, 16
store i32 %80, i32* %9
br label %81
81: ; preds = %76, %72
%82 = load i32, i32* %9
%83 = call i32 @INT64_C(i32 0)
%84 = icmp slt i32 %82, %83
br i1 %84, label %85, label %90
85: ; preds = %81
%86 = load i32, i32* %8
%87 = sub nsw i32 %86, 8
store i32 %87, i32* %8
%88 = load i32, i32* %9
%89 = shl i32 %88, 8
store i32 %89, i32* %9
br label %90
90: ; preds = %85, %81
%91 = load i32, i32* %9
%92 = call i32 @INT64_C(i32 0)
%93 = icmp slt i32 %91, %92
br i1 %93, label %94, label %99
94: ; preds = %90
%95 = load i32, i32* %8
%96 = sub nsw i32 %95, 4
store i32 %96, i32* %8
%97 = load i32, i32* %9
%98 = shl i32 %97, 4
store i32 %98, i32* %9
br label %99
99: ; preds = %94, %90
%100 = load i32, i32* %9
%101 = call i32 @INT64_C(i32 0)
%102 = icmp slt i32 %100, %101
br i1 %102, label %103, label %108
103: ; preds = %99
%104 = load i32, i32* %8
%105 = sub nsw i32 %104, 2
store i32 %105, i32* %8
%106 = load i32, i32* %9
%107 = shl i32 %106, 2
store i32 %107, i32* %9
br label %108
108: ; preds = %103, %99
%109 = load i32, i32* %9
%110 = call i32 @INT64_C(i32 0)
%111 = and i32 %109, %110
%112 = icmp ne i32 %111, 0
br i1 %112, label %118, label %113
113: ; preds = %108
%114 = load i32, i32* %8
%115 = add nsw i32 %114, -1
store i32 %115, i32* %8
%116 = load i32, i32* %9
%117 = shl i32 %116, 1
store i32 %117, i32* %9
br label %118
118: ; preds = %113, %108
%119 = load i32, i32* %9
%120 = shl i32 %119, 1
%121 = call i32 @INT64_C(i32 0)
%122 = sub nsw i32 %120, %121
store i32 %122, i32* %9
br label %123
123: ; preds = %118, %51
%124 = load i32, i32* %8
%125 = add nsw i32 %124, 1025
store i32 %125, i32* %8
br label %126
126: ; preds = %123, %50
br label %127
127: ; preds = %126, %66
%128 = load i32, i32* %7
%129 = load i32*, i32** %6
%130 = getelementptr inbounds i32, i32* %129, i64 1
store i32 %128, i32* %130
%131 = load i32, i32* %8
%132 = shl i32 %131, 52
%133 = load i32, i32* %9
%134 = or i32 %132, %133
%135 = load i32*, i32** %6
%136 = getelementptr inbounds i32, i32* %135, i64 0
store i32 %134, i32* %136
ret void
}

LLVM IR (-O2):
define void @f64ToRecF64(i32 %0, i32 %1, i32* nocapture readnone %2) {
%4 = tail call i32 @UINT64_C(i32 -1)
ret void
}