A compound of formula (Ib): or a pharmaceutically acceptable salt thereof for use in treating, preventing, or managing a disorder mediated by an opioid receptor, wherein the disorder is a neurological disorder, pain or diarrhea, wherein X is CH 2, CHCH 3, or C(CH 3) 2; and R 1 is optionally substituted benzimidazolyl; R 2 is optionally substituted phenyl; and each occurrence of R 3 and R 4 is independently (i) hydrogen; or (ii) alkyl, alkenyl, heteroalkyl, cycloalkyl, heterocyclyl, aryl, heteroaryl, aralkyl, or heteroaralkyl, each of which is optionally substituted; or (iii) R 3 and R 4 together with the nitrogen atom to which they are attached form an optionally substituted 3- to 8-membered heterocyclyl or heteroaryl ring; or (iv) one of R 3 and R 4 is OH and the other is hydrogen; wherein optionally substituted means optionally substituted with one or more substituents independently selected from (a) C 1-6 alkyl, C 2-6 alkenyl, C 2-6 alkynyl, C 3-7 cycloalkyl, C 6-14 aryl, C 7-15 aralkyl, heteroaryl, and heterocyclyl; and (b) halo, cyano (-CN), nitro (-NO 2), oxo(=O), -C R a, -C OR a, -C NR b R c, -C(NR a)NR b R c, -OR a, -OC R a, -OC OR a, -OC NR b R c, -OC(=NR a)NR b R c, -OS R a, -OS 2 R a, -OS NR b R c, -OS 2 NR b R c, -NR b R c, -NR a C R d, -NR a C OR d, -NR a C NR b R c, -NR a C(=NR d)NR b R c, -NR a S R d, -NR a S 2 R d, -NR a S NR b R c, -NR a S 2 NR b R c, -SR a, -S R a, -S 2 R a, -S NR b R c, and -S 2 NR b R c, wherein each R a, R b, R c, and R d is independently (i) hydrogen; (ii) C 1-6 alkyl, C 2-6 alkenyl, C 2-6 alkynyl, C 3-7 cycloalkyl, C 6-14 aryl, C 7-15 aralkyl, heteroaryl, or heterocyclyl, wherein each may be substituted with one or more substituents Q 1; or (iii) R b and R c together with the N atom to which they are attached form heteroaryl or heterocyclyl, wherein each may be substituted with one or more substituents Q 1; wherein each Q 1 is independently selected from the group consisting of (a) cyano, halo, oxo, and nitro; and (b) C 1-6 alkyl, C 2-6 alkenyl, C 2-6 alkynyl, C 3-7 cycloalkyl, C 6-14 aryl, C 7-15 aralkyl, heteroaryl, and heterocyclyl; and (c) -C R e, -C OR e, -C NR f R g, -C(NR e)NR f R g, -OR e, -OC R e, -OC OR e, -OC NR f R g, -OC(=NR e)NR f R g, -OS R e, -OS 2 R e, -OS NR f R g, -OS 2 NR f R g, -NR f R g, -NR e C R h, -NR e C OR h, -NR e C NR f R g, - NR e C(=NR h)NR f R g, -NR e S R h, -NR e S 2 R h, -NR e S NR f R g, -NR e S 2 NR f R g, -SR e, -S R e, -S 2 R e, -S NR f R g, and -S 2 NR f R g; wherein each R e, R f, R g, and R h is independently (i) hydrogen; (ii) C 1-6 alkyl, C 2-6 alkenyl, C 2-6 alkynyl, C 3-7 cycloalkyl, C 6-14 aryl, C 7-15 aralkyl, heteroaryl, or heterocyclyl; or (iii) R f and R g together with the N atom to which they are attached form heteroaryl or heterocyclyl; optionally wherein said opioid receptor is a mu opioid receptor. X is CH 2, CHCH 3, or C(CH 3) 2; and R 1 is optionally substituted benzimidazolyl; R 2 is optionally substituted phenyl; and each occurrence of R 3 and R 4 is independently (i) hydrogen; or (ii) alkyl, alkenyl, heteroalkyl, cycloalkyl, heterocyclyl, aryl, heteroaryl, aralkyl, or heteroaralkyl, each of which is optionally substituted; or (iii) R 3 and R 4 together with the nitrogen atom to which they are attached form an optionally substituted 3- to 8-membered heterocyclyl or heteroaryl ring; or (iv) one of R 3 and R 4 is OH and the other is hydrogen; wherein optionally substituted means optionally substituted with one or more substituents independently selected from (a) C 1-6 alkyl, C 2-6 alkenyl, C 2-6 alkynyl, C 3-7 cycloalkyl, C 6-14 aryl, C 7-15 aralkyl, heteroaryl, and heterocyclyl; and (b) halo, cyano (-CN), nitro (-NO 2), oxo(=O), -C R a, -C OR a, -C NR b R c, -C(NR a)NR b R c, -OR a, -OC R a, -OC OR a, -OC NR b R c, -OC(=NR a)NR b R c, -OS R a, -OS 2 R a, -OS NR b R c, -OS 2 NR b R c, -NR b R c, -NR a C R d, -NR a C OR d, -NR a C NR b R c, -NR a C(=NR d)NR b R c, -NR a S R d, -NR a S 2 R d, -NR a S NR b R c, -NR a S 2 NR b R c, -SR a, -S R a, -S 2 R a, -S NR b R c, and -S 2 NR b R c, wherein each R a, R b, R c, and R d is independently (i) hydrogen; (ii) C 1-6 alkyl, C 2-6 alkenyl, C 2-6 alkynyl, C 3-7 cycloalkyl, C 6-14 aryl, C 7-15 aralkyl, heteroaryl, or heterocyclyl, wherein each may be substituted with one or more substituents Q 1; or (iii) R b and R c together with the N atom to which they are attached form heteroaryl or heterocyclyl, wherein each may be substituted with one or more substituents Q 1; wherein each Q 1 is independently selected from the group consisting of (a) cyano, halo, oxo, and nitro; and (b) C 1-6 alkyl, C 2-6 alkenyl, C 2-6 alkynyl, C 3-7 cycloalkyl, C 6-14 aryl, C 7-15 aralkyl, heteroaryl, and heterocyclyl; and (c) -C R e, -C OR e, -C NR f R g, -C(NR e)NR f R g, -OR e, -OC R e, -OC OR e, -OC NR f R g, -OC(=NR e)NR f R g, -OS R e, -OS 2 R e, -OS NR f R g, -OS 2 NR f R g, -NR f R g, -NR e C R h, -NR e C OR h, -NR e C NR f R g, - NR e C(=NR h)NR f R g, -NR e S R h, -NR e S 2 R h, -NR e S NR f R g, -NR e S 2 NR f R g, -SR e, -S R e, -S 2 R e, -S NR f R g, and -S 2 NR f R g; wherein each R e, R f, R g, and R h is independently (i) hydrogen; (ii) C 1-6 alkyl, C 2-6 alkenyl, C 2-6 alkynyl, C 3-7 cycloalkyl, C 6-14 aryl, C 7-15 aralkyl, heteroaryl, or heterocyclyl; or (iii) R f and R g together with the N atom to which they are attached form heteroaryl or heterocyclyl; optionally wherein said opioid receptor is a mu opioid receptor.