user: Demonstrate the C code that generates the assembly output below:

```asm
<_renormalize_transition_matrix>:
  endbr64
  test   %esi,%esi
  jle    L73
  push   %r15
  movslq %esi,%rax
  mov    %esi,%r9d
  xor    %ecx,%ecx
  push   %r14
  shl    $0x3,%rax
  and    $0xfffffffe,%r9d
  lea    -0x1(%rsi),%r14d
  push   %r13
  mov    %ecx,%r15d
  mov    %rdx,%r13
  pxor   %xmm1,%xmm1
  push   %r12
  xor    %r12d,%r12d
  mov    %rdi,%rcx
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %r9d,%ebx
  sub    $0x48,%rsp
  mov    %rax,0x28(%rsp)
  mov    %esi,%eax
  shr    %eax
  mov    %rdi,0x38(%rsp)
  lea    -0x1(%rax),%r8d
  mov    %r9d,%eax
  lea    (%rdx,%rax,8),%r11
  mov    %esi,%eax
  add    $0x1,%r8
  mov    %r14d,%edx
  mov    %rax,0x30(%rsp)
  shl    $0x4,%r8
  mov    %r8,%r14
  mov    %r12d,%r8d
  mov    %esi,%r12d
  nopl   0x0(%rax,%rax,1)
L84:
  cmp    $0x2,%edx
  jbe    L24
  lea    0x8(%rbp),%rsi
  xor    %eax,%eax
  cmp    %rsi,%r13
  je     L24
  nopl   0x0(%rax,%rax,1)
L13:
  movupd 0x0(%rbp,%rax,1),%xmm3
  movups %xmm3,0x0(%r13,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%r14
  jne    L13
  cmp    %ebx,%r12d
  je     L85
  lea    (%r15,%rbx,1),%eax
  cltq
  movsd  (%rcx,%rax,8),%xmm0
  movsd  %xmm0,(%r11)
L85:
  xor    %esi,%esi
  mov    %r13,%rdi
  mov    %rcx,0x20(%rsp)
  add    %r12d,%r15d
  mov    %r11,0x18(%rsp)
  mov    %r8d,0x14(%rsp)
  mov    %edx,(%rsp)
  movsd  %xmm1,0x8(%rsp)
  call   <_mixed_sort@plt>
  mov    %r12d,%esi
  mov    %r13,%rdi
  call   <_kahan_summation@plt>
  mov    0x14(%rsp),%r8d
  movsd  0x8(%rsp),%xmm1
  add    0x28(%rsp),%rbp
  mov    (%rsp),%edx
  add    $0x1,%r8d
  maxsd  %xmm0,%xmm1
  mov    0x18(%rsp),%r11
  mov    0x20(%rsp),%rcx
  cmp    %r8d,%r12d
  jne    L84
  pxor   %xmm4,%xmm4
  mov    %edx,%r14d
  comisd %xmm1,%xmm4
  jae    L113
  mov    0x28(%rsp),%rax
  mov    %r8d,0x14(%rsp)
  mov    %r13,%r12
  mov    %r8d,%ebp
  mov    0x38(%rsp),%rbx
  xor    %r15d,%r15d
  mov    %rcx,%r13
  add    $0x8,%rax
  mov    %rax,0x8(%rsp)
  nopl   (%rax)
L119:
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L72:
  movsd  0x0(%r13,%rax,8),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x0(%r13,%rax,8)
  cmp    %r15d,%eax
  je     L4
  add    $0x1,%rax
  movsd  %xmm0,(%r12,%r15,8)
  cmp    %rax,%rbp
  jne    L72
L34:
  xor    %esi,%esi
  mov    %r14d,%edx
  mov    %r12,%rdi
  movsd  %xmm1,(%rsp)
  call   <_mixed_sort@plt>
  mov    0x14(%rsp),%esi
  mov    %r12,%rdi
  add    $0x1,%r15
  call   <_kahan_summation@plt>
  add    0x28(%rsp),%r13
  movsd  (%rsp),%xmm1
  movapd %xmm0,%xmm2
  movsd  D2(%rip),%xmm0
  subsd  %xmm2,%xmm0
  movsd  %xmm0,(%rbx)
  add    0x8(%rsp),%rbx
  cmp    %r15,%rbp
  jne    L119
L113:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L4:
  add    $0x1,%rax
  movq   $0x0,(%r12,%r15,8)
  cmp    %rax,%rbp
  jne    L72
  jmp    L34
  nopw   0x0(%rax,%rax,1)
L24:
  mov    0x30(%rsp),%rsi
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L18:
  movsd  0x0(%rbp,%rax,8),%xmm0
  movsd  %xmm0,0x0(%r13,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rsi
  jne    L18
  jmp    L85
L73:
  ret
```

tool_calls: name: parse_data
arguments: tag: D2
datatype: f64

tool: D2: 1

assistant: ```c
extern void _renormalize_transition_matrix(double *p, int n_conf_states, double *scratch_M) {
  int i, j;
  double sum, max_sum = 0.0;
  for (i = 0; i < n_conf_states; ++i) {
    for (j = 0; j < n_conf_states; ++j)
      scratch_M[j] = p[i * n_conf_states + j];
    _mixed_sort(scratch_M, 0, n_conf_states - 1);
    sum = _kahan_summation(scratch_M, n_conf_states);
    max_sum = (max_sum > sum) ? max_sum : sum;
  }
  if (0.0 >= max_sum)
    return;
  for (i = 0; i < n_conf_states; ++i) {
    for (j = 0; j < n_conf_states; ++j) {
      p[i * n_conf_states + j] /= max_sum;
      if (i == j)
        scratch_M[i] = 0.0;
      else
        scratch_M[i] = p[i * n_conf_states + j];
    }
    _mixed_sort(scratch_M, 0, n_conf_states - 1);
    p[i * n_conf_states + i] = 1.0 - _kahan_summation(scratch_M, n_conf_states);
  }
}
```