// File: vsklad[P]cgen/commands.cpp
// Function: encode_anf(CGenAlgorithm, unsigned int, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, CGenVariableInfo, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, CGenVariableInfo>>>&, unsigned int, unsigned int, char const*, CGenOutputFormat, CGenTraceFormat, bool, bool, bool, bal::FormulaProcessingMode)
void encode_anf(const CGenAlgorithm algorithm, const uint32_t rounds,
                CGenVariablesMap& variables_map,
                const uint32_t add_max_args, const uint32_t xor_max_args,
                const char* const output_file_name,
                const CGenOutputFormat output_format, const CGenTraceFormat trace_format,
                const bool b_reindex_variables, const bool b_normalize_variables,
                const bool b_assign_after_encoding, const bal::FormulaProcessingMode mode) {    
    bal::Anf anf;
    
    switch(algorithm) {
        case algSHA1:
            encode_impl<acl::SHA1<bal::Literal<bal::Anf>>>(anf, rounds, variables_map, add_max_args, xor_max_args,
                                                       output_file_name, output_format,
                                                       b_reindex_variables, b_normalize_variables,
                                                       b_assign_after_encoding, mode);
            break;
        case algSHA256:
            encode_impl<acl::SHA256<bal::Literal<bal::Anf>>>(anf, rounds, variables_map, add_max_args, xor_max_args,
                                                         output_file_name, output_format,
                                                         b_reindex_variables, b_normalize_variables,
                                                         b_assign_after_encoding, mode);
            break;
        default:
            assert(false);
    };
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x130, %rsp            # imm = 0x130
movl %ecx, -0x114(%rbp)
movq %rdx, -0x110(%rbp)
movl %esi, %r10d
movl -0x114(%rbp), %esi
movl %edi, %r11d
movq -0x110(%rbp), %rdi
movl 0x38(%rbp), %eax
movb 0x30(%rbp), %al
movb 0x28(%rbp), %cl
movb 0x20(%rbp), %dl
movl 0x18(%rbp), %ebx
movl 0x10(%rbp), %ebx
movl %r11d, -0x14(%rbp)
movl %r10d, -0x18(%rbp)
movq %rdi, -0x20(%rbp)
movl %esi, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movq %r9, -0x30(%rbp)
andb $0x1, %dl
movb %dl, -0x31(%rbp)
andb $0x1, %cl
movb %cl, -0x32(%rbp)
andb $0x1, %al
movb %al, -0x33(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x2e5b0
movl -0x14(%rbp), %eax
movl %eax, -0x108(%rbp)
subl $0x1, %eax
je 0x2c528
jmp 0x2c514
movl -0x108(%rbp), %eax
subl $0x2, %eax
je 0x2c5a4
jmp 0x2c5fa
movl -0x18(%rbp), %esi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %r8d
movq -0x30(%rbp), %r9
movl 0x10(%rbp), %edi
movl 0x38(%rbp), %r14d
movzbl -0x31(%rbp), %r10d
movzbl -0x32(%rbp), %r11d
movzbl -0x33(%rbp), %ebx
movq %rsp, %rax
movl %r14d, 0x20(%rax)
andl $0x1, %ebx
movl %ebx, 0x18(%rax)
andl $0x1, %r11d
movl %r11d, 0x10(%rax)
andl $0x1, %r10d
movl %r10d, 0x8(%rax)
movl %edi, (%rax)
leaq -0xf8(%rbp), %rdi
callq 0x2e610
jmp 0x2c57c
jmp 0x2c619
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x30e30
jmp 0x2c631
movl -0x18(%rbp), %esi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %r8d
movq -0x30(%rbp), %r9
movl 0x10(%rbp), %edi
movl 0x38(%rbp), %r14d
movzbl -0x31(%rbp), %r10d
movzbl -0x32(%rbp), %r11d
movzbl -0x33(%rbp), %ebx
movq %rsp, %rax
movl %r14d, 0x20(%rax)
andl $0x1, %ebx
movl %ebx, 0x18(%rax)
andl $0x1, %r11d
movl %r11d, 0x10(%rax)
andl $0x1, %r10d
movl %r10d, 0x8(%rax)
movl %edi, (%rax)
leaq -0xf8(%rbp), %rdi
callq 0x2fa20
jmp 0x2c5f8
jmp 0x2c619
leaq 0x37866(%rip), %rdi     # 0x63e67
leaq 0x35e89(%rip), %rsi     # 0x62491
movl $0x23d, %edx            # imm = 0x23D
leaq 0x362d2(%rip), %rcx     # 0x628e6
callq 0xd1c0
leaq -0xf8(%rbp), %rdi
callq 0x30e30
addq $0x130, %rsp            # imm = 0x130
popq %rbx
popq %r14
popq %rbp
retq
movq -0x100(%rbp), %rdi
callq 0xd5a0
nopl (%rax)