// File: /workspace/github_cpp_makefile_star2_O3/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 0x2b332
movq %rax, %rdi
callq 0x27c58
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rsi
cmpq -0x20(%rbp), %rsi
je 0x3d81d
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, -0x28(%rbp)
jmp 0x3d82a
leaq -0x30(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0x19328
leaq -0x30(%rbp), %rdx
leaq -0x50(%rbp), %rcx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3d568
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq $0x2, %rdx
jb 0x3d86b
movq (%rcx), %rsi
movl $0x1, %edi
imulq (%rcx,%rdi,8), %rsi
movq %rsi, (%rcx,%rdi,8)
incq %rdi
cmpq %rdi, %rdx
jne 0x3d85a
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %r8
subq %rdi, %r8
sarq $0x3, %r8
leaq 0x1(%r8), %rsi
cmpq %rsi, %rdx
jne 0x3d8cf
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 0x3d887
addq %rax, %rsi
movq %rbx, %rdi
callq 0x2d3a6
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3d8b4
callq 0x42b0
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x3d8c2
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 0x2a490
leaq 0xa15f(%rip), %rsi      # 0x47a51
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rdx
callq 0xe495
movb $0x1, %r15b
leaq -0x70(%rbp), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x333ee
xorl %r15d, %r15d
leaq 0x1d453(%rip), %rsi     # 0x5ad70
leaq -0x2f384(%rip), %rdx    # 0xe5a0
movq %r14, %rdi
callq 0x4540
movq %rax, %rbx
leaq -0x60(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3d941
callq 0x42b0
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3d953
callq 0x42b0
testb %r15b, %r15b
jne 0x3d974
jmp 0x3d985
movq %rax, %rbx
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3d974
callq 0x42b0
jmp 0x3d974
movq %rax, %rbx
movq %r14, %rdi
callq 0x4250
jmp 0x3d985
jmp 0x3d982
jmp 0x3d982
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3d993
callq 0x42b0
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x3d9a1
callq 0x42b0
movq %rbx, %rdi
callq 0x4560
nop