// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movl %edi, %ebx
callq 0x1ad03
cmpw $0x4001, 0x89ea3(%rip)  # imm = 0x4001
jb 0x88a0
movups 0x69a37(%rip), %xmm0    # 0x722b5
movq %rsp, %rdi
movaps %xmm0, 0x10(%rdi)
movups 0x69a19(%rip), %xmm0    # 0x722a5
movaps %xmm0, (%rdi)
movl $0x212079, 0x20(%rdi)   # imm = 0x212079
callq 0x19277
jmp 0x8a3c
movslq %ebx, %rax
imulq $0x2c, %rax, %rax
leaq 0x273402(%rip), %r12    # 0x27bcb0
movzwl 0x2a(%r12,%rax), %r15d
testw %r15w, %r15w
js 0x8908
leaq 0x9be1f(%rip), %r14     # 0xa46e0
leaq 0x69a58(%rip), %rsi     # 0x72320
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x6b00
movq %r14, %rdi
xorl %esi, %esi
movl $0x2, %edx
xorl %ecx, %ecx
callq 0x1b33f
cmpw $0x1, %ax
je 0x89d6
leaq 0x69a5e(%rip), %rdi     # 0x72354
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x19277
leaq (%r12,%rax), %r13
addq $0x2a, %r13
leaq 0x699b2(%rip), %rsi     # 0x722c9
xorl %r15d, %r15d
movq %rsp, %r14
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x6b00
movq %r14, %rdi
callq 0x19277
leaq 0x9bef6(%rip), %rax     # 0xa482e
cmpb $0x0, (%rax)
je 0x8953
incq %r15
addq $0x22, %rax
cmpq $0x4000, %r15           # imm = 0x4000
jne 0x8938
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
cmpw $-0x1, %r15w
jne 0x8966
leaq 0x69985(%rip), %rdi     # 0x722e6
jmp 0x8896
leaq 0x699a1(%rip), %rdi     # 0x7230e
callq 0x19277
movw %r15w, (%r13)
movslq %r15d, %rax
movq %rax, %rcx
shlq $0x5, %rcx
leaq (%rcx,%rax,2), %rax
leaq 0x9be84(%rip), %rcx     # 0xa4810
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rcx,%rax)
movups %xmm0, (%rcx,%rax)
movw $0x0, 0x20(%rcx,%rax)
movswq %bx, %rdx
imulq $0x2c, %rdx, %rdx
movzwl 0x1a(%r12,%rdx), %esi
movw %si, 0x8(%rcx,%rax)
movzwl 0xe(%r12,%rdx), %edx
movw %dx, 0xa(%rcx,%rax)
cmpb $-0x1, 0x1e(%rcx,%rax)
je 0x89ce
addq %rcx, %rax
addq $0x1e, %rax
movb $-0x1, (%rax)
movswl %bx, %edi
callq 0x72af
movswq %r15w, %rax
movq %rax, %rcx
shlq $0x5, %rcx
leaq (%rcx,%rax,2), %rax
leaq 0x9be24(%rip), %rcx     # 0xa4810
movzwl 0x9be0d(%rip), %edx     # 0xa4800
movw %dx, 0x20(%rcx,%rax)
movups 0x9bdf1(%rip), %xmm0    # 0xa47f0
movups %xmm0, 0x10(%rcx,%rax)
movups 0x9bdd5(%rip), %xmm0    # 0xa47e0
movups %xmm0, (%rcx,%rax)
movswl 0x89d02(%rip), %edx     # 0x92718
leaq 0x69945(%rip), %rsi     # 0x72362
movq %rsp, %r14
movq %r14, %rdi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x6b00
movq %r14, %rdi
callq 0x19277
movswl %bx, %edi
callq 0x72af
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq