// File: /workspace/github_cpp_makefile_star2_O2/SMT-COMP[P]scrambler/scrambler.cpp
// Function: main
int main(int argc, char **argv)
{
    annotation_mode keep_annotations = all;

    bool create_core = false;
    std::string core_file;

    set_seed(time(0));

    for (int i = 1; i < argc; ) {
        if (strcmp(argv[i], "-seed") == 0 && i+1 < argc) {
            std::istringstream s(argv[i+1]);
            int x;
            if (s >> x && x >= 0) {
                if (x > 0) {
                    set_seed(x);
                } else {
                    no_scramble = true;
                }
            } else {
                std::cerr << "Invalid value for -seed: " << argv[i+1] << std::endl;
                return 1;
            }
            i += 2;
        } else if (strcmp(argv[i], "-term_annot") == 0 && i+1 < argc) {
            if (strcmp(argv[i+1], "true") == 0) {
                keep_annotations = all;
            } else if (strcmp(argv[i+1], "pattern") == 0) {
                keep_annotations = pattern;
            } else if (strcmp(argv[i+1], "false") == 0) {
                keep_annotations = none;
            } else {
                usage(argv[0]);
            }
            i += 2;
        } else if (strcmp(argv[i], "-core") == 0 && i+1 < argc) {
            create_core = true;
            core_file = argv[i+1];
            i += 2;
        } else if (strcmp(argv[i], "-incremental") == 0 && i + 1 < argc) {
            if (strcmp(argv[i + 1], "true") == 0) {
                gen_incremental = true;
            } else if (strcmp(argv[i + 1], "false") == 0) {
                gen_incremental = false;
            } else {
                usage(argv[0]);
            }
            i += 2;
        } else if (strcmp(argv[i], "-gen-unsat-core") == 0 && i + 1 < argc) {
            if (strcmp(argv[i + 1], "true") == 0) {
                gen_ucore = true;
            } else if (strcmp(argv[i + 1], "false") == 0) {
                gen_ucore = false;
            } else {
                usage(argv[0]);
            }
            i += 2;
        } else if (strcmp(argv[i], "-gen-model-val") == 0 && i + 1 < argc) {
            if (strcmp(argv[i + 1], "true") == 0) {
                gen_mval = true;
            } else if (strcmp(argv[i + 1], "false") == 0) {
                gen_mval = false;
            } else {
                usage(argv[0]);
            }
            i += 2;
        } else if (strcmp(argv[i], "-gen-proof") == 0 && i + 1 < argc) {
            if (strcmp(argv[i + 1], "true") == 0) {
                gen_proof = true;
            } else if (strcmp(argv[i + 1], "false") == 0) {
                gen_proof = false;
            } else {
                usage(argv[0]);
            }
            i += 2;
        } else if (strcmp(argv[i], "-support-non-smtcomp") == 0 &&
                   i + 1 < argc) {
            if (strcmp(argv[i + 1], "true") == 0) {
                support_non_smtcomp = true;
            } else if (strcmp(argv[i + 1], "false") == 0) {
                support_non_smtcomp = false;
            } else {
                usage(argv[0]);
            }
            i += 2;
        } else if (strcmp(argv[i], "-support-z3") == 0 && i + 1 < argc) {
            if (strcmp(argv[i + 1], "true") == 0) {
                support_z3 = true;
            } else if (strcmp(argv[i + 1], "false") == 0) {
                support_z3 = false;
            } else {
                usage(argv[0]);
            }
            i += 2;
        } else if (strcmp(argv[i], "-count-asserts") == 0 && i + 1 < argc) {
            if (strcmp(argv[i + 1], "true") == 0) {
                count_asrts = true;
            } else if (strcmp(argv[i + 1], "false") == 0) {
                count_asrts = false;
            } else {
                usage(argv[0]);
            }
            i += 2;
        } else {
            usage(argv[0]);
        }
    }

    StringSet core_names;
    if (create_core) {
        std::ifstream src(core_file.c_str());
        if (!parse_core(src, core_names)) {
            std::cerr << "ERROR parsing core names from " << core_file << std::endl;
            return 1;
        }
    }

    if (!gen_incremental && !count_asrts) {
        // prepend SMT-LIB command that suppresses success for non-incremental
        // tracks
        std::cout << "(set-option :print-success false)" << std::endl;
    }

    if (gen_ucore) {
        // prepend SMT-LIB command that enables production of unsat cores
        std::cout << "(set-option :produce-unsat-cores true)" << std::endl;
    }

    if (gen_mval) {
        // prepend SMT-LIB command that enables production of models
        std::cout << "(set-option :produce-models true)" << std::endl;
    }

    if (gen_proof) {
        // prepend SMT-LIB command that enables production of models
        std::cout << "(set-option :produce-proofs true)" << std::endl;
    }

    if (count_asrts) {
        while (!std::cin.eof()) {
            yyparse();
        }
        int asrt_count = 0;
        for (std::vector<scrambler::node*>::iterator it = commands.begin(); it != commands.end(); ++it) {
            if ((*it)->symbol == "assert") {
                asrt_count++;
            }
        }
        std::cerr << "; Number of assertions: " << asrt_count << "\n";
        exit(0);
    }

    while (!std::cin.eof()) {
        yyparse();
        if (!commands.empty() && commands.back()->symbol == "check-sat") {
            if (create_core) {
                filter_named(core_names);
            }
            assert(!commands.empty());
            print_scrambled(std::cout, keep_annotations);
        }
    }

    if (create_core) {
        filter_named(core_names);
    }
    if (!commands.empty()) {
        print_scrambled(std::cout, keep_annotations);
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movq %rsi, (%rsp)
movl %edi, %ebp
movq 0xdcee(%rip), %rax      # 0x12f98
addq $0x18, %rax
leaq 0x10(%rsp), %rcx
movq %rax, (%rcx)
movq $0x0, 0x18(%rsp)
xorl %edi, %edi
callq 0x31d0
cltq
movq %rax, 0xdfa9(%rip)      # 0x13278
pushq $0x1
popq %rax
pushq $0x2
popq %rbx
leaq 0x28(%rsp), %r13
movq $0x0, 0x20(%rsp)
movl %eax, %r14d
cmpl %ebp, %r14d
jge 0x5779
movslq %r14d, %rax
movq (%rsp), %rcx
movq (%rcx,%rax,8), %r12
movq %r12, %rdi
leaq 0x6673(%rip), %rsi      # 0xb977
callq 0x32f0
testl %eax, %eax
jne 0x53a1
leal 0x1(%r14), %eax
cmpl %ebp, %eax
jge 0x53a1
movq %r13, %r12
movslq %eax, %r13
movq (%rsp), %rax
movq (%rax,%r13,8), %rsi
movq %r12, %rdi
leaq 0xf(%rsp), %rdx
callq 0x3140
movl %ebx, %r15d
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
pushq $0x8
popq %rdx
callq 0x33e0
movq %r12, %rdi
callq 0x3438
movq %rbx, %rdi
movq %r12, %rbx
movq %r12, %rsi
callq 0x3130
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
sete %cl
movl 0x28(%rsp), %eax
testl %eax, %eax
setns %r12b
andb %cl, %r12b
cmpb $0x1, %r12b
jne 0x56ce
movl %eax, %eax
testq %rax, %rax
je 0x5717
movq %rax, 0xdedc(%rip)      # 0x13278
jmp 0x571e
movq %r12, %rdi
leaq 0x65ec(%rip), %rsi      # 0xb997
callq 0x32f0
testl %eax, %eax
jne 0x5418
leal 0x1(%r14), %eax
cmpl %ebp, %eax
jge 0x5418
cltq
movq (%rsp), %rcx
movq (%rcx,%rax,8), %r12
movq %r12, %rdi
leaq 0x65d3(%rip), %rsi      # 0xb9a3
callq 0x32f0
pushq $0x2
popq %rbx
testl %eax, %eax
je 0x5770
movq %r12, %rdi
leaq 0x672d(%rip), %rsi      # 0xbb17
callq 0x32f0
pushq $0x1
popq %rbx
testl %eax, %eax
je 0x5770
movq %r12, %rdi
leaq 0x65a4(%rip), %rsi      # 0xb9a8
callq 0x32f0
xorl %ebx, %ebx
testl %eax, %eax
je 0x5770
jmp 0x5990
movq %r12, %rdi
leaq 0x65a3(%rip), %rsi      # 0xb9c5
callq 0x32f0
testl %eax, %eax
jne 0x5457
leal 0x1(%r14), %eax
cmpl %ebp, %eax
jge 0x5457
cltq
movq (%rsp), %rcx
movq (%rcx,%rax,8), %rsi
leaq 0x10(%rsp), %rdi
callq 0x3300
addl $0x2, %r14d
movb $0x1, %al
movq %rax, 0x20(%rsp)
jmp 0x52e6
movq %r12, %rdi
leaq 0x654d(%rip), %rsi      # 0xb9ae
callq 0x32f0
testl %eax, %eax
jne 0x54b1
leal 0x1(%r14), %eax
cmpl %ebp, %eax
jge 0x54b1
cltq
movq (%rsp), %rcx
movq (%rcx,%rax,8), %r12
movq %r12, %rdi
leaq 0x651d(%rip), %rsi      # 0xb9a3
callq 0x32f0
testl %eax, %eax
je 0x570d
movq %r12, %rdi
leaq 0x650b(%rip), %rsi      # 0xb9a8
callq 0x32f0
testl %eax, %eax
jne 0x5990
xorl %eax, %eax
jmp 0x570f
movq %r12, %rdi
leaq 0x6500(%rip), %rsi      # 0xb9bb
callq 0x32f0
testl %eax, %eax
jne 0x550b
leal 0x1(%r14), %eax
cmpl %ebp, %eax
jge 0x550b
cltq
movq (%rsp), %rcx
movq (%rcx,%rax,8), %r12
movq %r12, %rdi
leaq 0x64c3(%rip), %rsi      # 0xb9a3
callq 0x32f0
testl %eax, %eax
je 0x5740
movq %r12, %rdi
leaq 0x64b1(%rip), %rsi      # 0xb9a8
callq 0x32f0
testl %eax, %eax
jne 0x5990
xorl %eax, %eax
jmp 0x5742
movq %r12, %rdi
leaq 0x64b6(%rip), %rsi      # 0xb9cb
callq 0x32f0
testl %eax, %eax
jne 0x5565
leal 0x1(%r14), %eax
cmpl %ebp, %eax
jge 0x5565
cltq
movq (%rsp), %rcx
movq (%rcx,%rax,8), %r12
movq %r12, %rdi
leaq 0x6469(%rip), %rsi      # 0xb9a3
callq 0x32f0
testl %eax, %eax
je 0x574a
movq %r12, %rdi
leaq 0x6457(%rip), %rsi      # 0xb9a8
callq 0x32f0
testl %eax, %eax
jne 0x5990
xorl %eax, %eax
jmp 0x574c
movq %r12, %rdi
leaq 0x646b(%rip), %rsi      # 0xb9da
callq 0x32f0
testl %eax, %eax
jne 0x55bf
leal 0x1(%r14), %eax
cmpl %ebp, %eax
jge 0x55bf
cltq
movq (%rsp), %rcx
movq (%rcx,%rax,8), %r12
movq %r12, %rdi
leaq 0x640f(%rip), %rsi      # 0xb9a3
callq 0x32f0
testl %eax, %eax
je 0x5754
movq %r12, %rdi
leaq 0x63fd(%rip), %rsi      # 0xb9a8
callq 0x32f0
testl %eax, %eax
jne 0x5990
xorl %eax, %eax
jmp 0x5756
movq %r12, %rdi
leaq 0x641c(%rip), %rsi      # 0xb9e5
callq 0x32f0
testl %eax, %eax
jne 0x5619
leal 0x1(%r14), %eax
cmpl %ebp, %eax
jge 0x5619
cltq
movq (%rsp), %rcx
movq (%rcx,%rax,8), %r12
movq %r12, %rdi
leaq 0x63b5(%rip), %rsi      # 0xb9a3
callq 0x32f0
testl %eax, %eax
je 0x575e
movq %r12, %rdi
leaq 0x63a3(%rip), %rsi      # 0xb9a8
callq 0x32f0
testl %eax, %eax
jne 0x5990
xorl %eax, %eax
jmp 0x5760
movq %r12, %rdi
leaq 0x63d7(%rip), %rsi      # 0xb9fa
callq 0x32f0
testl %eax, %eax
jne 0x5673
leal 0x1(%r14), %eax
cmpl %ebp, %eax
jge 0x5673
cltq
movq (%rsp), %rcx
movq (%rcx,%rax,8), %r12
movq %r12, %rdi
leaq 0x635b(%rip), %rsi      # 0xb9a3
callq 0x32f0
testl %eax, %eax
je 0x5768
movq %r12, %rdi
leaq 0x6349(%rip), %rsi      # 0xb9a8
callq 0x32f0
testl %eax, %eax
jne 0x5990
xorl %eax, %eax
jmp 0x576a
movq %r12, %rdi
leaq 0x6389(%rip), %rsi      # 0xba06
callq 0x32f0
testl %eax, %eax
jne 0x5990
leal 0x1(%r14), %eax
cmpl %ebp, %eax
jge 0x5990
cltq
movq (%rsp), %rcx
movq (%rcx,%rax,8), %r12
movq %r12, %rdi
leaq 0x62f9(%rip), %rsi      # 0xb9a3
callq 0x32f0
testl %eax, %eax
je 0x5703
movq %r12, %rdi
leaq 0x62eb(%rip), %rsi      # 0xb9a8
callq 0x32f0
testl %eax, %eax
jne 0x5990
xorl %eax, %eax
jmp 0x5705
movq 0xd91b(%rip), %rdi      # 0x12ff0
leaq 0x62a1(%rip), %rsi      # 0xb97d
callq 0x3210
movq (%rsp), %rcx
movq (%rcx,%r13,8), %rsi
movq %rax, %rdi
callq 0x3210
movq %rax, %rdi
callq 0x30f0
pushq $0x1
popq %rax
movq %rax, 0x18(%rsp)
jmp 0x5722
movb $0x1, %al
movb %al, 0xdb7c(%rip)       # 0x13287
jmp 0x5770
movb $0x1, %al
movb %al, 0xdb6c(%rip)       # 0x13281
jmp 0x5770
movb $0x1, 0xdb62(%rip)      # 0x13280
addl $0x2, %r14d
leaq 0x60(%rsp), %rdi
callq 0x3200
testb %r12b, %r12b
movq %rbx, %r13
movl %r15d, %ebx
jne 0x52e6
jmp 0x596f
movb $0x1, %al
movb %al, 0xdb3a(%rip)       # 0x13282
jmp 0x5770
movb $0x1, %al
movb %al, 0xdb31(%rip)       # 0x13283
jmp 0x5770
movb $0x1, %al
movb %al, 0xdb28(%rip)       # 0x13284
jmp 0x5770
movb $0x1, %al
movb %al, 0xdb1f(%rip)       # 0x13285
jmp 0x5770
movb $0x1, %al
movb %al, 0xdb16(%rip)       # 0x13286
addl $0x2, %r14d
jmp 0x52e6
leaq 0x58(%rsp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
testb $0x1, 0x20(%rsp)
je 0x580d
movq 0x10(%rsp), %rsi
leaq 0x60(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x33f0
leaq 0x60(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x4b16
movl %eax, %ebp
testb %al, %al
jne 0x57fa
movq 0xd81f(%rip), %rdi      # 0x12ff0
leaq 0x623d(%rip), %rsi      # 0xba15
callq 0x3210
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x30f0
pushq $0x1
popq %rax
movq %rax, 0x18(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x3080
testb %bpl, %bpl
je 0x5965
cmpb $0x0, 0xda6d(%rip)      # 0x13281
jne 0x583a
cmpb $0x0, 0xda6a(%rip)      # 0x13287
jne 0x583a
movq 0xd792(%rip), %rdi      # 0x12fb8
leaq 0x6207(%rip), %rsi      # 0xba34
callq 0x3210
movq %rax, %rdi
callq 0x30f0
cmpb $0x1, 0xda41(%rip)      # 0x13282
jne 0x585e
movq 0xd76e(%rip), %rdi      # 0x12fb8
leaq 0x6205(%rip), %rsi      # 0xba56
callq 0x3210
movq %rax, %rdi
callq 0x30f0
cmpb $0x1, 0xda1e(%rip)      # 0x13283
jne 0x5882
movq 0xd74a(%rip), %rdi      # 0x12fb8
leaq 0x6208(%rip), %rsi      # 0xba7d
callq 0x3210
movq %rax, %rdi
callq 0x30f0
cmpb $0x1, 0xd9fb(%rip)      # 0x13284
jne 0x58a6
movq 0xd726(%rip), %rdi      # 0x12fb8
leaq 0x6206(%rip), %rsi      # 0xba9f
callq 0x3210
movq %rax, %rdi
callq 0x30f0
cmpb $0x0, 0xd9da(%rip)      # 0x13287
jne 0x59bb
movq 0xd71e(%rip), %r13      # 0x12fd8
leaq 0x5a10(%rip), %r14      # 0xb2d1
leaq 0x28(%rsp), %r15
movq 0xd6eb(%rip), %r12      # 0x12fb8
movq (%r13), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%r13,%rax)
jne 0x592d
callq 0x78c4
movq 0xd9ef(%rip), %rax      # 0x132d8
cmpq %rax, 0xd9e0(%rip)      # 0x132d0
je 0x58cd
movq -0x8(%rax), %rdi
movq %r14, %rsi
callq 0x5af6
testb %al, %al
je 0x58cd
testb $0x1, 0x20(%rsp)
je 0x5911
movq %r15, %rdi
callq 0x4f1d
movq 0xd9b8(%rip), %rax      # 0x132d0
cmpq 0xd9b9(%rip), %rax      # 0x132d8
je 0x599c
movq %r12, %rdi
movl %ebx, %esi
callq 0x47ee
jmp 0x58cd
testb $0x1, 0x20(%rsp)
je 0x593e
leaq 0x28(%rsp), %rdi
callq 0x4f1d
movq 0xd98b(%rip), %rax      # 0x132d0
movq $0x0, 0x18(%rsp)
cmpq 0xd983(%rip), %rax      # 0x132d8
je 0x5965
movq 0xd65a(%rip), %rdi      # 0x12fb8
movl %ebx, %esi
callq 0x47ee
leaq 0x28(%rsp), %rdi
callq 0x5d84
leaq 0x10(%rsp), %rdi
callq 0x3438
movq 0x18(%rsp), %rax
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rsp), %rax
movq (%rax), %rdi
callq 0x501d
leaq 0x6137(%rip), %rdi      # 0xbada
leaq 0x5683(%rip), %rsi      # 0xb02d
leaq 0x613b(%rip), %rcx      # 0xbaec
movl $0x445, %edx            # imm = 0x445
callq 0x3160
movq 0xd616(%rip), %rbx      # 0x12fd8
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%rbx,%rax)
jne 0x59d7
callq 0x78c4
jmp 0x59c2
xorl %ebx, %ebx
movq 0xd8f0(%rip), %r15      # 0x132d0
leaq 0x7757(%rip), %r14      # 0xd13e
cmpq 0xd8ea(%rip), %r15      # 0x132d8
je 0x5a06
movq (%r15), %rdi
movq %r14, %rsi
callq 0x5af6
movzbl %al, %eax
addl %eax, %ebx
addq $0x8, %r15
jmp 0x59e7
movq 0xd5e3(%rip), %rdi      # 0x12ff0
leaq 0x60ad(%rip), %rsi      # 0xbac1
callq 0x3210
movq %rax, %rdi
movl %ebx, %esi
callq 0x3390
leaq 0x5f4b(%rip), %rsi      # 0xb975
movq %rax, %rdi
callq 0x3210
xorl %edi, %edi
callq 0x3260
jmp 0x5a77
jmp 0x5a77
jmp 0x5a77
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x3080
jmp 0x5a7a
jmp 0x5a77
jmp 0x5a72
jmp 0x5a72
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3438
jmp 0x5a84
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x3200
jmp 0x5a84
movq %rax, %rbx
jmp 0x5a84
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x5d84
leaq 0x10(%rsp), %rdi
callq 0x3438
movq %rbx, %rdi
callq 0x33c0