// File: /workspace/github_cpp_makefile_star2_O1/pointwiseproduct[P]untyped_lambda/untyped_lambda.cpp
// Function: main
int main(int argc, char *argv[]){
    if(argc <= 1){
        launch_interpreter();
        return 0;
    }

    program_switchs.insert("-b");
    for(int i = 2; i < argc; ++i){
        std::string str(argv[i]);
        if(str == "-o"){
            auto iter = program_switchs.find("-b");
            if(iter != program_switchs.end()){
                program_switchs.erase(iter);
            }
        }else if(str == "-b"){
            auto iter = program_switchs.find("-o");
            if(iter != program_switchs.end()){
                program_switchs.erase(iter);
            }
        }
        program_switchs.insert(str);
    }

    if(program_switchs.find("-h") != program_switchs.end() || program_switchs.find("--help") != program_switchs.end()){
        std::cout << "untyped lambda calcus ver 1.0.0" << std::endl;
        std::cout << "usage:" << std::endl;
        std::cout << "  untyped_lambda ifile_path.txt {option}" << std::endl;
        std::cout << std::endl;
        std::cout << "option:" << std::endl;
        // �w���v���b�Z�[�W���\�������D
        std::cout << "  --help:" << std::endl;
        std::cout << "      -h: show this message." << std::endl;
        // �e���̕]���O�̒l���\�������D
        std::cout << "      -b: show before evaluation of fomulas. [default]" << std::endl;
        // �e���̕]�����ʂ̂ݕ\�������D
        std::cout << "      -o: show only evaluation results." << std::endl;
        // ���̕]�����ƂɈꎞ���~�����D
        std::cout << "      -s: step evaluation." << std::endl << std::endl;

        return 0;
    }

    try{
        const fs::path ifile_path(argv[1]);
        check_file_exist(ifile_path);
        std::vector<char> str = open_file(ifile_path);
        auto a = tokenize_phase1::tokenize(str);
        auto b = tokenize_phase2::tokenize(a);
        if(!parsing_phase::lines(b.begin())){
            throw parsing_failed();
        }

        bool program_swtich_s = program_switchs.find("-s") != program_switchs.end();
        bool program_swtich_b = program_switchs.find("-b") != program_switchs.end();
        for(auto &i : internal_data::lines){
            std::unique_ptr<internal_data::expr> q((i->copy()));
            if(program_swtich_b || program_swtich_s){
                std::cout << i->to_str() << std::endl;
                if(program_swtich_s){
                    waiting();
                }
                internal_data::global_variable_replace(q);
                std::cout << q->to_str() << std::endl;
                if(program_swtich_s){
                    waiting();
                }
            }
            while(true){
                try{
                    int nest_level = 0;
                    bool mod = false;
                    //internal_data::eval2(q, true, mod, true);
                    if(internal_data::lo_most_reduction(q)){
                        throw internal_data::step_out();
                    }
                }catch(internal_data::step_out){
                    if(program_swtich_s){
                        std::cout << q->to_str() << "." << std::endl;
                        waiting();
                    }
                    continue;
                }
                break;
            }
            if(program_swtich_b || program_swtich_s){
                std::cout << "-> ";
            }
            std::cout << q->to_str() << "." << std::endl;
        }
    }catch(app_exception e){
        std::cerr << e.what() << std::endl;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, 0x20(%rsp)
cmpl $0x1, %edi
jg 0x5797
callq 0x523c
jmp 0x5fdf
movl %edi, %ebp
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x4950(%rip), %rsi      # 0xa0f9
leaq 0x494b(%rip), %rdx      # 0xa0fb
leaq 0x30(%rsp), %rdi
callq 0x8026
leaq 0x9a5f(%rip), %rdi      # 0xf220
leaq 0x30(%rsp), %rsi
callq 0x8edc
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x57df
callq 0x31f0
cmpl $0x2, %ebp
je 0x58f9
cmpl $0x4, %ebp
movl $0x3, %ebx
cmovgel %ebp, %ebx
movl $0x2, %r12d
leaq 0x30(%rsp), %r14
leaq 0x50(%rsp), %r15
leaq 0x9a16(%rip), %rbp      # 0xf220
movq 0x20(%rsp), %rax
movq (%rax,%r12,8), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x30f0
movq %r14, %rdi
leaq 0x48d4(%rip), %rsi      # 0xa0fc
callq 0x30c0
testl %eax, %eax
je 0x5875
movq %r14, %rdi
leaq 0x48be(%rip), %rsi      # 0xa0f9
callq 0x30c0
testl %eax, %eax
jne 0x58ce
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %r15, %rdi
leaq 0x48a0(%rip), %rsi      # 0xa0fc
leaq 0x489b(%rip), %rdx      # 0xa0fe
callq 0x8026
movq %rbp, %rdi
movq %r15, %rsi
callq 0x906e
jmp 0x58a0
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %r15, %rdi
leaq 0x4870(%rip), %rsi      # 0xa0f9
leaq 0x486b(%rip), %rdx      # 0xa0fb
callq 0x8026
movq %rbp, %rdi
movq %r15, %rsi
callq 0x906e
movq %rax, %r13
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x58b7
callq 0x31f0
leaq 0x996a(%rip), %rax      # 0xf228
cmpq %rax, %r13
je 0x58ce
movq %rbp, %rdi
movq %r13, %rsi
callq 0x90f8
movq %rbp, %rdi
movq %r14, %rsi
callq 0x9138
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x58ed
callq 0x31f0
incq %r12
cmpq %r12, %rbx
jne 0x580a
leaq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
movq %rax, (%rdi)
leaq 0x47f2(%rip), %rsi      # 0xa0ff
leaq 0x47ed(%rip), %rdx      # 0xa101
callq 0x8026
leaq 0x9900(%rip), %rdi      # 0xf220
leaq 0x30(%rsp), %rsi
callq 0x906e
movq %rax, %r14
movb $0x1, %bl
leaq 0x98f2(%rip), %r15      # 0xf228
cmpq %r15, %rax
jne 0x5973
leaq 0x60(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x47b7(%rip), %rsi      # 0xa102
leaq 0x47b6(%rip), %rdx      # 0xa108
leaq 0x50(%rsp), %rdi
callq 0x8026
leaq 0x98bd(%rip), %rdi      # 0xf220
leaq 0x50(%rsp), %rsi
callq 0x906e
cmpq %r15, %rax
setne %bl
cmpq %r15, %r14
jne 0x598b
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x598b
callq 0x31f0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x599f
callq 0x31f0
testb %bl, %bl
je 0x5c17
movq 0x961a(%rip), %rbx      # 0xefc8
leaq 0x4754(%rip), %rsi      # 0xa109
movl $0x1f, %edx
movq %rbx, %rdi
callq 0x3260
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
leaq 0x4739(%rip), %rsi      # 0xa129
movl $0x6, %edx
movq %rbx, %rdi
callq 0x3260
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
leaq 0x4705(%rip), %rsi      # 0xa130
movl $0x28, %edx
movq %rbx, %rdi
callq 0x3260
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
leaq 0x46cc(%rip), %rsi      # 0xa159
movl $0x7, %edx
movq %rbx, %rdi
callq 0x3260
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
leaq 0x4699(%rip), %rsi      # 0xa161
movl $0x9, %edx
movq %rbx, %rdi
callq 0x3260
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
leaq 0x4668(%rip), %rsi      # 0xa16b
movl $0x1c, %edx
movq %rbx, %rdi
callq 0x3260
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
leaq 0x464a(%rip), %rsi      # 0xa188
movl $0x36, %edx
movq %rbx, %rdi
callq 0x3260
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
leaq 0x4646(%rip), %rsi      # 0xa1bf
movl $0x27, %edx
movq %rbx, %rdi
callq 0x3260
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
leaq 0x4633(%rip), %rsi      # 0xa1e7
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x3260
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
jmp 0x5fdf
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0x30(%rsp), %rdi
movq %rsp, %rdx
callq 0x30f0
leaq 0x30(%rsp), %rdi
callq 0x3695
leaq 0xa0(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x373a
leaq 0x88(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x392b
leaq 0x70(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x3d18
movq 0x70(%rsp), %rdi
callq 0x51f3
testb %al, %al
je 0x5ffb
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x4570(%rip), %rsi      # 0xa202
leaq 0x456b(%rip), %rdx      # 0xa204
movq %rsp, %rdi
callq 0x8026
leaq 0x9578(%rip), %rdi      # 0xf220
movq %rsp, %rsi
callq 0x906e
movq %rax, 0x20(%rsp)
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5cc8
callq 0x31f0
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x441f(%rip), %rsi      # 0xa0f9
leaq 0x441a(%rip), %rdx      # 0xa0fb
callq 0x8026
leaq 0x9533(%rip), %rdi      # 0xf220
movq %rsp, %rsi
callq 0x906e
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5d0b
callq 0x31f0
movq 0x956e(%rip), %r13      # 0xf280
movq 0x956f(%rip), %r14      # 0xf288
cmpq %r14, %r13
je 0x5f98
leaq 0x94ff(%rip), %rcx      # 0xf228
xorq %rcx, %rbx
movq 0x20(%rsp), %rax
xorq %rcx, %rax
orq %rbx, %rax
setne %r15b
movq 0x9286(%rip), %r12      # 0xefc8
movq (%r13), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq %rax, 0x28(%rsp)
testb %r15b, %r15b
je 0x5e41
movq (%r13), %rsi
movq (%rsi), %rax
movq %rsp, %rdi
callq *0x20(%rax)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x3260
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5db5
callq 0x31f0
leaq 0x946c(%rip), %rax      # 0xf228
cmpq %rax, 0x20(%rsp)
je 0x5dc8
callq 0x32f0
leaq 0x28(%rsp), %rdi
callq 0x402a
movq 0x28(%rsp), %rsi
movq (%rsi), %rax
movq %rsp, %rdi
callq *0x20(%rax)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x3260
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5e2e
callq 0x31f0
leaq 0x93f3(%rip), %rax      # 0xf228
cmpq %rax, 0x20(%rsp)
je 0x5e41
callq 0x32f0
leaq 0x28(%rsp), %rdi
callq 0x40c4
testb %al, %al
je 0x5ef5
movl $0x1, %edi
callq 0x3130
movq %rax, %rdi
leaq 0x8cd1(%rip), %rsi      # 0xeb38
xorl %edx, %edx
callq 0x3350
jmp 0x6026
movq %rax, %rbp
cmpl $0x2, %edx
jne 0x5ff3
movq %rbp, %rdi
callq 0x3100
leaq 0x939a(%rip), %rax      # 0xf228
cmpq %rax, 0x20(%rsp)
je 0x5eeb
movq 0x28(%rsp), %rsi
movq (%rsi), %rax
movq %rsp, %rdi
callq *0x20(%rax)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x3260
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x43f1(%rip), %rsi      # 0xa2b7
callq 0x3260
movq %rbx, %rdi
callq 0x3120
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5ee6
callq 0x31f0
callq 0x32f0
callq 0x3340
jmp 0x5e41
testb %r15b, %r15b
je 0x5f0e
movl $0x3, %edx
movq %r12, %rdi
leaq 0x42fc(%rip), %rsi      # 0xa205
callq 0x3260
movq 0x28(%rsp), %rbx
movq (%rbx), %rax
movq %rsp, %rdi
movq %rbx, %rsi
callq *0x20(%rax)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x3260
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0x4375(%rip), %rsi      # 0xa2b7
callq 0x3260
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %rbp, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5f82
callq 0x31f0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x38(%rax)
addq $0x8, %r13
cmpq %r14, %r13
jne 0x5d42
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x5fa7
callq 0x31f0
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x5fb9
callq 0x31f0
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x5fcb
callq 0x31f0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x5fdf
callq 0x31f0
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %r14
jmp 0x615f
movl $0x10, %edi
callq 0x3130
movq %rax, %rbx
movq %rax, %rdi
callq 0x67ba
leaq 0x8b09(%rip), %rsi      # 0xeb20
movq 0x8fa2(%rip), %rdx      # 0xefc0
movq %rbx, %rdi
callq 0x3350
jmp 0x6116
movq %rdx, %r14
movq %rax, %rbp
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x604c
callq 0x31f0
jmp 0x604c
movq %rdx, %r14
movq %rax, %rbp
callq 0x3340
jmp 0x615f
jmp 0x610c
movq %rdx, %r14
movq %rax, %rbp
movq %rbx, %rdi
callq 0x31a0
jmp 0x6178
movq %rax, %rbp
movq 0x50(%rsp), %rdi
cmpq %rbx, %rdi
jne 0x6103
jmp 0x6121
jmp 0x611e
jmp 0x608d
jmp 0x610c
movq %rdx, %r14
movq %rax, %rbp
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x6178
callq 0x31f0
jmp 0x6178
jmp 0x610c
jmp 0x610c
movq %rdx, %r14
movq %rax, %rbp
jmp 0x6187
movq %rdx, %r14
movq %rax, %rbp
jmp 0x6199
jmp 0x60cb
movq %rdx, %r14
movq %rax, %rbp
jmp 0x61ab
movq %rdx, %r14
movq %rax, %rbp
jmp 0x61bf
jmp 0x611e
jmp 0x6137
jmp 0x611e
jmp 0x6137
jmp 0x60f1
jmp 0x611e
jmp 0x6116
jmp 0x6116
movq %rax, %rbp
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x6121
callq 0x31f0
jmp 0x6121
jmp 0x611e
movq %rdx, %r14
movq %rax, %rbp
jmp 0x6178
jmp 0x6116
movq %rdx, %r14
movq %rax, %rbp
jmp 0x615f
movq %rax, %rbp
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x613a
callq 0x31f0
jmp 0x613a
movq %rax, %rbp
movq %rbp, %rdi
callq 0x3360
jmp 0x6146
jmp 0x6146
movq %rdx, %r14
movq %rax, %rbp
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x615f
callq 0x31f0
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x616f
movq (%rdi), %rax
callq *0x38(%rax)
movq $0x0, 0x28(%rsp)
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x6187
callq 0x31f0
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x6199
callq 0x31f0
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x61ab
callq 0x31f0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x61bf
callq 0x31f0
cmpl $0x1, %r14d
jne 0x613a
movq %rbp, %rdi
callq 0x3290
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x32c0
leaq 0x8998(%rip), %rax      # 0xeb80
movq %rax, (%rbx)
movq %rbp, %rdi
callq 0x3100
movq %rbx, %rdi
callq 0x32d0
movq 0x8dee(%rip), %rdi      # 0xeff0
movq %rax, %rsi
callq 0x3210
movq %rax, %rdi
callq 0x3120
leaq 0x30(%rsp), %rdi
callq 0x33c8
callq 0x3340
jmp 0x5fdf
movq %rax, %rbp
leaq 0x30(%rsp), %rdi
callq 0x33c8
callq 0x3340
jmp 0x613a
movq %rax, %rdi
callq 0x6245