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

```asm
<Hex_to_bin>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,-0x30(%rbp)
  mov    %r8d,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L43
  cmpl   $0x0,-0x4(%rbp)
  jne    L33
L43:
  mov    $0xffffffff,%eax
  jmp    L51
L33:
  mov    -0x28(%rbp),%rax
  movl   $0x0,(%rax)
  movl   $0x0,-0xc(%rbp)
  jmp    L180
L241:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L93
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jg     L93
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  shl    $0x4,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L220
L93:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jle    L199
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x46,%al
  jg     L199
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x37,%eax
  shl    $0x4,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L220
L199:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x60,%al
  jle    L192
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x66,%al
  jg     L192
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x57,%eax
  shl    $0x4,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L220
L192:
  mov    $0xffffffff,%eax
  jmp    L51
L220:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L95
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jg     L95
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  or     %eax,-0x8(%rbp)
  jmp    L15
L95:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jle    L208
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x46,%al
  jg     L208
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x37,%eax
  or     %eax,-0x8(%rbp)
  jmp    L15
L208:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x60,%al
  jle    L169
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x66,%al
  jg     L169
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x57,%eax
  or     %eax,-0x8(%rbp)
  jmp    L15
L169:
  mov    $0xffffffff,%eax
  jmp    L51
L15:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x1c(%rbp)
  jg     L140
  mov    $0x0,%eax
  jmp    L51
L140:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    -0x8(%rbp),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,(%rax)
  addl   $0x2,-0xc(%rbp)
L180:
  mov    -0xc(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jl     L241
  mov    $0x1,%eax
L51:
  leave
  ret
```

assistant: ```c
int Hex_to_bin(char *hex, int bin_size, int *bin_count, unsigned char *bin_data, int flag) {
  int i, l, acc;
  l = strlen(hex);
  if (l % 2 || l == 0)
    return (-1);
  *bin_count = 0;
  for (i = 0; i < l; i += 2) {
    if (hex[i] >= '0' && hex[i] <= '9')
      acc = (hex[i] - '0') << 4;
    else if (hex[i] >= 'A' && hex[i] <= 'F')
      acc = (hex[i] - 'A' + 10) << 4;
    else if (hex[i] >= 'a' && hex[i] <= 'f')
      acc = (hex[i] - 'a' + 10) << 4;
    else
      return (-1);
    if (hex[i + 1] >= '0' && hex[i + 1] <= '9')
      acc |= (hex[i + 1] - '0');
    else if (hex[i + 1] >= 'A' && hex[i + 1] <= 'F')
      acc |= (hex[i + 1] - 'A' + 10);
    else if (hex[i + 1] >= 'a' && hex[i + 1] <= 'f')
      acc |= (hex[i + 1] - 'a' + 10);
    else
      return (-1);
    if (*bin_count >= bin_size)
      return (0);
    bin_data[*bin_count] = acc;
    (*bin_count)++;
  }
  return (1);
}
```