+ }
+
+ // 2nd pass over whole .text segment
+ for (ea = inf.minEA; ea != BADADDR; ea = next_head(ea, inf.maxEA))
+ {
+ segment_t *seg = getseg(ea);
+ if (!seg || seg->type != SEG_CODE)
+ break;
+
+ flags_t ea_flags = get_flags_novalue(ea);
+ func = get_func(ea);
+ if (isCode(ea_flags))
+ {
+ if (!decode_insn(ea)) {
+ msg("%x: decode_insn() failed\n", ea);
+ continue;
+ }
+
+ // find non-local branches
+ if ((cmd.itype == NN_jmp || insn_jcc())
+ && cmd.Operands[0].type == o_near)
+ {
+ target_ea = cmd.Operands[0].addr;
+ if (func == NULL)
+ nonlocal_add(target_ea);
+ else {
+ ret = get_func_chunknum(func, target_ea);
+ if (ret != 0) {
+ // a jump to another func or chunk
+ // check if it lands on func start
+ if (!isFunc(get_flags_novalue(target_ea)))
+ nonlocal_add(target_ea);
+ }
+ }
+ }
+ }
+ else { // not code
+ if (func == NULL && isOff0(ea_flags)) {
+ ea_size = get_item_size(ea);
+ for (tmp_ea = 0; tmp_ea < ea_size; tmp_ea += 4)
+ nonlocal_add(get_long(ea + tmp_ea));
+ }
+ }
+ }
+
+ if (nonlocal_bt_cnt > 1) {
+ qsort(nonlocal_bt, nonlocal_bt_cnt,
+ sizeof(nonlocal_bt[0]), nonlocal_bt_cmp);