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