/* This program is part of the TACLeBench benchmark suite. Version V 1.9 Name: deg2rad Author: unknown Function: deg2rad performs conversion of degree to radiant Source: MiBench http://wwweb.eecs.umich.edu/mibench Original name: basicmath_small Changes: no major functional changes License: this code is FREE with no restrictions */ #include "pi.h" // Wasm loop bounds __attribute__((import_module("__pragma"), import_name("loopbound"))) extern void __pragma_loopbound(unsigned int min_bound, unsigned int max_bound); #define deg2rad(d) ((d) * PI / 180) /* Forward declaration of functions */ __attribute__((always_inline)) static inline void deg2rad_init(void); __attribute__((noinline)) __attribute__((export_name("entrypoint"))) __attribute__((noinline)) __attribute__((export_name("entrypoint"))) void deg2rad_main(void); __attribute__((always_inline)) static inline int deg2rad_return(void); __attribute__((noinline)) __attribute__((export_name("main"))) __attribute__((noinline)) __attribute__((export_name("main"))) int main(void); /* Declaration of global variables */ float deg2rad_X, deg2rad_Y; /* Initialization function */ __attribute__((always_inline)) static inline void deg2rad_init(void) { deg2rad_X = 0; deg2rad_Y = 0; } /* Return function */ __attribute__((always_inline)) static inline int deg2rad_return(void) { int temp = deg2rad_Y; if (temp == 1133) return 0; else return -1; } /* Main functions */ __attribute__((noinline)) __attribute__((export_name("entrypoint"))) __attribute__((noinline)) __attribute__((export_name("entrypoint"))) void deg2rad_main(void) { /* convert some rads to degrees */ __pragma_loopbound(361, 361); for (deg2rad_X = 0.0f; deg2rad_X <= 360.0f; deg2rad_X += 1.0f) deg2rad_Y += deg2rad(deg2rad_X); } __attribute__((noinline)) __attribute__((export_name("main"))) __attribute__((noinline)) __attribute__((export_name("main"))) int main(void) { deg2rad_init(); deg2rad_main(); return deg2rad_return(); }