// File: /workspace/github_c_makefile_star2_O0/42Bastian[P]lyxass/mnemonics.c
// Function: op9
int op9(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);
    writeByte((char)l);
  } else {
    brace = atom == '(';
    if ( (err = Expression( &l )) == EXPR_ERROR ) return 1;
    if ( brace && last_atom == ')' ){
      Warning("LDX (n) translates to LDX n\n");
    }

    if ( l < 0 || l > 65535 ) return Error(WORD_ERR,"");
    CYCLES += 3;
    op |= 0x04;
    if ( l > 255 || err == EXPR_UNSOLVED || Current.pass2 ){
      op |= 0x08;
      flag = 1;
      ++CYCLES;
    }
    if ( TestAtom(',') ){
      if ( !TestAtomOR('y','Y') ) 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 0xaea9
leaq -0x10(%rbp), %rdi
callq 0xc920
movl %eax, -0xc(%rbp)
cmpl $0x1, %eax
jne 0xae55
movl $0x1, -0x4(%rbp)
jmp 0xb00d
cmpl $-0x80, -0x10(%rbp)
jl 0xae64
cmpl $0xff, -0x10(%rbp)
jle 0xae7d
movl $0x1a, %edi
leaq 0x61ed(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xb00d
leaq 0xd944(%rip), %rax      # 0x187c8
movq (%rax), %rax
movl (%rax), %ecx
addl $0x2, %ecx
movl %ecx, (%rax)
movl -0x8(%rbp), %eax
movsbl %al, %edi
callq 0x3340
movl -0x10(%rbp), %eax
movsbl %al, %edi
callq 0x3470
jmp 0xaff9
leaq 0x16070(%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 0xaedb
movl $0x1, -0x4(%rbp)
jmp 0xb00d
cmpl $0x0, -0x18(%rbp)
je 0xaef9
leaq 0x1603c(%rip), %rax     # 0x20f24
cmpl $0x29, (%rax)
jne 0xaef9
leaq 0x6619(%rip), %rdi      # 0x1150d
callq 0xd910
cmpl $0x0, -0x10(%rbp)
jl 0xaf08
cmpl $0xffff, -0x10(%rbp)    # imm = 0xFFFF
jle 0xaf21
movl $0x1b, %edi
leaq 0x6149(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xb00d
leaq 0xd8a0(%rip), %rax      # 0x187c8
movq (%rax), %rax
movl (%rax), %ecx
addl $0x3, %ecx
movl %ecx, (%rax)
movl -0x8(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x8(%rbp)
cmpl $0xff, -0x10(%rbp)
jg 0xaf5a
cmpl $0x2, -0xc(%rbp)
je 0xaf5a
leaq 0xd6a7(%rip), %rax      # 0x185f8
cmpl $0x0, 0xe4(%rax)
je 0xaf7b
movl -0x8(%rbp), %eax
orl $0x8, %eax
movl %eax, -0x8(%rbp)
movl $0x1, -0x14(%rbp)
leaq 0xd857(%rip), %rax      # 0x187c8
movq (%rax), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl $0x2c, %edi
callq 0x5a90
cmpl $0x0, %eax
je 0xafce
movl $0x79, %edi
movl $0x59, %esi
callq 0x5af0
cmpl $0x0, %eax
jne 0xafb4
movl $0x12, %edi
leaq 0x60b3(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xb00d
movl -0x8(%rbp), %eax
orl $0x10, %eax
movl %eax, -0x8(%rbp)
leaq 0xd804(%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 0xafec
movl -0x10(%rbp), %eax
movswl %ax, %edi
callq 0x3670
jmp 0xaff7
movl -0x10(%rbp), %eax
movsbl %al, %edi
callq 0x3470
jmp 0xaff9
cmpl $0x2, -0xc(%rbp)
jne 0xb006
movb $0x0, %al
callq 0xcfe0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)