// File: /workspace/github_c_makefile_star2_O0/42Bastian[P]lyxass/jaguar.c
// Function: load_reg
int load_reg(int op )
{
  int reg1,reg2,save_reg1;
  int save = 0;

  if ( !TestAtom('(') ) return Error(SYNTAX_ERR,"");

  if ( GetRegister( &reg1 ) ) return 1;

  if ( TestAtom(')') ){
    op = 41;
  } else {
    if ( atom != '+' ) return Error(SYNTAX_ERR,"");
    GetAtom();
    op = 58;
    save_reg1 = reg1;
    reg1 -= 14;
    if ( reg1  < 0 || reg1 > 1 ) return Error(SYNTAX_ERR,"");
    op += reg1;

    SavePosition();

    if ( GetRegister( &reg1 ) ){
      int32_t l;
      int err;
      RestorePosition();

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

      if ( err == EXPR_UNSOLVED ){
        save = 1;
        l = 4;
      }

      if ( !mac_mode ){
        if ( (l & 3) ) return Error(IMM_ERR,"x % 4 != 0");
        l >>= 2;
      }
      if ( l == 0 ){
        op = 41;
        reg1 = save_reg1;
        Warning("Index 0, using non-indexed LOAD");
      } else {
        if ( l < 0 || l > 32 ) return Error(IMM_ERR,"4<=x<=128");
        reg1 = l == 32 ? 0 : l;
        op -= 15;
      }
    }
    if ( !TestAtom(')') ) return Error(SYNTAX_ERR,"");
  }

  if ( !TestAtom(',') ) return Error(SYNTAX_ERR,"");

  if ( GetRegister( &reg2 ) ) return 1;

  if ( save ) saveCurrentLine();

  op = ( op << 10 ) | ( reg1 << 5 ) | reg2;

  writeOp( op );

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x28, %edi
callq 0x5a90
cmpl $0x0, %eax
jne 0xebba
movl $0x12, %edi
leaq 0x24b0(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xede3
leaq -0xc(%rbp), %rdi
callq 0xde90
cmpl $0x0, %eax
je 0xebd4
movl $0x1, -0x4(%rbp)
jmp 0xede3
movl $0x29, %edi
callq 0x5a90
cmpl $0x0, %eax
je 0xebef
movl $0x29, -0x8(%rbp)
jmp 0xed74
leaq 0x1232a(%rip), %rax     # 0x20f20
cmpl $0x2b, (%rax)
je 0xec14
movl $0x12, %edi
leaq 0x2456(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xede3
callq 0x59e0
movl $0x3a, -0x8(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0xc(%rbp), %eax
subl $0xe, %eax
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jl 0xec3b
cmpl $0x1, -0xc(%rbp)
jle 0xec54
movl $0x12, %edi
leaq 0x2416(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xede3
movl -0xc(%rbp), %eax
addl -0x8(%rbp), %eax
movl %eax, -0x8(%rbp)
callq 0x5a50
leaq -0xc(%rbp), %rdi
callq 0xde90
cmpl $0x0, %eax
je 0xed4d
callq 0x5a70
leaq -0x1c(%rbp), %rdi
callq 0xc920
movl %eax, -0x20(%rbp)
cmpl $0x11, %eax
jne 0xec96
movl $0x1, -0x4(%rbp)
jmp 0xede3
cmpl $0x2, -0x20(%rbp)
jne 0xecaa
movl $0x1, -0x18(%rbp)
movl $0x4, -0x1c(%rbp)
leaq 0x12eef(%rip), %rax     # 0x21ba0
cmpl $0x0, (%rax)
jne 0xece3
movl -0x1c(%rbp), %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0xecda
movl $0x2b, %edi
leaq 0x3034(%rip), %rsi      # 0x11d01
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xede3
movl -0x1c(%rbp), %eax
sarl $0x2, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0xed04
movl $0x29, -0x8(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0xc(%rbp)
leaq 0x300f(%rip), %rdi      # 0x11d0c
callq 0xd910
jmp 0xed4b
cmpl $0x0, -0x1c(%rbp)
jl 0xed10
cmpl $0x20, -0x1c(%rbp)
jle 0xed29
movl $0x2b, %edi
leaq 0x3010(%rip), %rsi      # 0x11d2c
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xede3
cmpl $0x20, -0x1c(%rbp)
jne 0xed36
xorl %eax, %eax
movl %eax, -0x24(%rbp)
jmp 0xed3c
movl -0x1c(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x8(%rbp), %eax
subl $0xf, %eax
movl %eax, -0x8(%rbp)
jmp 0xed4d
movl $0x29, %edi
callq 0x5a90
cmpl $0x0, %eax
jne 0xed72
movl $0x12, %edi
leaq 0x22f5(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xede3
jmp 0xed74
movl $0x2c, %edi
callq 0x5a90
cmpl $0x0, %eax
jne 0xed99
movl $0x12, %edi
leaq 0x22ce(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xede3
leaq -0x10(%rbp), %rdi
callq 0xde90
cmpl $0x0, %eax
je 0xedb0
movl $0x1, -0x4(%rbp)
jmp 0xede3
cmpl $0x0, -0x18(%rbp)
je 0xedbd
movb $0x0, %al
callq 0xcfe0
movl -0x8(%rbp), %eax
shll $0xa, %eax
movl -0xc(%rbp), %ecx
shll $0x5, %ecx
orl %ecx, %eax
orl -0x10(%rbp), %eax
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
movswl %ax, %edi
callq 0xda40
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)