user: Please show me the C implementation that matches the assembly code listed below:

```asm
<__emdnorm>:
  endbr64
  push   %r15
  pxor   %xmm0,%xmm0
  xor    %r10d,%r10d
  mov    $0x1,%r11d
  push   %r14
  mov    %edx,%r15d
  mov    %r8d,%r14d
  push   %r13
  mov    %esi,%r13d
  push   %r12
  mov    %r9d,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %ecx,%ebx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movaps %xmm0,(%rsp)
  mov    %r10w,0x10(%rsp)
  mov    %r11w,0xe(%rsp)
  call   <__enormlz@plt>
  sub    %eax,%ebx
  cmp    $0x50,%eax
  jle    L95
  cmp    $0x7ffe,%ebx
  jle    L56
L95:
  test   %ebx,%ebx
  js     L194
  test   %r14d,%r14d
  je     L263
  cmp    $0x50,%r12d
  setne  %r14b
  test   %ebx,%ebx
  setle  %al
  and    %eax,%r14d
  cmp    $0x40,%r12d
  je     L270
L46:
  movzwl 0x10(%rbp),%eax
  test   %r14b,%r14b
  jne    L36
  xor    %edx,%edx
  mov    %dx,0x10(%rbp)
  test   %ax,%ax
  js     L299
L89:
  cmpw   $0x0,0x4(%rbp)
  jne    L83
L263:
  xor    %edi,%edi
  mov    %di,0x10(%rbp)
  cmp    $0x7ffe,%ebx
  jg     L151
L162:
  xor    %eax,%eax
  test   %ebx,%ebx
  cmovns %ebx,%eax
  mov    %ax,0x2(%rbp)
  jmp    L241
  nopl   0x0(%rax)
L194:
  cmp    $0xffffffb0,%ebx
  jl     L56
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <__eshift@plt>
  test   %eax,%eax
  mov    $0x1,%eax
  cmovne %eax,%r13d
  test   %r14d,%r14d
  je     L32
  cmp    $0x50,%r12d
  setne  %r14b
  cmp    $0x40,%r12d
  jne    L46
  movl   $0x1,0xc(%rsp)
L248:
  movzwl 0x10(%rbp),%eax
  mov    %rbp,%rdi
  and    $0x1,%eax
  or     %eax,%r13d
  call   <__eshdn1@plt>
  jmp    L17
  nopl   0x0(%rax,%rax,1)
L56:
  mov    %rbp,%rdi
  call   <__ecleazs@plt>
L241:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L15
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L151:
  mov    $0x7fff,%esi
  movq   $0x0,0x4(%rbp)
  mov    %si,0x2(%rbp)
  movl   $0x0,0xc(%rbp)
  jmp    L241
  nopw   0x0(%rax,%rax,1)
L299:
  mov    $0x7,%ecx
L247:
  cmp    $0x8000,%ax
  jne    L94
  test   %r13d,%r13d
  jne    L131
  testb  $0x1,0x0(%rbp,%rcx,2)
  je     L254
L94:
  mov    %rsp,%rdi
  mov    %rbp,%rsi
  call   <__eaddm@plt>
L254:
  test   %r14b,%r14b
  je     L89
  mov    %rbp,%rdi
  call   <__eshup1@plt>
  cmpw   $0x0,0x4(%rbp)
  jne    L83
L32:
  xor    %ecx,%ecx
  mov    %cx,0x10(%rbp)
  jmp    L162
  nopl   0x0(%rax)
L83:
  mov    %rbp,%rdi
  add    $0x1,%ebx
  call   <__eshdn1@plt>
  jmp    L263
L270:
  movl   $0x1,0xc(%rsp)
  test   %r14b,%r14b
  jne    L248
L17:
  cmpw   $0x0,0x10(%rbp)
  movzwl 0xe(%rbp),%eax
  lea    0xe(%rbp),%rdx
  mov    $0x6,%ecx
  je     L38
  or     $0x1,%eax
L38:
  xor    %r9d,%r9d
  mov    %r9w,0x10(%rbp)
L184:
  xor    %r8d,%r8d
  mov    %r8w,(%rdx)
  test   %ax,%ax
  jns    L254
  jmp    L247
  nopl   0x0(%rax)
L36:
  and    $0x1,%eax
  mov    %rbp,%rdi
  or     %eax,%r13d
  call   <__eshdn1@plt>
  movzwl 0x10(%rbp),%eax
  lea    0x10(%rbp),%rdx
  mov    $0x7,%ecx
  jmp    L184
  nopl   (%rax)
L131:
  test   %r15d,%r15d
  je     L94
  jmp    L254
L15:
  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;
}
```