#pragma safety enable

struct X {
    int* pi;
};

int* f();
int main(struct X* pX)
{
    if (pX)
    {
        static_state(pX, "not-null");
    }
    else
    {
        static_state(pX, "null");
    }

    if (!pX)
    {
        static_state(pX, "null");
    }
    else
    {
        static_state(pX, "not-null");
    }

    if (pX && pX->pi)
    {
        static_state(pX, "not-null");
        static_state(pX->pi, "not-null");
    }
    else
    {
        static_debug(pX);
        static_state(pX, "not-null null");
        static_state(pX->pi, "not-null null");
    }

    if (pX == 0 || (pX->pi = f()) == 0)
    {
#pragma cake diagnostic check "-Wflow-not-null"

        static_state(pX, "null not-null");
    }
    else
    {
        //static_state(pX, "not-null"); //FAILS only on github windows!? WTF
    }


}
