// File: /workspace/github_cpp_makefile_star2_O1/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 0x2d762
movq %rax, %rdi
callq 0x2b8a6
movq %rax, %r14
movl $0x1, %esi
movq %r13, %rdi
callq 0x2d762
movq %rax, %rdi
callq 0x2b8a6
movq %rax, %r13
movq %rax, %rdi
callq 0x2bb90
testb %al, %al
je 0x3e081
movq %r13, %rdi
callq 0x2d488
movq %rax, %rdi
callq 0x2fdda
cmpl $0x1, %eax
jne 0x3e081
movq %r13, %rdi
callq 0x2d488
movq %rax, %rdi
callq 0x2f8a4
movq %rax, -0x48(%rbp)
movq 0x8(%r15), %rsi
cmpq 0x10(%r15), %rsi
je 0x3dfa0
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%r15)
jmp 0x3dfac
leaq -0x48(%rbp), %rdx
movq %r15, %rdi
callq 0x19282
movq %r14, %rdi
callq 0x2d660
testb %al, %al
je 0x3e00c
movq %r13, %rdi
callq 0x2bb90
testb %al, %al
je 0x3e0dd
movq %r13, %rdi
callq 0x2d488
movq %rax, %rdi
callq 0x2fdda
cmpl $0x1, %eax
jne 0x3e0dd
movq %r14, %rdi
callq 0x2bbcc
movq %rax, %rdi
callq 0x282f6
movq %rax, -0x48(%rbp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x3e056
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x3e062
movq %r14, %rdi
callq 0x2bbcc
movq %rax, %rdi
callq 0x282f6
movq %rax, -0x48(%rbp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x3e037
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x3e043
leaq -0x48(%rbp), %rdx
movq %rbx, %rdi
callq 0x19282
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x3df02
jmp 0x3e072
leaq -0x48(%rbp), %rdx
movq %rbx, %rdi
callq 0x19282
movq %r14, %rdi
callq 0x2d57a
movq %rax, %rdi
callq 0x2f024
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), %r12
movq %r12, -0x10(%r12)
leaq 0xa928(%rip), %rsi      # 0x489c6
leaq 0xa952(%rip), %rdx      # 0x489f7
leaq -0x48(%rbp), %rdi
callq 0xf65c
movb $0x1, %r15b
leaq -0x48(%rbp), %rdx
movq %rbx, %rdi
movl $0x13, %esi
callq 0x33d12
xorl %r15d, %r15d
leaq 0x1dca4(%rip), %rsi     # 0x5bd70
leaq -0x2fd19(%rip), %rdx    # 0xe3ba
movq %rbx, %rdi
callq 0x4540
jmp 0x3e137
movl $0x28, %edi
callq 0x4190
movq %rax, %rbx
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xa8fe(%rip), %rsi      # 0x489f8
leaq 0xa94f(%rip), %rdx      # 0x48a50
leaq -0x48(%rbp), %rdi
callq 0xf65c
movb $0x1, %r15b
leaq -0x48(%rbp), %rdx
movq %rbx, %rdi
movl $0x13, %esi
callq 0x33d12
xorl %r15d, %r15d
leaq 0x1dc48(%rip), %rsi     # 0x5bd70
leaq -0x2fd75(%rip), %rdx    # 0xe3ba
movq %rbx, %rdi
callq 0x4540
jmp 0x3e13b
jmp 0x3e14e
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x3e154
callq 0x42b0
jmp 0x3e154
movq %rax, %r14
movb $0x1, %r15b
testb %r15b, %r15b
je 0x3e161
movq %rbx, %rdi
callq 0x4250
movq %r14, %rdi
callq 0x4560
nop