// File: /workspace/github_cpp_makefile_star2_O2/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 0x25ffa
movq %rax, %rdi
callq 0x247e8
movq %rax, %r14
pushq $0x1
popq %rsi
movq %r13, %rdi
callq 0x25ffa
movq %rax, %rdi
callq 0x247e8
movq %rax, %r13
movq %rax, %rdi
callq 0x24972
testb %al, %al
je 0x32f97
movq %r13, %rdi
callq 0x25daa
movq %rax, %rdi
callq 0x27fba
cmpl $0x1, %eax
jne 0x32f97
movq %r13, %rdi
callq 0x25daa
movq %rax, %rdi
callq 0x27b16
leaq -0x50(%rbp), %rsi
movq %rax, (%rsi)
movq %r15, %rdi
callq 0x1679a
movq %r14, %rdi
callq 0x25f26
testb %al, %al
je 0x32f58
movq %r13, %rdi
callq 0x24972
testb %al, %al
je 0x32fe3
movq %r13, %rdi
callq 0x25daa
movq %rax, %rdi
callq 0x27fba
cmpl $0x1, %eax
jne 0x32fe3
movq %r14, %rdi
callq 0x249b0
movq %rax, %rdi
callq 0x21bf6
leaq -0x50(%rbp), %rsi
movq %rax, (%rsi)
movq %rbx, %rdi
callq 0x1679a
movq %r14, %rdi
callq 0x25e6e
movq %rax, %rdi
callq 0x2751c
jmp 0x32f88
movq %r14, %rdi
callq 0x249b0
movq %rax, %rdi
callq 0x21bf6
leaq -0x50(%rbp), %rsi
movq %rax, (%rsi)
movq %rbx, %rdi
callq 0x1679a
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x32e62
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x28
popq %rdi
callq 0x4180
movq %rax, %rbx
leaq 0x99b9(%rip), %rsi      # 0x3c962
leaq -0x50(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x4130
movb $0x1, %r15b
pushq $0x13
popq %rsi
leaq -0x50(%rbp), %rdx
movq %rbx, %rdi
callq 0x2b53c
xorl %r15d, %r15d
leaq 0x1fd9e(%rip), %rsi     # 0x52d70
leaq -0x26731(%rip), %rdx    # 0xc8a8
movq %rbx, %rdi
callq 0x44e0
jmp 0x3302d
pushq $0x28
popq %rdi
callq 0x4180
movq %rax, %rbx
leaq 0x999f(%rip), %rsi      # 0x3c994
leaq -0x50(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x4130
movb $0x1, %r15b
pushq $0x13
popq %rsi
leaq -0x50(%rbp), %rdx
movq %rbx, %rdi
callq 0x2b53c
xorl %r15d, %r15d
leaq 0x1fd52(%rip), %rsi     # 0x52d70
leaq -0x2677d(%rip), %rdx    # 0xc8a8
movq %rbx, %rdi
callq 0x44e0
jmp 0x33031
jmp 0x33044
movq %rax, %r14
leaq -0x50(%rbp), %rdi
callq 0x4598
testb %r15b, %r15b
jne 0x33047
jmp 0x3304f
movq %rax, %r14
movq %rbx, %rdi
callq 0x4220
movq %r14, %rdi
callq 0x4500
nop