// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/src/recover.cpp
// Function: mode_recover()
int16_t mode_recover()
{
    uint16_t t;
    std::cout << "T: ";
    std::cin >> t;
    std::vector<std::pair<uint256_t, uint256_t>> points_vector;

    uint16_t i = 0;
    bool input_flag = true;
    std::cout << "To stop entering type 'stop'...\n";
    while ((i < t) || input_flag)
    {
        std::pair<uint256_t, uint256_t> pair;
        bool code = get_point(pair);
        if (code && (i < t))
        {
            std::cout << "Not enough points were entered!\nContinue entering...\n";
        }
        else if (code && (i >= t))
        {
            input_flag = false;
        }
        else
        {
            points_vector.push_back(pair);
            i++;
        }
    }

    uint256_t secret = reconstruct_secret(points_vector, t);
    std::cout << std::hex << "\nSecret: 0x" << secret << "\n";

    return SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq 0x6038(%rip), %rbx      # 0xbfb8
leaq 0x12a5(%rip), %rsi      # 0x722c
movq %rbx, %rdi
callq 0x2150
movq 0x6042(%rip), %rdi      # 0xbfd8
leaq 0x2a(%rsp), %rsi
callq 0x2210
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
andq $0x0, 0x60(%rsp)
leaq 0x11a9(%rip), %rsi      # 0x715e
movq %rbx, %rdi
callq 0x2150
movb $0x1, %bl
leaq 0xd0(%rsp), %r15
leaq 0x11f3(%rip), %rbp      # 0x71c1
leaq 0x90(%rsp), %r14
xorl %r12d, %r12d
cmpw 0x2a(%rsp), %r12w
setb %al
orb %bl, %al
testb $0x1, %al
je 0x6156
xorps %xmm0, %xmm0
movaps %xmm0, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
leaq 0xe0(%rsp), %rax
movq %rax, 0xd0(%rsp)
andq $0x0, 0xd8(%rsp)
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
xorl %ecx, %ecx
movb %cl, 0xe0(%rsp)
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
andq $0x0, 0x38(%rsp)
movb %cl, 0x40(%rsp)
movq 0x5f8c(%rip), %rdi      # 0xbfd8
movq %r15, %rsi
callq 0x21b0
movq %r15, %rdi
movq %rbp, %rsi
callq 0x64a7
testb %al, %al
je 0x60cf
movq 0x5f6e(%rip), %rdi      # 0xbfd8
leaq 0x30(%rsp), %rsi
callq 0x21b0
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x3464
leaq 0xf0(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x3464
movups 0x70(%rsp), %xmm0
movups 0x80(%rsp), %xmm1
movaps %xmm1, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movups 0xf0(%rsp), %xmm0
movups 0x100(%rsp), %xmm1
leaq 0xb0(%rsp), %rax
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movq %r15, %rdi
movq %rbp, %r13
movq %rbp, %rsi
callq 0x64b1
movl %eax, %ebp
leaq 0x30(%rsp), %rdi
callq 0x20a0
movq %r15, %rdi
callq 0x20a0
movzwl 0x2a(%rsp), %eax
cmpw %ax, %r12w
setb %cl
andb %bpl, %cl
cmpb $0x1, %cl
jne 0x6120
movq 0x5eac(%rip), %rdi      # 0xbfb8
leaq 0x106c(%rip), %rsi      # 0x717f
callq 0x2150
movq %r13, %rbp
jmp 0x5fd9
cmpw %ax, %r12w
setb %al
xorb $0x1, %bpl
orb %al, %bpl
cmpb $0x1, %bpl
jne 0x614c
leaq 0x50(%rsp), %rdi
movq %r14, %rsi
callq 0x6472
movq %r13, %rbp
incl %r12d
jmp 0x5fd9
xorl %ebx, %ebx
movq %r13, %rbp
jmp 0x5fd9
leaq 0x1069(%rip), %rsi      # 0x71c6
leaq 0xd0(%rsp), %r15
movq %r15, %rdi
callq 0x351a
xorps %xmm0, %xmm0
leaq 0x110(%rsp), %rax
movaps %xmm0, (%rax)
leaq 0xe86(%rip), %rcx       # 0x7008
movups (%rcx), %xmm0
movaps %xmm0, 0x10(%rax)
xorl %r12d, %r12d
leaq 0x158(%rsp), %r13
leaq 0x138(%rsp), %rbp
movzbl %r12b, %r12d
movq 0x50(%rsp), %rdx
movq 0x58(%rsp), %rax
movq %rax, %rcx
subq %rdx, %rcx
sarq $0x6, %rcx
cmpq %r12, %rcx
jbe 0x63cf
leaq 0xe44(%rip), %rcx       # 0x7008
movups (%rcx), %xmm0
leaq 0x40(%rsp), %rcx
movups %xmm0, (%rcx)
andq $0x0, 0x38(%rsp)
movq $0x1, 0x30(%rsp)
xorl %ebx, %ebx
movzbl %bl, %ebx
movq %rax, %rcx
subq %rdx, %rcx
sarq $0x6, %rcx
cmpq %rbx, %rcx
jbe 0x6349
cmpb %bl, %r12b
je 0x6342
movl %ebx, %eax
shll $0x6, %eax
addq %rax, %rdx
movq %r13, %rdi
movq %r15, %rsi
callq 0x4194
movq 0x50(%rsp), %rax
movl %r12d, %edi
shll $0x6, %edi
addq %rax, %rdi
movl %ebx, %esi
shll $0x6, %esi
addq %rax, %rsi
callq 0x3f30
movq 0x50(%rsp), %rcx
testb %al, %al
je 0x6249
movl %r12d, %esi
shll $0x6, %esi
addq %rcx, %rsi
movl %ebx, %edx
shll $0x6, %edx
addq %rcx, %rdx
jmp 0x6268
movl %ebx, %esi
shll $0x6, %esi
addq %rcx, %rsi
movl %r12d, %edx
shll $0x6, %edx
addq %rcx, %rdx
movq %r14, %rdi
callq 0x4194
movq %r15, %rsi
movq %r14, %rdx
movq %rbp, %rdi
callq 0x4194
movl $0x2, 0x2c(%rsp)
movq %r14, %rdi
movq %r15, %rsi
leaq 0x2c(%rsp), %rdx
callq 0x64be
movups 0x90(%rsp), %xmm0
movups 0xa0(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0xf0(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x58c0
movups 0xf0(%rsp), %xmm0
movups 0x100(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x59dc
movups 0x90(%rsp), %xmm0
movups 0xa0(%rsp), %xmm1
movaps %xmm1, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps 0x70(%rsp), %xmm0
movaps 0x80(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r14, %rdi
leaq 0x30(%rsp), %rsi
movq %r15, %rdx
callq 0x59dc
movups 0x90(%rsp), %xmm0
movups 0xa0(%rsp), %xmm1
movaps %xmm1, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq 0x50(%rsp), %rdx
movq 0x58(%rsp), %rax
incb %bl
jmp 0x61e0
movl %r12d, %eax
shll $0x6, %eax
movups 0x20(%rdx,%rax), %xmm0
movups 0x30(%rdx,%rax), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r14, %rdi
leaq 0x30(%rsp), %rsi
movq %r15, %rdx
callq 0x59dc
movups 0x90(%rsp), %xmm0
movups 0xa0(%rsp), %xmm1
movaps %xmm1, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movq %r14, %rdi
leaq 0x110(%rsp), %rsi
leaq 0x70(%rsp), %rdx
movq %r15, %rcx
callq 0x5b0e
movups 0x90(%rsp), %xmm0
movups 0xa0(%rsp), %xmm1
movaps %xmm1, 0x120(%rsp)
movaps %xmm0, 0x110(%rsp)
incb %r12b
jmp 0x619c
movq 0x5be2(%rip), %rdi      # 0xbfb8
movq (%rdi), %rax
movq -0x18(%rax), %rax
movl 0x18(%rdi,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rdi,%rax)
leaq 0xdc3(%rip), %rsi       # 0x71b5
callq 0x2150
leaq 0x110(%rsp), %rsi
movq %rax, %rdi
callq 0x578e
leaq 0xd6f(%rip), %rsi       # 0x717d
movq %rax, %rdi
callq 0x2150
leaq 0x50(%rsp), %rdi
callq 0x6540
xorl %eax, %eax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x645c
jmp 0x645c
jmp 0x6440
jmp 0x6440
jmp 0x645c
jmp 0x645c
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x20a0
leaq 0xd0(%rsp), %rdi
callq 0x20a0
jmp 0x645f
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x6540
movq %rbx, %rdi
callq 0x2270
nop