// File: sundale[P]gcode/rs274ngc/interp_find.cc
// Function: Interp::find_current_in_system(setup_struct*, int, double*, double*, double*, double*, double*, double*, double*, double*, double*)
int Interp::find_current_in_system(setup_pointer s, int system,
                                   double *x, double *y, double *z,
                                   double *a, double *b, double *c,
                                   double *u, double *v, double *w) {
    double *p = s->parameters;

    *x = s->current_x;
    *y = s->current_y;
    *z = s->current_z;
    *a = s->AA_current;
    *b = s->BB_current;
    *c = s->CC_current;
    *u = s->u_current;
    *v = s->v_current;
    *w = s->w_current;

    rotate(x, y, s->rotation_xy);

    *x += s->origin_offset_x;
    *y += s->origin_offset_y;
    *z += s->origin_offset_z;
    *a += s->AA_origin_offset;
    *b += s->BB_origin_offset;
    *c += s->CC_origin_offset;
    *u += s->u_origin_offset;
    *v += s->v_origin_offset;
    *w += s->w_origin_offset;

    *x -= USER_TO_PROGRAM_LEN(p[5201 + system * 20]);
    *y -= USER_TO_PROGRAM_LEN(p[5202 + system * 20]);
    *z -= USER_TO_PROGRAM_LEN(p[5203 + system * 20]);
    *a -= USER_TO_PROGRAM_LEN(p[5204 + system * 20]);
    *b -= USER_TO_PROGRAM_LEN(p[5205 + system * 20]);
    *c -= USER_TO_PROGRAM_LEN(p[5206 + system * 20]);
    *u -= USER_TO_PROGRAM_LEN(p[5207 + system * 20]);
    *v -= USER_TO_PROGRAM_LEN(p[5208 + system * 20]);
    *w -= USER_TO_PROGRAM_LEN(p[5209 + system * 20]);

    rotate(x, y, -p[5210 + system * 20]);
    return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x50(%rbp)
movq -0x10(%rbp), %rax
addq $0x17c0, %rax           # imm = 0x17C0
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movsd 0x600(%rax), %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movsd 0x608(%rax), %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movsd 0x610(%rax), %xmm0
movq -0x30(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq 0x10(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movsd 0x20(%rax), %xmm0
movq 0x18(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movsd 0x38(%rax), %xmm0
movq 0x20(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movsd 0x50(%rax), %xmm0
movq 0x28(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movsd 0x68(%rax), %xmm0
movq 0x30(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movsd 0x80(%rax), %xmm0
movq 0x38(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x10(%rbp), %rax
movsd 0x17b8(%rax), %xmm0
callq 0x11cc0
movq -0x10(%rbp), %rax
movsd 0x17a0(%rax), %xmm0
movq -0x20(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movsd 0x17a8(%rax), %xmm0
movq -0x28(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movsd 0x17b0(%rax), %xmm0
movq -0x30(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movsd 0x10(%rax), %xmm0
movq 0x10(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movsd 0x28(%rax), %xmm0
movq 0x18(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movsd 0x40(%rax), %xmm0
movq 0x20(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movsd 0x58(%rax), %xmm0
movq 0x28(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movsd 0x70(%rax), %xmm0
movq 0x30(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movsd 0x88(%rax), %xmm0
movq 0x38(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq -0x38(%rbp), %rax
imull $0x14, -0x14(%rbp), %ecx
addl $0x1451, %ecx           # imm = 0x1451
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x48(%rbp)
callq 0x11030
movaps %xmm0, %xmm1
movsd -0x48(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movq 0x2da31(%rip), %rax     # 0x86f60
cmpl $0x1, 0x1690(%rax)
jne 0x59547
movsd 0x1f908(%rip), %xmm0    # 0x78e48
movsd %xmm0, -0x58(%rbp)
jmp 0x59587
movq 0x2da12(%rip), %rax     # 0x86f60
movl 0x1690(%rax), %eax
movsd 0x1f8e4(%rip), %xmm0    # 0x78e40
movsd 0x1f8ac(%rip), %xmm1    # 0x78e10
movsd %xmm1, -0x68(%rbp)
cmpl $0x3, %eax
movsd %xmm0, -0x60(%rbp)
je 0x5957d
movsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x40(%rbp), %xmm1
movsd -0x58(%rbp), %xmm0
divsd %xmm0, %xmm1
movq -0x20(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movq -0x38(%rbp), %rax
imull $0x14, -0x14(%rbp), %ecx
addl $0x1452, %ecx           # imm = 0x1452
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x78(%rbp)
callq 0x11030
movaps %xmm0, %xmm1
movsd -0x78(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movq 0x2d983(%rip), %rax     # 0x86f60
cmpl $0x1, 0x1690(%rax)
jne 0x595f5
movsd 0x1f85a(%rip), %xmm0    # 0x78e48
movsd %xmm0, -0x80(%rbp)
jmp 0x59644
movq 0x2d964(%rip), %rax     # 0x86f60
movl 0x1690(%rax), %eax
movsd 0x1f836(%rip), %xmm0    # 0x78e40
movsd 0x1f7fe(%rip), %xmm1    # 0x78e10
movsd %xmm1, -0x90(%rbp)
cmpl $0x3, %eax
movsd %xmm0, -0x88(%rbp)
je 0x59637
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x70(%rbp), %xmm1
movsd -0x80(%rbp), %xmm0
divsd %xmm0, %xmm1
movq -0x28(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movq -0x38(%rbp), %rax
imull $0x14, -0x14(%rbp), %ecx
addl $0x1453, %ecx           # imm = 0x1453
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0xa0(%rbp)
callq 0x11030
movaps %xmm0, %xmm1
movsd -0xa0(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movq 0x2d8bd(%rip), %rax     # 0x86f60
cmpl $0x1, 0x1690(%rax)
jne 0x596be
movsd 0x1f794(%rip), %xmm0    # 0x78e48
movsd %xmm0, -0xa8(%rbp)
jmp 0x59710
movq 0x2d89b(%rip), %rax     # 0x86f60
movl 0x1690(%rax), %eax
movsd 0x1f76d(%rip), %xmm0    # 0x78e40
movsd 0x1f735(%rip), %xmm1    # 0x78e10
movsd %xmm1, -0xb8(%rbp)
cmpl $0x3, %eax
movsd %xmm0, -0xb0(%rbp)
je 0x59700
movsd -0xb8(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0x98(%rbp), %xmm1
movsd -0xa8(%rbp), %xmm0
divsd %xmm0, %xmm1
movq -0x30(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movq -0x38(%rbp), %rax
imull $0x14, -0x14(%rbp), %ecx
addl $0x1454, %ecx           # imm = 0x1454
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0xc8(%rbp)
callq 0x11030
movaps %xmm0, %xmm1
movsd -0xc8(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movq 0x2d7eb(%rip), %rax     # 0x86f60
cmpl $0x1, 0x1690(%rax)
jne 0x59790
movsd 0x1f6c2(%rip), %xmm0    # 0x78e48
movsd %xmm0, -0xd0(%rbp)
jmp 0x597e2
movq 0x2d7c9(%rip), %rax     # 0x86f60
movl 0x1690(%rax), %eax
movsd 0x1f69b(%rip), %xmm0    # 0x78e40
movsd 0x1f663(%rip), %xmm1    # 0x78e10
movsd %xmm1, -0xe0(%rbp)
cmpl $0x3, %eax
movsd %xmm0, -0xd8(%rbp)
je 0x597d2
movsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0xd8(%rbp)
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0xd0(%rbp)
movsd -0xc0(%rbp), %xmm1
movsd -0xd0(%rbp), %xmm0
divsd %xmm0, %xmm1
movq 0x10(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movq -0x38(%rbp), %rax
imull $0x14, -0x14(%rbp), %ecx
addl $0x1455, %ecx           # imm = 0x1455
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0xf0(%rbp)
callq 0x11030
movaps %xmm0, %xmm1
movsd -0xf0(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0xe8(%rbp)
movq 0x2d719(%rip), %rax     # 0x86f60
cmpl $0x1, 0x1690(%rax)
jne 0x59862
movsd 0x1f5f0(%rip), %xmm0    # 0x78e48
movsd %xmm0, -0xf8(%rbp)
jmp 0x598b4
movq 0x2d6f7(%rip), %rax     # 0x86f60
movl 0x1690(%rax), %eax
movsd 0x1f5c9(%rip), %xmm0    # 0x78e40
movsd 0x1f591(%rip), %xmm1    # 0x78e10
movsd %xmm1, -0x108(%rbp)
cmpl $0x3, %eax
movsd %xmm0, -0x100(%rbp)
je 0x598a4
movsd -0x108(%rbp), %xmm0
movsd %xmm0, -0x100(%rbp)
movsd -0x100(%rbp), %xmm0
movsd %xmm0, -0xf8(%rbp)
movsd -0xe8(%rbp), %xmm1
movsd -0xf8(%rbp), %xmm0
divsd %xmm0, %xmm1
movq 0x18(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movq -0x38(%rbp), %rax
imull $0x14, -0x14(%rbp), %ecx
addl $0x1456, %ecx           # imm = 0x1456
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x118(%rbp)
callq 0x11030
movaps %xmm0, %xmm1
movsd -0x118(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x110(%rbp)
movq 0x2d647(%rip), %rax     # 0x86f60
cmpl $0x1, 0x1690(%rax)
jne 0x59934
movsd 0x1f51e(%rip), %xmm0    # 0x78e48
movsd %xmm0, -0x120(%rbp)
jmp 0x59986
movq 0x2d625(%rip), %rax     # 0x86f60
movl 0x1690(%rax), %eax
movsd 0x1f4f7(%rip), %xmm0    # 0x78e40
movsd 0x1f4bf(%rip), %xmm1    # 0x78e10
movsd %xmm1, -0x130(%rbp)
cmpl $0x3, %eax
movsd %xmm0, -0x128(%rbp)
je 0x59976
movsd -0x130(%rbp), %xmm0
movsd %xmm0, -0x128(%rbp)
movsd -0x128(%rbp), %xmm0
movsd %xmm0, -0x120(%rbp)
movsd -0x110(%rbp), %xmm1
movsd -0x120(%rbp), %xmm0
divsd %xmm0, %xmm1
movq 0x20(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movq -0x38(%rbp), %rax
imull $0x14, -0x14(%rbp), %ecx
addl $0x1457, %ecx           # imm = 0x1457
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x140(%rbp)
callq 0x11030
movaps %xmm0, %xmm1
movsd -0x140(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x138(%rbp)
movq 0x2d575(%rip), %rax     # 0x86f60
cmpl $0x1, 0x1690(%rax)
jne 0x59a06
movsd 0x1f44c(%rip), %xmm0    # 0x78e48
movsd %xmm0, -0x148(%rbp)
jmp 0x59a58
movq 0x2d553(%rip), %rax     # 0x86f60
movl 0x1690(%rax), %eax
movsd 0x1f425(%rip), %xmm0    # 0x78e40
movsd 0x1f3ed(%rip), %xmm1    # 0x78e10
movsd %xmm1, -0x158(%rbp)
cmpl $0x3, %eax
movsd %xmm0, -0x150(%rbp)
je 0x59a48
movsd -0x158(%rbp), %xmm0
movsd %xmm0, -0x150(%rbp)
movsd -0x150(%rbp), %xmm0
movsd %xmm0, -0x148(%rbp)
movsd -0x138(%rbp), %xmm1
movsd -0x148(%rbp), %xmm0
divsd %xmm0, %xmm1
movq 0x28(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movq -0x38(%rbp), %rax
imull $0x14, -0x14(%rbp), %ecx
addl $0x1458, %ecx           # imm = 0x1458
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x168(%rbp)
callq 0x11030
movaps %xmm0, %xmm1
movsd -0x168(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x160(%rbp)
movq 0x2d4a3(%rip), %rax     # 0x86f60
cmpl $0x1, 0x1690(%rax)
jne 0x59ad8
movsd 0x1f37a(%rip), %xmm0    # 0x78e48
movsd %xmm0, -0x170(%rbp)
jmp 0x59b2a
movq 0x2d481(%rip), %rax     # 0x86f60
movl 0x1690(%rax), %eax
movsd 0x1f353(%rip), %xmm0    # 0x78e40
movsd 0x1f31b(%rip), %xmm1    # 0x78e10
movsd %xmm1, -0x180(%rbp)
cmpl $0x3, %eax
movsd %xmm0, -0x178(%rbp)
je 0x59b1a
movsd -0x180(%rbp), %xmm0
movsd %xmm0, -0x178(%rbp)
movsd -0x178(%rbp), %xmm0
movsd %xmm0, -0x170(%rbp)
movsd -0x160(%rbp), %xmm1
movsd -0x170(%rbp), %xmm0
divsd %xmm0, %xmm1
movq 0x30(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movq -0x38(%rbp), %rax
imull $0x14, -0x14(%rbp), %ecx
addl $0x1459, %ecx           # imm = 0x1459
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x190(%rbp)
callq 0x11030
movaps %xmm0, %xmm1
movsd -0x190(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x188(%rbp)
movq 0x2d3d1(%rip), %rax     # 0x86f60
cmpl $0x1, 0x1690(%rax)
jne 0x59baa
movsd 0x1f2a8(%rip), %xmm0    # 0x78e48
movsd %xmm0, -0x198(%rbp)
jmp 0x59bfc
movq 0x2d3af(%rip), %rax     # 0x86f60
movl 0x1690(%rax), %eax
movsd 0x1f281(%rip), %xmm0    # 0x78e40
movsd 0x1f249(%rip), %xmm1    # 0x78e10
movsd %xmm1, -0x1a8(%rbp)
cmpl $0x3, %eax
movsd %xmm0, -0x1a0(%rbp)
je 0x59bec
movsd -0x1a8(%rbp), %xmm0
movsd %xmm0, -0x1a0(%rbp)
movsd -0x1a0(%rbp), %xmm0
movsd %xmm0, -0x198(%rbp)
movq -0x50(%rbp), %rdi
movsd -0x188(%rbp), %xmm1
movsd -0x198(%rbp), %xmm0
divsd %xmm0, %xmm1
movq 0x38(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x38(%rbp), %rax
imull $0x14, -0x14(%rbp), %ecx
addl $0x145a, %ecx           # imm = 0x145A
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
callq 0x11cc0
xorl %eax, %eax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
nopl (%rax)