// File: /workspace/github_c_makefile_star2_O1/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 0x6b51c(%rip), %rdi     # 0x724eb
leaq 0x6b51a(%rip), %rsi     # 0x724f0
callq 0x6ce0
testq %rax, %rax
je 0x71e9
movq %rax, %rbx
leaq 0x6b505(%rip), %rdi     # 0x724f3
movl $0xe, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x6b90
leaq 0x274ca9(%rip), %r13    # 0x27bcb0
leaq 0x2a(%r13), %r12
leaq 0x6b4f0(%rip), %r14     # 0x72502
xorl %r15d, %r15d
movswl (%r12), %ecx
cmpl $-0x1, %ecx
je 0x702f
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x61e0
incq %r15
addq $0x2c, %r12
cmpq $0x4000, %r15           # imm = 0x4000
jne 0x7015
movl $0xa, %edi
movq %rbx, %rsi
callq 0x6920
leaq 0x2a(%r13), %r15
leaq 0x9d7b9(%rip), %r14     # 0xa4810
xorl %r12d, %r12d
movswl (%r15), %ebp
cmpl $-0x1, %ebp
je 0x70af
movslq %ebp, %rax
movq %rax, %rcx
shlq $0x5, %rcx
leaq (%rcx,%rax,2), %rax
cmpb $0x0, 0x1e(%r14,%rax)
jne 0x70af
movw $0xffff, (%r15)         # imm = 0xFFFF
leaq 0x6b487(%rip), %rdi     # 0x7250d
movl %r12d, %esi
xorl %eax, %eax
callq 0x24cb4
movl -0x2a(%r15), %ecx
movl -0x26(%r15), %r8d
movq %rbx, %rdi
leaq 0x6b47d(%rip), %rsi     # 0x7251f
movl %r12d, %edx
movl %ebp, %r9d
xorl %eax, %eax
callq 0x61e0
incq %r12
addq $0x2c, %r15
cmpq $0x4000, %r12           # imm = 0x4000
jne 0x705a
movl $0xa, %edi
movq %rbx, %rsi
callq 0x6920
leaq 0x2a(%r13), %rbp
leaq 0x6b48f(%rip), %r15     # 0x72566
xorl %r12d, %r12d
movq %r12, %rax
shlq $0x5, %rax
leaq (%rax,%r12,2), %rax
cmpb $-0x1, 0x1e(%r14,%rax)
jne 0x7145
addq %r14, %rax
addq $0x1e, %rax
movq %rbp, %rdx
xorl %ecx, %ecx
movswq (%rdx), %rsi
movl %esi, %esi
cmpq %rsi, %r12
je 0x7119
incq %rcx
addq $0x2c, %rdx
cmpq $0x4000, %rcx           # imm = 0x4000
jne 0x70f9
movl $0x4000, %ecx           # imm = 0x4000
cmpl $0x4000, %ecx           # imm = 0x4000
jne 0x7145
movb $0x0, (%rax)
leaq 0x6b422(%rip), %rdi     # 0x7254d
movl %r12d, %esi
xorl %eax, %eax
callq 0x24cb4
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x61e0
incq %r12
cmpq $0x4000, %r12           # imm = 0x4000
jne 0x70da
movl $0xa, %edi
movq %rbx, %rsi
callq 0x6920
leaq 0x6b436(%rip), %r15     # 0x7259b
xorl %ebp, %ebp
xorl %r12d, %r12d
imulq $0x2c, %r12, %r14
movzwl 0x2a(%r13,%r14), %eax
cmpw $-0x1, %ax
je 0x71c3
addq %r13, %r14
xorl %ecx, %ecx
cmpq %rcx, %rbp
je 0x718c
cmpw %ax, 0x2a(%r13,%rcx)
je 0x719b
addq $0x2c, %rcx
cmpq $0xb0000, %rcx          # imm = 0xB0000
jne 0x717f
jmp 0x71c3
leaq 0x6b3e2(%rip), %rdi     # 0x72584
movl %r12d, %esi
xorl %eax, %eax
callq 0x24cb4
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
cmpq $0x4000, %r12           # imm = 0x4000
jne 0x716a
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