// File: /workspace/github_cpp_makefile_star2_O1/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 0x1bbee(%rip), %r13     # 0x43f60
movl 0x1690(%r13), %eax
movsd 0xeb3f(%rip), %xmm1     # 0x36ec0
movsd %xmm1, -0x48(%rbp)
cmpl $0x3, %eax
je 0x28393
movsd 0xeb0d(%rip), %xmm1     # 0x36ea0
movsd -0x38(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xeb24(%rip), %xmm0     # 0x36ec8
movsd %xmm0, -0x38(%rbp)
cmpl $0x1, %eax
je 0x283b2
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 0xead5(%rip), %xmm1     # 0x36ec0
cmpl $0x3, %eax
movq -0x58(%rbp), %rbx
je 0x283fc
movsd 0xeaa4(%rip), %xmm1     # 0x36ea0
movsd -0x40(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xeabb(%rip), %xmm0     # 0x36ec8
cmpl $0x1, %eax
je 0x28416
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 0xea77(%rip), %xmm1     # 0x36ec0
cmpl $0x3, %eax
je 0x28456
movsd 0xea4a(%rip), %xmm1     # 0x36ea0
movsd -0x40(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xea61(%rip), %xmm0     # 0x36ec8
cmpl $0x1, %eax
je 0x28470
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 0xea19(%rip), %xmm1     # 0x36ec0
cmpl $0x3, %eax
je 0x284b4
movsd 0xe9ec(%rip), %xmm1     # 0x36ea0
movsd -0x30(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xea03(%rip), %xmm0     # 0x36ec8
cmpl $0x1, %eax
je 0x284ce
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 0xe9bb(%rip), %xmm1     # 0x36ec0
cmpl $0x3, %eax
je 0x28512
movsd 0xe98e(%rip), %xmm1     # 0x36ea0
movsd -0x30(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xe9a5(%rip), %xmm0     # 0x36ec8
cmpl $0x1, %eax
je 0x2852c
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 0xe95d(%rip), %xmm1     # 0x36ec0
cmpl $0x3, %eax
je 0x28570
movsd 0xe930(%rip), %xmm1     # 0x36ea0
movsd -0x30(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xe947(%rip), %xmm0     # 0x36ec8
cmpl $0x1, %eax
je 0x2858a
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 0xe8ff(%rip), %xmm1     # 0x36ec0
cmpl $0x3, %eax
je 0x285ce
movsd 0xe8d2(%rip), %xmm1     # 0x36ea0
movsd -0x30(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xe8e9(%rip), %xmm0     # 0x36ec8
cmpl $0x1, %eax
je 0x285e8
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 0xe8a1(%rip), %xmm1     # 0x36ec0
cmpl $0x3, %eax
je 0x2862c
movsd 0xe874(%rip), %xmm1     # 0x36ea0
movsd -0x30(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xe88b(%rip), %xmm0     # 0x36ec8
cmpl $0x1, %eax
je 0x28646
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 0x28687
movsd 0xe81e(%rip), %xmm1     # 0x36ea0
movsd %xmm1, -0x48(%rbp)
cmpl $0x1, %eax
je 0x28696
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 0xe84b(%rip), %xmm0     # 0x36f10
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