
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
Given an ellipse $C$: $\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1 (a > b > 0)$ with its left focus at $F$ and eccentricity $\frac{1}{2}$. A line intersects the ellipse at points $A$ and $B$. When $AB \perp x$-axis, the perimeter of $\triangle ABF$ reaches its maximum value of $8$.
$(1)$ Find the equation of the ellipse;
$(2)$ If the line passes through point $M(-4,0)$, find the equation of line $AB$ when the area of $\triangle ABF$ is maximized.

Present the answer in LaTex format: \boxed{Your answer}
user