// File: /workspace/github_c_makefile_star2_O1/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, 0x9af7e(%rip)     # 0xa46db
callq 0x1ad03
movslq %ebx, %rax
imulq $0x2c, %rax, %r15
leaq 0x272540(%rip), %r12    # 0x27bcb0
movzwl 0x2a(%r12,%r15), %r14d
testw %r14w, %r14w
js 0x9b24
leaq 0x692b1(%rip), %rdi     # 0x72a38
callq 0x19277
movswl %bx, %ebp
movl %ebp, %edi
callq 0x72af
movswl %r14w, %r15d
leaq 0x692b3(%rip), %rsi     # 0x72a54
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 0x9b047(%rip), %r13     # 0xa4810
movzbl (%r13,%r12), %esi
movq %r14, %rdi
movl $0xc, %edx
xorl %ecx, %ecx
callq 0x1b33f
movb %al, (%r13,%r12)
leaq 0x69287(%rip), %rsi     # 0x72a71
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 0x1b33f
movb %al, 0x1(%r13,%r12)
leaq 0x69276(%rip), %rsi     # 0x72a8e
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 0x1b33f
movw %ax, 0x2(%r13,%r12)
leaq 0x69264(%rip), %rsi     # 0x72aab
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 0x1b33f
movw %ax, 0x4(%r13,%r12)
leaq 0x69252(%rip), %rsi     # 0x72ac8
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 0x1b33f
movw %ax, 0x6(%r13,%r12)
leaq 0x69240(%rip), %rsi     # 0x72ae5
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 0x1b33f
movw %ax, 0x8(%r13,%r12)
leaq 0x6922e(%rip), %rsi     # 0x72b02
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 0x1b33f
movw %ax, 0xa(%r13,%r12)
leaq 0x6921c(%rip), %rsi     # 0x72b1f
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 0x1b33f
movw %ax, 0xc(%r13,%r12)
leaq 0x69209(%rip), %rsi     # 0x72b3b
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 0x1b33f
movw %ax, 0xe(%r13,%r12)
leaq 0x691f5(%rip), %rsi     # 0x72b56
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 0x1b33f
movw %ax, 0x10(%r13,%r12)
leaq 0x691e0(%rip), %rsi     # 0x72b70
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 0x1b33f
movw %ax, 0x12(%r13,%r12)
leaq 0x691ce(%rip), %rsi     # 0x72b8d
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 0x1b33f
movw %ax, 0x14(%r13,%r12)
leaq 0x691bc(%rip), %rsi     # 0x72baa
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 0x1b33f
movw %ax, 0x16(%r13,%r12)
leaq 0x691a8(%rip), %rsi     # 0x72bc5
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 0x1b33f
movw %ax, 0x18(%r13,%r12)
leaq 0x69195(%rip), %rsi     # 0x72be1
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 0x1b33f
movw %ax, 0x1a(%r13,%r12)
leaq 0x69183(%rip), %rsi     # 0x72bfe
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 0x1b33f
movw %ax, 0x1c(%r13,%r12)
leaq 0x69173(%rip), %rsi     # 0x72c1d
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 0x1b33f
movb %al, 0x1f(%r13,%r12)
leaq 0x69160(%rip), %rsi     # 0x72c38
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 0x1b33f
movw %ax, 0x20(%r13,%r12)
leaq 0x6914a(%rip), %rdi     # 0x72c51
callq 0x19277
movl %ebp, %edi
callq 0x72af
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq (%r12,%r15), %r13
addq $0x2a, %r13
leaq 0x68eee(%rip), %rdi     # 0x72a21
callq 0x19277
leaq 0x9acef(%rip), %rax     # 0xa482e
xorl %r14d, %r14d
cmpb $0x0, (%rax)
je 0x9b5d
incq %r14
addq $0x22, %rax
cmpq $0x4000, %r14           # imm = 0x4000
jne 0x9b42
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpw $-0x1, %r14w
jne 0x9b77
leaq 0x6877b(%rip), %rdi     # 0x722e6
callq 0x19277
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x9b13
leaq 0x68790(%rip), %rdi     # 0x7230e
callq 0x19277
movw %r14w, (%r13)
movslq %r14d, %rax
movq %rax, %rcx
shlq $0x5, %rcx
leaq (%rcx,%rax,2), %rax
leaq 0x9ac73(%rip), %rcx     # 0xa4810
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rcx,%rax)
movups %xmm0, (%rcx,%rax)
movw $0x0, 0x20(%rcx,%rax)
movzwl 0x1a(%r12,%r15), %edx
movw %dx, 0x8(%rcx,%rax)
movzwl 0xe(%r12,%r15), %edx
movw %dx, 0xa(%rcx,%rax)
cmpb $-0x1, 0x1e(%rcx,%rax)
je 0x978c
addq %rcx, %rax
addq $0x1e, %rax
movb $-0x1, (%rax)
jmp 0x978c