// File: /workspace/github_cpp_makefile_star2_O3/SMT-COMP[P]scrambler/scrambler.cpp
// Function: print_scrambled(std::ostream&, annotation_mode)
void print_scrambled(std::ostream &out, annotation_mode keep_annotations)
{
    if (!no_scramble) {
        // identify consecutive declarations and shuffle them
        for (size_t i = 0; i < commands.size(); ) {
            if (commands[i]->symbol == "declare-fun") {
                size_t j = i+1;
                while (j < commands.size() &&
                       commands[j]->symbol == "declare-fun") {
                    ++j;
                }
                if (j - i > 1) {
                    shuffle_list(&commands, i, j);
                }
                i = j;
            } else {
                ++i;
            }
        }

        // identify consecutive assertions and shuffle them
        for (size_t i = 0; i < commands.size(); ) {
            if (commands[i]->symbol == "assert") {
                size_t j = i+1;
                while (j < commands.size() &&
                       commands[j]->symbol == "assert"){
                    ++j;
                }
                if (j - i > 1) {
                    shuffle_list(&commands, i, j);
                }
                i = j;
            } else {
                ++i;
            }
        }

        // Generate a random permutation of name ids. Note that index
        // 0 is unused in the permuted_name_ids vector (but present to
        // simplify indexing), and index next_name_id is out of range.
        size_t old_size = permuted_name_ids.size();
        assert(old_size <= next_name_id);
        // Since the print_scrambled function may be called multiple
        // times (for different parts of the benchmark), we only need
        // to permute those name ids that have been declared since the
        // last call to print_scrambled.
        if (old_size < next_name_id) {
            permuted_name_ids.reserve(next_name_id);
            for (size_t i = old_size; i < next_name_id; ++i) {
                permuted_name_ids.push_back(i);
                assert(permuted_name_ids[i] == i);
            }
            assert(permuted_name_ids.size() == next_name_id);
            // index 0 must not be shuffled
            if (old_size == 0) {
                old_size = 1;
            }
            // Knuth shuffle
            for (size_t i = old_size; i < next_name_id - 1; ++i) {
                size_t j = i + next_rand_int(next_name_id - i);
                std::swap(permuted_name_ids[i], permuted_name_ids[j]);
            }
        }
    }

    // print all commands
    for (size_t i = 0; i < commands.size(); ++i) {
        print_command(out, commands[i], keep_annotations);
        del_node(commands[i]);
    }
    commands.clear();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebx
movq %rdi, %r14
cmpb $0x0, 0xe40f(%rip)      # 0x132b0
jne 0x515d
movl %ebx, 0x14(%rsp)
movq 0xe456(%rip), %rcx      # 0x13308
movq 0xe447(%rip), %rax      # 0x13300
cmpq %rax, %rcx
je 0x4f65
xorl %r13d, %r13d
leaq 0x7438(%rip), %r15      # 0xc304
movq (%rax,%r13,8), %rdi
movq %r15, %rsi
callq 0x30a0
testl %eax, %eax
je 0x4ee4
incq %r13
movq %r13, %rbp
jmp 0x4f41
leaq (,%r13,8), %r12
movl $0x1, %ecx
movq %rcx, %rbx
leaq (%rcx,%r13), %rbp
movq 0xe409(%rip), %rcx      # 0x13308
movq 0xe3fa(%rip), %rax      # 0x13300
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %rbp
jae 0x4f29
addq %r12, %rax
movq (%rax,%rbx,8), %rdi
movq %r15, %rsi
callq 0x30a0
leaq 0x1(%rbx), %rcx
testl %eax, %eax
je 0x4ef1
cmpq $0x2, %rbx
jb 0x4f41
leaq 0xe3ca(%rip), %rdi      # 0x13300
movq %r13, %rsi
movq %rbp, %rdx
callq 0x416e
movq 0xe3c0(%rip), %rcx      # 0x13308
movq 0xe3b1(%rip), %rax      # 0x13300
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movq %rbp, %r13
cmpq %rdx, %rbp
jb 0x4ecc
cmpq %rax, %rcx
je 0x500e
xorl %r13d, %r13d
leaq 0x91e6(%rip), %r15      # 0xe15e
movq (%rax,%r13,8), %rdi
movq %r15, %rsi
callq 0x30a0
testl %eax, %eax
je 0x4f90
incq %r13
movq %r13, %rbp
jmp 0x4fed
leaq (,%r13,8), %r12
movl $0x1, %ecx
movq %rcx, %rbx
leaq (%rcx,%r13), %rbp
movq 0xe35d(%rip), %rcx      # 0x13308
movq 0xe34e(%rip), %rax      # 0x13300
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %rbp
jae 0x4fd5
addq %r12, %rax
movq (%rax,%rbx,8), %rdi
movq %r15, %rsi
callq 0x30a0
leaq 0x1(%rbx), %rcx
testl %eax, %eax
je 0x4f9d
cmpq $0x2, %rbx
jb 0x4fed
leaq 0xe31e(%rip), %rdi      # 0x13300
movq %r13, %rsi
movq %rbp, %rdx
callq 0x416e
movq 0xe314(%rip), %rcx      # 0x13308
movq 0xe305(%rip), %rax      # 0x13300
subq %rax, %rcx
sarq $0x3, %rcx
movq %rbp, %r13
cmpq %rcx, %rbp
jb 0x4f78
movq 0xe313(%rip), %r13      # 0x13328
subq 0xe304(%rip), %r13      # 0x13320
sarq $0x3, %r13
movq 0xe231(%rip), %rsi      # 0x13258
cmpq %rsi, %r13
ja 0x51eb
movl 0x14(%rsp), %ebx
jae 0x515d
leaq 0xe2df(%rip), %rdi      # 0x13320
callq 0x64f4
movq %r13, 0x8(%rsp)
movq 0xe206(%rip), %rdi      # 0x13258
movq 0xe2cf(%rip), %rsi      # 0x13328
cmpq %rdi, %r13
jae 0x50ce
movq 0xe2cb(%rip), %rax      # 0x13330
leaq 0xe2b4(%rip), %r15      # 0x13320
leaq 0x8(%rsp), %r12
movq %r13, %rdx
cmpq %rax, %rsi
je 0x5089
movq %rdx, (%rsi)
addq $0x8, %rsi
movq %rsi, 0xe2a1(%rip)      # 0x13328
jmp 0x50a2
movq %r15, %rdi
movq %r12, %rdx
callq 0x7080
movq 0xe28d(%rip), %rsi      # 0x13328
movq 0xe28e(%rip), %rax      # 0x13330
movq 0x8(%rsp), %rdx
movq 0xe272(%rip), %rcx      # 0x13320
cmpq %rdx, (%rcx,%rdx,8)
jne 0x51cc
incq %rdx
movq %rdx, 0x8(%rsp)
movq 0xe191(%rip), %rdi      # 0x13258
cmpq %rdi, %rdx
jb 0x5074
jmp 0x50d5
movq 0xe24b(%rip), %rcx      # 0x13320
subq %rcx, %rsi
sarq $0x3, %rsi
cmpq %rdi, %rsi
jne 0x520a
cmpq $0x1, %r13
adcq $0x0, %r13
leaq -0x1(%rdi), %rax
cmpq %rax, %r13
jae 0x515d
movq %r13, %rsi
negq %rsi
leaq (%rcx,%r13,8), %r8
movabsq $0x5deece66d, %r9       # imm = 0x5DEECE66D
addq %rsi, %rdi
movq 0xe194(%rip), %rax      # 0x132a8
imulq %r9, %rax
addq $0xb, %rax
btrq $0x31, %rax
movq %rax, 0xe180(%rip)      # 0x132a8
shrq $0x10, %rax
xorl %edx, %edx
divq %rdi
leaq (%rcx,%r13,8), %rax
movq (%r8), %rdi
movq (%rax,%rdx,8), %r10
movq %r10, (%r8)
movq %rdi, (%rax,%rdx,8)
incq %r13
movq 0xe10b(%rip), %rdi      # 0x13258
leaq -0x1(%rdi), %rax
decq %rsi
addq $0x8, %r8
cmpq %rax, %r13
jb 0x510a
movq 0xe1a4(%rip), %rcx      # 0x13308
movq 0xe195(%rip), %rax      # 0x13300
cmpq %rax, %rcx
je 0x51b1
xorl %r15d, %r15d
movq (%rax,%r15,8), %rsi
movq %r14, %rdi
movl %ebx, %edx
callq 0x4e56
movq 0xe178(%rip), %rax      # 0x13300
movq (%rax,%r15,8), %rdi
callq 0x410f
incq %r15
movq 0xe16d(%rip), %rcx      # 0x13308
movq 0xe15e(%rip), %rax      # 0x13300
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rdx, %r15
jb 0x5173
cmpq %rax, %rcx
je 0x51bd
movq %rax, 0xe14b(%rip)      # 0x13308
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x718c(%rip), %rdi      # 0xc35f
leaq 0x6e53(%rip), %rsi      # 0xc02d
leaq 0x7148(%rip), %rcx      # 0xc329
movl $0x2d6, %edx            # imm = 0x2D6
callq 0x31a0
leaq 0x711e(%rip), %rdi      # 0xc310
leaq 0x6e34(%rip), %rsi      # 0xc02d
leaq 0x7129(%rip), %rcx      # 0xc329
movl $0x2cd, %edx            # imm = 0x2CD
callq 0x31a0
leaq 0x7168(%rip), %rdi      # 0xc379
leaq 0x6e15(%rip), %rsi      # 0xc02d
leaq 0x710a(%rip), %rcx      # 0xc329
movl $0x2d8, %edx            # imm = 0x2D8
callq 0x31a0