// File: /workspace/github_c_makefile_star2_O2/buptlxb[P]xRay/src/taint_block.cpp
// Function: TaintBlock::TaintBlock(BasicBlock*)
TaintBlock::TaintBlock(BasicBlock *bb)
{
    if (bb->isVisited())
        return;
    bb->setVisited(true);
    bBlocks.push_back(bb);
    const vector<DISASM> &insts = bb->getInsts();
    for (BasicBlock::ConstRevDisasmIter iter = insts.rbegin(); iter != insts.rend(); iter++) {

//        printf("%s (%d %d %d) (%d %d %d) (%d %d %d)\n", iter->CompleteInstr, iter->Argument1.ArgType, iter->Argument1.ArgSize, iter->Argument1.ArgPosition, iter->Argument2.ArgType, iter->Argument2.ArgSize, iter->Argument2.ArgPosition, iter->Argument3.ArgType, iter->Argument3.ArgSize, iter->Argument3.ArgPosition);
        if (IS_WRITE_GPR(iter->Argument1)) {
            define.insert(iter->Argument1);
        } else if (IS_READ_GPR(iter->Argument1)) {
            use.insert(iter->Argument1);
        }

        if (IS_WRITE_GPR(iter->Argument2)) {
            define.insert(iter->Argument2);
        } else if (IS_READ_GPR(iter->Argument2)) {
            use.insert(iter->Argument2);
        }

        if (IS_WRITE_GPR(iter->Argument3)) {
            define.insert(iter->Argument3);
        } else if (IS_READ_GPR(iter->Argument3)) {
            use.insert(iter->Argument3);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, 0x10(%rsp)
leaq 0x50(%rdi), %rax
andl $0x0, 0x50(%rdi)
andq $0x0, 0x58(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x30(%rdi)
andq $0x0, 0x40(%rdi)
movq %rax, 0x60(%rdi)
movq %rax, 0x68(%rdi)
andq $0x0, 0x70(%rdi)
leaq 0x80(%rdi), %rax
andl $0x0, 0x80(%rdi)
andq $0x0, 0x88(%rdi)
movq %rax, 0x90(%rdi)
movq %rax, 0x98(%rdi)
andq $0x0, 0xa0(%rdi)
leaq 0xb0(%rdi), %rax
andl $0x0, 0xb0(%rdi)
andq $0x0, 0xb8(%rdi)
movq %rax, 0xc0(%rdi)
movq %rax, 0xc8(%rdi)
andq $0x0, 0xd0(%rdi)
cmpb $0x0, 0x5a(%rsi)
je 0xab99
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %rbx
leaq 0x78(%rdi), %r14
leaq 0xa8(%rdi), %r15
movb $0x1, 0x5a(%rsi)
leaq 0x10(%rsp), %rsi
callq 0x892c
movq 0x10(%rsp), %r13
movq $-0x1f1, %r12           # imm = 0xFE0F
addq 0x8(%r13), %r12
leaq 0x1f1(%r12), %rbp
cmpq (%r13), %rbp
je 0xab8a
movl -0x1a5(%rbp), %eax
cmpl $0x1, %eax
je 0xabf0
cmpl $0x2, %eax
jne 0xac03
testb $0x2, 0x42(%r12)
movq %r15, %rdi
jne 0xabfb
jmp 0xac03
testb $0x2, 0x42(%r12)
movq %r14, %rdi
je 0xac03
movq %r12, %rsi
callq 0xb090
movl -0x13d(%rbp), %eax
cmpl $0x1, %eax
je 0xac23
cmpl $0x2, %eax
jne 0xac3b
testb $0x2, 0xaa(%r12)
movq %r15, %rdi
jne 0xac31
jmp 0xac3b
testb $0x2, 0xaa(%r12)
movq %r14, %rdi
je 0xac3b
leaq 0x68(%r12), %rsi
callq 0xb090
movl -0xd5(%rbp), %eax
cmpl $0x1, %eax
je 0xac5b
cmpl $0x2, %eax
jne 0xac76
testb $0x2, 0x112(%r12)
movq %r15, %rdi
jne 0xac69
jmp 0xac76
testb $0x2, 0x112(%r12)
movq %r14, %rdi
je 0xac76
leaq 0xd0(%r12), %rsi
callq 0xb090
addq $-0x28d, %r12           # imm = 0xFD73
jmp 0xabc5
jmp 0xac84
movq %rax, 0x8(%rsp)
leaq 0x30(%rbx), %r13
leaq 0x18(%rbx), %rbp
leaq 0x48(%rbx), %r12
movq %r15, %rdi
callq 0xaf12
movq %r14, %rdi
callq 0xaf12
movq %r12, %rdi
callq 0xaf5e
movq %r13, %rdi
callq 0xb05c
movq %rbp, %rdi
callq 0xb05c
movq %rbx, %rdi
callq 0x89d6
movq 0x8(%rsp), %rdi
callq 0x82a0
nop