void test_invalid(long double x, long double y) {
  int q;
  q = 0xdeadbeef;
  assert(isnan(remainder(x, y)));
  assert(isnan(remquo(x, y, &q)));
  assert(isnan(remainderf(x, y)));
  assert(isnan(remquof(x, y, &q)));
  assert(isnan(remainderl(x, y)));
  assert(isnan(remquol(x, y, &q)));
}


x86 assembly (clang, -O0):
<test_invalid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
movl   $0xdeadbeef,-0x24(%rbp)
fldt   -0x10(%rbp)
fstpl  -0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
fldt   -0x20(%rbp)
fstpl  -0x30(%rbp)
movsd  -0x30(%rbp),%xmm1
call   1040 <remainder@plt>
mov    $0x1,%al
mov    %al,-0x5a(%rbp)
call   1060 <isnan@plt>
mov    %eax,%edi
xor    %eax,%eax
mov    %al,-0x59(%rbp)
call   1030 <assert@plt>
fldt   -0x10(%rbp)
fstpl  -0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
fldt   -0x20(%rbp)
fstpl  -0x40(%rbp)
movsd  -0x40(%rbp),%xmm1
lea    -0x24(%rbp),%rdi
mov    %rdi,-0x68(%rbp)
call   10a0 <remquo@plt>
mov    -0x5a(%rbp),%al
call   1060 <isnan@plt>
mov    %eax,%edi
mov    -0x59(%rbp),%al
call   1030 <assert@plt>
fldt   -0x10(%rbp)
fstps  -0x50(%rbp)
movss  -0x50(%rbp),%xmm0
fldt   -0x20(%rbp)
fstps  -0x4c(%rbp)
movss  -0x4c(%rbp),%xmm1
call   1080 <remainderf@plt>
mov    -0x5a(%rbp),%al
cvtss2sd %xmm0,%xmm0
call   1060 <isnan@plt>
mov    %eax,%edi
mov    -0x59(%rbp),%al
call   1030 <assert@plt>
mov    -0x68(%rbp),%rdi
fldt   -0x10(%rbp)
fstps  -0x58(%rbp)
movss  -0x58(%rbp),%xmm0
fldt   -0x20(%rbp)
fstps  -0x54(%rbp)
movss  -0x54(%rbp),%xmm1
call   1090 <remquof@plt>
mov    -0x5a(%rbp),%al
cvtss2sd %xmm0,%xmm0
call   1060 <isnan@plt>
mov    %eax,%edi
mov    -0x59(%rbp),%al
call   1030 <assert@plt>
fldt   -0x10(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
call   1050 <remainderl@plt>
mov    -0x59(%rbp),%al
mov    %rsp,%rcx
fstpt  (%rcx)
call   1060 <isnan@plt>
mov    %eax,%edi
mov    -0x59(%rbp),%al
call   1030 <assert@plt>
fldt   -0x10(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
lea    -0x24(%rbp),%rdi
call   1070 <remquol@plt>
mov    %rsp,%rax
fstpt  (%rax)
xor    %eax,%eax
call   1060 <isnan@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1030 <assert@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_invalid>:
push   %rbx
sub    $0x70,%rsp
fldt   0x90(%rsp)
fld    %st(0)
fstpt  0x48(%rsp)
fldt   0x80(%rsp)
fld    %st(0)
fstpt  0x54(%rsp)
movl   $0xdeadbeef,0x44(%rsp)
de
fstpl  0x68(%rsp)
movsd  0x68(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
fstpl  0x60(%rsp)
movsd  0x60(%rsp),%xmm1
movsd  %xmm1,0x28(%rsp)
call   1040 <remainder@plt>
mov    $0x1,%al
call   1060 <isnan@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1030 <assert@plt>
lea    0x44(%rsp),%rbx
movsd  0x30(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
mov    %rbx,%rdi
call   10a0 <remquo@plt>
mov    $0x1,%al
call   1060 <isnan@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1030 <assert@plt>
fldt   0x54(%rsp)
fstps  0x40(%rsp)
movss  0x40(%rsp),%xmm0
movss  %xmm0,0x30(%rsp)
fldt   0x48(%rsp)
fstps  0x3c(%rsp)
movss  0x3c(%rsp),%xmm1
movss  %xmm1,0x28(%rsp)
call   1080 <remainderf@plt>
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1060 <isnan@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1030 <assert@plt>
movss  0x30(%rsp),%xmm0
movss  0x28(%rsp),%xmm1
mov    %rbx,%rdi
call   1090 <remquof@plt>
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1060 <isnan@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1030 <assert@plt>
fldt   0x48(%rsp)
fstpt  0x10(%rsp)
fldt   0x54(%rsp)
fstpt  (%rsp)
call   1050 <remainderl@plt>
fstpt  (%rsp)
xor    %eax,%eax
call   1060 <isnan@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1030 <assert@plt>
fldt   0x48(%rsp)
fstpt  0x10(%rsp)
fldt   0x54(%rsp)
fstpt  (%rsp)
mov    %rbx,%rdi
call   1070 <remquol@plt>
fstpt  (%rsp)
xor    %eax,%eax
call   1060 <isnan@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1030 <assert@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @test_invalid(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
%5 = alloca i32
store x86_fp80 %0, x86_fp80* %3
store x86_fp80 %1, x86_fp80* %4
store i32 -559038737, i32* %5
%6 = load x86_fp80, x86_fp80* %3
%7 = fptrunc x86_fp80 %6 to double
%8 = load x86_fp80, x86_fp80* %4
%9 = fptrunc x86_fp80 %8 to double
%10 = call double @remainder(double %7, double %9)
%11 = call i32 (double, ...) bitcast (i32 (...)* @isnan to i32 (double, ...)*)(double %10)
%12 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %11)
%13 = load x86_fp80, x86_fp80* %3
%14 = fptrunc x86_fp80 %13 to double
%15 = load x86_fp80, x86_fp80* %4
%16 = fptrunc x86_fp80 %15 to double
%17 = call double @remquo(double %14, double %16, i32* %5)
%18 = call i32 (double, ...) bitcast (i32 (...)* @isnan to i32 (double, ...)*)(double %17)
%19 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %18)
%20 = load x86_fp80, x86_fp80* %3
%21 = fptrunc x86_fp80 %20 to float
%22 = load x86_fp80, x86_fp80* %4
%23 = fptrunc x86_fp80 %22 to float
%24 = call float @remainderf(float %21, float %23)
%25 = fpext float %24 to double
%26 = call i32 (double, ...) bitcast (i32 (...)* @isnan to i32 (double, ...)*)(double %25)
%27 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %26)
%28 = load x86_fp80, x86_fp80* %3
%29 = fptrunc x86_fp80 %28 to float
%30 = load x86_fp80, x86_fp80* %4
%31 = fptrunc x86_fp80 %30 to float
%32 = call float @remquof(float %29, float %31, i32* %5)
%33 = fpext float %32 to double
%34 = call i32 (double, ...) bitcast (i32 (...)* @isnan to i32 (double, ...)*)(double %33)
%35 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %34)
%36 = load x86_fp80, x86_fp80* %3
%37 = load x86_fp80, x86_fp80* %4
%38 = call x86_fp80 @remainderl(x86_fp80 %36, x86_fp80 %37)
%39 = call i32 (x86_fp80, ...) bitcast (i32 (...)* @isnan to i32 (x86_fp80, ...)*)(x86_fp80 %38)
%40 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %39)
%41 = load x86_fp80, x86_fp80* %3
%42 = load x86_fp80, x86_fp80* %4
%43 = call x86_fp80 @remquol(x86_fp80 %41, x86_fp80 %42, i32* %5)
%44 = call i32 (x86_fp80, ...) bitcast (i32 (...)* @isnan to i32 (x86_fp80, ...)*)(x86_fp80 %43)
%45 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %44)
ret void
}

LLVM IR (-O2):
define void @test_invalid(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 -559038737, i32* %3
%5 = fptrunc x86_fp80 %0 to double
%6 = fptrunc x86_fp80 %1 to double
%7 = tail call double @remainder(double %5, double %6)
%8 = tail call i32 (double, ...) bitcast (i32 (...)* @isnan to i32 (double, ...)*)(double %7)
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %8)
%10 = call double @remquo(double %5, double %6, i32* %3)
%11 = call i32 (double, ...) bitcast (i32 (...)* @isnan to i32 (double, ...)*)(double %10)
%12 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %11)
%13 = fptrunc x86_fp80 %0 to float
%14 = fptrunc x86_fp80 %1 to float
%15 = call float @remainderf(float %13, float %14)
%16 = fpext float %15 to double
%17 = call i32 (double, ...) bitcast (i32 (...)* @isnan to i32 (double, ...)*)(double %16)
%18 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %17)
%19 = call float @remquof(float %13, float %14, i32* %3)
%20 = fpext float %19 to double
%21 = call i32 (double, ...) bitcast (i32 (...)* @isnan to i32 (double, ...)*)(double %20)
%22 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %21)
%23 = call x86_fp80 @remainderl(x86_fp80 %0, x86_fp80 %1)
%24 = call i32 (x86_fp80, ...) bitcast (i32 (...)* @isnan to i32 (x86_fp80, ...)*)(x86_fp80 %23)
%25 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %24)
%26 = call x86_fp80 @remquol(x86_fp80 %0, x86_fp80 %1, i32* %3)
%27 = call i32 (x86_fp80, ...) bitcast (i32 (...)* @isnan to i32 (x86_fp80, ...)*)(x86_fp80 %26)
%28 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %27)
ret void
}