// File: /workspace/github_cpp_makefile_star2_O3/rupc[P]xor-secret-sharing-scheme/main.cpp
// Function: XORSecretShares::generate_random_secret[abi:cxx11]()
std::string XORSecretShares::generate_random_secret(void)
{
    if (_init == false) {
        return "ERROR";
    }

    std::string randSecret(key_size, '0');

    for (int i = 0; i < key_size; i++) {
        randSecret[i] = std::to_string(rand() % 2)[0];
    }

    std::string res;
    switch (key_size) {
        case 64: {
            std::bitset<64> _secret_64(randSecret);
            res = _secret_64.to_string();
        }
            break;
        case 128: {
            std::bitset<128> _secret_128(randSecret);
            res = _secret_128.to_string();
        }
            break;
        case 256: {
            std::bitset<256> _secret_256(randSecret);
            res = _secret_256.to_string();
        }
            break;
        default: {
            std::bitset<32> _secret_32(randSecret);
            res = _secret_32.to_string();
        }
            break;
    }
    this->secret = res;
    return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
cmpb $0x0, 0x4(%rsi)
je 0x2428
movq %rsi, %r13
movslq (%rsi), %rsi
leaq -0x58(%rbp), %r14
movq %r14, -0x10(%r14)
leaq -0x68(%rbp), %rdi
movl $0x30, %edx
callq 0x2140
movl (%r13), %eax
testl %eax, %eax
jle 0x23bd
movq %rbx, -0x90(%rbp)
leaq -0x38(%rbp), %r15
xorl %ebx, %ebx
callq 0x2040
movl %eax, %r12d
movl %eax, %r14d
shrl $0x1f, %r14d
andl %eax, %r14d
leal 0x1(%r14), %esi
movq %r15, -0x48(%rbp)
leaq -0x48(%rbp), %rdi
movl $0x2d, %edx
callq 0x2140
andl $0x1, %r12d
movl %r14d, %edi
addq -0x48(%rbp), %rdi
movl $0x1, %esi
movl %r12d, %edx
callq 0x3062
movq -0x48(%rbp), %rax
movb (%rax), %al
movq -0x68(%rbp), %rcx
movb %al, (%rcx,%rbx)
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x23a6
callq 0x20f0
incq %rbx
movslq (%r13), %rax
cmpq %rax, %rbx
jl 0x234b
movq -0x90(%rbp), %rbx
leaq -0x58(%rbp), %r14
leaq 0x10(%rbx), %r12
movq %r12, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
cmpl $0x40, %eax
je 0x246e
cmpl $0x80, %eax
je 0x244a
cmpl $0x100, %eax            # imm = 0x100
jne 0x2492
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
xorl %edx, %edx
callq 0x2ede
leaq -0x88(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x34c4
leaq -0x88(%rbp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2150
movq (%r15), %rdi
leaq -0x78(%rbp), %rax
jmp 0x24ca
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x1bce(%rip), %rsi      # 0x4004
leaq 0x1bcc(%rip), %rdx      # 0x4009
movq %rbx, %rdi
callq 0x3172
jmp 0x24f1
leaq -0x88(%rbp), %rdi
leaq -0x68(%rbp), %rsi
xorl %edx, %edx
callq 0x2e90
leaq -0x48(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x3392
jmp 0x24b4
leaq -0x88(%rbp), %rdi
leaq -0x68(%rbp), %rsi
xorl %edx, %edx
callq 0x2e42
leaq -0x48(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x3272
jmp 0x24b4
leaq -0x88(%rbp), %rdi
leaq -0x68(%rbp), %rsi
xorl %edx, %edx
callq 0x2f30
leaq -0x48(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x35e4
leaq -0x48(%rbp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2150
movq (%r15), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x24d4
callq 0x20f0
addq $0x8, %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2070
movq -0x68(%rbp), %rdi
cmpq %r14, %rdi
je 0x24f1
callq 0x20f0
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2513
jmp 0x2513
jmp 0x2513
jmp 0x2513
jmp 0x2513
jmp 0x2513
jmp 0x2513
jmp 0x2513
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x2528
callq 0x20f0
jmp 0x2528
movq %rax, %r14
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x253a
callq 0x20f0
movq %r14, %rdi
callq 0x2180