/*
 * *************************************************************************************************************
 *
 * *** profile_main
 *
 *    supports SDK_profiling topic cluster
 *
 * Structure of code:
 *    main calls A, B, C, D, and E
 *       C calls C1 and C2
 *       C1 calls C1a and C1b
 *    functions A and E are recursive
 *    function D is a simple return of the argument
 *    All functions contain adjustable delay loops
 *
 * ***
 *
 * History:
 *    V0.1 - 04/28/2017 - WK - initial cut based on structure outlined in lab instructions
 *
 * *************************************************************************************************************
 *
 */

/* includes */
#include <stdio.h>
#include <stdlib.h>
#include "profile.h"

/*** main() ***/
int main(int argc, char* argv[]) {
	// local variables
	int main_loop_index;
	int seed, resultA, resultB, resultC, resultD, resultE;

	// for use with some Terminals that treat /n as /n/r
	//use_only_nl();

	// iterate through the sequence of calls a fixed number of times so that profiler exits w/o user intervention
	for (main_loop_index=0; main_loop_index < 30; main_loop_index++) {

		// spend some time in the main before jumping into the subroutines
		seed = (main_loop_index * 3 + 7) / 2;

		// begin the calls
		resultA = funA(seed);
		resultB = funB(resultA);
		resultC = funC(resultB);
		resultD = funD(resultC);
		resultE = funE(resultD);
	}
	return resultE;					// irrelevant
}

//<copyright-disclaimer-start>
//<copyright-disclaimer-start>
//  **************************************************************************************************************
//  * © 2024 Advanced Micro Devices, Inc. All rights reserved.                                                   *
//  * DISCLAIMER                                                                                                 *
//  * The information contained herein is for informational purposes only, and is subject to change              *
//  * without notice. While every precaution has been taken in the preparation of this document, it              *
//  * may contain technical inaccuracies, omissions and typographical errors, and AMD is under no                *
//  * obligation to update or otherwise correct this information.  Advanced Micro Devices, Inc. makes            *
//  * no representations or warranties with respect to the accuracy or completeness of the contents of           *
//  * this document, and assumes no liability of any kind, including the implied warranties of noninfringement,  *
//  * merchantability or fitness for particular purposes, with respect to the operation or use of AMD            *
//  * hardware, software or other products described herein.  No license, including implied or                   *
//  * arising by estoppel, to any intellectual property rights is granted by this document.  Terms and           *
//  * limitations applicable to the purchase or use of AMD’s products are as set forth in a signed agreement     *
//  * between the parties or in AMD's Standard Terms and Conditions of Sale. GD-18                               *
//  *                                                                                                            *
//  **************************************************************************************************************
//<copyright-disclaimer-end>
//<copyright-disclaimer-end>
