// File: /workspace/github_cpp_makefile_star2_O3/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 $0x98, %rsp
movq %rsi, 0x20(%rsp)
cmpl $0x1, %edi
jg 0x55f0
callq 0x50b6
jmp 0x5e1a
movl %edi, %ebp
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x4af7(%rip), %rsi      # 0xa0f9
leaq 0x4af2(%rip), %rdx      # 0xa0fb
leaq 0x28(%rsp), %rdi
callq 0x7e56
leaq 0x9c06(%rip), %rdi      # 0xf220
leaq 0x28(%rsp), %rsi
callq 0x8d2a
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x5638
callq 0x31f0
cmpl $0x2, %ebp
je 0x5744
movl %ebp, %r12d
movl $0x2, %ebx
leaq 0x28(%rsp), %r14
movq %rsp, %r15
leaq 0x9bc8(%rip), %rbp      # 0xf220
movq 0x20(%rsp), %rax
movq (%rax,%rbx,8), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x30f0
movq %r14, %rdi
leaq 0x4a86(%rip), %rsi      # 0xa0fc
callq 0x30c0
testl %eax, %eax
je 0x56c2
movq %r14, %rdi
leaq 0x4a70(%rip), %rsi      # 0xa0f9
callq 0x30c0
testl %eax, %eax
jne 0x5719
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %r15, %rdi
leaq 0x4a53(%rip), %rsi      # 0xa0fc
leaq 0x4a4e(%rip), %rdx      # 0xa0fe
callq 0x7e56
movq %rbp, %rdi
movq %r15, %rsi
callq 0x8ebc
jmp 0x56ec
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %r15, %rdi
leaq 0x4a24(%rip), %rsi      # 0xa0f9
leaq 0x4a1f(%rip), %rdx      # 0xa0fb
callq 0x7e56
movq %rbp, %rdi
movq %r15, %rsi
callq 0x8ebc
movq %rax, %r13
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5702
callq 0x31f0
leaq 0x9b1f(%rip), %rax      # 0xf228
cmpq %rax, %r13
je 0x5719
movq %rbp, %rdi
movq %r13, %rsi
callq 0x8f46
movq %rbp, %rdi
movq %r14, %rsi
callq 0x8f86
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x5738
callq 0x31f0
incq %rbx
cmpq %rbx, %r12
jne 0x5658
leaq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
movq %rax, (%rdi)
leaq 0x49a7(%rip), %rsi      # 0xa0ff
leaq 0x49a2(%rip), %rdx      # 0xa101
callq 0x7e56
leaq 0x9ab5(%rip), %rdi      # 0xf220
leaq 0x28(%rsp), %rsi
callq 0x8ebc
movb $0x1, %bpl
leaq 0x9aa9(%rip), %rcx      # 0xf228
cmpq %rcx, %rax
jne 0x57ce
leaq 0x10(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x496e(%rip), %rsi      # 0xa102
leaq 0x496d(%rip), %rdx      # 0xa108
movq %rsp, %rdi
callq 0x7e56
leaq 0x9a76(%rip), %rdi      # 0xf220
movq %rsp, %rsi
callq 0x8ebc
leaq 0x9a6f(%rip), %rcx      # 0xf228
cmpq %rcx, %rax
setne %bpl
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x57ce
callq 0x31f0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x57e2
callq 0x31f0
testb %bpl, %bpl
je 0x5a5b
movq 0x97d6(%rip), %rbx      # 0xefc8
leaq 0x4910(%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 0x48f5(%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 0x48c1(%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 0x4888(%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 0x4855(%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 0x4824(%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 0x4806(%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 0x4802(%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 0x47ef(%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 0x5e1a
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0x28(%rsp), %rdi
movq %rsp, %rdx
callq 0x30f0
leaq 0x28(%rsp), %rdi
callq 0x3695
leaq 0x80(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x3737
leaq 0x68(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x3935
leaq 0x50(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x3d3a
movq 0x50(%rsp), %rdi
callq 0x506d
testb %al, %al
je 0x5e36
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x4732(%rip), %rsi      # 0xa202
leaq 0x472d(%rip), %rdx      # 0xa204
movq %rsp, %rdi
callq 0x7e56
leaq 0x973a(%rip), %rdi      # 0xf220
movq %rsp, %rsi
callq 0x8ebc
movq %rax, 0x20(%rsp)
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5b06
callq 0x31f0
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x45e1(%rip), %rsi      # 0xa0f9
leaq 0x45dc(%rip), %rdx      # 0xa0fb
callq 0x7e56
leaq 0x96f5(%rip), %rdi      # 0xf220
movq %rsp, %rsi
callq 0x8ebc
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5b49
callq 0x31f0
movq 0x9730(%rip), %r13      # 0xf280
movq 0x9731(%rip), %r14      # 0xf288
cmpq %r14, %r13
je 0x5dd6
leaq 0x96c1(%rip), %rcx      # 0xf228
xorq %rcx, %rbx
movq 0x20(%rsp), %rax
xorq %rcx, %rax
orq %rbx, %rax
setne %r15b
movq 0x9448(%rip), %r12      # 0xefc8
movq (%r13), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq %rax, 0x48(%rsp)
testb %r15b, %r15b
je 0x5c7f
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 0x5bf3
callq 0x31f0
leaq 0x962e(%rip), %rax      # 0xf228
cmpq %rax, 0x20(%rsp)
je 0x5c06
callq 0x32f0
leaq 0x48(%rsp), %rdi
callq 0x4020
movq 0x48(%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 0x5c6c
callq 0x31f0
leaq 0x95b5(%rip), %rax      # 0xf228
cmpq %rax, 0x20(%rsp)
je 0x5c7f
callq 0x32f0
leaq 0x48(%rsp), %rdi
callq 0x40c5
testb %al, %al
je 0x5d33
movl $0x1, %edi
callq 0x3130
movq %rax, %rdi
leaq 0x8e93(%rip), %rsi      # 0xeb38
xorl %edx, %edx
callq 0x3350
jmp 0x5e61
movq %rax, %rbp
cmpl $0x2, %edx
jne 0x5e2e
movq %rbp, %rdi
callq 0x3100
leaq 0x955c(%rip), %rax      # 0xf228
cmpq %rax, 0x20(%rsp)
je 0x5d29
movq 0x48(%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 0x45b3(%rip), %rsi      # 0xa2b7
callq 0x3260
movq %rbx, %rdi
callq 0x3120
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5d24
callq 0x31f0
callq 0x32f0
callq 0x3340
jmp 0x5c7f
testb %r15b, %r15b
je 0x5d4c
movl $0x3, %edx
movq %r12, %rdi
leaq 0x44be(%rip), %rsi      # 0xa205
callq 0x3260
movq 0x48(%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 0x4537(%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 0x5dc0
callq 0x31f0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x38(%rax)
addq $0x8, %r13
cmpq %r14, %r13
jne 0x5b80
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x5de5
callq 0x31f0
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x5df4
callq 0x31f0
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x5e06
callq 0x31f0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x5e1a
callq 0x31f0
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %r14
jmp 0x5f98
movl $0x10, %edi
callq 0x3130
movq %rax, %rbx
movq %rax, %rdi
callq 0x65ea
leaq 0x8cce(%rip), %rsi      # 0xeb20
movq 0x9167(%rip), %rdx      # 0xefc0
movq %rbx, %rdi
callq 0x3350
jmp 0x5f4f
movq %rdx, %r14
movq %rax, %rbp
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5e87
callq 0x31f0
jmp 0x5e87
movq %rdx, %r14
movq %rax, %rbp
callq 0x3340
jmp 0x5f98
jmp 0x5f45
movq %rdx, %r14
movq %rax, %rbp
movq %rbx, %rdi
callq 0x31a0
jmp 0x5fa8
movq %rax, %rbp
movq (%rsp), %rdi
cmpq %rbx, %rdi
jne 0x5f3c
jmp 0x5f5a
jmp 0x5f57
jmp 0x5ec7
jmp 0x5f45
movq %rdx, %r14
movq %rax, %rbp
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5fa8
callq 0x31f0
jmp 0x5fa8
jmp 0x5f45
jmp 0x5f45
movq %rdx, %r14
movq %rax, %rbp
jmp 0x5fb7
movq %rdx, %r14
movq %rax, %rbp
jmp 0x5fc6
jmp 0x5f05
movq %rdx, %r14
movq %rax, %rbp
jmp 0x5fd8
movq %rdx, %r14
movq %rax, %rbp
jmp 0x5fec
jmp 0x5f57
jmp 0x5f70
jmp 0x5f57
jmp 0x5f70
jmp 0x5f2b
jmp 0x5f57
jmp 0x5f4f
jmp 0x5f4f
movq %rax, %rbp
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5f5a
callq 0x31f0
jmp 0x5f5a
jmp 0x5f57
movq %rdx, %r14
movq %rax, %rbp
jmp 0x5fa8
jmp 0x5f4f
movq %rdx, %r14
movq %rax, %rbp
jmp 0x5f98
movq %rax, %rbp
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x5f73
callq 0x31f0
jmp 0x5f73
movq %rax, %rbp
movq %rbp, %rdi
callq 0x3360
jmp 0x5f7f
jmp 0x5f7f
movq %rdx, %r14
movq %rax, %rbp
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5f98
callq 0x31f0
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x5fa8
movq (%rdi), %rax
callq *0x38(%rax)
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x5fb7
callq 0x31f0
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x5fc6
callq 0x31f0
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x5fd8
callq 0x31f0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x5fec
callq 0x31f0
cmpl $0x1, %r14d
jne 0x5f73
movq %rbp, %rdi
callq 0x3290
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x32c0
leaq 0x8b6f(%rip), %rax      # 0xeb80
movq %rax, (%rbx)
movq %rbp, %rdi
callq 0x3100
movq %rbx, %rdi
callq 0x32d0
movq 0x8fc5(%rip), %rdi      # 0xeff0
movq %rax, %rsi
callq 0x3210
movq %rax, %rdi
callq 0x3120
leaq 0x28(%rsp), %rdi
callq 0x33c8
callq 0x3340
jmp 0x5e1a
movq %rax, %rbp
leaq 0x28(%rsp), %rdi
callq 0x33c8
callq 0x3340
jmp 0x5f73
movq %rax, %rdi
callq 0x606e