A compound of formula (I') or (I") or a pharmaceutically acceptable salt thereof, wherein x is an integer of from 0 to 4; each R a is independently selected from C1-C3 alkyl; m is 1 or 2; R 1 is C1-C6 alkyl, C3-C6 cycloalkyl, C3-C6 cycloalkyl-C1-C6 alkyl, C1-C6 alkyl-C3-C6 cycloalkyl, C1-C6 alkoxy-C1-C6 alkyl, cyano-C1-C6 alkyl, or a moiety of formula ring A is phenyl or 5- or 6-membered heteroaryl; g is an integer of from 0 to 3; each R 1a is independently selected from C1-C6 alkyl, R 1b O, and R 1c R 1d N; each R 1b is independently selected from H and C1-C6 alkyl; each R 1c is independently selected from H and C1-C6 alkyl; each R 1d is independently selected from H and C1-C6 alkyl; or two R 1a, attached to adjacent atoms of ring A form, together with the atoms to which they are attached, a 5- or 6-membered ring optionally containing one or more heteroatoms; R 2 is Cl or Br; p is an integer of from 0 to 3; each R 3 is independently selected from C1-C6 alkyl; y is an integer of from 0 to 3; R b is selected from halogen, C1-C3 alkyl, and C1-C3 alkoxy; Z is N or CH; W is >Q-R 4, -O- or -N(R 5)C -; Q is N or CH; n is 1 or 2 when W is >Q-R 4 or -O-; n is 0 or 1 when W is -N(R 5)C -; R 4 is C1-C6 alkyl, R 4a [O(CH 2) q] r -Y, R 4b S 2, R 4c C, cyano-C1-C6 alkyl, or a moiety of formula each q is independently selected from 1, 2, 3 and 4; r is 1 or 2; h is an integer of from 0 to 3; Y is a direct bond or C; L is a direct bond, C1-C4 alkylene, or -L 1 -L 2 -; L 1 is a direct bond or C1-C4 alkylene; L 2 is C or NH; R 4a is H or C1-C6 alkyl; R 4b is C1-C6 alkyl; R 4c is C1-C6 alkyl; R 4d is C1-C6 alkyl; ring B is selected from phenyl and 5- or 6-membered heteroaryl; R 5 is H, C1-C6 alkyl, R 5a [O(CH 2) u] v, or a moiety of formula R 5a is H or C1-C6 alkyl; each u is independently selected from 1, 2, 3 and 4; v is 1 or 2; M is a direct bond or C1-C4 alkylene; ring C is selected from phenyl and 5- or 6-membered heteroaryl; R 5b is C1-C6 alkyl; and j is an integer of from 0 to 3. x is an integer of from 0 to 4; each R a is independently selected from C1-C3 alkyl; m is 1 or 2; R 1 is C1-C6 alkyl, C3-C6 cycloalkyl, C3-C6 cycloalkyl-C1-C6 alkyl, C1-C6 alkyl-C3-C6 cycloalkyl, C1-C6 alkoxy-C1-C6 alkyl, cyano-C1-C6 alkyl, or a moiety of formula ring A is phenyl or 5- or 6-membered heteroaryl; g is an integer of from 0 to 3; each R 1a is independently selected from C1-C6 alkyl, R 1b O, and R 1c R 1d N; each R 1b is independently selected from H and C1-C6 alkyl; each R 1c is independently selected from H and C1-C6 alkyl; each R 1d is independently selected from H and C1-C6 alkyl; or two R 1a, attached to adjacent atoms of ring A form, together with the atoms to which they are attached, a 5- or 6-membered ring optionally containing one or more heteroatoms; R 2 is Cl or Br; p is an integer of from 0 to 3; each R 3 is independently selected from C1-C6 alkyl; y is an integer of from 0 to 3; R b is selected from halogen, C1-C3 alkyl, and C1-C3 alkoxy; Z is N or CH; W is >Q-R 4, -O- or -N(R 5)C -; Q is N or CH; n is 1 or 2 when W is >Q-R 4 or -O-; n is 0 or 1 when W is -N(R 5)C -; R 4 is C1-C6 alkyl, R 4a [O(CH 2) q] r -Y, R 4b S 2, R 4c C, cyano-C1-C6 alkyl, or a moiety of formula each q is independently selected from 1, 2, 3 and 4; r is 1 or 2; h is an integer of from 0 to 3; Y is a direct bond or C; L is a direct bond, C1-C4 alkylene, or -L 1 -L 2 -; L 1 is a direct bond or C1-C4 alkylene; L 2 is C or NH; R 4a is H or C1-C6 alkyl; R 4b is C1-C6 alkyl; R 4c is C1-C6 alkyl; R 4d is C1-C6 alkyl; ring B is selected from phenyl and 5- or 6-membered heteroaryl; R 5 is H, C1-C6 alkyl, R 5a [O(CH 2) u] v, or a moiety of formula R 5a is H or C1-C6 alkyl; each u is independently selected from 1, 2, 3 and 4; v is 1 or 2; M is a direct bond or C1-C4 alkylene; ring C is selected from phenyl and 5- or 6-membered heteroaryl; R 5b is C1-C6 alkyl; and j is an integer of from 0 to 3.