user: Converte this assembly snippet into its equivalent C code:

```asm
<__emdnorm>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,%rbx
  mov    %esi,%r14d
  mov    %edx,0x8(%rsp)
  mov    %ecx,%ebp
  mov    %r8d,%r15d
  mov    %r9d,%r13d
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  movw   $0x0,0x20(%rsp)
  movw   $0x1,0x1e(%rsp)
  call   <__enormlz@plt>
  sub    %eax,%ebp
  cmp    $0x50,%eax
  setg   %r12b
  cmp    $0x7ffe,%ebp
  setle  %al
  and    %al,%r12b
  jne    L335
  test   %ebp,%ebp
  js     L308
  test   %r15d,%r15d
  je     L337
  cmp    $0x40,%r13d
  je     L276
L215:
  test   %ebp,%ebp
  setle  %r12b
  cmp    $0x50,%r13d
  setne  %al
  movl   $0x7,0xc(%rsp)
  mov    $0x8,%r15d
  and    %al,%r12b
  jne    L43
L222:
  movslq %r15d,%rax
  lea    (%rbx,%rax,2),%rdx
  movzwl (%rdx),%eax
  cmp    $0x4f,%r13d
  jg     L136
  cmp    $0x7,%r15d
  jle    L246
  jmp    L136
L335:
  mov    %rbx,%rdi
  call   <__ecleazs@plt>
  jmp    L312
L308:
  cmp    $0xffffffb0,%ebp
  jl     L152
  mov    %ebp,%esi
  mov    %rbx,%rdi
  call   <__eshift@plt>
  test   %eax,%eax
  mov    $0x1,%eax
  cmovne %eax,%r14d
  test   %r15d,%r15d
  je     L96
  cmp    $0x40,%r13d
  jne    L215
  movw   $0x0,0x1e(%rsp)
  movw   $0x1,0x1c(%rsp)
  test   %ebp,%ebp
  setle  %r12b
  movl   $0x6,0xc(%rsp)
  mov    $0x7,%r15d
L43:
  movzwl 0x10(%rbx),%eax
  and    $0x1,%eax
  or     %eax,%r14d
  mov    %rbx,%rdi
  call   <__eshdn1@plt>
  jmp    L222
L152:
  mov    %rbx,%rdi
  call   <__ecleazs@plt>
  jmp    L312
L276:
  movw   $0x0,0x1e(%rsp)
  movw   $0x1,0x1c(%rsp)
  test   %ebp,%ebp
  setle  %al
  jle    L207
  lea    0xe(%rbx),%rdx
  movzwl 0xe(%rbx),%eax
  movl   $0x6,0xc(%rsp)
L246:
  cmpw   $0x0,0x10(%rbx)
  je     L201
  or     $0x1,%eax
L201:
  movw   $0x0,0x10(%rbx)
L136:
  movw   $0x0,(%rdx)
  test   %ax,%ax
  js     L211
L145:
  test   %r12b,%r12b
  jne    L132
  cmpw   $0x0,0x4(%rbx)
  jne    L127
L337:
  movw   $0x0,0x10(%rbx)
  cmp    $0x7ffe,%ebp
  jg     L66
L332:
  test   %ebp,%ebp
  mov    $0x0,%eax
  cmovns %ebp,%eax
  mov    %ax,0x2(%rbx)
L312:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L331
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L207:
  mov    %eax,%r12d
  movl   $0x6,0xc(%rsp)
  mov    $0x7,%r15d
  jmp    L43
L211:
  cmp    $0x8000,%ax
  jne    L319
  test   %r14d,%r14d
  jne    L6
  movslq 0xc(%rsp),%rax
  testb  $0x1,(%rbx,%rax,2)
  je     L145
L319:
  lea    0x10(%rsp),%rdi
  mov    %rbx,%rsi
  call   <__eaddm@plt>
  jmp    L145
L6:
  cmpl   $0x0,0x8(%rsp)
  je     L319
  jmp    L145
L132:
  mov    %rbx,%rdi
  call   <__eshup1@plt>
  cmpw   $0x0,0x4(%rbx)
  jne    L127
  movw   $0x0,0x10(%rbx)
  jmp    L332
L127:
  mov    %rbx,%rdi
  call   <__eshdn1@plt>
  add    $0x1,%ebp
  jmp    L337
L66:
  movw   $0x7fff,0x2(%rbx)
  lea    0x4(%rbx),%rax
  add    $0x10,%rbx
L239:
  movw   $0x0,(%rax)
  add    $0x2,%rax
  cmp    %rax,%rbx
  jne    L239
  jmp    L312
L96:
  movw   $0x0,0x10(%rbx)
  jmp    L332
L331:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void __emdnorm(short unsigned int *s, int lost, int subflg, int expo, int rcntrl, int rndprc) {
  int i, j;
  unsigned short r;
  int rw = (6 + 3) - 1;
  int re = (6 + 3) - 2;
  const unsigned short rmsk = 0xffff;
  const unsigned short rmbit = 0x8000;
  unsigned short rbit[(6 + 3)] = {0, 0, 0, 0, 0, 0, 0, 1, 0};
  j = __enormlz(s);
  expo -= j;
  if ((j > (((6 + 3) - 4) * 16)) && (expo < 32767)) {
    __ecleazs(s);
    return;
  }
  if (expo < 0) {
    if (expo > (-(((6 + 3) - 4) * 16) - 1)) {
      j = expo;
      i = __eshift(s, j);
      if (i)
        lost = 1;
    } else {
      __ecleazs(s);
      return;
    }
  }
  if (rcntrl == 0)
    goto mdfin;
  if (rndprc == 64) {
    rw = 7;
    re = 6;
    rbit[(6 + 3) - 2] = 0;
    rbit[6] = 1;
  }
  if ((expo <= 0) && (rndprc != (((6 + 3) - 4) * 16))) {
    lost |= s[(6 + 3) - 1] & 1;
    __eshdn1(s);
  }
  r = s[rw] & rmsk;
  if (rndprc < (((6 + 3) - 4) * 16)) {
    i = rw + 1;
    while (i < (6 + 3)) {
      if (s[i])
        r |= 1;
      s[i] = 0;
      ++i;
    }
  }
  s[rw] &= (rmsk ^ 0xffff);
  if ((r & rmbit) != 0) {
    if (r == rmbit) {
      if (lost == 0) {
        if ((s[re] & 1) == 0)
          goto mddone;
      } else {
        if (subflg != 0)
          goto mddone;
      }
    }
    __eaddm(rbit, s);
  }
mddone:
  if ((expo <= 0) && (rndprc != (((6 + 3) - 4) * 16))) {
    __eshup1(s);
  }
  if (s[2] != 0) {
    __eshdn1(s);
    expo += 1;
  }
mdfin:
  s[(6 + 3) - 1] = 0;
  if (expo >= 32767) {
    s[1] = 32767;
    for (i = 2; i < (6 + 3) - 1; i++)
      s[i] = 0;
    return;
  }
  if (expo < 0)
    s[1] = 0;
  else
    s[1] = (unsigned short)expo;
}
```