/* Generated by forth2c, (C) Martin Maierhofer 1994 */ /* size of data space, can be changed ! */ int _C_DATA_SIZE = 8192; #include "forth.h" /* general forth definitions */ #include "forth2c.h" /* forth2c specific definitions */ Char flags[8212]; Char eflag[4]; Cell primes(void) { Cell _c_result; Cell x0; Cell x1; Cell x2; Cell x3; Cell x4; Cell r0; Cell r1; Cell r2; Cell r3; { x0 = (Cell) (&flags[0]); } { /* Literal */ x1 = 8190; } { /* Literal */ x2 = 1; } { /* fill */ UCell u; Char *addr, c; c = (Char) x2; u = (UCell) x1; addr = (Char *) x0; memset(addr, c, u); } { /* Literal */ x0 = 0; } { /* Literal */ x1 = 3; } { x2 = (Cell) (&eflag[0]); } { /* fetch */ Cell *a; a = (Cell *) x2; x2 = *a; } { x3 = (Cell) (&flags[0]); } { /* do */ Cell bound, index; index = x3; bound = x2; r0 = bound; r1 = index; } label0: { /* i */ Cell n = r1; x2 = n; } { /* cfetch */ Char *a; a = (Char *) x2; x2 = (Cell) *a; } if (!x2) goto label1; { /* dup */ Cell n; n = x1; x1 = n; x2 = n; } { /* i */ Cell n = r1; x3 = n; } { /* plus */ Cell n1, n2, n; n1 = x3; n2 = x2; n = n2 + n1; x2 = n; } { /* dup */ Cell n; n = x2; x2 = n; x3 = n; } { x4 = (Cell) (&eflag[0]); } { /* fetch */ Cell *a; a = (Cell *) x4; x4 = *a; } { /* less-than */ Cell n1, n2, n; n1 = x4; n2 = x3; n = FLAG(n2 < n1); x3 = n; } if (!x3) goto label2; { x3 = (Cell) (&eflag[0]); } { /* fetch */ Cell *a; a = (Cell *) x3; x3 = *a; } { /* swap */ Cell n1, n2; n1 = x3; n2 = x2; x2 = n1; x3 = n2; } { /* do */ Cell bound, index; index = x3; bound = x2; r2 = bound; r3 = index; } label3: { /* Literal */ x2 = 0; } { /* i */ Cell n = r3; x3 = n; } { /* cstore */ Char *a; Cell c; a = (Char *) x3; c = (Char) x2; *a = c; } { /* dup */ Cell n; n = x1; x1 = n; x2 = n; } { /* +loop */ Cell step, index, bound; index = r3; bound = r2; step = x2; index += step; if ((step > 0 && index < bound) || (step <= 0 && index >= bound)) { r2 = bound; r3 = index; goto label3; } } { /* unloop */ } goto label4; label2: { /* drop */ } label4: { /* swap */ Cell n1, n2; n1 = x1; n2 = x0; x0 = n1; x1 = n2; } { /* one_plus */ Cell n; n = x1; x1 = n + 1; } { /* swap */ Cell n1, n2; n1 = x1; n2 = x0; x0 = n1; x1 = n2; } label1: { /* Literal */ x2 = 2; } { /* plus */ Cell n1, n2, n; n1 = x2; n2 = x1; n = n2 + n1; x1 = n; } { /* loop */ Cell index, bound; index = r1; bound = r0; index++; if (index != bound) { r0 = bound; r1 = index; goto label0; } } { /* unloop */ } { /* drop */ } { /* exit */ _c_result = x0; return (_c_result); } } Cell benchmark(void) { Cell _c_result; Cell x0; Cell x1; Cell x2; Cell r0; Cell r1; { /* Literal */ x0 = 0; } { /* Literal */ x1 = 1000; } { /* Literal */ x2 = 0; } { /* do */ Cell bound, index; index = x2; bound = x1; r0 = bound; r1 = index; } label0: { Cell _C_locret; _C_locret = primes(); x1 = _C_locret; } { /* nip */ Cell n1, n2; n2 = x1; n1 = x0; x0 = n2; } { /* loop */ Cell index, bound; index = r1; bound = r0; index++; if (index != bound) { r0 = bound; r1 = index; goto label0; } } { /* unloop */ } { /* exit */ _c_result = x0; return (_c_result); } } void main(void) { Cell x0; Cell x1; { x0 = (Cell) (&flags[0]); } { /* Literal */ x1 = 8190; } { /* plus */ Cell n1, n2, n; n1 = x1; n2 = x0; n = n2 + n1; x0 = n; } { x1 = (Cell) (&eflag[0]); } { /* store */ Cell *a, n; a = (Cell *) x1; n = x0; *a = n; } { Cell _C_locret; _C_locret = benchmark(); x0 = _C_locret; } { /* dot */ printf("%d ", x0); fflush(stdout); } { /* exit */ return; } }