/*
----------------------------------------------------------------------------
--| BEGIN PROLOGUE
--|
--| CLASSIFICATION: UNCLASSIFIED
--|
--| FILE NAME:      badcoding.c
--|
--| ABSTRACT:
--|   This file contains the functions that do file 1 stuff.
--|   ??? I am really clueless about what to say ???
--|
--| HISTORY:
--|   CCCQ_NAME:
--|   CCCQ_VER: 10/20/2003 ws
--|
--| END PROLOGUE
----------------------------------------------------------------------------
*/

/* LE SV TOC-001 this is a real rocket scientist - will not compile here */
 LogSvEvent((int)3476); /*12/04/2003 23:14:03*/ 

#include "file-1.h"

int function_first () {
 A = B + C;
}

/*
-----------------------------------------------------------------------------
--| NAME:   function_a
--|
--| ABSTRACT:
--|   function a does function stuff.
--| /* LE SV TOC-001 this is a real rocket scientist - will not compile here */
--|
--| RETURNS:
--|   NONE.
--|
----------------------------------------------------------------------------
*/

int A;
int B;
long C;
/* LE SV TOC-001 this is a real rocket scientist - will not compile here */
 LogSvEvent((int)3477); /*12/04/2003 23:14:03*/ 
long D;
double E;
double E;

static void function_a (void)
{

    // uncalled function
    
}

/*
-----------------------------------------------------------------------------
--| NAME:   function_b
--|
--| ABSTRACT:
--|   function b does function stuff.
--|
--| RETURNS:
--|   NONE.
--|
----------------------------------------------------------------------------
*/
static void function_b (void)
{
variable = function_1 + function_2 + function_3;
variable = function_b + function_c + function_d;
    
if (veg)
   // missing curly brace
   variable = orange;

A = B + C;
A = B + C;
A = B + C;

#ifdef LAZY
   // this is not nice
   A = B + C;
   A = B + C;
#endif

A = B + C;
A = B + C;
A = B + C;

if ($stuff > $otherstuff) 
/* LE SV TOC-008 split the if block */
 LogSvEvent((int)3478); /*12/04/2003 23:14:03*/ 
{
   A = B + C;
   A = B + C;
}

A = B + C;
A = B + C;
A = B + C;

if {
   X = Y + Z;
}
else {
   // bad keyword
   halt;
}

A = B + C;
A = B + C;
A = B + C;

    
/* LE SV TOC-002 this is paraphrase of req 2 */
 LogSvEvent((int)3479); /*12/04/2003 23:14:03*/ 
/* LE SV TOC-003 this is paraphrase of req 3 */
 LogSvEvent((int)3480); /*12/04/2003 23:14:03*/ 
    
// TBD - what do I do now
A = B + C;
A = B + C;
A = B + C;

// TBS - I need to figure this out
A = B + C;
A = B + C;
A = B + C;

// ??? go see ws
A = B + C;
A = B + C;
A = B + C;

// (P) this is really important
A = B + C;
A = B + C;
A = B + C;

}

static void function_c (void)
{
// TBD - what do I do now

A = B + C;
A = B + C;
A = B + C;

switch (stuff)
{
   case one:
   {
      run_this;
/* LE S TOC-003 this is paraphrase of 003 - but bad encoding */
/* L SV TOC-004 this is paraphrase of 004 - but bad encoding */
/* LE TOC-005 this is paraphrase of 005 - but bad encoding */
/* SV TOC-006 this is paraphrase of 006 - but bad encoding */
/*  LE SV  TOC-NONE Attempted AUTO COMMENT but not in spec */            // too lazy to paraphrase req
 LogSvEvent((int)3481); /*12/04/2003 23:14:03*/ 
      break;
   }
   case two:
   {
      run_this;
      break;
   }
   // missing default
}

A = B + C;
A = B + C;
A = B + C;

switch (stuff)
{
      case one:
   {
      run_this;
      break;
   }
   case two:
   {
      run_this;
      break;
   }
   default:
   {
      // missing error call
   }
}

A = B + C;
A = B + C;
A = B + C;

switch (stuff)
{
   case:
   case:
   // stacked case statements but only if there is a new line in between

   case:
   case:
   case:
   {
      run_this;
      break;
   }
   default:
   {
      halt;
   }
}

A = B + C;
A = B + C;
A = B + C;

switch (stuff)
{
   case one:
   {
      run_this; 
      // missing break
   }
   case two:
   {
      run_this;
      break;
   }
   default:
   {
      SwError;
/* LE SV TOC-008 we really should log all error calls but NOT HERE */
 LogSvEvent((int)3482); /*12/04/2003 23:14:03*/ 
   }
}

A = B + C;
A = B + C;
A = B + C;

switch (stuff)
{
   case one:
   {
      switch (nested)
      {
         case:
            X = Y + Z;
         case:
            X = Y + Z;
         default:
            SwError;
      } 
   }
   case two:
   {
      run_this;
      break;
   }
   default:
   {
/* LE SV TOC-008 we really should log all error calls */
 LogSvEvent((int)3483); /*12/04/2003 23:14:03*/ 
      SwError;
   }
}

one_huge_line = A + A + A + A + A + A + A + A + A + A + A + A + A + A + A + A + A + A + A + A + A + A + A + A + A + A + A + A + A + A; 

A = B + C;
A = B + C;

// dead code
/* dead_code1 = A * B; */

A = B + C;

// tricky not dead_code 
A = B + C; /* A = A * B; */
   AA = BA + CA; /* AA = AA * BA; */

A = B + C;

/* dead_codes2 = B + C; 
dead_code2 = D + E; 
dead_code2 = F + G; */

A = B + C;

/* 
dead_code3 = B - C; 
dead_code3 = D - E; 
dead_code3 = F - G;
*/

A = B + C;

if ($stuff > $otherstuff) 
/* LE SV TOC-008 we really should log all error calls */
 LogSvEvent((int)3484); /*12/04/2003 23:14:03*/ 
{
   A = B + C;
}
else {
   /* LE SV TOC-008 we really should log all error calls */
 LogSvEvent((int)3485); /*12/04/2003 23:14:03*/ 
   SwError;
}

// recast
A = (int)B + C;
A = B + C;
A = (long)B + C;
A = B + C;
A = (float)B + C;

A = B + C;
A = B + C;
A = B + C;

send_buffer = (U16 *) malloc(size+1);
A = B + C;
A = B + C;

rcv_buffer = (U16 *) alloc(size+1);
A = B + C;
A = B + C;

FreePtr = HmiStringPtr;
free(FreePtr);

A = B + C;

// endless loops
goto error;

A = B + C;
A = B + C;

// endless loops
do forever;

A = B + C;
A = B + C;
A = B + C;

// endless loops
while(1) {
   A = B + C;
   A = B + C;
   A = B + C;
   A = B + C;
}

A = B + C;

#ifdef LAZY
	// this is not nice
	A = B + C;
	A = B + C;
#endif

A = B + C;

A = 0x0001;
A = 0x0002;
A = 0x0003;
A = 0x0004;
A = 0x0006;
A = 0x0007;
A = 0x0008;
A = 0x0009;

}

/*
-----------------------------------------------------------------------------
--| NAME:   function_d
--|
--| ABSTRACT:
--|   function b does function stuff.
--|
--| RETURNS:
--|   NONE.
--|
----------------------------------------------------------------------------
*/

static void function_d (void)
{
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
}

/*
-----------------------------------------------------------------------------
--| NAME:   function_e
--|
--| ABSTRACT:
--|   function b does function stuff.
--|
--| RETURNS:
--|   NONE.
--|
----------------------------------------------------------------------------
*/

static function_e ()
{
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
    this_func_is_way_too_big;
}