#include <perms.h>

                                                                //      1  ! IMP80 TO DO: %realslong
                                                                //      2  !              %else %if <cond> without the finish/start
                                                                //      3  ! - report to Bob if wrong.
                                                                //      4  ! Is .001 valid syntax in Imp or does it have to be 0.001?
                                                                //      5  
                                                                //      6  ! Translation of
                                                                //      7  ! <http://www.cs.brandeis.edu/~storer/LunarLander/LunarLander/LunarLanderListing.jpg>
                                                                //      8  ! by Jim Storer from FOCAL to C and then to Imp by gtoal#gtoal.com
                                                                //      9  ! C version is at https://raw.githubusercontent.com/ericeche/lunarlanderc/main/lunarlander.c
                                                                //     10  
                                                                //     11  %begin
#line 11 "regression-bugs-tmp/lunarlander.imp"
int main(int argc, char **argv) {
  __label__ _imp_endofblock;
  _imp_initialise(argc, argv);
                                                                //     12  
                                                                //     13  !%external %string (255) %fn %spec cli param
                                                                //     14  !%external %routine %spec readline(%string(255)%name B)
                                                                //     15  !%external %routine %spec print(%longreal R, %integer B, A)
                                                                //     16  !%external %integer %fn %spec int pt(%longreal R)
                                                                //     17  !%external %longreal %fn %spec frac pt(%longreal R)
                                                                //     18  !%external %longreal %fn %spec sqrt(%longreal R)
                                                                //     19  
                                                                //     20  %const %integer TRUE = 1, FALSE = 0
_imp_current_line = 20; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
                                                                //     21  
                                                                //     22  ! Global variables
                                                                //     23  !
                                                                //     24  ! A - Altitude (miles)
                                                                //     25  ! G - Gravity
                                                                //     26  ! I - Intermediate altitude (miles)
                                                                //     27  ! J - Intermediate velocity (miles/sec)
                                                                //     28  ! K - Fuel rate (lbs/sec)
                                                                //     29  ! L - Elapsed time (sec)
                                                                //     30  ! M - Total weight (lbs)
                                                                //     31  ! N - Empty weight (lbs, Note: M - N is remaining fuel weight)
                                                                //     32  ! S - Time elapsed in current 10-second turn (sec)
                                                                //     33  ! T - Time remaining in current 10-second turn (sec)
                                                                //     34  ! V - Downward speed (miles/sec)
                                                                //     35  ! W - Temporary working variable
                                                                //     36  ! Z - Thrust per pound of fuel burned
                                                                //     37  
                                                                //     38  %own %longreal A, G, I, J, K, L, M, N, S, T, V, W, Z;
_imp_current_line = 38; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 38 "regression-bugs-tmp/lunarlander.imp"
static double A;
#line 38 "regression-bugs-tmp/lunarlander.imp"
static double G;
#line 38 "regression-bugs-tmp/lunarlander.imp"
static double I;
#line 38 "regression-bugs-tmp/lunarlander.imp"
static double J;
#line 38 "regression-bugs-tmp/lunarlander.imp"
static double K;
#line 38 "regression-bugs-tmp/lunarlander.imp"
static double L;
#line 38 "regression-bugs-tmp/lunarlander.imp"
static double M;
#line 38 "regression-bugs-tmp/lunarlander.imp"
static double N;
#line 38 "regression-bugs-tmp/lunarlander.imp"
static double S;
#line 38 "regression-bugs-tmp/lunarlander.imp"
static double T;
#line 38 "regression-bugs-tmp/lunarlander.imp"
static double V;
#line 38 "regression-bugs-tmp/lunarlander.imp"
static double W;
#line 38 "regression-bugs-tmp/lunarlander.imp"
static double Z;
                                                                //     39  
                                                                //     40  %own %integer echo input = 0
_imp_current_line = 40; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 40 "regression-bugs-tmp/lunarlander.imp"
static int ECHOINPUT = 0;
                                                                //     41  
                                                                //     42  %routinespec update lander state
_imp_current_line = 42; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 42 "regression-bugs-tmp/lunarlander.imp"
auto void UPDATELANDERSTATE( void );
                                                                //     43  %routinespec apply thrust
_imp_current_line = 43; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 43 "regression-bugs-tmp/lunarlander.imp"
auto void APPLYTHRUST( void );
                                                                //     44  
                                                                //     45  ! Input routines (substitutes for FOCAL ACCEPT command)
                                                                //     46  %integerfnspec accept real(%longrealname value);
_imp_current_line = 46; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 46 "regression-bugs-tmp/lunarlander.imp"
auto int ACCEPTREAL( double /*name*/*VALUE );
                                                                //     47  %integerfnspec accept yes or no
_imp_current_line = 47; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 47 "regression-bugs-tmp/lunarlander.imp"
auto int ACCEPTYESORNO( void );
                                                                //     48  %routinespec accept line(%string(*)%name buffer, %integername buffer length)
_imp_current_line = 48; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 48 "regression-bugs-tmp/lunarlander.imp"
auto void ACCEPTLINE( _imp_string /*%string(255)*/ /*name*/*BUFFER, int /*name*/*BUFFERLENGTH );
                                                                //     49  
                                                                //     50      ! If --echo is present, then write all input back to standard output.
                                                                //     51      ! (This is useful for testing with files as redirected input.)
                                                                //     52      echo input = 1 %if cliparam = "--echo"
_imp_current_line = 52; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 52 "regression-bugs-tmp/lunarlander.imp"
if ((_imp_strcmp(_imp_CLIPARAM(), _imp_str_literal("--echo")) != 0)) goto L_0002;
#line 52 "regression-bugs-tmp/lunarlander.imp"
ECHOINPUT = 1;
#line 52 "regression-bugs-tmp/lunarlander.imp"
L_0002:;
                                                                //     53  
                                                                //     54      printstring("CONTROL CALLING LUNAR MODULE. MANUAL CONTROL IS NECESSARY"); newline
_imp_current_line = 54; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 54 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("CONTROL CALLING LUNAR MODULE. MANUAL CONTROL IS NECESSARY"));
_imp_current_line = 54; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 54 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINE();
                                                                //     55      printstring("YOU MAY RESET FUEL RATE K EACH 10 SECS TO 0 OR ANY VALUE"); newline
_imp_current_line = 55; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 55 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("YOU MAY RESET FUEL RATE K EACH 10 SECS TO 0 OR ANY VALUE"));
_imp_current_line = 55; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 55 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINE();
                                                                //     56      printstring("BETWEEN 8 & 200 LBS/SEC. YOU'VE 16000 LBS FUEL. ESTIMATED"); newline
_imp_current_line = 56; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 56 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("BETWEEN 8 & 200 LBS/SEC. YOU'VE 16000 LBS FUEL. ESTIMATED"));
_imp_current_line = 56; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 56 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINE();
                                                                //     57      printstring("FREE FALL IMPACT TIME-120 SECS. CAPSULE WEIGHT-32500 LBS"); newlines(3)
_imp_current_line = 57; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 57 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("FREE FALL IMPACT TIME-120 SECS. CAPSULE WEIGHT-32500 LBS"));
_imp_current_line = 57; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 57 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINES(3);
                                                                //     58      
                                                                //     59      %cycle ;! 01.20 in original FOCAL code
_imp_current_line = 59; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 59 "regression-bugs-tmp/lunarlander.imp"
L_0003:;
                                                                //     60          printstring("FIRST RADAR CHECK COMING UP"); newlines(3)
_imp_current_line = 60; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 60 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("FIRST RADAR CHECK COMING UP"));
_imp_current_line = 60; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 60 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINES(3);
                                                                //     61          printstring("COMMENCE LANDING PROCEDURE"); newline
_imp_current_line = 61; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 61 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("COMMENCE LANDING PROCEDURE"));
_imp_current_line = 61; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 61 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINE();
                                                                //     62          printstring("TIME,SECS   ALTITUDE,MILES+FEET   VELOCITY,MPH   FUEL,LBS   FUEL RATE"); newline
_imp_current_line = 62; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 62 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("TIME,SECS   ALTITUDE,MILES+FEET   VELOCITY,MPH   FUEL,LBS   FUEL RATE"));
_imp_current_line = 62; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 62 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINE();
                                                                //     63  
                                                                //     64          A = 120
_imp_current_line = 64; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 64 "regression-bugs-tmp/lunarlander.imp"
A = 120;
                                                                //     65          V = 1
_imp_current_line = 65; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 65 "regression-bugs-tmp/lunarlander.imp"
V = 1;
                                                                //     66          M = 32500
_imp_current_line = 66; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 66 "regression-bugs-tmp/lunarlander.imp"
M = 32500;
                                                                //     67          N = 16500
_imp_current_line = 67; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 67 "regression-bugs-tmp/lunarlander.imp"
N = 16500;
                                                                //     68          G = 0.001
_imp_current_line = 68; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 68 "regression-bugs-tmp/lunarlander.imp"
G = 0.001;
                                                                //     69          Z = 1.8
_imp_current_line = 69; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 69 "regression-bugs-tmp/lunarlander.imp"
Z = 1.8;
                                                                //     70          L = 0
_imp_current_line = 70; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 70 "regression-bugs-tmp/lunarlander.imp"
L = 0;
                                                                //     71  
                                                                //     72      start turn: ;! 02.10 in original FOCAL code
_imp_current_line = 72; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 72 "regression-bugs-tmp/lunarlander.imp"
U_1000:;
                                                                //     73          print(L, 7, 0)
_imp_current_line = 73; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 73 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINT(L, 7, 0);
                                                                //     74          print(int pt(A), 16, 0)  { note integer being automatically converted to longreal - c would require (double) cast except that C's trunc() returns a double }
_imp_current_line = 74; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 74 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINT(_imp_INTPT(A), 16, 0);
/*promote*/                                                                //     75          print(5280 * frac pt(A), 7, 0)
_imp_current_line = 75; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 75 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINT((((double)(5280)) * (_imp_FRACPT(A))), 7, 0);
/*promote*/                                                                //     76          print(3600 * V, 15, 2)
_imp_current_line = 76; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 76 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINT((((double)(3600)) * (V)), 15, 2);
                                                                //     77          print(M - N, 12, 1)
_imp_current_line = 77; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 77 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINT((((double)(M)) - (N)), 12, 1);
                                                                //     78          spaces(6)
_imp_current_line = 78; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 78 "regression-bugs-tmp/lunarlander.imp"
_imp_SPACES(6);
                                                                //     79          
                                                                //     80      prompt for k:
_imp_current_line = 80; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 80 "regression-bugs-tmp/lunarlander.imp"
U_1001:;
                                                                //     81          prompt("K=:")
_imp_current_line = 81; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 81 "regression-bugs-tmp/lunarlander.imp"
_imp_PROMPT(_imp_str_literal("K=:"));
                                                                //     82          %integer is valid input
_imp_current_line = 82; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 82 "regression-bugs-tmp/lunarlander.imp"
int ISVALIDINPUT;
                                                                //     83          is valid input = accept real(K)
_imp_current_line = 83; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 83 "regression-bugs-tmp/lunarlander.imp"
ISVALIDINPUT = ACCEPTREAL(&K);
                                                                //     84          %if is valid input # TRUE %or K < 0 %or 0 < K < 8 %or K > 200 %start
_imp_current_line = 84; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 84 "regression-bugs-tmp/lunarlander.imp"
if (((ISVALIDINPUT) != (1))) goto L_0006;
#line 84 "regression-bugs-tmp/lunarlander.imp"
if (((K) < (0))) goto L_0006;
#line 84 "regression-bugs-tmp/lunarlander.imp"
if ((((0) >= (K))) || (((K) < (8)))) goto L_0006;
#line 84 "regression-bugs-tmp/lunarlander.imp"
L_0007:;
#line 84 "regression-bugs-tmp/lunarlander.imp"
if (((K) <= (200))) goto L_0008;
#line 84 "regression-bugs-tmp/lunarlander.imp"
L_0006:;
                                                                //     85              %integer x
_imp_current_line = 85; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 85 "regression-bugs-tmp/lunarlander.imp"
int X;
                                                                //     86              printstring("NOT POSSIBLE"); newline
_imp_current_line = 86; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 86 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("NOT POSSIBLE"));
_imp_current_line = 86; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 86 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINE();
                                                                //     87              printsymbol('.') %for x = 1, 1, 51
_imp_current_line = 87; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 87 "regression-bugs-tmp/lunarlander.imp"
X = 0;
if ((((51)-(1)) % (1)) != 0) _imp_signal(5,1,0,"Illegal cycle X = 1, 1, 51");
L_0009:;
if (X == 51) goto L_000a;
X += 1;
#line 87 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSYMBOL(46);
#line 87 "regression-bugs-tmp/lunarlander.imp"
goto L_0009;
#line 87 "regression-bugs-tmp/lunarlander.imp"
L_000a:;
                                                                //     88              -> prompt for k
_imp_current_line = 88; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 88 "regression-bugs-tmp/lunarlander.imp"
goto U_1001;
                                                                //     89          %finish
_imp_current_line = 89; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 89 "regression-bugs-tmp/lunarlander.imp"
L_0008:;
                                                                //     90  
                                                                //     91          T = 10
_imp_current_line = 91; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 91 "regression-bugs-tmp/lunarlander.imp"
T = 10;
                                                                //     92  
                                                                //     93      turn loop:
_imp_current_line = 93; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 93 "regression-bugs-tmp/lunarlander.imp"
U_1002:;
                                                                //     94          ! 03.10 in original FOCAL code
                                                                //     95          %cycle
_imp_current_line = 95; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 95 "regression-bugs-tmp/lunarlander.imp"
L_000c:;
                                                                //     96              -> fuel out %if M - N < 0.001
_imp_current_line = 96; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 96 "regression-bugs-tmp/lunarlander.imp"
if ((((((double)(M)) - (N))) >= (0.001))) goto L_000f;
#line 96 "regression-bugs-tmp/lunarlander.imp"
goto U_1003;
#line 96 "regression-bugs-tmp/lunarlander.imp"
L_000f:;
                                                                //     97              -> start turn %if T < 0.001
_imp_current_line = 97; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 97 "regression-bugs-tmp/lunarlander.imp"
if (((T) >= (0.001))) goto L_0010;
#line 97 "regression-bugs-tmp/lunarlander.imp"
goto U_1000;
#line 97 "regression-bugs-tmp/lunarlander.imp"
L_0010:;
                                                                //     98              S = T
_imp_current_line = 98; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 98 "regression-bugs-tmp/lunarlander.imp"
S = T;
                                                                //     99              S = (M - N) / K %if N + S * K - M > 0
_imp_current_line = 99; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 99 "regression-bugs-tmp/lunarlander.imp"
if ((((((double)(((N) + ((double)((((double)(S)) * (K))))))) - (M))) <= (0))) goto L_0011;
#line 99 "regression-bugs-tmp/lunarlander.imp"
S = (double)((double)(((((double)(M)) - (N)))) / (double)((double)(K)));
#line 99 "regression-bugs-tmp/lunarlander.imp"
L_0011:;
                                                                //    100              apply thrust
_imp_current_line = 100; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 100 "regression-bugs-tmp/lunarlander.imp"
APPLYTHRUST();
                                                                //    101              %exit %if I <= 0
_imp_current_line = 101; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 101 "regression-bugs-tmp/lunarlander.imp"
if (((I) > (0))) goto L_0012;
#line 101 "regression-bugs-tmp/lunarlander.imp"
goto L_000d;
#line 101 "regression-bugs-tmp/lunarlander.imp"
L_0012:;
                                                                //    102              %if V > 0 %and J < 0 %start
_imp_current_line = 102; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 102 "regression-bugs-tmp/lunarlander.imp"
if (((V) <= (0))) goto L_0013;
#line 102 "regression-bugs-tmp/lunarlander.imp"
if (((J) >= (0))) goto L_0013;
                                                                //    103                  %longreal ZZZ,QQQ,RRR
_imp_current_line = 103; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 103 "regression-bugs-tmp/lunarlander.imp"
double ZZZ;
#line 103 "regression-bugs-tmp/lunarlander.imp"
double QQQ;
#line 103 "regression-bugs-tmp/lunarlander.imp"
double RRR;
                                                                //    104                  ! 08.10 in original FOCAL code
                                                                //    105                  %cycle
_imp_current_line = 105; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 105 "regression-bugs-tmp/lunarlander.imp"
L_0014:;
                                                                //    106                      ! FOCAL-to-C gotcha: In FOCAL, multiplication has a higher
                                                                //    107                      ! precedence than division.  In C, they have the same
                                                                //    108                      ! precedence and are evaluated left-to-right.  So the
                                                                //    109                      ! original FOCAL subexpression `M * G / Z * K` can''t be
                                                                //    110                      ! copied as-is into C: `Z * K` has to be parenthesized to
                                                                //    111                      ! get the same result.
                                                                //    112  
                                                                //    113                      W = (1 - M * G / (Z * K)) / 2
_imp_current_line = 113; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 113 "regression-bugs-tmp/lunarlander.imp"
W = (double)((double)((((1) - (((double)((double)(((((double)(M)) * (G)))) / (double)(((((double)(Z)) * (K)))))))))) / (double)((float)(2)));
/*promote*/                                                                //    114                      S = M * V / (Z * K * (W + sqrt(W * W + V / (2 * Z))))
_imp_current_line = 114; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 114 "regression-bugs-tmp/lunarlander.imp"
S = (double)((double)(((((double)(M)) * (V)))) / (double)((((((((double)(Z)) * (K)))) * ((((double)(W)) + (_imp_SQRT((((((double)(W)) * (W))) + (((double)((double)((double)(V)) / (double)(((((double)(2)) * (Z))))))))))))))));
                                                                //    115                      apply thrust
_imp_current_line = 115; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 115 "regression-bugs-tmp/lunarlander.imp"
APPLYTHRUST();
                                                                //    116                      -> loop until on the moon %if I <= 0
_imp_current_line = 116; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 116 "regression-bugs-tmp/lunarlander.imp"
if (((I) > (0))) goto L_0017;
#line 116 "regression-bugs-tmp/lunarlander.imp"
goto U_1004;
#line 116 "regression-bugs-tmp/lunarlander.imp"
L_0017:;
                                                                //    117                      update lander state
_imp_current_line = 117; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 117 "regression-bugs-tmp/lunarlander.imp"
UPDATELANDERSTATE();
                                                                //    118                      -> turn loop %if -J < 0 %or V <= 0
_imp_current_line = 118; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 118 "regression-bugs-tmp/lunarlander.imp"
if ((((-(J))) < (0))) goto L_0018;
#line 118 "regression-bugs-tmp/lunarlander.imp"
if (((V) > (0))) goto L_0019;
#line 118 "regression-bugs-tmp/lunarlander.imp"
L_0018:;
#line 118 "regression-bugs-tmp/lunarlander.imp"
goto U_1002;
#line 118 "regression-bugs-tmp/lunarlander.imp"
L_0019:;
                                                                //    119                  %repeat
_imp_current_line = 119; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 119 "regression-bugs-tmp/lunarlander.imp"
goto L_0014;
                                                                //    120              %finish
_imp_current_line = 120; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 120 "regression-bugs-tmp/lunarlander.imp"
L_0013:;
                                                                //    121              update lander state
_imp_current_line = 121; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 121 "regression-bugs-tmp/lunarlander.imp"
UPDATELANDERSTATE();
                                                                //    122          %repeat
_imp_current_line = 122; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 122 "regression-bugs-tmp/lunarlander.imp"
goto L_000c;
#line 122 "regression-bugs-tmp/lunarlander.imp"
L_000d:;
                                                                //    123  
                                                                //    124      loop until on the moon: ;! 07.10 in original FOCAL code
_imp_current_line = 124; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 124 "regression-bugs-tmp/lunarlander.imp"
U_1004:;
                                                                //    125          %while S >= 0.005 %cycle
_imp_current_line = 125; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 125 "regression-bugs-tmp/lunarlander.imp"
L_001a:;
#line 125 "regression-bugs-tmp/lunarlander.imp"
if (((S) < (0.005))) goto L_001b;
/*promote*//*promote*//*Warning: potential loss of precision converting from integer AST_BINOP ((((double)(2)) * (A)) - 0 bytes) to real AST_BINOP (((G) - (((double)((double)(((((double)(Z)) * (K)))) / (double)((double)(M)))))) - 0 bytes) detected at ast.c line 108 */
/*Warning: potential loss of precision converting from integer AST_BINOP (((((((double)(2)) * (A)))) * (((G) - (((double)((double)(((((double)(Z)) * (K)))) / (double)((double)(M)))))))) - 0 bytes) to real AST_BINOP ((((double)(V)) * (V)) - 0 bytes) detected at ast.c line 108 */
                                                                //    126              S = 2 * A / (V + sqrt(V * V + 2 * A * (G - Z * K / M)))
_imp_current_line = 126; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 126 "regression-bugs-tmp/lunarlander.imp"
S = (double)((double)(((((double)(2)) * (A)))) / (double)(((((double)(V)) + (_imp_SQRT((((((double)(V)) * (V))) + ((((((((double)(2)) * (A)))) * (((G) - (((double)((double)(((((double)(Z)) * (K)))) / (double)((double)(M)))))))))))))))));
                                                                //    127              apply thrust
_imp_current_line = 127; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 127 "regression-bugs-tmp/lunarlander.imp"
APPLYTHRUST();
                                                                //    128              update lander state
_imp_current_line = 128; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 128 "regression-bugs-tmp/lunarlander.imp"
UPDATELANDERSTATE();
                                                                //    129          %repeat
_imp_current_line = 129; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 129 "regression-bugs-tmp/lunarlander.imp"
goto L_001a;
#line 129 "regression-bugs-tmp/lunarlander.imp"
L_001b:;
                                                                //    130          -> on the moon
_imp_current_line = 130; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 130 "regression-bugs-tmp/lunarlander.imp"
goto U_1005;
                                                                //    131  
                                                                //    132      fuel out: ;! 04.10 in original FOCAL code
_imp_current_line = 132; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 132 "regression-bugs-tmp/lunarlander.imp"
U_1003:;
                                                                //    133          printstring("FUEL OUT AT ")
_imp_current_line = 133; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 133 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("FUEL OUT AT "));
                                                                //    134          print(L, 8, 2)
_imp_current_line = 134; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 134 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINT(L, 8, 2);
                                                                //    135          printstring("SECS"); newline
_imp_current_line = 135; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 135 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("SECS"));
_imp_current_line = 135; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 135 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINE();
/*promote*//*promote*//*Warning: potential loss of precision converting from integer AST_BINOP ((((double)((((double)(2)) * (A)))) * (G)) - 0 bytes) to real AST_BINOP ((((double)(V)) * (V)) - 0 bytes) detected at ast.c line 108 */
                                                                //    136          S = (sqrt(V * V + 2 * A * G) - V) / G
_imp_current_line = 136; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 136 "regression-bugs-tmp/lunarlander.imp"
S = (double)((double)(((((double)(_imp_SQRT((((((double)(V)) * (V))) + (((((double)((((double)(2)) * (A)))) * (G)))))))) - (V)))) / (double)((double)(G)));
                                                                //    137          V = V + G * S
_imp_current_line = 137; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 137 "regression-bugs-tmp/lunarlander.imp"
V = ((V) + ((double)((((double)(G)) * (S)))));
                                                                //    138          L = L + S
_imp_current_line = 138; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 138 "regression-bugs-tmp/lunarlander.imp"
L = (((double)(L)) + (S));
                                                                //    139  
                                                                //    140      on the moon: ;! 05.10 in original FOCAL code
_imp_current_line = 140; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 140 "regression-bugs-tmp/lunarlander.imp"
U_1005:;
                                                                //    141          printstring("ON THE MOON AT ")
_imp_current_line = 141; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 141 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("ON THE MOON AT "));
                                                                //    142          print(L, 8, 2)
_imp_current_line = 142; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 142 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINT(L, 8, 2);
                                                                //    143          printstring(" SECS"); newline
_imp_current_line = 143; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 143 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal(" SECS"));
_imp_current_line = 143; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 143 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINE();
/*promote*/                                                                //    144          W = 3600 * V
_imp_current_line = 144; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 144 "regression-bugs-tmp/lunarlander.imp"
W = (((double)(3600)) * (V));
                                                                //    145          printstring("IMPACT VELOCITY OF ")
_imp_current_line = 145; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 145 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("IMPACT VELOCITY OF "));
                                                                //    146          print(W, 8, 2)
_imp_current_line = 146; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 146 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINT(W, 8, 2);
                                                                //    147          printstring(" M.P.H."); newline
_imp_current_line = 147; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 147 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal(" M.P.H."));
_imp_current_line = 147; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 147 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINE();
                                                                //    148          printstring("FUEL LEFT: ")
_imp_current_line = 148; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 148 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("FUEL LEFT: "));
                                                                //    149          print(M - N, 8, 2)
_imp_current_line = 149; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 149 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINT((((double)(M)) - (N)), 8, 2);
                                                                //    150          printstring(" LBS"); newline
_imp_current_line = 150; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 150 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal(" LBS"));
_imp_current_line = 150; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 150 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINE();
                                                                //    151          %if W <= 1 %start
_imp_current_line = 151; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 151 "regression-bugs-tmp/lunarlander.imp"
if (((W) > (1))) goto L_001d;
                                                                //    152              printstring("PERFECT LANDING !-(LUCKY); newline")
_imp_current_line = 152; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 152 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("PERFECT LANDING !-(LUCKY); newline"));
                                                                //    153          %finish %else %if W <= 10 %start
_imp_current_line = 153; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 153 "regression-bugs-tmp/lunarlander.imp"
goto L_001e;
#line 153 "regression-bugs-tmp/lunarlander.imp"
L_001d:;
#line 153 "regression-bugs-tmp/lunarlander.imp"
if (((W) > (10))) goto L_001f;
                                                                //    154              printstring("GOOD LANDING-(COULD BE BETTER); newline")
_imp_current_line = 154; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 154 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("GOOD LANDING-(COULD BE BETTER); newline"));
                                                                //    155          %finish %else %if W <= 22 %start
_imp_current_line = 155; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 155 "regression-bugs-tmp/lunarlander.imp"
goto L_001e;
#line 155 "regression-bugs-tmp/lunarlander.imp"
L_001f:;
#line 155 "regression-bugs-tmp/lunarlander.imp"
if (((W) > (22))) goto L_0020;
                                                                //    156              printstring("CONGRATULATIONS ON A POOR LANDING"); newline
_imp_current_line = 156; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 156 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("CONGRATULATIONS ON A POOR LANDING"));
_imp_current_line = 156; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 156 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINE();
                                                                //    157          %finish %else %if W <= 40 %start
_imp_current_line = 157; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 157 "regression-bugs-tmp/lunarlander.imp"
goto L_001e;
#line 157 "regression-bugs-tmp/lunarlander.imp"
L_0020:;
#line 157 "regression-bugs-tmp/lunarlander.imp"
if (((W) > (40))) goto L_0021;
                                                                //    158              printstring("CRAFT DAMAGE. GOOD LUCK"); newline
_imp_current_line = 158; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 158 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("CRAFT DAMAGE. GOOD LUCK"));
_imp_current_line = 158; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 158 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINE();
                                                                //    159          %finish %else %if W <= 60 %start
_imp_current_line = 159; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 159 "regression-bugs-tmp/lunarlander.imp"
goto L_001e;
#line 159 "regression-bugs-tmp/lunarlander.imp"
L_0021:;
#line 159 "regression-bugs-tmp/lunarlander.imp"
if (((W) > (60))) goto L_0022;
                                                                //    160              printstring("CRASH LANDING-YOU'VE 5 HRS OXYGEN"); newline
_imp_current_line = 160; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 160 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("CRASH LANDING-YOU'VE 5 HRS OXYGEN"));
_imp_current_line = 160; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 160 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINE();
                                                                //    161          %finish %else %start
_imp_current_line = 161; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 161 "regression-bugs-tmp/lunarlander.imp"
goto L_001e;
#line 161 "regression-bugs-tmp/lunarlander.imp"
L_0022:;
                                                                //    162              printstring("SORRY,BUT THERE WERE NO SURVIVORS-YOU BLEW IT!"); newline
_imp_current_line = 162; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 162 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("SORRY,BUT THERE WERE NO SURVIVORS-YOU BLEW IT!"));
_imp_current_line = 162; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 162 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINE();
                                                                //    163              printstring("IN FACT YOU BLASTED A NEW LUNAR CRATER ")
_imp_current_line = 163; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 163 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("IN FACT YOU BLASTED A NEW LUNAR CRATER "));
                                                                //    164              print(W * 0.277777, 8, 2)
_imp_current_line = 164; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 164 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINT((((double)(W)) * (0.277777)), 8, 2);
                                                                //    165              printstring(" FT. DEEP"); newline
_imp_current_line = 165; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 165 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal(" FT. DEEP"));
_imp_current_line = 165; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 165 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINE();
                                                                //    166          %finish
_imp_current_line = 166; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 166 "regression-bugs-tmp/lunarlander.imp"
L_001e:;
                                                                //    167  
                                                                //    168          newlines(3)
_imp_current_line = 168; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 168 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINES(3);
                                                                //    169          prompt("TRY AGAIN?")
_imp_current_line = 169; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 169 "regression-bugs-tmp/lunarlander.imp"
_imp_PROMPT(_imp_str_literal("TRY AGAIN?"));
                                                                //    170      %repeat %until %not accept yes or no = TRUE
_imp_current_line = 170; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 170 "regression-bugs-tmp/lunarlander.imp"
if (((ACCEPTYESORNO()) != (1))) goto L_0004;
#line 170 "regression-bugs-tmp/lunarlander.imp"
goto L_0003;
#line 170 "regression-bugs-tmp/lunarlander.imp"
L_0004:;
                                                                //    171  
                                                                //    172      printstring("CONTROL OUT"); newlines(3)
_imp_current_line = 172; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 172 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("CONTROL OUT"));
_imp_current_line = 172; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 172 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINES(3);
                                                                //    173      
                                                                //    174      %stop
_imp_current_line = 174; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 174 "regression-bugs-tmp/lunarlander.imp"
exit(0);
                                                                //    175  
                                                                //    176  
                                                                //    177  ! Subroutine at line 06.10 in original FOCAL code
                                                                //    178  %routine update lander state
_imp_current_line = 178; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 178 "regression-bugs-tmp/lunarlander.imp"
void UPDATELANDERSTATE( void )
#line 178 "regression-bugs-tmp/lunarlander.imp"
{
  __label__ _imp_endofblock;
                                                                //    179      L = L + S
_imp_current_line = 179; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 179 "regression-bugs-tmp/lunarlander.imp"
L = (((double)(L)) + (S));
                                                                //    180      T = T - S
_imp_current_line = 180; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 180 "regression-bugs-tmp/lunarlander.imp"
T = (((double)(T)) - (S));
                                                                //    181      M = M - S * K
_imp_current_line = 181; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 181 "regression-bugs-tmp/lunarlander.imp"
M = ((M) - ((double)((((double)(S)) * (K)))));
                                                                //    182      A = I
_imp_current_line = 182; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 182 "regression-bugs-tmp/lunarlander.imp"
A = I;
                                                                //    183      V = J
_imp_current_line = 183; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 183 "regression-bugs-tmp/lunarlander.imp"
V = J;
                                                                //    184  %end
_imp_current_line = 184; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 184 "regression-bugs-tmp/lunarlander.imp"
return;
_imp_endofblock: ;
} // End of block UPDATELANDERSTATE at level 2
                                                                //    185  
                                                                //    186  ! Subroutine at line 09.10 in original FOCAL code
                                                                //    187  %routine apply thrust
_imp_current_line = 187; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 187 "regression-bugs-tmp/lunarlander.imp"
void APPLYTHRUST( void )
#line 187 "regression-bugs-tmp/lunarlander.imp"
{
  __label__ _imp_endofblock;
                                                                //    188      %longreal Q, Q 2, Q 3, Q 4, Q 5
_imp_current_line = 188; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 188 "regression-bugs-tmp/lunarlander.imp"
double Q;
#line 188 "regression-bugs-tmp/lunarlander.imp"
double Q2;
#line 188 "regression-bugs-tmp/lunarlander.imp"
double Q3;
#line 188 "regression-bugs-tmp/lunarlander.imp"
double Q4;
#line 188 "regression-bugs-tmp/lunarlander.imp"
double Q5;
                                                                //    189      Q = S * K / M
_imp_current_line = 189; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 189 "regression-bugs-tmp/lunarlander.imp"
Q = (double)((double)(((((double)(S)) * (K)))) / (double)((double)(M)));
                                                                //    190      Q 2 = Q * Q
_imp_current_line = 190; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 190 "regression-bugs-tmp/lunarlander.imp"
Q2 = (((double)(Q)) * (Q));
                                                                //    191      Q 3 = Q 2 * Q
_imp_current_line = 191; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 191 "regression-bugs-tmp/lunarlander.imp"
Q3 = (((double)(Q2)) * (Q));
                                                                //    192      Q 4 = Q 3 * Q
_imp_current_line = 192; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 192 "regression-bugs-tmp/lunarlander.imp"
Q4 = (((double)(Q3)) * (Q));
                                                                //    193      Q 5 = Q 4 * Q
_imp_current_line = 193; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 193 "regression-bugs-tmp/lunarlander.imp"
Q5 = (((double)(Q4)) * (Q));
                                                                //    194  
                                                                //    195      J = V + G * S + Z * (-Q - Q 2 / 2 - Q 3 / 3 - Q 4 / 4 - Q 5 / 5)
_imp_current_line = 195; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 195 "regression-bugs-tmp/lunarlander.imp"
J = (((((V) + ((double)((((double)(G)) * (S))))))) + (((Z) * ((((((((((((((-(Q)))) - (((double)((double)((double)(Q2)) / (double)((float)(2)))))))) - (((double)((double)((double)(Q3)) / (double)((float)(3)))))))) - (((double)((double)((double)(Q4)) / (double)((float)(4)))))))) - (((double)((double)((double)(Q5)) / (double)((float)(5))))))))));
                                                                //    196      I = A - G * S * S / 2 - V * S + Z * S * (Q / 2 + Q 2 / 6 + Q 3 / 12 + Q 4 / 20 + Q 5 / 30)
_imp_current_line = 196; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 196 "regression-bugs-tmp/lunarlander.imp"
I = ((((((((A) - (((double)((double)(((((double)((((double)(G)) * (S)))) * (S)))) / (double)((float)(2)))))))) - ((((double)(V)) * (S)))))) + ((((((double)(Z)) * (S))) * (((((((((((((((double)((double)((double)(Q)) / (double)((float)(2)))))) + (((double)((double)((double)(Q2)) / (double)((float)(6)))))))) + (((double)((double)((double)(Q3)) / (double)((float)(12)))))))) + (((double)((double)((double)(Q4)) / (double)((float)(20)))))))) + (((double)((double)((double)(Q5)) / (double)((float)(30))))))))));
                                                                //    197  %end
_imp_current_line = 197; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 197 "regression-bugs-tmp/lunarlander.imp"
return;
_imp_endofblock: ;
} // End of block APPLYTHRUST at level 2
                                                                //    198  
                                                                //    199  ! Read a floating-point value from stdin.
                                                                //    200  !
                                                                //    201  ! Returns 1 on success, or 0 if input did not contain a number.
                                                                //    202  !
                                                                //    203  ! Calls exit(-1) on EOF or other failure to read input.
                                                                //    204  %integerfn accept real(%longrealname value)
_imp_current_line = 204; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 204 "regression-bugs-tmp/lunarlander.imp"
int ACCEPTREAL( double /*name*/*VALUE )
#line 204 "regression-bugs-tmp/lunarlander.imp"
{
  __label__ _imp_endofblock;
                                                                //    205      %string (255) buffer
_imp_current_line = 205; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 205 "regression-bugs-tmp/lunarlander.imp"
_imp_string /*%string(255)*/ BUFFER;
                                                                //    206      %integer buffer length
_imp_current_line = 206; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 206 "regression-bugs-tmp/lunarlander.imp"
int BUFFERLENGTH;
                                                                //    207      buffer length = 0
_imp_current_line = 207; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 207 "regression-bugs-tmp/lunarlander.imp"
BUFFERLENGTH = 0;
                                                                //    208      accept line(buffer, buffer length)
_imp_current_line = 208; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 208 "regression-bugs-tmp/lunarlander.imp"
ACCEPTLINE(&BUFFER, &BUFFERLENGTH);
                                                                //    209      %integer is valid input
_imp_current_line = 209; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 209 "regression-bugs-tmp/lunarlander.imp"
int ISVALIDINPUT;
                                                                //    210      read(value)
_imp_current_line = 210; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 210 "regression-bugs-tmp/lunarlander.imp"
_imp_READ(VALUE);
                                                                //    211      !is valid input = 0 %if is valid input # 1 
                                                                //    212          %result = TRUE; !is valid input
_imp_current_line = 212; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 212 "regression-bugs-tmp/lunarlander.imp"
return 1;
                                                                //    213  %end
_imp_current_line = 213; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 213 "regression-bugs-tmp/lunarlander.imp"
_imp_endofblock: ;
} // End of block ACCEPTREAL at level 2
                                                                //    214  
                                                                //    215  ! Reads input and returns 1 if it starts with 'Y' or 'y', or returns 0 if it
                                                                //    216  ! starts with 'N' or 'n'.
                                                                //    217  !
                                                                //    218  ! If input starts with none of those characters, prompt again.
                                                                //    219  !
                                                                //    220  ! If unable to read input, calls exit(-1)
                                                                //    221  %integerfn accept yes or no
_imp_current_line = 221; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 221 "regression-bugs-tmp/lunarlander.imp"
int ACCEPTYESORNO( void )
#line 221 "regression-bugs-tmp/lunarlander.imp"
{
  __label__ _imp_endofblock;
                                                                //    222      %integer result
_imp_current_line = 222; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 222 "regression-bugs-tmp/lunarlander.imp"
int RESULT;
                                                                //    223      result = -1
_imp_current_line = 223; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 223 "regression-bugs-tmp/lunarlander.imp"
RESULT = (-1);
                                                                //    224      %cycle
_imp_current_line = 224; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 224 "regression-bugs-tmp/lunarlander.imp"
L_0023:;
                                                                //    225          prompt("(ANS. YES OR NO):")
_imp_current_line = 225; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 225 "regression-bugs-tmp/lunarlander.imp"
_imp_PROMPT(_imp_str_literal("(ANS. YES OR NO):"));
                                                                //    226          %string (255) buffer; buffer = ""
_imp_current_line = 226; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 226 "regression-bugs-tmp/lunarlander.imp"
_imp_string /*%string(255)*/ BUFFER;
_imp_current_line = 226; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 226 "regression-bugs-tmp/lunarlander.imp"
BUFFER = _imp_str_literal("");
                                                                //    227          %integer buffer length
_imp_current_line = 227; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 227 "regression-bugs-tmp/lunarlander.imp"
int BUFFERLENGTH;
                                                                //    228          buffer length = 0
_imp_current_line = 228; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 228 "regression-bugs-tmp/lunarlander.imp"
BUFFERLENGTH = 0;
                                                                //    229          accept line(buffer, buffer length)
_imp_current_line = 229; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 229 "regression-bugs-tmp/lunarlander.imp"
ACCEPTLINE(&BUFFER, &BUFFERLENGTH);
                                                                //    230  
                                                                //    231          %if buffer length > 0 %start
_imp_current_line = 231; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 231 "regression-bugs-tmp/lunarlander.imp"
if (((BUFFERLENGTH) <= (0))) goto L_0026;
                                                                //    232              %switch case('N':'y')
_imp_current_line = 232; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 232 "regression-bugs-tmp/lunarlander.imp"
static int sw1_CASE_idx;
static const void * /*SWITCH*/ sw1_CASE[44] = { &&sw1_CASE_78, &&sw1_CASE_79, &&sw1_CASE_80, &&sw1_CASE_81, &&sw1_CASE_82, &&sw1_CASE_83, &&sw1_CASE_84, &&sw1_CASE_85, &&sw1_CASE_86, &&sw1_CASE_87, &&sw1_CASE_88, &&sw1_CASE_89, &&sw1_CASE_90, &&sw1_CASE_91, &&sw1_CASE_92, &&sw1_CASE_93, &&sw1_CASE_94, &&sw1_CASE_95, &&sw1_CASE_96, &&sw1_CASE_97, &&sw1_CASE_98, &&sw1_CASE_99, &&sw1_CASE_100, &&sw1_CASE_101, &&sw1_CASE_102, &&sw1_CASE_103, &&sw1_CASE_104, &&sw1_CASE_105, &&sw1_CASE_106, &&sw1_CASE_107, &&sw1_CASE_108, &&sw1_CASE_109, &&sw1_CASE_110, &&sw1_CASE_111, &&sw1_CASE_112, &&sw1_CASE_113, &&sw1_CASE_114, &&sw1_CASE_115, &&sw1_CASE_116, &&sw1_CASE_117, &&sw1_CASE_118, &&sw1_CASE_119, &&sw1_CASE_120, &&sw1_CASE_121,  };
                                                                //    233              -> case(charno(buffer,1))
_imp_current_line = 233; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 233 "regression-bugs-tmp/lunarlander.imp"
sw1_CASE_idx = *_imp_CHARNO(&BUFFER, 1); if ((78 <= sw1_CASE_idx) && (sw1_CASE_idx <= 121)) goto *(sw1_CASE-78)[sw1_CASE_idx];  /* Bounds=78:121 */ else {
   /*_imp_signal(8, 2, sw1_CASE_idx);*/
   fprintf(stderr, "%%SWITCH index CASE(%d) not in range 78:121 at %s:%d\n",
           sw1_CASE_idx, (_imp_current_file != 0 ? _imp_current_file : __FILE__),
           (_imp_current_line != 0 ? _imp_current_line : __LINE__));
           exit(1);
}
                                                                //    234              case('y'):
_imp_current_line = 234; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 234 "regression-bugs-tmp/lunarlander.imp"
sw1_CASE_121:;
                                                                //    235              case('Y'):
_imp_current_line = 235; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 235 "regression-bugs-tmp/lunarlander.imp"
sw1_CASE_89:;
                                                                //    236                  %result = 1
_imp_current_line = 236; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 236 "regression-bugs-tmp/lunarlander.imp"
return 1;
                                                                //    237  
                                                                //    238              case('n'):
_imp_current_line = 238; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 238 "regression-bugs-tmp/lunarlander.imp"
sw1_CASE_110:;
                                                                //    239              case('N'):
_imp_current_line = 239; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 239 "regression-bugs-tmp/lunarlander.imp"
sw1_CASE_78:;
                                                                //    240                  %result = 0
_imp_current_line = 240; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 240 "regression-bugs-tmp/lunarlander.imp"
return 0;
                                                                //    241  
                                                                //    242              case(*):
_imp_current_line = 242; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 242 "regression-bugs-tmp/lunarlander.imp"
sw1_CASE_default:;
                                                                //    243          %finish
_imp_current_line = 243; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 243 "regression-bugs-tmp/lunarlander.imp"
L_0026:;
                                                                //    244  
                                                                //    245      %repeat %until result >= 0
_imp_current_line = 245; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 245 "regression-bugs-tmp/lunarlander.imp"
if (((RESULT) >= (0))) goto L_0024;
#line 245 "regression-bugs-tmp/lunarlander.imp"
goto L_0023;
#line 245 "regression-bugs-tmp/lunarlander.imp"
L_0024:;
                                                                //    246  
                                                                //    247      %result = result
_imp_current_line = 247; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 247 "regression-bugs-tmp/lunarlander.imp"
return RESULT;
                                                                //    248  %end
_imp_current_line = 248; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 248 "regression-bugs-tmp/lunarlander.imp"
sw1_CASE_79:;
sw1_CASE_80:;
sw1_CASE_81:;
sw1_CASE_82:;
sw1_CASE_83:;
sw1_CASE_84:;
sw1_CASE_85:;
sw1_CASE_86:;
sw1_CASE_87:;
sw1_CASE_88:;
sw1_CASE_90:;
sw1_CASE_91:;
sw1_CASE_92:;
sw1_CASE_93:;
sw1_CASE_94:;
sw1_CASE_95:;
sw1_CASE_96:;
sw1_CASE_97:;
sw1_CASE_98:;
sw1_CASE_99:;
sw1_CASE_100:;
sw1_CASE_101:;
sw1_CASE_102:;
sw1_CASE_103:;
sw1_CASE_104:;
sw1_CASE_105:;
sw1_CASE_106:;
sw1_CASE_107:;
sw1_CASE_108:;
sw1_CASE_109:;
sw1_CASE_111:;
sw1_CASE_112:;
sw1_CASE_113:;
sw1_CASE_114:;
sw1_CASE_115:;
sw1_CASE_116:;
sw1_CASE_117:;
sw1_CASE_118:;
sw1_CASE_119:;
sw1_CASE_120:;
goto sw1_CASE_default;
_imp_endofblock: ;
} // End of block ACCEPTYESORNO at level 2
                                                                //    249  
                                                                //    250  ! Reads a line of input.  Caller is responsible for calling free() on the
                                                                //    251  ! returned buffer.
                                                                //    252  !
                                                                //    253  ! If unable to read input, calls exit(-1).
                                                                //    254  %routine accept line(%string(*)%name buffer, %integername buffer length)
_imp_current_line = 254; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 254 "regression-bugs-tmp/lunarlander.imp"
void ACCEPTLINE( _imp_string /*%string(255)*/ /*name*/*BUFFER, int /*name*/*BUFFERLENGTH )
#line 254 "regression-bugs-tmp/lunarlander.imp"
{
  __label__ _imp_endofblock;
                                                                //    255      %on %event 9 %start
_imp_current_line = 255; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 255 "regression-bugs-tmp/lunarlander.imp"
if (!_imp_on_event(9)) goto L_0027;
                                                                //    256          newline; printstring("END OF INPUT"); newlines(2)
_imp_current_line = 256; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 256 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINE();
_imp_current_line = 256; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 256 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(_imp_str_literal("END OF INPUT"));
_imp_current_line = 256; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 256 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINES(2);
                                                                //    257          %stop
_imp_current_line = 257; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 257 "regression-bugs-tmp/lunarlander.imp"
exit(0);
                                                                //    258      %finish
_imp_current_line = 258; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 258 "regression-bugs-tmp/lunarlander.imp"
L_0027:;
                                                                //    259      readline(buffer)
_imp_current_line = 259; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 259 "regression-bugs-tmp/lunarlander.imp"
_imp_READLINE(BUFFER);
                                                                //    260      %if echo input=TRUE %start
_imp_current_line = 260; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 260 "regression-bugs-tmp/lunarlander.imp"
if (((ECHOINPUT) != (1))) goto L_0028;
                                                                //    261          printstring(buffer); newline
_imp_current_line = 261; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 261 "regression-bugs-tmp/lunarlander.imp"
_imp_PRINTSTRING(*BUFFER);
_imp_current_line = 261; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 261 "regression-bugs-tmp/lunarlander.imp"
_imp_NEWLINE();
                                                                //    262      %finish
_imp_current_line = 262; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 262 "regression-bugs-tmp/lunarlander.imp"
L_0028:;
                                                                //    263      buffer length = length(buffer)
_imp_current_line = 263; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 263 "regression-bugs-tmp/lunarlander.imp"
*BUFFERLENGTH = *_imp_LENGTH(BUFFER);
                                                                //    264  %end
_imp_current_line = 264; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 264 "regression-bugs-tmp/lunarlander.imp"
return;
_imp_endofblock: ;
} // End of block ACCEPTLINE at level 2
                                                                //    265  
                                                                //    266  %endofprogram
_imp_current_line = 266; _imp_current_file = "regression-bugs-tmp/lunarlander.imp";
#line 266 "regression-bugs-tmp/lunarlander.imp"
return 0;
_imp_endofblock: ;
} // End of block _imp_main at level 1
#line 266 "regression-bugs-tmp/lunarlander.imp"
// End of file
