// File: /workspace/github_c_makefile_star2_O0/cogbee[P]vmir-latest/src/vmir_bitcode_parser.c
// Function: ir_define_abbrev
static int
ir_define_abbrev(ir_unit_t *iu, bcbitstream_t *bs)
{
  const uint32_t numops = read_vbr(bs, 5);
  ir_abbrev_t *ia = calloc(1, sizeof(ir_abbrev_t) +
                           sizeof(ir_abbrev_operand_t) * numops);
  ia->ia_nops = numops;
  int i;
  for(i = 0; i < numops; i++) {
    ir_abbrev_operand_t *iao = &ia->ia_ops[i];
    const int litteral = read_bits(bs, 1);
    if(litteral) {
      iao->iao_type = IAOT_LITTERAL;
      iao->iao_data = read_vbr(bs, 8);
      continue;
    }

    iao->iao_type = read_bits(bs, 3);
    switch(iao->iao_type) {
    case IAOT_FIXED_WIDTH:
    case IAOT_VBR:
      iao->iao_data = read_vbr(bs, 5);
      break;

    case IAOT_CHAR6:
      break;

    case IAOT_BLOB:
      if(i != numops - 1)
        parser_error(iu, "Blob is not last\n");
      break;

    case IAOT_ARRAY:
      if(i != numops - 2)
        parser_error(iu, "Array is not next to last\n");
      break;

    default:
      parser_error(iu, "Bad type %d in abbrev", iao->iao_type);
    }
  }

  ir_block_t *ib = LIST_FIRST(&iu->iu_blocks);

  if(ib->ib_blockinfo != NULL) {
    TAILQ_INSERT_TAIL(&ib->ib_blockinfo->ib_abbrevs, ia, ia_link);
    ib->ib_blockinfo->ib_num_abbrevs++;
  } else {
    TAILQ_INSERT_TAIL(&ib->ib_scoped_abbrevs, ia, ia_link);
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl $0x5, %esi
callq 0x33b80
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, %esi
shlq $0x3, %rsi
addq $0x18, %rsi
movl $0x1, %edi
callq 0x32c0
movq %rax, -0x20(%rbp)
movl -0x14(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x3368b
movq -0x20(%rbp), %rax
addq $0x14, %rax
movslq -0x24(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x17a80
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x3359d
movq -0x30(%rbp), %rax
movl $0x0, (%rax)
movq -0x10(%rbp), %rdi
movl $0x8, %esi
callq 0x33b80
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x4(%rax)
jmp 0x3367d
movq -0x10(%rbp), %rdi
movl $0x3, %esi
callq 0x17a80
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
movl (%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x48(%rbp)
subl $0x4, %eax
ja 0x33656
movq -0x48(%rbp), %rax
leaq 0xa723(%rip), %rcx      # 0x3dcf8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdi
movl $0x5, %esi
callq 0x33b80
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x4(%rax)
jmp 0x3367b
jmp 0x3367b
movl -0x24(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
je 0x33627
movq -0x8(%rbp), %rdi
leaq 0xd250(%rip), %rsi      # 0x40864
movl $0x417, %edx            # imm = 0x417
leaq 0xdba2(%rip), %rcx      # 0x411c2
movb $0x0, %al
callq 0x18220
jmp 0x3367b
movl -0x24(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
je 0x33654
movq -0x8(%rbp), %rdi
leaq 0xd223(%rip), %rsi      # 0x40864
movl $0x41c, %edx            # imm = 0x41C
leaq 0xdb87(%rip), %rcx      # 0x411d4
movb $0x0, %al
callq 0x18220
jmp 0x3367b
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movl (%rax), %r8d
leaq 0xd1fc(%rip), %rsi      # 0x40864
movl $0x420, %edx            # imm = 0x420
leaq 0xdb7b(%rip), %rcx      # 0x411ef
movb $0x0, %al
callq 0x18220
jmp 0x3367d
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3353d
movq -0x8(%rbp), %rax
movq 0x140(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x336fc
jmp 0x336a7
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x20(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x20(%rax), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq %rcx, 0x20(%rax)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movl 0x14(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x14(%rax)
jmp 0x33736
jmp 0x336fe
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x33736
xorl %eax, %eax
addq $0x50, %rsp
popq %rbp
retq
nop