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

```asm
<Z80_Index_GetOpcodeCountForInstruction>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  call   <Z80_RD_MEM@plt>
  cmp    $0xdd,%al
  je     L72
  mov    %eax,%ebx
  ja     L63
  mov    $0x4,%eax
  cmp    $0xcb,%bl
  jne    L14
L147:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L63:
  mov    %eax,%edx
  mov    $0x1,%eax
  and    $0xffffffef,%edx
  cmp    $0xed,%dl
  je     L147
L244:
  mov    %ebx,%edx
  and    $0x7,%edx
  cmp    $0x3,%dl
  je     L13
  cmp    $0x5,%dl
  je     L78
  mov    $0x1,%eax
  cmp    $0x1,%dl
  jne    L147
  test   $0x8,%bl
  je     L365
  and    $0xffffffef,%ebx
  cmp    $0xe9,%bl
  sete   %al
L165:
  movzbl %al,%eax
  add    $0x1,%eax
  jmp    L147
L40:
  cmp    $0xc0,%al
  je     L244
L72:
  pop    %rbx
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  ret
L14:
  mov    %ebx,%eax
  and    $0xffffffc0,%eax
  cmp    $0x80,%al
  je     L217
  ja     L40
  test   %al,%al
  je     L75
  cmp    $0x40,%al
  jne    L72
  cmp    $0x76,%bl
  je     L72
  mov    %ebx,%ebp
  mov    %ebx,%r12d
  shr    $0x3,%bpl
  and    $0x7,%r12d
  and    $0x7,%ebp
  mov    %ebp,%edi
  call   <Diss_Index_IsReg8Bit@plt>
  test   %eax,%eax
  jne    L21
  mov    %r12d,%edi
  call   <Diss_Index_IsReg8Bit@plt>
  test   %eax,%eax
  je     L72
L21:
  mov    %ebp,%edi
  call   <Diss_Index_Get8BitRegCount@plt>
  mov    %r12d,%edi
  mov    %eax,%ebp
  call   <Diss_Index_Get8BitRegCount@plt>
  cmp    %al,%bpl
  jb     L165
  movzbl %bpl,%eax
  add    $0x1,%eax
  jmp    L147
  nopl   0x0(%rax)
L217:
  mov    %ebx,%ebp
  and    $0x7,%ebp
  mov    %ebp,%edi
  call   <Diss_Index_IsReg8Bit@plt>
  test   %eax,%eax
  je     L72
  jmp    L3
  xchg   %ax,%ax
L75:
  mov    %ebx,%eax
  and    $0x7,%eax
  cmp    $0x6,%al
  ja     L72
  lea    D5(%rip),%rdx
  movzbl %al,%eax
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  nopl   0x0(%rax)
L78:
  test   $0x8,%bl
  jne    L72
L365:
  shr    $0x4,%bl
  mov    %ebx,%edi
  and    $0x3,%edi
  call   <Diss_Index_IsRegIndex@plt>
  test   %eax,%eax
  je     L72
L309:
  mov    $0x2,%eax
  jmp    L147
  shr    $0x3,%bl
  movzbl %bl,%ebp
  mov    %ebp,%edi
  call   <Diss_Index_IsReg8Bit@plt>
  test   %eax,%eax
  je     L72
  nopl   (%rax)
L3:
  mov    %ebp,%edi
  call   <Diss_Index_Get8BitRegCount@plt>
  movzbl %al,%eax
  add    $0x1,%eax
  jmp    L147
  nopw   0x0(%rax,%rax,1)
L13:
  mov    %ebx,%eax
  and    $0x30,%eax
  cmp    $0x10,%al
  sete   %dl
  cmp    $0xc3,%bl
  sete   %al
  or     %eax,%edx
  xor    %eax,%eax
  xor    $0x1,%edx
  cmp    $0xe3,%bl
  sete   %al
  and    %edx,%eax
  add    $0x1,%eax
  jmp    L147
  nopw   0x0(%rax,%rax,1)
  shr    $0x3,%bl
  movzbl %bl,%ebp
  mov    %ebp,%edi
  call   <Diss_Index_IsReg8Bit@plt>
  test   %eax,%eax
  je     L72
  mov    %ebp,%edi
  call   <Diss_Index_Get8BitRegCount@plt>
  movzbl %al,%eax
  add    $0x2,%eax
  jmp    L147
  nopw   0x0(%rax,%rax,1)
  test   $0x8,%bl
  jne    L309
  shr    $0x4,%bl
  movzbl %bl,%edi
  call   <Diss_Index_IsRegIndex@plt>
  test   %eax,%eax
  je     L72
L116:
  mov    $0x4,%eax
  jmp    L147
  cs nopw 0x0(%rax,%rax,1)
  shr    $0x4,%bl
  movzbl %bl,%edi
  call   <Diss_Index_IsRegIndex@plt>
  test   %eax,%eax
  je     L72
  jmp    L309
  nopl   0x0(%rax,%rax,1)
  shr    $0x4,%bl
  cmp    $0x2,%bl
  jne    L72
  jmp    L116
```

assistant: ```c
int Z80_Index_GetOpcodeCountForInstruction(int DisAddr) {
  unsigned char Opcode;
  Opcode = Z80_RD_MEM(DisAddr);
  DisAddr++;
  switch (Opcode) {
  case 0x0dd:
  case 0x0fd:
  case 0x0ed:
    return 1;
  case 0x0cb:
    return 4;
  default: {
    switch (Opcode & 0x0c0) {
    case 0x000: {
      switch (Opcode & 0x07) {
      case 1: {
        if ((Opcode & 0x08) != 0) {
          return 2;
        } else {
          if (Diss_Index_IsRegIndex((Opcode >> 4) & 0x03)) {
            return 4;
          }
        }
      } break;
      case 2: {
        switch ((Opcode >> 4) & 0x03) {
        case 2:
          return 4;
        default:
          break;
        }
      } break;
      case 3: {
        if (Diss_Index_IsRegIndex((Opcode >> 4) & 0x03))
          return 2;
      } break;
      case 4:
      case 5: {
        unsigned char OpcodeIndex;
        OpcodeIndex = ((Opcode >> 3) & 0x07);
        if (Diss_Index_IsReg8Bit(OpcodeIndex))
          return Diss_Index_Get8BitRegCount(OpcodeIndex) + 1;
      } break;
      case 6: {
        unsigned char OpcodeIndex;
        OpcodeIndex = (Opcode >> 3) & 0x07;
        if (Diss_Index_IsReg8Bit(OpcodeIndex))
          return Diss_Index_Get8BitRegCount(OpcodeIndex) + 2;
      } break;
      default:
        break;
      }
    } break;
    case 0x040: {
      if (Opcode != 0x076) {
        unsigned char Reg1, Reg2;
        Reg1 = (Opcode >> 3) & 0x07;
        Reg2 = Opcode & 0x07;
        if (Diss_Index_IsReg8Bit(Reg1) || Diss_Index_IsReg8Bit(Reg2)) {
          unsigned char Length1, Length2;
          Length1 = Diss_Index_Get8BitRegCount(Reg1);
          Length2 = Diss_Index_Get8BitRegCount(Reg2);
          if (Length1 < Length2) {
            return Length2 + 1;
          }
          return Length1 + 1;
        }
      }
    } break;
    case 0x080: {
      unsigned char OpcodeIndex;
      OpcodeIndex = (Opcode & 0x07);
      if (Diss_Index_IsReg8Bit(OpcodeIndex))
        return Diss_Index_Get8BitRegCount(OpcodeIndex) + 1;
    } break;
    case 0x0c0: {
      switch (Opcode & 0x07) {
      case 1: {
        if ((Opcode & (1 << 3)) == 0) {
          if (Diss_Index_IsRegIndex((Opcode >> 4) & 0x03))
            return 2;
        } else {
          if ((Opcode == 0x0f9) || (Opcode == 0x0e9))
            return 2;
        }
      } break;
      case 3: {
        if ((Opcode & (3 << 4)) == (1 << 4)) {
        } else if (Opcode == 0x0c3) {
        } else {
          if (Opcode == 0x0e3)
            return 2;
        }
      } break;
      case 5: {
        if ((Opcode & (1 << 3)) == 0) {
          if (Diss_Index_IsRegIndex((Opcode >> 4) & 0x03))
            return 2;
        }
      } break;
      default:
        break;
      }
    } break;
    }
  } break;
  }
  return 1;
}
```