// File: /workspace/github_c_makefile_star2_O0/Edilbert[P]BS9/bs9.c
// Function: RecordMacro
void RecordMacro(char *p)
{
   char Macro[ML];
   int i,j,l,al,an,bl,mf;
   int ap[10];
   char args[ML];
   char Buf[ML];
   char *b;
   char *at;

   if (Macros > MAXMAC -2)
   {
      ++ErrNum;
      ErrorMsg("Too many macros (> %d)\n",MAXMAC);
      exit(1);
   }

   bl = 1;
   mf = strcmpword(p,"MACRO") != 0; // 1 : name MACRO
   if (!mf) p += 5;                 // 0 : MACRO name
   if (df) fprintf(df,"macro type = %d\n",mf);

   p = NextSymbol(p,Macro);
   l = strlen(Macro);
   if (mf) p = StrMatch(p,"MACRO") + 5;
   p = SkipSpace(p);

   if (df)
   {
      fprintf(df,"Macro name: <%s>\n",Macro);
      fprintf(df,"Arglist: <%s>\n",p);
   }

   if (*p == '(') ++p;
   if (mf) an = ScanArgs(p,args,ap);
   else    an = ScanArguments(p,args,ap,MAXARGS);
   if (df)
   {
      fprintf(df,"RecordMacro: %s(",Macro);
      for (i=0 ; i < an ; ++i)
      {
         at = args + ap[i];
         al = strlen(at);
         fprintf(df,"%s[%d]",at,al);
         if (i < an-1) fprintf(df,",");
      }
      fprintf(df,")\n");
   }
   j = MacroIndex(Macro);
   if (j < 0)  // create new entry in macro table
   {
      j = Macros;
      Mac[j].Name = (char *)StrNDup(Macro,l);
      Mac[j].Narg = an;
      Mac[j].Type = mf;
      fgets(Line,sizeof(Line),sf);
      while (!feof(sf) && !StrCaseStr(Line,"ENDM"))
      {
         ++LiNo;
         l = strlen(Line);
         if (l && Line[l-1] == 10) Line[--l] = 0; // Remove linefeed
         if (l && Line[l-1] == 13) Line[--l] = 0; // Remove return

         // parse line and substitute arguments

         p = Line;
         b = Buf;
         while (*p)
         {
            for (i=0 ; i < an ; ++i)
            {
               at = args + ap[i];
               al = strlen(at);
               if (al && !StrnCmp(p,at,al))
               {
                  *b++ = CHAMAC;
                  *b++ = '0' + i;
                  p += al;
                  break;
               }
            }
            if (i == an) *b++ = *p++;
         }
         *b++ = '\n';
         *b = 0;

         if (df)
         {
            fprintf(df,"MAC line  :%s\n",Line);
            fprintf(df,"MAC parsed:%s\n",Buf);
         }
         l = strlen(Buf);
         if (bl == 1)
         {
            bl = l+1;
            Mac[j].Body = (char *)StrNDup(Buf,l);
         }
         else
         {
            bl += l;
            Mac[j].Body = (char *)ReallocOrDie(Mac[j].Body,bl);
            strcat(Mac[j].Body,Buf);
         }
         fgets(Line,sizeof(Line),sf);
      }
      Macros++;
      if (df) fprintf(df,"finished macro %d\n",Macros);
   }
   else  // Skip macro
   {
      if (!Pass) PrintLiNo();
      ++LiNo;
      if (ListOn && !Pass) fprintf(lf,"            %s\n",Line);
      do
      {
         fgets(Line,sizeof(Line),sf);
         if (!Pass)
         {
            PrintLiNo();
            if (ListOn) fprintf(lf,"            %s",Line);
            if (pf) fprintf(pf,"%s",Line);
         }
         ++LiNo;
      } while (!feof(sf) && !StrCaseStr(Line,"ENDM"));
      LiNo-=2;
   }
   if (df) MacroInfo(j);
   ++LiNo;
}

// Assembly:
subq $0x378, %rsp            # imm = 0x378
movq %rdi, 0x370(%rsp)
cmpl $0xc6, 0x7a4b7(%rip)    # 0x86620
jle 0xc197
movl 0x1c89b(%rip), %eax     # 0x28a0c
addl $0x1, %eax
movl %eax, 0x1c892(%rip)     # 0x28a0c
leaq 0x51b6(%rip), %rdi      # 0x11337
movl $0xc8, %esi
movb $0x0, %al
callq 0x3150
movl $0x1, %edi
callq 0x22b0
movl $0x1, 0x258(%rsp)
movq 0x370(%rsp), %rdi
leaq 0x519e(%rip), %rsi      # 0x1134f
callq 0x2e80
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x254(%rsp)
cmpl $0x0, 0x254(%rsp)
jne 0xc1e6
movq 0x370(%rsp), %rax
addq $0x5, %rax
movq %rax, 0x370(%rsp)
cmpq $0x0, 0x1c802(%rip)     # 0x289f0
je 0xc20c
movq 0x1c7f9(%rip), %rdi     # 0x289f0
movl 0x254(%rsp), %edx
leaq 0x5150(%rip), %rsi      # 0x11355
movb $0x0, %al
callq 0x21e0
movq 0x370(%rsp), %rdi
leaq 0x270(%rsp), %rsi
callq 0x2c30
movq %rax, 0x370(%rsp)
leaq 0x270(%rsp), %rdi
callq 0x20f0
movl %eax, 0x264(%rsp)
cmpl $0x0, 0x254(%rsp)
je 0xc267
movq 0x370(%rsp), %rdi
leaq 0x50f9(%rip), %rsi      # 0x1134f
callq 0x2880
addq $0x5, %rax
movq %rax, 0x370(%rsp)
movq 0x370(%rsp), %rdi
callq 0x2830
movq %rax, 0x370(%rsp)
cmpq $0x0, 0x1c76c(%rip)     # 0x289f0
je 0xc2c0
movq 0x1c763(%rip), %rdi     # 0x289f0
leaq 0x270(%rsp), %rdx
leaq 0x50ca(%rip), %rsi      # 0x11366
movb $0x0, %al
callq 0x21e0
movq 0x1c746(%rip), %rdi     # 0x289f0
movq 0x370(%rsp), %rdx
leaq 0x50bf(%rip), %rsi      # 0x11378
movb $0x0, %al
callq 0x21e0
movq 0x370(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x28, %eax
jne 0xc2e4
movq 0x370(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x370(%rsp)
cmpl $0x0, 0x254(%rsp)
je 0xc314
movq 0x370(%rsp), %rdi
leaq 0x120(%rsp), %rsi
leaq 0x220(%rsp), %rdx
callq 0xbe80
movl %eax, 0x25c(%rsp)
jmp 0xc33d
movq 0x370(%rsp), %rdi
leaq 0x120(%rsp), %rsi
leaq 0x220(%rsp), %rdx
movl $0xa, %ecx
callq 0xbbc0
movl %eax, 0x25c(%rsp)
cmpq $0x0, 0x1c6ab(%rip)     # 0x289f0
je 0xc430
movq 0x1c69e(%rip), %rdi     # 0x289f0
leaq 0x270(%rsp), %rdx
leaq 0x5026(%rip), %rsi      # 0x11387
movb $0x0, %al
callq 0x21e0
movl $0x0, 0x26c(%rsp)
movl 0x26c(%rsp), %eax
cmpl 0x25c(%rsp), %eax
jge 0xc41b
leaq 0x120(%rsp), %rax
movslq 0x26c(%rsp), %rcx
movslq 0x220(%rsp,%rcx,4), %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
callq 0x20f0
movl %eax, 0x260(%rsp)
movq 0x1c631(%rip), %rdi     # 0x289f0
movq 0x10(%rsp), %rdx
movl 0x260(%rsp), %ecx
leaq 0x4fc6(%rip), %rsi      # 0x11398
movb $0x0, %al
callq 0x21e0
movl 0x26c(%rsp), %eax
movl 0x25c(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xc403
movq 0x1c5fb(%rip), %rdi     # 0x289f0
leaq 0x43d2(%rip), %rsi      # 0x107ce
movb $0x0, %al
callq 0x21e0
jmp 0xc405
movl 0x26c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x26c(%rsp)
jmp 0xc373
movq 0x1c5ce(%rip), %rdi     # 0x289f0
leaq 0x4026(%rip), %rsi      # 0x1044f
movb $0x0, %al
callq 0x21e0
leaq 0x270(%rsp), %rdi
callq 0x3ac0
movl %eax, 0x268(%rsp)
cmpl $0x0, 0x268(%rsp)
jge 0xc8b4
movl 0x7a1c8(%rip), %eax     # 0x86620
movl %eax, 0x268(%rsp)
leaq 0x270(%rsp), %rdi
movl 0x264(%rsp), %esi
callq 0x26b0
movq %rax, %rcx
movslq 0x268(%rsp), %rdx
leaq 0x7a1ab(%rip), %rax     # 0x86630
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movl 0x25c(%rsp), %ecx
movslq 0x268(%rsp), %rdx
leaq 0x7a18b(%rip), %rax     # 0x86630
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movl 0x254(%rsp), %ecx
movslq 0x268(%rsp), %rdx
leaq 0x7a16b(%rip), %rax     # 0x86630
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
movq 0x7bc82(%rip), %rdx     # 0x88158
leaq 0x1b9a3(%rip), %rdi     # 0x27e80
movl $0x100, %esi            # imm = 0x100
callq 0x2190
movq 0x7bc6a(%rip), %rdi     # 0x88158
callq 0x2200
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, 0xf(%rsp)
jne 0xc520
leaq 0x1b979(%rip), %rdi     # 0x27e80
leaq 0x4e91(%rip), %rsi      # 0x1139f
callq 0x2460
cmpq $0x0, %rax
setne %al
xorb $-0x1, %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0xc52d
jmp 0xc87b
movl 0x1b805(%rip), %eax     # 0x27d38
addl $0x1, %eax
movl %eax, 0x1b7fc(%rip)     # 0x27d38
leaq 0x1b93d(%rip), %rdi     # 0x27e80
callq 0x20f0
movl %eax, 0x264(%rsp)
cmpl $0x0, 0x264(%rsp)
je 0xc595
movl 0x264(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x1b913(%rip), %rax     # 0x27e80
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0xc595
movl 0x264(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x264(%rsp)
movslq %eax, %rcx
leaq 0x1b8ef(%rip), %rax     # 0x27e80
movb $0x0, (%rax,%rcx)
cmpl $0x0, 0x264(%rsp)
je 0xc5db
movl 0x264(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x1b8cd(%rip), %rax     # 0x27e80
movsbl (%rax,%rcx), %eax
cmpl $0xd, %eax
jne 0xc5db
movl 0x264(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x264(%rsp)
movslq %eax, %rcx
leaq 0x1b8a9(%rip), %rax     # 0x27e80
movb $0x0, (%rax,%rcx)
leaq 0x1b89e(%rip), %rax     # 0x27e80
movq %rax, 0x370(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x370(%rsp), %rax
cmpb $0x0, (%rax)
je 0xc729
movl $0x0, 0x26c(%rsp)
movl 0x26c(%rsp), %eax
cmpl 0x25c(%rsp), %eax
jge 0xc6e8
leaq 0x120(%rsp), %rax
movslq 0x26c(%rsp), %rcx
movslq 0x220(%rsp,%rcx,4), %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
callq 0x20f0
movl %eax, 0x260(%rsp)
cmpl $0x0, 0x260(%rsp)
je 0xc6d0
movq 0x370(%rsp), %rdi
movq 0x10(%rsp), %rsi
movslq 0x260(%rsp), %rdx
callq 0x3990
cmpl $0x0, %eax
jne 0xc6d0
movq 0x18(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rsp)
movb $0x60, (%rax)
movl 0x26c(%rsp), %eax
addl $0x30, %eax
movb %al, %cl
movq 0x18(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x18(%rsp)
movb %cl, (%rax)
movl 0x260(%rsp), %ecx
movq 0x370(%rsp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0x370(%rsp)
jmp 0xc6e8
jmp 0xc6d2
movl 0x26c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x26c(%rsp)
jmp 0xc610
movl 0x26c(%rsp), %eax
cmpl 0x25c(%rsp), %eax
jne 0xc724
movq 0x370(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x370(%rsp)
movb (%rax), %cl
movq 0x18(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x18(%rsp)
movb %cl, (%rax)
jmp 0xc5f4
movq 0x18(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rsp)
movb $0xa, (%rax)
movq 0x18(%rsp), %rax
movb $0x0, (%rax)
cmpq $0x0, 0x1c2a3(%rip)     # 0x289f0
je 0xc785
movq 0x1c29a(%rip), %rdi     # 0x289f0
leaq 0x4c47(%rip), %rsi      # 0x113a4
leaq 0x1b71c(%rip), %rdx     # 0x27e80
movb $0x0, %al
callq 0x21e0
movq 0x1c27e(%rip), %rdi     # 0x289f0
leaq 0x20(%rsp), %rdx
leaq 0x4c35(%rip), %rsi      # 0x113b3
movb $0x0, %al
callq 0x21e0
leaq 0x20(%rsp), %rdi
callq 0x20f0
movl %eax, 0x264(%rsp)
cmpl $0x1, 0x258(%rsp)
jne 0xc7e1
movl 0x264(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x258(%rsp)
leaq 0x20(%rsp), %rdi
movl 0x264(%rsp), %esi
callq 0x26b0
movq %rax, %rcx
movslq 0x268(%rsp), %rdx
leaq 0x79e5c(%rip), %rax     # 0x86630
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
jmp 0xc85e
movl 0x264(%rsp), %eax
addl 0x258(%rsp), %eax
movl %eax, 0x258(%rsp)
movslq 0x268(%rsp), %rcx
leaq 0x79e2b(%rip), %rax     # 0x86630
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
movslq 0x258(%rsp), %rsi
callq 0x2640
movq %rax, %rcx
movslq 0x268(%rsp), %rdx
leaq 0x79e01(%rip), %rax     # 0x86630
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movslq 0x268(%rsp), %rcx
leaq 0x79de7(%rip), %rax     # 0x86630
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
leaq 0x20(%rsp), %rsi
callq 0x22a0
movq 0x7b8f3(%rip), %rdx     # 0x88158
leaq 0x1b614(%rip), %rdi     # 0x27e80
movl $0x100, %esi            # imm = 0x100
callq 0x2190
jmp 0xc4e7
movl 0x79d9f(%rip), %eax     # 0x86620
addl $0x1, %eax
movl %eax, 0x79d96(%rip)     # 0x86620
cmpq $0x0, 0x1c15e(%rip)     # 0x289f0
je 0xc8af
movq 0x1c155(%rip), %rdi     # 0x289f0
movl 0x79d7f(%rip), %edx     # 0x86620
leaq 0x4b1a(%rip), %rsi      # 0x113c2
movb $0x0, %al
callq 0x21e0
jmp 0xc9d7
cmpl $0x0, 0x1c13d(%rip)     # 0x289f8
jne 0xc8c2
callq 0x3320
movl 0x1b470(%rip), %eax     # 0x27d38
addl $0x1, %eax
movl %eax, 0x1b467(%rip)     # 0x27d38
cmpl $0x0, 0x88c0(%rip)      # 0x15198
je 0xc8ff
cmpl $0x0, 0x1c117(%rip)     # 0x289f8
jne 0xc8ff
movq 0x1c0fe(%rip), %rdi     # 0x289e8
leaq 0x388f(%rip), %rsi      # 0x10180
leaq 0x1b588(%rip), %rdx     # 0x27e80
movb $0x0, %al
callq 0x21e0
jmp 0xc901
movq 0x7b850(%rip), %rdx     # 0x88158
leaq 0x1b571(%rip), %rdi     # 0x27e80
movl $0x100, %esi            # imm = 0x100
callq 0x2190
cmpl $0x0, 0x1c0d8(%rip)     # 0x289f8
jne 0xc974
callq 0x3320
cmpl $0x0, 0x886a(%rip)      # 0x15198
je 0xc94c
movq 0x1c0b1(%rip), %rdi     # 0x289e8
leaq 0x3ce2(%rip), %rsi      # 0x10620
leaq 0x1b53b(%rip), %rdx     # 0x27e80
movb $0x0, %al
callq 0x21e0
cmpq $0x0, 0x7de64(%rip)     # 0x8a7b8
je 0xc972
movq 0x7de5b(%rip), %rdi     # 0x8a7b8
leaq 0x3cc8(%rip), %rsi      # 0x1062c
leaq 0x1b515(%rip), %rdx     # 0x27e80
movb $0x0, %al
callq 0x21e0
jmp 0xc974
movl 0x1b3be(%rip), %eax     # 0x27d38
addl $0x1, %eax
movl %eax, 0x1b3b5(%rip)     # 0x27d38
movq 0x7b7ce(%rip), %rdi     # 0x88158
callq 0x2200
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, 0xe(%rsp)
jne 0xc9bc
leaq 0x1b4dd(%rip), %rdi     # 0x27e80
leaq 0x49f5(%rip), %rsi      # 0x1139f
callq 0x2460
cmpq $0x0, %rax
setne %al
xorb $-0x1, %al
movb %al, 0xe(%rsp)
movb 0xe(%rsp), %al
testb $0x1, %al
jne 0xc901
movl 0x1b36a(%rip), %eax     # 0x27d38
subl $0x2, %eax
movl %eax, 0x1b361(%rip)     # 0x27d38
cmpq $0x0, 0x1c011(%rip)     # 0x289f0
je 0xc9ed
movl 0x268(%rsp), %edi
callq 0xc040
movl 0x1b345(%rip), %eax     # 0x27d38
addl $0x1, %eax
movl %eax, 0x1b33c(%rip)     # 0x27d38
addq $0x378, %rsp            # imm = 0x378
retq
nopw %cs:(%rax,%rax)