// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/PositionInfo.cpp
// Function: PositionInfo::UpdateOffsideLine()
void PositionInfo::UpdateOffsideLine() {
  const BallState &ball_state = mpWorldState->GetBall();
  const PlayerState *pPlayer = 0;

  double first = 0.0;
  double second = 0.0;
  Unum f_unum = 0;
  Unum s_unum = 0;

  // teammate offside line
  for (int i = 1; i <= TEAMSIZE; ++i) {
    pPlayer = &(mpWorldState->GetOpponent(i));
    if (pPlayer->IsAlive() == false) {
      continue;
    }

    if (pPlayer->GetPos().X() > second) {
      if (pPlayer->GetPos().X() > first) {
        second = first;
        s_unum = f_unum;
        first = pPlayer->GetPos().X();
        f_unum = i;
      } else {
        second = pPlayer->GetPos().X();
        s_unum = i;
      }
    }
  }

  if (ball_state.GetPosConf() > PlayerParam::instance().minValidConf() &&
      ball_state.GetPos().X() > second) {
    mTeammateOffsideLineOpp = 0;
    mTeammateOffsideLine = ball_state.GetPos().X();
    mTeammateOffsideLineConf = ball_state.GetPosConf();
    mTeammateOffsideLineSpeed = ball_state.GetVel().X();
  } else {
    mTeammateOffsideLine = second;
    if (s_unum == 0) {
      mTeammateOffsideLineOpp = 0;
      mTeammateOffsideLineConf = 0.0;
      mTeammateOffsideLineSpeed = 0.0;
    } else {
      mTeammateOffsideLineOpp = s_unum;
      mTeammateOffsideLineConf = mpWorldState->GetOpponent(s_unum).GetPosConf();
      mTeammateOffsideLineSpeed =
          mpWorldState->GetOpponent(s_unum).GetVel().X();
    }
  }

  // opponent offside line
  first = 0.0;
  second = 0.0;
  f_unum = 0;
  s_unum = 0;
  for (int i = 1; i <= TEAMSIZE; ++i) {
    pPlayer = &(mpWorldState->GetTeammate(i));
    if (pPlayer->IsAlive() == false) {
      continue;
    }

    if (pPlayer->GetPos().X() < second) {
      if (pPlayer->GetPos().X() < first) {
        second = first;
        s_unum = f_unum;
        first = pPlayer->GetPos().X();
        f_unum = i;
      } else {
        second = pPlayer->GetPos().X();
        s_unum = i;
      }
    }
  }
  if (ball_state.GetPosConf() > PlayerParam::instance().minValidConf() &&
      ball_state.GetPos().X() < second) {
    mOpponentOffsideLineTm = 0;
    mOpponentOffsideLine = ball_state.GetPos().X();
    mOpponentOffsideLineConf = ball_state.GetPosConf();
    mOpponentOffsideLineSpeed = ball_state.GetVel().X();
  } else {
    mOpponentOffsideLine = second;
    if (s_unum == 0) {
      mOpponentOffsideLineTm = 0;
      mOpponentOffsideLineConf = 0.0;
      mOpponentOffsideLineSpeed = 0.0;
    } else {
      mOpponentOffsideLineTm = s_unum;
      mOpponentOffsideLineConf = mpWorldState->GetTeammate(s_unum).GetPosConf();
      mOpponentOffsideLineSpeed =
          mpWorldState->GetTeammate(s_unum).GetVel().X();
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq 0x10(%rax), %rdi
callq 0x10570
movq %rax, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x1, -0x34(%rbp)
cmpl $0xb, -0x34(%rbp)
jg 0x7e991
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0x34(%rbp), %rsi
callq 0x1d480
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x23f20
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x7e8e5
jmp 0x7e983
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, %rdi
callq 0x176f0
movsd (%rax), %xmm0
ucomisd -0x28(%rbp), %xmm0
jbe 0x7e981
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, %rdi
callq 0x176f0
movsd (%rax), %xmm0
ucomisd -0x20(%rbp), %xmm0
jbe 0x7e95b
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, %rdi
callq 0x176f0
movsd (%rax), %xmm0
movsd %xmm0, -0x20(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x7e97f
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, %rdi
callq 0x176f0
movsd (%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x30(%rbp)
jmp 0x7e981
jmp 0x7e983
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x7e8ae
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x1d930
movsd (%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
callq 0x798a0
movq %rax, %rdi
callq 0x1d950
movsd -0x48(%rbp), %xmm0
ucomisd (%rax), %xmm0
jbe 0x7ea62
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, %rdi
callq 0x176f0
movsd (%rax), %xmm0
ucomisd -0x28(%rbp), %xmm0
jbe 0x7ea62
movq -0x40(%rbp), %rax
movl $0x0, 0x1798(%rax)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, %rdi
callq 0x176f0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movsd (%rcx), %xmm0
movsd %xmm0, 0x17a0(%rax)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x1d930
movq %rax, %rcx
movq -0x40(%rbp), %rax
movsd (%rcx), %xmm0
movsd %xmm0, 0x17a8(%rax)
movq -0x10(%rbp), %rdi
callq 0x10a80
movq %rax, %rdi
callq 0x176f0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movsd (%rcx), %xmm0
movsd %xmm0, 0x17b0(%rax)
jmp 0x7eb0a
movq -0x40(%rbp), %rax
movsd -0x28(%rbp), %xmm0
movsd %xmm0, 0x17a0(%rax)
cmpl $0x0, -0x30(%rbp)
jne 0x7ea9f
movq -0x40(%rbp), %rax
movl $0x0, 0x1798(%rax)
xorps %xmm0, %xmm0
movsd %xmm0, 0x17a8(%rax)
xorps %xmm0, %xmm0
movsd %xmm0, 0x17b0(%rax)
jmp 0x7eb08
movq -0x40(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, 0x1798(%rax)
movq 0x10(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1d480
movq %rax, %rdi
addq $0x8, %rdi
callq 0x1d930
movq %rax, %rcx
movq -0x40(%rbp), %rax
movsd (%rcx), %xmm0
movsd %xmm0, 0x17a8(%rax)
movq 0x10(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1d480
movq %rax, %rdi
callq 0x10a80
movq %rax, %rdi
callq 0x176f0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movsd (%rcx), %xmm0
movsd %xmm0, 0x17b0(%rax)
jmp 0x7eb0a
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x1, -0x38(%rbp)
cmpl $0xb, -0x38(%rbp)
jg 0x7ec1e
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x12520
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x23f20
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x7eb66
jmp 0x7ec10
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, %rdi
callq 0x176f0
movsd (%rax), %xmm1
movsd -0x28(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7ec0e
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, %rdi
callq 0x176f0
movsd (%rax), %xmm1
movsd -0x20(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7ebe8
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, %rdi
callq 0x176f0
movsd (%rax), %xmm0
movsd %xmm0, -0x20(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x7ec0c
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, %rdi
callq 0x176f0
movsd (%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x30(%rbp)
jmp 0x7ec0e
jmp 0x7ec10
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x7eb2f
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x1d930
movsd (%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
callq 0x798a0
movq %rax, %rdi
callq 0x1d950
movsd -0x50(%rbp), %xmm0
ucomisd (%rax), %xmm0
jbe 0x7ecf3
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, %rdi
callq 0x176f0
movsd (%rax), %xmm1
movsd -0x28(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7ecf3
movq -0x40(%rbp), %rax
movl $0x0, 0x17b8(%rax)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, %rdi
callq 0x176f0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movsd (%rcx), %xmm0
movsd %xmm0, 0x17c0(%rax)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x1d930
movq %rax, %rcx
movq -0x40(%rbp), %rax
movsd (%rcx), %xmm0
movsd %xmm0, 0x17c8(%rax)
movq -0x10(%rbp), %rdi
callq 0x10a80
movq %rax, %rdi
callq 0x176f0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movsd (%rcx), %xmm0
movsd %xmm0, 0x17d0(%rax)
jmp 0x7ed9b
movq -0x40(%rbp), %rax
movsd -0x28(%rbp), %xmm0
movsd %xmm0, 0x17c0(%rax)
cmpl $0x0, -0x30(%rbp)
jne 0x7ed30
movq -0x40(%rbp), %rax
movl $0x0, 0x17b8(%rax)
xorps %xmm0, %xmm0
movsd %xmm0, 0x17c8(%rax)
xorps %xmm0, %xmm0
movsd %xmm0, 0x17d0(%rax)
jmp 0x7ed99
movq -0x40(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, 0x17b8(%rax)
movq 0x10(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x12520
movq %rax, %rdi
addq $0x8, %rdi
callq 0x1d930
movq %rax, %rcx
movq -0x40(%rbp), %rax
movsd (%rcx), %xmm0
movsd %xmm0, 0x17c8(%rax)
movq 0x10(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x12520
movq %rax, %rdi
callq 0x10a80
movq %rax, %rdi
callq 0x176f0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movsd (%rcx), %xmm0
movsd %xmm0, 0x17d0(%rax)
jmp 0x7ed9b
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)