double _XcmsModuloF(double val, register double *dp) {
  register double abs;
  double ip;
  abs = ((val) < 0.0 ? -(val) : (val));
  if (abs >= ((double)(0x7FFFFFFF) * (1L << (((8 * (int)sizeof(double)) - 11) -
                                             (8 * (int)sizeof(int)) + 1)))) {
    ip = val;
  } else {
    ip =
        abs + ((double)(0x7FFFFFFF) * (1L << (((8 * (int)sizeof(double)) - 11) -
                                              (8 * (int)sizeof(int)) + 1)));
    ip -= ((double)(0x7FFFFFFF) * (1L << (((8 * (int)sizeof(double)) - 11) -
                                          (8 * (int)sizeof(int)) + 1)));
    if (ip > abs)
      ip -= 1.0;
    ip = ((ip) < 0.0 ? -(ip) : (ip));
  }
  *dp = ip;
  return (val - ip);
}


x86 assembly (clang, -O0):
<_XcmsModuloF>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1141 <_XcmsModuloF+0x41>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    114b <_XcmsModuloF+0x4b>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe9e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     117b <_XcmsModuloF+0x7b>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1211 <_XcmsModuloF+0x111>
movsd  0xe7d(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe66(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11c9 <_XcmsModuloF+0xc9>
movsd  -0x20(%rbp),%xmm0
movsd  0xe48(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11fd <_XcmsModuloF+0xfd>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1207 <_XcmsModuloF+0x107>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_XcmsModuloF>:
movapd 0xef8(%rip),%xmm3
xorpd  %xmm0,%xmm3
xorpd  %xmm2,%xmm2
movapd %xmm0,%xmm1
cmpltsd %xmm2,%xmm1
andpd  %xmm1,%xmm3
andnpd %xmm0,%xmm1
orpd   %xmm3,%xmm1
ucomisd 0xee3(%rip),%xmm1
movapd %xmm0,%xmm3
jae    1185 <_XcmsModuloF+0x85>
movsd  0xed5(%rip),%xmm3
addsd  %xmm1,%xmm3
addsd  0xed1(%rip),%xmm3
movsd  0xed1(%rip),%xmm4
addsd  %xmm3,%xmm4
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm4
andnpd %xmm3,%xmm1
orpd   %xmm4,%xmm1
movapd 0xe94(%rip),%xmm4
xorpd  %xmm1,%xmm4
movapd %xmm1,%xmm3
cmpltsd %xmm2,%xmm3
andpd  %xmm3,%xmm4
andnpd %xmm1,%xmm3
orpd   %xmm4,%xmm3
movsd  %xmm3,(%rdi)
subsd  %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @_XcmsModuloF(double %0, double* %1) {
%3 = alloca double
%4 = alloca double*
%5 = alloca double
%6 = alloca double
store double %0, double* %3
store double* %1, double** %4
%7 = load double, double* %3
%8 = fcmp olt double %7, 0.000000e+00
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load double, double* %3
%11 = fneg double %10
br label %14
12: ; preds = %2
%13 = load double, double* %3
br label %14
14: ; preds = %12, %9
%15 = phi double [ %11, %9 ], [ %13, %12 ]
store double %15, double* %5
%16 = load double, double* %5
%17 = fcmp oge double %16, 0x433FFFFFFFC00000
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = load double, double* %3
store double %19, double* %6
br label %41
20: ; preds = %14
%21 = load double, double* %5
%22 = fadd double %21, 0x433FFFFFFFC00000
store double %22, double* %6
%23 = load double, double* %6
%24 = fsub double %23, 0x433FFFFFFFC00000
store double %24, double* %6
%25 = load double, double* %6
%26 = load double, double* %5
%27 = fcmp ogt double %25, %26
br i1 %27, label %28, label %31
28: ; preds = %20
%29 = load double, double* %6
%30 = fsub double %29, 1.000000e+00
store double %30, double* %6
br label %31
31: ; preds = %28, %20
%32 = load double, double* %6
%33 = fcmp olt double %32, 0.000000e+00
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load double, double* %6
%36 = fneg double %35
br label %39
37: ; preds = %31
%38 = load double, double* %6
br label %39
39: ; preds = %37, %34
%40 = phi double [ %36, %34 ], [ %38, %37 ]
store double %40, double* %6
br label %41
41: ; preds = %39, %18
%42 = load double, double* %6
%43 = load double*, double** %4
store double %42, double* %43
%44 = load double, double* %3
%45 = load double, double* %6
%46 = fsub double %44, %45
ret double %46
}

LLVM IR (-O2):
define double @_XcmsModuloF(double %0, double* nocapture writeonly %1) {
%3 = fcmp olt double %0, 0.000000e+00
%4 = fneg double %0
%5 = select i1 %3, double %4, double %0
%6 = fcmp ult double %5, 0x433FFFFFFFC00000
br i1 %6, label %7, label %16
7: ; preds = %2
%8 = fadd double %5, 0x433FFFFFFFC00000
%9 = fadd double %8, 0xC33FFFFFFFC00000
%10 = fcmp ogt double %9, %5
%11 = fadd double %9, -1.000000e+00
%12 = select i1 %10, double %11, double %9
%13 = fcmp olt double %12, 0.000000e+00
%14 = fneg double %12
%15 = select i1 %13, double %14, double %12
br label %16
16: ; preds = %2, %7
%17 = phi double [ %15, %7 ], [ %0, %2 ]
store double %17, double* %1
%18 = fsub double %0, %17
ret double %18
}