// File: 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
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x28(%rbp), %rax
movb (%rax), %al
movb %al, -0x91(%rbp)
leaq -0x50(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x8(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x8, %rcx
movsbl -0x91(%rbp), %r8d
callq 0x3e00
leaq -0x50(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x26c0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x41b0
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x41b0
leaq -0x50(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x8, %rcx
movsbl -0x91(%rbp), %r8d
callq 0x4840
movq -0x20(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x8, %rcx
movsbl -0x91(%rbp), %r8d
callq 0x3e00
leaq -0x70(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x8(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x8, %rcx
movsbl -0x91(%rbp), %r8d
callq 0x3e00
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x70(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x41b0
leaq -0x70(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x8, %rcx
movsbl -0x91(%rbp), %r8d
callq 0x4840
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x26c0
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x70(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x8, %rcx
movsbl -0x91(%rbp), %r8d
callq 0x3e00
leaq -0x90(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x8, %rcx
movsbl -0x91(%rbp), %r8d
callq 0x3e00
movq -0x20(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq -0x90(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x41b0
movq -0x20(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x8, %rcx
movsbl -0x91(%rbp), %r8d
callq 0x3e00
leaq -0x90(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x26c0
leaq -0x90(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq -0x70(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x8, %rcx
movsbl -0x91(%rbp), %r8d
callq 0x3e00
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movq -0x8(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x8, %rcx
movsbl -0x91(%rbp), %r8d
callq 0x3e00
leaq -0x70(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x41b0
movq -0x10(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x8, %rcx
movsbl -0x91(%rbp), %r8d
callq 0x3e00
movq -0x8(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movsbl -0x91(%rbp), %edx
callq 0x3db0
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)