// File: /workspace/github_cpp_makefile_star2_O1/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 0x2f82
cmpb $0x0, 0x4(%r12)
je 0x287b
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 0x305a
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 0x30cc
movq -0x58(%rbp), %r14
testq %r14, %r14
je 0x2856
xorl %ebx, %ebx
leaq -0x78(%rbp), %r12
leaq -0x50(%rbp), %r13
movq -0x80(%rbp), %rax
movl (%rax), %eax
cmpl $0x100, %eax            # imm = 0x100
je 0x2760
cmpl $0x80, %eax
je 0x2708
cmpl $0x40, %eax
jne 0x27e7
leaq -0xa0(%rbp), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x2e46
movq %rbx, %rsi
shlq $0x5, %rsi
addq (%r15), %rsi
leaq -0xc0(%rbp), %rdi
xorl %edx, %edx
callq 0x2e46
movq -0xc0(%rbp), %rax
xorq %rax, -0xa0(%rbp)
movq %r12, %rdi
leaq -0xa0(%rbp), %rsi
callq 0x3260
jmp 0x282d
leaq -0xa0(%rbp), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x2e94
movq %rbx, %rsi
shlq $0x5, %rsi
addq (%r15), %rsi
leaq -0xc0(%rbp), %rdi
xorl %edx, %edx
callq 0x2e94
xorl %eax, %eax
movq -0xc0(%rbp,%rax,8), %rcx
xorq %rcx, -0xa0(%rbp,%rax,8)
incq %rax
cmpq $0x1, %rax
je 0x2733
movq %r12, %rdi
leaq -0xa0(%rbp), %rsi
callq 0x3378
jmp 0x282d
movq %r12, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x2ee2
movq %rbx, %rsi
shlq $0x5, %rsi
movq %r15, %r14
addq (%r15), %rsi
leaq -0xa0(%rbp), %rdi
xorl %edx, %edx
callq 0x2ee2
movq %r12, %r15
xorl %eax, %eax
movq -0xa0(%rbp,%rax,8), %rcx
xorq %rcx, -0x78(%rbp,%rax,8)
incq %rax
cmpq $0x4, %rax
jne 0x278d
leaq -0xc0(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x34a2
movq %r13, %rdi
movq %r12, %rsi
callq 0x2150
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0x27d8
callq 0x20f0
movq %r15, %r12
movq -0x58(%rbp), %rax
movq %r14, %r15
movq %rax, %r14
jmp 0x284a
leaq -0xa0(%rbp), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x2e46
movq %rbx, %rsi
shlq $0x5, %rsi
addq (%r15), %rsi
leaq -0xc0(%rbp), %rdi
xorl %edx, %edx
callq 0x2e46
movq -0xc0(%rbp), %rax
xorq %rax, -0xa0(%rbp)
movq %r12, %rdi
leaq -0xa0(%rbp), %rsi
callq 0x3260
movq %r13, %rdi
movq %r12, %rsi
callq 0x2150
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x284a
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 0x28c1
callq 0x20f0
jmp 0x28c1
movq 0x376e(%rip), %rbx      # 0x5ff0
leaq 0x177b(%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 0x373c(%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 0x28f5
jmp 0x290e
movq %rax, %rbx
jmp 0x2930
jmp 0x28f5
jmp 0x28f5
jmp 0x28f5
jmp 0x28f5
jmp 0x28f5
jmp 0x28f5
jmp 0x28f5
jmp 0x28f5
jmp 0x28f5
jmp 0x28f5
jmp 0x28f5
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2911
callq 0x20f0
jmp 0x2911
jmp 0x2917
movq %rax, %rbx
movq -0x30(%rbp), %r15
jmp 0x2930
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
movq -0x30(%rbp), %r15
je 0x2930
callq 0x20f0
movq %r15, %rdi
callq 0x300c
movq %rbx, %rdi
callq 0x2180