__float128 plm_lndPlm(int l, int m, __float128 x, int *sign) {
  const int lmax = l + 1;
  __float128 plm[lmax - m + 1];
  int signs[lmax - m + 1];
  _lnplm_array(lmax, m, x, plm, signs);
  return logadd_s(logq(l - m + 1) + plm[l + 1 - m], signs[l + 1 - m],
                  logq(l + 1) + logq(x) + plm[l - m], -signs[l + 1 - m], sign) -
         logq(((x) * (x)) - 1);
}


x86 assembly (clang, -O0):
<plm_lndPlm>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movaps %xmm0,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    %ecx,%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rax,%rcx
shl    $0x4,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x80(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    %ecx,%eax
add    $0x1,%eax
lea    0xf(,%rax,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rcx
sub    %rsi,%rcx
mov    %rcx,-0x70(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x8(%rbp),%esi
movaps -0x20(%rbp),%xmm0
mov    $0x1,%al
mov    %al,-0x4d(%rbp)
call   1040 <_lnplm_array@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%eax
sub    %eax,%edi
add    $0x1,%edi
xor    %eax,%eax
mov    %al,-0x85(%rbp)
call   1050 <logq@plt>
mov    %eax,%edi
call   3180 <__floatsitf>
mov    -0x80(%rbp),%rcx
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
mov    -0x8(%rbp),%edx
sub    %edx,%eax
cltq
mov    %rax,-0x98(%rbp)
shl    $0x4,%rax
movaps (%rax,%rcx,1),%xmm1
call   12d0 <__addtf3>
mov    -0x98(%rbp),%rdx
mov    -0x8c(%rbp),%edi
mov    -0x85(%rbp),%al
mov    -0x70(%rbp),%rcx
movaps %xmm0,-0x60(%rbp)
mov    (%rcx,%rdx,4),%ecx
mov    %ecx,-0x64(%rbp)
call   1050 <logq@plt>
mov    %eax,%ecx
mov    -0x4d(%rbp),%al
mov    %ecx,-0x84(%rbp)
movaps -0x20(%rbp),%xmm0
call   1050 <logq@plt>
mov    -0x84(%rbp),%edi
add    %eax,%edi
call   3180 <__floatsitf>
mov    -0x80(%rbp),%rcx
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%edx
sub    %edx,%eax
mov    %eax,-0x74(%rbp)
cltq
shl    $0x4,%rax
movaps (%rax,%rcx,1),%xmm1
call   12d0 <__addtf3>
mov    -0x74(%rbp),%ecx
mov    -0x70(%rbp),%rax
mov    -0x64(%rbp),%edi
movaps %xmm0,%xmm1
movaps -0x60(%rbp),%xmm0
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
neg    %esi
mov    -0x28(%rbp),%rdx
mov    $0x2,%al
call   1030 <logadd_s@plt>
mov    %eax,-0x4c(%rbp)
movaps -0x20(%rbp),%xmm1
movaps %xmm1,%xmm0
call   26b0 <__multf3>
movaps 0x2d5c(%rip),%xmm1
call   12d0 <__addtf3>
mov    -0x4d(%rbp),%al
call   1050 <logq@plt>
mov    -0x4c(%rbp),%edi
sub    %eax,%edi
call   3180 <__floatsitf>
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret
nopw   0x0(%rax,%rax,1)

x86 assembly (clang, -O2):
<plm_lndPlm>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,-0x38(%rbp)
movaps %xmm0,-0x50(%rbp)
mov    %esi,%r14d
mov    %edi,%r15d
lea    0x1(%r15),%eax
mov    %eax,%ebx
mov    %eax,%edi
mov    %eax,-0x30(%rbp)
sub    %esi,%ebx
lea    0x1(%rbx),%eax
lea    0xf(,%rax,4),%rcx
shl    $0x4,%rax
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%r12
sub    %rcx,%r12
mov    %r12,%rsp
mov    %r13,%rdx
mov    %r12,%rcx
mov    $0x1,%al
call   1040 <_lnplm_array@plt>
sub    %r14d,%r15d
lea    0x1(%r15),%edi
xor    %eax,%eax
call   1050 <logq@plt>
mov    %eax,%edi
call   3100 <__floatsitf>
movaps %xmm0,%xmm1
movslq %ebx,%r14
mov    %r14,%rax
shl    $0x4,%rax
movaps (%rax,%r13,1),%xmm0
call   1250 <__addtf3>
movaps %xmm0,-0x60(%rbp)
mov    (%r12,%r14,4),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%edi
xor    %eax,%eax
call   1050 <logq@plt>
mov    %eax,%ebx
movaps -0x50(%rbp),%xmm0
mov    $0x1,%al
call   1050 <logq@plt>
add    %eax,%ebx
mov    %ebx,%edi
call   3100 <__floatsitf>
movaps %xmm0,%xmm1
movslq %r15d,%rax
shl    $0x4,%rax
movaps (%rax,%r13,1),%xmm0
call   1250 <__addtf3>
movaps %xmm0,%xmm1
xor    %esi,%esi
sub    (%r12,%r14,4),%esi
movaps -0x60(%rbp),%xmm0
mov    -0x2c(%rbp),%edi
mov    -0x38(%rbp),%rdx
mov    $0x2,%al
call   1030 <logadd_s@plt>
mov    %eax,%ebx
movaps -0x50(%rbp),%xmm0
movaps %xmm0,%xmm1
call   2630 <__multf3>
movaps 0x2dd7(%rip),%xmm1
call   1250 <__addtf3>
mov    $0x1,%al
call   1050 <logq@plt>
sub    %eax,%ebx
mov    %ebx,%edi
call   3100 <__floatsitf>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
nopl   (%rax)

LLVM IR (-O0):
define fp128 @plm_lndPlm(i32 %0, i32 %1, fp128 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca fp128
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i64
store i32 %0, i32* %5
store i32 %1, i32* %6
store fp128 %2, fp128* %7
store i32* %3, i32** %8
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 1
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = load i32, i32* %6
%17 = sub nsw i32 %15, %16
%18 = add nsw i32 %17, 1
%19 = zext i32 %18 to i64
%20 = call i8* @llvm.stacksave()
store i8* %20, i8** %10
%21 = alloca fp128, i64 %19
store i64 %19, i64* %11
%22 = load i32, i32* %9
%23 = load i32, i32* %6
%24 = sub nsw i32 %22, %23
%25 = add nsw i32 %24, 1
%26 = zext i32 %25 to i64
%27 = alloca i32, i64 %26
store i64 %26, i64* %12
%28 = load i32, i32* %9
%29 = load i32, i32* %6
%30 = load fp128, fp128* %7
%31 = call i32 (i32, i32, fp128, fp128*, i32*, ...) bitcast (i32 (...)* @_lnplm_array to i32 (i32, i32, fp128, fp128*, i32*, ...)*)(i32 %28, i32 %29, fp128 %30, fp128* %21, i32* %27)
%32 = load i32, i32* %5
%33 = load i32, i32* %6
%34 = sub nsw i32 %32, %33
%35 = add nsw i32 %34, 1
%36 = call i32 (i32, ...) bitcast (i32 (...)* @logq to i32 (i32, ...)*)(i32 %35)
%37 = sitofp i32 %36 to fp128
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 1
%40 = load i32, i32* %6
%41 = sub nsw i32 %39, %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds fp128, fp128* %21, i64 %42
%44 = load fp128, fp128* %43
%45 = fadd fp128 %37, %44
%46 = load i32, i32* %5
%47 = add nsw i32 %46, 1
%48 = load i32, i32* %6
%49 = sub nsw i32 %47, %48
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i32, i32* %27, i64 %50
%52 = load i32, i32* %51
%53 = load i32, i32* %5
%54 = add nsw i32 %53, 1
%55 = call i32 (i32, ...) bitcast (i32 (...)* @logq to i32 (i32, ...)*)(i32 %54)
%56 = load fp128, fp128* %7
%57 = call i32 (fp128, ...) bitcast (i32 (...)* @logq to i32 (fp128, ...)*)(fp128 %56)
%58 = add nsw i32 %55, %57
%59 = sitofp i32 %58 to fp128
%60 = load i32, i32* %5
%61 = load i32, i32* %6
%62 = sub nsw i32 %60, %61
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds fp128, fp128* %21, i64 %63
%65 = load fp128, fp128* %64
%66 = fadd fp128 %59, %65
%67 = load i32, i32* %5
%68 = add nsw i32 %67, 1
%69 = load i32, i32* %6
%70 = sub nsw i32 %68, %69
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i32, i32* %27, i64 %71
%73 = load i32, i32* %72
%74 = sub nsw i32 0, %73
%75 = load i32*, i32** %8
%76 = call i32 (fp128, i32, fp128, i32, i32*, ...) bitcast (i32 (...)* @logadd_s to i32 (fp128, i32, fp128, i32, i32*, ...)*)(fp128 %45, i32 %52, fp128 %66, i32 %74, i32* %75)
%77 = load fp128, fp128* %7
%78 = load fp128, fp128* %7
%79 = call fp128 @llvm.fmuladd.f128(fp128 %77, fp128 %78, fp128 0xL0000000000000000BFFF000000000000)
%80 = call i32 (fp128, ...) bitcast (i32 (...)* @logq to i32 (fp128, ...)*)(fp128 %79)
%81 = sub nsw i32 %76, %80
%82 = sitofp i32 %81 to fp128
%83 = load i8*, i8** %10
ret fp128 %82
}

LLVM IR (-O2):
define fp128 @plm_lndPlm(i32 %0, i32 %1, fp128 %2, i32* %3) {
%5 = add nsw i32 %0, 1
%6 = sub nsw i32 %5, %1
%7 = add nsw i32 %6, 1
%8 = zext i32 %7 to i64
%9 = alloca fp128, i64 %8
%10 = alloca i32, i64 %8
%11 = call i32 (i32, i32, fp128, fp128*, i32*, ...) bitcast (i32 (...)* @_lnplm_array to i32 (i32, i32, fp128, fp128*, i32*, ...)*)(i32 %5, i32 %1, fp128 %2, fp128* %9, i32* %10)
%12 = sub nsw i32 %0, %1
%13 = add nsw i32 %12, 1
%14 = call i32 (i32, ...) bitcast (i32 (...)* @logq to i32 (i32, ...)*)(i32 %13)
%15 = sitofp i32 %14 to fp128
%16 = sext i32 %6 to i64
%17 = getelementptr inbounds fp128, fp128* %9, i64 %16
%18 = load fp128, fp128* %17
%19 = fadd fp128 %18, %15
%20 = getelementptr inbounds i32, i32* %10, i64 %16
%21 = load i32, i32* %20
%22 = call i32 (i32, ...) bitcast (i32 (...)* @logq to i32 (i32, ...)*)(i32 %5)
%23 = call i32 (fp128, ...) bitcast (i32 (...)* @logq to i32 (fp128, ...)*)(fp128 %2)
%24 = add nsw i32 %23, %22
%25 = sitofp i32 %24 to fp128
%26 = sext i32 %12 to i64
%27 = getelementptr inbounds fp128, fp128* %9, i64 %26
%28 = load fp128, fp128* %27
%29 = fadd fp128 %28, %25
%30 = load i32, i32* %20
%31 = sub nsw i32 0, %30
%32 = call i32 (fp128, i32, fp128, i32, i32*, ...) bitcast (i32 (...)* @logadd_s to i32 (fp128, i32, fp128, i32, i32*, ...)*)(fp128 %19, i32 %21, fp128 %29, i32 %31, i32* %3)
%33 = call fp128 @llvm.fmuladd.f128(fp128 %2, fp128 %2, fp128 0xL0000000000000000BFFF000000000000)
%34 = call i32 (fp128, ...) bitcast (i32 (...)* @logq to i32 (fp128, ...)*)(fp128 %33)
%35 = sub nsw i32 %32, %34
%36 = sitofp i32 %35 to fp128
ret fp128 %36
}