// File: /workspace/github_cpp_makefile_star2_O2/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 $0x98, %rsp
movq %rdx, %r14
movq %rsi, %r15
leaq -0x50(%rbp), %rdx
movq %rdi, -0x30(%rbp)
movq %r14, %rsi
callq 0x2d3a
cmpb $0x0, 0x4(%r15)
je 0x2756
decq %r14
xorl %r13d, %r13d
pushq $0x2
popq %r12
leaq -0xb8(%rbp), %rbx
movq %r14, -0x78(%rbp)
cmpq %r14, %r13
je 0x2590
movslq (%r15), %rsi
leaq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq -0x50(%rbp), %rdi
pushq $0x30
popq %rdx
callq 0x2150
xorl %r14d, %r14d
movslq (%r15), %rax
cmpq %rax, %r14
jge 0x2562
callq 0x2030
cltd
idivl %r12d
movq %rbx, %rdi
movl %edx, %esi
callq 0x2bd1
movq -0xb8(%rbp), %rax
movb (%rax), %al
movq -0x50(%rbp), %rcx
movb %al, (%rcx,%r14)
movq %rbx, %rdi
callq 0x2080
incq %r14
jmp 0x2529
movq %r13, %rdi
shlq $0x5, %rdi
movq -0x30(%rbp), %rax
addq (%rax), %rdi
leaq -0x50(%rbp), %r14
movq %r14, %rsi
callq 0x20b0
movq %r14, %rdi
callq 0x2080
incq %r13
movq -0x78(%rbp), %r14
jmp 0x2506
leaq 0x8(%r15), %rsi
leaq -0x50(%rbp), %rdi
callq 0x2170
xorl %ebx, %ebx
leaq -0xb8(%rbp), %r13
subq $0x1, %r14
jb 0x2736
movl (%r15), %eax
cmpl $0x100, %eax            # imm = 0x100
je 0x2675
cmpl $0x80, %eax
je 0x2611
cmpl $0x40, %eax
jne 0x26db
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x2c32
movq -0x30(%rbp), %rax
movq (%rax), %rsi
addq %rbx, %rsi
leaq -0x98(%rbp), %rdi
xorl %edx, %edx
callq 0x2c32
movq -0x98(%rbp), %rax
xorq %rax, -0x70(%rbp)
movq %r13, %rdi
leaq -0x70(%rbp), %rsi
callq 0x2f16
jmp 0x2719
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x2c72
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq %rbx, %r12
addq %rbx, %rsi
leaq -0x98(%rbp), %r13
movq %r13, %rdi
xorl %edx, %edx
callq 0x2c72
leaq -0x70(%rbp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x34b4
leaq -0xb8(%rbp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x306a
leaq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0x2160
movq %r13, %rdi
callq 0x2080
jmp 0x26d6
movq %r13, %rdi
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x2cb4
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq %rbx, %r12
addq %rbx, %rsi
leaq -0x70(%rbp), %rbx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2cb4
movq %r13, %rdi
movq %rbx, %rsi
callq 0x34d0
movq %r13, %rsi
leaq -0x98(%rbp), %r13
movq %r13, %rdi
callq 0x31cc
leaq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0x2160
movq %r13, %rdi
callq 0x2080
leaq -0xb8(%rbp), %r13
movq %r12, %rbx
jmp 0x272d
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x2c32
movq -0x30(%rbp), %rax
movq (%rax), %rsi
addq %rbx, %rsi
leaq -0x98(%rbp), %rdi
xorl %edx, %edx
callq 0x2c32
movq -0x98(%rbp), %rax
xorq %rax, -0x70(%rbp)
movq %r13, %rdi
leaq -0x70(%rbp), %rsi
callq 0x2f16
leaq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0x2160
movq %r13, %rdi
callq 0x2080
addq $0x20, %rbx
jmp 0x25a6
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
addq $-0x20, %rdi
leaq -0x50(%rbp), %rsi
callq 0x20b0
leaq -0x50(%rbp), %rdi
callq 0x2080
jmp 0x2771
movq 0x3893(%rip), %rdi      # 0x5ff0
leaq 0x18a0(%rip), %rsi      # 0x4004
callq 0x2130
movq %rax, %rdi
callq 0x2090
movq -0x30(%rbp), %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x27ac
jmp 0x27a7
jmp 0x27a7
jmp 0x27ac
jmp 0x27ac
jmp 0x27ac
jmp 0x27ac
jmp 0x27ac
jmp 0x27ac
jmp 0x27ac
jmp 0x27ac
jmp 0x27ac
jmp 0x27ac
jmp 0x27ac
jmp 0x27ac
jmp 0x27ac
movq %rax, %r14
jmp 0x27b8
movq %rax, %r14
leaq -0x50(%rbp), %rdi
callq 0x2080
movq -0x30(%rbp), %rdi
callq 0x2d8c
movq %r14, %rdi
callq 0x21b0