// File: /workspace/github_c_makefile_star2_O1/jrrk[P]cbzone/c_move.c
// Function: movesuper
void movesuper(g, pl)
     Genericp g;
     Genericp pl;
{
  int i;
  float dx, dy, tazm, t1, t3, scrot, sctot, scale, cp, sp, dcp;
  float dsp, cm, sm, xmt, ymt, xpt, ypt, rate, temp, dist;
  Genericp s;

  g->pcount++;
  g->fcount++;
  if (g->attr & IS_NEW) {
    g->attr &=  ~(IS_NEW | IS_PRESET);
    g->bcount = 0;
    g->ecount = 0;
    g->pcount = 10;
    g->fcount = 15;
    g->orientation = 1.0;
  }
  if (g->attr & IS_BLOCKED && g->attr & LAST_BLOCKED)
    g->orientation = -g->orientation;
  g->attr &= ~LAST_BLOCKED;

  if (g->attr & IS_BLOCKED) {
    if (g->attr & BLOCKED_BY_ENEMY)
      g->attr |= IS_EVADING;
    else
      g->attr &= ~IS_EVADING;
    g->attr |= IS_PRESET | LAST_BLOCKED;
    g->bcount  = 0;
  }
  if (g->attr & IS_PRESET) {
    g->bcount++;
    if (!(g->attr & IS_EVADING)) {
      if (g->bcount == 1) {
        g->speed = -12.0 * g->orientation;
        g->rotate = 0.045;
        if (frand() > 0.5)
          g->rotate = -g->rotate;
      }
      else if (g->bcount == 30) {
        g->speed  = 12.0 * g->orientation;
        g->rotate = 0.0;
      }
      else if (g->bcount > 60)
        g->attr &= ~IS_PRESET;
    }
    else {
      if (g->bcount == 1) {
        g->speed  = -12.0 * g->orientation;
        g->rotate = 0.0;
      }
      else if (g->bcount == 10 || g->bcount == 15 ||
               g->bcount == 20 || g->bcount == 25) {
        dx = pl->x - g->x;
        dy = pl->y - g->y;
        if (fabs(dy) < 1.e-7)
          dy = sign(1.e-7, dy);
        if (dy <= 0.0)
          tazm = - atan(dx / dy) + ra (180.0);
        else
          tazm = - atan(dx / dy) ;
        if (g->azm > PI2)
          g->azm -= PI2;
        if (g->azm < 0.0)
          g->azm += PI2;
        t1 = (tazm - g->azm) / 5.0;
        t3 = (tazm - (g->azm - PI2)) / 5.0;
        if (fabs(t3) < fabs(t1))
          t1 = t3;
        if (fabs(t1) > 0.045)
          t1 = sign (.045, t1);
        g->rotate = t1;
        g->speed = 0.0;
      }
      else if (g->bcount > 30)
        g->attr &= ~IS_PRESET;
    }
  }
  else if (g->pcount >= 5) {
    g->orientation = 1.0;
    g->pcount = 0;
    dx = pl->x - g->x;
    dy = pl->y - g->y;
    if (fabs(dy) < 1.e-7) dy =
      sign(1.e-7, dy);
    if (dy <= 0.0)
      tazm = - atan(dx / dy) + ra (180.0);
    else
      tazm = - atan(dx / dy);
    if (g->azm > PI2)
      g->azm -= PI2;
    if (g->azm < 0.0)
      g->azm += PI2;
    t1 = (tazm - g->azm) / 5.0;
    t3 = (tazm - (g->azm - PI2)) / 5.0;
    if (fabs(t3) < fabs(t1))
      t1 = t3;
    g->speed = 12.0 * (PI - fabs(t1) * 5.0) / PI;
    if (fabs(t1) > 0.045)
      t1 = sign (0.045, t1);
    g->rotate = t1;
  }

  scrot = g->rotate / 0.045 * 12.0;
  sctot = sqrt (g->speed*g->speed + scrot*scrot);
  if (sctot > 12.0) {
    scale = 12.0 / sctot;
    g->speed *= scale;
    g->rotate *= scale;
  }

  s = g->salvo;
  if (pl->attr & IS_ALIVE && g->fcount>10 && g->ecount>50 &&
      !(s->attr & STILL_THERE)) {
    g->fcount = 0;
    cp = pl->ca;
    sp = pl->sa;
    dcp = cos(pl->rotate);
    dsp = sin(pl->rotate);
    cm = cos(g->azm);
    sm = sin(g->azm);
    i = 0;
    xmt = g->x;
    ymt = g->y;
    xpt = pl->x;
    ypt = pl->y;
    rate = 40.0;

    for (i=0; i<50; i++) {
      temp = cp;
      cp = cp * dcp - sp * dsp;
      sp = sp * dcp + dsp * temp;
      xmt -= sm * rate;
      ymt += cm * rate;
      xpt -= sp * pl->speed;
      ypt += cp * pl->speed;
      dist = (xpt-xmt)*(xpt-xmt) + (ymt-ypt)*(ymt-ypt);
      if (dist <= BMS_TOL) {
        s->attr = START_LIVING;
        s->x = g->x;
        s->y = g->y;
        s->z = 0.0;
        s->prox = g->prox;
        s->proy = g->proy;
        s->azm = g->azm;
        s->speed = 40.0;
        s->ecount = 0;
        message(3, True);
        break;
      }
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
incl 0x4c(%rdi)
incl 0x54(%rdi)
movq %rsi, %r14
movl 0x8(%rdi), %eax
testb $0x2, %al
je 0xb685
andl $-0x43, %eax
movl %eax, 0x8(%rbx)
movq $0xa, 0x4c(%rbx)
movl $0xf, 0x54(%rbx)
movq $0x3f800000, 0x40(%rbx) # imm = 0x3F800000
movl 0x8(%rbx), %eax
testl $0x600, %eax            # imm = 0x600
sete %cl
btl $0xb, %eax
setae %dl
orb %cl, %dl
jne 0xb6ad
movss 0x40(%rbx), %xmm0
xorpd 0x2978(%rip), %xmm0     # 0xe020
movss %xmm0, 0x40(%rbx)
movl %eax, %ecx
andl $0xfffff7ff, %ecx       # imm = 0xFFFFF7FF
movl %ecx, 0x8(%rbx)
testl $0x600, %eax            # imm = 0x600
je 0xb6e6
movl %eax, %ecx
andl $0xfffff53f, %ecx       # imm = 0xFFFFF53F
movl %eax, %edx
orl $0x80, %edx
btl $0x9, %eax
cmovael %ecx, %edx
orl $0x840, %edx            # imm = 0x840
movl %edx, 0x8(%rbx)
movl $0x0, 0x50(%rbx)
movl 0x8(%rbx), %eax
testb $0x40, %al
jne 0xb899
cmpl $0x5, 0x4c(%rbx)
jl 0xbacb
movl $0x3f800000, 0x40(%rbx) # imm = 0x3F800000
movl $0x0, 0x4c(%rbx)
movss 0xc(%r14), %xmm0
movss 0x10(%r14), %xmm3
subss 0xc(%rbx), %xmm0
subss 0x10(%rbx), %xmm3
xorps %xmm1, %xmm1
xorl %eax, %eax
ucomiss %xmm3, %xmm1
seta %cl
movaps 0x290f(%rip), %xmm1     # 0xe040
andps %xmm3, %xmm1
cvtss2sd %xmm1, %xmm1
movsd 0x3450(%rip), %xmm2     # 0xeb90
ucomisd %xmm1, %xmm2
jbe 0xb754
movb %cl, %al
leaq 0x3449(%rip), %rcx      # 0xeb98
movss (%rcx,%rax,4), %xmm3
movaps %xmm3, 0x10(%rsp)
divss %xmm3, %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x4270
movaps 0x10(%rsp), %xmm6
movsd 0x342d(%rip), %xmm1     # 0xeba0
subsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm1
xorps %xmm2, %xmm2
cvtsd2ss %xmm0, %xmm2
xorps 0x2897(%rip), %xmm2     # 0xe020
cmpnless 0x349a(%rip), %xmm6     # 0xec2c
andps %xmm6, %xmm2
andnps %xmm1, %xmm6
xorps %xmm0, %xmm0
cvtss2sd 0x20(%rbx), %xmm0
orps %xmm2, %xmm6
ucomisd 0x3275(%rip), %xmm0     # 0xea20
jbe 0xb7be
addsd 0x3273(%rip), %xmm0     # 0xea28
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x20(%rbx)
movss 0x20(%rbx), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm1, %xmm0
jbe 0xb7e0
cvtss2sd %xmm1, %xmm1
addsd 0x3249(%rip), %xmm1     # 0xea20
cvtsd2ss %xmm1, %xmm1
movss %xmm1, 0x20(%rbx)
movss 0x20(%rbx), %xmm1
xorps %xmm2, %xmm2
cvtss2sd %xmm6, %xmm2
subss %xmm1, %xmm6
divss 0x3420(%rip), %xmm6     # 0xec18
cvtss2sd %xmm1, %xmm1
addsd 0x3224(%rip), %xmm1     # 0xea28
subsd %xmm1, %xmm2
movsd 0x2890(%rip), %xmm3     # 0xe0a0
divsd %xmm3, %xmm2
cvtsd2ss %xmm2, %xmm2
movaps 0x2821(%rip), %xmm4     # 0xe040
movaps %xmm2, %xmm1
andps %xmm4, %xmm1
movaps %xmm6, %xmm5
andps %xmm4, %xmm5
cmpltss %xmm5, %xmm1
andps %xmm1, %xmm2
andnps %xmm6, %xmm1
orps %xmm2, %xmm1
xorl %eax, %eax
ucomiss %xmm1, %xmm0
seta %cl
andps %xmm1, %xmm4
xorps %xmm0, %xmm0
cvtss2sd %xmm4, %xmm0
mulsd %xmm0, %xmm3
movsd 0x3361(%rip), %xmm2     # 0xebb8
movapd %xmm2, %xmm4
subsd %xmm3, %xmm4
mulsd 0x3359(%rip), %xmm4     # 0xebc0
divsd %xmm2, %xmm4
xorps %xmm2, %xmm2
cvtsd2ss %xmm4, %xmm2
movss %xmm2, 0x2c(%rbx)
ucomisd 0x3329(%rip), %xmm0     # 0xeba8
jbe 0xb88f
movb %cl, %al
leaq 0x3326(%rip), %rcx      # 0xebb0
movss (%rcx,%rax,4), %xmm1
movss %xmm1, 0x30(%rbx)
jmp 0xbacb
movl 0x50(%rbx), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x50(%rbx)
testb %al, %al
js 0xb8c9
testl %ecx, %ecx
je 0xba47
cmpl $0x1e, %edx
jne 0xba95
movss 0x40(%rbx), %xmm0
mulss 0x335c(%rip), %xmm0     # 0xec20
jmp 0xbab2
cmpl $0x18, %ecx
ja 0xbac0
movl $0x1084200, %edx        # imm = 0x1084200
btl %ecx, %edx
jae 0xbaa1
movss 0xc(%r14), %xmm0
movss 0x10(%r14), %xmm3
subss 0xc(%rbx), %xmm0
subss 0x10(%rbx), %xmm3
xorps %xmm1, %xmm1
xorl %eax, %eax
ucomiss %xmm3, %xmm1
seta %cl
movaps 0x2738(%rip), %xmm1     # 0xe040
andps %xmm3, %xmm1
cvtss2sd %xmm1, %xmm1
movsd 0x3279(%rip), %xmm2     # 0xeb90
ucomisd %xmm1, %xmm2
jbe 0xb92b
movb %cl, %al
leaq 0x3272(%rip), %rcx      # 0xeb98
movss (%rcx,%rax,4), %xmm3
movaps %xmm3, 0x10(%rsp)
divss %xmm3, %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x4270
movaps 0x10(%rsp), %xmm5
movsd 0x3256(%rip), %xmm1     # 0xeba0
subsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm1
xorps %xmm2, %xmm2
cvtsd2ss %xmm0, %xmm2
xorps 0x26c0(%rip), %xmm2     # 0xe020
cmpnless 0x32c3(%rip), %xmm5     # 0xec2c
andps %xmm5, %xmm2
andnps %xmm1, %xmm5
xorps %xmm0, %xmm0
cvtss2sd 0x20(%rbx), %xmm0
orps %xmm2, %xmm5
ucomisd 0x309e(%rip), %xmm0     # 0xea20
jbe 0xb995
addsd 0x309c(%rip), %xmm0     # 0xea28
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x20(%rbx)
movss 0x20(%rbx), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm1, %xmm0
jbe 0xb9b7
cvtss2sd %xmm1, %xmm1
addsd 0x3072(%rip), %xmm1     # 0xea20
cvtsd2ss %xmm1, %xmm1
movss %xmm1, 0x20(%rbx)
movss 0x20(%rbx), %xmm1
xorps %xmm2, %xmm2
cvtss2sd %xmm5, %xmm2
subss %xmm1, %xmm5
divss 0x3249(%rip), %xmm5     # 0xec18
cvtss2sd %xmm1, %xmm1
addsd 0x304d(%rip), %xmm1     # 0xea28
subsd %xmm1, %xmm2
divsd 0x26b9(%rip), %xmm2     # 0xe0a0
cvtsd2ss %xmm2, %xmm2
movaps 0x264e(%rip), %xmm3     # 0xe040
movaps %xmm2, %xmm1
andps %xmm3, %xmm1
movaps %xmm5, %xmm4
andps %xmm3, %xmm4
cmpltss %xmm4, %xmm1
andps %xmm1, %xmm2
andnps %xmm5, %xmm1
orps %xmm2, %xmm1
xorl %eax, %eax
ucomiss %xmm1, %xmm0
seta %cl
andps %xmm1, %xmm3
xorps %xmm0, %xmm0
cvtss2sd %xmm3, %xmm0
ucomisd 0x3182(%rip), %xmm0     # 0xeba8
jbe 0xba36
movb %cl, %al
leaq 0x317f(%rip), %rcx      # 0xebb0
movss (%rcx,%rax,4), %xmm1
movss %xmm1, 0x30(%rbx)
movl $0x0, 0x2c(%rbx)
jmp 0xbacb
movss 0x40(%rbx), %xmm0
mulss 0x31c8(%rip), %xmm0     # 0xec1c
movss %xmm0, 0x2c(%rbx)
movl $0x3d3851ec, 0x30(%rbx) # imm = 0x3D3851EC
callq 0x4510
movzwl %ax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x25e9(%rip), %xmm0     # 0xe060
ucomisd 0x30b1(%rip), %xmm0     # 0xeb30
jbe 0xbacb
movss 0x30(%rbx), %xmm0
xorpd 0x2592(%rip), %xmm0     # 0xe020
movss %xmm0, 0x30(%rbx)
jmp 0xbacb
cmpl $0x3c, %ecx
jl 0xbacb
andl $0xffffff3f, %eax       # imm = 0xFFFFFF3F
jmp 0xbac8
testl %ecx, %ecx
jne 0xbac0
movss 0x40(%rbx), %xmm0
mulss 0x316a(%rip), %xmm0     # 0xec1c
movss %xmm0, 0x2c(%rbx)
movl $0x0, 0x30(%rbx)
jmp 0xbacb
cmpl $0x1e, %ecx
jl 0xbacb
andl $-0x41, %eax
movl %eax, 0x8(%rbx)
xorps %xmm0, %xmm0
cvtss2sd 0x30(%rbx), %xmm0
divsd 0x30cd(%rip), %xmm0     # 0xeba8
mulsd 0x30dd(%rip), %xmm0     # 0xebc0
xorps %xmm1, %xmm1
cvtsd2ss %xmm0, %xmm1
movss 0x2c(%rbx), %xmm0
mulss %xmm1, %xmm1
mulss %xmm0, %xmm0
addss %xmm1, %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0xbb09
sqrtss %xmm0, %xmm0
jmp 0xbb0e
callq 0x45e0
ucomiss 0x310b(%rip), %xmm0     # 0xec20
jbe 0xbb3b
movss 0x3101(%rip), %xmm1     # 0xec20
divss %xmm0, %xmm1
movss 0x2c(%rbx), %xmm0
mulss %xmm1, %xmm0
movss %xmm0, 0x2c(%rbx)
mulss 0x30(%rbx), %xmm1
movss %xmm1, 0x30(%rbx)
testb $0x1, 0x8(%r14)
je 0xbccd
cmpl $0xb, 0x54(%rbx)
jl 0xbccd
cmpl $0x33, 0x44(%rbx)
jl 0xbccd
movq 0x650(%rbx), %r15
movzwl 0x8(%r15), %eax
testl $0x119, %eax            # imm = 0x119
jne 0xbccd
movl $0x0, 0x54(%rbx)
movss 0x24(%r14), %xmm0
movss %xmm0, 0x10(%rsp)
movss 0x28(%r14), %xmm0
movss %xmm0, 0xc(%rsp)
xorps %xmm0, %xmm0
cvtss2sd 0x30(%r14), %xmm0
callq 0x41e0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtss2sd 0x30(%r14), %xmm0
callq 0x4590
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x4(%rsp)
xorps %xmm0, %xmm0
cvtss2sd 0x20(%rbx), %xmm0
callq 0x41e0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rsp)
xorps %xmm0, %xmm0
cvtss2sd 0x20(%rbx), %xmm0
callq 0x4590
movss (%rsp), %xmm15
movss 0x4(%rsp), %xmm14
movss 0x8(%rsp), %xmm13
movss 0xc(%rsp), %xmm12
movss 0x10(%rsp), %xmm11
xorps %xmm2, %xmm2
cvtsd2ss %xmm0, %xmm2
movss 0xc(%rbx), %xmm0
movss 0x10(%rbx), %xmm1
movss 0xc(%r14), %xmm3
movss 0x10(%r14), %xmm8
xorps 0x23f7(%rip), %xmm2     # 0xe020
movss 0x2c(%r14), %xmm4
movl $0x32, %eax
movss 0x2fe8(%rip), %xmm5     # 0xec24
mulss %xmm5, %xmm2
mulss %xmm5, %xmm15
movss 0x2fdb(%rip), %xmm5     # 0xec28
movaps %xmm1, %xmm6
movaps %xmm0, %xmm7
movaps %xmm11, %xmm9
movaps %xmm8, %xmm10
addss %xmm15, %xmm6
addss %xmm2, %xmm7
movaps %xmm14, %xmm8
mulss %xmm12, %xmm8
mulss %xmm13, %xmm11
subss %xmm8, %xmm11
mulss %xmm14, %xmm9
mulss %xmm13, %xmm12
addss %xmm9, %xmm12
movaps %xmm12, %xmm8
mulss %xmm4, %xmm8
subss %xmm8, %xmm3
movaps %xmm11, %xmm8
mulss %xmm4, %xmm8
addss %xmm10, %xmm8
movaps %xmm3, %xmm9
subss %xmm7, %xmm9
movaps %xmm6, %xmm10
subss %xmm8, %xmm10
mulss %xmm10, %xmm10
mulss %xmm9, %xmm9
addss %xmm10, %xmm9
ucomiss %xmm9, %xmm5
jae 0xbcd7
decl %eax
jne 0xbc53
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movl $0x3, 0x8(%r15)
movss %xmm0, 0xc(%r15)
movss %xmm1, 0x10(%r15)
xorl %eax, %eax
movl %eax, 0x14(%r15)
movss 0x18(%rbx), %xmm0
movss %xmm0, 0x18(%r15)
movss 0x1c(%rbx), %xmm0
movss %xmm0, 0x1c(%r15)
movss 0x20(%rbx), %xmm0
movss %xmm0, 0x20(%r15)
movl $0x42200000, 0x2c(%r15) # imm = 0x42200000
movl %eax, 0x44(%r15)
movl $0x3, %edi
movl $0x1, %esi
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x7a44