// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x8(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x23, %edi
callq 0x5a90
cmpl $0x0, %eax
je 0xab03
leaq -0x10(%rbp), %rdi
callq 0xc920
movl %eax, -0xc(%rbp)
cmpl $0x1, %eax
jne 0xaa99
movl $0x1, -0x4(%rbp)
jmp 0xac8f
cmpl $-0x80, -0x10(%rbp)
jl 0xaaa8
cmpl $0xff, -0x10(%rbp)
jle 0xaac1
movl $0x1a, %edi
leaq 0x65a9(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xac8f
leaq 0xdd00(%rip), %rax      # 0x187c8
movq (%rax), %rax
movl (%rax), %ecx
addl $0x2, %ecx
movl %ecx, (%rax)
cmpl $0x20, -0x8(%rbp)
jne 0xaae2
movl $0x89, %eax
movl %eax, -0x1c(%rbp)
jmp 0xaae8
movl -0x8(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movsbl %al, %edi
callq 0x3340
movl -0x10(%rbp), %eax
movsbl %al, %edi
callq 0x3470
jmp 0xac7b
leaq 0x16416(%rip), %rax     # 0x20f20
cmpl $0x28, (%rax)
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x18(%rbp)
leaq -0x10(%rbp), %rdi
callq 0xc920
movl %eax, -0xc(%rbp)
cmpl $0x1, %eax
jne 0xab35
movl $0x1, -0x4(%rbp)
jmp 0xac8f
cmpl $0x0, -0x18(%rbp)
je 0xab53
leaq 0x163e2(%rip), %rax     # 0x20f24
cmpl $0x29, (%rax)
jne 0xab53
leaq 0x6992(%rip), %rdi      # 0x114e0
callq 0xd910
cmpl $0x0, -0x10(%rbp)
jl 0xab62
cmpl $0xffff, -0x10(%rbp)    # imm = 0xFFFF
jle 0xab7b
movl $0x1b, %edi
leaq 0x64ef(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xac8f
movl -0x8(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x8(%rbp)
leaq 0xdc3d(%rip), %rax      # 0x187c8
movq (%rax), %rax
movl (%rax), %ecx
addl $0x3, %ecx
movl %ecx, (%rax)
cmpl $0xff, -0x10(%rbp)
jg 0xabb4
cmpl $0x2, -0xc(%rbp)
je 0xabb4
leaq 0xda4d(%rip), %rax      # 0x185f8
cmpl $0x0, 0xe4(%rax)
je 0xabd5
movl -0x8(%rbp), %eax
orl $0x8, %eax
movl %eax, -0x8(%rbp)
movl $0x1, -0x14(%rbp)
leaq 0xdbfd(%rip), %rax      # 0x187c8
movq (%rax), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl $0x2c, %edi
callq 0x5a90
cmpl $0x0, %eax
je 0xac50
movl -0x8(%rbp), %eax
andl $0xc0, %eax
cmpl $0xc0, %eax
jne 0xac0c
movl $0x12, %edi
leaq 0x645e(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xac8f
movl $0x78, %edi
movl $0x58, %esi
callq 0x5af0
cmpl $0x0, %eax
jne 0xac36
movl $0x12, %edi
leaq 0x6431(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xac8f
movl -0x8(%rbp), %eax
orl $0x10, %eax
movl %eax, -0x8(%rbp)
leaq 0xdb82(%rip), %rax      # 0x187c8
movq (%rax), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl -0x8(%rbp), %eax
movsbl %al, %edi
callq 0x3340
cmpl $0x0, -0x14(%rbp)
je 0xac6e
movl -0x10(%rbp), %eax
movswl %ax, %edi
callq 0x3670
jmp 0xac79
movl -0x10(%rbp), %eax
movsbl %al, %edi
callq 0x3470
jmp 0xac7b
cmpl $0x2, -0xc(%rbp)
jne 0xac88
movb $0x0, %al
callq 0xcfe0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)