// File: /workspace/github_cpp_makefile_star2_O1/simap[P]ecctools/lib/uECC.c
// Function: XYcZ_add(unsigned long*, unsigned long*, unsigned long*, unsigned long*, uECC_Curve_t const*)
static void XYcZ_add(uECC_word_t * X1,
                     uECC_word_t * Y1,
                     uECC_word_t * X2,
                     uECC_word_t * Y2,
                     uECC_Curve curve) {
    /* t1 = X1, t2 = Y1, t3 = X2, t4 = Y2 */
    uECC_word_t t5[uECC_MAX_WORDS];
    wordcount_t num_words = curve->num_words;

    uECC_vli_modSub(t5, X2, X1, curve->p, num_words); /* t5 = x2 - x1 */
    uECC_vli_modSquare_fast(t5, t5, curve);                  /* t5 = (x2 - x1)^2 = A */
    uECC_vli_modMult_fast(X1, X1, t5, curve);                /* t1 = x1*A = B */
    uECC_vli_modMult_fast(X2, X2, t5, curve);                /* t3 = x2*A = C */
    uECC_vli_modSub(Y2, Y2, Y1, curve->p, num_words); /* t4 = y2 - y1 */
    uECC_vli_modSquare_fast(t5, Y2, curve);                  /* t5 = (y2 - y1)^2 = D */

    uECC_vli_modSub(t5, t5, X1, curve->p, num_words); /* t5 = D - B */
    uECC_vli_modSub(t5, t5, X2, curve->p, num_words); /* t5 = D - B - C = x3 */
    uECC_vli_modSub(X2, X2, X1, curve->p, num_words); /* t3 = C - B */
    uECC_vli_modMult_fast(Y1, Y1, X2, curve);                /* t2 = y1*(C - B) */
    uECC_vli_modSub(X2, X1, t5, curve->p, num_words); /* t3 = B - x3 */
    uECC_vli_modMult_fast(Y2, Y2, X2, curve);                /* t4 = (y2 - y1)*(B - x3) */
    uECC_vli_modSub(Y2, Y2, Y1, curve->p, num_words); /* t4 = y3 */

    uECC_vli_set(X2, t5, num_words);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r8, %r12
movq %rcx, %r14
movq %rdx, %rbx
movq %rsi, 0x8(%rsp)
movq %rdi, %rdx
movq %rdi, 0x10(%rsp)
movsbl (%r8), %ebp
leaq 0x8(%r8), %r13
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r13, %rcx
movq %r13, 0x18(%rsp)
movl %ebp, %r8d
callq 0x38f2
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
movq %r15, %rdx
movl %ebp, %ecx
callq 0x5802
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
callq *0xc0(%r12)
movsbl (%r12), %ecx
leaq 0x40(%rsp), %rdi
movq 0x10(%rsp), %r15
movq %r15, %rsi
leaq 0x20(%rsp), %rdx
callq 0x5802
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
callq *0xc0(%r12)
movsbl (%r12), %ecx
leaq 0x40(%rsp), %rdi
movq %rbx, %rsi
leaq 0x20(%rsp), %r15
movq %r15, %rdx
callq 0x5802
movq %rbx, %rdi
leaq 0x40(%rsp), %rsi
callq *0xc0(%r12)
movq %r14, %rdi
movq %r14, %rsi
movq 0x8(%rsp), %rdx
movq %r13, %rcx
movl %ebp, %r8d
callq 0x38f2
movsbl (%r12), %ecx
leaq 0x40(%rsp), %rdi
movq %r14, %rsi
movq %r14, %rdx
callq 0x5802
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
callq *0xc0(%r12)
movq %r15, %rdi
movq %r15, %rsi
movq 0x10(%rsp), %r15
movq %r15, %rdx
movq %r13, %rcx
movl %ebp, %r8d
callq 0x38f2
leaq 0x20(%rsp), %rdi
movq %rdi, %rsi
movq %rbx, %rdx
movq %r13, %rcx
movl %ebp, %r8d
callq 0x38f2
movq %rbx, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r13, %rcx
movl %ebp, %r8d
callq 0x38f2
movsbl (%r12), %ecx
leaq 0x40(%rsp), %rdi
movq 0x8(%rsp), %r13
movq %r13, %rsi
movq %rbx, %rdx
callq 0x5802
movq %r13, %rdi
leaq 0x40(%rsp), %rsi
callq *0xc0(%r12)
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x20(%rsp), %rdx
movq 0x18(%rsp), %r13
movq %r13, %rcx
movl %ebp, %r8d
callq 0x38f2
movsbl (%r12), %ecx
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x5802
movq %r14, %rdi
movq %r15, %rsi
callq *0xc0(%r12)
movq %r14, %rdi
movq %r14, %rsi
movq 0x8(%rsp), %rdx
movq %r13, %rcx
movl %ebp, %r8d
callq 0x38f2
testl %ebp, %ebp
jle 0x3b49
movslq %ebp, %rdx
shlq $0x3, %rdx
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x1070
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq