// File: /workspace/github_c_makefile_star2_O0/42Bastian[P]lyxass/jaguar.c
// Function: GetRegister
int GetRegister(int *reg)
{
  label_t regL;
  label_t *regL2;
  int32_t solved;
  char *p;

  *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;
  }

  p = srcLinePtr - 1;

  if ( GetLabel(&regL) ) return 1;

  if ( (regL2 = FindLabel(&regL, &solved)) == NULL ){
#if 0 /* allow pass 2 resolving */
    return -1;
#else
    return Error(REG_ERR,"");
#endif
  }

  if (regL2->type != REGISTER ) return -1;

  if (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
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movb $0x0, %al
callq 0x5ad0
leaq 0x13069(%rip), %rax     # 0x20f20
cmpl $0x72, (%rax)
je 0xdecc
leaq 0x1305d(%rip), %rax     # 0x20f20
cmpl $0x52, (%rax)
jne 0xdf55
callq 0x31d0
movq (%rax), %rax
leaq 0x1304d(%rip), %rcx     # 0x20f28
movslq (%rcx), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xdf55
callq 0x59e0
leaq -0x8c(%rbp), %rdi
callq 0xba90
cmpl $0x11, %eax
jne 0xdf1b
movl $0x2c, %edi
leaq 0x314f(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xe1ff
cmpl $0x1f, -0x8c(%rbp)
jle 0xdf3d
movl $0x2c, %edi
leaq 0x312d(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xe1ff
movl -0x8c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0xe1ff
leaq 0x12fb4(%rip), %rax     # 0x20f10
movq (%rax), %rax
addq $-0x1, %rax
movq %rax, -0x88(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x5de0
cmpl $0x0, %eax
je 0xdf84
movl $0x1, -0x4(%rbp)
jmp 0xe1ff
leaq -0x70(%rbp), %rdi
leaq -0x7c(%rbp), %rsi
callq 0x6f20
movq %rax, -0x78(%rbp)
cmpq $0x0, %rax
jne 0xdfb4
movl $0x2c, %edi
leaq 0x30b6(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xe1ff
movq -0x78(%rbp), %rax
cmpl $0x40, 0x4(%rax)
je 0xdfca
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xe1ff
movq -0x78(%rbp), %rax
cmpq $-0x1, 0x8(%rax)
jne 0xdfee
movl $0x2c, %edi
leaq 0x307c(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0xe1ff
movq -0x78(%rbp), %rax
cmpl $0x2, (%rax)
jle 0xe0e0
movq -0x88(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x88(%rbp)
movb $0x72, (%rax)
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movl $0xa, %ecx
cqto
idivq %rcx
addq $0x30, %rax
movb %al, %cl
movq -0x88(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x88(%rbp)
movb %cl, (%rax)
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movl $0xa, %ecx
cqto
idivq %rcx
addq $0x30, %rdx
movb %dl, %cl
movq -0x88(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x88(%rbp)
movb %cl, (%rax)
leaq 0x12ea8(%rip), %rax     # 0x20f20
movl (%rax), %eax
movb %al, %cl
movq -0x88(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x88(%rbp)
movb %cl, (%rax)
movq -0x88(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq 0x12e68(%rip), %rax     # 0x20f10
movq (%rax), %rax
movq %rax, -0x98(%rbp)
leaq 0x12e57(%rip), %rax     # 0x20f10
movq (%rax), %rdi
callq 0x30a0
movq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rsi
movq %rax, %rdx
addq $0x1, %rdx
callq 0x3170
jmp 0xe1c4
movq -0x88(%rbp), %rax
addq $0x4, %rax
movq %rax, -0xb0(%rbp)
leaq 0x12e17(%rip), %rax     # 0x20f10
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
leaq 0x12e06(%rip), %rax     # 0x20f10
movq (%rax), %rdi
callq 0x30a0
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq %rax, %rdx
addq $0x1, %rdx
callq 0x3170
movq -0x88(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x88(%rbp)
movb $0x72, (%rax)
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movl $0xa, %ecx
cqto
idivq %rcx
addq $0x30, %rax
movb %al, %cl
movq -0x88(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x88(%rbp)
movb %cl, (%rax)
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movl $0xa, %ecx
cqto
idivq %rcx
addq $0x30, %rdx
movb %dl, %cl
movq -0x88(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x88(%rbp)
movb %cl, (%rax)
leaq 0x12d77(%rip), %rax     # 0x20f20
movl (%rax), %eax
movb %al, %cl
movq -0x88(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x88(%rbp)
movb %cl, (%rax)
movq -0x88(%rbp), %rcx
leaq 0x12d3e(%rip), %rax     # 0x20f10
movq %rcx, (%rax)
movq -0x88(%rbp), %rax
movsbl (%rax), %ecx
leaq 0x12d42(%rip), %rax     # 0x20f28
movl %ecx, (%rax)
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax,%rax)