// File: sundale[P]gcode/rs274ngc/interp_queue.cc
// Function: dequeue_canons(setup_struct*)
void dequeue_canons(setup_pointer settings) {

    if(debug_qc) printf("dequeueing: endpoint is now invalid\n");
    endpoint_valid = 0;

    if(qc().empty()) return;

    for(unsigned int i = 0; i<qc().size(); i++) {
        queued_canon &q = qc()[i];

        switch(q.type) {
        case QARC_FEED:
            if(debug_qc) printf("issuing arc feed lineno %d\n", q.data.arc_feed.line_number);
            ARC_FEED(q.data.arc_feed.line_number, 
                     latheorigin_z(settings, q.data.arc_feed.end1), 
                     latheorigin_x(settings, q.data.arc_feed.end2), 
                     latheorigin_z(settings, q.data.arc_feed.center1),
                     latheorigin_x(settings, q.data.arc_feed.center2), 
                     q.data.arc_feed.turn, 
                     q.data.arc_feed.end3,
                     q.data.arc_feed.a, q.data.arc_feed.b, q.data.arc_feed.c, 
                     q.data.arc_feed.u, q.data.arc_feed.v, q.data.arc_feed.w);
            break;
        case QSTRAIGHT_FEED:
            if(debug_qc) printf("issuing straight feed lineno %d\n", q.data.straight_feed.line_number);
            STRAIGHT_FEED(q.data.straight_feed.line_number, 
                          latheorigin_x(settings, q.data.straight_feed.x), 
                          q.data.straight_feed.y, 
                          latheorigin_z(settings, q.data.straight_feed.z),
                          q.data.straight_feed.a, q.data.straight_feed.b, q.data.straight_feed.c, 
                          q.data.straight_feed.u, q.data.straight_feed.v, q.data.straight_feed.w);
            break;
        case QSTRAIGHT_TRAVERSE:
            if(debug_qc) printf("issuing straight traverse lineno %d\n", q.data.straight_traverse.line_number);
            STRAIGHT_TRAVERSE(q.data.straight_traverse.line_number, 
                              latheorigin_x(settings, q.data.straight_traverse.x),
                              q.data.straight_traverse.y,
                              latheorigin_z(settings, q.data.straight_traverse.z),
                              q.data.straight_traverse.a, q.data.straight_traverse.b, q.data.straight_traverse.c, 
                              q.data.straight_traverse.u, q.data.straight_traverse.v, q.data.straight_traverse.w);
            break;
        case QSET_FEED_RATE:
            if(debug_qc) printf("issuing set feed rate\n");
            SET_FEED_RATE(q.data.set_feed_rate.feed);
            break;
        case QDWELL:
            if(debug_qc) printf("issuing dwell\n");
            DWELL(q.data.dwell.time);
            break;
        case QSET_FEED_MODE:
            if(debug_qc) printf("issuing set feed mode\n");
            SET_FEED_MODE(q.data.set_feed_mode.mode);
            break;
        case QMIST_ON:
            if(debug_qc) printf("issuing mist on\n");
            MIST_ON();
            break;
        case QMIST_OFF:
            if(debug_qc) printf("issuing mist off\n");
            MIST_OFF();
            break;
        case QFLOOD_ON:
            if(debug_qc) printf("issuing flood on\n");
            FLOOD_ON();
            break;
        case QFLOOD_OFF:
            if(debug_qc) printf("issuing flood off\n");
            FLOOD_OFF();
            break;
        case QSTART_SPINDLE_CLOCKWISE:
            if(debug_qc) printf("issuing spindle clockwise\n");
            START_SPINDLE_CLOCKWISE();
            break;
        case QSTART_SPINDLE_COUNTERCLOCKWISE:
            if(debug_qc) printf("issuing spindle counterclockwise\n");
            START_SPINDLE_COUNTERCLOCKWISE();
            break;
        case QSTOP_SPINDLE_TURNING:
            if(debug_qc) printf("issuing stop spindle\n");
            STOP_SPINDLE_TURNING();
            break;
        case QSET_SPINDLE_MODE:
            if(debug_qc) printf("issuing set spindle mode\n");
            SET_SPINDLE_MODE(q.data.set_spindle_mode.mode);
            break;
        case QSET_SPINDLE_SPEED:
            if(debug_qc) printf("issuing set spindle speed\n");
            SET_SPINDLE_SPEED(q.data.set_spindle_speed.speed);
            break;
        case QCOMMENT:
            if(debug_qc) printf("issuing comment\n");
            COMMENT(q.data.comment.comment);
            free(q.data.comment.comment);
            break;
        case QM_USER_COMMAND:
            if(debug_qc) printf("issuing mcommand\n");
            {int index=q.data.mcommand.index;
              (*(USER_DEFINED_FUNCTION[index - 100])) (index -100,
                                                    q.data.mcommand.p_number,
                                                    q.data.mcommand.q_number);
            }
            break;
        }
    }
    qc().clear();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
cmpl $0x0, 0x715ba(%rip)     # 0xa6a10
je 0x35466
leaq 0x464ae(%rip), %rdi     # 0x7b90d
movb $0x0, %al
callq 0x10060
movl $0x0, 0x715a4(%rip)     # 0xa6a14
callq 0x103d0
movq %rax, %rdi
callq 0x11220
testb $0x1, %al
jne 0x35483
jmp 0x35488
jmp 0x359ae
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq %rax, -0x28(%rbp)
callq 0x103d0
movq %rax, %rdi
callq 0x12150
movq %rax, %rcx
movq -0x28(%rbp), %rax
cmpq %rcx, %rax
jae 0x359a1
callq 0x103d0
movq %rax, %rdi
movl -0xc(%rbp), %eax
movl %eax, %esi
callq 0x122b0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x30(%rbp)
subq $0x10, %rax
ja 0x35991
movq -0x30(%rbp), %rax
leaq 0x4600c(%rip), %rcx     # 0x7b4f4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, 0x71518(%rip)     # 0xa6a10
je 0x3550f
movq -0x18(%rbp), %rax
movl 0x8(%rax), %esi
leaq 0x4642a(%rip), %rdi     # 0x7b932
movb $0x0, %al
callq 0x10060
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movsd 0x18(%rax), %xmm0
callq 0x359c0
movsd %xmm0, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movsd 0x20(%rax), %xmm0
callq 0x35a60
movsd %xmm0, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movsd 0x28(%rax), %xmm0
callq 0x359c0
movsd %xmm0, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movsd 0x30(%rax), %xmm0
callq 0x35a60
movl -0x4c(%rbp), %edi
movsd -0x48(%rbp), %xmm1
movsd -0x40(%rbp), %xmm2
movaps %xmm0, %xmm3
movsd -0x38(%rbp), %xmm0
movq -0x18(%rbp), %rax
movl 0x38(%rax), %esi
movq -0x18(%rbp), %rax
movsd 0x40(%rax), %xmm4
movq -0x18(%rbp), %rax
movsd 0x48(%rax), %xmm5
movq -0x18(%rbp), %rax
movsd 0x50(%rax), %xmm6
movq -0x18(%rbp), %rax
movsd 0x58(%rax), %xmm7
movq -0x18(%rbp), %rax
movsd 0x60(%rax), %xmm10
movq -0x18(%rbp), %rax
movsd 0x68(%rax), %xmm9
movq -0x18(%rbp), %rax
movsd 0x70(%rax), %xmm8
movsd %xmm10, (%rsp)
movsd %xmm9, 0x8(%rsp)
movsd %xmm8, 0x10(%rsp)
callq 0x12120
jmp 0x35991
cmpl $0x0, 0x7141d(%rip)     # 0xa6a10
je 0x3560a
movq -0x18(%rbp), %rax
movl 0x8(%rax), %esi
leaq 0x4634b(%rip), %rdi     # 0x7b94e
movb $0x0, %al
callq 0x10060
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movsd 0x28(%rax), %xmm0
callq 0x35a60
movsd %xmm0, -0x58(%rbp)
movq -0x18(%rbp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movsd 0x38(%rax), %xmm0
callq 0x359c0
movl -0x64(%rbp), %edi
movsd -0x60(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x58(%rbp), %xmm0
movq -0x18(%rbp), %rax
movsd 0x40(%rax), %xmm3
movq -0x18(%rbp), %rax
movsd 0x48(%rax), %xmm4
movq -0x18(%rbp), %rax
movsd 0x50(%rax), %xmm5
movq -0x18(%rbp), %rax
movsd 0x58(%rax), %xmm6
movq -0x18(%rbp), %rax
movsd 0x60(%rax), %xmm7
movq -0x18(%rbp), %rax
movsd 0x68(%rax), %xmm8
movsd %xmm8, (%rsp)
callq 0x10ac0
jmp 0x35991
cmpl $0x0, 0x71367(%rip)     # 0xa6a10
je 0x356c0
movq -0x18(%rbp), %rax
movl 0x8(%rax), %esi
leaq 0x462b6(%rip), %rdi     # 0x7b96f
movb $0x0, %al
callq 0x10060
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x7c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movsd 0x28(%rax), %xmm0
callq 0x35a60
movsd %xmm0, -0x70(%rbp)
movq -0x18(%rbp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, -0x78(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movsd 0x38(%rax), %xmm0
callq 0x359c0
movl -0x7c(%rbp), %edi
movsd -0x78(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x70(%rbp), %xmm0
movq -0x18(%rbp), %rax
movsd 0x40(%rax), %xmm3
movq -0x18(%rbp), %rax
movsd 0x48(%rax), %xmm4
movq -0x18(%rbp), %rax
movsd 0x50(%rax), %xmm5
movq -0x18(%rbp), %rax
movsd 0x58(%rax), %xmm6
movq -0x18(%rbp), %rax
movsd 0x60(%rax), %xmm7
movq -0x18(%rbp), %rax
movsd 0x68(%rax), %xmm8
movsd %xmm8, (%rsp)
callq 0x10ef0
jmp 0x35991
cmpl $0x0, 0x712b1(%rip)     # 0xa6a10
je 0x3576f
leaq 0x4622c(%rip), %rdi     # 0x7b994
movb $0x0, %al
callq 0x10060
movq -0x18(%rbp), %rax
movsd 0x8(%rax), %xmm0
callq 0x11290
jmp 0x35991
cmpl $0x0, 0x71287(%rip)     # 0xa6a10
je 0x35799
leaq 0x46219(%rip), %rdi     # 0x7b9ab
movb $0x0, %al
callq 0x10060
movq -0x18(%rbp), %rax
movsd 0x8(%rax), %xmm0
callq 0x10040
jmp 0x35991
cmpl $0x0, 0x7125d(%rip)     # 0xa6a10
je 0x357c3
leaq 0x461fe(%rip), %rdi     # 0x7b9ba
movb $0x0, %al
callq 0x10060
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x11d10
jmp 0x35991
cmpl $0x0, 0x71235(%rip)     # 0xa6a10
je 0x357eb
leaq 0x461ed(%rip), %rdi     # 0x7b9d1
movb $0x0, %al
callq 0x10060
callq 0x11d90
jmp 0x35991
cmpl $0x0, 0x71214(%rip)     # 0xa6a10
je 0x3580c
leaq 0x461dd(%rip), %rdi     # 0x7b9e2
movb $0x0, %al
callq 0x10060
callq 0x10190
jmp 0x35991
cmpl $0x0, 0x711f3(%rip)     # 0xa6a10
je 0x3582d
leaq 0x461ce(%rip), %rdi     # 0x7b9f4
movb $0x0, %al
callq 0x10060
callq 0x10d40
jmp 0x35991
cmpl $0x0, 0x711d2(%rip)     # 0xa6a10
je 0x3584e
leaq 0x461bf(%rip), %rdi     # 0x7ba06
movb $0x0, %al
callq 0x10060
callq 0x10b90
jmp 0x35991
cmpl $0x0, 0x711b1(%rip)     # 0xa6a10
je 0x3586f
leaq 0x461b1(%rip), %rdi     # 0x7ba19
movb $0x0, %al
callq 0x10060
callq 0x112f0
jmp 0x35991
cmpl $0x0, 0x71190(%rip)     # 0xa6a10
je 0x35890
leaq 0x461ab(%rip), %rdi     # 0x7ba34
movb $0x0, %al
callq 0x10060
callq 0x118b0
jmp 0x35991
cmpl $0x0, 0x7116f(%rip)     # 0xa6a10
je 0x358b1
leaq 0x461ac(%rip), %rdi     # 0x7ba56
movb $0x0, %al
callq 0x10060
callq 0x11300
jmp 0x35991
cmpl $0x0, 0x7114e(%rip)     # 0xa6a10
je 0x358d2
leaq 0x461a1(%rip), %rdi     # 0x7ba6c
movb $0x0, %al
callq 0x10060
movq -0x18(%rbp), %rax
movsd 0x8(%rax), %xmm0
callq 0x112c0
jmp 0x35991
cmpl $0x0, 0x71124(%rip)     # 0xa6a10
je 0x358fc
leaq 0x46191(%rip), %rdi     # 0x7ba86
movb $0x0, %al
callq 0x10060
movq -0x18(%rbp), %rax
movsd 0x8(%rax), %xmm0
callq 0x10790
jmp 0x35991
cmpl $0x0, 0x710fa(%rip)     # 0xa6a10
je 0x35926
leaq 0x46182(%rip), %rdi     # 0x7baa1
movb $0x0, %al
callq 0x10060
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x10d60
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x114b0
jmp 0x35991
cmpl $0x0, 0x710c7(%rip)     # 0xa6a10
je 0x35959
leaq 0x46160(%rip), %rdi     # 0x7bab2
movb $0x0, %al
callq 0x10060
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
subl $0x64, %eax
movslq %eax, %rcx
movq 0x51665(%rip), %rax     # 0x86fd8
movq (%rax,%rcx,8), %rax
movl -0x1c(%rbp), %edi
subl $0x64, %edi
movq -0x18(%rbp), %rcx
movsd 0x10(%rcx), %xmm0
movq -0x18(%rbp), %rcx
movsd 0x18(%rcx), %xmm1
callq *%rax
jmp 0x35993
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3548f
callq 0x103d0
movq %rax, %rdi
callq 0x118d0
addq $0xa0, %rsp
popq %rbp
retq
nopw (%rax,%rax)