// Copyright Contributors to the Open Shading Language project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/AcademySoftwareFoundation/OpenShadingLanguage

shader layer_f_return_in_varying_then_in_uniform_then_in_varying_loop (float f_in = 41,
          color c_in = 42,
          output color c_outb = 0
    )
{    
    int count = 1 + int(P[0]*8);
    
    if (P[1] > 0.6)
    {
        for (int i = 0; i < count; ++i)
        {
            c_outb = color(i/8.0,i/8.0,i/8.0);
            //printf ("i: %d P:%g c:%g\n", i, P, c_outb);
            if (i > 4) 
            {
                if (P[0] > -1000) {
                    return;
                }
            }
        }   
        c_outb = color(f_in);
        printf ("f: f_in = %g, c_in = %g\n", f_in, c_in);
    }
}
