// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/PlayerParam.h
// Function: PlayerParam::GetEpsInMark(double)
double GetEpsInMark(double dist) {
    Assert(dist >= 0);
    int low = 0;
    int middle = 0;
    int high = MARKSIZE - 1;

    while (low <= high) {
      middle = (low + high) / 2;

      if (middle + 1 >= MARKSIZE) {
        return mMarkChange[MARKSIZE - 1][2];
      }

      if (dist >= mMarkChange[middle][0] &&
          dist <= mMarkChange[middle + 1][0]) {
        if (fabs(dist - mMarkChange[middle][0]) <
            fabs(dist - mMarkChange[middle + 1][0])) {
          return mMarkChange[middle][2];
        } else {
          return mMarkChange[middle + 1][2];
        }
      }

      if (middle == 0) {
        return mMarkChange[middle][2];
      }

      if (dist < mMarkChange[middle][0]) {
        high = middle;
      } else {
        low = middle + 1;
      }
    }

    PRINT_ERROR("can not find this dist " << dist);
    return 0;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x183, -0x24(%rbp)     # imm = 0x183
movl -0x1c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0xbdead
movl -0x1c(%rbp), %eax
addl -0x24(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
cmpl $0x184, %eax            # imm = 0x184
jl 0xbdd4e
movq -0x30(%rbp), %rax
movsd 0x5c30(%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0xbdf20
movq -0x30(%rbp), %rax
movsd -0x18(%rbp), %xmm0
addq $0x37d8, %rax           # imm = 0x37D8
movslq -0x20(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
ucomisd (%rax), %xmm0
jb 0xbde49
movq -0x30(%rbp), %rax
movsd -0x18(%rbp), %xmm1
addq $0x37d8, %rax           # imm = 0x37D8
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jb 0xbde49
movq -0x30(%rbp), %rax
movsd -0x18(%rbp), %xmm1
movq %rax, %rcx
addq $0x37d8, %rcx           # imm = 0x37D8
movslq -0x20(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
subsd (%rcx), %xmm1
movaps 0x3298(%rip), %xmm0     # 0xc1060
pand %xmm0, %xmm1
movsd -0x18(%rbp), %xmm0
addq $0x37d8, %rax           # imm = 0x37D8
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
subsd (%rax), %xmm0
movaps 0x326e(%rip), %xmm2     # 0xc1060
pand %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0xbde20
movq -0x30(%rbp), %rax
addq $0x37d8, %rax           # imm = 0x37D8
movslq -0x20(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0xbdf20
movq -0x30(%rbp), %rax
addq $0x37d8, %rax           # imm = 0x37D8
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0xbdf20
cmpl $0x0, -0x20(%rbp)
jne 0xbde73
movq -0x30(%rbp), %rax
addq $0x37d8, %rax           # imm = 0x37D8
movslq -0x20(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0xbdf20
movq -0x30(%rbp), %rax
movsd -0x18(%rbp), %xmm1
addq $0x37d8, %rax           # imm = 0x37D8
movslq -0x20(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xbde9f
movl -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0xbdea8
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xbdd0e
jmp 0xbdeaf
movq 0x4013a(%rip), %rdi     # 0xfdff0
leaq 0x7b5e(%rip), %rsi      # 0xc5a1b
callq 0xa5a0
movq %rax, %rdi
leaq 0x7385(%rip), %rsi      # 0xc5251
callq 0xa5a0
movq %rax, %rdi
movl $0x1ac, %esi            # imm = 0x1AC
callq 0xaa40
movq %rax, %rdi
leaq 0x5677(%rip), %rsi      # 0xc355f
callq 0xa5a0
movq %rax, %rdi
leaq 0x7b39(%rip), %rsi      # 0xc5a30
callq 0xa5a0
movq %rax, %rdi
movsd -0x18(%rbp), %xmm0
callq 0xab60
movq %rax, %rdi
movq 0x4009d(%rip), %rsi     # 0xfdfb0
callq 0xa630
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)