// File: /workspace/github_c_makefile_star2_O3/42Bastian[P]lyxass/jaguar.c
// Function: GetRegisterOrPC
int GetRegisterOrPC(int *reg)
{
  extern int LabelTable[256];

  label_t regL,*regL2;
  int32_t solved;
  char *p;

  SavePosition();

  *reg = -1;

  KillSpace();

  if ( (atom == 'r' || atom == 'R') && isdigit(next_atom) ){
   int32_t l;
    GetAtom();
    if ( getdec32(&l) == EXPR_ERR ) return Error(REG_ERR,"");
    if ( l > 31 ) return Error(REG_ERR,"");
    *reg = (int)l;
    return 0;
  }

  if ( (atom == 'p' || atom == 'P') &&
       (next_atom == 'c' || next_atom == 'C') ){
    *reg = 64;
    GetAtom();
    GetAtom();
    if ( !LabelTable[atom] ) return 0;
    RestorePosition();
  }

  p = srcLinePtr - 1;

  if ( GetLabel(&regL) ) return 1;

  if ( (regL2 = FindLabel(&regL, &solved)) == NULL ) return Error(REG_ERR,"");

  if (regL2->type != REGISTER ) return Error(REG_ERR,"");

  if (regL2->type == REGISTER && regL2->value == -1 ) return Error(REG_ERR,"");

  if ( regL2->len > 2 ){
    *p++ = 'r';
    *p++ = (char)(regL2->value / 10 + '0');
    *p++ = (char)(regL2->value % 10 + '0');
    *p++ = atom;
    memmove(p,srcLinePtr,strlen(srcLinePtr)+1);
  } else {
    memmove(p+4,srcLinePtr,strlen(srcLinePtr)+1);
    *p++ = 'r';
    *p++ = (char)(regL2->value / 10 + '0');
    *p++ = (char)(regL2->value % 10 + '0');
    *p++ = atom;
  }
  srcLinePtr = p;
  next_atom = *p;

  *reg = (int)regL2->value;

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
callq 0x4f58
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
xorl %eax, %eax
callq 0x4ff7
leaq 0x1260e(%rip), %rbp     # 0x1cf30
movl (%rbp), %eax
andl $-0x21, %eax
cmpl $0x50, %eax
je 0xa975
cmpl $0x52, %eax
jne 0xa9b0
callq 0x31e0
movq (%rax), %rax
leaq 0x125f7(%rip), %rcx     # 0x1cf38
movslq (%rcx), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0xa9b0
callq 0x4f1a
leaq 0x18(%rsp), %rdi
callq 0x9480
cmpl $0x11, %eax
je 0xaa86
movl 0x18(%rsp), %eax
cmpl $0x20, %eax
jge 0xaa86
jmp 0xab30
leaq 0x125bc(%rip), %rax     # 0x1cf38
movl (%rax), %eax
andl $-0x21, %eax
cmpl $0x43, %eax
jne 0xa9b0
movl $0x40, (%rbx)
callq 0x4f1a
callq 0x4f1a
movslq (%rbp), %rax
leaq 0x12e0f(%rip), %rcx     # 0x1d7b0
cmpl $0x0, (%rcx,%rax,4)
je 0xab32
callq 0x4f6a
leaq 0x12569(%rip), %r12     # 0x1cf20
movq (%r12), %r14
leaq 0x18(%rsp), %rdi
callq 0x52f1
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0xab34
leaq 0x18(%rsp), %rdi
leaq 0x14(%rsp), %rsi
callq 0x60dc
testq %rax, %rax
je 0xaa86
movq %rax, %r15
cmpl $0x40, 0x4(%rax)
jne 0xaa86
cmpq $-0x1, 0x8(%r15)
je 0xaa86
cmpl $0x3, (%r15)
jl 0xaa9c
movb $0x72, -0x1(%r14)
movabsq $0x6666666666666667, %rcx # imm = 0x6666666666666667
movq %rcx, %rax
imulq 0x8(%r15)
movq %rdx, %rax
shrq $0x3f, %rax
shrl $0x2, %edx
addl %eax, %edx
addb $0x30, %dl
movb %dl, (%r14)
movq 0x8(%r15), %rsi
movq %rsi, %rax
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
shrl $0x2, %edx
addl %eax, %edx
addl %edx, %edx
leal (%rdx,%rdx,4), %eax
subl %eax, %esi
addb $0x30, %sil
movb %sil, 0x1(%r14)
movb (%rbp), %al
movb %al, 0x2(%r14)
addq $0x3, %r14
movq (%r12), %r13
movq %r13, %rdi
callq 0x30b0
leaq 0x1(%rax), %rdx
movq %r14, %rdi
movq %r13, %rsi
callq 0x3180
jmp 0xab1b
leaq 0x2505(%rip), %rsi      # 0xcf92
movl $0x2c, %edi
callq 0xa1d8
jmp 0xab34
leaq 0x3(%r14), %rax
movq %rax, 0x8(%rsp)
movq (%r12), %r13
movq %r13, %rdi
callq 0x30b0
leaq 0x1(%rax), %rdx
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x3180
movb $0x72, -0x1(%r14)
movabsq $0x6666666666666667, %rcx # imm = 0x6666666666666667
movq %rcx, %rax
imulq 0x8(%r15)
movq %rdx, %rax
shrq $0x3f, %rax
shrl $0x2, %edx
addl %eax, %edx
addb $0x30, %dl
movb %dl, (%r14)
movq 0x8(%r15), %rsi
movq %rsi, %rax
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
shrl $0x2, %edx
addl %eax, %edx
addl %edx, %edx
leal (%rdx,%rdx,4), %eax
subl %eax, %esi
addb $0x30, %sil
movb %sil, 0x1(%r14)
movb (%rbp), %al
movb %al, 0x2(%r14)
movq 0x8(%rsp), %r14
movq %r14, (%r12)
movsbl (%r14), %eax
leaq 0x1240e(%rip), %rcx     # 0x1cf38
movl %eax, (%rcx)
movl 0x8(%r15), %eax
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq