// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/src/tekstat.c
// Function: damagesprite
int
damagesprite(int hitsprite, int points)
{
     short     ext;

    #ifdef PLRSPRDEBUG
     if( isaplayersprite(hitsprite) ) {
          crashgame("messing w plrsprite at 12");
     }
    #else
     if( isaplayersprite(hitsprite) ) {
          return(0);
     }
    #endif

     ext=sprptr[hitsprite]->extra;

     switch( sprptr[hitsprite]->statnum ) {
     case INANIMATE:
          if( validext(ext) ) {
               newstatus(hitsprite, DEATH);
          }
          return(0);
     case GENEXPLODE1:
          changespritestat(hitsprite,INACTIVE);
          genexplosion1(hitsprite);
          //changespritestat(hitsprite,VANISH);
          jsdeletesprite(hitsprite);
          return(0);
     case GENEXPLODE2:
          changespritestat(hitsprite,INACTIVE);
          genexplosion2(hitsprite);
          //changespritestat(hitsprite,VANISH);
          jsdeletesprite(hitsprite);
          return(0);
     case INACTIVE:
     case FLOATING:
          return(0);
     case PROJHIT:
     case PROJECTILE:
     case TOSS:
     case PAIN:
     case RUNTHRU:
     case TWITCH:
     case DEATH:
          return(0);
     default:
          break;
     }

     if( difficulty == 0 ) {
          points<<=1;
     }

     if( validext(ext) ) {
          if( (labs(points)) > sprXTptr[ext]->hitpoints ) {
               sprXTptr[ext]->hitpoints=0;
          }
          else {
               sprXTptr[ext]->hitpoints-=points;
          }
          sprXTptr[ext]->aimask|=AI_JUSTSHOTAT;
          sprXTptr[ext]->aimask|=AI_TIMETODODGE;
          sprXTptr[ext]->aimask|=AI_WASATTACKED;
          if( sprXTptr[ext]->hitpoints < ENEMYCRITICALCONDITION )
               sprXTptr[ext]->aimask|=AI_CRITICAL;
          if( sprXTptr[ext]->hitpoints <= 0 ) {
               sprXTptr[ext]->hitpoints=0;
               //newstatus(hitsprite,DEATH);
               sprXTptr[ext]->fxmask|=FX_NXTSTTDEATH;
               return(1);
          }
          else {
               //newstatus(hitsprite,PAIN);
               sprXTptr[ext]->fxmask|=FX_NXTSTTPAIN;
          }
     }

     return(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl -0x8(%rbp), %edi
callq 0x2aec0
cmpl $0x0, %eax
je 0x30259
leaq 0xaa2a0(%rip), %rdi     # 0xda4f2
movb $0x0, %al
callq 0x44240
movslq -0x8(%rbp), %rcx
leaq 0x149f7c(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rcx
movw 0x2a(%rcx), %cx
movw %cx, -0xe(%rbp)
movslq -0x8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movswl 0x1a(%rax), %eax
movl %eax, -0x14(%rbp)
testl %eax, %eax
je 0x302f4
jmp 0x30285
movl -0x14(%rbp), %eax
subl $0x64, %eax
je 0x3037c
jmp 0x30293
movl -0x14(%rbp), %eax
addl $0xfffffed3, %eax       # imm = 0xFFFFFED3
subl $0x3, %eax
jb 0x30388
jmp 0x302a6
movl -0x14(%rbp), %eax
subl $0x142, %eax            # imm = 0x142
je 0x3037c
jmp 0x302b6
movl -0x14(%rbp), %eax
addl $0xfffffe70, %eax       # imm = 0xFFFFFE70
subl $0x3, %eax
jb 0x30388
jmp 0x302c9
movl -0x14(%rbp), %eax
subl $0x197, %eax            # imm = 0x197
je 0x30388
jmp 0x302d9
movl -0x14(%rbp), %eax
subl $0x320, %eax            # imm = 0x320
je 0x3031e
jmp 0x302e5
movl -0x14(%rbp), %eax
subl $0x321, %eax            # imm = 0x321
je 0x3034d
jmp 0x30394
movswl -0xe(%rbp), %edi
callq 0x2ae90
cmpl $0x0, %eax
je 0x30312
movl -0x8(%rbp), %eax
movl $0x12d, %esi            # imm = 0x12D
movswl %ax, %edi
callq 0x2d0c0
movl $0x0, -0x4(%rbp)
jmp 0x30513
movl -0x8(%rbp), %eax
movl $0x64, %esi
movswl %ax, %edi
callq 0x6a500
movl -0x8(%rbp), %edi
callq 0x30520
movl -0x8(%rbp), %eax
movswl %ax, %edi
callq 0x2ae00
movl $0x0, -0x4(%rbp)
jmp 0x30513
movl -0x8(%rbp), %eax
movl $0x64, %esi
movswl %ax, %edi
callq 0x6a500
movl -0x8(%rbp), %edi
callq 0x30760
movl -0x8(%rbp), %eax
movswl %ax, %edi
callq 0x2ae00
movl $0x0, -0x4(%rbp)
jmp 0x30513
movl $0x0, -0x4(%rbp)
jmp 0x30513
movl $0x0, -0x4(%rbp)
jmp 0x30513
jmp 0x30396
leaq 0x149c2b(%rip), %rax    # 0x179fc8
cmpl $0x0, (%rax)
jne 0x303aa
movl -0xc(%rbp), %eax
shll %eax
movl %eax, -0xc(%rbp)
movswl -0xe(%rbp), %edi
callq 0x2ae90
cmpl $0x0, %eax
je 0x3050c
movslq -0xc(%rbp), %rax
movq %rax, %rcx
negq %rcx
cmovnsq %rcx, %rax
movswq -0xe(%rbp), %rdx
leaq 0x1f1e0a(%rip), %rcx    # 0x2221e0
movq (%rcx,%rdx,8), %rcx
movsbq 0x1(%rcx), %rcx
cmpq %rcx, %rax
jle 0x303fa
movswq -0xe(%rbp), %rcx
leaq 0x1f1df0(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movb $0x0, 0x1(%rax)
jmp 0x30416
movl -0xc(%rbp), %edx
movswq -0xe(%rbp), %rcx
leaq 0x1f1dd7(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %ecx
subl %edx, %ecx
movb %cl, 0x1(%rax)
movswq -0xe(%rbp), %rcx
leaq 0x1f1dbe(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movzwl 0x6(%rax), %ecx
orl $0x4, %ecx
movw %cx, 0x6(%rax)
movswq -0xe(%rbp), %rcx
leaq 0x1f1da3(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movzwl 0x6(%rax), %ecx
orl $0x800, %ecx            # imm = 0x800
movw %cx, 0x6(%rax)
movswq -0xe(%rbp), %rcx
leaq 0x1f1d85(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movzwl 0x6(%rax), %ecx
orl $0x20, %ecx
movw %cx, 0x6(%rax)
movswq -0xe(%rbp), %rcx
leaq 0x1f1d6a(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x19, %eax
jge 0x3049e
movswq -0xe(%rbp), %rcx
leaq 0x1f1d51(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movzwl 0x6(%rax), %ecx
orl $0x8, %ecx
movw %cx, 0x6(%rax)
movswq -0xe(%rbp), %rcx
leaq 0x1f1d36(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
jg 0x304ef
movswq -0xe(%rbp), %rcx
leaq 0x1f1d1d(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movb $0x0, 0x1(%rax)
movswq -0xe(%rbp), %rcx
leaq 0x1f1d09(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movzwl 0x4(%rax), %ecx
orl $0x40, %ecx
movw %cx, 0x4(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x30513
movswq -0xe(%rbp), %rcx
leaq 0x1f1ce5(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movzwl 0x4(%rax), %ecx
orl $0x20, %ecx
movw %cx, 0x4(%rax)
jmp 0x3050c
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)