user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<mp_lmpar>:
  endbr64
  push   %r15
  mov    %r8,%r15
  push   %r14
  mov    %rsi,%r14
  push   %r13
  push   %r12
  mov    %r9,%r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  sub    $0x78,%rsp
  mov    %edx,0x68(%rsp)
  mov    0xd0(%rsp),%rbx
  mov    %rcx,0x48(%rsp)
  movsd  %xmm0,0x40(%rsp)
  test   %edi,%edi
  jle    L597
  lea    0x1(%rdx),%edi
  pxor   %xmm4,%xmm4
  movslq %ebp,%rdx
  mov    %ebp,%r13d
  movslq %edi,%rdi
  mov    0xb0(%rsp),%r9
  xor    %eax,%eax
  xor    %r8d,%r8d
  shl    $0x3,%rdi
  movsd  %xmm4,0x8(%rsp)
  jmp    L160
  nopl   (%rax)
L203:
  add    $0x1,%rax
  add    %rdi,%rsi
  cmp    %rax,%rdx
  je     L500
L160:
  movsd  (%r9,%rax,8),%xmm0
  movsd  0x8(%rsp),%xmm6
  movsd  %xmm0,(%rbx,%rax,8)
  ucomisd (%rsi),%xmm6
  setnp  %cl
  cmovne %r8d,%ecx
  test   %cl,%cl
  je     L225
  cmp    %r13d,%ebp
  je     L439
L225:
  cmp    %r13d,%ebp
  jle    L203
  movq   $0x0,(%rbx,%rax,8)
L606:
  add    $0x1,%rax
  add    %rdi,%rsi
  cmp    %rax,%rdx
  jne    L160
L500:
  test   %r13d,%r13d
  je     L77
  mov    0x68(%rsp),%r9d
  movslq %r13d,%rdi
  lea    (%rbx,%rdi,8),%rsi
  mov    %r9d,%eax
  not    %eax
  cltq
  shl    $0x3,%rax
  mov    %rax,0x18(%rsp)
  lea    -0x1(%r13),%eax
  imul   %r9d,%eax
  movslq %eax,%rcx
  mov    %eax,%r11d
  mov    %r9d,%eax
  neg    %eax
  add    %rcx,%rdi
  lea    (%r14,%rcx,8),%rcx
  cltq
  lea    (%r14,%rdi,8),%r8
  lea    -0x2(%r13),%edi
  shl    $0x3,%rax
  mov    %rax,0x10(%rsp)
  nopl   0x0(%rax)
L562:
  movsd  -0x8(%rsi),%xmm0
  divsd  -0x8(%r8),%xmm0
  movsd  %xmm0,-0x8(%rsi)
  cmp    $0xffffffff,%edi
  jne    L706
L77:
  mov    0x48(%rsp),%rsi
  mov    0xc0(%rsp),%rdi
  xor    %eax,%eax
L414:
  movsd  (%rbx,%rax,8),%xmm0
  movslq (%rsi,%rax,4),%rcx
  add    $0x1,%rax
  movsd  %xmm0,(%rdi,%rcx,8)
  cmp    %rdx,%rax
  jne    L414
  mov    0xc0(%rsp),%rsi
  mov    0xd8(%rsp),%rdi
  xor    %eax,%eax
  nopl   0x0(%rax)
L97:
  movslq (%r15,%rax,4),%rcx
  movsd  (%r12,%rcx,8),%xmm0
  mulsd  (%rsi,%rax,8),%xmm0
  movsd  %xmm0,(%rdi,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rdx
  jne    L97
  mov    0xd8(%rsp),%rsi
  mov    %ebp,%edi
  call   <mp_enorm@plt>
  movsd  0x40(%rsp),%xmm7
  movsd  D11(%rip),%xmm1
  movapd %xmm0,%xmm5
  movapd %xmm0,%xmm4
  subsd  %xmm7,%xmm5
  mulsd  %xmm1,%xmm7
  movsd  %xmm5,0x18(%rsp)
  comisd %xmm5,%xmm7
  movsd  %xmm7,0x58(%rsp)
  jae    L31
  movsd  0x8(%rsp),%xmm6
  movslq 0x68(%rsp),%rax
  movsd  %xmm6,0x38(%rsp)
  mov    %rax,0x10(%rsp)
  cmp    %r13d,%ebp
  jle    L53
L279:
  test   %ebp,%ebp
  jle    L130
  mov    0x10(%rsp),%rax
  mov    %ebp,0x20(%rsp)
  lea    0x1(%rbp),%r10d
  mov    %r14,%rcx
  mov    0x68(%rsp),%r11d
  mov    0x48(%rsp),%rbp
  mov    $0x1,%edx
  xor    %esi,%esi
  mov    0xb0(%rsp),%rdi
  lea    0x0(,%rax,8),%r9
  nopl   0x0(%rax,%rax,1)
L27:
  mov    %edx,%r8d
  cmp    $0x1,%rdx
  je     L530
  mov    %edx,%r13d
  xor    %eax,%eax
  pxor   %xmm0,%xmm0
  shr    %r13d
  shl    $0x4,%r13
  nopl   (%rax)
L629:
  movupd (%rdi,%rax,1),%xmm3
  movupd (%rcx,%rax,1),%xmm5
  add    $0x10,%rax
  mulpd  %xmm5,%xmm3
  addsd  %xmm3,%xmm0
  unpckhpd %xmm3,%xmm3
  addsd  %xmm3,%xmm0
  cmp    %rax,%r13
  jne    L629
  mov    %r8d,%eax
  and    $0xfffffffe,%eax
  lea    (%rsi,%rax,1),%r13d
  cmp    %eax,%r8d
  je     L600
L425:
  cltq
  movslq %r13d,%r13
  movsd  (%rdi,%rax,8),%xmm2
  mulsd  (%r14,%r13,8),%xmm2
  addsd  %xmm2,%xmm0
L600:
  movslq -0x4(%rbp,%rdx,4),%rax
  add    %r11d,%esi
  add    %r9,%rcx
  movslq (%r15,%rax,4),%rax
  divsd  (%r12,%rax,8),%xmm0
  movsd  %xmm0,-0x8(%rbx,%rdx,8)
  add    $0x1,%rdx
  cmp    %r10,%rdx
  jne    L27
  mov    0x20(%rsp),%ebp
L130:
  mov    %rbx,%rsi
  mov    %ebp,%edi
  movsd  %xmm4,0x20(%rsp)
  movsd  %xmm1,0x28(%rsp)
  call   <mp_enorm@plt>
  movapd %xmm0,%xmm4
  divsd  0x40(%rsp),%xmm4
  ucomisd 0x8(%rsp),%xmm4
  movsd  %xmm4,0x60(%rsp)
  movq   %xmm0,%r13
  movsd  0x20(%rsp),%xmm4
  jp     L459
  movsd  0x28(%rsp),%xmm1
  je     L686
L459:
  mov    0xb8(%rsp),%rax
  movsd  0x38(%rsp),%xmm1
  movsd  %xmm4,0x20(%rsp)
  movsd  (%rax),%xmm0
  call   <mp_dmax1@plt>
  mov    0xb8(%rsp),%rax
  movsd  0x60(%rsp),%xmm1
  movsd  %xmm0,(%rax)
  call   <mp_dmin1@plt>
  ucomisd 0x8(%rsp),%xmm0
  jp     L54
  movsd  0x20(%rsp),%xmm4
  jne    L54
  movq   %r13,%xmm0
  divsd  %xmm4,%xmm0
L54:
  mov    0xb8(%rsp),%rax
  movl   $0xa,0x6c(%rsp)
  mov    %r14,0x50(%rsp)
  mov    0xd8(%rsp),%r14
  movsd  %xmm0,(%rax)
  mov    0x10(%rsp),%rax
  lea    0x8(,%rax,8),%rdi
  shl    $0x3,%rax
  mov    %rdi,0x28(%rsp)
  mov    %rax,0x20(%rsp)
L207:
  ucomisd 0x8(%rsp),%xmm0
  jp     L625
  je     L577
L625:
  movsd  0x8(%rsp),%xmm5
  ucomisd %xmm0,%xmm5
  ja     L607
  sqrtsd %xmm0,%xmm0
L24:
  test   %ebp,%ebp
  jle    L47
  movslq %ebp,%r13
  xor    %eax,%eax
  nop
L430:
  movslq (%r15,%rax,4),%rdx
  movsd  (%r12,%rdx,8),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  %xmm1,(%rbx,%rax,8)
  add    $0x1,%rax
  cmp    %r13,%rax
  jne    L430
  sub    $0x8,%rsp
  mov    %rbx,%r8
  mov    %ebp,%edi
  push   %r14
  push   0xd8(%rsp)
  push   0xd8(%rsp)
  mov    0xd0(%rsp),%r9
  mov    0x68(%rsp),%rcx
  mov    0x88(%rsp),%edx
  mov    0x70(%rsp),%rsi
  call   <mp_qrsolv@plt>
  mov    0xe0(%rsp),%rcx
  add    $0x20,%rsp
  xor    %eax,%eax
  nopl   0x0(%rax)
L682:
  movslq (%r15,%rax,4),%rdx
  movsd  (%r12,%rdx,8),%xmm0
  mulsd  (%rcx,%rax,8),%xmm0
  movsd  %xmm0,(%r14,%rax,8)
  add    $0x1,%rax
  cmp    %r13,%rax
  jne    L682
L352:
  mov    %r14,%rsi
  mov    %ebp,%edi
  call   <mp_enorm@plt>
  movsd  0x58(%rsp),%xmm5
  movapd %xmm0,%xmm4
  subsd  0x40(%rsp),%xmm4
  movapd %xmm0,%xmm1
  movapd %xmm4,%xmm0
  andpd  D32(%rip),%xmm0
  movsd  %xmm4,0x10(%rsp)
  comisd %xmm0,%xmm5
  jae    L221
  movsd  0x38(%rsp),%xmm6
  movsd  0x8(%rsp),%xmm7
  ucomisd %xmm7,%xmm6
  jp     L163
  jne    L163
  movsd  0x18(%rsp),%xmm6
  comisd %xmm4,%xmm6
  jb     L163
  comisd %xmm6,%xmm7
  ja     L221
L163:
  subl   $0x1,0x6c(%rsp)
  je     L221
  mov    0x48(%rsp),%rdi
  movslq %ebp,%rdx
  xor    %eax,%eax
  test   %ebp,%ebp
  jle    L159
  nopl   0x0(%rax,%rax,1)
L138:
  movslq (%rdi,%rax,4),%rcx
  movsd  (%r14,%rcx,8),%xmm0
  movslq (%r15,%rcx,4),%rsi
  divsd  %xmm1,%xmm0
  mulsd  (%r12,%rsi,8),%xmm0
  movsd  %xmm0,(%rbx,%rax,8)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L138
  mov    0xc8(%rsp),%rax
  movsd  (%rbx),%xmm0
  divsd  (%rax),%xmm0
  movsd  %xmm0,(%rbx)
  cmp    $0x1,%ebp
  jne    L177
  nopl   0x0(%rax,%rax,1)
L159:
  mov    %rbx,%rsi
  mov    %ebp,%edi
  call   <mp_enorm@plt>
  movsd  0x10(%rsp),%xmm6
  comisd 0x8(%rsp),%xmm6
  movapd %xmm0,%xmm2
  ja     L529
L367:
  movsd  0x8(%rsp),%xmm4
  comisd 0x10(%rsp),%xmm4
  ja     L205
L147:
  movsd  0x10(%rsp),%xmm1
  divsd  0x40(%rsp),%xmm1
  divsd  %xmm2,%xmm1
  mov    0xb8(%rsp),%rax
  movsd  0x38(%rsp),%xmm0
  divsd  %xmm2,%xmm1
  addsd  (%rax),%xmm1
  call   <mp_dmax1@plt>
  mov    0xb8(%rsp),%rax
  movsd  0x10(%rsp),%xmm1
  movsd  %xmm0,(%rax)
  movsd  %xmm1,0x18(%rsp)
  jmp    L207
  nopw   0x0(%rax,%rax,1)
L439:
  movq   $0x0,(%rbx,%rax,8)
  mov    %eax,%r13d
  jmp    L606
L31:
  mov    0xb8(%rsp),%rax
  movq   $0x0,(%rax)
L221:
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L706:
  lea    0x8(%rcx),%rax
  cmp    %rax,%rbx
  je     L579
  test   %edi,%edi
  je     L579
  lea    0x1(%rdi),%r9d
  movapd %xmm0,%xmm3
  xor    %eax,%eax
  mov    %r9d,%r10d
  unpcklpd %xmm3,%xmm3
  shr    %r10d
  shl    $0x4,%r10
  nopl   (%rax)
L361:
  movupd (%rcx,%rax,1),%xmm2
  movupd (%rbx,%rax,1),%xmm1
  mulpd  %xmm3,%xmm2
  subpd  %xmm2,%xmm1
  movups %xmm1,(%rbx,%rax,1)
  add    $0x10,%rax
  cmp    %r10,%rax
  jne    L361
  mov    %r9d,%eax
  and    $0xfffffffe,%eax
  lea    (%rax,%r11,1),%r10d
  cmp    %r9d,%eax
  je     L445
  movslq %r10d,%r10
  lea    (%rbx,%rax,8),%rax
  mulsd  (%r14,%r10,8),%xmm0
  movsd  (%rax),%xmm1
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%rax)
L445:
  sub    $0x8,%rsi
  add    0x18(%rsp),%r8
  sub    $0x1,%edi
  sub    0x68(%rsp),%r11d
  add    0x10(%rsp),%rcx
  jmp    L562
  nopw   0x0(%rax,%rax,1)
L577:
  movsd  D6(%rip),%xmm1
  mulsd  0x60(%rsp),%xmm1
  mov    D14(%rip),%rax
  movq   %rax,%xmm0
  call   <mp_dmax1@plt>
  mov    0xb8(%rsp),%rax
  movsd  %xmm0,(%rax)
  jmp    L625
  nopl   0x0(%rax,%rax,1)
L177:
  mov    0x68(%rsp),%eax
  mov    0x50(%rsp),%rdi
  mov    %r12,0x30(%rsp)
  mov    $0x1,%r13d
  mov    %r14,0xd8(%rsp)
  mov    $0x1,%edx
  lea    0x1(%rax),%esi
  lea    -0x2(%rbp),%eax
  mov    %rdi,%r9
  mov    %rdi,%r14
  add    $0x2,%rax
  lea    0x10(%rdi),%r8
  mov    %esi,%r12d
  mov    %rax,0x18(%rsp)
  nopl   (%rax)
L145:
  mov    %ebp,%r10d
  mov    %edx,%ecx
  lea    (%rbx,%rdx,8),%rsi
  sub    %edx,%r10d
  cmp    %edx,%ebp
  setg   %dil
  cmp    $0x1,%r10d
  setne  %al
  test   %al,%dil
  je     L675
  cmp    %r8,%rsi
  je     L675
  cmp    %edx,%ebp
  movapd %xmm0,%xmm3
  lea    -0x8(%r8),%r11
  mov    $0x1,%eax
  cmovle %eax,%r10d
  unpcklpd %xmm3,%xmm3
  xor    %eax,%eax
  mov    %r10d,%edi
  shr    %edi
  shl    $0x4,%rdi
  nopl   (%rax)
L232:
  movupd (%r11,%rax,1),%xmm2
  movupd (%rsi,%rax,1),%xmm1
  mulpd  %xmm3,%xmm2
  subpd  %xmm2,%xmm1
  movups %xmm1,(%rsi,%rax,1)
  add    $0x10,%rax
  cmp    %rdi,%rax
  jne    L232
  mov    %r10d,%eax
  and    $0xfffffffe,%eax
  add    %eax,%ecx
  lea    0x0(%r13,%rax,1),%esi
  cmp    %r10d,%eax
  je     L448
  movslq %esi,%rsi
  movslq %ecx,%rcx
  mulsd  (%r14,%rsi,8),%xmm0
  lea    (%rbx,%rcx,8),%rax
  movsd  (%rax),%xmm1
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%rax)
L448:
  mov    0xc8(%rsp),%rax
  movsd  (%rbx,%rdx,8),%xmm0
  add    %r12d,%r13d
  add    0x28(%rsp),%r8
  add    0x20(%rsp),%r9
  divsd  (%rax,%rdx,8),%xmm0
  movsd  %xmm0,(%rbx,%rdx,8)
  add    $0x1,%rdx
  cmp    0x18(%rsp),%rdx
  jne    L145
  mov    0x30(%rsp),%r12
  mov    0xd8(%rsp),%r14
  jmp    L159
  nopl   0x0(%rax,%rax,1)
L675:
  mov    %rdx,%rax
  nopl   0x0(%rax,%rax,1)
L670:
  movsd  (%r9,%rax,8),%xmm2
  movsd  (%rbx,%rax,8),%xmm1
  mulsd  %xmm0,%xmm2
  subsd  %xmm2,%xmm1
  movsd  %xmm1,(%rbx,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%ebp
  jg     L670
  jmp    L448
  nopw   0x0(%rax,%rax,1)
L205:
  mov    0xb8(%rsp),%rax
  movsd  0x60(%rsp),%xmm0
  movsd  %xmm2,0x18(%rsp)
  movsd  (%rax),%xmm1
  call   <mp_dmin1@plt>
  movsd  0x18(%rsp),%xmm2
  movsd  %xmm0,0x60(%rsp)
  jmp    L147
  cs nopw 0x0(%rax,%rax,1)
L529:
  mov    0xb8(%rsp),%rax
  movsd  %xmm0,0x18(%rsp)
  movsd  0x38(%rsp),%xmm0
  movsd  (%rax),%xmm1
  call   <mp_dmax1@plt>
  movsd  0x18(%rsp),%xmm2
  movsd  %xmm0,0x38(%rsp)
  jmp    L367
L530:
  mov    %esi,%r13d
  pxor   %xmm0,%xmm0
  xor    %eax,%eax
  jmp    L425
L47:
  sub    $0x8,%rsp
  mov    %rbx,%r8
  mov    %ebp,%edi
  push   %r14
  push   0xd8(%rsp)
  push   0xd8(%rsp)
  mov    0xd0(%rsp),%r9
  mov    0x68(%rsp),%rcx
  mov    0x88(%rsp),%edx
  mov    0x70(%rsp),%rsi
  call   <mp_qrsolv@plt>
  add    $0x20,%rsp
  jmp    L352
L579:
  lea    0x1(%rdi),%r9d
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L22:
  movsd  (%rcx,%rax,8),%xmm2
  movsd  (%rbx,%rax,8),%xmm1
  mulsd  %xmm0,%xmm2
  subsd  %xmm2,%xmm1
  movsd  %xmm1,(%rbx,%rax,8)
  add    $0x1,%rax
  cmp    %r9,%rax
  jne    L22
  jmp    L445
L597:
  mov    0xd8(%rsp),%rsi
  call   <mp_enorm@plt>
  movsd  0x40(%rsp),%xmm5
  movsd  D11(%rip),%xmm1
  movapd %xmm0,%xmm7
  movapd %xmm0,%xmm4
  subsd  %xmm5,%xmm7
  mulsd  %xmm1,%xmm5
  movsd  %xmm7,0x18(%rsp)
  comisd %xmm7,%xmm5
  movsd  %xmm5,0x58(%rsp)
  jae    L31
  pxor   %xmm6,%xmm6
  movsd  %xmm6,0x8(%rsp)
L53:
  movslq %ebp,%r10
  xor    %eax,%eax
  test   %ebp,%ebp
  jle    L523
  mov    0x48(%rsp),%rsi
  mov    0xd8(%rsp),%rdi
  nopw   0x0(%rax,%rax,1)
L564:
  movslq (%rsi,%rax,4),%rdx
  movsd  (%rdi,%rdx,8),%xmm0
  movslq (%r15,%rdx,4),%rcx
  divsd  %xmm4,%xmm0
  mulsd  (%r12,%rcx,8),%xmm0
  movsd  %xmm0,(%rbx,%rax,8)
  add    $0x1,%rax
  cmp    %r10,%rax
  jne    L564
  movslq 0x68(%rsp),%rax
  mov    %ebp,0x20(%rsp)
  mov    %r14,%rsi
  mov    %r14,%rcx
  xor    %edx,%edx
  xor    %r9d,%r9d
  mov    %rax,0x10(%rsp)
  mov    %rax,%r8
  lea    0x8(,%rax,8),%r11
  lea    0x0(,%rax,8),%r13
  nopl   0x0(%rax)
L634:
  pxor   %xmm0,%xmm0
  test   %rdx,%rdx
  je     L45
  test   %edx,%edx
  mov    $0x1,%edi
  cmovg  %edx,%edi
  cmp    $0x1,%rdx
  jbe    L598
  mov    %edi,%ebp
  xor    %eax,%eax
  shr    %ebp
  shl    $0x4,%rbp
  nopw   0x0(%rax,%rax,1)
L596:
  movupd (%rbx,%rax,1),%xmm3
  movupd (%rcx,%rax,1),%xmm7
  add    $0x10,%rax
  mulpd  %xmm7,%xmm3
  addsd  %xmm3,%xmm0
  unpckhpd %xmm3,%xmm3
  addsd  %xmm3,%xmm0
  cmp    %rax,%rbp
  jne    L596
  mov    %edi,%eax
  and    $0xfffffffe,%eax
  lea    (%r9,%rax,1),%ebp
  cmp    %edi,%eax
  je     L45
L346:
  cltq
  movslq %ebp,%rbp
  movsd  (%rbx,%rax,8),%xmm2
  mulsd  (%r14,%rbp,8),%xmm2
  addsd  %xmm2,%xmm0
L45:
  movsd  (%rbx,%rdx,8),%xmm2
  add    %r8d,%r9d
  add    %r13,%rcx
  subsd  %xmm0,%xmm2
  divsd  (%rsi),%xmm2
  movsd  %xmm2,(%rbx,%rdx,8)
  add    %r11,%rsi
  add    $0x1,%rdx
  cmp    %r10,%rdx
  jne    L634
  mov    0x20(%rsp),%ebp
L71:
  mov    %rbx,%rsi
  mov    %ebp,%edi
  movsd  %xmm1,0x28(%rsp)
  movsd  %xmm4,0x20(%rsp)
  call   <mp_enorm@plt>
  movsd  0x20(%rsp),%xmm4
  movsd  0x28(%rsp),%xmm1
  movapd %xmm0,%xmm2
  movsd  0x18(%rsp),%xmm0
  divsd  0x40(%rsp),%xmm0
  divsd  %xmm2,%xmm0
  divsd  %xmm2,%xmm0
  movsd  %xmm0,0x38(%rsp)
  jmp    L279
L686:
  movsd  0x40(%rsp),%xmm0
  movsd  %xmm4,0x20(%rsp)
  call   <mp_dmin1@plt>
  movsd  D14(%rip),%xmm1
  movsd  0x20(%rsp),%xmm4
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x60(%rsp)
  jmp    L459
L598:
  mov    %r9d,%ebp
  xor    %eax,%eax
  jmp    L346
L523:
  movslq 0x68(%rsp),%rax
  mov    %rax,0x10(%rsp)
  jmp    L71
L607:
  call   <sqrt@plt>
  jmp    L24
```

tool_calls: name: parse_data
arguments: data_label: D11
data_type: f64
name: parse_data
arguments: data_label: D32
data_type: qword[2]
name: parse_data
arguments: data_label: D6
data_type: f64
name: parse_data
arguments: data_label: D14
data_type: byte[8]

tool: D11: 0.1

tool: {"D32": [0x7fffffffffffffff,0x0000000000000000]}

tool: D6: 0.001

tool: {"D14": [0xca,0x49,0xe5,0x3c,0xf8,0xff,0x0f,0x38]}

assistant: ```c
void mp_lmpar(int n, double *r, int ldr, int *ipvt, int *ifree, double *diag, double *qtb, double delta, double *par, double *x, double *sdiag, double *wa1, double *wa2) {
  int i, iter, ij, jj, j, jm1, jp1, k, l, nsing;
  double dxnorm, fp, gnorm, parc, parl, paru;
  double sum, temp;
  static double zero = 0.0;
  static double p1 = 0.1;
  static double p001 = 0.001;
  nsing = n;
  jj = 0;
  for (j = 0; j < n; j++) {
    wa1[j] = qtb[j];
    if ((r[jj] == zero) && (nsing == n))
      nsing = j;
    if (nsing < n)
      wa1[j] = zero;
    jj += ldr + 1;
  }
  if (nsing >= 1) {
    for (k = 0; k < nsing; k++) {
      j = nsing - k - 1;
      wa1[j] = wa1[j] / r[j + ldr * j];
      temp = wa1[j];
      jm1 = j - 1;
      if (jm1 >= 0) {
        ij = ldr * j;
        for (i = 0; i <= jm1; i++) {
          wa1[i] -= r[ij] * temp;
          ij += 1;
        }
      }
    }
  }
  for (j = 0; j < n; j++) {
    l = ipvt[j];
    x[l] = wa1[j];
  }
  iter = 0;
  for (j = 0; j < n; j++)
    wa2[j] = diag[ifree[j]] * x[j];
  dxnorm = mp_enorm(n, wa2);
  fp = dxnorm - delta;
  if (fp <= p1 * delta) {
    goto L220;
  }
  parl = zero;
  if (nsing >= n) {
    for (j = 0; j < n; j++) {
      l = ipvt[j];
      wa1[j] = diag[ifree[l]] * (wa2[l] / dxnorm);
    }
    jj = 0;
    for (j = 0; j < n; j++) {
      sum = zero;
      jm1 = j - 1;
      if (jm1 >= 0) {
        ij = jj;
        for (i = 0; i <= jm1; i++) {
          sum += r[ij] * wa1[i];
          ij += 1;
        }
      }
      wa1[j] = (wa1[j] - sum) / r[j + ldr * j];
      jj += ldr;
    }
    temp = mp_enorm(n, wa1);
    parl = ((fp / delta) / temp) / temp;
  }
  jj = 0;
  for (j = 0; j < n; j++) {
    sum = zero;
    ij = jj;
    for (i = 0; i <= j; i++) {
      sum += r[ij] * qtb[i];
      ij += 1;
    }
    l = ipvt[j];
    wa1[j] = sum / diag[ifree[l]];
    jj += ldr;
  }
  gnorm = mp_enorm(n, wa1);
  paru = gnorm / delta;
  if (paru == zero)
    paru = 1.17549e-38 / mp_dmin1(delta, p1);
  *par = mp_dmax1(*par, parl);
  *par = mp_dmin1(*par, paru);
  if (*par == zero)
    *par = gnorm / dxnorm;
L150:
  iter += 1;
  if (*par == zero)
    *par = mp_dmax1(1.17549e-38, p001 * paru);
  temp = sqrt(*par);
  for (j = 0; j < n; j++)
    wa1[j] = temp * diag[ifree[j]];
  mp_qrsolv(n, r, ldr, ipvt, wa1, qtb, x, sdiag, wa2);
  for (j = 0; j < n; j++)
    wa2[j] = diag[ifree[j]] * x[j];
  dxnorm = mp_enorm(n, wa2);
  temp = fp;
  fp = dxnorm - delta;
  if ((fabs(fp) <= p1 * delta) || ((parl == zero) && (fp <= temp) && (temp < zero)) || (iter == 10))
    goto L220;
  for (j = 0; j < n; j++) {
    l = ipvt[j];
    wa1[j] = diag[ifree[l]] * (wa2[l] / dxnorm);
  }
  jj = 0;
  for (j = 0; j < n; j++) {
    wa1[j] = wa1[j] / sdiag[j];
    temp = wa1[j];
    jp1 = j + 1;
    if (jp1 < n) {
      ij = jp1 + jj;
      for (i = jp1; i < n; i++) {
        wa1[i] -= r[ij] * temp;
        ij += 1;
      }
    }
    jj += ldr;
  }
  temp = mp_enorm(n, wa1);
  parc = ((fp / delta) / temp) / temp;
  if (fp > zero)
    parl = mp_dmax1(parl, *par);
  if (fp < zero)
    paru = mp_dmin1(paru, *par);
  *par = mp_dmax1(parl, *par + parc);
  goto L150;
L220:
  if (iter == 0)
    *par = zero;
}
```