// File: /workspace/github_c_makefile_star2_O2/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, 0x9593a(%rip)     # 0x9e6db
callq 0x1906e
movslq %ebx, %rax
imulq $0x2c, %rax, %r15
leaq 0x26cefc(%rip), %r13    # 0x275cb0
movswq 0x2a(%r13,%r15), %r12
movswl %bx, %ebx
testq %r12, %r12
js 0x9159
leaq 0x5fc75(%rip), %rdi     # 0x68a42
callq 0x177d3
movl %r12d, %r14d
movl %ebx, %edi
callq 0x727f
movswl %r14w, %r15d
leaq 0x5fc77(%rip), %rsi     # 0x68a5e
xorl %ebp, %ebp
movq %rsp, %r14
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
imulq $0x22, %r12, %r12
leaq 0x95a0c(%rip), %r13     # 0x9e810
movzbl (%r12,%r13), %esi
pushq $0xc
popq %rdx
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x1953c
movb %al, (%r12,%r13)
leaq 0x5fc5a(%rip), %rsi     # 0x68a7b
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movsbl 0x1(%r12,%r13), %esi
movq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
xorl %ecx, %ecx
callq 0x1953c
movb %al, 0x1(%r12,%r13)
leaq 0x5fc49(%rip), %rsi     # 0x68a98
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x2(%r12,%r13), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1953c
movw %ax, 0x2(%r12,%r13)
leaq 0x5fc37(%rip), %rsi     # 0x68ab5
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x4(%r12,%r13), %esi
movq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
xorl %ecx, %ecx
callq 0x1953c
movw %ax, 0x4(%r12,%r13)
leaq 0x5fc25(%rip), %rsi     # 0x68ad2
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x6(%r12,%r13), %esi
movq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
xorl %ecx, %ecx
callq 0x1953c
movw %ax, 0x6(%r12,%r13)
leaq 0x5fc13(%rip), %rsi     # 0x68aef
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x8(%r12,%r13), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1953c
movw %ax, 0x8(%r12,%r13)
leaq 0x5fc01(%rip), %rsi     # 0x68b0c
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0xa(%r12,%r13), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1953c
movw %ax, 0xa(%r12,%r13)
leaq 0x5fbef(%rip), %rsi     # 0x68b29
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0xc(%r12,%r13), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1953c
movw %ax, 0xc(%r12,%r13)
leaq 0x5fbdc(%rip), %rsi     # 0x68b45
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0xe(%r12,%r13), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1953c
movw %ax, 0xe(%r12,%r13)
leaq 0x5fbc8(%rip), %rsi     # 0x68b60
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x10(%r12,%r13), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1953c
movw %ax, 0x10(%r12,%r13)
leaq 0x5fbb3(%rip), %rsi     # 0x68b7a
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x12(%r12,%r13), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1953c
movw %ax, 0x12(%r12,%r13)
leaq 0x5fba1(%rip), %rsi     # 0x68b97
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x14(%r12,%r13), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1953c
movw %ax, 0x14(%r12,%r13)
leaq 0x5fb8f(%rip), %rsi     # 0x68bb4
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x16(%r12,%r13), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1953c
movw %ax, 0x16(%r12,%r13)
leaq 0x5fb7b(%rip), %rsi     # 0x68bcf
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x18(%r12,%r13), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1953c
movw %ax, 0x18(%r12,%r13)
leaq 0x5fb68(%rip), %rsi     # 0x68beb
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x1a(%r12,%r13), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1953c
movw %ax, 0x1a(%r12,%r13)
leaq 0x5fb56(%rip), %rsi     # 0x68c08
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x1c(%r12,%r13), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1953c
movw %ax, 0x1c(%r12,%r13)
leaq 0x5fb46(%rip), %rsi     # 0x68c27
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movzbl 0x1f(%r12,%r13), %esi
pushq $0x7
popq %rdx
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x1953c
movb %al, 0x1f(%r12,%r13)
leaq 0x5fb35(%rip), %rsi     # 0x68c42
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6b00
movswl 0x20(%r12,%r13), %esi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %ecx, %ecx
callq 0x1953c
movw %ax, 0x20(%r12,%r13)
leaq 0x5fb1f(%rip), %rdi     # 0x68c5b
callq 0x177d3
movl %ebx, %edi
callq 0x727f
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5f8cb(%rip), %rdi     # 0x68a2b
callq 0x177d3
callq 0x8425
movl %eax, %r14d
cmpw $-0x1, %r14w
jne 0x9185
leaq 0x5f16b(%rip), %rdi     # 0x682e6
callq 0x177d3
pushq $-0x1
popq %rbp
jmp 0x9148
addq %r13, %r15
addq $0x2a, %r15
leaq 0x5f17b(%rip), %rdi     # 0x6830e
callq 0x177d3
movw %r14w, (%r15)
movswl %r14w, %esi
movl %ebx, %edi
callq 0x844b
movswq %r14w, %r12
imulq $0x22, %r12, %rax
leaq 0x9565a(%rip), %rcx     # 0x9e810
cmpb $-0x1, 0x1e(%rax,%rcx)
je 0x8dd5
addq %rcx, %rax
addq $0x1e, %rax
movb $-0x1, (%rax)
jmp 0x8dd5