// File: /workspace/github_cpp_makefile_star2_O3/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 $0x2b0, %rsp            # imm = 0x2B0
movsd %xmm1, -0xa0(%rbp)
movsd %xmm0, -0x40(%rbp)
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rsi), %rsi
addq $0x30, %rsi
leaq -0x2c8(%rbp), %r15
movq %r15, %rdi
callq 0x14fbe
leaq 0x522e9(%rip), %rax     # 0x832e0
movq %rax, (%r15)
movq %rbx, %rdi
callq 0xe75a
movq %rax, %r15
leaq -0x250(%rbp), %r12
movq %r12, %rdi
movq %rax, %rsi
callq 0x14fbe
leaq 0x51e4a(%rip), %rax     # 0x82e68
movq %rax, -0x250(%rbp)
movups 0x78(%r15), %xmm0
movupd 0x88(%r15), %xmm1
movups %xmm0, -0x1d8(%rbp)
movupd %xmm1, -0x1c8(%rbp)
movsd 0x98(%r15), %xmm0
movsd %xmm0, -0x1b8(%rbp)
movl 0xa0(%r15), %eax
movl %eax, -0x1b0(%rbp)
movsd 0xa8(%r15), %xmm0
movsd %xmm0, -0x1a8(%rbp)
movsd 0xb0(%r15), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd %xmm0, -0x1a0(%rbp)
movl 0xb8(%r15), %eax
movl %eax, -0x198(%rbp)
movsd 0xc0(%r15), %xmm0
movsd %xmm0, -0x190(%rbp)
movq 0xc8(%r15), %rax
movq %rax, -0x188(%rbp)
movups 0xd0(%r15), %xmm0
movups %xmm0, -0x180(%rbp)
movq 0xe0(%r15), %rax
movq %rax, -0x170(%rbp)
movl 0xe8(%r15), %eax
movl %eax, -0x168(%rbp)
movsd 0xf0(%r15), %xmm0
movsd %xmm0, -0x160(%rbp)
movq 0xf8(%r15), %rax
movq %rax, -0x158(%rbp)
movl 0x100(%r15), %eax
movl %eax, -0x150(%rbp)
movsd 0x108(%r15), %xmm0
movsd %xmm0, -0x148(%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, -0xe0(%rbp)
movl %ecx, -0xdd(%rbp)
movq -0x1e8(%rbp), %r15
movl $0x1, -0x58(%rbp)
movl $0x1, %eax
cmpl $0x0, 0x668(%r15)
jg 0x3117a
leaq -0x58(%rbp), %rsi
movq %r15, %rdi
callq 0xef58
movslq -0x58(%rbp), %rax
shlq $0x4, %rax
movsd 0x8(%r15,%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
movsd 0x10(%r15,%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x43dce
movq 0x5c38(%rax), %rax
movslq -0x13c(%rbp), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movsd 0x3040(%rax,%rcx), %xmm0
movapd %xmm0, -0x70(%rbp)
callq 0x49360
movsd 0x30d8(%rax), %xmm0
movsd %xmm0, -0x98(%rbp)
callq 0x43dce
movq 0x5c38(%rax), %rax
movslq -0x13c(%rbp), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movapd -0x70(%rbp), %xmm1
mulsd -0xa0(%rbp), %xmm1
addsd -0x98(%rbp), %xmm1
addsd 0x3038(%rax,%rcx), %xmm1
movsd -0x38(%rbp), %xmm3
addsd -0x40(%rbp), %xmm3
movsd 0x37e43(%rip), %xmm0    # 0x69060
ucomisd %xmm3, %xmm0
movapd %xmm1, -0x70(%rbp)
jbe 0x3123c
movsd 0x37e40(%rip), %xmm1    # 0x69070
addsd %xmm1, %xmm3
ucomisd %xmm3, %xmm0
ja 0x31230
jmp 0x3126e
movapd %xmm3, %xmm2
ucomisd 0x37e00(%rip), %xmm3    # 0x69048
jae 0x31250
movapd %xmm2, %xmm3
jmp 0x3126e
movsd 0x37e10(%rip), %xmm0    # 0x69068
movsd 0x37de8(%rip), %xmm1    # 0x69048
movapd %xmm2, %xmm3
addsd %xmm0, %xmm3
ucomisd %xmm1, %xmm3
jae 0x31264
movsd %xmm3, -0x38(%rbp)
movsd 0x37dd5(%rip), %xmm0    # 0x69050
mulsd %xmm3, %xmm0
divsd 0x37dc1(%rip), %xmm0    # 0x69048
leaq -0x58(%rbp), %r15
leaq -0xb8(%rbp), %r12
movsd %xmm0, -0x40(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x92d0
movsd (%r12), %xmm0
movapd -0x70(%rbp), %xmm6
mulsd %xmm6, %xmm0
mulsd (%r15), %xmm6
movsd -0x28(%rbp), %xmm5
addsd %xmm5, %xmm0
movsd -0x30(%rbp), %xmm4
addsd %xmm4, %xmm6
movsd %xmm0, -0x80(%rbp)
movsd %xmm6, -0x78(%rbp)
movapd 0x37d36(%rip), %xmm2    # 0x69010
andpd %xmm6, %xmm2
leaq 0x3ac0b(%rip), %rax     # 0x6bef0
movsd (%rax), %xmm1
movsd 0x38587(%rip), %xmm3    # 0x69878
mulsd %xmm1, %xmm3
ucomisd %xmm3, %xmm2
jbe 0x31315
movsd %xmm5, -0x58(%rbp)
movsd %xmm4, -0x50(%rbp)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
xorpd %xmm0, %xmm0
jmp 0x31364
movsd -0x38(%rbp), %xmm4
movapd 0x37cee(%rip), %xmm2    # 0x69010
andpd %xmm0, %xmm2
leaq 0x3abbb(%rip), %rax     # 0x6bee8
movsd (%rax), %xmm3
mulsd 0x3853f(%rip), %xmm3    # 0x69878
ucomisd %xmm3, %xmm2
jbe 0x3145b
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd %xmm4, -0x48(%rbp)
movsd 0x37d4c(%rip), %xmm0    # 0x690b0
movapd 0x37cb4(%rip), %xmm2    # 0x69020
xorpd %xmm1, %xmm2
xorpd %xmm3, %xmm3
cmpltsd %xmm6, %xmm3
andpd %xmm3, %xmm1
andnpd %xmm2, %xmm3
orpd %xmm1, %xmm3
mulsd 0x384eb(%rip), %xmm3    # 0x69878
movq $0x0, -0xb8(%rbp)
movsd %xmm3, -0xb0(%rbp)
movsd %xmm0, -0xa8(%rbp)
xorpd %xmm0, %xmm0
movapd %xmm0, -0x90(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x220f2
leaq -0xb8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0x291bc
movsd -0x90(%rbp), %xmm0
movsd -0x88(%rbp), %xmm1
subsd -0x28(%rbp), %xmm0
subsd -0x30(%rbp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
addsd 0x394f0(%rip), %xmm0    # 0x6a900
movapd %xmm0, -0x70(%rbp)
leaq -0xd0(%rbp), %r15
leaq -0xd8(%rbp), %r12
movsd -0x40(%rbp), %xmm0
movq %r15, %rdi
movq %r12, %rsi
callq 0x92d0
movapd -0x70(%rbp), %xmm6
movsd (%r12), %xmm0
mulsd %xmm6, %xmm0
mulsd (%r15), %xmm6
addsd -0x28(%rbp), %xmm0
addsd -0x30(%rbp), %xmm6
movsd %xmm0, -0x80(%rbp)
movsd %xmm6, -0x78(%rbp)
subsd -0x2c0(%rbp), %xmm0
subsd -0x2b8(%rbp), %xmm6
mulsd %xmm6, %xmm6
mulsd %xmm0, %xmm0
addsd %xmm6, %xmm0
sqrtsd %xmm0, %xmm0
leaq -0x80(%rbp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x2e9f6
movl %eax, %ebx
leaq 0x50f35(%rip), %r14     # 0x823d0
movq %r14, -0x250(%rbp)
movq -0x1e8(%rbp), %rdi
movl $0x670, %esi            # imm = 0x670
callq 0x94e0
movq %r14, -0x2c8(%rbp)
movq -0x260(%rbp), %rdi
movl $0x670, %esi            # imm = 0x670
callq 0x94e0
movl %ebx, %eax
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x314e8
jmp 0x314e8
jmp 0x314e8
movq %rax, %rbx
jmp 0x3150a
movq %rax, %rbx
leaq 0x50ede(%rip), %rax     # 0x823d0
movq %rax, -0x250(%rbp)
movq -0x1e8(%rbp), %rdi
movl $0x670, %esi            # imm = 0x670
callq 0x94e0
leaq 0x50ebf(%rip), %rax     # 0x823d0
movq %rax, -0x2c8(%rbp)
movq -0x260(%rbp), %rdi
movl $0x670, %esi            # imm = 0x670
callq 0x94e0
movq %rbx, %rdi
callq 0x98b0
nop