// File: /workspace/github_c_makefile_star2_O3/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 0x8ca3
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 0x5600
movq %rax, (%rsp)
movq %rbx, (%rax)
testq %rbx, %rbx
je 0x8aa6
imulq $-0x188, %rbx, %rbx     # imm = 0xFE78
movl $0x8, %r13d
movq (%rsp), %rax
leaq (%rax,%r13), %rdi
callq 0x5720
leaq (%rbx,%r13), %rax
addq $0x188, %rax            # imm = 0x188
addq $0x188, %r13            # imm = 0x188
cmpq $0x8, %rax
jne 0x8a82
movq %r15, %rdi
callq 0x52e0
testl %eax, %eax
js 0x8afa
movq (%rsp), %rax
leaq 0x18(%rax), %rbp
movq %r15, %rdi
callq 0x5330
cmpl $0x0, (%r14)
je 0x8aee
movsbl %al, %r12d
movq %rbp, %r13
xorl %ebx, %ebx
movq %r13, %rdi
movl %r12d, %esi
callq 0x5510
incq %rbx
movl (%r14), %eax
addq $0x188, %r13            # imm = 0x188
cmpq %rax, %rbx
jb 0x8ad1
movq %r15, %rdi
callq 0x52e0
testl %eax, %eax
jns 0x8aba
movl (%r14), %edi
testl %edi, %edi
setne %al
movl 0x10(%rsp), %ecx
andb %al, %cl
cmpb $0x1, %cl
jne 0x8b4d
movq (%rsp), %rax
leaq 0x18(%rax), %r15
xorl %r12d, %r12d
callq 0x56f0
movsbl %al, %esi
movq %r15, %rdi
callq 0x5510
movl %r12d, %edi
callq 0x56f0
movsbl %al, %esi
movq %r15, %rdi
callq 0x5510
incq %r12
movl (%r14), %edi
addq $0x188, %r15            # imm = 0x188
cmpq %rdi, %r12
jb 0x8b18
movq (%rsp), %rax
leaq 0x8(%rax), %r13
testl %edi, %edi
je 0x8b7c
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 0x8b5e
movq %r13, %rdi
callq 0x52e0
testl %eax, %eax
js 0x8c25
leaq 0x18(%rsp), %r12
cmpl $0x0, (%r14)
je 0x8bc8
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 0x54f0
incq %rbx
movl (%r14), %eax
addq $0x188, %r15            # imm = 0x188
addq $0x28, %rbp
cmpq %rax, %rbx
jb 0x8b9e
movq %r13, %rdi
callq 0x52e0
testl %eax, %eax
js 0x8c15
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 0x8c15
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x5060
movq %r13, %rdi
callq 0x52e0
testl %eax, %eax
jns 0x8b91
movl $0x3, 0x10(%r14)
movq (%rsp), %rax
movq (%rax), %rax
imulq $0x188, %rax, %r14      # imm = 0x188
testq %rax, %rax
je 0x8c84
movq (%rsp), %rcx
leaq (%r14,%rcx), %r15
addq $-0x180, %r15           # imm = 0xFE80
imulq $-0x188, %rax, %rbx     # imm = 0xFE78
movq 0x6373(%rip), %r12      # 0xefd0
movq %r15, %rdi
movq %r12, %rsi
callq 0x53b0
leaq 0x80(%r15), %rdi
callq 0x55b0
addq $-0x188, %r15           # imm = 0xFE78
addq $0x188, %rbx            # imm = 0x188
jne 0x8c5d
addq $0x8, %r14
movq (%rsp), %rdi
movq %r14, %rsi
callq 0x5580
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0x55a0
movq %rax, %rbx
leaq 0x28(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x26ca(%rip), %rsi      # 0xb38a
leaq 0x26fe(%rip), %rdx      # 0xb3c5
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 0x62c4(%rip), %rsi      # 0xefc0
movq 0x62b5(%rip), %rdx      # 0xefb8
movq %rbx, %rdi
callq 0x5270
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x8d25
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x5060
testb %bpl, %bpl
jne 0x8d2f
jmp 0x8d7b
movq %rax, %r14
movq %rbx, %rdi
callq 0x5380
jmp 0x8d7b
movq %rax, %r14
jmp 0x8d7b
movq %rax, %r14
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x8d7b
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x5060
jmp 0x8d7b
movq %rax, %r14
cmpq $0x8, %r13
je 0x8d6f
movq %r13, %rdi
movq (%rsp), %rsi
callq 0x57ac
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x5580
movq %r14, %rdi
callq 0x5670