// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
cmpl $0x0, 0x10(%rdi)
jne 0x8d43
movq %rsi, %r15
movq %rdi, %r14
movl %edx, 0x10(%rsp)
movl (%rdi), %ebx
imulq $0x188, %rbx, %r12      # imm = 0x188
addq $0x8, %r12
movq %r12, %rdi
callq 0x5610
movq %rax, (%rsp)
movq %rbx, (%rax)
testq %rbx, %rbx
je 0x8b44
imulq $-0x188, %rbx, %rbx     # imm = 0xFE78
movl $0x8, %r13d
movq (%rsp), %rax
leaq (%rax,%r13), %rdi
callq 0x5730
leaq (%rbx,%r13), %rax
addq $0x188, %rax            # imm = 0x188
addq $0x188, %r13            # imm = 0x188
cmpq $0x8, %rax
jne 0x8b20
movq %r15, %rdi
callq 0x52e0
testl %eax, %eax
js 0x8b98
movq (%rsp), %rax
leaq 0x18(%rax), %rbp
movq %r15, %rdi
callq 0x5330
cmpl $0x0, (%r14)
je 0x8b8c
movsbl %al, %r12d
movq %rbp, %r13
xorl %ebx, %ebx
movq %r13, %rdi
movl %r12d, %esi
callq 0x5520
incq %rbx
movl (%r14), %eax
addq $0x188, %r13            # imm = 0x188
cmpq %rax, %rbx
jb 0x8b6f
movq %r15, %rdi
callq 0x52e0
testl %eax, %eax
jns 0x8b58
movl (%r14), %edi
testl %edi, %edi
setne %al
movl 0x10(%rsp), %ecx
andb %al, %cl
cmpb $0x1, %cl
jne 0x8beb
movq (%rsp), %rax
leaq 0x18(%rax), %r15
xorl %r12d, %r12d
callq 0x5700
movsbl %al, %esi
movq %r15, %rdi
callq 0x5520
movl %r12d, %edi
callq 0x5700
movsbl %al, %esi
movq %r15, %rdi
callq 0x5520
incq %r12
movl (%r14), %edi
addq $0x188, %r15            # imm = 0x188
cmpq %rdi, %r12
jb 0x8bb6
movq (%rsp), %rax
leaq 0x8(%rax), %r13
cmpl $0x0, (%r14)
je 0x8c1c
xorl %ebx, %ebx
movq %r13, %r15
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5150
incq %rbx
movl (%r14), %eax
addq $0x188, %r15            # imm = 0x188
cmpq %rax, %rbx
jb 0x8bfe
movq %r13, %rdi
callq 0x52e0
testl %eax, %eax
js 0x8cc5
leaq 0x18(%rsp), %r12
cmpl $0x0, (%r14)
je 0x8c68
xorl %ebp, %ebp
movq %r13, %r15
xorl %ebx, %ebx
movq 0x8(%r14), %rax
movq (%rax), %rdi
addq %rbp, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x5500
incq %rbx
movl (%r14), %eax
addq $0x188, %r15            # imm = 0x188
addq $0x28, %rbp
cmpq %rax, %rbx
jb 0x8c3e
movq %r13, %rdi
callq 0x52e0
testl %eax, %eax
js 0x8cb5
movl (%r14), %esi
movl $0x0, 0x14(%rsp)
movq %r12, %rdi
leaq 0x14(%rsp), %rdx
leaq 0xf(%rsp), %rcx
callq 0x53d0
movq %r14, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x5390
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x8cb5
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x5060
movq %r13, %rdi
callq 0x52e0
testl %eax, %eax
jns 0x8c31
movl $0x3, 0x10(%r14)
movq (%rsp), %rax
movq (%rax), %rax
imulq $0x188, %rax, %r14      # imm = 0x188
testq %rax, %rax
je 0x8d24
movq (%rsp), %rcx
leaq (%r14,%rcx), %r15
addq $-0x180, %r15           # imm = 0xFE80
imulq $-0x188, %rax, %rbx     # imm = 0xFE78
movq 0x62d3(%rip), %r12      # 0xefd0
movq %r15, %rdi
movq %r12, %rsi
callq 0x53b0
leaq 0x80(%r15), %rdi
callq 0x55c0
addq $-0x188, %r15           # imm = 0xFE78
addq $0x188, %rbx            # imm = 0x188
jne 0x8cfd
addq $0x8, %r14
movq (%rsp), %rdi
movq %r14, %rsi
callq 0x5590
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0x55b0
movq %rax, %rbx
leaq 0x28(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x264e(%rip), %rsi      # 0xb3ae
leaq 0x2682(%rip), %rdx      # 0xb3e9
leaq 0x18(%rsp), %rdi
callq 0x5160
movq %rbx, %rax
addq $0x10, %rax
movq %rax, (%rbx)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
movb $0x1, %bpl
movq %rbx, %rdi
callq 0x5170
xorl %ebp, %ebp
movq 0x6224(%rip), %rsi      # 0xefc0
movq 0x6215(%rip), %rdx      # 0xefb8
movq %rbx, %rdi
callq 0x5270
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x8dcd
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x5060
jmp 0x8dcd
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x8e1e
movq %rbx, %rdi
callq 0x5380
jmp 0x8e1e
movq %rax, %r14
jmp 0x8e1e
movq %rax, %r14
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x8e1e
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x5060
jmp 0x8e1e
movq %rax, %r14
cmpq $0x8, %r13
je 0x8e12
movq %r13, %rdi
movq (%rsp), %rsi
callq 0x57bc
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x5590
movq %r14, %rdi
callq 0x5680