#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 uint64_t;

/* Variables and functions */
void ldbl_canonicalize_int(double *a, double *aa) {
  uint64_t ax, aax;
  union {
    double value;
    uint64_t word;
  } extractor;
  extractor.value = *a;
  ax = extractor.word;
  extractor.value = *aa;
  aax = extractor.word;
  int expdiff = ((ax >> 52) & 0x7ff) - ((aax >> 52) & 0x7ff);
  if (expdiff <= 53) {
    if (expdiff == 53) {
      if ((ax & 1) != 0) {
        *a += 2 * *aa;
        *aa = -*aa;
      }
    } else {
      *a += *aa;
      *aa = 0;
    }
  }
}


x86 assembly (clang, -O0):
<ldbl_canonicalize_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x34,%ecx
sar    %cl,%eax
and    $0x7ff,%eax
mov    -0x18(%rbp),%edx
mov    $0x34,%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    $0x7ff,%ecx
sub    %ecx,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x35,-0x24(%rbp)
jg     11e7 <ldbl_canonicalize_int+0xe7>
cmpl   $0x35,-0x24(%rbp)
jne    11c3 <ldbl_canonicalize_int+0xc3>
mov    -0x14(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11be <ldbl_canonicalize_int+0xbe>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    11e2 <ldbl_canonicalize_int+0xe2>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    11e7 <ldbl_canonicalize_int+0xe7>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldbl_canonicalize_int>:
ret

LLVM IR (-O0):
%union.anon = type { double }
define void @ldbl_canonicalize_int(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca %union.anon
%8 = alloca i32
store double* %0, double** %3
store double* %1, double** %4
%9 = load double*, double** %3
%10 = load double, double* %9
%11 = bitcast %union.anon* %7 to double*
store double %10, double* %11
%12 = bitcast %union.anon* %7 to i32*
%13 = load i32, i32* %12
store i32 %13, i32* %5
%14 = load double*, double** %4
%15 = load double, double* %14
%16 = bitcast %union.anon* %7 to double*
store double %15, double* %16
%17 = bitcast %union.anon* %7 to i32*
%18 = load i32, i32* %17
store i32 %18, i32* %6
%19 = load i32, i32* %5
%20 = ashr i32 %19, 52
%21 = and i32 %20, 2047
%22 = load i32, i32* %6
%23 = ashr i32 %22, 52
%24 = and i32 %23, 2047
%25 = sub nsw i32 %21, %24
store i32 %25, i32* %8
%26 = load i32, i32* %8
%27 = icmp sle i32 %26, 53
br i1 %27, label %28, label %54
28: ; preds = %2
%29 = load i32, i32* %8
%30 = icmp eq i32 %29, 53
br i1 %30, label %31, label %46
31: ; preds = %28
%32 = load i32, i32* %5
%33 = and i32 %32, 1
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %45
35: ; preds = %31
%36 = load double*, double** %4
%37 = load double, double* %36
%38 = load double*, double** %3
%39 = load double, double* %38
%40 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %37, double %39)
store double %40, double* %38
%41 = load double*, double** %4
%42 = load double, double* %41
%43 = fneg double %42
%44 = load double*, double** %4
store double %43, double* %44
br label %45
45: ; preds = %35, %31
br label %53
46: ; preds = %28
%47 = load double*, double** %4
%48 = load double, double* %47
%49 = load double*, double** %3
%50 = load double, double* %49
%51 = fadd double %50, %48
store double %51, double* %49
%52 = load double*, double** %4
store double 0.000000e+00, double* %52
br label %53
53: ; preds = %46, %45
br label %54
54: ; preds = %53, %2
ret void
}

LLVM IR (-O2):
define void @ldbl_canonicalize_int(double* nocapture %0, double* nocapture %1) {
ret void
}