// File: /workspace/github_c_makefile_star2_O2/Edilbert[P]BS9/bs9.c
// Function: Phase2
void Phase2(void)
{
   int i,l,Eof;

   pc        =   -1;
   EnumValue =   -1;
   ForcedEnd =    0;
   ListOn    =    1;
   CPU       = 6309;
   Scope[0]  =    0;
   ModuleStart =  0;

   for (i=0 ; i < 11 ; ++i) minlab[i] = UNDEF;

   if (IfLevel)
   {
      printf("\n*** Error in conditional assembly ***\n");
      if (IfLevel == 1)
         printf("*** an #endif statement is missing\n");
      else
         printf("*** %d #endif statements are missing\n",IfLevel);
      exit(1);
   }
   rewind(sf);
   LiNo = 0; TotalLiNo = 0;
   fgets(Line,sizeof(Line),sf);
   Eof = feof(sf);
   while (!Eof || IncludeLevel > 0)
   {
      ++LiNo; ++TotalLiNo;
      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
      ParseLine(Line);
      if (MacLev)
      {
         NextMacLine(Line);
         ListOn = MacList;
      }
      else
      {
         fgets(Line,sizeof(Line),sf);
         ListOn = ListGlobal;
      }
      Eof = feof(sf) || ForcedEnd;
      if (Eof && IncludeLevel > 0) Eof = CloseInclude();
      if (GenEnd < pc) GenEnd = pc; // Remember highest assenble address
      if (ErrNum >= ERRMAX)
      {
         printf("\n*** Error count reached maximum of %d ***\n",ErrNum);
         printf("Assembly stopped\n");
         return;
      }
   }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
orl $-0x1, 0xa836(%rip)     # 0x13734
orl $-0x1, 0xa81f(%rip)     # 0x13724
andl $0x0, 0x7b5a4(%rip)     # 0x844b0
movl $0x1, 0x82a2(%rip)      # 0x111b8
andl $0x0, 0x7b253(%rip)     # 0x84170
movl $0x18a5, 0x8289(%rip)   # imm = 0x18A5
movb $0x0, 0x1ae72(%rip)     # 0x23da0
xorl %eax, %eax
leaq 0x7b5d9(%rip), %rcx     # 0x84510
cmpq $0x2c, %rax
je 0x8f4a
movl $0xff0000, (%rax,%rcx)  # imm = 0xFF0000
addq $0x4, %rax
jmp 0x8f37
cmpl $0x0, 0x7b573(%rip)     # 0x844c4
jne 0x90be
movq 0x7b21a(%rip), %rdi     # 0x84178
callq 0x2140
andl $0x0, 0x1adee(%rip)     # 0x23d58
andl $0x0, 0x1adef(%rip)     # 0x23d60
movq 0x7b200(%rip), %rdx     # 0x84178
leaq 0x1af21(%rip), %rbx     # 0x23ea0
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x21c0
movq 0x7b1e5(%rip), %rdi     # 0x84178
callq 0x2230
movl 0x1ba62(%rip), %ecx     # 0x24a00
leaq 0x820f(%rip), %r14      # 0x111b4
leaq 0xa77c(%rip), %r15      # 0x13728
testl %eax, %eax
je 0x8fb8
testl %ecx, %ecx
jle 0x90b8
incl 0x1ad9a(%rip)           # 0x23d58
incl 0x1ad9c(%rip)           # 0x23d60
movq %rbx, %rdi
callq 0x2110
testl %eax, %eax
je 0x8ff9
movl %eax, %ecx
decl %ecx
movslq %ecx, %rcx
cmpb $0xa, (%rcx,%rbx)
jne 0x8feb
cltq
movb $0x0, -0x1(%rax,%rbx)
decq %rax
testl %eax, %eax
je 0x8ff9
cltq
cmpb $0xd, -0x1(%rax,%rbx)
jne 0x8ff9
movb $0x0, -0x1(%rax,%rbx)
movq %rbx, %rdi
callq 0x86f9
cmpl $0x0, 0x7d900(%rip)     # 0x86908
je 0x9017
movq %rbx, %rdi
callq 0x85cd
movq %r15, %rax
jmp 0x902e
movq 0x7b15a(%rip), %rdx     # 0x84178
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x21c0
movq %r14, %rax
movl (%rax), %eax
movl %eax, 0x8182(%rip)      # 0x111b8
movq 0x7b13b(%rip), %rdi     # 0x84178
callq 0x2230
movl %eax, %ecx
xorl %eax, %eax
orl 0x7b464(%rip), %ecx     # 0x844b0
setne %dl
movl 0x1b9ab(%rip), %ecx     # 0x24a00
testl %ecx, %ecx
setg %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x9071
callq 0x8cbe
movl 0x1b991(%rip), %ecx     # 0x24a00
jmp 0x9073
movb %dl, %al
movl 0xa6bb(%rip), %edx      # 0x13734
cmpl %edx, 0x1aced(%rip)     # 0x23d6c
jge 0x9087
movl %edx, 0x1ace5(%rip)     # 0x23d6c
movl 0x1b99f(%rip), %esi     # 0x24a2c
cmpl 0xa68d(%rip), %esi      # 0x13720
jl 0x8fac
leaq 0x3543(%rip), %rdi      # 0xc5e3
xorl %eax, %eax
callq 0x2130
leaq 0x3929(%rip), %rdi      # 0xc9d7
popq %rbx
popq %r14
popq %r15
jmp 0x20a0
popq %rbx
popq %r14
popq %r15
retq
leaq 0x3923(%rip), %rdi      # 0xc9e8
callq 0x20a0
movl 0x7b3f4(%rip), %esi     # 0x844c4
cmpl $0x1, %esi
jne 0x90e3
leaq 0x3933(%rip), %rdi      # 0xca0f
callq 0x20a0
jmp 0x90f1
leaq 0x34d3(%rip), %rdi      # 0xc5bd
xorl %eax, %eax
callq 0x2130
pushq $0x1
popq %rdi
callq 0x22f0