bpf: extract __check_reg_arg() utility function