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

```asm
<nextch>:
  endbr64
  cmp    $0x1,%esi
  ja     L13
  test   %rdi,%rdi
  je     L124
  movslq %esi,%rsi
  lea    D92(%rip),%rax
  mov    $0x1,%r8d
  mov    %rdi,(%rax,%rsi,8)
  lea    D56(%rip),%rax
  movl   $0x0,(%rax,%rsi,4)
L173:
  mov    %r8d,%eax
  ret
  nopl   0x0(%rax,%rax,1)
L124:
  movslq %esi,%r9
  lea    D92(%rip),%rax
  mov    (%rax,%r9,8),%rdi
  test   %rdi,%rdi
  je     L13
  lea    D56(%rip),%r10
  mov    (%r10,%r9,4),%ecx
  test   %ecx,%ecx
  je     L232
  movslq %ecx,%rax
  movzbl (%rdi,%rax,1),%r8d
  cmp    $0x2d,%r8b
  je     L143
L54:
  cmp    $0x5c,%r8b
  je     L0
  test   %r8b,%r8b
  je     L182
L44:
  add    $0x1,%ecx
  lea    D22(%rip),%rax
  mov    %r8b,(%rax,%r9,1)
  movslq %ecx,%rax
  mov    %ecx,(%r10,%r9,4)
  cmpb   $0x2d,(%rdi,%rax,1)
  jne    L173
  push   %rbx
  movsbl %r8b,%r11d
  lea    D20(%rip),%rbx
  cs nopw 0x0(%rax,%rax,1)
L175:
  lea    0x1(%rcx),%edx
  mov    $0x1,%esi
  movslq %edx,%rdx
  movsbl (%rdi,%rdx,1),%eax
  cmp    $0x5c,%al
  jne    L224
  lea    0x2(%rcx),%edx
  mov    $0x2,%esi
  movslq %edx,%rdx
  movsbl (%rdi,%rdx,1),%eax
L224:
  test   %al,%al
  je     L223
  cmpb   $0x2d,0x1(%rdi,%rdx,1)
  je     L183
  sub    %r11d,%eax
  test   %eax,%eax
  je     L213
  lea    D20(%rip),%rax
  jg     L134
  movl   $0xffffffff,(%rax,%r9,4)
L35:
  mov    %r8d,%eax
  pop    %rbx
  ret
  xchg   %ax,%ax
L232:
  cmpb   $0x2d,(%rdi)
  je     L13
  movzbl (%rdi),%r8d
  jmp    L54
  nopw   0x0(%rax,%rax,1)
L223:
  xor    %r8d,%r8d
  pop    %rbx
  mov    %r8d,%eax
  ret
L213:
  movl   $0x0,(%rbx,%r9,4)
  add    $0x2,%ecx
L166:
  movslq %ecx,%rax
  mov    %ecx,(%r10,%r9,4)
  cmpb   $0x2d,(%rdi,%rax,1)
  je     L175
  jmp    L35
  xchg   %ax,%ax
L183:
  lea    0x1(%rsi,%rcx,1),%ecx
  jmp    L166
  cs nopw 0x0(%rax,%rax,1)
L143:
  lea    D22(%rip),%rdx
  lea    D20(%rip),%rsi
  movzbl (%rdx,%r9,1),%r8d
  add    (%rsi,%r9,4),%r8b
  mov    %r8b,(%rdx,%r9,1)
  cmp    0x1(%rdi,%rax,1),%r8b
  jne    L173
  add    $0x2,%ecx
  mov    %ecx,(%r10,%r9,4)
  jmp    L173
  nopw   0x0(%rax,%rax,1)
L0:
  add    $0x1,%ecx
  movslq %ecx,%rax
  mov    %ecx,(%r10,%r9,4)
  movzbl (%rdi,%rax,1),%r8d
  jmp    L44
  nopl   0x0(%rax)
L182:
  movzbl D12(%rip),%r8d
  test   %esi,%esi
  jne    L173
L13:
  xor    %r8d,%r8d
  jmp    L173
  nopl   0x0(%rax,%rax,1)
L134:
  movl   $0x1,(%rax,%r9,4)
  jmp    L35
```

assistant: ```c
char nextch(str, who)
char *str;
int who;
{
  static char *what[2] = {0, 0};
  static char last[2] = {0, 0};
  static int increment[2];
  static int pos[2];
  if (who < 0 || who > 1) {
    return 0;
  }
  if (str) {
    what[who] = str;
    pos[who] = 0;
    return 1;
  } else if (!what[who]) {
    return 0;
  }
  if (!pos[who] && what[who][0] == '-') {
    return 0;
  }
  switch (what[who][pos[who]]) {
  case '-': {
    last[who] += increment[who];
    if (what[who][pos[who] + 1] == last[who]) {
      pos[who] += 2;
    }
    return last[who];
  }
  case '\0': {
    if (who) {
      return last[1];
    }
    return 0;
  }
  case '\\': {
    pos[who]++;
  }
  default: {
    last[who] = what[who][pos[who]++];
    while (what[who][pos[who]] == '-') {
      int inc = 1;
      if (what[who][pos[who] + inc] == '\\') {
        inc++;
      }
      if (!what[who][pos[who] + inc]) {
        return 0;
      }
      if (what[who][pos[who] + inc + 1] == '-') {
        pos[who] += inc + 1;
        continue;
      }
      increment[who] = what[who][pos[who] + inc] - last[who];
      if (!increment[who]) {
        pos[who] += 2;
        continue;
      }
      if (increment[who] > 0) {
        increment[who] = 1;
        break;
      } else if (increment[who] < 0) {
        increment[who] = -1;
        break;
      }
    }
    return last[who];
  }
  }
}
```