// File: archit-p[P]bulletproofs-demo/src/prover.cpp
// Function: Prover::calc_r()
vector <int> Prover::calc_r()
{
    if(x == -1 || z == -1) {
        cout << "Set the x and z values before calling";
        return {-1};
    }
    vector <int> ret = vector_sum(ar, k_product_vector(get_k_vector(1, ar.size()), z));
    ret = vector_sum(ret, k_product_vector(sr, x));
    ret = haderson_product(get_k_vector(y, ar.size()),ret);
    ret = vector_sum(ret, k_product_vector(get_k_vector(2, ar.size()), (int)pow(z, 2))); 
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rdi, -0x1a0(%rbp)
movq %rdi, %rax
movq %rax, -0x198(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x190(%rbp)
cmpl $-0x1, 0xc(%rax)
je 0x4432
movq -0x190(%rbp), %rax
cmpl $-0x1, 0x14(%rax)
jne 0x44b1
movq 0x7b9f(%rip), %rdi      # 0xbfd8
leaq 0x3beb(%rip), %rsi      # 0x802b
callq 0x10c0
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
leaq -0x24(%rbp), %rax
movq %rax, -0x20(%rbp)
movq $0x1, -0x18(%rbp)
leaq -0x25(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x1d90
movq -0x1a0(%rbp), %rdi
movq -0x1a8(%rbp), %rcx
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x53b0
jmp 0x4489
leaq -0x25(%rbp), %rdi
callq 0x1f80
jmp 0x48bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x25(%rbp), %rdi
callq 0x1f80
jmp 0x48cc
movq -0x190(%rbp), %rsi
movb $0x0, -0x35(%rbp)
addq $0x30, %rsi
movq %rsi, -0x1b0(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x52c0
movq -0x1b0(%rbp), %rdi
callq 0x2450
movl %eax, %edx
leaq -0x80(%rbp), %rdi
movl $0x1, %esi
callq 0x2950
jmp 0x44ee
movq -0x190(%rbp), %rax
movl 0x14(%rax), %edx
leaq -0x68(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x2ac0
jmp 0x4507
movq -0x1a0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x68(%rbp), %rdx
callq 0x2ce0
jmp 0x451d
leaq -0x68(%rbp), %rdi
callq 0x1cc0
leaq -0x80(%rbp), %rdi
callq 0x1cc0
leaq -0x50(%rbp), %rdi
callq 0x1cc0
movq -0x1a0(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x52c0
jmp 0x454d
movq -0x190(%rbp), %rsi
addq $0x60, %rsi
leaq -0xe0(%rbp), %rdi
callq 0x52c0
jmp 0x4566
movq -0x190(%rbp), %rax
movl 0xc(%rax), %edx
leaq -0xc8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x2ac0
jmp 0x4585
leaq -0x98(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
leaq -0xc8(%rbp), %rdx
callq 0x2ce0
jmp 0x45a1
movq -0x1a0(%rbp), %rdi
leaq -0x98(%rbp), %rsi
movq %rsi, -0x1c0(%rbp)
callq 0x5290
movq -0x1c0(%rbp), %rdi
callq 0x1cc0
leaq -0xc8(%rbp), %rdi
callq 0x1cc0
leaq -0xe0(%rbp), %rdi
callq 0x1cc0
leaq -0xb0(%rbp), %rdi
callq 0x1cc0
movq -0x190(%rbp), %rdi
movl 0x10(%rdi), %eax
movl %eax, -0x1b4(%rbp)
addq $0x30, %rdi
callq 0x2450
movl -0x1b4(%rbp), %esi
movl %eax, %edx
leaq -0x110(%rbp), %rdi
callq 0x2950
jmp 0x461a
movq -0x1a0(%rbp), %rsi
leaq -0x128(%rbp), %rdi
callq 0x52c0
jmp 0x462f
leaq -0xf8(%rbp), %rdi
leaq -0x110(%rbp), %rsi
leaq -0x128(%rbp), %rdx
callq 0x1510
jmp 0x464b
movq -0x1a0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
movq %rsi, -0x1c8(%rbp)
callq 0x5290
movq -0x1c8(%rbp), %rdi
callq 0x1cc0
leaq -0x128(%rbp), %rdi
callq 0x1cc0
leaq -0x110(%rbp), %rdi
callq 0x1cc0
movq -0x1a0(%rbp), %rsi
leaq -0x158(%rbp), %rdi
callq 0x52c0
jmp 0x469e
movq -0x190(%rbp), %rdi
addq $0x30, %rdi
callq 0x2450
movl %eax, %edx
leaq -0x188(%rbp), %rdi
movl $0x2, %esi
callq 0x2950
jmp 0x46c3
movq -0x190(%rbp), %rax
movl 0x14(%rax), %edi
movl $0x2, %esi
callq 0x3020
movsd %xmm0, -0x1d0(%rbp)
jmp 0x46e1
movsd -0x1d0(%rbp), %xmm0
cvttsd2si %xmm0, %edx
leaq -0x170(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x2ac0
jmp 0x4702
leaq -0x140(%rbp), %rdi
leaq -0x158(%rbp), %rsi
leaq -0x170(%rbp), %rdx
callq 0x2ce0
jmp 0x471e
movq -0x1a0(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x5290
leaq -0x140(%rbp), %rdi
callq 0x1cc0
leaq -0x170(%rbp), %rdi
callq 0x1cc0
leaq -0x188(%rbp), %rdi
callq 0x1cc0
leaq -0x158(%rbp), %rdi
callq 0x1cc0
movb $0x1, -0x35(%rbp)
testb $0x1, -0x35(%rbp)
jne 0x48ac
jmp 0x48a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x47ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x47a5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x1cc0
leaq -0x80(%rbp), %rdi
callq 0x1cc0
leaq -0x50(%rbp), %rdi
callq 0x1cc0
jmp 0x48cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x48ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x480d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x4801
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x1cc0
leaq -0xe0(%rbp), %rdi
callq 0x1cc0
leaq -0xb0(%rbp), %rdi
callq 0x1cc0
jmp 0x48ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x4844
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x1cc0
leaq -0x110(%rbp), %rdi
callq 0x1cc0
jmp 0x48ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x4892
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x4886
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x1cc0
leaq -0x188(%rbp), %rdi
callq 0x1cc0
leaq -0x158(%rbp), %rdi
callq 0x1cc0
jmp 0x48ae
movq -0x1a0(%rbp), %rdi
callq 0x1cc0
jmp 0x48bc
movq -0x1a0(%rbp), %rdi
callq 0x1cc0
jmp 0x48cc
movq -0x198(%rbp), %rax
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x1170
nopw %cs:(%rax,%rax)