user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<qrfac>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0xb8,%rsp
  mov    %rdi,-0x98(%rbp)
  mov    %esi,-0x9c(%rbp)
  mov    %edx,-0xa0(%rbp)
  mov    %ecx,-0xa4(%rbp)
  mov    %r8d,-0xa8(%rbp)
  mov    %r9,-0xb0(%rbp)
  movsd  %xmm0,-0xb8(%rbp)
  cmpl   $0x0,-0xa8(%rbp)
  je     L281
  cmpl   $0x1,-0xa8(%rbp)
  je     L281
  lea    D41(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
L281:
  mov    -0xa0(%rbp),%eax
  cltq
  mov    %eax,%edx
  mov    -0x9c(%rbp),%eax
  cltq
  imul   %edx,%eax
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x60(%rbp)
  mov    -0xa0(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x58(%rbp)
  mov    -0x9c(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x50(%rbp)
  movsd  D26(%rip),%xmm0
  movsd  %xmm0,-0x48(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x40(%rbp)
  movsd  D13(%rip),%xmm0
  movsd  %xmm0,-0x38(%rbp)
  movsd  -0xb8(%rbp),%xmm0
  movsd  %xmm0,-0x30(%rbp)
  mov    -0x60(%rbp),%rcx
  mov    -0xa0(%rbp),%edx
  mov    -0x9c(%rbp),%esi
  mov    -0x98(%rbp),%rax
  mov    %rax,%rdi
  call   <mtranspose@plt>
  movl   $0x0,-0x88(%rbp)
  jmp    L162
L252:
  mov    -0x88(%rbp),%eax
  imul   -0x9c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rax,%rdx
  mov    -0x88(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    0x20(%rbp),%rax
  lea    (%rcx,%rax,1),%rbx
  mov    -0x9c(%rbp),%eax
  mov    %eax,%esi
  mov    %rdx,%rdi
  call   <enorm@plt>
  movq   %xmm0,%rax
  mov    %rax,(%rbx)
  mov    -0x88(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x20(%rbp),%rax
  add    %rax,%rdx
  mov    -0x88(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    0x18(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x88(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x88(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x58(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  cmpl   $0x1,-0xa8(%rbp)
  jne    L109
  mov    -0x88(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xb0(%rbp),%rax
  add    %rax,%rdx
  mov    -0x88(%rbp),%eax
  mov    %eax,(%rdx)
L109:
  addl   $0x1,-0x88(%rbp)
L162:
  mov    -0x88(%rbp),%eax
  cmp    -0xa0(%rbp),%eax
  jl     L252
  mov    -0x9c(%rbp),%eax
  cmp    -0xa0(%rbp),%eax
  jge    L357
  mov    -0x9c(%rbp),%eax
  mov    %eax,-0x7c(%rbp)
  jmp    L121
L357:
  mov    -0xa0(%rbp),%eax
  mov    %eax,-0x7c(%rbp)
L121:
  movl   $0x0,-0x88(%rbp)
  jmp    L170
L249:
  cmpl   $0x1,-0xa8(%rbp)
  jne    L18
  mov    -0x88(%rbp),%eax
  mov    %eax,-0x80(%rbp)
  mov    -0x88(%rbp),%eax
  mov    %eax,-0x84(%rbp)
  jmp    L126
L196:
  mov    -0x84(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x80(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  comisd %xmm1,%xmm0
  jbe    L143
  mov    -0x84(%rbp),%eax
  mov    %eax,-0x80(%rbp)
L143:
  addl   $0x1,-0x84(%rbp)
L126:
  mov    -0x84(%rbp),%eax
  cmp    -0xa0(%rbp),%eax
  jl     L196
  mov    -0x80(%rbp),%eax
  cmp    -0x88(%rbp),%eax
  je     L18
  movl   $0x0,-0x8c(%rbp)
  jmp    L220
L217:
  mov    -0x8c(%rbp),%eax
  imul   -0xa0(%rbp),%eax
  mov    %eax,-0x78(%rbp)
  mov    -0x78(%rbp),%edx
  mov    -0x88(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x28(%rbp)
  mov    -0x78(%rbp),%edx
  mov    -0x80(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rax,%rdx
  mov    -0x78(%rbp),%ecx
  mov    -0x88(%rbp),%eax
  add    %ecx,%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x98(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x78(%rbp),%edx
  mov    -0x80(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  movsd  -0x28(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x8c(%rbp)
L220:
  mov    -0x8c(%rbp),%eax
  cmp    -0x9c(%rbp),%eax
  jl     L217
  mov    -0x88(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x80(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    0x18(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x88(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rax,%rdx
  mov    -0x80(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x58(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x88(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xb0(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x84(%rbp)
  mov    -0x80(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xb0(%rbp),%rax
  add    %rdx,%rax
  mov    -0x88(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0xb0(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x80(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xb0(%rbp),%rax
  add    %rax,%rdx
  mov    -0x84(%rbp),%eax
  mov    %eax,(%rdx)
L18:
  mov    -0x88(%rbp),%eax
  imul   -0xa0(%rbp),%eax
  mov    %eax,%edx
  mov    -0x88(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x78(%rbp)
  movl   $0x0,-0x8c(%rbp)
  jmp    L1
L118:
  mov    -0x8c(%rbp),%eax
  imul   -0xa0(%rbp),%eax
  mov    %eax,%edx
  mov    -0x78(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rax,%rdx
  mov    -0x8c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x50(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x8c(%rbp)
L1:
  mov    -0x9c(%rbp),%eax
  sub    -0x88(%rbp),%eax
  cmp    %eax,-0x8c(%rbp)
  jl     L118
  mov    -0x9c(%rbp),%eax
  sub    -0x88(%rbp),%eax
  mov    %eax,%edx
  mov    -0x50(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <enorm@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x70(%rbp)
  movsd  -0x70(%rbp),%xmm0
  ucomisd -0x40(%rbp),%xmm0
  jp     L195
  movsd  -0x70(%rbp),%xmm0
  ucomisd -0x40(%rbp),%xmm0
  je     L171
L195:
  mov    -0x78(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  -0x40(%rbp),%xmm0
  comisd %xmm1,%xmm0
  jbe    L235
  movsd  -0x70(%rbp),%xmm0
  movq   D35(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,-0x70(%rbp)
L235:
  mov    -0x88(%rbp),%eax
  mov    %eax,-0x8c(%rbp)
  jmp    L81
L350:
  mov    -0x8c(%rbp),%eax
  imul   -0xa0(%rbp),%eax
  mov    %eax,%edx
  mov    -0x88(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x8c(%rbp),%eax
  imul   -0xa0(%rbp),%eax
  mov    %eax,%edx
  mov    -0x88(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  divsd  -0x70(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x8c(%rbp)
L81:
  mov    -0x8c(%rbp),%eax
  cmp    -0x9c(%rbp),%eax
  jl     L350
  mov    -0x78(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x78(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  addsd  -0x48(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x88(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x74(%rbp)
  mov    -0x74(%rbp),%eax
  cmp    -0xa0(%rbp),%eax
  jge    L171
  mov    -0x74(%rbp),%eax
  mov    %eax,-0x84(%rbp)
  jmp    L312
L114:
  movsd  -0x40(%rbp),%xmm0
  movsd  %xmm0,-0x68(%rbp)
  mov    -0x88(%rbp),%eax
  mov    %eax,-0x8c(%rbp)
  jmp    L189
L345:
  mov    -0x8c(%rbp),%eax
  imul   -0xa0(%rbp),%eax
  mov    %eax,%edx
  mov    -0x88(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x8c(%rbp),%eax
  imul   -0xa0(%rbp),%eax
  mov    %eax,%edx
  mov    -0x84(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  -0x68(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x68(%rbp)
  addl   $0x1,-0x8c(%rbp)
L189:
  mov    -0x8c(%rbp),%eax
  cmp    -0x9c(%rbp),%eax
  jl     L345
  mov    -0x78(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  -0x68(%rbp),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x28(%rbp)
  mov    -0x88(%rbp),%eax
  mov    %eax,-0x8c(%rbp)
  jmp    L266
L328:
  mov    -0x8c(%rbp),%eax
  imul   -0xa0(%rbp),%eax
  mov    %eax,%edx
  mov    -0x84(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x8c(%rbp),%eax
  imul   -0xa0(%rbp),%eax
  mov    %eax,%edx
  mov    -0x88(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mulsd  -0x28(%rbp),%xmm1
  mov    -0x8c(%rbp),%eax
  imul   -0xa0(%rbp),%eax
  mov    %eax,%edx
  mov    -0x84(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x8c(%rbp)
L266:
  mov    -0x8c(%rbp),%eax
  cmp    -0x9c(%rbp),%eax
  jl     L328
  cmpl   $0x1,-0xa8(%rbp)
  jne    L6
  mov    -0x84(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  ucomisd -0x40(%rbp),%xmm0
  jp     L45
  ucomisd -0x40(%rbp),%xmm0
  je     L6
L45:
  mov    -0x88(%rbp),%eax
  imul   -0xa0(%rbp),%eax
  mov    %eax,%edx
  mov    -0x84(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x84(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x28(%rbp)
  movsd  -0x28(%rbp),%xmm0
  movapd %xmm0,%xmm1
  mulsd  %xmm0,%xmm1
  movsd  -0x48(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  mov    -0x40(%rbp),%rax
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <pmax@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x84(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  movsd  %xmm2,-0xc0(%rbp)
  mov    -0x20(%rbp),%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  mov    -0x84(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x18(%rbp),%rax
  add    %rdx,%rax
  mulsd  -0xc0(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x84(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x84(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  divsd  %xmm1,%xmm0
  movsd  -0x38(%rbp),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movsd  -0x18(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movsd  -0x30(%rbp),%xmm0
  comisd -0x18(%rbp),%xmm0
  jb     L6
  movl   $0x0,-0x8c(%rbp)
  jmp    L282
L247:
  mov    -0x74(%rbp),%eax
  imul   -0xa0(%rbp),%eax
  mov    %eax,%edx
  mov    -0x84(%rbp),%eax
  add    %eax,%edx
  mov    -0x8c(%rbp),%eax
  imul   -0xa0(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rax,%rdx
  mov    -0x8c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x50(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x8c(%rbp)
L282:
  mov    -0x9c(%rbp),%eax
  sub    -0x88(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x8c(%rbp)
  jl     L247
  mov    -0x9c(%rbp),%eax
  sub    -0x88(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    -0x84(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    0x18(%rbp),%rax
  lea    (%rcx,%rax,1),%rbx
  mov    -0x50(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <enorm@plt>
  movq   %xmm0,%rax
  mov    %rax,(%rbx)
  mov    -0x84(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x84(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x58(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
L6:
  addl   $0x1,-0x84(%rbp)
L312:
  mov    -0x84(%rbp),%eax
  cmp    -0xa0(%rbp),%eax
  jl     L114
L171:
  mov    -0x88(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  -0x70(%rbp),%xmm0
  movq   D35(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x88(%rbp)
L170:
  mov    -0x88(%rbp),%eax
  cmp    -0x7c(%rbp),%eax
  jl     L249
  mov    -0x60(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x50(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D41
data_type: string
name: retrieve_data
arguments: tag: D26
data_type: f64
name: retrieve_data
arguments: tag: D13
data_type: byte[8]
name: retrieve_data
arguments: tag: D35
data_type: f32[2]

tool: D41: Pivot only takes binary values 0 and 1 


tool: D26: 1

tool: {"D13": [0x9a,0x99,0x99,0x99,0x99,0x99,0xa9,0x3f]}

tool: {"D35": [0.0,-0.0]}

assistant: ```c
void qrfac(double *A, int M, int N, int lda, int pivot, int *ipvt, int lipvt, double *rdiag, double *acnorm, double eps) {
  int i, j, jp1, k, kmax, minmn, t;
  double ajnorm, epsmch, one, p05, sum, temp, zero, temp2, pmaxval;
  double *AT, *wa, *wa2;
  if (pivot != 0 && pivot != 1) {
    printf("Pivot only takes binary values 0 and 1 \n");
    exit(-1);
  }
  AT = (double *)malloc(sizeof(double) * N * M);
  wa = (double *)malloc(sizeof(double) * N);
  wa2 = (double *)malloc(sizeof(double) * M);
  one = 1.0;
  zero = 0.0;
  p05 = 5.0e-02;
  epsmch = eps;
  mtranspose(A, M, N, AT);
  for (j = 0; j < N; ++j) {
    acnorm[j] = enorm(AT + j * M, M);
    rdiag[j] = acnorm[j];
    wa[j] = rdiag[j];
    if (pivot == 1) {
      ipvt[j] = j;
    }
  }
  if (M < N) {
    minmn = M;
  } else {
    minmn = N;
  }
  for (j = 0; j < minmn; ++j) {
    if (pivot == 1) {
      kmax = j;
      for (k = j; k < N; ++k) {
        if (rdiag[k] > rdiag[kmax]) {
          kmax = k;
        }
      }
      if (kmax != j) {
        for (i = 0; i < M; ++i) {
          t = i * N;
          temp = A[t + j];
          A[t + j] = A[t + kmax];
          A[t + kmax] = temp;
        }
        rdiag[kmax] = rdiag[j];
        wa[kmax] = wa[j];
        k = ipvt[j];
        ipvt[j] = ipvt[kmax];
        ipvt[kmax] = k;
      }
    }
    t = j * N + j;
    for (i = 0; i < M - j; ++i) {
      wa2[i] = A[t + i * N];
    }
    ajnorm = enorm(wa2, M - j);
    if (ajnorm != zero) {
      if (A[t] < zero) {
        ajnorm = -ajnorm;
      }
      for (i = j; i < M; ++i) {
        A[i * N + j] /= ajnorm;
      }
      A[t] += one;
      jp1 = j + 1;
      if (N >= jp1 + 1) {
        for (k = jp1; k < N; ++k) {
          sum = zero;
          for (i = j; i < M; ++i) {
            sum += (A[i * N + j] * A[i * N + k]);
          }
          temp = sum / A[t];
          for (i = j; i < M; ++i) {
            A[i * N + k] -= (temp * A[i * N + j]);
          }
          if (pivot == 1 && rdiag[k] != zero) {
            temp = A[j * N + k] / rdiag[k];
            pmaxval = pmax(zero, one - temp * temp);
            rdiag[k] = rdiag[k] * sqrt(pmaxval);
            temp2 = (p05 * (rdiag[k] / wa[k]));
            temp2 = temp2 * temp2;
            if (temp2 <= epsmch) {
              for (i = 0; i < M - j - 1; ++i) {
                wa2[i] = A[jp1 * N + k + i * N];
              }
              rdiag[k] = enorm(wa2, M - j - 1);
              wa[k] = rdiag[k];
            }
          }
        }
      }
    }
    rdiag[j] = -ajnorm;
  }
  free(AT);
  free(wa);
  free(wa2);
}
```