The piecewise function g(x) is shown in the graph.

Graph with three pieces. The first piece is a horizontal line from the left with an open right endpoint at negative 2 comma negative 1. The second piece is curved with a solid point at negative 1 comma 0, which ends at 1 comma 1. The last piece starts with a solid circle at 0 comma 1 and increases to the right as it passes through 4 comma 5.

Which of the following represents g(x)?

g of x is a piecewise function, which equals negative 2, when x is less than negative 1, and it equals the quantity x plus 1 end quantity squared, when negative 1 is less than or equal to x is less than 0, and it equals x plus 1, when x is greater than or equal to 0.
g of x is a piecewise function, which equals negative 2, when x is less than or equal to negative 1, and it equals the quantity x minus 1 end quantity squared, when negative 1 is less than x is less than 0, and it equals negative x plus 1, when x is greater than 0.
g of x is a piecewise function, which equals negative 2, when x is less than negative 1, and it equals the quantity x minus 1 end quantity squared, when negative 1 is less than or equal to x is less than or equal to 0, and it equals negative x plus 1, when x is greater than 0.
g of x is a piecewise function, which equals negative 2, when x is less than or equal to negative 1, and it equals the quantity x plus 1 end quantity squared, when negative 1 is less than x is less than 0, and it equals x plus 1, when x is greater than or equal to 0.