// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/src/bstub.c
// Function: JS_CopyExt
void
JS_CopyExt(int sn)
{
     char      what[50];
     short     j;
     int       ans;

     clearmidstatbar16();

     if( (recordXT < 0) || (recordXT > MAXSPRITES) ) {
          sprintf(what, "NO current valid copy EXT to copy !");
          printmessage16(what);
          return;
     }

     j=sprite[sn].extra;

     if( j < 0 ) {
          sprintf(what, "Mapping EXT for sprite %d...", sn);
          printmessage16(what);
          j=JS_FirstFreeExt();
          if( j == -1 ) {
               printmessage16("ERROR! Not able to map to an extension.");
               return;
          }
          printmessage16("Extension Mapped.");
          sprite[sn].extra=j;
          JS_InitExtension(sn, j);
          JS_LockExt(j);
          JS_ShowSpriteExts(sn);
     }
     else {
          sprintf(tempbuf, "Overwrite existing EXT for sprite %d ?  1=YES 0=NO ", sn);
          ans=getnumber16(tempbuf, 0, 2L, 0);
          if( ans != 1 ) {
               printmessage16("Not Copied...");
               return;
          }
     }

     memcpy(&spriteXT[j], &recXT, sizeof(struct spriteextension));

     sprintf(what, "Copying Ext %d to sprite %d...", recordXT, sn);
     printmessage16(what);

     JS_ShowSpriteExts(sn);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edi, %ebx
callq 0x1906e
cmpw $0x4001, 0x84474(%rip)  # imm = 0x4001
jb 0x82cf
movups 0x60008(%rip), %xmm0    # 0x682b5
movq %rsp, %rdi
movaps %xmm0, 0x10(%rdi)
movups 0x5ffea(%rip), %xmm0    # 0x682a5
movaps %xmm0, (%rdi)
movl $0x212079, 0x20(%rdi)   # imm = 0x212079
callq 0x177d3
jmp 0x8416
movslq %ebx, %rax
imulq $0x2c, %rax, %r12
leaq 0x26d9d3(%rip), %r13    # 0x275cb0
movswq 0x2a(%r13,%r12), %r15
testq %r15, %r15
js 0x8335
leaq 0x963f1(%rip), %r14     # 0x9e6e0
leaq 0x6002a(%rip), %rsi     # 0x68320
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x6b00
pushq $0x2
popq %rdx
movq %r14, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x1953c
cmpw $0x1, %ax
je 0x83bb
leaq 0x60032(%rip), %rdi     # 0x68354
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x177d3
leaq 0x5ff8d(%rip), %rsi     # 0x682c9
movq %rsp, %r14
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x6b00
movq %r14, %rdi
callq 0x177d3
callq 0x8425
movl %eax, %r14d
cmpw $-0x1, %r14w
jne 0x836e
leaq 0x5ff7d(%rip), %rdi     # 0x682e6
jmp 0x82c5
leaq (%r12,%r13), %r15
addq $0x2a, %r15
leaq 0x5ff91(%rip), %rdi     # 0x6830e
callq 0x177d3
movw %r14w, (%r15)
movswl %bx, %ebp
movswl %r14w, %esi
movl %ebp, %edi
callq 0x844b
movswq %r14w, %r15
imulq $0x22, %r15, %rax
leaq 0x9646d(%rip), %rcx     # 0x9e810
cmpb $-0x1, 0x1e(%rax,%rcx)
je 0x83b4
addq %rcx, %rax
addq $0x1e, %rax
movb $-0x1, (%rax)
movl %ebp, %edi
callq 0x727f
imulq $0x22, %r15, %rax
leaq 0x9644a(%rip), %rcx     # 0x9e810
movzwl 0x96433(%rip), %edx     # 0x9e800
movw %dx, 0x20(%rax,%rcx)
movups 0x96417(%rip), %xmm0    # 0x9e7f0
movups %xmm0, 0x10(%rax,%rcx)
movups 0x963fb(%rip), %xmm0    # 0x9e7e0
movups %xmm0, (%rax,%rcx)
movswl 0x84328(%rip), %edx     # 0x8c718
leaq 0x5ff6b(%rip), %rsi     # 0x68362
movq %rsp, %r14
movq %r14, %rdi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x6b00
movq %r14, %rdi
callq 0x177d3
movswl %bx, %edi
callq 0x727f
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq