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

```asm
<mod_chol>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %rdx,0x40(%rsp)
  mov    %rcx,0x18(%rsp)
  cmp    $0x1,%esi
  je     L62
  mov    %esi,%ebx
  test   %esi,%esi
  jle    L497
  movslq %esi,%rsi
  pxor   %xmm6,%xmm6
  mov    0x40(%rsp),%rdx
  mov    %r8,%r13
  mov    %rsi,0x50(%rsp)
  mov    0x18(%rsp),%rcx
  xor    %eax,%eax
  movsd  %xmm6,0x8(%rsp)
  nopl   0x0(%rax,%rax,1)
L558:
  mov    %eax,(%rcx,%rax,4)
  movq   $0x0,(%rdx,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rsi
  jne    L558
  movsd  0x8(%rsp),%xmm6
  xor    %edx,%edx
  mov    $0x1,%r12d
  xor    %esi,%esi
  movq   D188(%rip),%xmm4
  movsd  %xmm6,(%rsp)
  nopl   0x0(%rax)
L213:
  mov    %edx,%ecx
  add    $0x1,%edx
  movsd  0x8(%rsp),%xmm7
  mov    %edx,%eax
  imul   %ecx,%eax
  sar    %eax
  add    %ecx,%eax
  cltq
  movsd  0x0(%rbp,%rax,8),%xmm0
  movapd %xmm0,%xmm1
  ucomisd %xmm0,%xmm7
  andpd  %xmm4,%xmm1
  maxsd  (%rsp),%xmm1
  cmova  %esi,%r12d
  movsd  %xmm1,(%rsp)
  cmp    %ebx,%edx
  jne    L213
  test   %r12d,%r12d
  je     L206
  movsd  D154(%rip),%xmm7
  movapd %xmm1,%xmm6
  mov    %r13,0x20(%rsp)
  xor    %r12d,%r12d
  mulsd  %xmm7,%xmm6
  movsd  %xmm7,0x48(%rsp)
  movsd  %xmm6,0x10(%rsp)
  nopw   0x0(%rax,%rax,1)
L238:
  lea    0x1(%r12),%r14d
  mov    %r12d,%r15d
  mov    %r14d,%eax
  imul   %r12d,%eax
  sar    %eax
  add    %r12d,%eax
  cltq
  lea    0x0(%rbp,%rax,8),%r13
  movsd  0x0(%r13),%xmm1
  movapd %xmm1,%xmm2
  cmp    %ebx,%r14d
  jge    L250
  mov    %r14d,%edx
  nopl   (%rax)
L325:
  mov    %edx,%ecx
  add    $0x1,%edx
  mov    %edx,%esi
  imul   %ecx,%esi
  mov    %esi,%eax
  shr    $0x1f,%eax
  add    %esi,%eax
  sar    %eax
  add    %ecx,%eax
  cltq
  movsd  0x0(%rbp,%rax,8),%xmm0
  movapd %xmm0,%xmm5
  comisd %xmm1,%xmm0
  minsd  %xmm2,%xmm0
  maxsd  %xmm1,%xmm5
  cmova  %ecx,%r15d
  movapd %xmm0,%xmm2
  movapd %xmm5,%xmm1
  cmp    %ebx,%edx
  jne    L325
L250:
  movsd  0x10(%rsp),%xmm6
  comisd %xmm1,%xmm6
  ja     L445
  mulsd  D114(%rip),%xmm1
  comisd %xmm2,%xmm1
  ja     L445
  cmp    %r15d,%r12d
  je     L256
  mov    %r12d,%ecx
  mov    %r15d,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <switch_row_and_colMAT@plt>
  mov    0x18(%rsp),%rdi
  mov    %r12d,%edx
  mov    %r15d,%esi
  xor    %eax,%eax
  call   <switch_row_and_colVEC@plt>
  movq   D188(%rip),%xmm4
L256:
  cmp    %ebx,%r14d
  je     L537
  movsd  0x0(%r13),%xmm3
  mov    %r14d,%edx
  pxor   %xmm2,%xmm2
  cs nopw 0x0(%rax,%rax,1)
L66:
  mov    %edx,%esi
  add    $0x1,%edx
  mov    %edx,%ecx
  imul   %esi,%ecx
  mov    %ecx,%eax
  shr    $0x1f,%eax
  add    %ecx,%eax
  sar    %eax
  lea    (%rax,%r12,1),%ecx
  add    %esi,%eax
  movslq %ecx,%rcx
  cltq
  movsd  0x0(%rbp,%rcx,8),%xmm0
  movsd  0x0(%rbp,%rax,8),%xmm1
  mulsd  %xmm0,%xmm0
  divsd  %xmm3,%xmm0
  subsd  %xmm0,%xmm1
  minsd  %xmm2,%xmm1
  movapd %xmm1,%xmm2
  cmp    %ebx,%edx
  jne    L66
  movsd  D114(%rip),%xmm0
  mulsd  (%rsp),%xmm0
  comisd %xmm1,%xmm0
  ja     L445
  mov    %r12d,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <jthIteration@plt>
  mov    %r14d,%r12d
  movq   D188(%rip),%xmm4
  jmp    L238
  nopl   0x0(%rax,%rax,1)
L537:
  movsd  D114(%rip),%xmm0
  mulsd  (%rsp),%xmm0
  comisd 0x8(%rsp),%xmm0
  mov    0x20(%rsp),%r13
  jbe    L550
L491:
  lea    -0x1(%rbx),%eax
  mov    %eax,0x5c(%rsp)
  cmp    %r12d,%eax
  je     L88
  jle    L532
  cmp    %r12d,%ebx
  jle    L486
L30:
  mov    %r14d,%eax
  movslq %r12d,%r15
  mov    %r13,0x10(%rsp)
  movslq %r14d,%r8
  imul   %r12d,%eax
  lea    0x0(,%r15,8),%rdx
  mov    %r14d,0x20(%rsp)
  lea    0x0(%r13,%rdx,1),%rdi
  lea    0x8(%r13,%rdx,1),%rsi
  sar    %eax
  add    %r12d,%eax
  cltq
  movsd  0x0(%rbp,%rax,8),%xmm0
  lea    0x8(%rbp),%rax
  mov    %rax,%r14
  movsd  %xmm0,(%rdi)
  xchg   %ax,%ax
L195:
  mov    %r8d,%r11d
  lea    -0x1(%r8),%r9d
  mov    %r8d,%r10d
  mov    %r8d,%r13d
  cmp    %r8d,%ebx
  jle    L264
  movsd  (%rdi),%xmm1
  mov    %r8d,%edx
  nopl   (%rax)
L338:
  mov    %edx,%ecx
  add    $0x1,%edx
  imul   %edx,%ecx
  mov    %ecx,%eax
  shr    $0x1f,%eax
  add    %ecx,%eax
  sar    %eax
  add    %r9d,%eax
  cltq
  movsd  0x0(%rbp,%rax,8),%xmm0
  andpd  %xmm4,%xmm0
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%rdi)
  cmp    %ebx,%edx
  jne    L338
  lea    0x1(%r11),%edx
  mov    %rsi,%rdi
  imul   %r10d,%edx
  mov    %edx,%eax
  shr    $0x1f,%eax
  add    %edx,%eax
  sar    %eax
  add    %eax,%r10d
  movslq %r10d,%r10
  movsd  0x0(%rbp,%r10,8),%xmm1
  movsd  %xmm1,(%rsi)
  cmp    %r12d,%r13d
  jle    L367
  sub    %r12d,%r11d
  movslq %eax,%rcx
  lea    -0x1(%r11),%edx
  lea    (%r15,%rcx,1),%rax
  add    %r15,%rdx
  lea    0x0(%rbp,%rax,8),%rax
  add    %rcx,%rdx
  lea    (%r14,%rdx,8),%rdx
  nopl   0x0(%rax,%rax,1)
L99:
  movsd  (%rax),%xmm0
  add    $0x8,%rax
  andpd  %xmm4,%xmm0
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%rsi)
  cmp    %rax,%rdx
  jne    L99
L367:
  add    $0x1,%r8
  add    $0x8,%rsi
  jmp    L195
L550:
  mov    %r12d,%edx
  mov    %r14d,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <jthIteration@plt>
L532:
  movsd  0x8(%rsp),%xmm7
  movsd  %xmm7,0x10(%rsp)
L230:
  movsd  0x10(%rsp),%xmm0
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L445:
  mov    0x20(%rsp),%r13
  jmp    L491
L62:
  movsd  (%rdi),%xmm0
  pxor   %xmm7,%xmm7
  mov    0x40(%rsp),%rax
  movsd  D154(%rip),%xmm6
  movsd  %xmm7,0x8(%rsp)
  movapd %xmm0,%xmm1
  andpd  D188(%rip),%xmm1
  mulsd  %xmm6,%xmm1
  subsd  %xmm0,%xmm1
  maxsd  %xmm7,%xmm1
  movsd  %xmm1,(%rax)
  movsd  (%rdi),%xmm0
  ucomisd %xmm7,%xmm0
  jp     L490
  jne    L490
  movsd  %xmm6,(%rax)
  movsd  (%rdi),%xmm0
  movapd %xmm6,%xmm1
L490:
  addsd  %xmm1,%xmm0
  movsd  0x8(%rsp),%xmm7
  ucomisd %xmm0,%xmm7
  ja     L118
  sqrtsd %xmm0,%xmm0
L248:
  mov    0x18(%rsp),%rax
  movsd  %xmm0,0x0(%rbp)
  movl   $0x0,(%rax)
  mov    0x40(%rsp),%rax
  movsd  (%rax),%xmm6
  movsd  %xmm6,0x10(%rsp)
  jmp    L230
L88:
  mov    %ebx,%eax
  movsd  0x10(%rsp),%xmm1
  imul   %r12d,%eax
  sar    %eax
  add    %r12d,%eax
  cltq
  lea    0x0(%rbp,%rax,8),%rbx
  movsd  (%rbx),%xmm2
  movapd %xmm2,%xmm0
  movsd  %xmm2,(%rsp)
  mulsd  D85(%rip),%xmm0
  divsd  D164(%rip),%xmm0
  call   <fmax@plt>
  movsd  (%rsp),%xmm2
  movsd  0x8(%rsp),%xmm6
  subsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm2
  movsd  %xmm0,0x10(%rsp)
  ucomisd %xmm2,%xmm6
  movapd %xmm2,%xmm0
  ja     L536
  sqrtsd %xmm0,%xmm0
L111:
  mov    0x40(%rsp),%rax
  mov    0x50(%rsp),%rdi
  movsd  %xmm0,(%rbx)
  movsd  0x10(%rsp),%xmm7
  movsd  %xmm7,-0x8(%rax,%rdi,8)
  jmp    L230
L264:
  mov    0x10(%rsp),%r13
  mov    0x20(%rsp),%r14d
L486:
  lea    -0x2(%rbx),%eax
  mov    %eax,0x58(%rsp)
  cmp    %r12d,%eax
  jle    L467
  movsd  0x8(%rsp),%xmm6
  mov    %r12d,0x20(%rsp)
  movslq %r12d,%r8
  mov    %r14d,%r12d
  movsd  %xmm6,0x10(%rsp)
  nopl   0x0(%rax)
L417:
  mov    0x20(%rsp),%r14d
  movsd  0x0(%r13,%r8,8),%xmm0
  mov    %r12d,0x20(%rsp)
  cmp    %r12d,%ebx
  jle    L282
  movslq %r12d,%rax
  mov    %r14d,%r15d
L352:
  movsd  0x0(%r13,%rax,8),%xmm1
  comisd %xmm0,%xmm1
  maxsd  %xmm0,%xmm1
  cmova  %eax,%r15d
  add    $0x1,%rax
  movapd %xmm1,%xmm0
  cmp    %eax,%ebx
  jg     L352
  cmp    %r8d,%r15d
  je     L116
  mov    %r15d,%edx
  mov    %r14d,%ecx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    %r8,0x28(%rsp)
  call   <switch_row_and_colMAT@plt>
  mov    0x18(%rsp),%rdi
  mov    %r15d,%esi
  mov    %r14d,%edx
  xor    %eax,%eax
  movslq %r15d,%r15
  call   <switch_row_and_colVEC@plt>
  mov    0x28(%rsp),%r8
  lea    0x0(%r13,%r15,8),%rax
  movq   D188(%rip),%xmm4
  movsd  (%rax),%xmm0
  movsd  0x0(%r13,%r8,8),%xmm1
  movsd  %xmm1,(%rax)
  movsd  %xmm0,0x0(%r13,%r8,8)
L116:
  mov    %r12d,%edx
  pxor   %xmm2,%xmm2
  nop
L540:
  mov    %edx,%ecx
  add    $0x1,%edx
  imul   %edx,%ecx
  mov    %ecx,%eax
  shr    $0x1f,%eax
  add    %ecx,%eax
  sar    %eax
  add    %r14d,%eax
  cltq
  movsd  0x0(%rbp,%rax,8),%xmm0
  andpd  %xmm4,%xmm0
  addsd  %xmm0,%xmm2
  cmp    %ebx,%edx
  jl     L540
L90:
  movsd  (%rsp),%xmm1
  mulsd  0x48(%rsp),%xmm1
  movapd %xmm2,%xmm0
  mov    %r8,0x38(%rsp)
  movsd  %xmm2,0x30(%rsp)
  call   <fmax@plt>
  mov    %r12d,%eax
  movsd  0x10(%rsp),%xmm1
  imul   %r14d,%eax
  sar    %eax
  add    %r14d,%eax
  cltq
  lea    0x0(%rbp,%rax,8),%r15
  movsd  (%r15),%xmm3
  subsd  %xmm3,%xmm0
  movsd  %xmm3,0x28(%rsp)
  call   <fmax@plt>
  movapd %xmm0,%xmm1
  pxor   %xmm0,%xmm0
  call   <fmax@plt>
  comisd 0x8(%rsp),%xmm0
  movsd  0x28(%rsp),%xmm3
  movsd  0x30(%rsp),%xmm2
  movq   D188(%rip),%xmm4
  mov    0x38(%rsp),%r8
  jbe    L117
  addsd  %xmm0,%xmm3
  mov    0x40(%rsp),%rax
  movsd  %xmm0,0x10(%rsp)
  movsd  %xmm3,(%r15)
  movsd  %xmm0,(%rax,%r8,8)
  movsd  (%r15),%xmm3
L117:
  ucomisd %xmm3,%xmm2
  jp     L351
  jne    L351
L385:
  mov    %r14d,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    %r8,0x28(%rsp)
  call   <jthIteration@plt>
  mov    0x28(%rsp),%r8
  add    $0x1,%r8
  cmp    %r12d,0x58(%rsp)
  je     L344
  movq   D188(%rip),%xmm4
  add    $0x1,%r12d
  jmp    L417
L351:
  divsd  %xmm3,%xmm2
  movsd  D180(%rip),%xmm1
  subsd  %xmm2,%xmm1
  cmp    %r12d,%ebx
  jle    L385
  movslq %r12d,%rax
  mov    %r12d,%edx
  lea    0x0(%r13,%rax,8),%rsi
  xchg   %ax,%ax
L258:
  mov    %edx,%ecx
  add    $0x1,%edx
  add    $0x8,%rsi
  imul   %edx,%ecx
  mov    %ecx,%eax
  shr    $0x1f,%eax
  add    %ecx,%eax
  sar    %eax
  add    %r14d,%eax
  cltq
  movsd  0x0(%rbp,%rax,8),%xmm0
  andpd  %xmm4,%xmm0
  mulsd  %xmm1,%xmm0
  addsd  -0x8(%rsi),%xmm0
  movsd  %xmm0,-0x8(%rsi)
  cmp    %ebx,%edx
  jne    L258
  jmp    L385
L467:
  movsd  0x8(%rsp),%xmm6
  movsd  %xmm6,0x10(%rsp)
L344:
  mov    0x58(%rsp),%eax
  mov    0x5c(%rsp),%edi
  movsd  D115(%rip),%xmm0
  movsd  0x8(%rsp),%xmm7
  mov    %eax,%edx
  imul   %edi,%edx
  sar    %edx
  add    %edx,%eax
  cltq
  lea    0x0(%rbp,%rax,8),%r12
  mov    %ebx,%eax
  imul   %edi,%eax
  movsd  (%r12),%xmm2
  movapd %xmm2,%xmm3
  sar    %eax
  add    %edi,%eax
  cltq
  lea    0x0(%rbp,%rax,8),%rbx
  lea    (%rdi,%rdx,1),%eax
  cltq
  movsd  (%rbx),%xmm1
  lea    0x0(%rbp,%rax,8),%rbp
  movsd  0x0(%rbp),%xmm4
  subsd  %xmm1,%xmm3
  mulsd  %xmm4,%xmm0
  mulsd  %xmm3,%xmm3
  mulsd  %xmm4,%xmm0
  addsd  %xmm3,%xmm0
  ucomisd %xmm0,%xmm7
  ja     L28
  sqrtsd %xmm0,%xmm0
L27:
  addsd  %xmm2,%xmm1
  movsd  D73(%rip),%xmm4
  movsd  %xmm2,0x20(%rsp)
  movapd %xmm1,%xmm3
  addsd  %xmm0,%xmm1
  subsd  %xmm0,%xmm3
  movsd  D85(%rip),%xmm0
  mulsd  %xmm4,%xmm1
  mulsd  %xmm4,%xmm3
  subsd  %xmm3,%xmm1
  movsd  %xmm3,0x18(%rsp)
  mulsd  %xmm1,%xmm0
  movsd  (%rsp),%xmm1
  mulsd  0x48(%rsp),%xmm1
  divsd  D8(%rip),%xmm0
  call   <fmax@plt>
  movsd  0x18(%rsp),%xmm3
  movapd %xmm0,%xmm1
  pxor   %xmm0,%xmm0
  subsd  %xmm3,%xmm1
  call   <fmax@plt>
  movsd  0x10(%rsp),%xmm1
  call   <fmax@plt>
  comisd 0x8(%rsp),%xmm0
  movsd  0x20(%rsp),%xmm2
  jbe    L438
  addsd  %xmm0,%xmm2
  mov    0x50(%rsp),%rax
  mov    0x40(%rsp),%rdi
  movsd  %xmm0,0x10(%rsp)
  shl    $0x3,%rax
  movsd  %xmm2,(%r12)
  movsd  (%rbx),%xmm1
  addsd  %xmm0,%xmm1
  movsd  %xmm1,(%rbx)
  movsd  %xmm0,-0x10(%rdi,%rax,1)
  movsd  %xmm0,-0x8(%rdi,%rax,1)
  movsd  (%r12),%xmm2
L438:
  movsd  0x8(%rsp),%xmm7
  ucomisd %xmm2,%xmm7
  ja     L140
  sqrtsd %xmm2,%xmm2
L119:
  movsd  %xmm2,(%r12)
  movsd  0x0(%rbp),%xmm0
  movsd  0x8(%rsp),%xmm6
  divsd  %xmm2,%xmm0
  movapd %xmm0,%xmm1
  movsd  %xmm0,0x0(%rbp)
  mulsd  %xmm0,%xmm1
  movsd  (%rbx),%xmm0
  subsd  %xmm1,%xmm0
  ucomisd %xmm0,%xmm6
  ja     L460
  sqrtsd %xmm0,%xmm0
L141:
  movsd  %xmm0,(%rbx)
  jmp    L230
L282:
  pxor   %xmm2,%xmm2
  jmp    L90
L497:
  pxor   %xmm7,%xmm7
  movsd  %xmm7,0x8(%rsp)
  jmp    L532
L536:
  call   <sqrt@plt>
  jmp    L111
L118:
  call   <sqrt@plt>
  jmp    L248
L206:
  movsd  D154(%rip),%xmm7
  lea    -0x1(%rbx),%eax
  mov    $0x1,%r14d
  mov    %eax,0x5c(%rsp)
  movsd  %xmm7,0x48(%rsp)
  jmp    L30
L460:
  call   <sqrt@plt>
  jmp    L141
L140:
  movapd %xmm2,%xmm0
  call   <sqrt@plt>
  movapd %xmm0,%xmm2
  jmp    L119
L28:
  movsd  %xmm1,0x20(%rsp)
  movsd  %xmm2,0x18(%rsp)
  call   <sqrt@plt>
  movsd  0x20(%rsp),%xmm1
  movsd  0x18(%rsp),%xmm2
  jmp    L27
```

tool_calls: name: parse_data
arguments: data_tag: D188
type: qword[2]
name: parse_data
arguments: data_tag: D154
type: byte[8]
name: parse_data
arguments: data_tag: D114
type: byte[8]
name: parse_data
arguments: data_tag: D85
type: byte[8]
name: parse_data
arguments: data_tag: D164
type: byte[8]
name: parse_data
arguments: data_tag: D180
type: f64
name: parse_data
arguments: data_tag: D115
type: f64
name: parse_data
arguments: data_tag: D73
type: f64
name: parse_data
arguments: data_tag: D8
type: byte[8]

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

tool: {"D154": [0x8d,0x72,0x8d,0xf9,0xa2,0x28,0xc4,0x3d]}

tool: {"D114": [0x9a,0x99,0x99,0x99,0x99,0x99,0xb9,0xbf]}

tool: {"D85": [0x3e,0x6e,0x3d,0xa5,0xfe,0x65,0xd9,0x3e]}

tool: {"D164": [0x61,0xad,0x00,0x4d,0xf3,0xff,0xef,0xbf]}

tool: D180: 1

tool: D115: 4

tool: D73: 0.5

tool: {"D8": [0x61,0xad,0x00,0x4d,0xf3,0xff,0xef,0x3f]}

assistant: ```c
double mod_chol(double *A, int n, double *E, int *P, double *g) {
  int phaseone = 1;
  int i, j, k;
  double tau = pow(2.22044604925031e-16, 1. / 3.);
  double taubar = pow(2.22044604925031e-16, 2.0 / 3.0);
  double mu = 0.1;
  double gamma = 0.0;
  double tmp = 0.;
  double delta = 0.;
  double deltaprev = 0.;
  double normj;
  double lambda_hi;
  double lambda_lo;
  if (n == 1) {
    delta = (taubar * fabs(A[0])) - A[0];
    if (delta > 0.0)
      E[0] = delta;
    else
      E[0] = 0.;
    if (A[0] == 0.0)
      E[0] = taubar;
    A[0] = sqrt(A[0] + E[0]);
    P[0] = 0;
    return E[0];
  }
  for (i = 0; i < n; i++) {
    P[i] = i;
    E[i] = 0.0;
  }
  for (i = 0; i < n; i++) {
    tmp = fabs(A[(((i) * ((i) + 1)) / 2 + (i))]);
    if (tmp > gamma)
      gamma = tmp;
    if (A[(((i) * ((i) + 1)) / 2 + (i))] < 0.0)
      phaseone = 0;
  }
  j = 0;
  while ((j < n) && phaseone) {
    double tmp_max = A[(((j) * ((j) + 1)) / 2 + (j))];
    double tmp_min = A[(((j) * ((j) + 1)) / 2 + (j))];
    int id = j;
    for (i = j + 1; i < n; i++) {
      if (tmp_max < A[(((i) * ((i) + 1)) / 2 + (i))]) {
        tmp_max = A[(((i) * ((i) + 1)) / 2 + (i))];
        id = i;
      }
      if (tmp_min > A[(((i) * ((i) + 1)) / 2 + (i))])
        tmp_min = A[(((i) * ((i) + 1)) / 2 + (i))];
    }
    if (tmp_max < taubar * gamma || tmp_min < -mu * tmp_max) {
      phaseone = 0;
      break;
    } else {
      if (id != j) {
        switch_row_and_colMAT(A, n, id, j);
        switch_row_and_colVEC(P, id, j);
      }
      tmp_min = 0.0;
      for (i = j + 1; i < n; i++) {
        tmp = A[(((i) * ((i) + 1)) / 2 + (i))] - A[(((i) * ((i) + 1)) / 2 + (j))] * A[(((i) * ((i) + 1)) / 2 + (j))] / A[(((j) * ((j) + 1)) / 2 + (j))];
        if (tmp_min > tmp)
          tmp_min = tmp;
      }
      if (tmp_min < -mu * gamma) {
        phaseone = 0;
        break;
      } else {
        jthIteration(A, n, j);
        j++;
      }
    }
  }
  if (!phaseone && (j == (n - 1))) {
    delta = -A[(((n - 1) * ((n - 1) + 1)) / 2 + (n - 1))] + fmax(tau * A[(((n - 1) * ((n - 1) + 1)) / 2 + (n - 1))] / (tau - 1.), taubar * gamma);
    A[(((n - 1) * ((n - 1) + 1)) / 2 + (n - 1))] += delta;
    A[(((n - 1) * ((n - 1) + 1)) / 2 + (n - 1))] = sqrt(A[(((n - 1) * ((n - 1) + 1)) / 2 + (n - 1))]);
    E[n - 1] = delta;
    deltaprev = delta;
  }
  if (!phaseone && (j < (n - 1))) {
    k = j - 1;
    for (i = k + 1; i < n; i++) {
      g[i] = A[(((i) * ((i) + 1)) / 2 + (i))];
      for (j = k + 1; j <= i - 1; j++) {
        g[i] -= fabs(A[(((i) * ((i) + 1)) / 2 + (j))]);
      }
      for (j = i + 1; j < n; j++) {
        g[i] -= fabs(A[(((j) * ((j) + 1)) / 2 + (i))]);
      }
    }
    for (j = k + 1; j < n - 2; j++) {
      int id = j;
      tmp = g[id];
      for (i = j + 1; i < n; i++) {
        if (tmp < g[i]) {
          tmp = g[i];
          id = i;
        }
      }
      if (id != j) {
        switch_row_and_colMAT(A, n, id, j);
        switch_row_and_colVEC(P, id, j);
        tmp = g[id];
        g[id] = g[j];
        g[j] = tmp;
      }
      normj = 0.;
      for (i = j + 1; i < n; i++) {
        normj += fabs(A[(((i) * ((i) + 1)) / 2 + (j))]);
      }
      delta = fmax(0.0, fmax(fmax(normj, taubar * gamma) - A[(((j) * ((j) + 1)) / 2 + (j))], deltaprev));
      if (delta > 0) {
        A[(((j) * ((j) + 1)) / 2 + (j))] += delta;
        deltaprev = delta;
        E[j] = delta;
      }
      if (A[(((j) * ((j) + 1)) / 2 + (j))] != normj) {
        tmp = 1.0 - normj / A[(((j) * ((j) + 1)) / 2 + (j))];
        for (i = j + 1; i < n; i++) {
          g[i] += fabs(A[(((i) * ((i) + 1)) / 2 + (j))]) * tmp;
        }
      }
      jthIteration(A, n, j);
    }
    tmp = sqrt((A[(((n - 2) * ((n - 2) + 1)) / 2 + (n - 2))] - A[(((n - 1) * ((n - 1) + 1)) / 2 + (n - 1))]) * (A[(((n - 2) * ((n - 2) + 1)) / 2 + (n - 2))] - A[(((n - 1) * ((n - 1) + 1)) / 2 + (n - 1))]) + 4.0 * A[(((n - 2) * ((n - 2) + 1)) / 2 + (n - 1))] * A[(((n - 2) * ((n - 2) + 1)) / 2 + (n - 1))]);
    lambda_hi = ((A[(((n - 2) * ((n - 2) + 1)) / 2 + (n - 2))] + A[(((n - 1) * ((n - 1) + 1)) / 2 + (n - 1))]) + tmp) * 0.5;
    lambda_lo = ((A[(((n - 2) * ((n - 2) + 1)) / 2 + (n - 2))] + A[(((n - 1) * ((n - 1) + 1)) / 2 + (n - 1))]) - tmp) * 0.5;
    delta = fmax(fmax(0.0, -lambda_lo + fmax(tau * (lambda_hi - lambda_lo) / (1.0 - tau), taubar * gamma)), deltaprev);
    if (delta > 0) {
      A[(((n - 2) * ((n - 2) + 1)) / 2 + (n - 2))] += delta;
      A[(((n - 1) * ((n - 1) + 1)) / 2 + (n - 1))] += delta;
      deltaprev = delta;
      E[n - 2] = delta;
      E[n - 1] = delta;
    }
    A[(((n - 2) * ((n - 2) + 1)) / 2 + (n - 2))] = sqrt(A[(((n - 2) * ((n - 2) + 1)) / 2 + (n - 2))]);
    A[(((n - 2) * ((n - 2) + 1)) / 2 + (n - 1))] /= A[(((n - 2) * ((n - 2) + 1)) / 2 + (n - 2))];
    A[(((n - 1) * ((n - 1) + 1)) / 2 + (n - 1))] = sqrt(A[(((n - 1) * ((n - 1) + 1)) / 2 + (n - 1))] - A[(((n - 2) * ((n - 2) + 1)) / 2 + (n - 1))] * A[(((n - 2) * ((n - 2) + 1)) / 2 + (n - 1))]);
  }
  return deltaprev;
}
```