// File: acliusBackHome[P]kamaya/dist/IR.cpp
// Function: IR::getItemEmit(ParseExpression const&, ParseType const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, ParseTree&, unsigned long, unsigned long)
size_t IR::getItemEmit(const ParseExpression &init_expr,
                       const ParseType &this_type, const string &symbol,
                       ParseTree &tree, size_t node_id, size_t scope_id) {
  vector<size_t> psize;
  vector<size_t> pid;
  psize.push_back(init_expr.get_ret_type().get_size());
  size_t esp = dfsArrayGetItem(init_expr, psize, pid);
  for (int i = 1; i < psize.size(); i++) {
    psize[i] *= psize[i - 1];
  }
  size_t pos = 0;
  if (psize.size() == pid.size() + 1) {
    for (int i = 0; i <= pid.size() - 1; i++) {
      pos += pid[i] * psize[i];
    }
  } else {
    throw ParseException(ExceptionCode::EX_UNKNOWN,
                         "IR::getItemEmit: Bad Array Type " +
                             init_expr.get_info());
  }
  init_expr.set_address(esp + pos);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xf0(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x16700
leaq -0x60(%rbp), %rdi
callq 0x16700
movq -0x10(%rbp), %rdi
callq 0x61800
movq %rax, -0xe8(%rbp)
jmp 0x85676
movq -0xe8(%rbp), %rdi
callq 0x57260
movq %rax, -0xf8(%rbp)
jmp 0x8568b
movq -0xf8(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x33d60
jmp 0x856a5
movq -0xf0(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x48(%rbp), %rdx
leaq -0x60(%rbp), %rcx
callq 0x852f0
movq %rax, -0x100(%rbp)
jmp 0x856c6
movq -0x100(%rbp), %rax
movq %rax, -0x80(%rbp)
movl $0x1, -0x84(%rbp)
movslq -0x84(%rbp), %rax
movq %rax, -0x108(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x16570
movq %rax, %rcx
movq -0x108(%rbp), %rax
cmpq %rcx, %rax
jae 0x85760
movl -0x84(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq -0x48(%rbp), %rdi
callq 0x34060
movq (%rax), %rax
movq %rax, -0x110(%rbp)
movslq -0x84(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x34060
movq -0x110(%rbp), %rcx
imulq (%rax), %rcx
movq %rcx, (%rax)
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x856db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x85940
movq $0x0, -0x90(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x16570
movq %rax, -0x118(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x16570
movq %rax, %rcx
movq -0x118(%rbp), %rax
addq $0x1, %rcx
cmpq %rcx, %rax
jne 0x8582e
movl $0x0, -0x94(%rbp)
movslq -0x94(%rbp), %rax
movq %rax, -0x120(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x16570
movq %rax, %rcx
movq -0x120(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
ja 0x85829
movslq -0x94(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x34060
movq (%rax), %rax
movq %rax, -0x128(%rbp)
movslq -0x94(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x34060
movq %rax, %rcx
movq -0x128(%rbp), %rax
imulq (%rcx), %rax
addq -0x90(%rbp), %rax
movq %rax, -0x90(%rbp)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x857a5
jmp 0x8590a
movb $0x1, -0xd9(%rbp)
movl $0x28, %edi
callq 0x41c0
movq %rax, -0x130(%rbp)
movq -0x10(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x60410
jmp 0x85858
leaq 0xc2fa(%rip), %rsi      # 0x91b59
leaq -0xb8(%rbp), %rdi
leaq -0xd8(%rbp), %rdx
callq 0x15d60
jmp 0x85874
movq -0x130(%rbp), %rdi
xorl %esi, %esi
leaq -0xb8(%rbp), %rdx
callq 0x73a90
jmp 0x8588b
movq -0x130(%rbp), %rdi
movb $0x0, -0xd9(%rbp)
leaq 0x404b0(%rip), %rsi     # 0xc5d50
leaq -0x6fa17(%rip), %rdx    # 0x15e90
callq 0x45b0
jmp 0x8595b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x858f1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x858e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x4688
leaq -0xd8(%rbp), %rdi
callq 0x4688
testb $0x1, -0xd9(%rbp)
jne 0x858fc
jmp 0x85908
movq -0x130(%rbp), %rdi
callq 0x4280
jmp 0x85940
movq -0x10(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0x90(%rbp), %rax
addq %rax, %rsi
callq 0x64ad0
jmp 0x85923
leaq -0x60(%rbp), %rdi
callq 0x166a0
leaq -0x48(%rbp), %rdi
callq 0x166a0
xorl %eax, %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
leaq -0x60(%rbp), %rdi
callq 0x166a0
leaq -0x48(%rbp), %rdi
callq 0x166a0
movq -0x70(%rbp), %rdi
callq 0x45e0
nopl (%rax,%rax)