// File: /workspace/github_c_makefile_star2_O3/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 0x1adf6
cmpw $0x4001, 0x8ad70(%rip)  # imm = 0x4001
jb 0x89ce
movups 0x6a950(%rip), %xmm0    # 0x73301
movq %rsp, %rdi
movaps %xmm0, 0x10(%rdi)
movups 0x6a932(%rip), %xmm0    # 0x732f1
movaps %xmm0, (%rdi)
movl $0x212079, 0x20(%rdi)   # imm = 0x212079
jmp 0x8a8e
movslq %ebx, %rax
imulq $0x2c, %rax, %rax
leaq 0x2742d4(%rip), %r12    # 0x27ccb0
movzwl 0x2a(%r12,%rax), %r15d
testw %r15w, %r15w
js 0x8a36
leaq 0x9ccf1(%rip), %r14     # 0xa56e0
leaq 0x6a976(%rip), %rsi     # 0x7336c
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x6b00
movq %r14, %rdi
xorl %esi, %esi
movl $0x2, %edx
xorl %ecx, %ecx
callq 0x1b432
cmpw $0x1, %ax
je 0x8aed
leaq 0x6a97c(%rip), %rdi     # 0x733a0
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x192c8
leaq (%r12,%rax), %r13
addq $0x2a, %r13
leaq 0x6a8d0(%rip), %rsi     # 0x73315
xorl %r15d, %r15d
movq %rsp, %r14
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x6b00
movq %r14, %rdi
callq 0x192c8
leaq 0x9cdc8(%rip), %r14     # 0xa582e
cmpb $0x0, (%r14)
je 0x8a7e
incq %r15
addq $0x22, %r14
cmpq $0x4000, %r15           # imm = 0x4000
jne 0x8a66
jmp 0x8a87
cmpq $0xffff, %r15           # imm = 0xFFFF
jne 0x8a98
leaq 0x6a8a4(%rip), %rdi     # 0x73332
callq 0x192c8
jmp 0x8b53
leaq 0x6a8bb(%rip), %rdi     # 0x7335a
callq 0x192c8
movw %r15w, (%r13)
xorps %xmm0, %xmm0
movups %xmm0, -0xe(%r14)
movups %xmm0, -0x1e(%r14)
movw $0x0, 0x2(%r14)
movswq %bx, %rax
imulq $0x2c, %rax, %rax
movzwl 0x1a(%r12,%rax), %ecx
movw %cx, -0x16(%r14)
movzwl 0xe(%r12,%rax), %eax
movw %ax, -0x14(%r14)
cmpb $-0x1, (%r14)
je 0x8ae5
movb $-0x1, (%r14)
movswl %bx, %edi
callq 0x73d7
movswq %r15w, %rax
movq %rax, %rcx
shlq $0x5, %rcx
leaq (%rcx,%rax,2), %rax
leaq 0x9cd0d(%rip), %rcx     # 0xa5810
movzwl 0x9ccf6(%rip), %edx     # 0xa5800
movw %dx, 0x20(%rcx,%rax)
movups 0x9ccda(%rip), %xmm0    # 0xa57f0
movups %xmm0, 0x10(%rcx,%rax)
movups 0x9ccbe(%rip), %xmm0    # 0xa57e0
movups %xmm0, (%rcx,%rax)
movswl 0x8abeb(%rip), %edx     # 0x93718
leaq 0x6a87a(%rip), %rsi     # 0x733ae
movq %rsp, %r14
movq %r14, %rdi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x6b00
movq %r14, %rdi
callq 0x192c8
movswl %bx, %edi
callq 0x73d7
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq