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

```asm
<BtFLZH_EncBalanceTree_r>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  mov    %ecx,-0x38(%rbp)
  mov    %r8d,-0x3c(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jns    L90
  mov    $0x0,%eax
  jmp    L123
L90:
  mov    -0x38(%rbp),%eax
  lea    0x1(%rax),%ecx
  mov    -0x34(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    -0x3c(%rbp),%edi
  mov    -0x30(%rbp),%rsi
  mov    -0x28(%rbp),%rax
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <BtFLZH_EncBalanceTree_r>
  mov    %eax,-0x18(%rbp)
  mov    -0x38(%rbp),%eax
  lea    0x1(%rax),%ecx
  mov    -0x34(%rbp),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    -0x3c(%rbp),%edi
  mov    -0x30(%rbp),%rsi
  mov    -0x28(%rbp),%rax
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <BtFLZH_EncBalanceTree_r>
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%edx
  mov    -0x18(%rbp),%eax
  cmp    %eax,%edx
  cmovge %edx,%eax
  add    $0x1,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    -0x10(%rbp),%edx
  mov    %dx,(%rax)
  mov    -0x38(%rbp),%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cmp    %eax,-0x3c(%rbp)
  jl     L145
  mov    -0x10(%rbp),%eax
  jmp    L123
L145:
  mov    -0x18(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x14(%rbp)
  jle    L52
  mov    -0x34(%rbp),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cwtl
  mov    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cwtl
  mov    %eax,-0xc(%rbp)
  mov    -0x1c(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    -0x1c(%rbp),%edx
  add    %edx,%edx
  movslq %edx,%rdx
  add    $0x1,%rdx
  lea    (%rdx,%rdx,1),%rcx
  mov    -0x28(%rbp),%rdx
  add    %rcx,%rdx
  movzwl (%rax),%eax
  mov    %ax,(%rdx)
  mov    -0x34(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    -0x1c(%rbp),%edx
  add    %edx,%edx
  movslq %edx,%rdx
  lea    (%rdx,%rdx,1),%rcx
  mov    -0x28(%rbp),%rdx
  add    %rcx,%rdx
  movzwl (%rax),%eax
  mov    %ax,(%rdx)
  mov    -0x34(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    -0x1c(%rbp),%edx
  mov    %dx,(%rax)
  mov    -0x34(%rbp),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    -0xc(%rbp),%edx
  mov    %dx,(%rax)
  jmp    L67
L52:
  mov    -0x14(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x18(%rbp)
  jle    L155
  mov    -0x34(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cwtl
  mov    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cwtl
  mov    %eax,-0xc(%rbp)
  mov    -0x1c(%rbp),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    -0x1c(%rbp),%edx
  add    %edx,%edx
  movslq %edx,%rdx
  lea    (%rdx,%rdx,1),%rcx
  mov    -0x28(%rbp),%rdx
  add    %rcx,%rdx
  movzwl (%rax),%eax
  mov    %ax,(%rdx)
  mov    -0x34(%rbp),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    -0x1c(%rbp),%edx
  add    %edx,%edx
  movslq %edx,%rdx
  add    $0x1,%rdx
  lea    (%rdx,%rdx,1),%rcx
  mov    -0x28(%rbp),%rdx
  add    %rcx,%rdx
  movzwl (%rax),%eax
  mov    %ax,(%rdx)
  mov    -0x34(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    -0xc(%rbp),%edx
  mov    %dx,(%rax)
  mov    -0x34(%rbp),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    -0x1c(%rbp),%edx
  mov    %dx,(%rax)
  jmp    L67
L155:
  mov    -0x10(%rbp),%eax
  jmp    L123
L67:
  mov    -0x1c(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cwtl
  mov    %eax,-0xc(%rbp)
  mov    -0x1c(%rbp),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cwtl
  mov    %eax,-0x8(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  js     L117
  mov    -0xc(%rbp),%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cwtl
  jmp    L105
L117:
  mov    $0x0,%eax
L105:
  mov    %eax,-0x18(%rbp)
  cmpl   $0x0,-0x8(%rbp)
  js     L42
  mov    -0x8(%rbp),%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cwtl
  jmp    L131
L42:
  mov    $0x0,%eax
L131:
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%edx
  mov    -0x18(%rbp),%eax
  cmp    %eax,%edx
  cmovge %edx,%eax
  add    $0x1,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    -0x4(%rbp),%edx
  mov    %dx,(%rax)
  mov    -0x34(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cwtl
  mov    %eax,-0xc(%rbp)
  mov    -0x34(%rbp),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cwtl
  mov    %eax,-0x8(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  js     L111
  mov    -0xc(%rbp),%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cwtl
  jmp    L48
L111:
  mov    $0x0,%eax
L48:
  mov    %eax,-0x18(%rbp)
  cmpl   $0x0,-0x8(%rbp)
  js     L112
  mov    -0x8(%rbp),%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cwtl
  jmp    L24
L112:
  mov    $0x0,%eax
L24:
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%edx
  mov    -0x18(%rbp),%eax
  cmp    %eax,%edx
  cmovge %edx,%eax
  add    $0x1,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    -0x10(%rbp),%edx
  mov    %dx,(%rax)
  mov    -0x10(%rbp),%eax
L123:
  leave
  ret
```

assistant: ```c
int BtFLZH_EncBalanceTree_r(short *nodes, short *nlen, int root, int h, int ml) {
  int h0, h1, h2, h3;
  int l0, l1, l2;
  if (root < 0) {
    return (0);
  }
  h1 = BtFLZH_EncBalanceTree_r(nodes, nlen, nodes[root * 2 + 0], h + 1, ml);
  h2 = BtFLZH_EncBalanceTree_r(nodes, nlen, nodes[root * 2 + 1], h + 1, ml);
  h0 = ((h1 > h2) ? h1 : h2) + 1;
  nlen[root] = h0;
  if ((h + h0) <= ml) {
    return (h0);
  }
  if ((h1 + 1) < h2) {
    l0 = nodes[root * 2 + 1];
    l1 = nodes[l0 * 2 + 1];
    nodes[l0 * 2 + 1] = nodes[l0 * 2 + 0];
    nodes[l0 * 2 + 0] = nodes[root * 2 + 0];
    nodes[root * 2 + 0] = l0;
    nodes[root * 2 + 1] = l1;
  } else if ((h2 + 1) < h1) {
    l0 = nodes[root * 2 + 0];
    l1 = nodes[l0 * 2 + 0];
    nodes[l0 * 2 + 0] = nodes[l0 * 2 + 1];
    nodes[l0 * 2 + 1] = nodes[root * 2 + 1];
    nodes[root * 2 + 0] = l1;
    nodes[root * 2 + 1] = l0;
  } else {
    return (h0);
  }
  l1 = nodes[l0 * 2 + 0];
  l2 = nodes[l0 * 2 + 1];
  h1 = (l1 < 0) ? 0 : nlen[l1];
  h2 = (l2 < 0) ? 0 : nlen[l2];
  h3 = ((h1 > h2) ? h1 : h2) + 1;
  nlen[l0] = h3;
  l1 = nodes[root * 2 + 0];
  l2 = nodes[root * 2 + 1];
  h1 = (l1 < 0) ? 0 : nlen[l1];
  h2 = (l2 < 0) ? 0 : nlen[l2];
  h0 = ((h1 > h2) ? h1 : h2) + 1;
  nlen[root] = h0;
  return (h0);
}
```