// File: /workspace/github_c_makefile_star2_O0/pali[P]bmfdec/./bmfparse.c
// Function: parse_root
static struct mof_classes parse_root(char *buf, uint32_t size, uint32_t offset) {
  struct mof_classes out;
  memset(&out, 0, sizeof(out));
  if (size < 12) error("Invalid size");
  uint32_t *buf2 = (uint32_t *)buf;
  if (buf2[0] != 0x1 || buf2[1] != 0x1) error("Invalid unknown");
  uint32_t count = buf2[2];
  uint32_t i;
  char *tmp = buf + 12;
  out.count = count;
  out.classes = calloc(count, sizeof(*out.classes));
  if (!out.classes) error("calloc failed");
  for (i=0; i<count; ++i) {
    if (tmp-buf >= UINT32_MAX || !check_sum(tmp-buf, 4, size)) error("Invalid size");
    uint32_t len = ((uint32_t *)tmp)[0];
    if (len == 0 || !check_sum(tmp-buf, len, size)) error("Invalid size");
    out.classes[i] = parse_class(tmp, len, offset ? offset+tmp-buf : 0);
    tmp += len;
  }
  if (tmp != buf+size) error("Buffer not processed");
  return out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movl %edx, -0x20(%rbp)
leaq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x10c0
cmpl $0xc, -0x1c(%rbp)
jae 0x2b63
jmp 0x2b2d
movq 0x84c4(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x593d(%rip), %rsi      # 0x847b
leaq 0x597a(%rip), %rdx      # 0x84bf
leaq 0x59f5(%rip), %rcx      # 0x8541
movl $0x36e, %r8d            # imm = 0x36E
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1180
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x2b7e
movq -0x28(%rbp), %rax
cmpl $0x1, 0x4(%rax)
je 0x2bb6
jmp 0x2b80
movq 0x8471(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x58ea(%rip), %rsi      # 0x847b
leaq 0x59b4(%rip), %rdx      # 0x854c
leaq 0x59a2(%rip), %rcx      # 0x8541
movl $0x370, %r8d            # imm = 0x370
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1180
movq -0x28(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x38(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, %edi
movl $0x48, %esi
callq 0x10e0
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x2c24
jmp 0x2bee
movq 0x8403(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x587c(%rip), %rsi      # 0x847b
leaq 0x5956(%rip), %rdx      # 0x855c
leaq 0x5934(%rip), %rcx      # 0x8541
movl $0x376, %r8d            # imm = 0x376
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1180
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jae 0x2dd1
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
jge 0x2c78
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
subl %ecx, %eax
cmpl $0x4, %eax
jb 0x2c78
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
addl $0x4, %eax
cmpl -0x1c(%rbp), %eax
jbe 0x2cb0
jmp 0x2c7a
movq 0x8377(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x57f0(%rip), %rsi      # 0x847b
leaq 0x582d(%rip), %rdx      # 0x84bf
leaq 0x58a8(%rip), %rcx      # 0x8541
movl $0x378, %r8d            # imm = 0x378
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1180
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x2ceb
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
subl %ecx, %eax
cmpl -0x3c(%rbp), %eax
jb 0x2ceb
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
addl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jbe 0x2d23
jmp 0x2ced
movq 0x8304(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x577d(%rip), %rsi      # 0x847b
leaq 0x57ba(%rip), %rdx      # 0x84bf
leaq 0x5835(%rip), %rcx      # 0x8541
movl $0x37a, %r8d            # imm = 0x37A
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1180
movq -0x8(%rbp), %rax
movl -0x30(%rbp), %ecx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x98(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x8c(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x2d6e
movl -0x20(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0xa8(%rbp)
jmp 0x2d79
xorl %eax, %eax
movq %rax, -0xa8(%rbp)
jmp 0x2d79
movl -0x8c(%rbp), %edx
movq -0x98(%rbp), %rsi
movq -0xa8(%rbp), %rax
movl %eax, %ecx
leaq -0x88(%rbp), %rdi
callq 0x2e30
movq -0xa0(%rbp), %rdi
leaq -0x88(%rbp), %rsi
movl $0x48, %edx
callq 0x1130
movl -0x3c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x2c2b
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
je 0x2e1c
jmp 0x2de6
movq 0x820b(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x5684(%rip), %rsi      # 0x847b
leaq 0x576c(%rip), %rdx      # 0x856a
leaq 0x573c(%rip), %rcx      # 0x8541
movl $0x37e, %r8d            # imm = 0x37E
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1180
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rdx
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)