// File: /workspace/github_c_makefile_star2_O2/42Bastian[P]lyxass/mnemonics.c
// Function: op8
int op8(int op)
{
  int err;
  int32_t l;
  int flag = 0;
  int brace = 0;

  if ( TestAtom('#') ){

    if ( (err = Expression( &l )) == EXPR_ERROR ) return 1;
    if ( l < -128 || l > 255 ) return Error(BYTE_ERR,"");
    CYCLES += 2;
    writeConstByte(op == 0x20 ? 0x89 : op);
    writeByte((char)l);
  } else {
    brace = atom == '(';
    if ( (err = Expression( &l )) == EXPR_ERROR ) return 1;
    if ( brace && last_atom == ')' ){
      Warning("BIT/LDY/CPY (n) translates to BIT/LDY/CPY n\n");
    }

    if ( l < 0 || l > 65535 ) return Error(WORD_ERR,"");
    op |= 0x04;
    CYCLES += 3;
    if ( l > 255 || err == EXPR_UNSOLVED || Current.pass2 ){
      op |= 0x08;
      flag = 1;
      CYCLES++;
    }
    if ( TestAtom(',') ){
      if ( (op & 0xc0) == 0xc0) return Error(SYNTAX_ERR,"");                     // no cpy ABCD,x !!!
      if ( !TestAtomOR('x','X') ) return Error(SYNTAX_ERR,"");
      op |= 0x10;
      CYCLES++;
    }

    writeConstByte(op);
    if ( flag ){
      writeWordLittle((short)l);
    } else {
      writeByte((char)l);
    }
  }
  if ( err == EXPR_UNSOLVED ) saveCurrentLine();
  return 0;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebp
pushq $0x23
popq %rdi
callq 0x4da7
testl %eax, %eax
je 0x7eb0
leaq 0x4(%rsp), %rdi
callq 0x929a
cmpl $0x1, %eax
je 0x7ec9
movl %eax, %ebx
movl $0xffffff00, %eax       # imm = 0xFFFFFF00
addl 0x4(%rsp), %eax
cmpl $0xfffffe7f, %eax       # imm = 0xFFFFFE7F
ja 0x7f09
leaq 0x40e9(%rip), %rsi      # 0xbf92
pushq $0x1a
jmp 0x7fe8
leaq 0x15079(%rip), %rax     # 0x1cf30
movl (%rax), %r14d
leaq 0x4(%rsp), %rdi
callq 0x929a
cmpl $0x1, %eax
jne 0x7ed1
pushq $0x1
popq %rbp
jmp 0x7ff0
movl %eax, %ebx
cmpl $0x28, %r14d
jne 0x7ef1
leaq 0x15054(%rip), %rax     # 0x1cf34
cmpl $0x29, (%rax)
jne 0x7ef1
leaq 0x456e(%rip), %rdi      # 0xc45a
callq 0x9cd8
cmpl $0x10000, 0x4(%rsp)     # imm = 0x10000
jb 0x7f4c
leaq 0x4090(%rip), %rsi      # 0xbf92
pushq $0x1b
jmp 0x7fe8
leaq 0xc8c8(%rip), %rax      # 0x147d8
movq (%rax), %rax
addl $0x2, (%rax)
cmpl $0x20, %ebp
movl $0x89, %eax
cmovnel %ebp, %eax
movsbl %al, %edi
callq 0x3323
movsbl 0x4(%rsp), %edi
callq 0x33cf
xorl %ebp, %ebp
cmpl $0x2, %ebx
jne 0x7ff0
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x960c
jmp 0x7ff0
leaq 0xc885(%rip), %r15      # 0x147d8
movq (%r15), %rax
movl (%rax), %ecx
leal 0x3(%rcx), %edx
movl %edx, (%rax)
cmpl $0x100, 0x4(%rsp)       # imm = 0x100
setl %dl
cmpl $0x2, %ebx
setne %sil
andb %dl, %sil
leaq 0xc68f(%rip), %rdx      # 0x14608
cmpl $0x0, 0xe4(%rdx)
sete %r14b
andb %sil, %r14b
je 0x7f8e
orl $0x4, %ebp
jmp 0x7f96
orl $0xc, %ebp
addl $0x4, %ecx
movl %ecx, (%rax)
pushq $0x2c
popq %rdi
callq 0x4da7
testl %eax, %eax
je 0x7fc1
movl %ebp, %eax
notl %eax
testb $-0x40, %al
je 0x7fdf
pushq $0x78
popq %rdi
pushq $0x58
popq %rsi
callq 0x4dd8
testl %eax, %eax
je 0x7fdf
orl $0x10, %ebp
movq (%r15), %rax
incl (%rax)
movsbl %bpl, %edi
callq 0x3323
movl 0x4(%rsp), %eax
testb %r14b, %r14b
je 0x7ffd
movsbl %al, %edi
callq 0x33cf
xorl %ebp, %ebp
jmp 0x7ff0
leaq 0x3fac(%rip), %rsi      # 0xbf92
pushq $0x12
popq %rdi
callq 0x96cc
movl %eax, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movswl %ax, %edi
callq 0x34fb
jmp 0x7f33