// File: micahcc[P]polygon_skeleton/./debug.h
// Function: void draw_state<std::set<Intersection, BeachCompare, std::allocator<Intersection>>, CircleQueue>(std::set<Intersection, BeachCompare, std::allocator<Intersection>> const&, CircleQueue const&, double)
void draw_state(const IntersectionContainer& intersections,
        const EventContainer& events, double sweep_y)
{
    svg::Dimensions dimensions(1200, 1200);

    static int count = 0;
    std::ostringstream oss;
    oss << "state_" << std::setfill('0') << std::setw(5) << count++ << ".svg";
    svg::Document doc(oss.str(), svg::Layout(dimensions, svg::Layout::BottomLeft));

    if(intersections.empty())
        return;

    auto it = intersections.end();
    it--;

    double min_x = std::numeric_limits<double>::infinity();
    double max_x = -std::numeric_limits<double>::infinity();
    for(const auto& curr_int : intersections) {
        if(!curr_int.pt_right)
            break;

        min_x = std::min<double>(min_x, curr_int.pt_right->x) - 100;
        max_x = std::max<double>(max_x, curr_int.pt_right->x) + 100;
    }

    for(const auto& curr_int : intersections) {
        if(!curr_int.pt_right)
            break;

       draw_parabola(doc, min_x, max_x, *curr_int.pt_right, sweep_y);
    }

    for(auto it = events.cbegin(); it != events.cend(); ++it) {
        doc << svg::Circle(svg::Point(it->circle.center.x, it->circle.center.y),
                5, svg::Fill(svg::Color::Red));

        doc << svg::Circle(svg::Point(it->circle.center.x, it->circle.center.y),
                2*it->circle.radius, svg::Fill(svg::Color::Transparent),
                svg::Stroke(1, svg::Color::Red));
    }

    doc.save();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x580, %rsp            # imm = 0x580
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
leaq -0x28(%rbp), %rdi
movsd 0xae74(%rip), %xmm1     # 0x23008
movaps %xmm1, %xmm0
callq 0x4250
leaq -0x1a0(%rbp), %rdi
movq %rdi, -0x4f0(%rbp)
callq 0x3300
movq -0x4f0(%rbp), %rdi
leaq 0xbb46(%rip), %rsi      # 0x23d03
callq 0x3250
movq %rax, -0x4e8(%rbp)
jmp 0x181cb
movl $0x30, %edi
callq 0x18980
movb %al, -0x4f1(%rbp)
jmp 0x181dd
movq -0x4e8(%rbp), %rdi
movb -0x4f1(%rbp), %al
movb %al, -0x1ad(%rbp)
movzbl -0x1ad(%rbp), %esi
callq 0x3390
movq %rax, -0x500(%rbp)
jmp 0x18205
movl $0x5, %edi
callq 0x189a0
movl %eax, -0x504(%rbp)
jmp 0x18217
movq -0x500(%rbp), %rdi
movl -0x504(%rbp), %eax
movl %eax, -0x1b4(%rbp)
movl -0x1b4(%rbp), %esi
callq 0x32c0
movq %rax, -0x510(%rbp)
jmp 0x1823e
movq -0x510(%rbp), %rdi
movl 0x1b009(%rip), %esi     # 0x33254
movl %esi, %eax
incl %eax
movl %eax, 0x1afff(%rip)     # 0x33254
callq 0x33f0
movq %rax, -0x518(%rbp)
jmp 0x18263
movq -0x518(%rbp), %rdi
leaq 0xae01(%rip), %rsi      # 0x23072
callq 0x3250
jmp 0x18278
leaq -0x248(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x3270
jmp 0x1828d
leaq -0x288(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x4280
jmp 0x182a1
leaq -0x278(%rbp), %rdi
leaq -0x28(%rbp), %rsi
movl $0x1, %edx
movsd 0xad57(%rip), %xmm0     # 0x23010
leaq -0x288(%rbp), %rcx
callq 0x42b0
jmp 0x182c7
movups -0x278(%rbp), %xmm0
movups -0x268(%rbp), %xmm1
movups -0x258(%rbp), %xmm2
movq %rsp, %rax
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
leaq -0x228(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x4310
jmp 0x182ff
leaq -0x248(%rbp), %rdi
callq 0x3160
movq -0x8(%rbp), %rdi
callq 0x11550
testb $0x1, %al
jne 0x1831a
jmp 0x18363
movl $0x1, -0x28c(%rbp)
jmp 0x18938
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x18965
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x3160
jmp 0x18965
movq -0x8(%rbp), %rdi
callq 0x10300
movq %rax, -0x298(%rbp)
leaq -0x298(%rbp), %rdi
xorl %esi, %esi
callq 0x10a50
movq %rax, -0x2a0(%rbp)
callq 0x150d0
movsd %xmm0, -0x2a8(%rbp)
callq 0x150d0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x2b0(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2b8(%rbp)
movq -0x2b8(%rbp), %rdi
callq 0x102a0
movq %rax, -0x2c0(%rbp)
movq -0x2b8(%rbp), %rdi
callq 0x10300
movq %rax, -0x2c8(%rbp)
leaq -0x2c0(%rbp), %rdi
leaq -0x2c8(%rbp), %rsi
callq 0x102d0
testb $0x1, %al
jne 0x18406
jmp 0x184c5
leaq -0x2c0(%rbp), %rdi
callq 0x10970
movq %rax, -0x2d0(%rbp)
movq -0x2d0(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x1842c
jmp 0x184c5
movq -0x2d0(%rbp), %rax
movq 0x8(%rax), %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x2d8(%rbp)
leaq -0x2a8(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
callq 0x11790
movsd (%rax), %xmm0
movsd 0xae0a(%rip), %xmm1     # 0x23270
subsd %xmm1, %xmm0
movsd %xmm0, -0x2a8(%rbp)
movq -0x2d0(%rbp), %rax
movq 0x8(%rax), %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x2e0(%rbp)
leaq -0x2b0(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x117d0
movsd 0xadc8(%rip), %xmm0     # 0x23270
addsd (%rax), %xmm0
movsd %xmm0, -0x2b0(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x109c0
jmp 0x183ea
movq -0x8(%rbp), %rax
movq %rax, -0x2e8(%rbp)
movq -0x2e8(%rbp), %rdi
callq 0x102a0
movq %rax, -0x2f0(%rbp)
movq -0x2e8(%rbp), %rdi
callq 0x10300
movq %rax, -0x2f8(%rbp)
leaq -0x2f0(%rbp), %rdi
leaq -0x2f8(%rbp), %rsi
callq 0x102d0
testb $0x1, %al
jne 0x1850f
jmp 0x18587
leaq -0x2f0(%rbp), %rdi
callq 0x10970
movq %rax, -0x300(%rbp)
movq -0x300(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x18532
jmp 0x18587
movsd -0x2a8(%rbp), %xmm0
movsd -0x2b0(%rbp), %xmm1
movq -0x300(%rbp), %rax
movq 0x8(%rax), %rsi
movsd -0x18(%rbp), %xmm2
leaq -0x228(%rbp), %rdi
callq 0x189c0
jmp 0x18560
jmp 0x18562
leaq -0x2f0(%rbp), %rdi
callq 0x109c0
jmp 0x184f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x18959
movq -0x10(%rbp), %rdi
callq 0x19210
movq %rax, -0x520(%rbp)
jmp 0x18599
movq -0x520(%rbp), %rax
movq %rax, -0x308(%rbp)
movq -0x10(%rbp), %rdi
callq 0x19240
movq %rax, -0x528(%rbp)
jmp 0x185b9
movq -0x528(%rbp), %rax
movq %rax, -0x310(%rbp)
leaq -0x308(%rbp), %rdi
leaq -0x310(%rbp), %rsi
callq 0x11c30
testb $0x1, %al
jne 0x185e3
jmp 0x18920
leaq -0x308(%rbp), %rdi
movq %rdi, -0x538(%rbp)
callq 0x12ca0
movq -0x538(%rbp), %rdi
movss 0x20(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x530(%rbp)
callq 0x12ca0
movsd -0x530(%rbp), %xmm0
movss 0x24(%rax), %xmm1
cvtss2sd %xmm1, %xmm1
leaq -0x390(%rbp), %rdi
callq 0x4280
jmp 0x18632
leaq -0x3b0(%rbp), %rdi
movl $0xb, %esi
callq 0x44b0
jmp 0x18645
leaq -0x3f8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x4510
jmp 0x18658
leaq -0x3e0(%rbp), %rdi
movsd 0xa9b9(%rip), %xmm0     # 0x23020
leaq -0x3f8(%rbp), %rsi
xorl %edx, %edx
callq 0x4720
jmp 0x18677
leaq -0x380(%rbp), %rdi
leaq -0x390(%rbp), %rsi
movsd 0xa99b(%rip), %xmm0     # 0x23028
leaq -0x3b0(%rbp), %rdx
leaq -0x3e0(%rbp), %rcx
callq 0x4790
jmp 0x186a2
leaq -0x228(%rbp), %rdi
leaq -0x380(%rbp), %rsi
callq 0x4430
jmp 0x186b7
leaq -0x380(%rbp), %rdi
callq 0x4810
leaq -0x3e0(%rbp), %rdi
callq 0x4830
leaq -0x3f8(%rbp), %rdi
callq 0x4860
leaq -0x3b0(%rbp), %rdi
callq 0x4880
leaq -0x308(%rbp), %rdi
movq %rdi, -0x548(%rbp)
callq 0x12ca0
movq -0x548(%rbp), %rdi
movss 0x20(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x540(%rbp)
callq 0x12ca0
movsd -0x540(%rbp), %xmm0
movss 0x24(%rax), %xmm1
cvtss2sd %xmm1, %xmm1
leaq -0x478(%rbp), %rdi
callq 0x4280
jmp 0x18736
leaq -0x308(%rbp), %rdi
callq 0x12ca0
movss 0x28(%rax), %xmm0
addss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x550(%rbp)
leaq -0x498(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x44b0
jmp 0x1876a
leaq -0x4e0(%rbp), %rdi
movl $0xb, %esi
callq 0x4510
jmp 0x1877d
leaq -0x4c8(%rbp), %rdi
movsd 0xa884(%rip), %xmm0     # 0x23010
leaq -0x4e0(%rbp), %rsi
xorl %edx, %edx
callq 0x4720
jmp 0x1879c
movsd -0x550(%rbp), %xmm0
leaq -0x468(%rbp), %rdi
leaq -0x478(%rbp), %rsi
leaq -0x498(%rbp), %rdx
leaq -0x4c8(%rbp), %rcx
callq 0x4790
jmp 0x187c7
leaq -0x228(%rbp), %rdi
leaq -0x468(%rbp), %rsi
callq 0x4430
jmp 0x187dc
leaq -0x468(%rbp), %rdi
callq 0x4810
leaq -0x4c8(%rbp), %rdi
callq 0x4830
leaq -0x4e0(%rbp), %rdi
callq 0x4860
leaq -0x498(%rbp), %rdi
callq 0x4880
leaq -0x308(%rbp), %rdi
callq 0x11c80
jmp 0x185a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x1888f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x18883
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x18877
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
leaq -0x380(%rbp), %rdi
callq 0x4810
leaq -0x3e0(%rbp), %rdi
callq 0x4830
leaq -0x3f8(%rbp), %rdi
callq 0x4860
leaq -0x3b0(%rbp), %rdi
callq 0x4880
jmp 0x18959
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x18912
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x18906
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x188fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
leaq -0x468(%rbp), %rdi
callq 0x4810
leaq -0x4c8(%rbp), %rdi
callq 0x4830
leaq -0x4e0(%rbp), %rdi
callq 0x4860
leaq -0x498(%rbp), %rdi
callq 0x4880
jmp 0x18959
leaq -0x228(%rbp), %rdi
callq 0x4b80
jmp 0x1892e
movl $0x0, -0x28c(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x4cb0
leaq -0x1a0(%rbp), %rdi
callq 0x3070
addq $0x580, %rsp            # imm = 0x580
popq %rbp
retq
leaq -0x228(%rbp), %rdi
callq 0x4cb0
leaq -0x1a0(%rbp), %rdi
callq 0x3070
movq -0x1a8(%rbp), %rdi
callq 0x3400
nopl (%rax)