(a) It is an offense for a person to knowingly possess or casually exchange a controlled substance, unless the substance was obtained directly from, or pursuant to, a valid prescription or order of a practitioner while acting in the course of professional practice.
(b) It is an offense for a person to distribute a small amount of marijuana not in excess of one-half (½) ounce (14.175 grams).
(c)

(1) Except as provided in subsections (d) and (e), a violation of this section is a Class A misdemeanor.
(2)

(A) A violation of subsection (a) with respect to any amount of methamphetamine shall be punished by confinement for not less than thirty (30) days, and the person shall serve at least one hundred percent (100%) of the thirty (30) day minimum.
(B)

(i) The thirty (30) day minimum sentence required by subdivision (c)(2)(A) shall not be construed to prohibit a person sentenced pursuant to this subsection (c) from participating in a drug or recovery court that is certified by the department of mental health and substance abuse services or another licensed treatment program.
(ii) Any person participating in such a court or program may receive sentence credit for up to the full thirty (30) day minimum required by subdivision (c)(2)(A).
(iii) For persons sentenced under subdivision (c)(2)(A) with clinical assessment results indicating the need to participate in a drug or recovery court or treatment program, the court shall strongly consider ordering service of the sentence through participation in a drug or recovery court or program permitted under subdivision (c)(2)(B)(i) instead of through confinement, unless the court determines the person is not suitable for, or otherwise cannot participate in, such a court or program.
(d) A violation of subsections (a) or (b), where there is casual exchange to a minor from an adult who is at least two (2) years the minor’s senior, and who knows that the person is a minor, is punished as a felony as provided in § 39-17-417.
(e) A violation under this section is a Class E felony where the person has two (2) or more prior convictions under this section and the current violation involves a Schedule I controlled substance classified as heroin.
(f)

(1) In addition to the other penalties provided in this section, any person convicted of violating this section for possession of a controlled substance may be required to attend a drug offender school, if available, or may be required to perform community service work at a drug or alcohol rehabilitation or treatment center.
(2) Any person required to attend a drug offender school pursuant to this subsection (f) shall also be required to pay a fee for attending the school. If the court determines that the person, by reason of indigency, cannot afford to pay a fee to attend the school, the court shall waive the fee and the person shall attend the school without charge. The amount of fee shall be established by the local governmental authority operating the school, but the fee shall not exceed the fee charged for attending an alcohol safety DUI school program if such a program is available in the jurisdiction. All fees collected pursuant to this subsection (f) shall be used by the governmental authority responsible for administering the school for operation of the school.
(g) Notwithstanding any other subsection to the contrary, a violation of subsection (a) with respect to tianeptine and any salt, sulfate, free acid, or other preparation of tianeptine and any salt, sulfate, free acid, compound, derivative, precursor, or other preparation thereof that is substantially chemically equivalent or identical with tianeptine is a Class A misdemeanor.