// File: /workspace/github_cpp_makefile_star2_O2/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, %rbx
movq (%rdi), %rdi
movq (%rdi), %rax
callq *(%rax)
movq (%rbx), %r15
cmpl $0x1, %eax
je 0x3e26
movq (%r15), %rax
movq %r15, %rdi
callq *(%rax)
movq (%rbx), %rdi
cmpl $0x2, %eax
jne 0x3e45
addq $0x20, %rdi
jmp 0x3dfd
movq 0x8(%r15), %r14
movq 0x10(%r15), %rax
subq %r14, %rax
cmpq $0x8, %rax
jne 0x3e59
movq (%r14), %rax
movq %rax, (%rbx)
movq %r15, (%r14)
jmp 0x41a7
movq (%rdi), %rax
callq *(%rax)
testl %eax, %eax
je 0x3f93
xorl %ebx, %ebx
jmp 0x41a9
leaq 0xf(%rsp), %rcx
movb $0x0, (%rcx)
movq (%r14), %rdi
leaq 0x58(%rsp), %r12
andq $0x0, 0x8(%r12)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r12)
movq %r12, 0x10(%r12)
movq %r12, 0x18(%r12)
andq $0x0, 0x20(%r12)
movq (%rdi), %rax
leaq 0xa3c6(%rip), %rdx      # 0xe258
leaq 0x50(%rsp), %rsi
callq *0x10(%rax)
leaq 0x8(%r15), %r13
movq (%r14), %rdi
movq %rax, (%r14)
testq %rdi, %rdi
je 0x3eaf
movq (%rdi), %rax
callq *0x38(%rax)
leaq 0x50(%rsp), %rdi
callq 0x5ea4
movq (%r13), %rax
movq (%rax), %rdi
movq (%rdi), %rax
callq *(%rax)
movq (%r13), %r8
movq (%r8), %rdi
cmpl $0x2, %eax
jne 0x3fdc
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movq %rcx, %rax
subq %rsi, %rax
pushq $0x28
popq %r9
cqto
idivq %r9
movq 0x10(%r15), %rdx
andl $0x0, 0x58(%rsp)
andq $0x0, 0x60(%rsp)
subq %r8, %rdx
andq $0x0, 0x78(%rsp)
sarq $0x3, %rdx
decq %rdx
movq %r12, 0x68(%rsp)
movq %r12, 0x70(%rsp)
cmpq %rax, %rdx
cmovbq %rdx, %rax
movq %rax, 0x18(%rsp)
movq %r13, 0x20(%rsp)
jae 0x3ff1
testq %rdx, %rdx
je 0x418d
movq %rdi, 0x10(%rsp)
leaq 0x8(%rdi), %r15
pushq $0x8
popq %r14
xorl %ebp, %ebp
leaq 0x28(%rsp), %r12
cmpq %rbp, 0x18(%rsp)
je 0x410a
movq (%r15), %rsi
addq %r14, %rsi
movq (%r13), %rax
movq 0x8(%rax,%rbp,8), %r13
movq %r12, %rdi
callq 0x32d0
movq %r13, 0x48(%rsp)
leaq 0x50(%rsp), %rdi
movq %r12, %rsi
callq 0x7ac6
movq %r12, %rdi
callq 0x3130
addq $0x28, %r14
incq %rbp
movq 0x20(%rsp), %r13
jmp 0x3f49
movq (%rbx), %rsi
addq $0x8, %rsi
leaq 0xa2b7(%rip), %rdi      # 0xe258
callq 0x7a50
leaq 0xa2b3(%rip), %rcx      # 0xe260
cmpq %rcx, %rax
je 0x3e52
movq 0x40(%rax), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq (%rbx), %rdi
movq %rax, (%rbx)
movb $0x1, %bl
testq %rdi, %rdi
je 0x41a9
movq (%rdi), %rax
callq *0x38(%rax)
jmp 0x41a9
movq (%rdi), %rax
callq *(%rax)
movq (%r13), %rdi
callq 0x3dec
movl %eax, %ebx
jmp 0x41a9
movq %rdi, 0x10(%rsp)
pushq $0x8
popq %r14
xorl %r12d, %r12d
leaq 0x28(%rsp), %rbp
subq %rsi, %rcx
movq %rcx, %rax
cqto
pushq $0x28
popq %rcx
idivq %rcx
cmpq %rax, %r12
jae 0x405e
addq %r14, %rsi
movq (%r13), %rax
movq 0x8(%rax,%r12,8), %r13
movq %rbp, %rdi
callq 0x32d0
movq %r13, 0x48(%rsp)
leaq 0x50(%rsp), %rdi
movq %rbp, %rsi
callq 0x7ac6
movq %rbp, %rdi
callq 0x3130
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rcx
addq $0x28, %r14
incq %r12
movq 0x20(%rsp), %r13
jmp 0x4002
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rdi
movq (%rdi), %rax
leaq 0xa1e7(%rip), %rdx      # 0xe258
leaq 0x50(%rsp), %rsi
leaq 0xf(%rsp), %rcx
callq *0x10(%rax)
movq %rax, %r12
movq (%r13), %rsi
movq 0x18(%rsp), %rax
leaq (%rsi,%rax,8), %rdx
addq $0x8, %rdx
movq %r13, %rdi
callq 0x5a28
movq (%r13), %rsi
leaq 0x28(%rsp), %rdx
movq %r12, (%rdx)
movq %r13, %rdi
callq 0x7d4e
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x40be
movq (%rdi), %rax
callq *0x38(%rax)
movq 0x8(%r15), %rax
movq 0x10(%r15), %rcx
subq %rax, %rcx
cmpq $0x8, %rcx
ja 0x419d
movq (%rax), %r14
andq $0x0, (%rax)
movq (%r13), %rax
movq (%rax), %rdi
andq $0x0, (%rax)
testq %rdi, %rdi
je 0x40f0
movq (%rdi), %rax
callq *0x38(%rax)
movq (%rbx), %rdi
movq %r14, (%rbx)
testq %rdi, %rdi
je 0x419d
movq (%rdi), %rax
callq *0x38(%rax)
jmp 0x419d
movq 0x10(%rsp), %r14
movq 0x20(%r14), %rdi
movq (%rdi), %rax
leaq 0xa13b(%rip), %rdx      # 0xe258
leaq 0x50(%rsp), %rsi
leaq 0xf(%rsp), %rcx
callq *0x10(%rax)
movq %rax, %r12
movq %rax, 0x28(%rsp)
movq (%rax), %rax
movq %r12, %rdi
callq *(%rax)
movq 0x20(%r14), %rdi
cmpl $0x1, %eax
jne 0x414e
movq %r12, 0x20(%r14)
movq %rdi, 0x28(%rsp)
jmp 0x4169
addq $0x8, %rdi
callq 0x5a46
movq 0x20(%r14), %rdi
addq $0x8, %rdi
leaq 0x28(%rsp), %rsi
callq 0x76f2
movq (%r15), %rsi
imulq $0x28, 0x18(%rsp), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x5a4e
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x418d
movq (%rdi), %rax
callq *0x38(%rax)
movq (%r13), %rax
movq (%rbx), %rcx
movq (%rax), %rdx
movq %rdx, (%rbx)
movq %rcx, (%rax)
leaq 0x50(%rsp), %rdi
callq 0x5ea4
movb $0x1, %bl
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x41c3
jmp 0x41f1
jmp 0x41c3
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x41f4
movq (%rdi), %rax
callq *0x38(%rax)
jmp 0x41f4
jmp 0x41f1
jmp 0x41f1
jmp 0x41f1
jmp 0x41f1
jmp 0x41e2
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3130
jmp 0x41f4
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x5ea4
movq %rbx, %rdi
callq 0x3370