// File: /workspace/github_c_makefile_star2_O0/pali[P]bmfdec/./bmfparse.c
// Function: parse_bmf
static struct mof_classes parse_bmf(char *buf, uint32_t size) {
  struct mof_classes out;
  if (size < 8) error("Invalid file size");
  if (((uint32_t *)buf)[0] != 0x424D4F46) error("Invalid magic header");
  uint32_t len = ((uint32_t *)buf)[1];
  if (len > size) error("Invalid size");
  uint32_t i;
  uint32_t count = 0;
  if (len < size) {
    if (!check_sum(20, len, size)) error("Invalid size");
    if (memcmp(buf+len, "BMOFQUALFLAVOR11", 16) != 0) error("Invalid second magic header");
    count = ((uint32_t *)(buf+len+16))[0];
    if (count >= UINT32_MAX/8 || 8*count != size-len-16-4) error("Invalid size");
    for (i=0; i<count; ++i) {
      if (((uint32_t *)(buf+len+16+4))[2*i] == 0) error("Invalid offset in second part");
    }
  }
  out = parse_root(buf+8, len-8, (len < size) ? 8 : 0);
  for (i=0; i<count; ++i) {
    if (((uint32_t *)(buf+len+16+4))[2*i] != 0) error("Qualifier from second part was not parsed");
  }
  return out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
cmpl $0x8, -0x1c(%rbp)
jae 0x208d
jmp 0x2057
movq 0x8f9a(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x6413(%rip), %rsi      # 0x847b
leaq 0x641f(%rip), %rdx      # 0x848e
leaq 0x642a(%rip), %rcx      # 0x84a0
movl $0x384, %r8d            # imm = 0x384
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1180
movq -0x18(%rbp), %rax
cmpl $0x424d4f46, (%rax)     # imm = 0x424D4F46
je 0x20d1
jmp 0x209b
movq 0x8f56(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x63cf(%rip), %rsi      # 0x847b
leaq 0x63f7(%rip), %rdx      # 0x84aa
leaq 0x63e6(%rip), %rcx      # 0x84a0
movl $0x385, %r8d            # imm = 0x385
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1180
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jbe 0x211b
jmp 0x20e5
movq 0x8f0c(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x6385(%rip), %rsi      # 0x847b
leaq 0x63c2(%rip), %rdx      # 0x84bf
leaq 0x639c(%rip), %rcx      # 0x84a0
movl $0x387, %r8d            # imm = 0x387
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1180
movl $0x0, -0x28(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0x22b2
movl $0xffffffeb, %eax       # imm = 0xFFFFFFEB
cmpl -0x20(%rbp), %eax
jb 0x2143
movl -0x20(%rbp), %eax
addl $0x14, %eax
cmpl -0x1c(%rbp), %eax
jbe 0x217b
jmp 0x2145
movq 0x8eac(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x6325(%rip), %rsi      # 0x847b
leaq 0x6362(%rip), %rdx      # 0x84bf
leaq 0x633c(%rip), %rcx      # 0x84a0
movl $0x38b, %r8d            # imm = 0x38B
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1180
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
addq %rcx, %rax
movups (%rax), %xmm0
movaps 0x6151(%rip), %xmm1     # 0x82e0
pcmpeqb %xmm1, %xmm0
pmovmskb %xmm0, %eax
subl $0xffff, %eax           # imm = 0xFFFF
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x21df
jmp 0x21a9
movq 0x8e48(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x62c1(%rip), %rsi      # 0x847b
leaq 0x631c(%rip), %rdx      # 0x84dd
leaq 0x62d8(%rip), %rcx      # 0x84a0
movl $0x38c, %r8d            # imm = 0x38C
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1180
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl 0x10(%rax,%rcx), %eax
movl %eax, -0x28(%rbp)
cmpl $0x1fffffff, -0x28(%rbp) # imm = 0x1FFFFFFF
jae 0x220c
movl -0x28(%rbp), %eax
shll $0x3, %eax
movl -0x1c(%rbp), %ecx
subl -0x20(%rbp), %ecx
subl $0x10, %ecx
subl $0x4, %ecx
cmpl %ecx, %eax
je 0x2244
jmp 0x220e
movq 0x8de3(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x625c(%rip), %rsi      # 0x847b
leaq 0x6299(%rip), %rdx      # 0x84bf
leaq 0x6273(%rip), %rcx      # 0x84a0
movl $0x38e, %r8d            # imm = 0x38E
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1180
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jae 0x22b0
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
addq %rcx, %rax
movl -0x24(%rbp), %ecx
shll %ecx
movl %ecx, %ecx
cmpl $0x0, 0x14(%rax,%rcx,4)
jne 0x22a3
jmp 0x226d
movq 0x8d84(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x61fd(%rip), %rsi      # 0x847b
leaq 0x6274(%rip), %rdx      # 0x84f9
leaq 0x6214(%rip), %rcx      # 0x84a0
movl $0x390, %r8d            # imm = 0x390
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1180
jmp 0x22a5
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x224b
jmp 0x22b2
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movl -0x20(%rbp), %esi
subl $0x8, %esi
movl -0x20(%rbp), %ecx
movl -0x1c(%rbp), %r8d
xorl %edx, %edx
movl $0x8, %eax
cmpl %r8d, %ecx
cmovbl %eax, %edx
callq 0x2b00
movl %eax, -0x38(%rbp)
movq %rdx, -0x30(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jae 0x235c
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
addq %rcx, %rax
movl -0x24(%rbp), %ecx
shll %ecx
movl %ecx, %ecx
cmpl $0x0, 0x14(%rax,%rcx,4)
je 0x234f
jmp 0x2319
movq 0x8cd8(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x6151(%rip), %rsi      # 0x847b
leaq 0x61e6(%rip), %rdx      # 0x8517
leaq 0x6168(%rip), %rcx      # 0x84a0
movl $0x395, %r8d            # imm = 0x395
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1180
jmp 0x2351
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x22f7
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rdx
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)