// File: schuyler[P]quickfix/include/quickfix/particle_filter.h
// Function: ParticleFilter<float, 2>::perturb(float)
void ParticleFilter<F,D>::perturb(F dT) {
    // FIXME: this only works in 2D for now
    // z0 = sqrt(-2.0 * log(u1)) * cos(two_pi * u2);
    Array<F, Dynamic, 1> u1 = Array<F, Dynamic, 1>::Random(N, 1) * 0.5 + 0.5,
                         u2 = Array<F, Dynamic, 1>::Random(N, 1) * 0.5 + 0.5;
    Array<F, Dynamic, 1> dx = (u1.log() * -2.).sqrt() * (u2 * 2 * M_PI).cos() * dispersion * dT,
                         dy = (u2.log() * -2.).sqrt() * (u1 * 2 * M_PI).sin() * dispersion * dT;
    Particles dP(N, D);
    dP << dx, dy;
    P = P + dP;
    // FIXME: clipping should happen here
    //P = P.cwiseMax(bound.row(0))
    //     .cwiseMin(bound.row(1));
}

// Assembly:
subq $0x958, %rsp            # imm = 0x958
movq %rdi, 0x950(%rsp)
movss %xmm0, 0x94c(%rsp)
movq 0x950(%rsp), %rax
movq %rax, 0x28(%rsp)
movslq 0x30(%rax), %rsi
leaq 0x8a8(%rsp), %rdi
movq %rdi, 0x8(%rsp)
movl $0x1, %edx
movq %rdx, 0x30(%rsp)
callq 0x2aff20
movq 0x8(%rsp), %rsi
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, 0x10(%rsp)
movq %rax, 0x8a0(%rsp)
leaq 0x8b8(%rsp), %rdi
movq %rdi, 0x18(%rsp)
leaq 0x8a0(%rsp), %rdx
callq 0x2ad6d0
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rsi
movq %rax, 0x898(%rsp)
leaq 0x8e8(%rsp), %rdi
movq %rdi, 0x20(%rsp)
leaq 0x898(%rsp), %rdx
callq 0x2b7fc0
movq 0x20(%rsp), %rsi
leaq 0x938(%rsp), %rdi
callq 0x29fc70
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rdx
movslq 0x30(%rax), %rsi
leaq 0x7f0(%rsp), %rdi
callq 0x2aff20
jmp 0x325476
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, 0x7d8(%rsp)
leaq 0x800(%rsp), %rdi
leaq 0x7f0(%rsp), %rsi
leaq 0x7d8(%rsp), %rdx
callq 0x2ad6d0
jmp 0x3254a7
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, 0x7d0(%rsp)
leaq 0x830(%rsp), %rdi
leaq 0x800(%rsp), %rsi
leaq 0x7d0(%rsp), %rdx
callq 0x2b7fc0
jmp 0x3254d8
leaq 0x880(%rsp), %rdi
leaq 0x830(%rsp), %rsi
callq 0x29fc70
jmp 0x3254ef
leaq 0x4f8(%rsp), %rdi
leaq 0x938(%rsp), %rsi
callq 0x2b29b0
jmp 0x325506
movabsq $-0x4000000000000000, %rax # imm = 0xC000000000000000
movq %rax, 0x4f0(%rsp)
leaq 0x508(%rsp), %rdi
leaq 0x4f8(%rsp), %rsi
leaq 0x4f0(%rsp), %rdx
callq 0x2b3d90
jmp 0x325537
leaq 0x538(%rsp), %rdi
leaq 0x508(%rsp), %rsi
callq 0x2a0cd0
jmp 0x32554e
movl $0x2, 0x43c(%rsp)
leaq 0x440(%rsp), %rdi
leaq 0x880(%rsp), %rsi
leaq 0x43c(%rsp), %rdx
callq 0x2afab0
jmp 0x325578
movabsq $0x400921fb54442d18, %rax # imm = 0x400921FB54442D18
movq %rax, 0x430(%rsp)
leaq 0x460(%rsp), %rdi
leaq 0x440(%rsp), %rsi
leaq 0x430(%rsp), %rdx
callq 0x296330
jmp 0x3255a9
leaq 0x4a0(%rsp), %rdi
leaq 0x460(%rsp), %rsi
callq 0x2abae0
jmp 0x3255c0
leaq 0x578(%rsp), %rdi
leaq 0x538(%rsp), %rsi
leaq 0x4a0(%rsp), %rdx
callq 0x2940a0
jmp 0x3255df
movq 0x28(%rsp), %rdx
addq $0x34, %rdx
leaq 0x618(%rsp), %rdi
leaq 0x578(%rsp), %rsi
callq 0x2a4b90
jmp 0x3255ff
leaq 0x6d8(%rsp), %rdi
leaq 0x618(%rsp), %rsi
leaq 0x94c(%rsp), %rdx
callq 0x29d610
jmp 0x32561e
leaq 0x7b8(%rsp), %rdi
leaq 0x6d8(%rsp), %rsi
callq 0x2b7b80
jmp 0x325635
leaq 0x158(%rsp), %rdi
leaq 0x880(%rsp), %rsi
callq 0x2b29b0
jmp 0x32564c
movabsq $-0x4000000000000000, %rax # imm = 0xC000000000000000
movq %rax, 0x150(%rsp)
leaq 0x168(%rsp), %rdi
leaq 0x158(%rsp), %rsi
leaq 0x150(%rsp), %rdx
callq 0x2b3d90
jmp 0x32567d
leaq 0x198(%rsp), %rdi
leaq 0x168(%rsp), %rsi
callq 0x2a0cd0
jmp 0x325694
movl $0x2, 0x9c(%rsp)
leaq 0xa0(%rsp), %rdi
leaq 0x938(%rsp), %rsi
leaq 0x9c(%rsp), %rdx
callq 0x2afab0
jmp 0x3256be
movabsq $0x400921fb54442d18, %rax # imm = 0x400921FB54442D18
movq %rax, 0x90(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0x296330
jmp 0x3256ef
leaq 0x100(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x2a71b0
jmp 0x325706
leaq 0x1d8(%rsp), %rdi
leaq 0x198(%rsp), %rsi
leaq 0x100(%rsp), %rdx
callq 0x292ef0
jmp 0x325725
movq 0x28(%rsp), %rdx
addq $0x34, %rdx
leaq 0x278(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
callq 0x2a9e20
jmp 0x325745
leaq 0x338(%rsp), %rdi
leaq 0x278(%rsp), %rsi
leaq 0x94c(%rsp), %rdx
callq 0x2a0f00
jmp 0x325764
leaq 0x418(%rsp), %rdi
leaq 0x338(%rsp), %rsi
callq 0x2b2aa0
jmp 0x32577b
movq 0x28(%rsp), %rsi
addq $0x30, %rsi
movl $0x2, 0x74(%rsp)
leaq 0x78(%rsp), %rdi
leaq 0x74(%rsp), %rdx
callq 0x2aa0c0
jmp 0x32579d
leaq 0x50(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0x7b8(%rsp), %rdx
callq 0x2b0dc0
jmp 0x3257b6
leaq 0x50(%rsp), %rdi
leaq 0x418(%rsp), %rsi
callq 0x2a9dc0
jmp 0x3257ca
leaq 0x50(%rsp), %rdi
callq 0x2b5350
movq 0x28(%rsp), %rsi
addq $0x8, %rsi
leaq 0x38(%rsp), %rdi
leaq 0x78(%rsp), %rdx
callq 0x295420
jmp 0x3257ee
movq 0x28(%rsp), %rdi
addq $0x8, %rdi
leaq 0x38(%rsp), %rsi
callq 0x291120
jmp 0x325803
leaq 0x78(%rsp), %rdi
callq 0x2a7f00
leaq 0x418(%rsp), %rdi
callq 0x2a7f20
leaq 0x7b8(%rsp), %rdi
callq 0x2a7f20
leaq 0x880(%rsp), %rdi
callq 0x2a7f20
leaq 0x938(%rsp), %rdi
callq 0x2a7f20
addq $0x958, %rsp            # imm = 0x958
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7e8(%rsp)
movl %eax, 0x7e4(%rsp)
jmp 0x32590c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7e8(%rsp)
movl %eax, 0x7e4(%rsp)
jmp 0x3258ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7e8(%rsp)
movl %eax, 0x7e4(%rsp)
jmp 0x3258f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7e8(%rsp)
movl %eax, 0x7e4(%rsp)
jmp 0x3258e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7e8(%rsp)
movl %eax, 0x7e4(%rsp)
jmp 0x3258db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7e8(%rsp)
movl %eax, 0x7e4(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x2b5350
leaq 0x78(%rsp), %rdi
callq 0x2a7f00
leaq 0x418(%rsp), %rdi
callq 0x2a7f20
leaq 0x7b8(%rsp), %rdi
callq 0x2a7f20
leaq 0x880(%rsp), %rdi
callq 0x2a7f20
leaq 0x938(%rsp), %rdi
callq 0x2a7f20
movq 0x7e8(%rsp), %rdi
callq 0x2b6590
nopw %cs:(%rax,%rax)