// File: /workspace/github_cpp_makefile_star2_O2/archit-p[P]bulletproofs-demo/src/inner_product_arg.cpp
// Function: InnerProdArg::generate_argument()
void InnerProdArg::generate_argument()
{
    vector <int> a_l, a_r, b_l, b_r, a_prime, b_prime, to_send;
    int x_inv = modInverse(x, order);
    cout << "x_inv value is :" << x_inv << endl;
    int c_prime; 
    while(a.size() > 1) {
        get_half(a, a_l, a_r);
        get_half(b, b_l, b_r);

        a_prime = vector_sum(k_product_vector(a_l, x, order), k_product_vector(a_r, x_inv, order), order);
        b_prime = vector_sum(k_product_vector(b_l, x_inv), k_product_vector(b_r, x), order);
        c_prime = inner_product(a_prime, b_prime, order);
        
        a.clear();
        b.clear();

        a = a_prime;
        b = b_prime;

        to_send.push_back(c_prime);
    }

    to_send.push_back(a[0]);
    to_send.push_back(b[0]);
    
    final_arg = serialize(to_send);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdi, %rbx
andq $0x0, 0xe0(%rsp)
xorps %xmm0, %xmm0
andq $0x0, 0xc0(%rsp)
movaps %xmm0, 0xd0(%rsp)
andq $0x0, 0xa0(%rsp)
movaps %xmm0, 0xb0(%rsp)
andq $0x0, 0x80(%rsp)
movaps %xmm0, 0x90(%rsp)
andq $0x0, 0x60(%rsp)
movaps %xmm0, 0x70(%rsp)
andq $0x0, 0x40(%rsp)
movaps %xmm0, 0x50(%rsp)
andq $0x0, 0x20(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x10(%rsp)
movl 0x38(%rdi), %esi
movl 0x40(%rdi), %edi
callq 0x1542
movl %eax, 0x8(%rsp)
movq 0x3d0d(%rip), %rdi      # 0x6fd8
leaq 0xdb0(%rip), %rsi       # 0x4082
callq 0x10e0
movq %rax, %rdi
movl 0x8(%rsp), %esi
callq 0x1140
movq %rax, %rdi
callq 0x1070
leaq 0x18(%rbx), %r14
leaq 0x1f0(%rsp), %r13
leaq 0x1c0(%rsp), %r12
movq (%rbx), %rsi
movq 0x8(%rbx), %rax
subq %rsi, %rax
cmpq $0x5, %rax
jb 0x353a
movq %rbx, %rdi
leaq 0xd0(%rsp), %rsi
leaq 0xb0(%rsp), %rdx
callq 0x1778
movq %r14, %rdi
leaq 0x90(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0x1778
leaq 0x148(%rsp), %r15
movq %r15, %rdi
leaq 0xd0(%rsp), %rsi
callq 0x2f60
movl 0x38(%rbx), %ecx
movl 0x40(%rbx), %edx
leaq 0x160(%rsp), %rdi
movq %r15, %rsi
callq 0x19a1
movq %r12, %rbp
leaq 0x130(%rsp), %r15
movq %r15, %rdi
leaq 0xb0(%rsp), %rsi
callq 0x2f60
movl 0x38(%rbx), %ecx
leaq 0x1d8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movl 0x8(%rsp), %edx
callq 0x19a1
movl 0x38(%rbx), %ecx
movq %r13, %rdi
leaq 0x160(%rsp), %r15
movq %r15, %rsi
movq %r12, %rdx
callq 0x1aee
leaq 0x50(%rsp), %rdi
movq %r13, %rsi
callq 0x2fe4
movq %r13, %rdi
callq 0x15ce
movq %r12, %rdi
callq 0x15ce
leaq 0x130(%rsp), %rdi
callq 0x15ce
movq %r15, %rdi
callq 0x15ce
leaq 0x148(%rsp), %rdi
callq 0x15ce
movq %rbp, %r12
movq %rbp, %rdi
leaq 0x90(%rsp), %rsi
callq 0x2f60
leaq 0x118(%rsp), %rdi
movq %r12, %rsi
movl 0x8(%rsp), %edx
callq 0x1959
leaq 0x100(%rsp), %r15
movq %r15, %rdi
leaq 0x70(%rsp), %rsi
callq 0x2f60
movl 0x40(%rbx), %edx
leaq 0x1a8(%rsp), %rbp
movq %rbp, %rdi
movq %r15, %rsi
callq 0x1959
movl 0x38(%rbx), %ecx
movq %r13, %rdi
leaq 0x118(%rsp), %r15
movq %r15, %rsi
movq %rbp, %rdx
callq 0x1aee
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0x2fe4
movq %r13, %rdi
callq 0x15ce
movq %rbp, %rdi
callq 0x15ce
leaq 0x100(%rsp), %rdi
callq 0x15ce
movq %r15, %rdi
callq 0x15ce
movq %r12, %rdi
callq 0x15ce
leaq 0xe8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x2f60
leaq 0x190(%rsp), %rbp
movq %rbp, %rdi
leaq 0x30(%rsp), %rsi
callq 0x2f60
movl 0x38(%rbx), %edx
leaq 0xe8(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
callq 0x1478
movl %eax, 0xc(%rsp)
movq %rbp, %rdi
callq 0x15ce
movq %r15, %rdi
callq 0x15ce
movq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
je 0x34fe
movq %rax, 0x8(%rbx)
movq 0x18(%rbx), %rax
cmpq %rax, 0x20(%rbx)
je 0x350c
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
leaq 0x50(%rsp), %rsi
callq 0x36fc
movq %r14, %rdi
leaq 0x30(%rsp), %rsi
callq 0x36fc
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x1c16
jmp 0x32ff
leaq 0x10(%rsp), %rdi
callq 0x1c16
movq (%r14), %rsi
leaq 0x10(%rsp), %rdi
callq 0x1c16
leaq 0x178(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2f60
leaq 0x178(%rsp), %r14
movq %r14, %rdi
callq 0x30e3
movq %rax, 0x30(%rbx)
movq %r14, %rdi
callq 0x15ce
leaq 0x10(%rsp), %rdi
callq 0x15ce
leaq 0x30(%rsp), %rdi
callq 0x15ce
leaq 0x50(%rsp), %rdi
callq 0x15ce
leaq 0x70(%rsp), %rdi
callq 0x15ce
leaq 0x90(%rsp), %rdi
callq 0x15ce
leaq 0xb0(%rsp), %rdi
callq 0x15ce
leaq 0xd0(%rsp), %rdi
callq 0x15ce
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x369b
jmp 0x369b
movq %rax, %rbx
leaq 0x1d8(%rsp), %rdi
callq 0x15ce
jmp 0x3613
jmp 0x369b
movq %rax, %rbx
jmp 0x365e
movq %rax, %rbx
jmp 0x366b
movq %rax, %rbx
jmp 0x3637
movq %rax, %rbx
leaq 0x130(%rsp), %rdi
callq 0x15ce
jmp 0x367f
movq %rax, %rbx
jmp 0x3651
movq %rax, %rbx
leaq 0x190(%rsp), %rdi
callq 0x15ce
leaq 0xe8(%rsp), %rdi
jmp 0x3694
movq %rax, %rbx
leaq 0x1a8(%rsp), %rdi
callq 0x15ce
leaq 0x100(%rsp), %rdi
callq 0x15ce
leaq 0x118(%rsp), %rdi
callq 0x15ce
leaq 0x1c0(%rsp), %rdi
jmp 0x3694
movq %rax, %rbx
jmp 0x368c
jmp 0x369b
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
callq 0x15ce
leaq 0x148(%rsp), %rdi
callq 0x15ce
jmp 0x369e
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x15ce
leaq 0x30(%rsp), %rdi
callq 0x15ce
leaq 0x50(%rsp), %rdi
callq 0x15ce
leaq 0x70(%rsp), %rdi
callq 0x15ce
leaq 0x90(%rsp), %rdi
callq 0x15ce
leaq 0xb0(%rsp), %rdi
callq 0x15ce
leaq 0xd0(%rsp), %rdi
callq 0x15ce
movq %rbx, %rdi
callq 0x1160
nop