// File: /workspace/github_cpp_makefile_star2_O2/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, 0xc(%rsp)
movq %rdi, %r14
cmpb $0x0, 0xea76(%rip)      # 0x13280
jne 0x4a76
xorl %ebp, %ebp
leaq 0x6aeb(%rip), %r15      # 0xb304
movq 0xeab8(%rip), %rcx      # 0x132d8
movq 0xeaa9(%rip), %rax      # 0x132d0
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rdx, %rbp
jae 0x48b4
movq %rbp, %r13
movq (%rax,%rbp,8), %rdi
movq %r15, %rsi
callq 0x5af6
testb %al, %al
je 0x48a9
leaq (,%r13,8), %r12
pushq $0x1
popq %rcx
movq %rcx, %rbx
leaq (%rcx,%r13), %rbp
movq 0xea76(%rip), %rcx      # 0x132d8
movq 0xea67(%rip), %rax      # 0x132d0
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %rbp
jae 0x488c
addq %r12, %rax
movq (%rax,%rbx,8), %rdi
movq %r15, %rsi
callq 0x5af6
leaq 0x1(%rbx), %rcx
testb %al, %al
jne 0x4854
cmpq $0x2, %rbx
jb 0x4819
leaq 0xea37(%rip), %rdi      # 0x132d0
movq %r13, %rsi
movq %rbp, %rdx
callq 0x3c76
jmp 0x4819
incq %r13
movq %r13, %rbp
jmp 0x4819
xorl %r13d, %r13d
leaq 0x8880(%rip), %r15      # 0xd13e
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %r13
jae 0x4957
movq (%rax,%r13,8), %rdi
movq %r15, %rsi
callq 0x5af6
testb %al, %al
je 0x493b
leaq (,%r13,8), %r12
pushq $0x1
popq %rcx
movq %rcx, %rbx
leaq (%rcx,%r13), %rbp
movq 0xe9e1(%rip), %rcx      # 0x132d8
movq 0xe9d2(%rip), %rax      # 0x132d0
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %rbp
jae 0x4921
addq %r12, %rax
movq (%rax,%rbx,8), %rdi
movq %r15, %rsi
callq 0x5af6
leaq 0x1(%rbx), %rcx
testb %al, %al
jne 0x48e9
cmpq $0x2, %rbx
jb 0x4941
leaq 0xe9a2(%rip), %rdi      # 0x132d0
movq %r13, %rsi
movq %rbp, %rdx
callq 0x3c76
jmp 0x4941
incq %r13
movq %r13, %rbp
movq 0xe990(%rip), %rcx      # 0x132d8
movq 0xe981(%rip), %rax      # 0x132d0
movq %rbp, %r13
jmp 0x48be
movq 0xe99a(%rip), %r13      # 0x132f8
subq 0xe98b(%rip), %r13      # 0x132f0
sarq $0x3, %r13
movq 0xe8b8(%rip), %rsi      # 0x13228
cmpq %rsi, %r13
ja 0x4ad8
jae 0x4a76
leaq 0xe96a(%rip), %r15      # 0x132f0
movq %r15, %rdi
callq 0x5b0a
leaq 0x10(%rsp), %r12
movq %r13, %rax
movq %rax, 0x10(%rsp)
movq 0xe886(%rip), %rsi      # 0x13228
cmpq %rsi, %rax
jae 0x49e7
movq %r15, %rdi
movq %r12, %rsi
callq 0x5b9a
movq 0x10(%rsp), %rcx
movq 0xe932(%rip), %rdx      # 0x132f0
leaq 0x1(%rcx), %rax
cmpq %rcx, (%rdx,%rcx,8)
je 0x4996
leaq 0x6990(%rip), %rdi      # 0xb35f
leaq 0x6657(%rip), %rsi      # 0xb02d
leaq 0x694c(%rip), %rcx      # 0xb329
movl $0x2d6, %edx            # imm = 0x2D6
callq 0x3160
movq 0xe90a(%rip), %rax      # 0x132f8
movq 0xe8fb(%rip), %rcx      # 0x132f0
subq %rcx, %rax
sarq $0x3, %rax
cmpq %rsi, %rax
jne 0x4af7
cmpq $0x1, %r13
adcq $0x0, %r13
leaq (%rcx,%r13,8), %rdi
movq %r13, %r8
negq %r8
movabsq $0x5deece66d, %r9       # imm = 0x5DEECE66D
leaq -0x1(%rsi), %rax
cmpq %rax, %r13
jae 0x4a76
addq %r8, %rsi
movq 0xe844(%rip), %rax      # 0x13278
imulq %r9, %rax
addq $0xb, %rax
btrq $0x31, %rax
movq %rax, 0xe830(%rip)      # 0x13278
shrq $0x10, %rax
xorl %edx, %edx
divq %rsi
leaq (%rcx,%r13,8), %rax
movq (%rdi), %rsi
movq (%rax,%rdx,8), %r10
movq %r10, (%rdi)
movq %rsi, (%rax,%rdx,8)
incq %r13
movq 0xe7bb(%rip), %rsi      # 0x13228
addq $0x8, %rdi
decq %r8
jmp 0x4a21
xorl %r15d, %r15d
movl 0xc(%rsp), %ebx
movq 0xe854(%rip), %rcx      # 0x132d8
movq 0xe845(%rip), %rax      # 0x132d0
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rdx, %r15
jae 0x4abd
movq (%rax,%r15,8), %rsi
movq %r14, %rdi
movl %ebx, %edx
callq 0x47dc
movq 0xe821(%rip), %rax      # 0x132d0
movq (%rax,%r15,8), %rdi
callq 0x3c33
incq %r15
jmp 0x4a7d
cmpq %rax, %rcx
je 0x4ac9
movq %rax, 0xe80f(%rip)      # 0x132d8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6831(%rip), %rdi      # 0xb310
leaq 0x6547(%rip), %rsi      # 0xb02d
leaq 0x683c(%rip), %rcx      # 0xb329
movl $0x2cd, %edx            # imm = 0x2CD
callq 0x3160
leaq 0x687b(%rip), %rdi      # 0xb379
leaq 0x6528(%rip), %rsi      # 0xb02d
leaq 0x681d(%rip), %rcx      # 0xb329
movl $0x2d8, %edx            # imm = 0x2D8
callq 0x3160