// File: icemiliang[P]vot/src/vot/cell.cc
// Function: voro::voronoicell_base::check_marginal(int, double&)
int voronoicell_base::check_marginal(int n,double &ans) {
    int i;
    for(i=0;i<n_marg;i+=2) if(marg[i]==n) return marg[i+1];
    if(n_marg==current_marginal) {
        current_marginal<<=1;
        if(current_marginal>max_marginal)
            voro_fatal_error("Marginal case buffer allocation exceeded absolute maximum",VOROPP_MEMORY_ERROR);
#if VOROPP_VERBOSE >=2
        fprintf(stderr,"Marginal cases buffer scaled up to %d\n",i);
#endif
        int *pmarg=new int[current_marginal];
        for(int j=0;j<n_marg;j++) pmarg[j]=marg[j];
        delete [] marg;
        marg=pmarg;
    }
    marg[n_marg++]=n;
    marg[n_marg++]=ans>tolerance?1:(ans<-tolerance?-1:0);
    return marg[n_marg-1];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x40(%rbp), %rcx
movl -0x24(%rbp), %eax
cmpl 0x74(%rcx), %eax
jge 0x45f0b
movq -0x40(%rbp), %rax
movq 0x78(%rax), %rax
movslq -0x24(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x14(%rbp), %eax
jne 0x45efe
movq -0x40(%rbp), %rax
movq 0x78(%rax), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x4(%rbp)
jmp 0x46059
jmp 0x45f00
movl -0x24(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x24(%rbp)
jmp 0x45ec2
movq -0x40(%rbp), %rcx
movl 0x74(%rcx), %eax
cmpl 0x70(%rcx), %eax
jne 0x45fcd
movq -0x40(%rbp), %rax
movl 0x70(%rax), %ecx
shll %ecx
movl %ecx, 0x70(%rax)
cmpl $0x1000000, 0x70(%rax)  # imm = 0x1000000
jle 0x45f41
leaq 0x4e5a5(%rip), %rdi     # 0x944dc
movl $0x2, %esi
callq 0x4c000
movq -0x40(%rbp), %rax
movslq 0x70(%rax), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0xa030
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x40(%rbp), %rcx
movl -0x34(%rbp), %eax
cmpl 0x74(%rcx), %eax
jge 0x45fa6
movq -0x40(%rbp), %rax
movq 0x78(%rax), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x45f75
movq -0x40(%rbp), %rax
movq 0x78(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x45fc1
movq -0x48(%rbp), %rdi
callq 0xa660
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, 0x78(%rax)
movq -0x40(%rbp), %rsi
movl -0x14(%rbp), %edx
movq 0x78(%rsi), %rax
movl 0x74(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x74(%rsi)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq -0x20(%rbp), %rax
movsd (%rax), %xmm0
movsd 0x4e0ef(%rip), %xmm1    # 0x940e8
ucomisd %xmm1, %xmm0
jbe 0x46009
movl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x4602a
movq -0x20(%rbp), %rax
movsd (%rax), %xmm1
movsd 0x4e0d7(%rip), %xmm0    # 0x940f0
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
ucomisd %xmm1, %xmm0
cmoval %ecx, %eax
movl %eax, -0x4c(%rbp)
movq -0x40(%rbp), %rcx
movl -0x4c(%rbp), %esi
movq 0x78(%rcx), %rax
movl 0x74(%rcx), %edx
movl %edx, %edi
addl $0x1, %edi
movl %edi, 0x74(%rcx)
movslq %edx, %rdx
movl %esi, (%rax,%rdx,4)
movq 0x78(%rcx), %rax
movl 0x74(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)