// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x8(%rbp)
leaq -0xc(%rbp), %rdi
callq 0xde90
cmpl $0x0, %eax
je 0xeee5
movl $0x1, -0x4(%rbp)
jmp 0xf0ec
movl $0x2c, %edi
callq 0x5a90
cmpl $0x0, %eax
je 0xef03
movl $0x28, %edi
callq 0x5a90
cmpl $0x0, %eax
jne 0xef1c
movl $0x12, %edi
leaq 0x2e27(%rip), %rsi      # 0x11d36
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xf0ec
leaq -0x10(%rbp), %rdi
callq 0xde90
cmpl $0x0, %eax
je 0xef36
movl $0x1, -0x4(%rbp)
jmp 0xf0ec
movl $0x29, %edi
callq 0x5a90
cmpl $0x0, %eax
je 0xef51
movl $0x2f, -0x8(%rbp)
jmp 0xf0c6
leaq 0x11fc8(%rip), %rax     # 0x20f20
cmpl $0x2b, (%rax)
je 0xef76
movl $0x12, %edi
leaq 0x2de2(%rip), %rsi      # 0x11d4b
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xf0ec
callq 0x59e0
movl $0x3c, -0x8(%rbp)
cmpl $0xe, -0x10(%rbp)
je 0xefa7
cmpl $0xf, -0x10(%rbp)
je 0xefa7
movl $0x12, %edi
leaq 0x2dbf(%rip), %rsi      # 0x11d59
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xf0ec
movl -0x10(%rbp), %eax
subl $0xe, %eax
addl -0x8(%rbp), %eax
movl %eax, -0x8(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x14(%rbp)
callq 0x5a50
leaq -0x10(%rbp), %rdi
callq 0xde90
cmpl $0x0, %eax
je 0xf09f
movl -0x8(%rbp), %eax
subl $0xb, %eax
movl %eax, -0x8(%rbp)
callq 0x5a70
leaq -0x18(%rbp), %rdi
callq 0xc920
movl %eax, -0x1c(%rbp)
cmpl $0x11, %eax
jne 0xeffb
movl $0x1, -0x4(%rbp)
jmp 0xf0ec
cmpl $0x2, -0x1c(%rbp)
jne 0xf008
movb $0x0, %al
callq 0xcfe0
leaq 0x12b91(%rip), %rax     # 0x21ba0
cmpl $0x0, (%rax)
jne 0xf041
movl -0x18(%rbp), %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0xf038
movl $0x2b, %edi
leaq 0x2cd6(%rip), %rsi      # 0x11d01
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xf0ec
movl -0x18(%rbp), %eax
sarl $0x2, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0xf062
movl $0x2f, -0x8(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x10(%rbp)
leaq 0x2d13(%rip), %rdi      # 0x11d6e
callq 0xd910
jmp 0xf09d
cmpl $0x0, -0x18(%rbp)
jl 0xf06e
cmpl $0x20, -0x18(%rbp)
jle 0xf084
movl $0x2b, %edi
leaq 0x2cb2(%rip), %rsi      # 0x11d2c
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xf0ec
cmpl $0x20, -0x18(%rbp)
jne 0xf091
xorl %eax, %eax
movl %eax, -0x20(%rbp)
jmp 0xf097
movl -0x18(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x10(%rbp)
jmp 0xf09f
movl $0x29, %edi
callq 0x5a90
cmpl $0x0, %eax
jne 0xf0c4
movl $0x12, %edi
leaq 0x1fa3(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xf0ec
jmp 0xf0c6
movl -0x8(%rbp), %eax
shll $0xa, %eax
movl -0x10(%rbp), %ecx
shll $0x5, %ecx
orl %ecx, %eax
orl -0xc(%rbp), %eax
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
movswl %ax, %edi
callq 0xda40
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)