/* Determine whether a conditional branch instruction would branch.  */
static int __kprobes branch_taken(unsigned int instr, struct pt_regs *regs)
/* Determine whether a conditional branch instruction would branch.  */
static int __kprobes branch_taken(unsigned int instr, struct pt_regs *regs)
{
	unsigned int bo = (instr >> 21) & 0x1f;
	unsigned int bi;
	if ((bo & 4) == 0) {
		--regs->ctr;
		if (((bo >> 1) & 1) ^ (regs->ctr == 0))
			return 0;
	}
	if ((bo & 0x10) == 0) {
		bi = (instr >> 16) & 0x1f;
		if (((regs->ccr >> (31 - bi)) & 1) != ((bo >> 3) & 1))
			return 0;
	}
	return 1;
}