int main(void) {
  volatile unsigned long long h = 0x8000000000000000LL;
  volatile unsigned long long l = 0xdLL;
  volatile unsigned __int128 u128 = (((unsigned __int128)h) << 64) | l;
  volatile __int128 s128 = u128;
  float fs = s128;
  if (fs != -0x1p+127)
    abort();
  double ds = s128;
  if (ds != -0x1p+127)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movabs $0x8000000000000000,%rax
mov    %rax,-0x10(%rbp)
movq   $0xd,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rcx,-0x38(%rbp)
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   11f0 <__floattisf>
movss  %xmm0,-0x44(%rbp)
movss  -0x44(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe78(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    119d <main+0x7d>
jp     119d <main+0x7d>
jmp    11a2 <main+0x82>
call   1030 <abort@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1330 <__floattidf>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xe3f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11d6 <main+0xb6>
jp     11d6 <main+0xb6>
jmp    11db <main+0xbb>
call   1030 <abort@plt>
xor    %edi,%edi
call   1040 <exit@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movabs $0x8000000000000000,%rax
mov    %rax,0x30(%rsp)
movq   $0xd,0x28(%rsp)
mov    0x30(%rsp),%rax
mov    0x28(%rsp),%rcx
mov    %rax,0x18(%rsp)
mov    %rcx,0x10(%rsp)
mov    0x10(%rsp),%rax
mov    0x18(%rsp),%rcx
mov    %rcx,0x8(%rsp)
mov    %rax,(%rsp)
mov    (%rsp),%rdi
mov    0x8(%rsp),%rsi
call   11b0 <__floattisf>
ucomiss 0xe88(%rip),%xmm0
jne    1196 <main+0x76>
jp     1196 <main+0x76>
mov    (%rsp),%rdi
mov    0x8(%rsp),%rsi
call   12f0 <__floattidf>
ucomisd 0xe76(%rip),%xmm0
jne    1196 <main+0x76>
jnp    119b <main+0x7b>
call   1030 <abort@plt>
xor    %edi,%edi
call   1040 <exit@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i128
%5 = alloca i128
%6 = alloca float
%7 = alloca double
store i32 0, i32* %1
store volatile i64 -9223372036854775808, i64* %2
store volatile i64 13, i64* %3
%8 = load volatile i64, i64* %2
%9 = zext i64 %8 to i128
%10 = shl i128 %9, 64
%11 = load volatile i64, i64* %3
%12 = zext i64 %11 to i128
%13 = or i128 %10, %12
store volatile i128 %13, i128* %4
%14 = load volatile i128, i128* %4
store volatile i128 %14, i128* %5
%15 = load volatile i128, i128* %5
%16 = sitofp i128 %15 to float
store float %16, float* %6
%17 = load float, float* %6
%18 = fpext float %17 to double
%19 = fcmp une double %18, 0xC7E0000000000000
br i1 %19, label %20, label %21
20: ; preds = %0
unreachable
21: ; preds = %0
%22 = load volatile i128, i128* %5
%23 = sitofp i128 %22 to double
store double %23, double* %7
%24 = load double, double* %7
%25 = fcmp une double %24, 0xC7E0000000000000
br i1 %25, label %26, label %27
26: ; preds = %21
unreachable
27: ; preds = %21
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i128
%4 = alloca i128
%5 = bitcast i64* %1 to i8*
store volatile i64 -9223372036854775808, i64* %1
%6 = bitcast i64* %2 to i8*
store volatile i64 13, i64* %2
%7 = bitcast i128* %3 to i8*
%8 = load volatile i64, i64* %1
%9 = zext i64 %8 to i128
%10 = shl nuw i128 %9, 64
%11 = load volatile i64, i64* %2
%12 = zext i64 %11 to i128
%13 = or i128 %10, %12
store volatile i128 %13, i128* %3
%14 = bitcast i128* %4 to i8*
%15 = load volatile i128, i128* %3
store volatile i128 %15, i128* %4
%16 = load volatile i128, i128* %4
%17 = sitofp i128 %16 to float
%18 = fcmp une float %17, 0xC7E0000000000000
br i1 %18, label %19, label %20
19: ; preds = %0
tail call void @abort()
unreachable
20: ; preds = %0
%21 = load volatile i128, i128* %4
%22 = sitofp i128 %21 to double
%23 = fcmp une double %22, 0xC7E0000000000000
br i1 %23, label %24, label %25
24: ; preds = %20
tail call void @abort()
unreachable
25: ; preds = %20
tail call void @exit(i32 0)
unreachable
}