// File: /workspace/github_cpp_makefile_star2_O1/wrighteagle2d[P]wrighteaglebase/Debug/../src/Kicker.cpp
// Function: Kicker::KickBallCloseToBody(Agent&, double, double)
bool Kicker::KickBallCloseToBody(Agent &agent, AngleDeg ang, double KickRatio) {
  BallState bs = agent.GetWorldState().GetBall();
  PlayerState ms = agent.GetSelf();
  AngleDeg angBody = ms.GetBodyDir();
  Vector posAgent = ms.GetPredictedPos(1);
  double dist = ms.GetKickableMargin() * KickRatio +
                ServerParam::instance().ballSize() + ms.GetPlayerSize();
  AngleDeg angGlobal = GetNormalizeAngleDeg(angBody + ang);
  Vector posDesBall = posAgent + Polar2Vector(dist, angGlobal);
  if (fabs(posDesBall.Y()) > ServerParam::PITCH_WIDTH / 2.0 ||
      fabs(posDesBall.X()) > ServerParam::PITCH_LENGTH / 2.0) {
    Ray lineBody(posAgent, angGlobal);
    Ray lineSide;
    if (fabs(posDesBall.Y()) > ServerParam::PITCH_WIDTH / 2.0) {
      lineSide = Ray(Vector(0, (posDesBall.Y() > 0 ? 1 : -1) *
                                   ServerParam::PITCH_WIDTH / 2.0),
                     0);
    }

    else {
      lineSide = Ray(Vector(0, (posDesBall.Y() > 0 ? 1 : -1) *
                                   ServerParam::PITCH_WIDTH / 2.0),
                     90);
    }
    Vector posIntersect;
    lineSide.Intersection(Line(lineBody), posIntersect);
    posDesBall =
        posAgent + Polar2Vector(posIntersect.Dist(posAgent) - 0.2, angGlobal);
  }

  Vector vecDesired = posDesBall - bs.GetPos();
  return Kicker::KickBall(agent, posDesBall, vecDesired.Mod(), 1, false);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x2a0, %rsp            # imm = 0x2A0
movsd %xmm1, -0xb0(%rbp)
movsd %xmm0, -0x58(%rbp)
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rsi), %rsi
addq $0x30, %rsi
leaq -0x2c0(%rbp), %r15
movq %r15, %rdi
callq 0x151ba
leaq 0x546cb(%rip), %rax     # 0x86290
movq %rax, (%r15)
movq %rbx, %rdi
callq 0xe85a
movq %rax, %r15
leaq -0x248(%rbp), %r12
movq %r12, %rdi
movq %rax, %rsi
callq 0x151ba
leaq 0x541dc(%rip), %rax     # 0x85dc8
movq %rax, -0x248(%rbp)
movups 0x78(%r15), %xmm0
movupd 0x88(%r15), %xmm1
movups %xmm0, -0x1d0(%rbp)
movupd %xmm1, -0x1c0(%rbp)
movsd 0x98(%r15), %xmm0
movsd %xmm0, -0x1b0(%rbp)
movl 0xa0(%r15), %eax
movl %eax, -0x1a8(%rbp)
movsd 0xa8(%r15), %xmm0
movsd %xmm0, -0x1a0(%rbp)
movsd 0xb0(%r15), %xmm0
movsd %xmm0, -0x28(%rbp)
movsd %xmm0, -0x198(%rbp)
movl 0xb8(%r15), %eax
movl %eax, -0x190(%rbp)
movsd 0xc0(%r15), %xmm0
movsd %xmm0, -0x188(%rbp)
movq 0xc8(%r15), %rax
movq %rax, -0x180(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, -0x178(%rbp)
movq $0x0, -0x168(%rbp)
movups 0xd0(%r15), %xmm0
movups %xmm0, -0x178(%rbp)
movq 0xe0(%r15), %rax
movq %rax, -0x168(%rbp)
movl 0xe8(%r15), %eax
movl %eax, -0x160(%rbp)
movsd 0xf0(%r15), %xmm0
movsd %xmm0, -0x158(%rbp)
movb $0x3f, -0x150(%rbp)
movl $0x0, -0x14c(%rbp)
movq 0xf8(%r15), %rax
movq %rax, -0x150(%rbp)
movl 0x100(%r15), %eax
movl %eax, -0x148(%rbp)
movsd 0x108(%r15), %xmm0
movsd %xmm0, -0x140(%rbp)
movl $0x110, %eax            # imm = 0x110
addq %rax, %r12
movq %r15, %rsi
addq %rax, %rsi
movl $0xc, %ecx
movq %r12, %rdi
rep  movsq (%rsi), %es:(%rdi)
movl 0x170(%r15), %eax
movl 0x173(%r15), %ecx
movl %eax, -0xd8(%rbp)
movl %ecx, -0xd5(%rbp)
movq -0x1e0(%rbp), %r15
movl $0x1, -0x50(%rbp)
cmpl $0x0, 0x668(%r15)
jle 0x31d5f
addq $0x18, %r15
jmp 0x31d7a
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
callq 0xf062
movslq -0x50(%rbp), %rax
shlq $0x4, %rax
addq %rax, %r15
addq $0x8, %r15
movsd (%r15), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd 0x8(%r15), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x450ba
movq 0x5c38(%rax), %rax
movslq -0x134(%rbp), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movsd 0x3040(%rax,%rcx), %xmm0
movapd %xmm0, -0x90(%rbp)
callq 0x4a75c
movsd 0x30d8(%rax), %xmm0
movsd %xmm0, -0xa8(%rbp)
callq 0x450ba
movq 0x5c38(%rax), %rax
movslq -0x134(%rbp), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movapd -0x90(%rbp), %xmm1
mulsd -0xb0(%rbp), %xmm1
addsd -0xa8(%rbp), %xmm1
addsd 0x3038(%rax,%rcx), %xmm1
movsd -0x28(%rbp), %xmm3
addsd -0x58(%rbp), %xmm3
movsd 0x39244(%rip), %xmm0    # 0x6b060
ucomisd %xmm3, %xmm0
movapd %xmm1, -0x90(%rbp)
jbe 0x31e3e
movsd 0x3923e(%rip), %xmm1    # 0x6b070
addsd %xmm1, %xmm3
ucomisd %xmm3, %xmm0
ja 0x31e32
jmp 0x31e70
movapd %xmm3, %xmm2
ucomisd 0x391fe(%rip), %xmm3    # 0x6b048
jae 0x31e52
movapd %xmm2, %xmm3
jmp 0x31e70
movsd 0x3920e(%rip), %xmm0    # 0x6b068
movsd 0x391e6(%rip), %xmm1    # 0x6b048
movapd %xmm2, %xmm3
addsd %xmm0, %xmm3
ucomisd %xmm1, %xmm3
jae 0x31e66
movsd %xmm3, -0x28(%rbp)
movsd 0x391d3(%rip), %xmm0    # 0x6b050
mulsd %xmm3, %xmm0
divsd 0x391bf(%rip), %xmm0    # 0x6b048
leaq -0x50(%rbp), %r15
leaq -0x80(%rbp), %r12
movsd %xmm0, -0x58(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x92d0
movsd (%r12), %xmm1
movapd -0x90(%rbp), %xmm6
mulsd %xmm6, %xmm1
mulsd (%r15), %xmm6
movsd -0x38(%rbp), %xmm4
addsd %xmm4, %xmm1
movsd -0x30(%rbp), %xmm5
addsd %xmm5, %xmm6
movsd %xmm1, -0x68(%rbp)
movsd %xmm6, -0x60(%rbp)
movapd 0x39134(%rip), %xmm2    # 0x6b010
andpd %xmm6, %xmm2
leaq 0x3c039(%rip), %rax     # 0x6df20
movsd (%rax), %xmm0
movsd 0x39985(%rip), %xmm3    # 0x6b878
mulsd %xmm0, %xmm3
ucomisd %xmm3, %xmm2
jbe 0x31fd2
xorpd %xmm1, %xmm1
movapd %xmm1, -0x50(%rbp)
movsd %xmm4, -0x50(%rbp)
movsd %xmm5, -0x48(%rbp)
movsd -0x28(%rbp), %xmm2
movsd %xmm2, -0x40(%rbp)
movapd %xmm1, -0x80(%rbp)
movapd 0x390f5(%rip), %xmm3    # 0x6b020
xorpd %xmm0, %xmm3
xorpd %xmm2, %xmm2
xorpd %xmm1, %xmm1
cmpltsd %xmm6, %xmm1
andpd %xmm1, %xmm0
andnpd %xmm3, %xmm1
orpd %xmm0, %xmm1
mulsd 0x39928(%rip), %xmm1    # 0x6b878
movq $0x0, -0x80(%rbp)
movsd %xmm1, -0x78(%rbp)
movsd %xmm2, -0x70(%rbp)
xorpd %xmm0, %xmm0
movapd %xmm0, -0xa0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x2276a
leaq -0x80(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x29a2c
movsd -0xa0(%rbp), %xmm0
movsd -0x98(%rbp), %xmm1
subsd -0x38(%rbp), %xmm0
subsd -0x30(%rbp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x3205b
sqrtsd %xmm0, %xmm0
jmp 0x32060
movsd -0x28(%rbp), %xmm5
andpd 0x39031(%rip), %xmm1    # 0x6b010
leaq 0x3bf32(%rip), %rax     # 0x6df18
movsd (%rax), %xmm4
mulsd 0x39886(%rip), %xmm4    # 0x6b878
ucomisd %xmm4, %xmm1
jbe 0x320bf
ucomisd %xmm3, %xmm2
xorpd %xmm1, %xmm1
movapd %xmm1, -0x50(%rbp)
movsd -0x38(%rbp), %xmm2
movsd %xmm2, -0x50(%rbp)
movsd -0x30(%rbp), %xmm2
movsd %xmm2, -0x48(%rbp)
movsd %xmm5, -0x40(%rbp)
movapd %xmm1, -0x80(%rbp)
ja 0x31f23
movapd 0x38feb(%rip), %xmm2    # 0x6b020
xorpd %xmm0, %xmm2
xorpd %xmm1, %xmm1
cmpltsd %xmm6, %xmm1
andpd %xmm1, %xmm0
andnpd %xmm2, %xmm1
orpd %xmm0, %xmm1
movsd 0x3905a(%rip), %xmm2    # 0x6b0b0
jmp 0x31f48
callq 0x93c0
addsd 0x3a8a8(%rip), %xmm0    # 0x6c910
movsd %xmm0, -0x28(%rbp)
leaq -0xc8(%rbp), %r15
leaq -0xd0(%rbp), %r12
movsd -0x58(%rbp), %xmm0
movq %r15, %rdi
movq %r12, %rsi
callq 0x92d0
movsd (%r12), %xmm0
movsd -0x28(%rbp), %xmm1
mulsd %xmm1, %xmm0
mulsd (%r15), %xmm1
movapd %xmm1, %xmm2
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd -0x30(%rbp), %xmm0
addsd %xmm2, %xmm0
movsd %xmm1, -0x68(%rbp)
movsd %xmm0, -0x60(%rbp)
movsd -0x68(%rbp), %xmm0
movsd -0x60(%rbp), %xmm1
subsd -0x2b8(%rbp), %xmm0
subsd -0x2b0(%rbp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x320f5
sqrtsd %xmm0, %xmm0
jmp 0x320fa
callq 0x93c0
leaq -0x68(%rbp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x2f49c
movl %eax, %ebx
leaq 0x53196(%rip), %r14     # 0x852b0
movq %r14, -0x248(%rbp)
movq -0x1e0(%rbp), %rdi
testq %rdi, %rdi
je 0x32137
movl $0x670, %esi            # imm = 0x670
callq 0x94e0
movq %r14, -0x2c0(%rbp)
movq -0x258(%rbp), %rdi
testq %rdi, %rdi
je 0x32154
movl $0x670, %esi            # imm = 0x670
callq 0x94e0
movl %ebx, %eax
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x32171
jmp 0x32171
jmp 0x32171
movq %rax, %rbx
jmp 0x32198
movq %rax, %rbx
leaq 0x53135(%rip), %rax     # 0x852b0
movq %rax, -0x248(%rbp)
movq -0x1e0(%rbp), %rdi
testq %rdi, %rdi
je 0x32198
movl $0x670, %esi            # imm = 0x670
callq 0x94e0
leaq 0x53111(%rip), %rax     # 0x852b0
movq %rax, -0x2c0(%rbp)
movq -0x258(%rbp), %rdi
testq %rdi, %rdi
je 0x321bc
movl $0x670, %esi            # imm = 0x670
callq 0x94e0
movq %rbx, %rdi
callq 0x98b0