// File: /workspace/github_cpp_makefile_star2_O1/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 0x59511
movl $0x88, %r13d
leaq 0x19c93(%rip), %rcx     # 0x72970
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 0x58dae
leaq 0x48(%r14), %rax
movq %rax, 0x8(%rsp)
movl 0x48(%r14), %ecx
leal -0x1(%rcx), %edx
cmpl $0x4, %edx
jb 0x5940e
cmpl $0x5, %ecx
jne 0x59082
cmpb $0x1, 0x7(%rsp)
jne 0x59186
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x59177
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x59186
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
movl 0x8(%r14), %ecx
leal -0x1(%rcx), %esi
cmpl $0x4, %esi
jae 0x58e30
leaq 0x48(%r14), %rax
movq %rax, 0x8(%rsp)
movl 0x48(%r14), %ecx
leal -0x1(%rcx), %edx
cmpl $0x4, %edx
jb 0x593fe
cmpl $0x5, %ecx
jne 0x590d7
cmpb $0x1, 0x7(%rsp)
jne 0x592c6
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x592b7
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x592c6
cmpl $0x5, %ecx
jne 0x58e5f
testb %dl, %dl
je 0x59136
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x5912c
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x59136
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
movl 0x8(%r14), %ecx
leal -0x1(%rcx), %esi
cmpl $0x4, %esi
jb 0x593fe
cmpl $0x5, %ecx
jne 0x59103
testb %dl, %dl
je 0x5933c
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x59332
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x5933c
movl $0x8, %r13d
jmp 0x593fe
cmpl $0x5, %ecx
jne 0x590ae
testb %dl, %dl
je 0x5927a
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x59270
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x5927a
testb %dl, %dl
jne 0x58e6e
cmpl $0x0, 0x30(%r14)
je 0x58cff
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x59169
leaq 0x8(%rsp), %rdx
jmp 0x59310
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
movl 0x8(%r14), %ecx
leal -0x1(%rcx), %esi
cmpl $0x4, %esi
jb 0x593fe
cmpl $0x5, %ecx
jne 0x591cc
testb %dl, %dl
je 0x59389
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x5937f
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x59389
movq 0xc8(%r14), %rbp
movq 0xd0(%r14), %r12
cmpq %r12, %rbp
je 0x593fe
leaq 0x10(%rsp), %r15
movq %rbp, 0x8(%rsp)
testq %rbp, %rbp
je 0x58f01
movl (%rbp), %eax
leal -0x1(%rax), %ecx
cmpl $0x4, %ecx
jae 0x58f0f
addq $0x40, %rbp
cmpq %r12, %rbp
jne 0x58eec
jmp 0x593fe
cmpl $0x5, %eax
jne 0x58f32
cmpb $0x1, 0x7(%rsp)
jne 0x58f64
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x58f57
movq %rbp, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x58f64
cmpb $0x0, 0x7(%rsp)
jne 0x58f3f
cmpl $0x0, 0x28(%rbp)
je 0x58f01
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x58f50
movq %rbp, (%rsi)
jmp 0x58f8e
leaq 0x8(%rsp), %rdx
jmp 0x58f9d
movq %r15, %rdi
leaq 0x8(%rsp), %rdx
callq 0x5aaf2
movq 0x8(%rsp), %rdx
movq 0x30(%rdx), %rax
cmpl $0x0, (%rax)
jne 0x58f01
cmpb $0x0, 0x7(%rsp)
jne 0x58f7f
cmpl $0x0, 0x28(%rax)
je 0x58f01
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x58f99
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x58f01
addq $0x30, %rdx
movq %r15, %rdi
callq 0x5aaf2
jmp 0x58f01
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
movl 0x8(%r14), %ecx
leal -0x1(%rcx), %esi
cmpl $0x4, %esi
jb 0x593fe
cmpl $0x5, %ecx
jne 0x591f5
testb %dl, %dl
je 0x593ca
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x593c0
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x593ca
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
movl 0x8(%r14), %ecx
leal -0x1(%rcx), %esi
cmpl $0x4, %esi
jb 0x5940e
cmpl $0x5, %ecx
jne 0x5921e
testb %dl, %dl
je 0x5946a
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x59460
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x5946a
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
movl 0x8(%r14), %ecx
leal -0x1(%rcx), %esi
cmpl $0x4, %esi
jb 0x5940e
cmpl $0x5, %ecx
jne 0x59247
testb %dl, %dl
je 0x594ae
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x594a4
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x594ae
cmpb $0x0, 0x7(%rsp)
jne 0x59094
cmpl $0x0, 0x70(%r14)
je 0x5940e
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x594dd
leaq 0x8(%rsp), %rdx
jmp 0x591bd
testb %dl, %dl
jne 0x590bd
cmpl $0x0, 0x30(%r14)
je 0x58d63
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x592a9
leaq 0x8(%rsp), %rdx
jmp 0x59323
cmpb $0x0, 0x7(%rsp)
jne 0x590e9
cmpl $0x0, 0x70(%r14)
je 0x593fe
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x593f5
leaq 0x8(%rsp), %rdx
jmp 0x592fd
testb %dl, %dl
jne 0x59112
cmpl $0x0, 0x30(%r14)
je 0x593fe
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x593f5
leaq 0x8(%rsp), %rdx
jmp 0x59373
leaq 0x8(%rsp), %rdx
callq 0x5aaf2
movq 0x8(%rsp), %rdx
movq 0x30(%rdx), %rax
cmpl $0x0, (%rax)
jne 0x58cff
cmpb $0x0, 0x7(%rsp)
jne 0x59159
cmpl $0x0, 0x28(%rax)
je 0x58cff
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x5930c
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x58cff
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x5aaf2
movq 0x8(%rsp), %rdx
movq 0x30(%rdx), %rax
cmpl $0x0, (%rax)
jne 0x5940e
cmpb $0x0, 0x7(%rsp)
jne 0x591a9
cmpl $0x0, 0x28(%rax)
je 0x5940e
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x594dd
addq $0x30, %rdx
leaq 0x10(%rsp), %rdi
callq 0x5aaf2
jmp 0x5940e
testb %dl, %dl
jne 0x591db
cmpl $0x0, 0x30(%r14)
je 0x593fe
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x593f5
leaq 0x8(%rsp), %rdx
jmp 0x593b4
testb %dl, %dl
jne 0x59204
cmpl $0x0, 0x30(%r14)
je 0x593fe
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x593f5
leaq 0x8(%rsp), %rdx
jmp 0x594ef
testb %dl, %dl
jne 0x5922d
cmpl $0x0, 0x30(%r14)
je 0x5940e
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x594dd
leaq 0x8(%rsp), %rdx
jmp 0x59495
testb %dl, %dl
jne 0x59256
cmpl $0x0, 0x30(%r14)
je 0x5940e
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x594dd
leaq 0x8(%rsp), %rdx
jmp 0x59502
leaq 0x8(%rsp), %rdx
callq 0x5aaf2
movq 0x8(%rsp), %rdx
movq 0x30(%rdx), %rax
cmpl $0x0, (%rax)
jne 0x58d63
cmpb $0x0, 0x7(%rsp)
jne 0x5929d
cmpl $0x0, 0x28(%rax)
je 0x58d63
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x5931f
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x58d63
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x5aaf2
movq 0x8(%rsp), %rdx
movq 0x30(%rdx), %rax
cmpl $0x0, (%rax)
jne 0x593fe
cmpb $0x0, 0x7(%rsp)
jne 0x592e9
cmpl $0x0, 0x28(%rax)
je 0x593fe
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x593f5
addq $0x30, %rdx
leaq 0x10(%rsp), %rdi
callq 0x5aaf2
jmp 0x593fe
addq $0x30, %rdx
leaq 0x10(%rsp), %rdi
callq 0x5aaf2
jmp 0x58cff
addq $0x30, %rdx
leaq 0x10(%rsp), %rdi
callq 0x5aaf2
jmp 0x58d63
leaq 0x8(%rsp), %rdx
callq 0x5aaf2
movq 0x8(%rsp), %rdx
movq 0x30(%rdx), %rax
cmpl $0x0, (%rax)
jne 0x593fe
cmpb $0x0, 0x7(%rsp)
jne 0x5935f
cmpl $0x0, 0x28(%rax)
je 0x593fe
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x593f5
addq $0x30, %rdx
leaq 0x10(%rsp), %rdi
callq 0x5aaf2
jmp 0x593fe
leaq 0x8(%rsp), %rdx
callq 0x5aaf2
movq 0x8(%rsp), %rdx
movq 0x30(%rdx), %rax
cmpl $0x0, (%rax)
jne 0x593fe
cmpb $0x0, 0x7(%rsp)
jne 0x593a4
cmpl $0x0, 0x28(%rax)
je 0x593fe
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x593f5
addq $0x30, %rdx
leaq 0x10(%rsp), %rdi
callq 0x5aaf2
jmp 0x593fe
leaq 0x8(%rsp), %rdx
callq 0x5aaf2
movq 0x8(%rsp), %rdx
movq 0x30(%rdx), %rax
cmpl $0x0, (%rax)
jne 0x593fe
cmpb $0x0, 0x7(%rsp)
jne 0x593e5
cmpl $0x0, 0x28(%rax)
je 0x593fe
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x594eb
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
addq %r13, %r14
leaq 0x50(%rsp), %rdi
movq %r14, %rsi
callq 0x595b8
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x5aa7a
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x59437
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x5944e
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
leaq 0x8(%rsp), %rdx
callq 0x5aaf2
movq 0x8(%rsp), %rdx
movq 0x30(%rdx), %rax
cmpl $0x0, (%rax)
jne 0x5940e
cmpb $0x0, 0x7(%rsp)
jne 0x59485
cmpl $0x0, 0x28(%rax)
je 0x5940e
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0x594dd
addq $0x30, %rdx
leaq 0x10(%rsp), %rdi
callq 0x5aaf2
jmp 0x5940e
leaq 0x8(%rsp), %rdx
callq 0x5aaf2
movq 0x8(%rsp), %rdx
movq 0x30(%rdx), %rax
cmpl $0x0, (%rax)
jne 0x5940e
cmpb $0x0, 0x7(%rsp)
jne 0x594d1
cmpl $0x0, 0x28(%rax)
je 0x5940e
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x594fe
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x5940e
addq $0x30, %rdx
leaq 0x10(%rsp), %rdi
callq 0x5aaf2
jmp 0x593fe
addq $0x30, %rdx
leaq 0x10(%rsp), %rdi
callq 0x5aaf2
jmp 0x5940e
movq 0x36ad8(%rip), %rdi     # 0x8fff0
leaq 0x15c49(%rip), %rsi     # 0x6f168
movl $0x8, %edx
callq 0x8330
movq 0x36ac0(%rip), %rdi     # 0x8fff0
leaq 0x1950e(%rip), %rsi     # 0x72a45
movl $0x21, %edx
callq 0x8330
movq 0x36aa8(%rip), %rdi     # 0x8fff0
leaq 0x16e71(%rip), %rsi     # 0x703c0
movl $0x1, %edx
callq 0x8330
movq 0x36a90(%rip), %rdi     # 0x8fff0
movl $0x4d, %esi
callq 0x8520
movq %rax, %rdi
callq 0x8180
movl $0xff, %edi
callq 0x8380
jmp 0x5957e
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x59598
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x595af
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
movq %rbx, %rdi
callq 0x8540
nop