// File: /workspace/github_cpp_makefile_star2_O3/pointwiseproduct[P]untyped_lambda/untyped_lambda.cpp
// Function: internal_data::lo_most_reduction(std::unique_ptr<internal_data::expr, std::default_delete<internal_data::expr>>&)
bool lo_most_reduction(std::unique_ptr<expr> &e){
        if(e->get_kind() == expr::kind::sequence){
            sequence *seq = static_cast<sequence*>(e.get());
            if(seq->vec.size() == 1){
                e.swap(seq->vec[0]);
                return true;
            }else{
                bool mod = false;
                seq->vec[0].reset(seq->vec[0]->replace(expr::variable_map(), assignment_table, mod));
                if(seq->vec[0]->get_kind() == expr::kind::lambda){
                    lambda &lam = *static_cast<lambda*>(seq->vec[0].get());
                    std::size_t s = (std::min)(lam.variable_seq.size(), seq->vec.size() - 1);
                    expr::variable_map map;
                    if(lam.variable_seq.size() <= s){
                        for(std::size_t i = 0; i < lam.variable_seq.size(); ++i){
                            map.insert(std::make_pair(lam.variable_seq[i].str, seq->vec[i + 1].get()));
                        }
                        {
                            expr *f = lam.seq->replace(map, assignment_table, mod);
                            seq->vec.erase(seq->vec.begin(), seq->vec.begin() + s + 1);
                            seq->vec.insert(seq->vec.begin(), std::move(std::unique_ptr<expr>(f)));
                        }
                        if(seq->vec.size() > 1){
                            return true;
                        }else{
                            std::unique_ptr<expr> f(std::move(*seq->vec.begin()));
                            *seq->vec.begin() = nullptr;
                            e.swap(f);
                            return true;
                        }
                    }else{
                        if(s > 0){
                            for(std::size_t i = 0; i < s; ++i){
                                map.insert(std::make_pair(lam.variable_seq[i].str, seq->vec[i + 1].get()));
                            }
                            std::unique_ptr<expr> f(lam.seq->replace(map, assignment_table, mod));
                            if(f->get_kind() == expr::kind::sequence){
                                lam.seq.swap(f);
                            }else{
                                lam.get_seq()->vec.clear();
                                lam.get_seq()->vec.push_back(std::move(f));
                            }
                            lam.variable_seq.erase(lam.variable_seq.begin(), lam.variable_seq.begin() + s);
                        }
                        e.swap(seq->vec[0]);
                        return true;
                    }
                }else{
                    if(seq->vec[0]->get_kind() == expr::kind::variable){
                        return lo_most_reduction(seq->vec[0]);
                    }else{
                        return lo_most_reduction(seq->vec[0]);
                    }
                }
            }
        }else if(e->get_kind() == expr::kind::lambda){
            return lo_most_reduction(static_cast<lambda*>(e.get())->seq);
        }else if(e->get_kind() == expr::kind::variable){
            variable *var = static_cast<variable*>(e.get());
            auto iter = assignment_table.find(var->str);
            if(iter != assignment_table.end()){
                e.reset(iter->second->copy());
                return true;
            }else{
                return false;
            }
        }

        // unreached point.
        return false;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %r14
movq (%rdi), %rdi
movq (%rdi), %rax
callq *(%rax)
cmpl $0x1, %eax
jne 0x40eb
movq %r14, %rbx
jmp 0x4114
movq (%r14), %rdi
movq (%rdi), %rax
callq *(%rax)
movq (%r14), %rbx
cmpl $0x2, %eax
jne 0x42e5
movq 0x20(%rbx), %rdi
addq $0x20, %rbx
movq (%rdi), %rax
callq *(%rax)
movq %rbx, %r14
cmpl $0x1, %eax
jne 0x40eb
movq (%rbx), %rbp
movq 0x8(%rbp), %r14
movq 0x10(%rbp), %rax
subq %r14, %rax
cmpq $0x8, %rax
jne 0x4136
movq (%r14), %rax
movq %rax, (%rbx)
movq %rbp, (%r14)
jmp 0x452a
leaq 0xf(%rsp), %rcx
movb $0x0, (%rcx)
movq (%r14), %rdi
leaq 0x58(%rsp), %r12
xorl %eax, %eax
movq %rax, 0x8(%r12)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r12)
movq %r12, 0x10(%r12)
movq %r12, 0x18(%r12)
movq %rax, 0x20(%r12)
movq (%rdi), %rax
leaq 0xb0e1(%rip), %rdx      # 0xf250
leaq 0x50(%rsp), %rsi
callq *0x10(%rax)
leaq 0x8(%rbp), %r15
movq (%r14), %rdi
movq %rax, (%r14)
testq %rdi, %rdi
je 0x418c
movq (%rdi), %rax
callq *0x38(%rax)
leaq 0x50(%rsp), %rdi
callq 0x687a
movq (%r15), %rax
movq (%rax), %rdi
movq (%rdi), %rax
callq *(%rax)
movq (%r15), %rsi
movq (%rsi), %r13
cmpl $0x2, %eax
jne 0x42f8
movq 0x8(%r13), %rax
movq 0x10(%r13), %rcx
movq %rcx, %rdi
subq %rax, %rdi
sarq $0x3, %rdi
movabsq $-0x3333333333333333, %rdx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rdx, %rdi
movq 0x10(%rbp), %rdx
subq %rsi, %rdx
sarq $0x3, %rdx
decq %rdx
xorl %esi, %esi
movl $0x0, 0x58(%rsp)
movq %rsi, 0x60(%rsp)
movq %r12, 0x68(%rsp)
movq %r12, 0x70(%rsp)
movq %rsi, 0x78(%rsp)
cmpq %rdi, %rdx
cmovbq %rdx, %rdi
movq %rdi, 0x48(%rsp)
movq %r13, 0x40(%rsp)
jae 0x4355
testq %rdx, %rdx
je 0x4511
leaq 0x8(%r13), %rax
movq %rax, 0x10(%rsp)
movl $0x2, %ebp
xorl %r12d, %r12d
leaq 0x18(%rsp), %r13
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %r15, %r14
movq (%r15), %rcx
movq 0x8(%rcx,%r12,8), %r15
leaq 0x28(%rsp), %rcx
movq %rcx, 0x18(%rsp)
movq -0x8(%rax,%rbp,8), %rsi
movq (%rax,%rbp,8), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x68f6
movq %r15, 0x38(%rsp)
leaq 0x50(%rsp), %rdi
movq %r13, %rsi
callq 0x8624
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
movq %r14, %r15
je 0x428c
callq 0x31f0
incq %r12
addq $0x5, %rbp
cmpq %r12, 0x48(%rsp)
jne 0x4232
movq 0x40(%rsp), %r14
movq 0x20(%r14), %rdi
movq (%rdi), %rax
leaq 0xafa3(%rip), %rdx      # 0xf250
leaq 0x50(%rsp), %rsi
leaq 0xf(%rsp), %rcx
callq *0x10(%rax)
movq %rax, %r12
movq %rax, 0x18(%rsp)
movq (%rax), %rax
movq %r12, %rdi
callq *(%rax)
movq 0x20(%r14), %r13
cmpl $0x1, %eax
jne 0x4499
movq %r12, 0x20(%r14)
movq %r13, 0x18(%rsp)
jmp 0x44e7
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
testl %eax, %eax
je 0x4310
xorl %ebx, %ebx
jmp 0x452c
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
movq (%r15), %rdi
callq 0x40c5
movl %eax, %ebx
jmp 0x452c
movq (%r14), %rsi
addq $0x8, %rsi
leaq 0xaf32(%rip), %rdi      # 0xf250
callq 0x859a
leaq 0xaf2e(%rip), %rcx      # 0xf258
cmpq %rcx, %rax
je 0x42f1
movq 0x40(%rax), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq (%r14), %rdi
movq %rax, (%r14)
movb $0x1, %bl
testq %rdi, %rdi
je 0x452c
movq (%rdi), %rax
callq *0x38(%rax)
jmp 0x452c
movq %rbp, 0x10(%rsp)
cmpq %rax, %rcx
je 0x43ea
movl $0x2, %ebp
xorl %r14d, %r14d
leaq 0x18(%rsp), %r12
movq (%r15), %rcx
movq 0x8(%rcx,%r14,8), %r13
leaq 0x28(%rsp), %rcx
movq %rcx, 0x18(%rsp)
movq -0x8(%rax,%rbp,8), %rsi
movq (%rax,%rbp,8), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x68f6
movq %r13, 0x38(%rsp)
leaq 0x50(%rsp), %rdi
movq %r12, %rsi
callq 0x8624
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
movq 0x40(%rsp), %r13
je 0x43c1
callq 0x31f0
incq %r14
movq 0x8(%r13), %rax
movq 0x10(%r13), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x3333333333333333, %rdx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rdx, %rcx
addq $0x5, %rbp
cmpq %rcx, %r14
jb 0x4370
movq %r15, %r14
movq 0x20(%r13), %rdi
movq (%rdi), %rax
leaq 0xae55(%rip), %rdx      # 0xf250
leaq 0x50(%rsp), %rsi
leaq 0xf(%rsp), %rcx
callq *0x10(%rax)
movq %rax, %r15
movq (%r14), %rsi
movq 0x48(%rsp), %rax
leaq (%rsi,%rax,8), %rdx
addq $0x8, %rdx
movq %r14, %rdi
callq 0x8802
movq (%r14), %rsi
leaq 0x18(%rsp), %rdx
movq %r15, (%rdx)
movq %r14, %rdi
callq 0x88b6
movq %r14, %r15
movq 0x10(%rsp), %r14
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x444e
movq (%rdi), %rax
callq *0x38(%rax)
movq 0x8(%r14), %rax
movq 0x10(%r14), %rcx
subq %rax, %rcx
cmpq $0x8, %rcx
ja 0x4520
movq (%rax), %r14
xorl %ecx, %ecx
movq %rcx, (%rax)
movq (%r15), %rax
movq (%rax), %rdi
movq %rcx, (%rax)
testq %rdi, %rdi
je 0x447f
movq (%rdi), %rax
callq *0x38(%rax)
movq (%rbx), %rdi
movq %r14, (%rbx)
testq %rdi, %rdi
je 0x4520
movq (%rdi), %rax
callq *0x38(%rax)
jmp 0x4520
movq 0x8(%r13), %r14
movq 0x10(%r13), %r12
cmpq %r14, %r12
je 0x44d6
movq %r14, %rbp
movq (%rbp), %rdi
testq %rdi, %rdi
je 0x44b8
movq (%rdi), %rax
callq *0x38(%rax)
movq $0x0, (%rbp)
addq $0x8, %rbp
cmpq %r12, %rbp
jne 0x44a9
movq %r14, 0x10(%r13)
movq 0x40(%rsp), %rax
movq 0x20(%rax), %r13
addq $0x8, %r13
leaq 0x18(%rsp), %rsi
movq %r13, %rdi
callq 0x8210
movq 0x10(%rsp), %rdi
movq (%rdi), %rsi
movq 0x48(%rsp), %rax
leaq (%rax,%rax,4), %rax
leaq (%rsi,%rax,8), %rdx
callq 0x89b2
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x4511
movq (%rdi), %rax
callq *0x38(%rax)
movq (%r15), %rax
movq (%rbx), %rcx
movq (%rax), %rdx
movq %rdx, (%rbx)
movq %rcx, (%rax)
leaq 0x50(%rsp), %rdi
callq 0x687a
movb $0x1, %bl
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4546
jmp 0x4563
jmp 0x4546
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x4581
movq (%rdi), %rax
callq *0x38(%rax)
jmp 0x4581
jmp 0x4563
jmp 0x4563
jmp 0x4563
jmp 0x4563
movq %rax, %rbx
jmp 0x4581
jmp 0x456a
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x4581
callq 0x31f0
leaq 0x50(%rsp), %rdi
callq 0x687a
movq %rbx, %rdi
callq 0x3360