// File: /workspace/github_cpp_makefile_star2_O2/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, %r15
movl %edx, -0x38(%rbp)
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), %rbx
movsd 0x600(%r12), %xmm0
movsd %xmm0, (%r15)
movsd 0x608(%r12), %xmm0
movsd %xmm0, (%r14)
movsd 0x610(%r12), %xmm0
movsd %xmm0, (%r9)
movsd 0x8(%r12), %xmm0
movsd %xmm0, (%rbx)
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 %r15, %rsi
movq %r14, %rdx
callq 0xc300
movsd 0x17a0(%r12), %xmm0
addsd (%r15), %xmm0
movq %r15, -0x50(%rbp)
movsd %xmm0, (%r15)
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
addsd (%rbx), %xmm0
movsd %xmm0, (%rbx)
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)
imull $0x14, -0x38(%rbp), %eax
movslq %eax, %r15
movsd 0xba48(%r12,%r15,8), %xmm0
movsd %xmm0, -0x38(%rbp)
callq 0xba40
movq 0x1a2ef(%rip), %rax     # 0x3cf60
movq %rax, %r14
movl 0x1690(%rax), %eax
movsd 0xd23e(%rip), %xmm1     # 0x2fec0
movsd %xmm1, -0x48(%rbp)
cmpl $0x3, %eax
je 0x22c94
movsd 0xd20c(%rip), %xmm1     # 0x2fea0
movsd -0x38(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xd223(%rip), %xmm0     # 0x2fec8
movsd %xmm0, -0x38(%rbp)
cmpl $0x1, %eax
je 0x22cb3
movapd %xmm1, %xmm0
divsd %xmm0, %xmm2
movq -0x50(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm2, %xmm0
movsd %xmm0, (%rax)
movsd 0xba50(%r12,%r15,8), %xmm0
movsd %xmm0, -0x40(%rbp)
callq 0xba40
movl 0x1690(%r14), %eax
movsd 0xd1d6(%rip), %xmm1     # 0x2fec0
cmpl $0x3, %eax
movq -0x58(%rbp), %rbx
je 0x22cfb
movsd 0xd1a5(%rip), %xmm1     # 0x2fea0
movsd -0x40(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xd1bc(%rip), %xmm0     # 0x2fec8
cmpl $0x1, %eax
je 0x22d15
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 0xba40
movl 0x1690(%r14), %eax
movsd 0xd178(%rip), %xmm1     # 0x2fec0
cmpl $0x3, %eax
je 0x22d55
movsd 0xd14b(%rip), %xmm1     # 0x2fea0
movsd -0x40(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xd162(%rip), %xmm0     # 0x2fec8
cmpl $0x1, %eax
je 0x22d6f
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 0xba40
movl 0x1690(%r14), %eax
movsd 0xd11a(%rip), %xmm1     # 0x2fec0
cmpl $0x3, %eax
je 0x22db3
movsd 0xd0ed(%rip), %xmm1     # 0x2fea0
movsd -0x30(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xd104(%rip), %xmm0     # 0x2fec8
cmpl $0x1, %eax
je 0x22dcd
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 0xba40
movl 0x1690(%r14), %eax
movsd 0xd0bc(%rip), %xmm1     # 0x2fec0
cmpl $0x3, %eax
je 0x22e11
movsd 0xd08f(%rip), %xmm1     # 0x2fea0
movsd -0x30(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xd0a6(%rip), %xmm0     # 0x2fec8
cmpl $0x1, %eax
je 0x22e2b
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 0xba40
movl 0x1690(%r14), %eax
movsd 0xd05e(%rip), %xmm1     # 0x2fec0
cmpl $0x3, %eax
je 0x22e6f
movsd 0xd031(%rip), %xmm1     # 0x2fea0
movsd -0x30(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xd048(%rip), %xmm0     # 0x2fec8
cmpl $0x1, %eax
je 0x22e89
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 0xba40
movl 0x1690(%r14), %eax
movsd 0xd000(%rip), %xmm1     # 0x2fec0
cmpl $0x3, %eax
je 0x22ecd
movsd 0xcfd3(%rip), %xmm1     # 0x2fea0
movsd -0x30(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xcfea(%rip), %xmm0     # 0x2fec8
cmpl $0x1, %eax
je 0x22ee7
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 0xba40
movl 0x1690(%r14), %eax
movsd 0xcfa2(%rip), %xmm1     # 0x2fec0
cmpl $0x3, %eax
je 0x22f2b
movsd 0xcf75(%rip), %xmm1     # 0x2fea0
movsd -0x30(%rbp), %xmm2
divsd %xmm0, %xmm2
movsd 0xcf8c(%rip), %xmm0     # 0x2fec8
cmpl $0x1, %eax
je 0x22f45
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 0xba40
movl 0x1690(%r14), %eax
cmpl $0x3, %eax
je 0x22f86
movsd 0xcf1f(%rip), %xmm1     # 0x2fea0
movsd %xmm1, -0x48(%rbp)
cmpl $0x1, %eax
je 0x22f95
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 0xcf4c(%rip), %xmm0     # 0x2ff10
movq -0x60(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq %rbx, %rdx
callq 0xc300
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop