// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %r13
movq %r8, %r14
movq %rcx, %rbx
movl %edx, %r15d
movq %rsi, %r12
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rcx
movq 0x28(%rbp), %rdx
movq 0x20(%rbp), %rsi
movq 0x18(%rbp), %r8
movq 0x10(%rbp), %r9
movsd 0x600(%r12), %xmm0
movsd %xmm0, (%rbx)
movsd 0x608(%r12), %xmm0
movsd %xmm0, (%r14)
movsd 0x610(%r12), %xmm0
movsd %xmm0, (%r13)
movsd 0x8(%r12), %xmm0
movsd %xmm0, (%r9)
movsd 0x20(%r12), %xmm0
movsd %xmm0, (%r8)
movsd 0x38(%r12), %xmm0
movsd %xmm0, (%rsi)
movsd 0x50(%r12), %xmm0
movsd %xmm0, (%rdx)
movsd 0x68(%r12), %xmm0
movsd %xmm0, (%rcx)
movsd 0x80(%r12), %xmm0
movsd %xmm0, (%rax)
movsd 0x17b8(%r12), %xmm0
movq %rdi, -0x60(%rbp)
movq %rbx, %rsi
movq %r14, %rdx
callq 0xb1a0
movsd 0x17a0(%r12), %xmm0
addsd (%rbx), %xmm0
movq %rbx, -0x50(%rbp)
movsd %xmm0, (%rbx)
movsd 0x17a8(%r12), %xmm0
addsd (%r14), %xmm0
movq %r14, -0x58(%rbp)
movsd %xmm0, (%r14)
movsd 0x17b0(%r12), %xmm0
addsd (%r13), %xmm0
movq %r13, -0x30(%rbp)
movsd %xmm0, (%r13)
movsd 0x10(%r12), %xmm0
movq 0x10(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movsd 0x28(%r12), %xmm0
movq 0x18(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movsd 0x40(%r12), %xmm0
movq 0x20(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movsd 0x58(%r12), %xmm0
movq 0x28(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movsd 0x70(%r12), %xmm0
movq 0x30(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movsd 0x88(%r12), %xmm0
movq 0x38(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
shll $0x2, %r15d
leal (%r15,%r15,4), %eax
movslq %eax, %r15
movsd 0xba48(%r12,%r15,8), %xmm0
movsd %xmm0, -0x38(%rbp)
callq 0xa990
movq 0x1bb88(%rip), %r13     # 0x40f60
movl 0x1690(%r13), %eax
movsd 0xead9(%rip), %xmm1     # 0x33ec0
movsd %xmm1, -0x48(%rbp)
cmpl $0x3, %eax
je 0x253f9
movsd 0xeaa7(%rip), %xmm1     # 0x33ea0
movsd -0x38(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xeabe(%rip), %xmm0     # 0x33ec8
movsd %xmm0, -0x38(%rbp)
cmpl $0x1, %eax
je 0x25418
movapd %xmm1, %xmm0
divsd %xmm0, %xmm2
movq -0x50(%rbp), %r14
movsd (%r14), %xmm0
subsd %xmm2, %xmm0
movsd %xmm0, (%r14)
movsd 0xba50(%r12,%r15,8), %xmm0
movsd %xmm0, -0x40(%rbp)
callq 0xa990
movl 0x1690(%r13), %eax
movsd 0xea6f(%rip), %xmm1     # 0x33ec0
cmpl $0x3, %eax
movq -0x58(%rbp), %rbx
je 0x25462
movsd 0xea3e(%rip), %xmm1     # 0x33ea0
movsd -0x40(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xea55(%rip), %xmm0     # 0x33ec8
cmpl $0x1, %eax
je 0x2547c
movapd %xmm1, %xmm0
divsd %xmm0, %xmm2
movsd (%rbx), %xmm0
subsd %xmm2, %xmm0
movsd %xmm0, (%rbx)
movsd 0xba58(%r12,%r15,8), %xmm0
movsd %xmm0, -0x40(%rbp)
callq 0xa990
movl 0x1690(%r13), %eax
movsd 0xea11(%rip), %xmm1     # 0x33ec0
cmpl $0x3, %eax
je 0x254bc
movsd 0xe9e4(%rip), %xmm1     # 0x33ea0
movsd -0x40(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xe9fb(%rip), %xmm0     # 0x33ec8
cmpl $0x1, %eax
je 0x254d6
movapd %xmm1, %xmm0
divsd %xmm0, %xmm2
movq -0x30(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm2, %xmm0
movsd %xmm0, (%rax)
movsd 0xba60(%r12,%r15,8), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0xa990
movl 0x1690(%r13), %eax
movsd 0xe9b3(%rip), %xmm1     # 0x33ec0
cmpl $0x3, %eax
je 0x2551a
movsd 0xe986(%rip), %xmm1     # 0x33ea0
movsd -0x30(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xe99d(%rip), %xmm0     # 0x33ec8
cmpl $0x1, %eax
je 0x25534
movapd %xmm1, %xmm0
divsd %xmm0, %xmm2
movq 0x10(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm2, %xmm0
movsd %xmm0, (%rax)
movsd 0xba68(%r12,%r15,8), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0xa990
movl 0x1690(%r13), %eax
movsd 0xe955(%rip), %xmm1     # 0x33ec0
cmpl $0x3, %eax
je 0x25578
movsd 0xe928(%rip), %xmm1     # 0x33ea0
movsd -0x30(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xe93f(%rip), %xmm0     # 0x33ec8
cmpl $0x1, %eax
je 0x25592
movapd %xmm1, %xmm0
divsd %xmm0, %xmm2
movq 0x18(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm2, %xmm0
movsd %xmm0, (%rax)
movsd 0xba70(%r12,%r15,8), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0xa990
movl 0x1690(%r13), %eax
movsd 0xe8f7(%rip), %xmm1     # 0x33ec0
cmpl $0x3, %eax
je 0x255d6
movsd 0xe8ca(%rip), %xmm1     # 0x33ea0
movsd -0x30(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xe8e1(%rip), %xmm0     # 0x33ec8
cmpl $0x1, %eax
je 0x255f0
movapd %xmm1, %xmm0
divsd %xmm0, %xmm2
movq 0x20(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm2, %xmm0
movsd %xmm0, (%rax)
movsd 0xba78(%r12,%r15,8), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0xa990
movl 0x1690(%r13), %eax
movsd 0xe899(%rip), %xmm1     # 0x33ec0
cmpl $0x3, %eax
je 0x25634
movsd 0xe86c(%rip), %xmm1     # 0x33ea0
movsd -0x30(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xe883(%rip), %xmm0     # 0x33ec8
cmpl $0x1, %eax
je 0x2564e
movapd %xmm1, %xmm0
divsd %xmm0, %xmm2
movq 0x28(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm2, %xmm0
movsd %xmm0, (%rax)
movsd 0xba80(%r12,%r15,8), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0xa990
movl 0x1690(%r13), %eax
movsd 0xe83b(%rip), %xmm1     # 0x33ec0
cmpl $0x3, %eax
je 0x25692
movsd 0xe80e(%rip), %xmm1     # 0x33ea0
movsd -0x30(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xe825(%rip), %xmm0     # 0x33ec8
cmpl $0x1, %eax
je 0x256ac
movapd %xmm1, %xmm0
divsd %xmm0, %xmm2
movq 0x30(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm2, %xmm0
movsd %xmm0, (%rax)
movsd 0xba88(%r12,%r15,8), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0xa990
movl 0x1690(%r13), %eax
cmpl $0x3, %eax
je 0x256ed
movsd 0xe7b8(%rip), %xmm1     # 0x33ea0
movsd %xmm1, -0x48(%rbp)
cmpl $0x1, %eax
je 0x256fc
movsd -0x48(%rbp), %xmm1
movsd %xmm1, -0x38(%rbp)
movsd -0x30(%rbp), %xmm1
divsd %xmm0, %xmm1
divsd -0x38(%rbp), %xmm1
movq 0x38(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movsd 0xba90(%r12,%r15,8), %xmm0
xorps 0xe7e5(%rip), %xmm0     # 0x33f10
movq -0x60(%rbp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xb1a0
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop