// File: /workspace/github_cpp_makefile_star2_O3/luooofan[P]hblzbd_compiler/src/Pass/ir_liveness_analysis.cpp
// Function: GetDefUsePtr(ir::IR*, bool)
std::pair<std::vector<Opn *>, std::vector<Opn *>> GetDefUsePtr(IR *ir, bool consider) {
  std::vector<Opn *> def;
  std::vector<Opn *> use;

  auto process_opn = [&use, &consider](Opn *op) {
    if (nullptr == op) return;
    if (op->type_ == Opn::Type::Imm || op->type_ == Opn::Type::Label || op->type_ == Opn::Type::Func ||
        op->type_ == Opn::Type::Null)
      return;
    if (op->type_ == Opn::Type::Array) {
      if (consider) use.push_back(op);
      if (op->offset_->type_ == Opn::Type::Var)
        if (consider || 0 != op->offset_->scope_id_) use.push_back(op->offset_);
    } else {  // var
      if (!consider && 0 == op->scope_id_) return;
      use.push_back(op);
    }
  };

  auto process_res = [&def, &use, &consider](Opn *res) {
    if (nullptr == res) return;
    if (res->type_ == Opn::Type::Label || res->type_ == Opn::Type::Func || res->type_ == Opn::Type::Null) return;
    if (res->type_ == Opn::Type::Array) {
      if (consider) def.push_back(res);
      if (res->offset_->type_ == Opn::Type::Var)
        if (consider || 0 != res->offset_->scope_id_) use.push_back(res->offset_);
    } else {  // var
      if (!consider && 0 == res->scope_id_) return;
      def.push_back(res);
    }
  };

  if (ir->op_ == IR::OpKind::ADD || ir->op_ == IR::OpKind::SUB || ir->op_ == IR::OpKind::MUL ||
      ir->op_ == IR::OpKind::DIV || ir->op_ == IR::OpKind::MOD) {
    process_opn(&(ir->opn1_));
    process_opn(&(ir->opn2_));
    process_res(&(ir->res_));
  } else if (ir->op_ == IR::OpKind::NOT || ir->op_ == IR::OpKind::NEG) {
    process_opn(&(ir->opn1_));
    process_res(&(ir->res_));
  } else if (ir->op_ == IR::OpKind::LABEL) {
    return {def, use};
  } else if (ir->op_ == IR::OpKind::PARAM) {
    process_opn(&(ir->opn1_));
  } else if (ir->op_ == IR::OpKind::CALL) {
    process_res(&(ir->res_));
  } else if (ir->op_ == IR::OpKind::RET) {
    process_opn(&(ir->opn1_));
  } else if (ir->op_ == IR::OpKind::GOTO) {
    return {def, use};
  } else if (ir->op_ == IR::OpKind::ASSIGN) {
    process_opn(&(ir->opn1_));
    process_res(&(ir->res_));
  } else if (ir->op_ == IR::OpKind::JEQ || ir->op_ == IR::OpKind::JNE || ir->op_ == IR::OpKind::JLT ||
             ir->op_ == IR::OpKind::JLE || ir->op_ == IR::OpKind::JGT || ir->op_ == IR::OpKind::JGE) {
    process_opn(&(ir->opn1_));
    process_opn(&(ir->opn2_));
  } else if (ir->op_ == IR::OpKind::VOID) {
    return {def, use};
  } else if (ir->op_ == IR::OpKind::ASSIGN_OFFSET) {
    process_opn(&(ir->opn1_));
    process_res(&(ir->res_));
  } else if (ir->op_ == IR::OpKind::PHI) {
    for (auto &arg : ir->phi_args_) {
      process_opn(&(arg));
    }
    process_res(&(ir->res_));
  } else if (ir->op_ == IR::OpKind::ALLOCA) {
    process_res(&(ir->opn1_));
  } else if (ir->op_ == IR::OpKind::DECLARE) {
    process_res(&(ir->opn1_));
  } else {
    MyAssert(0);
  }

  return {def, use};
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x7(%rsp), %rax
movb %dl, (%rax)
xorl %ecx, %ecx
leaq 0x30(%rsp), %rsi
movq %rcx, 0x10(%rsi)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsi)
leaq 0x10(%rsp), %rdi
movq %rcx, 0x10(%rdi)
movaps %xmm0, (%rdi)
movq %rsi, 0x50(%rsp)
movq %rdi, 0x58(%rsp)
movq %rax, 0x60(%rsp)
movl (%r14), %eax
cmpq $0x17, %rax
ja 0x58725
movl $0x88, %r13d
leaq 0x1997b(%rip), %rcx     # 0x71974
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
movl 0x8(%r14), %ecx
leal -0x1(%rcx), %esi
cmpl $0x4, %esi
jae 0x580ca
leaq 0x48(%r14), %rax
movq %rax, 0x8(%rsp)
movl 0x48(%r14), %ecx
leal -0x1(%rcx), %edx
cmpl $0x4, %edx
jb 0x586b8
cmpl $0x5, %ecx
jne 0x584ab
cmpb $0x1, 0x7(%rsp)
jne 0x58562
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x58553
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x58562
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
movl 0x8(%r14), %ecx
leal -0x1(%rcx), %esi
cmpl $0x4, %esi
jae 0x5819d
leaq 0x48(%r14), %rax
movq %rax, 0x8(%rsp)
movl 0x48(%r14), %ecx
leal -0x1(%rcx), %edx
cmpl $0x4, %edx
jb 0x586a8
cmpl $0x5, %ecx
jne 0x584ff
cmpb $0x1, 0x7(%rsp)
jne 0x5864f
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x58640
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x5864f
cmpl $0x5, %ecx
jne 0x581f7
testb %dl, %dl
je 0x580e8
leaq 0x8(%rsp), %rdx
xorl %esi, %esi
callq 0x59cf0
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rcx
cmpl $0x0, (%rcx)
jne 0x5801b
cmpb $0x0, 0x7(%rsp)
jne 0x58106
cmpl $0x0, 0x28(%rcx)
je 0x5801b
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x58691
movq %rcx, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x5801b
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
movl 0x8(%r14), %ecx
leal -0x1(%rcx), %esi
cmpl $0x4, %esi
jb 0x586a8
cmpl $0x5, %ecx
jne 0x5852b
testb %dl, %dl
je 0x5815b
leaq 0x8(%rsp), %rdx
xorl %esi, %esi
callq 0x59cf0
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rcx
cmpl $0x0, (%rcx)
jne 0x586a8
cmpb $0x0, 0x7(%rsp)
jne 0x58179
cmpl $0x0, 0x28(%rcx)
je 0x586a8
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x583cc
addq $0x30, %rax
jmp 0x58541
movl $0x8, %r13d
jmp 0x586a8
cmpl $0x5, %ecx
jne 0x584d7
testb %dl, %dl
je 0x581bb
leaq 0x8(%rsp), %rdx
xorl %esi, %esi
callq 0x59cf0
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rcx
cmpl $0x0, (%rcx)
jne 0x5807f
cmpb $0x0, 0x7(%rsp)
jne 0x581d9
cmpl $0x0, 0x28(%rcx)
je 0x5807f
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x5870a
movq %rcx, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x5807f
leaq 0x8(%rsp), %rax
testb %dl, %dl
jne 0x5820b
cmpl $0x0, 0x30(%r14)
je 0x5801b
xorl %esi, %esi
leaq 0x10(%rsp), %rdi
movq %rax, %rdx
callq 0x59cf0
jmp 0x5801b
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
movl 0x8(%r14), %ecx
leal -0x1(%rcx), %esi
cmpl $0x4, %esi
jb 0x586a8
cmpl $0x5, %ecx
jne 0x585a3
testb %dl, %dl
je 0x58256
leaq 0x8(%rsp), %rdx
xorl %esi, %esi
callq 0x59cf0
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rcx
cmpl $0x0, (%rcx)
jne 0x586a8
cmpb $0x0, 0x7(%rsp)
jne 0x58274
cmpl $0x0, 0x28(%rcx)
je 0x586a8
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x583cc
addq $0x30, %rax
jmp 0x585b9
movq 0xc8(%r14), %rbp
movq 0xd0(%r14), %r12
cmpq %r12, %rbp
je 0x586a8
leaq 0x10(%rsp), %r15
movq %rbp, 0x8(%rsp)
testq %rbp, %rbp
je 0x582be
movl (%rbp), %eax
leal -0x1(%rax), %ecx
cmpl $0x4, %ecx
jae 0x582cc
addq $0x40, %rbp
cmpq %r12, %rbp
jne 0x582a9
jmp 0x586a8
cmpl $0x5, %eax
jne 0x582ef
cmpb $0x1, 0x7(%rsp)
jne 0x58321
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x58314
movq %rbp, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x58321
cmpb $0x0, 0x7(%rsp)
jne 0x582fc
cmpl $0x0, 0x28(%rbp)
je 0x582be
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x5830d
movq %rbp, (%rsi)
jmp 0x5834b
leaq 0x8(%rsp), %rdx
jmp 0x5835a
movq %r15, %rdi
leaq 0x8(%rsp), %rdx
callq 0x59cf0
movq 0x8(%rsp), %rdx
movq 0x30(%rdx), %rax
cmpl $0x0, (%rax)
jne 0x582be
cmpb $0x0, 0x7(%rsp)
jne 0x5833c
cmpl $0x0, 0x28(%rax)
je 0x582be
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x58356
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x582be
addq $0x30, %rdx
movq %r15, %rdi
callq 0x59cf0
jmp 0x582be
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
movl 0x8(%r14), %ecx
leal -0x1(%rcx), %esi
cmpl $0x4, %esi
jb 0x586a8
cmpl $0x5, %ecx
jne 0x585cb
testb %dl, %dl
je 0x5839e
leaq 0x8(%rsp), %rdx
xorl %esi, %esi
callq 0x59cf0
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rcx
cmpl $0x0, (%rcx)
jne 0x586a8
cmpb $0x0, 0x7(%rsp)
jne 0x583bc
cmpl $0x0, 0x28(%rcx)
je 0x586a8
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x58713
movq %rcx, (%rsi)
jmp 0x58679
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
movl 0x8(%r14), %ecx
leal -0x1(%rcx), %esi
cmpl $0x4, %esi
jb 0x586b8
cmpl $0x5, %ecx
jne 0x585f3
testb %dl, %dl
je 0x5840b
leaq 0x8(%rsp), %rdx
xorl %esi, %esi
callq 0x59cf0
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rcx
cmpl $0x0, (%rcx)
jne 0x586b8
cmpb $0x0, 0x7(%rsp)
jne 0x58429
cmpl $0x0, 0x28(%rcx)
je 0x586b8
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x584a3
addq $0x30, %rax
jmp 0x58609
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
movl 0x8(%r14), %ecx
leal -0x1(%rcx), %esi
cmpl $0x4, %esi
jb 0x586b8
cmpl $0x5, %ecx
jne 0x5861b
testb %dl, %dl
je 0x58475
leaq 0x8(%rsp), %rdx
xorl %esi, %esi
callq 0x59cf0
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rcx
cmpl $0x0, (%rcx)
jne 0x586b8
cmpb $0x0, 0x7(%rsp)
jne 0x58493
cmpl $0x0, 0x28(%rcx)
je 0x586b8
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x5871c
movq %rcx, (%rsi)
jmp 0x58598
cmpb $0x0, 0x7(%rsp)
jne 0x584bd
cmpl $0x0, 0x70(%r14)
je 0x586b8
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x58595
leaq 0x8(%rsp), %rdx
jmp 0x58685
leaq 0x8(%rsp), %rax
testb %dl, %dl
jne 0x584eb
cmpl $0x0, 0x30(%r14)
je 0x5807f
xorl %esi, %esi
leaq 0x10(%rsp), %rdi
movq %rax, %rdx
callq 0x59cf0
jmp 0x5807f
cmpb $0x0, 0x7(%rsp)
jne 0x58511
cmpl $0x0, 0x70(%r14)
je 0x586a8
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x58676
leaq 0x8(%rsp), %rdx
jmp 0x5869e
leaq 0x8(%rsp), %rax
testb %dl, %dl
jne 0x5853f
cmpl $0x0, 0x30(%r14)
je 0x586a8
xorl %esi, %esi
leaq 0x10(%rsp), %rdi
movq %rax, %rdx
callq 0x59cf0
jmp 0x586a8
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x59cf0
movq 0x8(%rsp), %rdx
movq 0x30(%rdx), %rax
cmpl $0x0, (%rax)
jne 0x586b8
cmpb $0x0, 0x7(%rsp)
jne 0x58585
cmpl $0x0, 0x28(%rax)
je 0x586b8
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x58681
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x586b8
leaq 0x8(%rsp), %rax
testb %dl, %dl
jne 0x585b7
cmpl $0x0, 0x30(%r14)
je 0x586a8
xorl %esi, %esi
leaq 0x10(%rsp), %rdi
movq %rax, %rdx
callq 0x59cf0
jmp 0x586a8
leaq 0x8(%rsp), %rax
testb %dl, %dl
jne 0x585df
cmpl $0x0, 0x30(%r14)
je 0x586a8
xorl %esi, %esi
leaq 0x10(%rsp), %rdi
movq %rax, %rdx
callq 0x59cf0
jmp 0x586a8
leaq 0x8(%rsp), %rax
testb %dl, %dl
jne 0x58607
cmpl $0x0, 0x30(%r14)
je 0x586b8
xorl %esi, %esi
leaq 0x10(%rsp), %rdi
movq %rax, %rdx
callq 0x59cf0
jmp 0x586b8
leaq 0x8(%rsp), %rax
testb %dl, %dl
jne 0x5862f
cmpl $0x0, 0x30(%r14)
je 0x586b8
xorl %esi, %esi
leaq 0x10(%rsp), %rdi
movq %rax, %rdx
callq 0x59cf0
jmp 0x586b8
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x59cf0
movq 0x8(%rsp), %rdx
movq 0x30(%rdx), %rax
cmpl $0x0, (%rax)
jne 0x586a8
cmpb $0x0, 0x7(%rsp)
jne 0x5866a
cmpl $0x0, 0x28(%rax)
je 0x586a8
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x5869a
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x586a8
addq $0x30, %rdx
leaq 0x10(%rsp), %rdi
callq 0x59cf0
jmp 0x586b8
addq $0x30, %rax
jmp 0x5820d
addq $0x30, %rdx
leaq 0x10(%rsp), %rdi
callq 0x59cf0
addq %r13, %r14
leaq 0x50(%rsp), %rdi
movq %r14, %rsi
callq 0x587cc
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x59c78
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x586e1
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x586f8
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x30, %rax
jmp 0x584ed
addq $0x30, %rax
jmp 0x585e1
addq $0x30, %rax
jmp 0x58631
movq 0x368bc(%rip), %rdi     # 0x8efe8
leaq 0x15a35(%rip), %rsi     # 0x6e168
movl $0x8, %edx
callq 0x8330
movq 0x368a4(%rip), %rdi     # 0x8efe8
leaq 0x192fe(%rip), %rsi     # 0x71a49
movl $0x21, %edx
callq 0x8330
movq 0x3688c(%rip), %rdi     # 0x8efe8
leaq 0x16c5d(%rip), %rsi     # 0x6f3c0
movl $0x1, %edx
callq 0x8330
movq 0x36874(%rip), %rdi     # 0x8efe8
movl $0x4d, %esi
callq 0x8520
movq %rax, %rdi
callq 0x8180
movl $0xff, %edi
callq 0x8380
jmp 0x58792
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x587ac
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x587c3
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
movq %rbx, %rdi
callq 0x8540
nop