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

```asm
<parse_1st_msg>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    (%rdi),%rbx
  test   %rbx,%rbx
  je     L112
L75:
  mov    0x40(%r15),%rax
  add    $0x10,%rbx
  movq   $0x0,0x30(%r15)
  lea    D3(%rip),%rbp
  movq   $0x0,0x10(%r15)
  lea    D50(%rip),%r12
  lea    D43(%rip),%r14
  sub    %rbx,%rax
  movq   $0x0,0x48(%r15)
  lea    D6(%rip),%r13
  test   %rax,%rax
  jg     L110
  jmp    L120
  nopw   0x0(%rax,%rax,1)
L9:
  cmp    $0x7,%al
  je     L16
L114:
  mov    %rbx,%rdi
  call   <uint4@plt>
  cltq
  add    %rax,%rbx
  mov    0x40(%r15),%rax
  sub    %rbx,%rax
  test   %rax,%rax
  jle    L120
L110:
  movzbl 0x4(%rbx),%esi
  cmp    $0x8,%sil
  ja     L42
L53:
  mov    %rbx,(%r15,%rsi,8)
  movzbl 0x4(%rbx),%eax
  cmp    $0x6,%al
  jne    L9
  movzbl 0x5(%rbx),%eax
  test   %al,%al
  jne    L82
  mov    %rbx,0x48(%r15)
  movzbl 0x4(%rbx),%eax
  cmp    $0x7,%al
  jne    L114
L16:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L42:
  mov    %rbp,%rdi
  call   <fatal_error_i@plt>
  movzbl 0x4(%rbx),%esi
  jmp    L53
  xchg   %ax,%ax
L82:
  lea    -0x1(%rax),%edx
  cmp    $0xfc,%dl
  jbe    L94
  cmp    $0xfe,%al
  jne    L114
  mov    %r12,%rsi
  mov    %r14,%rdi
  call   <fatal_error@plt>
  movzbl 0x4(%rbx),%eax
  jmp    L9
L120:
  lea    D50(%rip),%rsi
  lea    D39(%rip),%rdi
  call   <fatal_error@plt>
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L94:
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <fatal_error@plt>
  movzbl 0x4(%rbx),%eax
  jmp    L9
  nopl   0x0(%rax)
L112:
  lea    D50(%rip),%rsi
  lea    D49(%rip),%rdi
  call   <fatal_error@plt>
  mov    (%r15),%rbx
  jmp    L75
```

tool_calls: name: parse_data
arguments: data_tag: D3
type: string
name: parse_data
arguments: data_tag: D50
type: string
name: parse_data
arguments: data_tag: D43
type: string
name: parse_data
arguments: data_tag: D6
type: string
name: parse_data
arguments: data_tag: D39
type: string
name: parse_data
arguments: data_tag: D49
type: string

tool: D3: parse_1st_msg illegal section %d

tool: 

tool: D43: parse_1st_msg: illegal grib msg, bitmap not defined code, table 6.0=254

tool: D6: parse_1st_msg: predefined bitmaps are not handled

tool: D39: parse_1st_msg illegally format grib

tool: D49: parse_1st_msg .. sec[0] == NULL

assistant: ```c
int parse_1st_msg(unsigned char **sec) {
  unsigned char *p;
  if (sec[0] == NULL)
    fatal_error("parse_1st_msg .. sec[0] == NULL", "");
  sec[2] = sec[6] = NULL;
  sec[9] = NULL;
  p = sec[0] + 16;
  while (sec[8] - p > 0) {
    if (p[4] > 8)
      fatal_error_i("parse_1st_msg illegal section %d", (int)p[4]);
    sec[p[4]] = p;
    if (p[4] == 6) {
      if (p[5] == 0) {
        sec[9] = p;
      } else if (p[5] >= 1 && p[5] <= 253) {
        fatal_error("parse_1st_msg: predefined bitmaps are not handled", "");
      } else if (p[5] == 254) {
        fatal_error("parse_1st_msg: illegal grib msg, bitmap not defined code, table 6.0=254", "");
      }
    }
    if (p[4] == 7) {
      return 0;
    }
    p += uint4(p);
  }
  fatal_error("parse_1st_msg illegally format grib", "");
  return 1;
}
```