// File: /workspace/github_c_makefile_star2_O2/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 0x4d82
orl $-0x1, (%rbx)
xorl %eax, %eax
callq 0x4dc3
leaq 0x1315d(%rip), %rbp     # 0x1cf30
movl (%rbp), %eax
andl $-0x21, %eax
cmpl $0x50, %eax
je 0x9e26
cmpl $0x52, %eax
jne 0x9e61
callq 0x31e0
movq (%rax), %rax
leaq 0x13146(%rip), %rcx     # 0x1cf38
movslq (%rcx), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x9e61
callq 0x4d44
leaq 0x18(%rsp), %rdi
callq 0x8a58
cmpl $0x11, %eax
je 0x9efa
movl 0x18(%rsp), %eax
cmpl $0x20, %eax
jge 0x9efa
jmp 0x9f78
leaq 0x1310b(%rip), %rax     # 0x1cf38
movl (%rax), %eax
andl $-0x21, %eax
cmpl $0x43, %eax
jne 0x9e61
movl $0x40, (%rbx)
callq 0x4d44
callq 0x4d44
movslq (%rbp), %rax
leaq 0x1395e(%rip), %rcx     # 0x1d7b0
cmpl $0x0, (%rcx,%rax,4)
je 0x9f7a
callq 0x4d94
leaq 0x130b8(%rip), %r12     # 0x1cf20
movq (%r12), %r14
leaq 0x18(%rsp), %rdi
callq 0x4fa0
testl %eax, %eax
je 0x9e82
pushq $0x1
popq %rax
jmp 0x9f7c
leaq 0x18(%rsp), %rdi
leaq 0x14(%rsp), %rsi
callq 0x59a0
testq %rax, %rax
je 0x9efa
movq %rax, %r15
cmpl $0x40, 0x4(%rax)
jne 0x9efa
cmpq $-0x1, 0x8(%r15)
je 0x9efa
cmpl $0x3, (%r15)
jl 0x9f0b
movb $0x72, -0x1(%r14)
movq 0x8(%r15), %rax
pushq $0xa
popq %rcx
cqto
idivq %rcx
addb $0x30, %al
movb %al, (%r14)
movq 0x8(%r15), %rax
cqto
idivq %rcx
addb $0x30, %dl
movb %dl, 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 0x9f63
leaq 0x2091(%rip), %rsi      # 0xbf92
pushq $0x2c
popq %rdi
callq 0x96cc
jmp 0x9f7c
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)
movq 0x8(%r15), %rax
pushq $0xa
popq %rcx
cqto
idivq %rcx
addb $0x30, %al
movb %al, (%r14)
movq 0x8(%r15), %rax
cqto
idivq %rcx
addb $0x30, %dl
movb %dl, 0x1(%r14)
movb (%rbp), %al
movb %al, 0x2(%r14)
movq 0x8(%rsp), %r14
movq %r14, (%r12)
movsbl (%r14), %eax
leaq 0x12fc6(%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