// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/bstub.c
// Function: JS_EditSpriteExts
int
JS_EditSpriteExts(short spritenum)
{
     char      what[50];
     short     j;

     spriteextmodified=1;

     clearmidstatbar16();

     j=sprite[spritenum].extra;

     if ( j < 0 ) {        // .extra is initialized to -1 in build.obj
          printmessage16("No Previous Extension.");
          j=JS_FirstFreeExt();
          if ( j == -1 ) {
               printmessage16("ERROR! Not able to map to an extension.");
               return(-1);
          }
          printmessage16("Extension Mapped.");
          sprite[spritenum].extra=j;
          JS_InitExtension(spritenum, j);
          JS_LockExt(j);
     }
     else {
          printmessage16("Editing Existing Extension.");
     }

     JS_ShowSpriteExts(spritenum);

     sprintf(what, "spriteextra[%d].class     = ", j);
     spriteXT[j].class=getnumber16(what, spriteXT[j].class, 12L, 0);

     sprintf(what, "spriteextra[%d].hitpoints = ", j);
     spriteXT[j].hitpoints=getnumber16(what, spriteXT[j].hitpoints, 256L, 0);

     sprintf(what, "spriteextra[%d].target    = ", j);
     spriteXT[j].target=getnumber16(what, spriteXT[j].target, 4096L, 0);
                                                   
     sprintf(what, "spriteextra[%d].fxmask    = ", j);
     spriteXT[j].fxmask=getnumber16(what, spriteXT[j].fxmask, 256L, 0);

     sprintf(what, "spriteextra[%d].aimask    = ", j);
     spriteXT[j].aimask=getnumber16(what, spriteXT[j].aimask, 256L, 0);

     sprintf(what, "spriteextra[%d].basestat  = ", j);
     spriteXT[j].basestat=getnumber16(what, spriteXT[j].basestat, 4096L, 0);

     sprintf(what, "spriteextra[%d].basepic   = ", j);
     spriteXT[j].basepic=getnumber16(what, spriteXT[j].basepic, 4096L, 0);

     sprintf(what, "spriteextra[%d].standpic = ", j);
     spriteXT[j].standpic=getnumber16(what, spriteXT[j].standpic, 4096L, 0);

     sprintf(what, "spriteextra[%d].walkpic = ", j);
     spriteXT[j].walkpic=getnumber16(what, spriteXT[j].walkpic, 4096L, 0);

     sprintf(what, "spriteextra[%d].runpic = ", j);
     spriteXT[j].runpic=getnumber16(what, spriteXT[j].runpic, 4096L, 0);

     sprintf(what, "spriteextra[%d].attackpic = ", j);
     spriteXT[j].attackpic=getnumber16(what, spriteXT[j].attackpic, 4096L, 0);

     sprintf(what, "spriteextra[%d].deathpic  = ", j);
     spriteXT[j].deathpic=getnumber16(what, spriteXT[j].deathpic, 4096L, 0);

     sprintf(what, "spriteextra[%d].painpic = ", j);
     spriteXT[j].painpic=getnumber16(what, spriteXT[j].painpic, 4096L, 0);

     sprintf(what, "spriteextra[%d].squatpic = ", j);
     spriteXT[j].squatpic=getnumber16(what, spriteXT[j].squatpic, 4096L, 0);

     sprintf(what, "spriteextra[%d].morphpic  = ", j);
     spriteXT[j].morphpic=getnumber16(what, spriteXT[j].morphpic, 4096L, 0);

     sprintf(what, "spriteextra[%d].specialpic  = ", j);
     spriteXT[j].specialpic=getnumber16(what, spriteXT[j].specialpic, 4096L, 0);

     sprintf(what, "spriteextra[%d].weapon  = ", j);
     spriteXT[j].weapon=getnumber16(what, spriteXT[j].weapon, 7L, 0);

     sprintf(what, "spriteextra[%d].ext2  = ", j);
     spriteXT[j].ext2=getnumber16(what, spriteXT[j].ext2, 4096L, 0);

     printmessage16("Sprite Extensions Saved.");

     JS_ShowSpriteExts(spritenum);

 return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edi, %ebx
movb $0x1, 0x9bdfa(%rip)     # 0xa56db
callq 0x1adf6
movslq %ebx, %rax
imulq $0x2c, %rax, %r15
leaq 0x2733bc(%rip), %r12    # 0x27ccb0
movzwl 0x2a(%r12,%r15), %r14d
testw %r14w, %r14w
js 0x9c99
leaq 0x6a179(%rip), %rdi     # 0x73a84
callq 0x192c8
movswl %bx, %ebp
movl %ebp, %edi
callq 0x73d7
movswl %r14w, %r15d
leaq 0x6a17b(%rip), %rsi     # 0x73aa0
xorl %ebx, %ebx
movq %rsp, %r14
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswq %r15w, %rax
movq %rax, %rcx
shlq $0x5, %rcx
leaq (%rcx,%rax,2), %r12
leaq 0x9bec3(%rip), %r13     # 0xa5810
movzbl (%r13,%r12), %esi
movq %r14, %rdi
movl $0xc, %edx
xorl %ecx, %ecx
callq 0x1b432
movb %al, (%r13,%r12)
leaq 0x6a14f(%rip), %rsi     # 0x73abd
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movsbl 0x1(%r13,%r12), %esi
movq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
xorl %ecx, %ecx
callq 0x1b432
movb %al, 0x1(%r13,%r12)
leaq 0x6a13e(%rip), %rsi     # 0x73ada
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x2(%r13,%r12), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1b432
movw %ax, 0x2(%r13,%r12)
leaq 0x6a12c(%rip), %rsi     # 0x73af7
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x4(%r13,%r12), %esi
movq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
xorl %ecx, %ecx
callq 0x1b432
movw %ax, 0x4(%r13,%r12)
leaq 0x6a11a(%rip), %rsi     # 0x73b14
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x6(%r13,%r12), %esi
movq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
xorl %ecx, %ecx
callq 0x1b432
movw %ax, 0x6(%r13,%r12)
leaq 0x6a108(%rip), %rsi     # 0x73b31
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x8(%r13,%r12), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1b432
movw %ax, 0x8(%r13,%r12)
leaq 0x6a0f6(%rip), %rsi     # 0x73b4e
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0xa(%r13,%r12), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1b432
movw %ax, 0xa(%r13,%r12)
leaq 0x6a0e4(%rip), %rsi     # 0x73b6b
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0xc(%r13,%r12), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1b432
movw %ax, 0xc(%r13,%r12)
leaq 0x6a0d1(%rip), %rsi     # 0x73b87
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0xe(%r13,%r12), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1b432
movw %ax, 0xe(%r13,%r12)
leaq 0x6a0bd(%rip), %rsi     # 0x73ba2
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x10(%r13,%r12), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1b432
movw %ax, 0x10(%r13,%r12)
leaq 0x6a0a8(%rip), %rsi     # 0x73bbc
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x12(%r13,%r12), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1b432
movw %ax, 0x12(%r13,%r12)
leaq 0x6a096(%rip), %rsi     # 0x73bd9
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x14(%r13,%r12), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1b432
movw %ax, 0x14(%r13,%r12)
leaq 0x6a084(%rip), %rsi     # 0x73bf6
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x16(%r13,%r12), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1b432
movw %ax, 0x16(%r13,%r12)
leaq 0x6a070(%rip), %rsi     # 0x73c11
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x18(%r13,%r12), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1b432
movw %ax, 0x18(%r13,%r12)
leaq 0x6a05d(%rip), %rsi     # 0x73c2d
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x1a(%r13,%r12), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1b432
movw %ax, 0x1a(%r13,%r12)
leaq 0x6a04b(%rip), %rsi     # 0x73c4a
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x1c(%r13,%r12), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1b432
movw %ax, 0x1c(%r13,%r12)
leaq 0x6a03b(%rip), %rsi     # 0x73c69
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movzbl 0x1f(%r13,%r12), %esi
movq %r14, %rdi
movl $0x7, %edx
xorl %ecx, %ecx
callq 0x1b432
movb %al, 0x1f(%r13,%r12)
leaq 0x6a028(%rip), %rsi     # 0x73c84
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x20(%r13,%r12), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1b432
movw %ax, 0x20(%r13,%r12)
leaq 0x6a012(%rip), %rdi     # 0x73c9d
callq 0x192c8
movl %ebp, %edi
callq 0x73d7
jmp 0x9cea
leaq (%r12,%r15), %rbp
addq $0x2a, %rbp
leaq 0x69dc5(%rip), %rdi     # 0x73a6d
callq 0x192c8
leaq 0x9bb7a(%rip), %r13     # 0xa582e
xorl %r14d, %r14d
cmpb $0x0, (%r13)
je 0x9cd0
incq %r14
addq $0x22, %r13
cmpq $0x4000, %r14           # imm = 0x4000
jne 0x9cb7
jmp 0x9cd9
cmpq $0xffff, %r14           # imm = 0xFFFF
jne 0x9cfb
leaq 0x69652(%rip), %rdi     # 0x73332
callq 0x192c8
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x69658(%rip), %rdi     # 0x7335a
callq 0x192c8
movw %r14w, (%rbp)
xorps %xmm0, %xmm0
movups %xmm0, -0xe(%r13)
movups %xmm0, -0x1e(%r13)
movw $0x0, 0x2(%r13)
movzwl 0x1a(%r12,%r15), %eax
movw %ax, -0x16(%r13)
movzwl 0xe(%r12,%r15), %eax
movw %ax, -0x14(%r13)
cmpb $-0x1, (%r13)
je 0x9910
movb $-0x1, (%r13)
jmp 0x9910