// File: /workspace/github_c_makefile_star2_O1/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 0x4f53
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
xorl %eax, %eax
callq 0x5037
leaq 0x1252a(%rip), %rbp     # 0x1cf30
movl (%rbp), %r14d
andl $-0x21, %r14d
cmpl $0x50, %r14d
je 0xaa3d
cmpl $0x52, %r14d
jne 0xaa78
callq 0x31e0
movq (%rax), %rax
leaq 0x1250f(%rip), %rcx     # 0x1cf38
movslq (%rcx), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
jne 0xab4e
cmpl $0x50, %r14d
jne 0xaa78
leaq 0x124f4(%rip), %rax     # 0x1cf38
movl (%rax), %eax
andl $-0x21, %eax
cmpl $0x43, %eax
jne 0xaa78
movl $0x40, (%rbx)
callq 0x4f15
callq 0x4f15
movslq (%rbp), %rax
leaq 0x12d47(%rip), %rcx     # 0x1d7b0
cmpl $0x0, (%rcx,%rax,4)
je 0xac1b
callq 0x4f65
leaq 0x124a1(%rip), %r12     # 0x1cf20
movq (%r12), %r14
leaq 0x18(%rsp), %rdi
callq 0x53a9
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0xac1d
leaq 0x18(%rsp), %rdi
leaq 0x14(%rsp), %rsi
callq 0x6140
testq %rax, %rax
je 0xab6f
movq %rax, %r15
cmpl $0x40, 0x4(%rax)
jne 0xab6f
cmpq $-0x1, 0x8(%r15)
je 0xab6f
cmpl $0x3, (%r15)
jl 0xab85
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 0xac04
callq 0x4f15
leaq 0x18(%rsp), %rdi
callq 0x94fc
cmpl $0x11, %eax
je 0xab6f
movl 0x18(%rsp), %eax
cmpl $0x20, %eax
jl 0xac19
leaq 0x241c(%rip), %rsi      # 0xcf92
movl $0x2c, %edi
callq 0xa2c8
jmp 0xac1d
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 0x12325(%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