// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorps %xmm0, %xmm0
movaps %xmm0, -0x30(%rbp)
xorl %eax, %eax
movq %rax, -0x20(%rbp)
movq %rax, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movq %rsi, %rdi
callq 0x2bbcc
movq %rax, %rdi
callq 0x282ec
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rsi
cmpq -0x20(%rbp), %rsi
je 0x3e1bd
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, -0x28(%rbp)
jmp 0x3e1ca
leaq -0x30(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0x19282
leaq -0x30(%rbp), %rdx
leaq -0x50(%rbp), %rcx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3df02
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq $0x2, %rdx
jb 0x3e20b
movq (%rcx), %rsi
movl $0x1, %edi
imulq (%rcx,%rdi,8), %rsi
movq %rsi, (%rcx,%rdi,8)
incq %rdi
cmpq %rdi, %rdx
jne 0x3e1fa
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %r8
subq %rdi, %r8
sarq $0x3, %r8
leaq 0x1(%r8), %rsi
cmpq %rsi, %rdx
jne 0x3e26f
xorl %edx, %edx
xorl %esi, %esi
movq (%rcx,%rdx,8), %r9
imulq (%rdi,%rdx,8), %r9
addq %r9, %rsi
incq %rdx
cmpq %rdx, %r8
jne 0x3e227
addq %rax, %rsi
movq %rbx, %rdi
callq 0x2dc82
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3e254
callq 0x42b0
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x3e262
callq 0x42b0
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x28, %edi
callq 0x4190
movq %rax, %r14
leaq -0x90(%rbp), %rdi
movq %rbx, %rsi
callq 0x2ad20
leaq 0xa7bf(%rip), %rsi      # 0x48a51
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rdx
callq 0xe2af
movb $0x1, %r15b
leaq -0x70(%rbp), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x33d12
xorl %r15d, %r15d
leaq 0x1dab3(%rip), %rsi     # 0x5bd70
leaq -0x2ff0a(%rip), %rdx    # 0xe3ba
movq %r14, %rdi
callq 0x4540
movq %rax, %rbx
leaq -0x60(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3e2e9
callq 0x42b0
jmp 0x3e2e9
movq %rax, %rbx
movb $0x1, %r15b
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3e303
callq 0x42b0
jmp 0x3e303
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x3e319
movq %r14, %rdi
callq 0x4250
jmp 0x3e319
jmp 0x3e316
jmp 0x3e316
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3e327
callq 0x42b0
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x3e335
callq 0x42b0
movq %rbx, %rdi
callq 0x4560
nop