// File: /workspace/github_cpp_makefile_star2_O3/rupc[P]xor-secret-sharing-scheme/main.cpp
// Function: XORSecretShares::split[abi:cxx11](unsigned long)
std::vector<std::string> XORSecretShares::split(size_t n) {
    std::vector<std::string> shadows(n);

    if (_init == false) {
        std::cerr << "ERROR" << std::endl;
        return shadows;
    }

    for (int i = 0; i < n - 1; i++) {
        std::string randSecret(key_size, '0');
        for (int j = 0; j < key_size; j++) {
            randSecret[j] = std::to_string(rand() % 2)[0];
        }
        shadows[i] = randSecret;
    }

    std::string last_secret = this->secret;

    for (int i = 0; i < n - 1; i++) {
        switch (key_size) {
            case 64: {
                std::bitset<64> _last_secret_64(last_secret);
                std::bitset<64> _secret_64(shadows[i]);
                last_secret = (_last_secret_64^=_secret_64).to_string();
            }
                break;
            case 128: {
                std::bitset<128> _last_secret_128(last_secret);
                std::bitset<128> _secret_128(shadows[i]);
                last_secret = (_last_secret_128^=_secret_128).to_string();
            }
                break;
            case 256: {
                std::bitset<256> _last_secret_256(last_secret);
                std::bitset<256> _secret_256(shadows[i]);
                last_secret = (_last_secret_256^=_secret_256).to_string();
            }
                break;
            default: {
                std::bitset<64> _last_secret_64(last_secret);
                std::bitset<64> _secret_64(shadows[i]);
                last_secret = (_last_secret_64^=_secret_64).to_string();
            }
                break;
        }
    }

    shadows[shadows.size() - 1] = last_secret;

    return shadows;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r15
leaq -0x50(%rbp), %rdx
movq %rbx, %rsi
callq 0x2f7e
cmpb $0x0, 0x4(%r12)
je 0x287c
decq %rbx
movq %rbx, -0x58(%rbp)
movq %r15, -0x30(%rbp)
movq %r12, -0x80(%rbp)
je 0x2667
leaq -0x68(%rbp), %r14
xorl %ebx, %ebx
leaq -0x78(%rbp), %r13
movq %rbx, -0xc8(%rbp)
movslq (%r12), %rsi
leaq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq -0x50(%rbp), %rdi
movl $0x30, %edx
callq 0x2140
cmpl $0x0, (%r12)
jle 0x262a
xorl %r15d, %r15d
callq 0x2040
movl %eax, %ebx
movl %eax, %r12d
shrl $0x1f, %r12d
andl %eax, %r12d
leal 0x1(%r12), %esi
movq %r14, -0x78(%rbp)
movq %r13, %rdi
movl $0x2d, %edx
callq 0x2140
andl $0x1, %ebx
movl %r12d, %edi
addq -0x78(%rbp), %rdi
movl $0x1, %esi
movl %ebx, %edx
callq 0x3062
movq -0x78(%rbp), %rax
movb (%rax), %al
movq -0x50(%rbp), %rcx
movb %al, (%rcx,%r15)
movq -0x78(%rbp), %rdi
cmpq %r14, %rdi
je 0x261a
callq 0x20f0
incq %r15
movq -0x80(%rbp), %r12
movslq (%r12), %rax
cmpq %rax, %r15
jl 0x25c1
movq -0xc8(%rbp), %rbx
movq %rbx, %rdi
shlq $0x5, %rdi
movq -0x30(%rbp), %r15
addq (%r15), %rdi
leaq -0x50(%rbp), %rsi
callq 0x2070
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x265a
callq 0x20f0
incq %rbx
cmpq -0x58(%rbp), %rbx
jne 0x2596
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
movq 0x8(%r12), %rsi
movq 0x10(%r12), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %rdi
callq 0x30d4
movq -0x58(%rbp), %r14
testq %r14, %r14
je 0x2857
xorl %ebx, %ebx
leaq -0x78(%rbp), %r12
leaq -0x50(%rbp), %r13
movq -0x80(%rbp), %rax
movl (%rax), %eax
cmpl $0x100, %eax            # imm = 0x100
je 0x2761
cmpl $0x80, %eax
je 0x2708
cmpl $0x40, %eax
jne 0x27e8
leaq -0xa0(%rbp), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x2e42
movq %rbx, %rsi
shlq $0x5, %rsi
addq (%r15), %rsi
leaq -0xc0(%rbp), %rdi
xorl %edx, %edx
callq 0x2e42
movq -0xc0(%rbp), %rax
xorq %rax, -0xa0(%rbp)
movq %r12, %rdi
leaq -0xa0(%rbp), %rsi
callq 0x3272
jmp 0x282e
leaq -0xa0(%rbp), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x2e90
movq %rbx, %rsi
shlq $0x5, %rsi
addq (%r15), %rsi
leaq -0xc0(%rbp), %rdi
xorl %edx, %edx
callq 0x2e90
movq -0xc0(%rbp), %rax
xorq %rax, -0xa0(%rbp)
movq -0xb8(%rbp), %rax
xorq %rax, -0x98(%rbp)
movq %r12, %rdi
leaq -0xa0(%rbp), %rsi
callq 0x3392
jmp 0x282e
movq %r12, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x2ede
movq %rbx, %rsi
shlq $0x5, %rsi
movq %r15, %r14
addq (%r15), %rsi
leaq -0xa0(%rbp), %rdi
xorl %edx, %edx
callq 0x2ede
movq %r12, %r15
xorl %eax, %eax
movq -0xa0(%rbp,%rax,8), %rcx
xorq %rcx, -0x78(%rbp,%rax,8)
incq %rax
cmpq $0x4, %rax
jne 0x278e
leaq -0xc0(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x34c4
movq %r13, %rdi
movq %r12, %rsi
callq 0x2150
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0x27d9
callq 0x20f0
movq %r15, %r12
movq -0x58(%rbp), %rax
movq %r14, %r15
movq %rax, %r14
jmp 0x284b
leaq -0xa0(%rbp), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x2e42
movq %rbx, %rsi
shlq $0x5, %rsi
addq (%r15), %rsi
leaq -0xc0(%rbp), %rdi
xorl %edx, %edx
callq 0x2e42
movq -0xc0(%rbp), %rax
xorq %rax, -0xa0(%rbp)
movq %r12, %rdi
leaq -0xa0(%rbp), %rsi
callq 0x3272
movq %r13, %rdi
movq %r12, %rsi
callq 0x2150
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x284b
callq 0x20f0
incq %rbx
cmpq %r14, %rbx
jne 0x269c
movq 0x8(%r15), %rdi
addq $-0x20, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2070
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x28c2
callq 0x20f0
jmp 0x28c2
movq 0x376d(%rip), %rbx      # 0x5ff0
leaq 0x177a(%rip), %rsi      # 0x4004
movl $0x5, %edx
movq %rbx, %rdi
callq 0x2130
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2110
movsbl %al, %esi
movq 0x373b(%rip), %rdi      # 0x5ff0
callq 0x2030
movq %rax, %rdi
callq 0x2090
movq %r15, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x28f6
jmp 0x290f
movq %rax, %rbx
jmp 0x2931
jmp 0x28f6
jmp 0x28f6
jmp 0x28f6
jmp 0x28f6
jmp 0x28f6
jmp 0x28f6
jmp 0x28f6
jmp 0x28f6
jmp 0x28f6
jmp 0x28f6
jmp 0x28f6
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2912
callq 0x20f0
jmp 0x2912
jmp 0x2918
movq %rax, %rbx
movq -0x30(%rbp), %r15
jmp 0x2931
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
movq -0x30(%rbp), %r15
je 0x2931
callq 0x20f0
movq %r15, %rdi
callq 0x300a
movq %rbx, %rdi
callq 0x2180