float fmodf(float x, float y) {
  float r;
  if (isinf(x))
    return __domain_error_noerrno();
  if (!y)
    return __domain_error();
  __asm__ __volatile__("fprem" : "=t"(r) : "0"(x));
  return r;
}


x86 assembly (clang, -O0):
<fmodf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1050 <isinf@plt>
cmp    $0x0,%eax
je     1170 <fmodf+0x40>
mov    $0x0,%al
call   1040 <__domain_error_noerrno@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11c2 <fmodf+0x92>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    119c <fmodf+0x6c>
jp     119c <fmodf+0x6c>
mov    $0x0,%al
call   1030 <__domain_error@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11c2 <fmodf+0x92>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
flds   -0x14(%rbp)
fprem
fstps  -0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmodf>:
sub    $0x18,%rsp
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1050 <isinf@plt>
test   %eax,%eax
je     1162 <fmodf+0x32>
xor    %eax,%eax
call   1040 <__domain_error_noerrno@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
add    $0x18,%rsp
ret
movss  0x8(%rsp),%xmm1
xorps  %xmm0,%xmm0
movss  0xc(%rsp),%xmm2
ucomiss %xmm0,%xmm2
jne    1178 <fmodf+0x48>
jnp    1193 <fmodf+0x63>
movss  %xmm1,0x14(%rsp)
flds   0x14(%rsp)
fprem
fstps  0x10(%rsp)
movss  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret
xor    %eax,%eax
call   1030 <__domain_error@plt>
jmp    1156 <fmodf+0x26>

LLVM IR (-O0):
define float @fmodf(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
%7 = load float, float* %4
%8 = fpext float %7 to double
%9 = call i32 (double, ...) bitcast (i32 (...)* @isinf to i32 (double, ...)*)(double %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 (...) @__domain_error_noerrno()
%13 = sitofp i32 %12 to float
store float %13, float* %3
br label %24
14: ; preds = %2
%15 = load float, float* %5
%16 = fcmp une float %15, 0.000000e+00
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = call i32 (...) @__domain_error()
%19 = sitofp i32 %18 to float
store float %19, float* %3
br label %24
20: ; preds = %14
%21 = load float, float* %4
%22 = call float asm sideeffect "fprem", "={st},0,~{dirflag},~{fpsr},~{flags}"(float %21)
store float %22, float* %6
%23 = load float, float* %6
store float %23, float* %3
br label %24
24: ; preds = %20, %17, %11
%25 = load float, float* %3
ret float %25
}

LLVM IR (-O2):
define float @fmodf(float %0, float %1) {
%3 = fpext float %0 to double
%4 = tail call i32 (double, ...) bitcast (i32 (...)* @isinf to i32 (double, ...)*)(double %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 (...) @__domain_error_noerrno()
%8 = sitofp i32 %7 to float
br label %16
9: ; preds = %2
%10 = fcmp une float %1, 0.000000e+00
br i1 %10, label %14, label %11
11: ; preds = %9
%12 = tail call i32 (...) @__domain_error()
%13 = sitofp i32 %12 to float
br label %16
14: ; preds = %9
%15 = tail call float asm sideeffect "fprem", "={st},0,~{dirflag},~{fpsr},~{flags}"(float %0)
br label %16
16: ; preds = %14, %11, %6
%17 = phi float [ %8, %6 ], [ %15, %14 ], [ %13, %11 ]
ret float %17
}