// File: /workspace/github_c_makefile_star2_O0/cogbee[P]vmir-latest/src/vmir_bitcode_parser.c
// Function: ir_dispatch_abbrev
static void
ir_dispatch_abbrev(ir_unit_t *iu, unsigned int id, rec_handler_t *rh,
                   const ir_blockinfo_t *ibi, bcbitstream_t *bs)
{
  const ir_abbrev_t *ia;
  const struct ir_abbrev_queue *iaq;
  const int orig_id = id;
  id -= 4;
  ir_block_t *b = LIST_FIRST(&iu->iu_blocks);

  if(id >= ibi->ib_num_abbrevs) {
    // Search in local scope
    id -= ibi->ib_num_abbrevs;
    iaq = &b->ib_scoped_abbrevs;
  } else {
    iaq = &ibi->ib_abbrevs;
  }
  TAILQ_FOREACH(ia, iaq, ia_link) {
    if(id == 0)
      break;
    id--;
  }

  if(ia == NULL)
    parser_error(iu, "Abbrev %d not found\n", orig_id);


  VECTOR_RESIZE(&iu->iu_argv, 0);

  int i;
  int nops = ia->ia_nops;

  for(i = 0; i < nops; i++) {
    int64_t a;
    switch(ia->ia_ops[i].iao_type) {
    case IAOT_LITTERAL:
      a = ia->ia_ops[i].iao_data;
      break;
    case IAOT_FIXED_WIDTH:
      a = read_bits(bs, ia->ia_ops[i].iao_data);
      break;
    case IAOT_VBR:
      a = read_vbr64(bs, ia->ia_ops[i].iao_data);
      break;
    case IAOT_ARRAY:
      assert(i == ia->ia_nops - 2);
      load_array(bs, iu, &ia->ia_ops[i + 1]);
      nops--; // Cut off last argument (which was array type)
      continue;
    case IAOT_BLOB:
      load_blob(bs, iu);
      continue;

    default:
      parser_error(iu, "Can't handle abbrevs with arg %d yet",
                           ia->ia_ops[i].iao_type);
    }
    VECTOR_PUSH_BACK(&iu->iu_argv, a);
  }

  rh(iu, iu->iu_argv.vh_p[0], iu->iu_argv.vh_length - 1,
     &iu->iu_argv.vh_p[1]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0xc(%rbp), %eax
subl $0x4, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x140(%rax), %rax
movq %rax, -0x48(%rbp)
movl -0xc(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jb 0x33855
movq -0x20(%rbp), %rax
movl 0x14(%rax), %ecx
movl -0xc(%rbp), %eax
subl %ecx, %eax
movl %eax, -0xc(%rbp)
movq -0x48(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x38(%rbp)
jmp 0x33861
movq -0x20(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x33891
cmpl $0x0, -0xc(%rbp)
jne 0x3387b
jmp 0x33891
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x3386c
cmpq $0x0, -0x30(%rbp)
jne 0x338ba
movq -0x8(%rbp), %rdi
movl -0x3c(%rbp), %r8d
leaq 0xcfbd(%rip), %rsi      # 0x40864
movl $0x479, %edx            # imm = 0x479
leaq 0xd988(%rip), %rcx      # 0x4123b
movb $0x0, %al
callq 0x18220
jmp 0x338bc
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpq 0x460(%rcx), %rax
jbe 0x3390f
movq -0x8(%rbp), %rax
movq $0x0, 0x460(%rax)
movq -0x8(%rbp), %rax
movq 0x460(%rax), %rax
shlq $0x3, %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x450(%rax), %rdi
movq -0x50(%rbp), %rsi
callq 0x3390
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x450(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x458(%rax)
movq -0x30(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x58(%rbp)
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x58(%rbp), %eax
jge 0x33b08
movq -0x30(%rbp), %rax
movslq -0x54(%rbp), %rcx
movl 0x14(%rax,%rcx,8), %eax
movq %rax, -0x78(%rbp)
subq $0x5, %rax
ja 0x33a32
movq -0x78(%rbp), %rax
leaq 0xa3ac(%rip), %rcx      # 0x3dd0c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x30(%rbp), %rax
movslq -0x54(%rbp), %rcx
movl 0x18(%rax,%rcx,8), %eax
movq %rax, -0x60(%rbp)
jmp 0x33a5d
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rax
movslq -0x54(%rbp), %rcx
movl 0x18(%rax,%rcx,8), %esi
callq 0x17a80
movl %eax, %eax
movq %rax, -0x60(%rbp)
jmp 0x33a5d
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rax
movslq -0x54(%rbp), %rcx
movl 0x18(%rax,%rcx,8), %esi
callq 0x38980
movq %rax, -0x60(%rbp)
jmp 0x33a5d
movl -0x54(%rbp), %eax
movq -0x30(%rbp), %rcx
movl 0x10(%rcx), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jne 0x339cf
jmp 0x339ee
leaq 0xd87a(%rip), %rdi      # 0x41250
leaq 0xce87(%rip), %rsi      # 0x40864
movl $0x48e, %edx            # imm = 0x48E
leaq 0xd87c(%rip), %rcx      # 0x41265
callq 0x31c0
movq -0x28(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x30(%rbp), %rdx
addq $0x14, %rdx
movl -0x54(%rbp), %eax
addl $0x1, %eax
cltq
shlq $0x3, %rax
addq %rax, %rdx
callq 0x38a60
movl -0x58(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x33afa
movq -0x28(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x38bf0
jmp 0x33afa
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movslq -0x54(%rbp), %rcx
movl 0x14(%rax,%rcx,8), %r8d
leaq 0xce1a(%rip), %rsi      # 0x40864
movl $0x498, %edx            # imm = 0x498
leaq 0xd87c(%rip), %rcx      # 0x412d2
movb $0x0, %al
callq 0x18220
jmp 0x33a5f
movq -0x8(%rbp), %rax
movq 0x458(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq -0x8(%rbp), %rcx
cmpq 0x460(%rcx), %rax
jbe 0x33ace
movq -0x68(%rbp), %rcx
addq $0x1, %rcx
shlq %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x460(%rax)
movq -0x8(%rbp), %rax
movq 0x460(%rax), %rax
shlq $0x3, %rax
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rax
movq 0x450(%rax), %rdi
movq -0x70(%rbp), %rsi
callq 0x3390
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x450(%rax)
movq -0x68(%rbp), %rcx
addq $0x1, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x458(%rax)
movq -0x60(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x450(%rax), %rax
movq -0x68(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x33afa
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x3392f
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rcx
movq 0x450(%rcx), %rcx
movq (%rcx), %rcx
movl %ecx, %esi
movq -0x8(%rbp), %rcx
movq 0x458(%rcx), %rcx
subq $0x1, %rcx
movl %ecx, %edx
movq -0x8(%rbp), %rcx
movq 0x450(%rcx), %rcx
addq $0x8, %rcx
callq *%rax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)