// File: Cell-veto[P]postlhc/./storage.hpp
// Function: Storage<Monodisperse2D>::displace(unsigned long, unsigned int, double, unsigned long)
key_t displace (key_t whom, unsigned direction, double distance,
        key_t preserve)
    {
        assert (distance >= 0.);
        CellData moving = pull_encoded (whom);

        moving.coord[direction] += uint64_t (real2frac[direction] * distance);
        moving.add_displacement (direction, distance);
        
        // maintain in_use flag
        moving.coord[1] |= 1;

        if (preserve == whom)
            return put_encoded_possibly_subdivide (moving);

        try
        {
            put_encoded (moving);
            return preserve;
        }
        catch (StorageFull)
        {
            // damage control - we need to resize the cell array,
            // but our caller also needs a valid reference to
            // inext.  pull it out.
            CellData next = pull_encoded (preserve);
            put_encoded_possibly_subdivide (moving);
            return put_encoded_possibly_subdivide (next);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movsd %xmm0, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movsd -0x28(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x422287
jmp 0x4222a6
leaq 0x1db293(%rip), %rdi    # 0x5fd521
leaq 0x1da252(%rip), %rsi    # 0x5fc4e7
movl $0x233, %edx            # imm = 0x233
leaq 0x1db28f(%rip), %rcx    # 0x5fd530
callq 0x53d020
movq -0x68(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x422410
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq %rcx, -0x40(%rbp)
movq %rdx, -0x38(%rbp)
movl -0x1c(%rbp), %ecx
movsd 0x68(%rax,%rcx,8), %xmm0
movsd -0x28(%rbp), %xmm1
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
movsd 0x1da09d(%rip), %xmm1   # 0x5fc388
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
andq %rdx, %rax
orq %rax, %rcx
movl -0x1c(%rbp), %eax
addq -0x40(%rbp,%rax,8), %rcx
movq %rcx, -0x40(%rbp,%rax,8)
movl -0x1c(%rbp), %esi
movsd -0x28(%rbp), %xmm0
leaq -0x40(%rbp), %rdi
callq 0x4224d0
movq -0x38(%rbp), %rax
orq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x422344
movq -0x68(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x4224f0
movq %rax, -0x8(%rbp)
jmp 0x4223f2
movq -0x68(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x4225b0
jmp 0x422353
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x4223f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x4223ff
movq -0x48(%rbp), %rdi
callq 0x4751c0
movq -0x68(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x422410
movq %rdx, -0x78(%rbp)
movq %rax, -0x70(%rbp)
jmp 0x42239c
movq -0x68(%rbp), %rdi
movq -0x78(%rbp), %rax
movq -0x70(%rbp), %rcx
movq %rcx, -0x60(%rbp)
movq %rax, -0x58(%rbp)
leaq -0x40(%rbp), %rsi
callq 0x4224f0
jmp 0x4223bb
movq -0x68(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x4224f0
movq %rax, -0x80(%rbp)
jmp 0x4223ce
movq -0x80(%rbp), %rax
movq %rax, -0x8(%rbp)
callq 0x475230
jmp 0x4223f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
callq 0x475230
jmp 0x4223f0
jmp 0x4223ff
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x5283c0
movq %rax, %rdi
callq 0x4082e0