// File: /workspace/github_cpp_makefile_star2_O3/simap[P]ecctools/lib/uECC.c
// Function: XYcZ_addC(unsigned long*, unsigned long*, unsigned long*, unsigned long*, uECC_Curve_t const*)
static void XYcZ_addC(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];
    uECC_word_t t6[uECC_MAX_WORDS];
    uECC_word_t t7[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_modAdd(t5, Y2, Y1, curve->p, num_words); /* t5 = y2 + y1 */
    uECC_vli_modSub(Y2, Y2, Y1, curve->p, num_words); /* t4 = y2 - y1 */

    uECC_vli_modSub(t6, X2, X1, curve->p, num_words); /* t6 = C - B */
    uECC_vli_modMult_fast(Y1, Y1, t6, curve);                /* t2 = y1 * (C - B) = E */
    uECC_vli_modAdd(t6, X1, X2, curve->p, num_words); /* t6 = B + C */
    uECC_vli_modSquare_fast(X2, Y2, curve);                  /* t3 = (y2 - y1)^2 = D */
    uECC_vli_modSub(X2, X2, t6, curve->p, num_words); /* t3 = D - (B + C) = x3 */

    uECC_vli_modSub(t7, X1, X2, curve->p, num_words); /* t7 = B - x3 */
    uECC_vli_modMult_fast(Y2, Y2, t7, curve);                /* t4 = (y2 - y1)*(B - x3) */
    uECC_vli_modSub(Y2, Y2, Y1, curve->p, num_words); /* t4 = (y2 - y1)*(B - x3) - E = y3 */

    uECC_vli_modSquare_fast(t7, t5, curve);                  /* t7 = (y2 + y1)^2 = F */
    uECC_vli_modSub(t7, t7, t6, curve->p, num_words); /* t7 = F - (B + C) = x3' */
    uECC_vli_modSub(t6, t7, X1, curve->p, num_words); /* t6 = x3' - B */
    uECC_vli_modMult_fast(t6, t6, t5, curve);                /* t6 = (y2+y1)*(x3' - B) */
    uECC_vli_modSub(Y1, t6, Y1, curve->p, num_words); /* t2 = (y2+y1)*(x3' - B) - E = y3' */

    uECC_vli_set(X1, t7, num_words);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %r8, %r15
movq %rcx, 0x18(%rsp)
movq %rdx, %r14
movq %rsi, 0x10(%rsp)
movq %rdi, %rdx
movq %rdi, 0x8(%rsp)
movsbl (%r8), %ebp
leaq 0x8(%r8), %r12
leaq 0xa0(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rcx
movl %ebp, %r8d
callq 0x37ab
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movq %r13, %rdx
movl %ebp, %ecx
callq 0x561c
movq %r13, %rdi
movq %rbx, %rsi
callq *0xc0(%r15)
movsbl (%r15), %ecx
leaq 0x20(%rsp), %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rsi
movq %r13, %rdx
callq 0x561c
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq *0xc0(%r15)
movsbl (%r15), %ecx
leaq 0x20(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdx
callq 0x561c
movq %r14, %rdi
movq %r13, %rsi
callq *0xc0(%r15)
movq %rbx, %rdi
movq 0x18(%rsp), %r13
movq %r13, %rsi
movq 0x10(%rsp), %rbx
movq %rbx, %rdx
movq %r12, %rcx
movl %ebp, %r8d
callq 0x4143
movq %r13, %rdi
movq %r13, %rsi
movq %rbx, %rdx
movq %r12, %rcx
movl %ebp, %r8d
callq 0x37ab
leaq 0x60(%rsp), %rdi
movq %r14, %rsi
movq 0x8(%rsp), %r13
movq %r13, %rdx
movq %r12, %rcx
movl %ebp, %r8d
callq 0x37ab
movsbl (%r15), %ecx
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
leaq 0x60(%rsp), %rdx
callq 0x561c
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq *0xc0(%r15)
leaq 0x60(%rsp), %rdi
movq %r13, %rsi
movq %r13, %rbx
movq %r14, %rdx
movq %r12, %rcx
movl %ebp, %r8d
callq 0x4143
movsbl (%r15), %ecx
leaq 0x20(%rsp), %rdi
movq 0x18(%rsp), %r13
movq %r13, %rsi
movq %r13, %rdx
callq 0x561c
movq %r14, %rdi
leaq 0x20(%rsp), %rsi
callq *0xc0(%r15)
movq %r14, %rdi
movq %r14, %rsi
leaq 0x60(%rsp), %rdx
movq %r12, %rcx
movl %ebp, %r8d
callq 0x37ab
leaq 0x80(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %r12, %rcx
movl %ebp, %r8d
callq 0x37ab
movsbl (%r15), %ecx
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
leaq 0x80(%rsp), %rdx
callq 0x561c
movq %r13, %rdi
movq %r14, %rsi
callq *0xc0(%r15)
movq %r13, %rdi
movq %r13, %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rcx
movl %ebp, %r8d
callq 0x37ab
movsbl (%r15), %ecx
leaq 0x20(%rsp), %r14
movq %r14, %rdi
leaq 0xa0(%rsp), %rdx
movq %rdx, %rsi
callq 0x561c
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq 0x8(%rsp), %r14
callq *0xc0(%r15)
movq %rbx, %rdi
movq %rbx, %rsi
leaq 0x60(%rsp), %r13
movq %r13, %rdx
movq %r12, %rcx
movl %ebp, %r8d
callq 0x37ab
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %r12, %rcx
movl %ebp, %r8d
callq 0x37ab
movsbl (%r15), %ecx
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
leaq 0xa0(%rsp), %rdx
callq 0x561c
movq %r13, %rdi
movq %rbx, %rsi
callq *0xc0(%r15)
movq 0x10(%rsp), %rdi
movq %r13, %rsi
movq %rdi, %rdx
movq %r12, %rcx
movl %ebp, %r8d
callq 0x37ab
testl %ebp, %ebp
jle 0x556a
movslq %ebp, %rdx
shlq $0x3, %rdx
leaq 0x80(%rsp), %rsi
movq %r14, %rdi
callq 0x1070
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq