// File: 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
subq $0xf0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x64230
movq %rax, %rdi
callq 0x60f30
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x64230
movq %rax, %rdi
callq 0x60f30
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x61790
testb $0x1, %al
jne 0x85358
jmp 0x853a3
movq -0x38(%rbp), %rdi
callq 0x63e50
movq %rax, %rdi
callq 0x6a020
cmpl $0x1, %eax
jne 0x853a3
movq -0x28(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x38(%rbp), %rdi
callq 0x63e50
movq %rax, %rdi
callq 0x69310
movq -0xc0(%rbp), %rdi
movq %rax, -0x40(%rbp)
leaq -0x40(%rbp), %rsi
callq 0x33d60
jmp 0x85460
movb $0x1, -0x75(%rbp)
movl $0x28, %edi
callq 0x41c0
movq %rax, -0xd0(%rbp)
leaq -0x61(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x45f0
movq -0xc8(%rbp), %rdx
leaq 0xc6f8(%rip), %rsi      # 0x91ace
leaq -0x60(%rbp), %rdi
callq 0x4450
jmp 0x853e1
movq -0xd0(%rbp), %rdi
movl $0x13, %esi
leaq -0x60(%rbp), %rdx
callq 0x73a90
jmp 0x853f8
movq -0xd0(%rbp), %rdi
movb $0x0, -0x75(%rbp)
leaq 0x40946(%rip), %rsi     # 0xc5d50
leaq -0x6f581(%rip), %rdx    # 0x15e90
callq 0x45b0
jmp 0x8561b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x8543e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x4688
leaq -0x61(%rbp), %rdi
callq 0x4380
testb $0x1, -0x75(%rbp)
jne 0x8544f
jmp 0x8545b
movq -0xd0(%rbp), %rdi
callq 0x4280
jmp 0x85612
movq -0x30(%rbp), %rdi
callq 0x640c0
testb $0x1, %al
jne 0x85472
jmp 0x855b3
movq -0x38(%rbp), %rdi
callq 0x61790
testb $0x1, %al
jne 0x85481
jmp 0x854e1
movq -0x38(%rbp), %rdi
callq 0x63e50
movq %rax, %rdi
callq 0x6a020
cmpl $0x1, %eax
jne 0x854e1
movq -0x20(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x30(%rbp), %rdi
callq 0x61800
movq %rax, %rdi
callq 0x57280
movq -0xd8(%rbp), %rdi
movq %rax, -0x80(%rbp)
leaq -0x80(%rbp), %rsi
callq 0x33d60
movq -0x30(%rbp), %rdi
callq 0x63f90
movq %rax, %rdi
callq 0x68770
movq %rax, -0x8(%rbp)
jmp 0x85605
movb $0x1, -0xa2(%rbp)
movl $0x28, %edi
callq 0x41c0
movq %rax, -0xe8(%rbp)
leaq -0xa1(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x45f0
movq -0xe0(%rbp), %rdx
leaq 0xc5e6(%rip), %rsi      # 0x91b00
leaq -0xa0(%rbp), %rdi
callq 0x4450
jmp 0x85528
movq -0xe8(%rbp), %rdi
movl $0x13, %esi
leaq -0xa0(%rbp), %rdx
callq 0x73a90
jmp 0x85542
movq -0xe8(%rbp), %rdi
movb $0x0, -0xa2(%rbp)
leaq 0x407f9(%rip), %rsi     # 0xc5d50
leaq -0x6f6ce(%rip), %rdx    # 0x15e90
callq 0x45b0
jmp 0x8561b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x8558e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x4688
leaq -0xa1(%rbp), %rdi
callq 0x4380
testb $0x1, -0xa2(%rbp)
jne 0x855a5
jmp 0x855b1
movq -0xe8(%rbp), %rdi
callq 0x4280
jmp 0x85612
movq -0x20(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x30(%rbp), %rdi
callq 0x61800
movq %rax, %rdi
callq 0x57280
movq -0xf0(%rbp), %rdi
movq %rax, -0xb0(%rbp)
leaq -0xb0(%rbp), %rsi
callq 0x33d60
movq -0xb8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x852f0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x45e0
nopl (%rax,%rax)