// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/src/bstub.c
// Function: checkextras
void checkextras(void)
{
     int       i,j,ext;
     FILE      *fp;

     fp=fopen("exts", "wt");
     if( fp == NULL ) {
          return;
     }

     fprintf(fp,"\n\t SPR\t\t EXT\n\n");
     for( i=0; i<MAXSPRITES; i++ ) {
          if( sprite[i].extra != -1 ) {
               fprintf(fp,"\t%4d\t\t%4d\n", i,sprite[i].extra);
          }
     }

     fprintf(fp, "\n");
     // check for maps to unlocked XT
     for( i=0; i<MAXSPRITES; i++ ) {
          ext=sprite[i].extra;
          if( ext != -1 ) {
               if( spriteXT[ext].lock == 0x00 ) {
                    sprite[i].extra=-1;
                    buildprintf("bad extra for %d\n", i);
                    fprintf(fp, "Sprite %d at %d,%d mapped to unlocked XT %4d\n", i,sprite[i].x,sprite[i].y,ext);
               }
          }
     }

     fprintf(fp, "\n");
     // check for locked XT with no mapping
     for( i=0; i<MAXSPRITES; i++ ) {
          if( spriteXT[i].lock == 0xFF ) {
               for( j=0; j<MAXSPRITES; j++ ) {
                    if( sprite[j].extra == i ) {
                         break;
                    }
               }
               if( j == MAXSPRITES ) {
                    spriteXT[i].lock=0x00;
                    buildprintf("extension %d had no map\n", i);
                    fprintf(fp, "No mapping for locked XT %4d\n", i);
               }
          }
     }

     fprintf(fp, "\n");
     // check for non-unique mapping
     for( i=0; i<MAXSPRITES; i++ ) {
          ext=sprite[i].extra;
          if( ext != -1 ) {
               for( j=0; j<MAXSPRITES; j++ ) {
                    if( (j != i) && (sprite[j].extra == ext) ) {
                         buildprintf("non unique map for %d\n",i);
                         fprintf(fp, "Non unique mapping for %4d at %d,%d\n", i,sprite[i].x,sprite[i].y);
                         break;
                    }
               }
          }
     }

     fclose(fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x61528(%rip), %rdi     # 0x684eb
leaq 0x61526(%rip), %rsi     # 0x684f0
callq 0x6ce0
testq %rax, %rax
je 0x71c0
movq %rax, %rbx
leaq 0x61511(%rip), %rdi     # 0x684f3
pushq $0xe
popq %rsi
pushq $0x1
popq %rdx
movq %rax, %rcx
callq 0x6b90
leaq 0x26ecb9(%rip), %r13    # 0x275cb0
leaq 0x2a(%r13), %r12
leaq 0x61500(%rip), %r14     # 0x68502
xorl %r15d, %r15d
cmpq $0x4000, %r15           # imm = 0x4000
je 0x7031
movswl (%r12), %ecx
cmpl $-0x1, %ecx
je 0x7028
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x61e0
incq %r15
addq $0x2c, %r12
jmp 0x7005
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x6920
leaq 0x2a(%r13), %r15
leaq 0x977c9(%rip), %r14     # 0x9e810
xorl %r12d, %r12d
cmpq $0x4000, %r12           # imm = 0x4000
je 0x70a9
movswl (%r15), %ebp
cmpl $-0x1, %ebp
je 0x70a0
movslq %ebp, %rax
imulq $0x22, %rax, %rax
cmpb $0x0, 0x1e(%rax,%r14)
jne 0x70a0
orw $-0x1, (%r15)
leaq 0x61496(%rip), %rdi     # 0x6850d
movl %r12d, %esi
xorl %eax, %eax
callq 0x22427
movl -0x2a(%r15), %ecx
movl -0x26(%r15), %r8d
movq %rbx, %rdi
leaq 0x6148c(%rip), %rsi     # 0x6851f
movl %r12d, %edx
movl %ebp, %r9d
xorl %eax, %eax
callq 0x61e0
incq %r12
addq $0x2c, %r15
jmp 0x704a
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x6920
pushq $0x2a
popq %rbp
leaq 0x614a8(%rip), %r15     # 0x68566
xorl %r12d, %r12d
cmpq $0x4000, %r12           # imm = 0x4000
je 0x7128
imulq $0x22, %r12, %rax
cmpb $-0x1, 0x1e(%rax,%r14)
jne 0x7123
addq %r14, %rax
addq $0x1e, %rax
movq %rbp, %rcx
leaq 0x2c(%rcx), %rdx
cmpq $0xb0056, %rdx          # imm = 0xB0056
je 0x70ff
movswq (%r13,%rcx), %rcx
movl %ecx, %esi
movq %rdx, %rcx
cmpq %rsi, %r12
jne 0x70e0
jmp 0x7123
movb $0x0, (%rax)
leaq 0x61444(%rip), %rdi     # 0x6854d
movl %r12d, %esi
xorl %eax, %eax
callq 0x22427
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x61e0
incq %r12
jmp 0x70c1
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x6920
leaq 0x61461(%rip), %r15     # 0x6859b
xorl %ebp, %ebp
xorl %r12d, %r12d
cmpq $0x4000, %r12           # imm = 0x4000
je 0x71aa
imulq $0x2c, %r12, %r14
movzwl 0x2a(%r13,%r14), %eax
cmpw $-0x1, %ax
je 0x71a1
addq %r13, %r14
xorl %ecx, %ecx
cmpq $0xb0000, %rcx          # imm = 0xB0000
je 0x71a1
cmpq %rcx, %rbp
je 0x7173
cmpw %ax, 0x2a(%r13,%rcx)
je 0x7179
addq $0x2c, %rcx
jmp 0x715d
leaq 0x61404(%rip), %rdi     # 0x68584
movl %r12d, %esi
xorl %eax, %eax
callq 0x22427
movl (%r14), %ecx
movl 0x4(%r14), %r8d
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x61e0
incq %r12
addq $0x2c, %rbp
jmp 0x713f
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6480
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq