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

float helper2(float val)
{
    if (P[0] < 1.0/6.0) {        
        return val;
    }
    return 0.5;
}


float helper(float val)
{
    if (P[0] > 1.0/3.0) {        
        return val;
    }
    return helper2(val);
}

shader return_in_then_of_nested_funcs(output float c = 0.0)
{
    c = helper(c);
}
