#include <perms.h>
static const short Main[217 /*1:217*/] = {
    1,   5,   14,  20,  26,  38,  43,  48,  54,  61,  68,  74,  79,  82,  84,  89,  96,  102, 108, 115, 122, 126,
    0,   129, 133, 137, 142, 145, 152, 156, 161, 164, 168, 0,   171, 0,   178, 184, 185, 189, 190, 193, 196, 199,
    0,   202, 205, 206, 208, 0,   211, 213, 215, 216, 219, 222, 225, 0,   228, 231, 236, 241, 244, 249, 0,   253,
    259, 260, 264, 266, 267, 270, 271, 274, 277, 279, 280, 283, 286, 289, 292, 295, 298, 302, 305, 308, 311, 314,
    317, 320, 324, 328, 332, 336, 340, 344, 348, 352, 355, 358, 0,   361, 363, 365, 373, 0,   381, 0,   385, 392,
    393, 396, 397, 400, 403, 405, 406, 410, 0,   413, 418, 425, 432, 0,   435, 437, 0,   440, 445, 446, 450, 453,
    456, 0,   459, 462, 463, 0,   469, 472, 473, 475, 0,   477, 489, 499, 506, 0,   509, 511, 512, 517, 0,   520,
    0,   530, 534, 535, 538, 539, 0,   543, 546, 547, 0,   558, 565, 566, 571, 572, 576, 579, 0,   585, 587, 588,
    591, 0,   594, 597, 0,   600, 602, 603, 608, 609, 614, 615, 618, 0,   620, 622, 623, 627, 628, 631, 634, 637,
    0,   640, 646, 0,   651, 656, 657, 660, 661, 665, 0,   667, 0,   670, 674, 675, 678, 681, 683};
static const short Sub[683 /*2:684*/] = {
    4119,   4288,  -8192,  0,      4149,  4168,   4197,   4166,   4286,  4119,   4230,   -8192,  0,      1,     8200,
    24576,  4230,  -8192,  0,      8,     8221,   24576,  16384,  -8192, 0,      15,     8204,   20480,  16384, 4202,
    21,     8244,  4168,   4197,   4166,  -8192,  0,      4154,   4246,  -20480, -8192,  0,      4290,   4154,  4295,
    -20480, 0,     23,     8223,   4255,  -8192,  -20480, 0,      4208,  4271,   4212,   -4096,  4261,   -8192, 0,
    30,     8197,  -4096,  4261,   -8192, -20480, 0,      35,     8196,  20480,  -8192,  -16384, 0,      41,    8198,
    4215,   -8192, 0,      4130,   4096,  0,      4225,   0,      45,    8199,   -8192,  -20480, 0,      4309,  50,
    8201,   4239,  -8192,  -20480, 0,     57,     -20480, 8202,   12288, -8192,  0,      65,     8203,   4232,  -8192,
    -20480, 0,     71,     77,     8193,  8205,   -8192,  -20480, 0,     85,     93,     8206,   8207,   -8192, -20480,
    0,      101,   8257,   -32768, 0,     -12288, -8192,  0,      4202,  4134,   4141,   0,      103,    8246,  4143,
    0,      106,   8208,   12288,  4141,  0,      116,    8209,   0,     123,    8210,   4136,   4168,   4197,  4166,
    0,      130,   8211,   20480,  0,     15,     8204,   20480,  16384, 0,      136,    8212,   0,      141,   8213,
    4146,   0,     149,    8214,   0,     8292,   4220,   154,    8245,  8192,   4132,   0,      8292,   4220,  154,
    8245,   8192,  4132,   0,      4136,  4168,   4197,   4166,   0,     156,    8247,   0,      21,     8244,  0,
    159,    8248,  0,      103,    8246,  0,      162,    8215,   4119,  0,      12288,  0,      -4096,  4204,  0,
    12288,  0,     136,    8212,   0,     166,    8216,   0,      169,   8218,   0,      175,    8217,   0,     182,
    8219,   0,     188,    8220,   0,     196,    188,    8194,   8220,  0,      71,     188,    8193,   8220,  0,
    201,    8222,  0,      206,    201,   8195,   8222,   0,      211,   8224,   4161,   0,      218,    8249,  12288,
    220,    8250,  8271,   0,      222,   8225,   8226,   0,      232,   8226,   0,      4172,   4197,   4166,  0,
    237,    8251,  0,      239,    8252,  0,      241,    8253,   0,     237,    8251,   0,      103,    8246,  0,
    239,    8252,  0,      243,    8254,  0,      245,    8255,   0,     248,    8256,   0,      250,    8257,  8257,
    0,      101,   8257,   0,      253,   8258,   0,      256,    8259,  0,      258,    8260,   0,      260,   8261,
    0,      263,   8262,   0,      21,    8244,   4168,   0,      266,   8263,   4168,   0,      269,    8264,  4168,
    0,      271,   8267,   4168,   0,     273,    8265,   4168,   0,     276,    8266,   4168,   0,      278,   8268,
    4168,   0,     281,    8272,   4168,  0,      162,    8215,   0,     283,    8227,   0,      154,    8245,  0,
    12288,  0,     4202,   0,      218,   8249,   4168,   4197,   4166,  220,    8250,   0,      248,    8256,  4168,
    4197,   4166,  248,    8256,   0,     -4096,  4204,   4206,   0,     218,    8249,   4168,   4197,   4166,  220,
    8250,   0,     286,    8270,   4202,  0,      288,    8231,   0,     297,    8232,   0,      304,    8233,  0,
    30,     8197,  -20480, 0,      20480, -16384, 0,      312,    8234,  8199,   -20480, 0,      319,    8234,  8207,
    28672,  24576, 20480,  0,      329,   8234,   8235,   28672,  24576, 20480,  0,      24576,  28672,  0,     12288,
    0,      -4096, 4223,   0,      218,   8249,   12288,  220,    8250,  0,      248,    -8191,  -28672, 0,     336,
    -24576, 0,     248,    -28672, 0,     339,    -28672, 0,      347,   8237,   4119,   0,      12288,  103,   8246,
    4236,   4234,  0,      281,    8269,  4232,   0,      12288,  0,     -4096,  0,      352,    8238,   -4096, 218,
    8249,   4283,  4246,   4279,   4281,  220,    8250,   0,      30,    8197,   -4096,  4253,   218,    8249,  -4096,
    220,    8250,  0,      4246,   218,   8249,   -4096,  220,    8250,  0,      232,    8226,   0,      352,   8238,
    0,      359,   8225,   4244,   4249,  0,      4163,   4305,   0,     4305,   218,    8249,   4168,   4197,  4166,
    220,    8250,  4251,   0,      281,   8269,   4249,   4251,   0,     286,    8270,   -4096,  0,      4305,  4259,
    4257,   0,     281,    8269,   4255,  0,      218,    8249,   4168,  12288,  154,    8245,   4168,   12288, 220,
    8250,   0,     218,    8249,   4265,  4305,   4263,   220,    8250,  0,      281,    8269,   4265,   4305,  4263,
    0,      4271,  232,    8226,   0,     4154,   4163,   0,      50,    8201,   4269,   232,    8226,   0,     359,
    8225,   0,     77,     8205,   0,     4154,   4274,   0,      365,   8239,   0,      368,    8240,   0,     281,
    8269,   0,     218,    8249,   -4096, 220,    8250,   0,      4277,  4283,   4246,   4279,   4281,   0,     50,
    8201,   0,     4154,   0,      372,   8241,   0,      4149,   4168,  4197,   4166,   0,      377,    8228,  0,
    381,    8229,  0,      387,    8230,  0,      288,    8231,   0,     359,    8225,   -4096,  4259,   4302,  0,
    4305,   4300,  4298,   -8192,  0,     281,    8269,   4305,   4300,  4298,   0,      21,     8244,   12288, 0,
    21,     8244,  -32768, 0,      -8192, 0,      -4096,  4307,   0,     281,    8269,   -4096,  4307,   0,     377,
    8228,   0,     288,    8231,   0,     387,    8230,   0};
static const unsigned char Literal[396 /*1:396*/] = {
    6,   102, 105, 110, 105, 115, 104, 6,   114, 101, 112, 101, 97,  116, 5,   99,  121, 99,  108, 101, 1,   61,
    6,   115, 119, 105, 116, 99,  104, 4,   115, 112, 101, 99,  5,   98,  101, 103, 105, 110, 3,   101, 110, 100,
    4,   108, 105, 115, 116, 6,   114, 101, 99,  111, 114, 100, 7,   99,  111, 110, 116, 114, 111, 108, 5,   102,
    97,  117, 108, 116, 5,   115, 104, 111, 114, 116, 7,   114, 111, 117, 116, 105, 110, 101, 7,   116, 114, 117,
    115, 116, 101, 100, 7,   112, 114, 111, 103, 114, 97,  109, 1,   42,  2,   45,  62,  9,   112, 114, 105, 110,
    116, 116, 101, 120, 116, 6,   114, 101, 116, 117, 114, 110, 6,   114, 101, 115, 117, 108, 116, 5,   115, 116,
    97,  114, 116, 4,   115, 116, 111, 112, 7,   109, 111, 110, 105, 116, 111, 114, 4,   101, 120, 105, 116, 1,
    58,  2,   61,  61,  2,   60,  45,  3,   97,  110, 100, 2,   105, 102, 5,   119, 104, 105, 108, 101, 6,   117,
    110, 108, 101, 115, 115, 5,   117, 110, 116, 105, 108, 7,   105, 110, 116, 101, 103, 101, 114, 4,   98,  121,
    116, 101, 4,   114, 101, 97,  108, 4,   108, 111, 110, 103, 6,   115, 116, 114, 105, 110, 103, 1,   40,  1,
    41,  9,   97,  114, 114, 97,  121, 110, 97,  109, 101, 4,   110, 97,  109, 101, 1,   43,  1,   45,  1,   92,
    1,   38,  2,   33,  33,  1,   33,  2,   42,  42,  2,   47,  47,  1,   47,  1,   46,  2,   60,  60,  2,   62,
    62,  2,   60,  61,  1,   60,  1,   35,  2,   62,  61,  1,   62,  2,   92,  61,  1,   44,  2,   111, 114, 1,
    95,  8,   101, 120, 116, 101, 114, 110, 97,  108, 6,   115, 121, 115, 116, 101, 109, 7,   100, 121, 110, 97,
    109, 105, 99,  6,   111, 102, 108, 105, 115, 116, 9,   111, 102, 112, 114, 111, 103, 114, 97,  109, 6,   111,
    102, 102, 105, 108, 101, 2,   33,  42,  7,   99,  111, 109, 109, 101, 110, 116, 4,   101, 108, 115, 101, 6,
    102, 111, 114, 109, 97,  116, 5,   97,  114, 114, 97,  121, 2,   102, 110, 3,   109, 97,  112, 4,   116, 104,
    101, 110, 3,   111, 119, 110, 5,   99,  111, 110, 115, 116, 9,   101, 120, 116, 114, 105, 110, 115, 105, 99};
static const unsigned char Sflags[80 /*1:80*/] = {3, 3, 3, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                                  0, 0, 3, 1, 1, 1, 1, 4, 0, 4, 0, 4, 0, 0, 3, 0, 0, 0, 0, 0,
                                                  0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                                  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
static unsigned char Keysyms[381 /*1:381*/] = {
    5,  83, 72, 79, 82, 84, 4,  66, 89, 84, 69, 4,  76, 79, 78, 71, 5,  66, 69, 71, 73, 78, 4,  83, 80, 69, 67, 3,
    69, 78, 68, 4,  76, 73, 83, 84, 6,  70, 73, 78, 73, 83, 72, 6,  82, 69, 67, 79, 82, 68, 7,  67, 79, 78, 84, 82,
    79, 76, 5,  70, 65, 85, 76, 84, 5,  67, 89, 67, 76, 69, 7,  82, 79, 85, 84, 73, 78, 69, 7,  84, 82, 85, 83, 84,
    69, 68, 7,  80, 82, 79, 71, 82, 65, 77, 9,  80, 82, 73, 78, 84, 84, 69, 88, 84, 6,  82, 69, 84, 85, 82, 78, 6,
    82, 69, 83, 85, 76, 84, 5,  83, 84, 65, 82, 84, 4,  83, 84, 79, 80, 7,  77, 79, 78, 73, 84, 79, 82, 4,  69, 88,
    73, 84, 3,  65, 78, 68, 2,  73, 70, 6,  85, 78, 76, 69, 83, 83, 5,  87, 72, 73, 76, 69, 5,  85, 78, 84, 73, 76,
    7,  73, 78, 84, 69, 71, 69, 82, 6,  82, 69, 80, 69, 65, 84, 4,  82, 69, 65, 76, 6,  83, 87, 73, 84, 67, 72, 6,
    83, 84, 82, 73, 78, 71, 5,  65, 82, 82, 65, 89, 4,  78, 65, 77, 69, 2,  79, 82, 3,  79, 87, 78, 5,  67, 79, 78,
    83, 84, 9,  69, 88, 84, 82, 73, 78, 83, 73, 67, 8,  69, 88, 84, 69, 82, 78, 65, 76, 6,  83, 89, 83, 84, 69, 77,
    7,  68, 89, 78, 65, 77, 73, 67, 2,  79, 70, 4,  70, 73, 76, 69, 7,  67, 79, 77, 77, 69, 78, 84, 4,  69, 76, 83,
    69, 6,  70, 79, 82, 77, 65, 84, 2,  70, 78, 3,  77, 65, 80, 4,  84, 72, 69, 78, 5,  82, 69, 65, 76, 83, 6,  78,
    79, 82, 77, 65, 76, 1,  61, 1,  58, 2,  45, 62, 2,  61, 61, 2,  60, 45, 1,  40, 1,  41, 1,  43, 1,  45, 1,  92,
    1,  38, 2,  33, 33, 1,  33, 1,  42, 2,  47, 47, 1,  47, 1,  46, 2,  60, 60, 2,  62, 62, 2,  60, 61, 1,  60, 2,
    62, 61, 1,  62, 1,  35, 2,  92, 61, 1,  44, 1,  95, 1,  32, 1,  44};
static const short Keyword[80 /*1:80*/] = {
    0,   6,   11,  16,  22,  27,  31,  36,  43,  50,  58,  64,  70,  78,  86,  94,  104, 111, 118, 124,
    129, 137, 142, 146, 149, 156, 162, 168, 176, 183, 188, 195, 202, 208, 213, 216, 220, 226, 236, 245,
    252, 260, 263, 268, 276, 281, 288, 291, 295, 300, 306, 313, 315, 317, 320, 323, 326, 328, 330, 332,
    334, 336, 338, 341, 343, 345, 348, 350, 352, 355, 358, 361, 363, 366, 368, 370, 373, 375, 377, 379};
static const unsigned char Kflags[80 /*1:80*/] = {
    144, 144, 144, 128, 129, 128, 128, 128, 128, 128, 128, 128, 128, 144, 128, 128, 128, 128, 128, 128,
    144, 128, 160, 130, 130, 130, 130, 128, 128, 128, 128, 128, 145, 129, 128, 144, 144, 144, 144, 144,
    144, 145, 128, 128, 162, 129, 129, 129, 160, 144, 128, 8,   8,   8,   8,   8,   4,   0,   0,   0,
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   8,   8,   8,   8,   8,   8,   64,  0,   0,   0};
static unsigned char Isolatebrackets = 0;
static unsigned char Leaveblanks = 0;
static unsigned char Sepblocks = 1;
static unsigned char Indentblocks = 1;
static unsigned char Splitkeywords = 0;
static unsigned char Packnames = 0;
static unsigned char Splitstats = 0;
static unsigned char Commentsnormal = 0;
static unsigned char Breakcomments = 1;
static unsigned char Leavestars = 1;
static unsigned char Justifyall = 0;
static unsigned char Labelsrelative = 0;
static unsigned char Splitconds = 1;
static unsigned char Decsrelative = 1;
static unsigned char Spacelists = 1;
static unsigned char Spaceequals = 1;
static unsigned char Isolateloops = 1;
static unsigned char Extramargin = 0;
static unsigned char Leaveowns = 0;
static unsigned char Commentsrelative = 1;
static unsigned char Extendcomments = 1;
static unsigned char Mi = 3;
static unsigned char Ll = 72;
static unsigned char Ct = 40;
static unsigned char Ml = 40;
static unsigned char Commentextension = 5;
static unsigned char Extnum = 2;
static unsigned char Initialmargin = 7;
static unsigned char Secondarymargin = 3;
static unsigned char Commentlimit = 20;
static unsigned char Commentline = 120;
static short Safetyfactor = 5;
static int Deltamargin = 3;
static int Linelength = 70;
static int Commenttab = 40;
static int Level = 1;
static int Mlimit = 0;
static int Secmargin = 3;
static unsigned char Commentflag;
static unsigned char Cmode;
static unsigned char Loopflag;
static int Linesize;
static int Cs;
static int Disp;
static int D;
static int Rmargin;
static int Firstdisp;
static int Size;
static int Cstart;
static int Linebase;
static int Fullline;
void Prompt(_imp_string S) { Printstring(S); }
void Send(_imp_string S);
void List(_imp_string S);
void Destroy(_imp_string S);
void Rename(_imp_string S);
static int Parse(int Ep);
static _imp_string Input;
static _imp_string Output;
static _imp_string Optionfile;
static _imp_string St;
static _imp_string Oplist;
static int Spt;
static int Sad;
static int S;
static unsigned char Spaces;
static unsigned char Mode;
static unsigned char Ok;
static unsigned char Thissep;
static const int Lasttext = 51;
static int Header;
static int Segs;
static int Strings[100 /*1:100*/];
static int Commentlength;
static short Rem[4 /*1:4*/];
static unsigned char Symfile[301 /*0:300*/];
static unsigned char Tlength[100 /*1:100*/];
static int Rec[100 /*1:100*/];
static unsigned char Status;
static unsigned char Options;
static unsigned char Lastsep;
static unsigned char Flag;
static unsigned char Pmode;
static unsigned char Quotes = 0;
static unsigned char Ownflag = ';';
static int Nval;
static int Currin;
static int Currout;
static int Slength;
static int Limit;
static int Margin;
static int Inbase;
static int Statsize;
static int Stat;
static int Keybase;
static int Textbase;
static int J;
static int Sn;
static int Rp;
static int Rplim;
static int Rpinc;
static int Maxmargin;
static int Endoffile;
static const int Ccc = 0x2025430A;
static const int Connektep = 1;
static const int Createep = 162;
static const int Readep = 7;
static const int Infoep = 5;
static const int Changeep = 6;
static void Setupfiles(_imp_string *S);
static void Closefiles(void);
static void Setoptions(void);
extern void Cherish(_imp_string S);
static void Continue(void) {
  auto void Adjust(void);
  int Hold[4 /*1:4*/];
  int J;
  int K;
  int L;
  int M;
  int N;
  int Z;
  int Lim;
  int Xes;
  unsigned char Nest;
  unsigned char S;
  unsigned char Cflag;
  Thissep = Nl;
  Lim = Margin + Safetyfactor + Secmargin;
  Z = Slength + Currout;
  if (Z < Limit || (Z - Safetyfactor - Limit < -4 && Rec[Rp + 1] == 0)) return;
  Xes = Z - Limit;
  for (J = 1; J <= 4; J++) Hold[J] = Nest(J) + Currout - Linebase;
  if (Lastsep == ';') {
    N = Currout;
    Quotes = 0;
    do {
      N--;
      S = *Byteinteger(N);
      if (S == '\'') Quotes = Quotes ^ 1;
    } while (S != ';' || Quotes != 0);
    *Byteinteger(N) = Nl;
    Limit = N + Linelength;
    Linebase = N;
    K = Currout + 80;
    M = K;
    for (L = N + 3; L <= Currout; L++) {
      K++;
      *Byteinteger(K) = *Byteinteger(L);
    }
    for (L = 1; L <= Margin; L++) {
      N++;
      *Byteinteger(N) = ' ';
    }
    for (L = M + 1; L <= K; L++) {
      N++;
      *Byteinteger(N) = *Byteinteger(L);
    }
    Currout = N;
    Lastsep = Nl;
    Adjust();
    if (Currout + Slength < Limit) return;
  }
  if (Nest(4) != 0 && Rec[Rem(4) - 1] >= 4) Nest(3) = 0;
  Cflag = 0;
  for (J = 1; J <= 4; J++) {
    N = Nest(J);
    if (N > Lim) {
      N += Linebase;
      if (N < Currout) {
        Cflag = 1;
        break;
      }
    }
  }
  if (Cflag) {
    if (Nest(J) - Margin - Secmargin - Safetyfactor < Xes) {
      K = J;
      while (K < 4) {
        K++;
        if (Nest(K)) {
          Cflag = 0;
          break;
        }
      }
      if (!Cflag) {
        L = Nest(K) + Linebase;
        if (Nest(K) > Lim && L < Currout) {
          J = K;
          N = L;
        }
      }
    }
    if (J == 4 && Rem(3) == Rem(4) - 1) {
      J = 3;
      N = Nest(3) + Linebase;
    }
    Lim = Nest(J) + Safetyfactor + Secmargin;
    K = Currout + 80;
    M = K;
    for (L = N + 1; L <= Currout; L++) {
      K++;
      *Byteinteger(K) = *Byteinteger(L);
    }
    for (J = 1; J <= Margin + Secmargin; J++) {
      Currout++;
      *Byteinteger(Currout) = ' ';
    }
    if (*Byteinteger(M + 1) == ' ') M++;
    if (*Byteinteger(M + 1) != '%') {
      Currout++;
      *Byteinteger(Currout) = '%';
    }
    for (L = M + 1; L <= K; L++) {
      Currout++;
      *Byteinteger(Currout) = *Byteinteger(L);
    }
  } else {
    Lim = Currout - Linebase + Safetyfactor;
    for (J = 1; J <= Margin + Secmargin; J++) {
      Currout++;
      *Byteinteger(Currout) = ' ';
    }
    Pmode = 128;
  }
  Limit = Linebase + Linelength;
  Statsize = Statsize - Linelength + Margin;
  if (Statsize + Margin >= Linelength) Rplim += Rpinc;
  Nval = 0;
  void Adjust(void) {
    for (J = 1; J <= 4; J++)
      if (Nest(J) <= Lim)
        Nest(J) = 0;
      else
        Nest(J) = Hold[J] - Currout + Linebase;
  }
}
static void Break(void) {
  if (*Byteinteger(Currout) != ';') Currout -= 2;
  *Byteinteger(Currout) = Nl;
  Size = 0;
  Linebase = Currout;
  Limit = Linebase + Linesize;
  Nval = 0;
}
void Soap(_imp_string Files) {
  static int Movex = 0xD2002001;
  static int Movey = 0x10010000;
  auto void Percent(void);
  auto void Space(void);
  int *Midmargin;
  int N;
  int P;
  int K;
  int M;
  int Z;
  unsigned char Nest;
  Printstring(_imp_str_literal("SOAP"));
  Newline();
  Setupfiles(Files);
  if (!Ok) return;
  Setoptions();
  if (!Ok) return;
  Midmargin = &Margin;
  if (!Commentsrelative) Midmargin = &Rmargin;
Top:;
  for (;;) {
    Nval = 0;
    Loopflag = 0;
    Rp = 0;
    Spt = 0;
    Mode = 0;
    Status = 0;
    Sad = Textbase;
    if (Lastsep != ';') Limit = Currout + Linelength;
    Inbase = Currin;
    if (Parse(0)) {
    Owns:
      J = Currin;
      Quotes = 0;
      K = 0;
      do {
        K++;
        J++;
        S = *Byteinteger(J);
        if (S == '\'') Quotes = Quotes ^ 1;
      } while ((S != Nl && S != ';') || (Quotes != 0 && K <= 300));
      Slength = J - Currin;
      if (Currout + Slength > Limit && Lastsep == ';') {
        Break();
        Stat = Currout + Margin;
        for (J = 1; J <= Margin; J++) {
          Currout++;
          *Byteinteger(Currout) = ' ';
        }
      }
      if (!Ownflag) {
        Ownflag = ';';
        if (Currout + Slength + Safetyfactor > Limit)
          ;
      }
      for (J = 1; J <= Slength; J++) {
        Currin++;
        Currout++;
        *Byteinteger(Currout) = *Byteinteger(Currin);
      }
      Lastsep = *Byteinteger(Currin);
      if (Lastsep == ';') {
        *Byteinteger(Currout + 1) = ' ';
        *Byteinteger(Currout + 2) = ' ';
        Currout += 2;
      } else
        Linebase = Currout;
    } else {
      Pmode = 128;
      Statsize = Currin - Inbase;
      if (Statsize + Margin > Linelength) {
        Rpinc = Rp / (Statsize / (Linelength - Margin));
        Rplim = Rpinc;
      } else
        Rplim = Rp;
      if ((Status & 11) != 0 && Lastsep == ';') {
        Lastsep = Nl;
        Break();
      }
      if (Status & 136) {
        if ((Leaveblanks != 0 && Thissep != ';') || ((Status & 128) != 0 && Sepblocks != 0)) {
        Null:;
          Currout++;
          *Byteinteger(Currout) = Nl;
          Linebase = Currout;
        }
        if ((Status & 8) != 0 && Rp <= 1) goto Top;
      }
      Rp = 0;
      if (Loopflag != 0 && (Status & 1) != 0 && *Byteinteger(Currout - 1) != Nl) {
        Currout++;
        *Byteinteger(Currout) = Nl;
        Linebase = Currout;
        Limit++;
      }
      if (Status & 2) {
        if (Extramargin != 0 && (Status & 4) != 0) Status = Status | 64;
        Level = (unsigned)Level >> 1;
        if (!Level) Level = 1;
        if (!(Mlimit & 1)) Margin -= Deltamargin;
        Mlimit = (unsigned)Mlimit >> 1;
        if (Margin < 0) Margin = 0;
      }
      if (Lastsep != ';') Stat = Currout + Margin;
      while (Rec[Rp + 1] == 100) {
        Rp++;
        if (Lastsep == ';' || Lastsep == ':') {
          N = -2;
          if (Lastsep == ':') N = 1;
          Currout += N;
          *Byteinteger(Currout) = Nl;
          Linebase = Currout;
          Limit = Currout + Linelength;
          Stat = Currout + Margin;
          Lastsep = Nl;
        }
        if (Labelsrelative != 0 && Lastsep != ':') {
          N = Level;
          M = Margin;
          if (Extramargin != 0 && Level == 1) M += Firstdisp;
          for (;;) {
            M -= Deltamargin;
            if (N & 1) break;
            N = (unsigned)N >> 1;
          }
          while (M > 0) {
            M--;
            Currout++;
            *Byteinteger(Currout) = ' ';
          }
        }
        for (;;) {
          Rp++;
          N = Rec[Rp];
          if (!N) break;
          if (N < 0)
            Sn = Strings[-N];
          else
            Sn = Keyword[N] + Keybase;
          for (J = Sn + 1; J <= Sn + *Byteinteger(Sn); J++) {
            Currout++;
            *Byteinteger(Currout) = *Byteinteger(J);
          }
        }
        if (Currout > Stat && (Status & 16) == 0) {
          Currout++;
          *Byteinteger(Currout) = Nl;
          Linebase = Currout;
          Limit = Currout + Linelength;
          Stat = Currout + Margin;
        }
        Lastsep = ':';
      }
      if (Status & 8) {
        Rp = 0;
        goto Null;
      }
      if (Status & 16) {
        Rp++;
        Disp = Rec[Rp];
        D = 0;
        Cmode = 0;
        J = Currin;
        while (*Byteinteger(J) != Nl && *Byteinteger(J) != ';') J++;
        Cs = J - Currin;
        if (!Commentflag)
          Cstart = Commenttab;
        else if (Commentsnormal) {
          Cmode = 1;
          Cstart = Margin;
        } else if (Lastsep == ';')
          Cstart = Commenttab;
        else if (!Disp)
          Cstart = 0;
        else if (Disp <= *Midmargin && (Status & 32) == 0)
          Cstart = Margin;
        else
          Cstart = Commenttab;
        if ((Status & 32) != 0 && Leavestars != 0) Cstart = 0;
        Size = Currout - Linebase;
        if (Lastsep == ';') {
          if (*Byteinteger(Currout) == Nl) {
            Loopflag = 1;
            do
              Linebase--;
            while (*Byteinteger(Linebase) != Nl);
            Size = Currout - Linebase;
          }
          Currout -= 2;
          Size -= 2;
          if (Extendcomments != 0 && Cstart < Size) {
            P = Cstart;
            N = Extnum;
            for (;;) {
              if (N <= 0) break;
              Cstart += Commentextension;
              if (Cstart >= Size) break;
              N--;
            }
            if (N <= 0 || Cs + Cstart > Commentline) Cstart = P;
          }
          if (Cstart < Size)
            if (Cmode)
              Cstart = 0;
            else
              Break();
          else {
            D = Commentline - Cstart - Cs;
            if (D < 0 && Breakcomments == 0) {
              Cstart = Linesize - Cs;
              Break();
              D = 0;
            }
          }
        } else {
          D = Commentline - Cstart - Cs;
          if (D < 0 && Breakcomments == 0) {
            Cstart = Commentline - Cs;
            D = 0;
          }
        }
        for (;;) {
          N = Cstart - Size;
          while (N > 0) {
            N--;
            Currout++;
            *Byteinteger(Currout) = ' ';
          }
          Currout++;
          *Byteinteger(Currout) = '!';
          if (Status & 32) {
            Currout++;
            *Byteinteger(Currout) = '*';
          }
          P = J;
          if (D < 0) {
            P = J + D;
            while (*Byteinteger(P) != ' ' && *Byteinteger(P) != ',' && *Byteinteger(P) != '.' && P > Currin) P--;
            P--;
            if (P == Currin) P = J + D;
          }
          for (K = Currin + 1; K <= P; K++) {
            Currout++;
            *Byteinteger(Currout) = *Byteinteger(K);
          }
          Currin = P;
          if (D >= 0) break;
          Currout++;
          *Byteinteger(Currout) = Nl;
          Size = 0;
          D += Linelength - Margin;
        }
        *Byteinteger(Currout) = Nl;
        if (Loopflag) {
          Loopflag = 0;
          Currout++;
          *Byteinteger(Currout) = Nl;
        }
        Size = 0;
        Linebase = Currout;
        Lastsep = Nl;
      } else {
        N = 0;
        if (Status & 64) {
          N = Deltamargin;
          if (Extramargin) N = Margin;
        }
        Stat -= N;
        while (Currout < Stat) {
          Currout++;
          *Byteinteger(Currout) = ' ';
        }
        if (Lastsep != ';') Limit = Currout + Linelength - Margin + N;
        for (;;) {
          Rp++;
          N = Rec[Rp];
          if (!N) break;
          if (N > 0) {
            Sn = Keyword[N] + Keybase;
            Flag = Kflags[N];
            Z = Sflags[N];
            Slength = *Byteinteger(Sn);
          } else {
            Sn = Strings[-N];
            Flag = 0;
            Z = 0;
            Slength = Tlength[-N];
          }
          if (Rp >= Rplim || (Slength + Currout > Limit && N <= Lasttext)) Continue();
          if (Z) {
            Nest(Z) = Currout - Linebase;
            Rem(Z) = Rp;
          }
          if ((Flag & Options & 15) != 0 || ((Pmode ^ Flag) & 128) == 0) Space();
          if (Flag & Pmode) Percent();
          for (J = Sn + 1; J <= Sn + *Byteinteger(Sn); J++) {
            Currout++;
            *Byteinteger(Currout) = *Byteinteger(J);
          }
          if (Flag & Options & 120) Space();
          if (0 >= N || N > Lasttext) Pmode = 128;
        }
        if (!Ownflag) goto Owns;
        Currout++;
        *Byteinteger(Currout) = Thissep;
        Lastsep = Thissep;
        if (Loopflag != 0 && (Status & 2) != 0) {
          Currout++;
          *Byteinteger(Currout) = Nl;
        }
        if (Status & 1) {
          Level = Level << 1;
          if (Status & 128) Level = Level | 1;
          Mlimit = Mlimit << 1;
          if (Margin >= Maxmargin || (Indentblocks == 0 && (Status & 128) != 0)) Mlimit = Mlimit | 1;
          if (Margin == 0 && Extramargin != 0)
            Margin = Initialmargin;
          else if (!(Mlimit & 1))
            Margin += Deltamargin;
        }
        if (Lastsep == ';') {
          *Byteinteger(Currout + 1) = ' ';
          Currout += 2;
          *Byteinteger(Currout) = ' ';
        } else
          Linebase = Currout;
        if (Currin >= Endoffile || (Status & 7) == 7) break;
      }
    }
  }
  Closefiles();
  return;
  void Space(void) {
    if (' ' != *Byteinteger(Currout) && *Byteinteger(Currout) != Nl && *Byteinteger(Currout) != '(') {
      Currout++;
      *Byteinteger(Currout) = ' ';
      Pmode = 128;
    }
  }
  void Percent(void) {
    if (Pmode) {
      if (' ' != *Byteinteger(Currout) && *Byteinteger(Currout) != Nl && *Byteinteger(Currout) != '(') {
        Currout++;
        *Byteinteger(Currout) = ' ';
      }
      Currout++;
      *Byteinteger(Currout) = '%';
      Pmode = 0;
    }
  }
}
static void Connekt(_imp_string File, int *Mode, int *Flag) {
  int J;
  J = 0;
  *Mode = J;
  if (*Flag == 5) *Flag = 0;
}
static int Parse(int Entry) {
  int Ss;
  int Sp;
  int Trp;
  int Tpt;
  int L;
  unsigned char Modes;
  int Put(void) {
    Spt--;
    Rp++;
    Rec[Rp] = Spt;
    Tlength[-Spt] = Slength;
    Strings[-Spt] = Sad;
    *String(Sad) = St;
    Sad = Sad + 1 + *Byteinteger(Addr(St));
    return (Spt);
  }
  void Sym(void) {
    for (;;) {
      Currin++;
      S = *Byteinteger(Currin);
      if ('A' > S || S > 'Z') Mode = 0;
      if (S == '%')
        Mode = 32;
      else {
        if (S != ' ') {
          S += Mode;
          if (S != 'C' + 32 || *Byteinteger(Currin + 1) != Nl) return;
          Currin++;
          Mode = 0;
        }
        Spaces() = Packnames;
      }
    }
  }
  int Constant(void) {
    int T;
    int Lim;
    int Cs;
    Slength = 0;
    St = _imp_str_literal("");
    Sym();
    while ('0' <= S && S <= '9' || S == '.' || S == '@') {
      Cs = Currin;
      St = _imp_join(St, Tostring(S));
      Sym();
    }
    if (_imp_strcmp(St, _imp_str_literal("")) != 0) {
      Currin = Cs;
      return (Put());
    }
    if (S == 'M' || S == 'X' || S == 'B') {
      St = Tostring(S);
      T = Currin;
      Sym();
      if (S != '\'') {
        Currin = T;
        return (0);
      }
    }
    Lim = Currin + 255;
    while (S == '\'') {
      do {
        if (S == Nl && Slength == 0) Slength = *Byteinteger(Addr(St));
        St = _imp_join(St, Tostring(S));
        Currin++;
        S = *Byteinteger(Currin);
      } while (S != '\'' && Currin <= Lim);
      St = _imp_join(St, _imp_str_literal("'"));
      Cs = Currin;
      Sym();
    }
    if (!Slength) Slength = *Byteinteger(Addr(St));
    if (_imp_strcmp(St, _imp_str_literal("")) != 0) {
      Currin = Cs;
      return (Put());
    }
    return (0);
  }
  int Name(void) {
    int Z;
    Sym();
    if ('A' > S || S > 'Z') return (0);
    St = _imp_str_literal("");
    for (;;) {
      Spaces() = 1;
      St = _imp_join(St, Tostring(S));
      Z = Currin;
      Sym();
      if (('A' > S || S > 'Z') && ('0' > S || S > '9')) {
        Slength = *Byteinteger(Addr(St));
        Currin = Z;
        return (Put());
      }
      if (!Spaces()) St = _imp_join(St, _imp_str_literal(" "));
    }
  }
  static int Bip_sw;
  static void *Bip[16 /*0:15*/] = {
      &&Bip_0, &&Bip_1, &&Bip_2,  &&Bip_3,  &&Bip_4,  &&Bip_5,  &&Bip_6,  &&Bip_7,
      &&Bip_8, &&Bip_9, &&Bip_10, &&Bip_11, &&Bip_12, &&Bip_13, &&Bip_14, &&Bip_15,
  };
  Trp = Rp;
  Tpt = Currin;
  Modes = Mode;
Failure:;
  Rp = Trp;
  Currin = Tpt;
  Mode = Modes;
  Entry++;
  Sp = Main[Entry];
  if (!Sp) return (1);
Success:;
  Sp++;
  Ss = Sub[Sp];
  if (!Ss) return (0);
  goto *Bip[Bip_sw = (unsigned)Ss >> 12 & 15];
Bip_1:;
  if (!Parse(Ss & 0xFFF)) goto Success;
  goto Failure;
Bip_0:;
  Ss = Ss & 0xFFF;
  L = Literal[Ss];
  for (Ss = Ss + 1; Ss <= Ss + L; Ss++) {
    Sym();
    if (S != Literal[Ss]) goto Failure;
  }
  goto Success;
Bip_15:;
  if (Name()) goto Success;
  goto Failure;
Bip_3:;
  if (Constant()) goto Success;
  goto Failure;
Bip_4:;
  if (Isolateloops) Loopflag = 1;
  goto Success;
Bip_5:;
  Status = Status | 1;
  goto Success;
Bip_6:;
  Status = Status | 2;
  goto Success;
Bip_7:;
  Status = Status | 4;
  goto Success;
Bip_8:;
  if (Leaveowns != 0 && *Byteinteger(Currin) != '*') goto Failure;
  Ownflag = 0;
  Rp++;
  Rec[Rp] = 0;
  Thissep = Nl;
  goto Success;
Bip_10:;
  Inbase++;
  Status = Status | 32;
Bip_9:;
  Status = Status | 16;
  Rp++;
  Rec[Rp] = Currin - Inbase - 1;
  goto Success;
Bip_11:;
  if (Decsrelative) Status = Status | 64;
  goto Success;
Bip_12:;
  if (Extramargin) Status = Status | 64;
  Status = Status | 128;
  goto Success;
Bip_13:;
  Status = Status | 8;
  goto Success;
Bip_14:;
  Sym();
  if (S != Nl && S != ';') goto Failure;
  Thissep = S;
  if (Splitstats) Thissep = Nl;
  Rp++;
  Rec[Rp] = 0;
  goto Success;
Bip_2:;
  Rp++;
  Rec[Rp] = Ss & 0xFFF;
  goto Success;
}
static void Create(_imp_string File, int *Size, int *Flag) {
  *Size = 3;
  if (*Flag == 0 || *Flag == 3) Connekt(File, *Size, *Flag);
}
static void Compress(_imp_string File) {}
static void Setupfiles(_imp_string *S) {
  int Flag;
  int Size;
  Ok = 0;
  Input = _imp_str_literal("");
  Output = _imp_str_literal("");
  Optionfile = _imp_str_literal("");
  if (!_imp_resolve(*S, Input, _imp_str_literal("/"), Output)) Input = *S;
  if (!_imp_resolve(Input, Input, _imp_str_literal(","), Optionfile)) Optionfile = _imp_str_literal("");
  if (_imp_strcmp(Output, _imp_str_literal("")) == 0) Output = Input;
  Size = 0;
  Currin = Size;
  if (Flag) {
    Printstring(_imp_join(_imp_str_literal("CANNOT CONNECT "), _imp_join(Input, _imp_str_literal(": "))));
    Write(Flag, 1);
    Newline();
    return;
  }
  if (*Integer(Currin + 12)) {
    Printstring(_imp_join(Input, _imp_str_literal(" IS NOT A SOURCE FILE\\n")));
    return;
  }
  Size = *Integer(Currin);
  if (Size < 10) {
    Printstring(_imp_join(Input, _imp_str_literal(" IS A NULL FILE\\n")));
    return;
  }
  Endoffile = Currin + Size;
  while (*Byteinteger(Endoffile) != Nl) Endoffile--;
  Currout = (unsigned)((Size * 6) + 4095) >> 12;
  Segs = (unsigned)(Currout + 15) >> 4;
  Create(_imp_str_literal("SP#WORK"), Currout, Flag);
  if (Flag) {
    Printstring(_imp_str_literal("CANNOT CREATE WORK FILE"));
    Write(Flag, 1);
    Newline();
    return;
  }
  Header = Currout;
  Currout += 16;
  *Byteinteger(Currout) = Nl;
  Currin += 15;
  *Integer(Header) = 1 << 16;
  *Integer(Header + 4) = 16;
  *Integer(Header + 8) = Segs;
  *Integer(Header + 12) = 0;
  Ok = 1;
}
static void Closefiles(void) {
  void Newgens(void) {}
}
static void Setoptions(void) {
  _imp_string S;
  _imp_string T;
  int J;
  unsigned char Optflag;
  unsigned char Word;
  void Line(_imp_string * S) {
    int J;
    if (!Optflag) return;
    *S = _imp_str_literal("");
    do {
      for (;;) {
        do
          Readsymbol(J);
        while (J == ' ');
        if (J == Nl) break;
        *S = _imp_join(*S, Tostring(J));
      }
    } while (_imp_strcmp(*S, _imp_str_literal("")) == 0);
  }
  void Set(_imp_string * S) {
    _imp_string N;
    _imp_string Opt;
    int V;
    int K;
    int C;
    int Num;
    unsigned char Not;
    static const _imp_string Param[31 /*1:31*/] = {
        _imp_str_literal("IB"), _imp_str_literal("LB"), _imp_str_literal("SB"), _imp_str_literal("TB"),
        _imp_str_literal("SK"), _imp_str_literal("PN"), _imp_str_literal("SS"), _imp_str_literal("CN"),
        _imp_str_literal("BC"), _imp_str_literal("LS"), _imp_str_literal("JA"), _imp_str_literal("LR"),
        _imp_str_literal("SC"), _imp_str_literal("DR"), _imp_str_literal("SL"), _imp_str_literal("SE"),
        _imp_str_literal("IL"), _imp_str_literal("EM"), _imp_str_literal("LO"), _imp_str_literal("CR"),
        _imp_str_literal("EC"), _imp_str_literal("MI"), _imp_str_literal("LL"), _imp_str_literal("CT"),
        _imp_str_literal("ML"), _imp_str_literal("CE"), _imp_str_literal("XN"), _imp_str_literal("IM"),
        _imp_str_literal("SM"), _imp_str_literal("CL"), _imp_str_literal("LC")};
    static int Params = 31;
    static int Bools = 21;
    Opt = *S;
    Not = 1;
    Num = 0;
    if (_imp_resolve(*S, *S, _imp_str_literal("="), N)) {
      Num = -1;
      V = 0;
      J = Addr(N);
      for (J = J + 1; J <= J + *Length(N); J++) {
        C = *Byteinteger(J) - '0';
        if (0 > C || C > 9) {
          Printstring(_imp_join(N, _imp_str_literal(" ?\\n")));
          return;
        }
        V = V * 10 + C;
      }
      if (V > 255) {
        Printstring(_imp_join(N, _imp_str_literal(" ?\\n")));
        return;
      }
    }
    if (Num == 0 && _imp_resolve(*S, NULL, _imp_str_literal("\\"), *S)) Not = 0;
    for (J = 1; J <= Params; J++)
      if (Param[J] == *S) {
        if (((Bools - J) ^ Num) < 0) {
          Printstring(_imp_join(*S, _imp_str_literal("= ?\\n")));
          return;
        }
        K = Not;
        if (Num < 0) K = V;
        Word(J) = K;
        Oplist = _imp_join(Oplist, _imp_join(_imp_str_literal(" "), Opt));
        return;
      }
    Printstring(_imp_join(*S, _imp_str_literal(" ?\\n")));
  }
  Oplist = _imp_str_literal("\\n!! OPTIONS:");
  Ok = 1;
  if (_imp_strcmp(Optionfile, _imp_str_literal("")) != 0) {
    Ok = 0;
    Optflag = 0;
    if (_imp_resolve(Optionfile, NULL, _imp_str_literal("["), S)) {
      if (_imp_resolve(S, S, _imp_str_literal("]"), NULL)) Optflag = 0;
      S = _imp_join(S, _imp_str_literal(",*"));
    } else {
      Optflag = 1;
      Prompt(_imp_str_literal("OPTIONS:"));
      Selectinput(76);
    }
    for (;;) {
      Line(S);
      while (_imp_resolve(S, T, _imp_str_literal(","), S)) Set(T);
      if (_imp_strcmp(S, _imp_str_literal("*")) == 0) break;
      Set(S);
    }
    if (*Charno(Output, 1) == '.') {
      *String(Currout) = _imp_join(Oplist, _imp_str_literal("\\n\\n"));
      *Byteinteger(Currout) = Nl;
      Currout = Currout + *Length(Oplist) + 2;
    }
  }
  Deltamargin = Mi;
  Linelength = Ll;
  Commenttab = Ct;
  Maxmargin = Ml;
  Secmargin = Secondarymargin;
  if (40 >= Linelength || Linelength >= 133) {
    Printstring(_imp_str_literal("INVALID LINE LENGTH\\n"));
    return;
  }
  if (0 >= Commenttab || Commenttab >= Linelength - 20) {
    Printstring(_imp_str_literal("INVALID COMMENT MARGIN\\n"));
    return;
  }
  if (Maxmargin >= Linelength - 20) {
    Printstring(_imp_str_literal("INVALID MAX MARGIN\\n"));
    return;
  }
  if (Deltamargin > Maxmargin << 1) {
    Printstring(_imp_str_literal("INVALID MARGIN INCREMENT\\n"));
    return;
  }
  if (Secmargin > (Deltamargin << 1) + Safetyfactor) {
    Printstring(_imp_str_literal("INVALID SECONDARY MARGIN\\n"));
    return;
  }
  if (Initialmargin > 30) {
    Printstring(_imp_str_literal("INVALID INITIAL MARGIN\\n"));
    return;
  }
  if (Deltamargin == 0 && Secmargin == 0 && Initialmargin == 0) Margin = 1;
  if (Extramargin) Margin = Initialmargin;
  if (Splitkeywords) Splitconds = 1;
  Commentlength = Linelength - Commenttab;
  Textbase = Addr(Symfile[0]);
  Keybase = Addr(Keysyms[1]);
  Rmargin = Commentlimit;
  Fullline = Linelength;
  Linelength -= Safetyfactor;
  Options =
      17 * Splitkeywords + 34 * Splitconds + (Spacelists << 6) + (Isolatebrackets << 2) + (Spaceequals << 3) + 128;
  Linebase = Currout;
  Size = 0;
  Commentflag = Justifyall << 1 | Commentsnormal;
  Commentflag = Commentflag ^ 0b010;
  Firstdisp = Deltamargin - Initialmargin;
  if (!Commentline) Commentline = Fullline;
  Ok = 1;
}
int _imp_mainep(int _imp_argc, char **_imp_argv) {
  Soap(_imp_str_literal("test.imp"));
  exit(0);
  return (1);
}
