// File: /workspace/github_cpp_makefile_star2_O3/acliusBackHome[P]kamaya/dist/IR.cpp
// Function: IR::dfsArrayGetItem(ParseExpression const&, std::vector<unsigned long, std::allocator<unsigned long>>&, std::vector<unsigned long, std::allocator<unsigned long>>&)
size_t IR::dfsArrayGetItem(const ParseExpression &expr, vector<size_t> &psize,
                           vector<size_t> &pid) {
  const ParseExpression &left =
      ParseExpression::get_expression(expr.get_child(0));
  const ParseExpression &right =
      ParseExpression::get_expression(expr.get_child(1));
  if (right.is_const() &&
      right.get_const().get_type() == ConstValueType::C_SIGNED) {
    pid.push_back(right.get_const().get_signed());
  } else {
    throw ParseException(ExceptionCode::EX_NOT_IMPLEMENTED,
                         "IR::dfsArrayGetItem: implamented right value type");
  }
  if (left.is_variable()) {
    if (right.is_const() &&
        right.get_const().get_type() == ConstValueType::C_SIGNED) {
      psize.push_back(left.get_ret_type().get_array_size());
      return left.get_variable().get_address();
    } else {
      throw ParseException(ExceptionCode::EX_NOT_IMPLEMENTED,
                           "IR::dfsArrayGetItem: the the bottom of arrary get "
                           "item exp, implamented right value type");
    }
  } else {
    psize.push_back(left.get_ret_type().get_array_size());
    return dfsArrayGetItem(left, psize, pid);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r12
movq %rsi, %rdi
xorl %esi, %esi
callq 0x2ce86
movq %rax, %rdi
callq 0x2b006
movq %rax, %r14
movl $0x1, %esi
movq %r13, %rdi
callq 0x2ce86
movq %rax, %rdi
callq 0x2b006
movq %rax, %r13
movq %rax, %rdi
callq 0x2b2f4
testb %al, %al
je 0x3d6e7
movq %r13, %rdi
callq 0x2cbac
movq %rax, %rdi
callq 0x2f50a
cmpl $0x1, %eax
jne 0x3d6e7
movq %r13, %rdi
callq 0x2cbac
movq %rax, %rdi
callq 0x2efe0
movq %rax, -0x48(%rbp)
movq 0x8(%r15), %rsi
cmpq 0x10(%r15), %rsi
je 0x3d606
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%r15)
jmp 0x3d612
leaq -0x48(%rbp), %rdx
movq %r15, %rdi
callq 0x19328
movq %r14, %rdi
callq 0x2cd84
testb %al, %al
je 0x3d672
movq %r13, %rdi
callq 0x2b2f4
testb %al, %al
je 0x3d742
movq %r13, %rdi
callq 0x2cbac
movq %rax, %rdi
callq 0x2f50a
cmpl $0x1, %eax
jne 0x3d742
movq %r14, %rdi
callq 0x2b332
movq %rax, %rdi
callq 0x27c62
movq %rax, -0x48(%rbp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x3d6bc
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x3d6c8
movq %r14, %rdi
callq 0x2b332
movq %rax, %rdi
callq 0x27c62
movq %rax, -0x48(%rbp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x3d69d
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x3d6a9
leaq -0x48(%rbp), %rdx
movq %rbx, %rdi
callq 0x19328
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x3d568
jmp 0x3d6d8
leaq -0x48(%rbp), %rdx
movq %rbx, %rdi
callq 0x19328
movq %r14, %rdi
callq 0x2cc9e
movq %rax, %rdi
callq 0x2e75e
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x28, %edi
callq 0x4190
movq %rax, %rbx
leaq -0x38(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xa2c3(%rip), %rsi      # 0x479c6
leaq 0xa2ed(%rip), %rdx      # 0x479f7
leaq -0x48(%rbp), %rdi
callq 0xf868
movb $0x1, %r12b
leaq -0x48(%rbp), %rdx
movq %rbx, %rdi
movl $0x13, %esi
callq 0x333ee
xorl %r12d, %r12d
leaq 0x1d63f(%rip), %rsi     # 0x5ad70
leaq -0x2f198(%rip), %rdx    # 0xe5a0
movq %rbx, %rdi
callq 0x4540
jmp 0x3d79b
movl $0x28, %edi
callq 0x4190
movq %rax, %rbx
leaq -0x38(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xa29a(%rip), %rsi      # 0x479f8
leaq 0xa2eb(%rip), %rdx      # 0x47a50
leaq -0x48(%rbp), %rdi
callq 0xf868
movb $0x1, %r12b
leaq -0x48(%rbp), %rdx
movq %rbx, %rdi
movl $0x13, %esi
callq 0x333ee
xorl %r12d, %r12d
leaq 0x1d5e4(%rip), %rsi     # 0x5ad70
leaq -0x2f1f3(%rip), %rdx    # 0xe5a0
movq %rbx, %rdi
callq 0x4540
jmp 0x3d79f
jmp 0x3d7b7
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x3d7b0
callq 0x42b0
testb %r12b, %r12b
jne 0x3d7ba
jmp 0x3d7c2
movq %rax, %r14
movq %rbx, %rdi
callq 0x4250
movq %r14, %rdi
callq 0x4560