

signed char scGlobalVariable1, scGlobalVariable2, scGlobalVariable3, scGlobalVariable4 ;

extern signed char scGlobalVariableResult ;

void CreateVariableUsage ( void ) ;

void main ( void )
{
    if ( 0 != scGlobalVariable1 )
    {
        scGlobalVariable1 = scGlobalVariable2 + scGlobalVariable3 ;  // Definition - 1
    }

    /*

        Since there is no usage for the signed char global variable
        'scGlobalVariable1' between its first and second definition,
        the compiler can optimize 'Definition - 1' as part of
        Dead variable elimination.
    */

    scGlobalVariable1 = scGlobalVariable3 + scGlobalVariable4 ;      // Definition - 2

    CreateVariableUsage () ;
}

/*
    Some optimizing compiler will eliminate the assignment code of a
    variable when the variable has no further usage after its definition.
    Therefore, to perform complete optimization evaluation, usage of a
    variable has been created in this function.
*/

void CreateVariableUsage ( void )
{
    scGlobalVariableResult = scGlobalVariable1 + scGlobalVariable2 + scGlobalVariable3 + scGlobalVariable4 ;
}
