// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, 0x8(%rsp)
leaq 0x50(%rdi), %rax
xorl %ecx, %ecx
movl %ecx, 0x50(%rdi)
movq %rcx, 0x58(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x30(%rdi)
movq %rcx, 0x40(%rdi)
movq %rax, 0x60(%rdi)
movq %rax, 0x68(%rdi)
movq %rcx, 0x70(%rdi)
leaq 0x80(%rdi), %rax
movl %ecx, 0x80(%rdi)
movq %rcx, 0x88(%rdi)
movq %rax, 0x90(%rdi)
movq %rax, 0x98(%rdi)
movq %rcx, 0xa0(%rdi)
leaq 0xb0(%rdi), %rax
movl %ecx, 0xb0(%rdi)
movq %rcx, 0xb8(%rdi)
movq %rax, 0xc0(%rdi)
movq %rax, 0xc8(%rdi)
movq %rcx, 0xd0(%rdi)
cmpb $0x0, 0x5a(%rsi)
jne 0xafee
movq %rdi, %rbx
leaq 0x78(%rdi), %r14
leaq 0xa8(%rdi), %r15
movb $0x1, 0x5a(%rsi)
movq 0x8(%rdi), %rax
cmpq 0x10(%rdi), %rax
je 0xaef9
movq %rsi, (%rax)
addq $0x8, 0x8(%rbx)
jmp 0xaf09
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x8cdc
movq 0x8(%rsp), %r13
movq 0x8(%r13), %r12
cmpq (%r13), %r12
je 0xafee
addq $-0x1f1, %r12           # imm = 0xFE0F
movl 0x4c(%r12), %eax
cmpl $0x1, %eax
je 0xaf42
cmpl $0x2, %eax
jne 0xaf55
testb $0x2, 0x42(%r12)
movq %r15, %rdi
jne 0xaf4d
cmpl $0x1, %eax
jne 0xaf55
testb $0x2, 0x42(%r12)
movq %r14, %rdi
je 0xaf55
movq %r12, %rsi
callq 0xb3be
movl 0xb4(%r12), %eax
cmpl $0x1, %eax
je 0xaf7a
cmpl $0x2, %eax
jne 0xaf92
testb $0x2, 0xaa(%r12)
movq %r15, %rdi
jne 0xaf88
cmpl $0x1, %eax
jne 0xaf92
testb $0x2, 0xaa(%r12)
movq %r14, %rdi
je 0xaf92
leaq 0x68(%r12), %rsi
callq 0xb3be
movl 0x11c(%r12), %eax
cmpl $0x1, %eax
je 0xafb7
cmpl $0x2, %eax
jne 0xafd2
testb $0x2, 0x112(%r12)
movq %r15, %rdi
jne 0xafc5
cmpl $0x1, %eax
jne 0xafd2
testb $0x2, 0x112(%r12)
movq %r14, %rdi
je 0xafd2
leaq 0xd0(%r12), %rsi
callq 0xb3be
leaq -0x28d(%r12), %rax
addq $-0x9c, %r12
cmpq (%r13), %r12
movq %rax, %r12
jne 0xaf23
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0xaffe
movq %rax, %r12
leaq 0x48(%rbx), %r13
movq %r15, %rdi
callq 0xb2ac
movq %r14, %rdi
callq 0xb2ac
movq %r13, %rdi
callq 0xb2fc
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0xb032
movq 0x40(%rbx), %rsi
subq %rdi, %rsi
callq 0x8170
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0xb047
movq 0x28(%rbx), %rsi
subq %rdi, %rsi
callq 0x8170
movq (%rbx), %rdi
testq %rdi, %rdi
je 0xb05b
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x8170
movq %r12, %rdi
callq 0x8270
nop