// File: /workspace/github_c_makefile_star2_O2/Edilbert[P]BS9/bs9.c
// Function: CheckCondition
int CheckCondition(char *p)
{
   int r,v,Ifdef,Ifndef,Ifval;
   r = 0;
   if (*p == '#') ++p; // old syntax #if, #endif, etc.
   if (!strcmpword(p,"error") && Pass)
   {
      CheckSkip();
      if (Skipping) return 0;     // Include line in listing
      ErrorMsg("%s\n",p+6);
      exit(1);
   }
   Ifdef  = !strcmpword(p,"ifdef");
   Ifndef = !strcmpword(p,"ifndef");
   Ifval  = !strcmpword(p,"if");
   if (Ifdef || Ifndef || Ifval)
   {
      r = 1;
      IfLevel++;
      if (IfLevel > 9)
      {
         ++ErrNum;
         ErrorMsg("More than 10  IF or IFDEF conditions nested\n");
         exit(1);
      }
      if (Ifdef)
      {
         p = EvalOperand(p+6,&v,0);
         SkipLine[IfLevel] = v == UNDEF;
      }
      else if (Ifndef)
      {
         p = EvalOperand(p+7,&v,0);
         SkipLine[IfLevel] = v != UNDEF;
      }
      else // if (Ifval)
      {
         p = EvalOperand(p+3,&v,0);
         SkipLine[IfLevel] = v == UNDEF || v == 0;
      }
      CheckSkip();
      if (ListOn && !Pass)
      {
         PrintLiNo();
         if (SkipLine[IfLevel])
            fprintf(lf,"%4.4x FALSE    %s\n",SkipLine[IfLevel],Line);
         else
            fprintf(lf,"0000 TRUE     %s\n",Line);
      }
      if (df) fprintf(df,"%5d %4.4x          %s\n",LiNo,SkipLine[IfLevel],Line);
   }
   else if (!strcmpword(p,"else"))
   {
      r = 1;
      SkipLine[IfLevel] = !SkipLine[IfLevel];
      CheckSkip();
      PrintLiNo();
      if (ListOn && !Pass) fprintf(lf,"              %s\n",Line);
   }
   if (!strcmpword(p,"endif"))
   {
   if (df) fprintf(df,"inside Check endif\n");
      r = 1;
      IfLevel--;
      PrintLiNo();
      if (ListOn && !Pass) fprintf(lf,"              %s\n",Line);
      if (IfLevel < 0)
      {
         ++ErrNum;
         ErrorMsg("endif without if\n");
         exit(1);
      }
      CheckSkip();
      if (df) fprintf(df,"ENDIF SkipLevel[%d]=%d\n",IfLevel,SkipLine[IfLevel]);
   }
   return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
cmpb $0x23, (%rdi)
sete %bl
addq %rdi, %rbx
leaq 0x5dee(%rip), %rsi      # 0xbcc6
movq %rbx, %rdi
callq 0x2994
testl %eax, %eax
jne 0x5f1b
cmpl $0x0, 0x1eb2d(%rip)     # 0x24a18
je 0x5f1b
callq 0x5e8d
xorl %ebp, %ebp
cmpl $0x0, 0x7e5c5(%rip)     # 0x844c0
jne 0x61c9
addq $0x6, %rbx
leaq 0x5315(%rip), %rdi      # 0xb221
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2af7
jmp 0x61f9
leaq 0x5daa(%rip), %rsi      # 0xbccc
movq %rbx, %rdi
callq 0x2994
movl %eax, %r14d
leaq 0x5d9e(%rip), %rsi      # 0xbcd2
movq %rbx, %rdi
callq 0x2994
movl %eax, %r15d
leaq 0x5e04(%rip), %rsi      # 0xbd4a
movq %rbx, %rdi
callq 0x2994
pushq $0x1
popq %rbp
testl %r14d, %r14d
je 0x5f79
testl %r15d, %r15d
je 0x5f79
testl %eax, %eax
je 0x5f79
leaq 0x5ddc(%rip), %rsi      # 0xbd42
movq %rbx, %rdi
callq 0x2994
testl %eax, %eax
je 0x5fd3
xorl %ebp, %ebp
jmp 0x611f
movl 0x7e545(%rip), %eax     # 0x844c4
leal 0x1(%rax), %ecx
movl %ecx, 0x7e53c(%rip)     # 0x844c4
cmpl $0x9, %eax
jge 0x61d6
testl %r14d, %r14d
je 0x6032
testl %r15d, %r15d
je 0x6057
addq $0x3, %rbx
leaq 0x4(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x37d5
movq %rax, %rbx
movl (%r14), %eax
cmpl $0xff0000, %eax         # imm = 0xFF0000
sete %cl
testl %eax, %eax
sete %al
orb %cl, %al
jmp 0x607a
movslq 0x7e4ea(%rip), %rax     # 0x844c4
leaq 0x7e4ef(%rip), %rcx     # 0x844d0
xorl %edx, %edx
cmpl $0x0, (%rcx,%rax,4)
sete %dl
movl %edx, (%rcx,%rax,4)
callq 0x5e8d
callq 0x2c67
cmpl $0x0, 0xb1ba(%rip)      # 0x111b8
je 0x611f
cmpl $0x0, 0x1ea0d(%rip)     # 0x24a18
jne 0x611f
movq 0x1e9f0(%rip), %rdi     # 0x24a08
leaq 0x51f4(%rip), %rsi      # 0xb213
leaq 0x1de7a(%rip), %rdx     # 0x23ea0
xorl %eax, %eax
callq 0x2210
jmp 0x611f
addq $0x6, %rbx
leaq 0x4(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x37d5
movq %rax, %rbx
cmpl $0xff0000, (%r14)       # imm = 0xFF0000
sete %al
jmp 0x607a
addq $0x7, %rbx
leaq 0x4(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x37d5
movq %rax, %rbx
cmpl $0xff0000, (%r14)       # imm = 0xFF0000
setne %al
movzbl %al, %eax
movslq 0x7e440(%rip), %rcx     # 0x844c4
leaq 0x7e445(%rip), %r14     # 0x844d0
movl %eax, (%r14,%rcx,4)
callq 0x5e8d
cmpl $0x0, 0xb11d(%rip)      # 0x111b8
je 0x60ed
cmpl $0x0, 0x1e974(%rip)     # 0x24a18
jne 0x60ed
callq 0x2c67
movslq 0x7e412(%rip), %rax     # 0x844c4
movl (%r14,%rax,4), %edx
movq 0x1e94b(%rip), %rdi     # 0x24a08
testl %edx, %edx
je 0x60d8
leaq 0x5c3e(%rip), %rsi      # 0xbd06
leaq 0x1ddd1(%rip), %rcx     # 0x23ea0
xorl %eax, %eax
callq 0x2210
jmp 0x60ed
leaq 0x5c3a(%rip), %rsi      # 0xbd19
leaq 0x1ddba(%rip), %rdx     # 0x23ea0
xorl %eax, %eax
callq 0x2210
movq 0x1e91c(%rip), %rdi     # 0x24a10
testq %rdi, %rdi
je 0x611f
movl 0x1dc59(%rip), %edx     # 0x23d58
movslq 0x7e3be(%rip), %rax     # 0x844c4
movl (%r14,%rax,4), %ecx
leaq 0x5c1a(%rip), %rsi      # 0xbd2b
leaq 0x1dd88(%rip), %r8      # 0x23ea0
xorl %eax, %eax
callq 0x2210
leaq 0x5c21(%rip), %rsi      # 0xbd47
movq %rbx, %rdi
callq 0x2994
testl %eax, %eax
jne 0x61c9
movq 0x1e8d3(%rip), %rcx     # 0x24a10
testq %rcx, %rcx
je 0x6154
leaq 0x5c04(%rip), %rdi      # 0xbd4d
pushq $0x13
popq %rsi
pushq $0x1
popq %rdx
callq 0x2300
decl 0x7e36a(%rip)           # 0x844c4
callq 0x2c67
cmpl $0x0, 0xb052(%rip)      # 0x111b8
je 0x618d
cmpl $0x0, 0x1e8a9(%rip)     # 0x24a18
jne 0x618d
movq 0x1e890(%rip), %rdi     # 0x24a08
leaq 0x5094(%rip), %rsi      # 0xb213
leaq 0x1dd1a(%rip), %rdx     # 0x23ea0
xorl %eax, %eax
callq 0x2210
cmpl $0x0, 0x7e330(%rip)     # 0x844c4
js 0x61e5
callq 0x5e8d
movq 0x1e86e(%rip), %rdi     # 0x24a10
pushq $0x1
popq %rbp
testq %rdi, %rdi
je 0x61c9
movslq 0x7e313(%rip), %rdx     # 0x844c4
leaq 0x7e318(%rip), %rax     # 0x844d0
movl (%rax,%rdx,4), %ecx
leaq 0x5bb1(%rip), %rsi      # 0xbd73
xorl %eax, %eax
callq 0x2210
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
incl 0x1e850(%rip)           # 0x24a2c
leaq 0x5af6(%rip), %rdi      # 0xbcd9
jmp 0x61f2
incl 0x1e841(%rip)           # 0x24a2c
leaq 0x5b6f(%rip), %rdi      # 0xbd61
xorl %eax, %eax
callq 0x2af7
pushq $0x1
popq %rdi
callq 0x22f0