// File: /workspace/github_c_makefile_star2_O3/42Bastian[P]lyxass/jaguar.c
// Function: store_reg
int store_reg(int op )
{
  int reg1,reg2, save_reg2;

  if ( GetRegister( &reg1 ) ) return 1;

  if ( !TestAtom(',') || !TestAtom('(') ) {
    return Error(SYNTAX_ERR,"Expecting ',' or '('");
  }

  if ( GetRegister( &reg2 ) ) return 1;

  if ( TestAtom(')') ){
    op = 47;
  } else {
    if ( atom != '+' ) return Error(SYNTAX_ERR,"Expecting '+'");
    GetAtom();
    op = 60;

    if ( reg2 != 14 && reg2 != 15 ) {
      return Error(SYNTAX_ERR,"Expecting r14 or r15");
    }

    op += (reg2 - 14);

    save_reg2 = reg2;

    SavePosition();

    if ( GetRegister( &reg2 ) ){
      int32_t l;
      int err;

      op -= 11;

      RestorePosition();

      if ( (err = Expression( &l )) == EXPR_ERR ) return 1;

      if ( err == EXPR_UNSOLVED ) saveCurrentLine();

      if ( !mac_mode ){
        if ( (l & 3) ) return Error(IMM_ERR,"x % 4 != 0");
        l >>= 2;
      }
      if ( l == 0 ){
        op = 47;
        reg2 = save_reg2;
        Warning("Offest 0 using STORE w/o index");
      } else {
        if ( l < 0 || l > 32 ) return Error(IMM_ERR,"4<=x<=128");
        reg2 = l == 32 ? 0 : l;
      }
    }
    if ( !TestAtom(')')) return Error(SYNTAX_ERR,"");
  }
  op = ( op << 10 ) | ( reg2 << 5 ) | reg1;

  writeOp( op );

  return 0;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
leaq 0xc(%rsp), %rdi
callq 0xab43
movl $0x1, %ebx
testl %eax, %eax
je 0xb82f
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
movl $0x2c, %edi
callq 0x4fa8
testl %eax, %eax
je 0xb8a3
movl $0x28, %edi
callq 0x4fa8
testl %eax, %eax
je 0xb8a3
leaq 0x4(%rsp), %rdi
callq 0xab43
testl %eax, %eax
jne 0xb827
movl $0x29, %edi
callq 0x4fa8
movl $0x2f, %ebx
testl %eax, %eax
je 0xb8b9
shll $0xa, %ebx
movl 0x4(%rsp), %eax
shll $0x5, %eax
orl %ebx, %eax
orl 0xc(%rsp), %eax
movswl %ax, %edi
shrl $0xa, %eax
andl $0x3f, %eax
movl %eax, 0x8895(%rip)      # 0x14120
leaq 0x8b1e(%rip), %rax      # 0x143b0
movl (%rax), %eax
movl %eax, 0x888a(%rip)      # 0x14124
callq 0x35cf
xorl %ebx, %ebx
jmp 0xb827
leaq 0x23c8(%rip), %rsi      # 0xdc72
movl $0x12, %edi
addq $0x10, %rsp
popq %rbx
jmp 0xa1d8
leaq 0x11670(%rip), %rax     # 0x1cf30
cmpl $0x2b, (%rax)
jne 0xb8df
callq 0x4f1a
movl 0x4(%rsp), %ebx
leal -0x10(%rbx), %eax
cmpl $-0x3, %eax
ja 0xb8e8
leaq 0x23b8(%rip), %rsi      # 0xdc95
jmp 0xb8aa
leaq 0x23a1(%rip), %rsi      # 0xdc87
jmp 0xb8aa
callq 0x4f58
leaq 0x4(%rsp), %rdi
callq 0xab43
testl %eax, %eax
je 0xb93d
callq 0x4f6a
leaq 0x8(%rsp), %rdi
callq 0x9d6c
cmpl $0x11, %eax
je 0xb942
cmpl $0x2, %eax
jne 0xb91b
xorl %eax, %eax
callq 0xa118
leaq 0x1228e(%rip), %rax     # 0x1dbb0
cmpl $0x0, (%rax)
movl 0x8(%rsp), %eax
je 0xb94c
testl %eax, %eax
je 0xb95e
cmpl $0x20, %eax
jbe 0xb975
leaq 0x232d(%rip), %rsi      # 0xdc68
jmp 0xb957
addl $0x2e, %ebx
jmp 0xb984
movl $0x1, %ebx
jmp 0xb827
testb $0x3, %al
je 0xb9ae
leaq 0x22e6(%rip), %rsi      # 0xdc3d
movl $0x2b, %edi
jmp 0xb9a2
movl %ebx, 0x4(%rsp)
leaq 0x2341(%rip), %rdi      # 0xdcaa
callq 0xa81b
movl $0x2f, %ebx
jmp 0xb984
addl $0x23, %ebx
xorl %ecx, %ecx
cmpl $0x20, %eax
cmovnel %eax, %ecx
movl %ecx, 0x4(%rsp)
movl $0x29, %edi
callq 0x4fa8
testl %eax, %eax
jne 0xb86c
leaq 0x15f5(%rip), %rsi      # 0xcf92
movl $0x12, %edi
callq 0xa1d8
movl %eax, %ebx
jmp 0xb827
sarl $0x2, %eax
movl %eax, 0x8(%rsp)
jmp 0xb92b