// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/riverkeyakv2/ref/Motorist.cpp
// Function: Engine::InjectCollective(std::istream&, bool)
void Engine::InjectCollective(istream& X, bool diversifyFlag)
{
    if (phase != fresh)
        throw Exception("The phase must be fresh to call Engine::InjectCollective().");
    stringstream *Xt = new stringstream[Pi];
    while(hasMore(X)) {
        UINT8 x = X.get();
        for(unsigned int i=0; i<Pi; i++)
            Xt[i].put(x);
    }
    if (diversifyFlag) {
        for(unsigned int i=0; i<Pi; i++) {
            Xt[i].put(enc8(Pi));
            Xt[i].put(enc8(i));
        }
    }
    for(unsigned int i=0; i<Pi; i++)
        Xt[i].seekg(0, ios_base::beg);
    while(hasMore(Xt[0])) {
        for(unsigned int i=0; i<Pi; i++)
            Pistons[i].Inject(Xt[i], 0);
        if (hasMore(Xt[0]))
            Spark(false, vector<unsigned int>(Pi, 0));
    }
    phase = endOfMessage;
    delete[] Xt;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, 0x14(%rsp)
cmpl $0x0, 0x10(%rdi)
jne 0x96ca
movq %rsi, %r12
movq %rdi, %r14
movl (%rdi), %ebx
imulq $0x188, %rbx, %rdi      # imm = 0x188
addq $0x8, %rdi
movq %rdi, 0x20(%rsp)
callq 0x68f0
leaq 0x8(%rax), %rcx
movq %rcx, 0x18(%rsp)
movq %rax, 0x8(%rsp)
movq %rbx, (%rax)
testq %rbx, %rbx
je 0x9534
imulq $-0x188, %rbx, %r13     # imm = 0xFE78
xorl %ebp, %ebp
movq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0x6a50
addq $-0x188, %rbp           # imm = 0xFE78
addq $0x188, %r15            # imm = 0x188
cmpq %rbp, %r13
jne 0x9519
movq 0x8(%rsp), %rax
leaq 0x18(%rax), %rbp
movq %r12, %rdi
callq 0x6100
testb %al, %al
je 0x9579
movq %r12, %rdi
callq 0x64d0
movsbl %al, %r15d
movq %rbp, %r13
xorl %ebx, %ebx
movl (%r14), %eax
cmpq %rax, %rbx
jae 0x953d
movq %r13, %rdi
movl %r15d, %esi
callq 0x6790
incq %rbx
addq $0x188, %r13            # imm = 0x188
jmp 0x955a
cmpb $0x0, 0x14(%rsp)
movq 0x18(%rsp), %rbx
je 0x95c8
movq 0x8(%rsp), %rax
leaq 0x18(%rax), %r12
xorl %r13d, %r13d
movl (%r14), %edi
cmpq %rdi, %r13
jae 0x95c8
callq 0x6a30
movsbl %al, %esi
movq %r12, %rdi
callq 0x6790
movl %r13d, %edi
callq 0x6a30
movsbl %al, %esi
movq %r12, %rdi
callq 0x6790
incq %r13
addq $0x188, %r12            # imm = 0x188
jmp 0x9591
xorl %r12d, %r12d
movq %rbx, %r15
movl (%r14), %eax
cmpq %rax, %r12
jae 0x95ee
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x6210
incq %r12
addq $0x188, %r15            # imm = 0x188
jmp 0x95ce
leaq 0x28(%rsp), %r12
movq %rbx, %rdi
callq 0x6100
testb %al, %al
je 0x9670
xorl %r13d, %r13d
movq %rbx, %r15
xorl %ebp, %ebp
movl (%r14), %eax
cmpq %rax, %rbp
jae 0x9633
movq 0x8(%r14), %rax
movq (%rax), %rdi
addq %r13, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x6760
incq %rbp
addq $0x188, %r15            # imm = 0x188
addq $0x28, %r13
jmp 0x9607
movq %rbx, %rdi
callq 0x6100
testb %al, %al
je 0x95f3
movl (%r14), %esi
andl $0x0, 0x10(%rsp)
movq %r12, %rdi
leaq 0x10(%rsp), %rdx
leaq 0x7(%rsp), %rcx
callq 0x6570
movq %r14, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x6530
movq %r12, %rdi
callq 0x62d0
jmp 0x95f3
movl $0x3, 0x10(%r14)
movq 0x8(%rsp), %r12
movq (%r12), %rax
imulq $0x188, %rax, %rbx      # imm = 0x188
testq %rax, %rax
je 0x96ac
movq %r12, %r14
addq $-0x180, %r14           # imm = 0xFE80
movq %rbx, %r15
leaq (%r14,%r15), %rdi
callq 0x6a70
addq $-0x188, %r15           # imm = 0xFE78
jne 0x969a
addq $0x8, %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x6870
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x20
popq %rdi
callq 0x6890
movq %rax, %rbx
leaq 0x1c4a(%rip), %rsi      # 0xb326
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x6950
movb $0x1, %bpl
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x6460
xorl %ebp, %ebp
movq 0x58c4(%rip), %rsi      # 0xefc8
movq 0x58b5(%rip), %rdx      # 0xefc0
movq %rbx, %rdi
callq 0x6390
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x65b0
testb %bpl, %bpl
jne 0x972a
jmp 0x9780
movq %rax, %r14
movq %rbx, %rdi
callq 0x6520
jmp 0x9780
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x62d0
jmp 0x9780
movq %rax, %r14
jmp 0x9780
movq %rax, %r14
testq %rbp, %rbp
je 0x9771
negq %rbp
movq 0x8(%rsp), %rbx
addq $-0x180, %rbx           # imm = 0xFE80
leaq (%rbx,%rbp), %rdi
callq 0x6a70
addq $-0x188, %rbp           # imm = 0xFE78
jne 0x975f
movq 0x8(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x6870
movq %r14, %rdi
callq 0x6980