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

```asm
<devanagari_log2vis>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  mov    %edx,%ebx
  sub    $0x38,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %rsp,%rcx
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  movslq %edx,%rax
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L152
L154:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L154
L152:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L28
L298:
  lea    -0x1(%rbx),%eax
  mov    %rsp,%r12
  mov    %eax,-0x54(%rbp)
  test   %ebx,%ebx
  jle    L9
  mov    %r12,%r15
  xor    %r14d,%r14d
  jmp    L249
  nopl   0x0(%rax)
L90:
  add    $0x1,%r14d
  mov    %r13d,-0x4(%r15)
  cmp    %r14d,%ebx
  jle    L418
L249:
  movslq %r14d,%rax
  add    $0x4,%r15
  lea    0x0(,%rax,4),%rsi
  mov    %rsi,-0x50(%rbp)
  mov    -0x48(%rbp),%rsi
  mov    (%rsi,%rax,4),%r13d
  mov    %r13d,%edi
  call   <is_consonant@plt>
  cmp    %r14d,-0x54(%rbp)
  jle    L90
  test   %rax,%rax
  je     L90
  mov    -0x48(%rbp),%rax
  mov    -0x50(%rbp),%rsi
  cmpl   $0x94d,0x4(%rax,%rsi,1)
  jne    L90
  add    $0x1,%r14d
  add    $0x10000,%r13d
  add    $0x1,%r14d
  mov    %r13d,-0x4(%r15)
  cmp    %r14d,%ebx
  jg     L249
  nopl   (%rax)
L418:
  mov    -0x54(%rbp),%eax
  test   %eax,%eax
  jle    L278
L224:
  lea    0x4(%r12),%r14
  mov    $0x2,%r15d
  jmp    L111
  nopl   0x0(%rax,%rax,1)
L14:
  mov    %r13d,%edi
  call   <is_dead_consonant@plt>
  test   %rax,%rax
  je     L398
  cmpl   $0x930,(%r14)
  je     L157
L398:
  mov    %r13d,%edi
  call   <is_dead_consonant@plt>
  test   %rax,%rax
  je     L430
  cmpl   $0x10930,(%r14)
  jne    L430
  lea    -0x10000(%r13),%ecx
  movslq %r15d,%rax
  movl   $0xe97f,(%r14)
  mov    %ecx,-0x4(%r14)
  movl   $0x94d,(%r12,%rax,4)
  nopl   (%rax)
L430:
  lea    0x1(%r15),%eax
  add    $0x4,%r14
  cmp    %r15d,%ebx
  je     L434
L103:
  mov    %eax,%r15d
L111:
  mov    -0x4(%r14),%r13d
  cmp    $0x10930,%r13d
  je     L160
  cmp    $0x931,%r13d
  jne    L14
  cmpl   $0x94d,(%r14)
  jne    L14
L225:
  movl   $0xe97d,-0x4(%r14)
  lea    0x1(%r15),%eax
  add    $0x4,%r14
  movl   $0x0,-0x4(%r14)
  cmp    %r15d,%ebx
  jne    L103
L434:
  lea    -0x2(%rbx),%r13d
  xor    %r15d,%r15d
  mov    %r13d,-0x50(%rbp)
  jmp    L353
  nopl   0x0(%rax)
L337:
  mov    %rax,%r15
L353:
  mov    (%r12,%r15,4),%r14d
  mov    %r14d,%edi
  call   <is_dead_consonant@plt>
  test   %rax,%rax
  je     L63
  cmp    %r15d,-0x50(%rbp)
  je     L54
  mov    0x4(%r12,%r15,4),%edi
  cmp    $0x200d,%edi
  je     L54
  mov    %edi,-0x54(%rbp)
  call   <is_consonant@plt>
  mov    -0x54(%rbp),%edi
  test   %rax,%rax
  je     L95
L54:
  lea    -0x1e000(%r14),%ecx
  mov    %ecx,(%r12,%r15,4)
L63:
  lea    0x1(%r15),%rax
  cmp    %r15,%r13
  jne    L337
  test   %ebx,%ebx
  jle    L411
L278:
  mov    %ebx,%ebx
  xor    %eax,%eax
  xor    %r8d,%r8d
  jmp    L306
  nopl   0x0(%rax,%rax,1)
L392:
  mov    -0x60(%rbp),%rdi
  mov    -0x48(%rbp),%rsi
  movslq %r8d,%rcx
  mov    %r8d,(%rdi,%rax,4)
  add    $0x1,%rax
  add    $0x1,%r8d
  mov    %edx,(%rsi,%rcx,4)
  cmp    %rbx,%rax
  je     L4
L306:
  mov    (%r12,%rax,4),%edx
  test   %edx,%edx
  jne    L392
  lea    -0x1(%r8),%edx
  xor    %ecx,%ecx
  test   %edx,%edx
  cmovs  %ecx,%edx
  mov    -0x60(%rbp),%rcx
  mov    %edx,(%rcx,%rax,4)
  add    $0x1,%rax
  cmp    %rbx,%rax
  jne    L306
L4:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L113
  lea    -0x28(%rbp),%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L160:
  mov    (%r14),%esi
  mov    %esi,%edi
  mov    %esi,-0x50(%rbp)
  call   <is_ind_vowel@plt>
  mov    -0x50(%rbp),%esi
  test   %rax,%rax
  je     L300
L327:
  mov    %esi,-0x4(%r14)
  movl   $0xe97e,(%r14)
  jmp    L430
  nopl   (%rax)
L157:
  lea    -0x10000(%r13),%ecx
  movl   $0xe97f,(%r14)
  mov    %ecx,-0x4(%r14)
  jmp    L430
  nop
L300:
  mov    %esi,%edi
  mov    %esi,-0x50(%rbp)
  call   <is_consonant@plt>
  mov    -0x50(%rbp),%esi
  test   %rax,%rax
  jne    L327
  cmp    $0x200d,%esi
  jne    L14
  jmp    L225
  nopl   0x0(%rax,%rax,1)
L95:
  call   <is_dead_consonant@plt>
  test   %rax,%rax
  jne    L54
  jmp    L63
  nopl   0x0(%rax,%rax,1)
L28:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L298
L9:
  mov    -0x54(%rbp),%edx
  test   %edx,%edx
  jg     L224
  cs nopw 0x0(%rax,%rax,1)
L411:
  xor    %r8d,%r8d
  jmp    L4
L113:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int devanagari_log2vis(unsigned int *str, unsigned int *ctog, int len) {
  int i, len1, cc, j, k, c;
  unsigned int *q, buf[len];
  q = buf;
  len1 = len - 1;
  for (i = 0; i < len; i++) {
    cc = str[i];
    if (is_consonant(cc) && i < len1 && str[i + 1] == 0x94d) {
      *q++ = cc + 0x10000;
      i++;
    } else {
      *q++ = cc;
    }
  }
  for (i = 0; i < len1; i++) {
    if (buf[i] == (0x930 + 0x10000) && (is_ind_vowel(buf[i + 1]) || is_consonant(buf[i + 1]))) {
      buf[i] = buf[i + 1];
      buf[i + 1] = 0xe97e;
    } else if (buf[i] == 0x931 && buf[i + 1] == 0x94d) {
      buf[i] = 0xe97d;
      buf[i + 1] = 0;
    } else if (buf[i] == (0x930 + 0x10000) && buf[i + 1] == 0x200d) {
      buf[i] = 0xe97d;
      buf[i + 1] = 0;
    } else if (is_dead_consonant(buf[i]) && buf[i + 1] == 0x930) {
      buf[i] -= 0x10000;
      buf[i + 1] = 0xe97f;
    } else if (is_dead_consonant(buf[i]) && buf[i + 1] == (0x930 + 0x10000)) {
      buf[i] -= 0x10000;
      buf[i + 1] = 0xe97f;
      buf[i + 2] = 0x94d;
    }
  }
  for (i = 0; i < len1; i++) {
    if (is_dead_consonant(buf[i]) && (i == (len1 - 1) || buf[i + 1] == 0x200d || is_consonant(buf[i + 1]) || is_dead_consonant(buf[i + 1]))) {
      buf[i] -= 0x10000 + 0xe000;
    }
  }
  j = 0;
  for (i = 0; i < len; i++) {
    c = buf[i];
    if (c != 0) {
      ctog[i] = j;
      str[j++] = c;
    } else {
      k = j - 1;
      if (k < 0)
        k = 0;
      ctog[i] = k;
    }
  }
  return j;
}
```