// File: /workspace/github_c_makefile_star2_O0/42Bastian[P]lyxass/pseudo.c
// Function: p_reg
int p_reg(int d)
{
  int32_t l;
  int i,o;
  int allowRedefine;

  if ( sourceMode == LYNX ) {
    return Error(SYNTAX_ERR,"REG only in RISC modes");
  }

  if ( ! Current.Label.len ) Error(SYNTAX_ERR,"");

  if ( TestAtomOR('r','R') ){
    if ( getdec32( &l ) == EXPR_ERR ) return Error(SYNTAX_ERR,"");
    if ( l > 31 ) return Error(SYNTAX_ERR,"");
  } else {
    if ( NeedConst( &l, "REG") ) return 1;
  }

  if ( (l < 0 || l > 31) && l != 99 ) Error(REG_ERR,"");

  if ( (Current.LabelPtr->type == REGISTER ) &&
       (Current.LabelPtr->file != -1) ) return Error(REG1_ERR,"");

  if ( Current.LabelPtr->type != NORMAL &&
       Current.LabelPtr->type != REGISTER ) return Error(SYNTAX_ERR,"");

  o = l;
  i = (int)strlen(Current.LabelPtr->name);
  if ( i > 2 &&
       Current.LabelPtr->name[i-2] == '.' &&
       Current.LabelPtr->name[i-1] == 'a'){
    o += 32;
  }
  allowRedefine = TestAtom('!');
  if ( (o == 99 || o == (99+32)) && allowRedefine ){
    return Error(SYNTAX_ERR,
                 "'!' not allowed with automatic register allocation.");
  }
  if ( o == 99 || o == (99+32) ){
    int end = o-99;
    i = risc[jaguar_mode].regAllocStart;
    if ( o == 99+32 ){
      i+=32;
    }
    o = -1;
    for( ; i >= end; --i){
      if ( risc[jaguar_mode].regs[i].flag == 0 ){
        o = i;
        l = o & 31;
        break;
      }
    }
    if ( o == -1 ){
      return Error(SYNTAX_ERR,"No more free register");
    }
  }

  if ( risc[jaguar_mode].regs[o].flag && allowRedefine == 0 ) {
    char help[256];
    sprintf(help,"Register already defined: %s:%5d",
            file_list[risc[jaguar_mode].regs[o].file].name,
            risc[jaguar_mode].regs[o].line);

    Warning(help);
  }

  risc[jaguar_mode].regs[o].flag = 1;
  risc[jaguar_mode].regs[o].file = Current.File;
  risc[jaguar_mode].regs[o].line = Current.Line;
  risc[jaguar_mode].regs[o].label = Current.LabelPtr;
  ++risc[jaguar_mode].regs[o].refCount;
  Current.LabelPtr->file = Current.File;
  Current.LabelPtr->type = REGISTER;
  Current.LabelPtr->value = l;
  // Current.varModifier++;
  // printf("(%s)%d\n",Current.LabelPtr->name,Current.LabelPtr->value);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movl %edi, -0x8(%rbp)
leaq 0xf19b(%rip), %rax      # 0x185e0
cmpl $0x1, (%rax)
jne 0x9463
movl $0x12, %edi
leaq 0x7f89(%rip), %rsi      # 0x113df
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0x9923
leaq 0xf18e(%rip), %rax      # 0x185f8
cmpl $0x0, 0x28(%rax)
jne 0x9481
movl $0x12, %edi
leaq 0x7be1(%rip), %rsi      # 0x1105d
callq 0xd130
movl $0x72, %edi
movl $0x52, %esi
callq 0x5af0
cmpl $0x0, %eax
je 0x94dd
leaq -0xc(%rbp), %rdi
callq 0xba90
cmpl $0x11, %eax
jne 0x94bc
movl $0x12, %edi
leaq 0x7bae(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0x9923
cmpl $0x1f, -0xc(%rbp)
jle 0x94db
movl $0x12, %edi
leaq 0x7b8f(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0x9923
jmp 0x9500
leaq -0xc(%rbp), %rdi
leaq 0x7f0e(%rip), %rsi      # 0x113f6
callq 0xc9f0
cmpl $0x0, %eax
je 0x94fe
movl $0x1, -0x4(%rbp)
jmp 0x9923
jmp 0x9500
cmpl $0x0, -0xc(%rbp)
jl 0x950c
cmpl $0x1f, -0xc(%rbp)
jle 0x9523
cmpl $0x63, -0xc(%rbp)
je 0x9523
movl $0x2c, %edi
leaq 0x7b3f(%rip), %rsi      # 0x1105d
callq 0xd130
leaq 0xf0ce(%rip), %rax      # 0x185f8
movq 0x88(%rax), %rax
cmpl $0x40, 0x4(%rax)
jne 0x9564
leaq 0xf0ba(%rip), %rax      # 0x185f8
movq 0x88(%rax), %rax
cmpl $-0x1, 0x14(%rax)
je 0x9564
movl $0x2d, %edi
leaq 0x7b06(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0x9923
leaq 0xf08d(%rip), %rax      # 0x185f8
movq 0x88(%rax), %rax
cmpl $0x1, 0x4(%rax)
je 0x95a5
leaq 0xf079(%rip), %rax      # 0x185f8
movq 0x88(%rax), %rax
cmpl $0x40, 0x4(%rax)
je 0x95a5
movl $0x12, %edi
leaq 0x7ac5(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0x9923
movl -0xc(%rbp), %eax
movl %eax, -0x14(%rbp)
leaq 0xf046(%rip), %rax      # 0x185f8
movq 0x88(%rax), %rdi
addq $0x38, %rdi
callq 0x30a0
movl %eax, -0x10(%rbp)
cmpl $0x2, -0x10(%rbp)
jle 0x9616
leaq 0xf026(%rip), %rax      # 0x185f8
movq 0x88(%rax), %rax
movl -0x10(%rbp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movsbl 0x38(%rax,%rcx), %eax
cmpl $0x2e, %eax
jne 0x9616
leaq 0xf005(%rip), %rax      # 0x185f8
movq 0x88(%rax), %rax
movl -0x10(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl 0x38(%rax,%rcx), %eax
cmpl $0x61, %eax
jne 0x9616
movl -0x14(%rbp), %eax
addl $0x20, %eax
movl %eax, -0x14(%rbp)
movl $0x21, %edi
callq 0x5a90
movl %eax, -0x18(%rbp)
cmpl $0x63, -0x14(%rbp)
je 0x9632
cmpl $0x83, -0x14(%rbp)
jne 0x9651
cmpl $0x0, -0x18(%rbp)
je 0x9651
movl $0x12, %edi
leaq 0x7db6(%rip), %rsi      # 0x113fa
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0x9923
cmpl $0x63, -0x14(%rbp)
je 0x9664
cmpl $0x83, -0x14(%rbp)
jne 0x971c
movl -0x14(%rbp), %eax
subl $0x63, %eax
movl %eax, -0x1c(%rbp)
leaq 0xef70(%rip), %rax      # 0x185e4
movslq (%rax), %rcx
leaq 0xda82(%rip), %rax      # 0x17100
imulq $0x808, %rcx, %rcx      # imm = 0x808
addq %rcx, %rax
movl 0x800(%rax), %eax
movl %eax, -0x10(%rbp)
cmpl $0x83, -0x14(%rbp)
jne 0x96a3
movl -0x10(%rbp), %eax
addl $0x20, %eax
movl %eax, -0x10(%rbp)
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movl -0x10(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x96fb
leaq 0xef2b(%rip), %rax      # 0x185e4
movslq (%rax), %rcx
leaq 0xda3d(%rip), %rax      # 0x17100
imulq $0x808, %rcx, %rcx      # imm = 0x808
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x0, (%rax)
jne 0x96ee
movl -0x10(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
andl $0x1f, %eax
movl %eax, -0xc(%rbp)
jmp 0x96fb
jmp 0x96f0
movl -0x10(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x96aa
cmpl $-0x1, -0x14(%rbp)
jne 0x971a
movl $0x12, %edi
leaq 0x7d21(%rip), %rsi      # 0x1142e
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0x9923
jmp 0x971c
leaq 0xeec1(%rip), %rax      # 0x185e4
movslq (%rax), %rcx
leaq 0xd9d3(%rip), %rax      # 0x17100
imulq $0x808, %rcx, %rcx      # imm = 0x808
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x0, (%rax)
je 0x97de
cmpl $0x0, -0x18(%rbp)
jne 0x97de
leaq -0x120(%rbp), %rdi
leaq 0xee81(%rip), %rax      # 0x185e4
movslq (%rax), %rcx
leaq 0xd993(%rip), %rax      # 0x17100
imulq $0x808, %rcx, %rcx      # imm = 0x808
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq 0x8(%rax), %rax
leaq 0xf043(%rip), %rdx      # 0x187d0
imulq $0x204, %rax, %rax      # imm = 0x204
addq %rax, %rdx
addq $0x4, %rdx
leaq 0xee42(%rip), %rax      # 0x185e4
movslq (%rax), %rcx
leaq 0xd954(%rip), %rax      # 0x17100
imulq $0x808, %rcx, %rcx      # imm = 0x808
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
leaq 0x7c79(%rip), %rsi      # 0x11444
movb $0x0, %al
callq 0x31a0
leaq -0x120(%rbp), %rdi
callq 0xd910
leaq 0xedff(%rip), %rax      # 0x185e4
movslq (%rax), %rcx
leaq 0xd911(%rip), %rax      # 0x17100
imulq $0x808, %rcx, %rcx      # imm = 0x808
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl $0x1, (%rax)
leaq 0xede7(%rip), %rax      # 0x185f8
movl 0x4(%rax), %ecx
leaq 0xedc9(%rip), %rax      # 0x185e4
movslq (%rax), %rdx
leaq 0xd8db(%rip), %rax      # 0x17100
imulq $0x808, %rdx, %rdx      # imm = 0x808
addq %rdx, %rax
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
leaq 0xedb4(%rip), %rax      # 0x185f8
movl (%rax), %ecx
leaq 0xed97(%rip), %rax      # 0x185e4
movslq (%rax), %rdx
leaq 0xd8a9(%rip), %rax      # 0x17100
imulq $0x808, %rdx, %rdx      # imm = 0x808
addq %rdx, %rax
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
leaq 0xed82(%rip), %rax      # 0x185f8
movq 0x88(%rax), %rcx
leaq 0xed60(%rip), %rax      # 0x185e4
movslq (%rax), %rdx
leaq 0xd872(%rip), %rax      # 0x17100
imulq $0x808, %rdx, %rdx      # imm = 0x808
addq %rdx, %rax
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
leaq 0xed36(%rip), %rax      # 0x185e4
movslq (%rax), %rcx
leaq 0xd848(%rip), %rax      # 0x17100
imulq $0x808, %rcx, %rcx      # imm = 0x808
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x18(%rax)
leaq 0xed1b(%rip), %rax      # 0x185f8
movl 0x4(%rax), %ecx
leaq 0xed11(%rip), %rax      # 0x185f8
movq 0x88(%rax), %rax
movl %ecx, 0x14(%rax)
leaq 0xed00(%rip), %rax      # 0x185f8
movq 0x88(%rax), %rax
movl $0x40, 0x4(%rax)
movslq -0xc(%rbp), %rcx
leaq 0xece7(%rip), %rax      # 0x185f8
movq 0x88(%rax), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nop