// File: DoubleString[P]RtConverter/src/Rtklib/rtcm3e.cpp
// Function: bamboo::to_msm_lock_ex(double)
static int to_msm_lock_ex(double lock)
{
    int lock_ms = (int)(lock * 1000.0);
    
    if (lock<0.0      ) return 0;
    if (lock<0.064    ) return lock_ms;
    if (lock<0.128    ) return (lock_ms+64       )/2;
    if (lock<0.256    ) return (lock_ms+256      )/4;
    if (lock<0.512    ) return (lock_ms+768      )/8;
    if (lock<1.024    ) return (lock_ms+2048     )/16;
    if (lock<2.048    ) return (lock_ms+5120     )/32;
    if (lock<4.096    ) return (lock_ms+12288    )/64;
    if (lock<8.192    ) return (lock_ms+28672    )/128;
    if (lock<16.384   ) return (lock_ms+65536    )/256;
    if (lock<32.768   ) return (lock_ms+147456   )/512;
    if (lock<65.536   ) return (lock_ms+327680   )/1024;
    if (lock<131.072  ) return (lock_ms+720896   )/2048;
    if (lock<262.144  ) return (lock_ms+1572864  )/4096;
    if (lock<524.288  ) return (lock_ms+3407872  )/8192;
    if (lock<1048.576 ) return (lock_ms+7340032  )/16384;
    if (lock<2097.152 ) return (lock_ms+15728640 )/32768;
    if (lock<4194.304 ) return (lock_ms+33554432 )/65536;
    if (lock<8388.608 ) return (lock_ms+71303168 )/131072;
    if (lock<16777.216) return (lock_ms+150994944)/262144;
    if (lock<33554.432) return (lock_ms+318767104)/524288;
    if (lock<67108.864) return (lock_ms+671088640)/1048576;
    return 704;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movsd %xmm0, -0x10(%rbp)
movsd 0x325e7(%rip), %xmm0    # 0xbd428
mulsd -0x10(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x14(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x10(%rbp), %xmm0
jbe 0x8ae63
movl $0x0, -0x4(%rbp)
jmp 0x8b182
movsd 0x32f55(%rip), %xmm0    # 0xbddc0
ucomisd -0x10(%rbp), %xmm0
jbe 0x8ae7d
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36f73(%rip), %xmm0    # 0xc1df8
ucomisd -0x10(%rbp), %xmm0
jbe 0x8aea2
movl -0x14(%rbp), %eax
addl $0x40, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36f56(%rip), %xmm0    # 0xc1e00
ucomisd -0x10(%rbp), %xmm0
jbe 0x8aec9
movl -0x14(%rbp), %eax
addl $0x100, %eax            # imm = 0x100
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36f37(%rip), %xmm0    # 0xc1e08
ucomisd -0x10(%rbp), %xmm0
jbe 0x8aef0
movl -0x14(%rbp), %eax
addl $0x300, %eax            # imm = 0x300
movl $0x8, %ecx
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36f18(%rip), %xmm0    # 0xc1e10
ucomisd -0x10(%rbp), %xmm0
jbe 0x8af17
movl -0x14(%rbp), %eax
addl $0x800, %eax            # imm = 0x800
movl $0x10, %ecx
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36ef9(%rip), %xmm0    # 0xc1e18
ucomisd -0x10(%rbp), %xmm0
jbe 0x8af3e
movl -0x14(%rbp), %eax
addl $0x1400, %eax           # imm = 0x1400
movl $0x20, %ecx
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36eda(%rip), %xmm0    # 0xc1e20
ucomisd -0x10(%rbp), %xmm0
jbe 0x8af65
movl -0x14(%rbp), %eax
addl $0x3000, %eax           # imm = 0x3000
movl $0x40, %ecx
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36ebb(%rip), %xmm0    # 0xc1e28
ucomisd -0x10(%rbp), %xmm0
jbe 0x8af8c
movl -0x14(%rbp), %eax
addl $0x7000, %eax           # imm = 0x7000
movl $0x80, %ecx
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36e9c(%rip), %xmm0    # 0xc1e30
ucomisd -0x10(%rbp), %xmm0
jbe 0x8afb3
movl -0x14(%rbp), %eax
addl $0x10000, %eax          # imm = 0x10000
movl $0x100, %ecx            # imm = 0x100
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36e7d(%rip), %xmm0    # 0xc1e38
ucomisd -0x10(%rbp), %xmm0
jbe 0x8afda
movl -0x14(%rbp), %eax
addl $0x24000, %eax          # imm = 0x24000
movl $0x200, %ecx            # imm = 0x200
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36e5e(%rip), %xmm0    # 0xc1e40
ucomisd -0x10(%rbp), %xmm0
jbe 0x8b001
movl -0x14(%rbp), %eax
addl $0x50000, %eax          # imm = 0x50000
movl $0x400, %ecx            # imm = 0x400
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36e3f(%rip), %xmm0    # 0xc1e48
ucomisd -0x10(%rbp), %xmm0
jbe 0x8b028
movl -0x14(%rbp), %eax
addl $0xb0000, %eax          # imm = 0xB0000
movl $0x800, %ecx            # imm = 0x800
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36e20(%rip), %xmm0    # 0xc1e50
ucomisd -0x10(%rbp), %xmm0
jbe 0x8b04f
movl -0x14(%rbp), %eax
addl $0x180000, %eax         # imm = 0x180000
movl $0x1000, %ecx           # imm = 0x1000
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36e01(%rip), %xmm0    # 0xc1e58
ucomisd -0x10(%rbp), %xmm0
jbe 0x8b076
movl -0x14(%rbp), %eax
addl $0x340000, %eax         # imm = 0x340000
movl $0x2000, %ecx           # imm = 0x2000
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36df2(%rip), %xmm0    # 0xc1e70
ucomisd -0x10(%rbp), %xmm0
jbe 0x8b09d
movl -0x14(%rbp), %eax
addl $0x700000, %eax         # imm = 0x700000
movl $0x4000, %ecx           # imm = 0x4000
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36dd3(%rip), %xmm0    # 0xc1e78
ucomisd -0x10(%rbp), %xmm0
jbe 0x8b0c4
movl -0x14(%rbp), %eax
addl $0xf00000, %eax         # imm = 0xF00000
movl $0x8000, %ecx           # imm = 0x8000
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36db4(%rip), %xmm0    # 0xc1e80
ucomisd -0x10(%rbp), %xmm0
jbe 0x8b0eb
movl -0x14(%rbp), %eax
addl $0x2000000, %eax        # imm = 0x2000000
movl $0x10000, %ecx          # imm = 0x10000
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36d95(%rip), %xmm0    # 0xc1e88
ucomisd -0x10(%rbp), %xmm0
jbe 0x8b10f
movl -0x14(%rbp), %eax
addl $0x4400000, %eax        # imm = 0x4400000
movl $0x20000, %ecx          # imm = 0x20000
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36d79(%rip), %xmm0    # 0xc1e90
ucomisd -0x10(%rbp), %xmm0
jbe 0x8b133
movl -0x14(%rbp), %eax
addl $0x9000000, %eax        # imm = 0x9000000
movl $0x40000, %ecx          # imm = 0x40000
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36d5d(%rip), %xmm0    # 0xc1e98
ucomisd -0x10(%rbp), %xmm0
jbe 0x8b157
movl -0x14(%rbp), %eax
addl $0x13000000, %eax       # imm = 0x13000000
movl $0x80000, %ecx          # imm = 0x80000
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movsd 0x36d41(%rip), %xmm0    # 0xc1ea0
ucomisd -0x10(%rbp), %xmm0
jbe 0x8b17b
movl -0x14(%rbp), %eax
addl $0x28000000, %eax       # imm = 0x28000000
movl $0x100000, %ecx         # imm = 0x100000
cltd
idivl %ecx
movl %eax, -0x4(%rbp)
jmp 0x8b182
movl $0x2c0, -0x4(%rbp)      # imm = 0x2C0
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)