// File: /workspace/github_cpp_makefile_star2_O2/kc885[P]SAT-Solver-with-CDCL/cdcl.cpp
// Function: ck_cdcl_solver::Solver::parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void parse(std::string filename){
            std::string line;
            std::ifstream ifs(filename);
            int clause_num = 0;
            while (ifs) {
                getline(ifs, line);
                
                //effective clause number
                int temp;
                
                if (line.size() > 0) {
                    if (line[0] == 'p') {
                        sscanf(line.c_str(), "p cnf %d %d", &variableNumber, &temp);
                        
                        //initialization
                        unsat = 0;
                        decisionVar.push_back(0);
                        for (int i =0;i <variableNumber;i++){
                            //undefined
                            val_decisionLevel.push_back(0);
                            decisionVar.push_back(0);
                            //antecedent.push_back(-1);
                            std::vector<int> temp1;
                            std::vector<int> temp2;
                            varToClause[i+1] = temp1;
                            varToClause[-i-1] = temp2;
                        }
                        val_decisionLevel.push_back(0);
                        decisionVar.push_back(0);
                        
                    } else if (line[0] == 'c' ){
                        continue;
                    } else {
                        //readClause(line, lits);
                        std::stringstream sin(line);
                        
                        //if a clause contain both a variable and its negation, this clause must evaluate to true so we can skip it.
                        int resolve_flag = 0;
                        
                        //counter for effective variable number in a clause
                        int count = 0;
                        
                        std::unordered_set<int> visited;
                        
                        int num;
                        while(sin >> num){
                            if(num == 0)
                                break;
                            if(visited.count(num) > 0)
                                continue;
                            else if(visited.count(-num) > 0)
                                resolve_flag = 1;
                            else{
                                visited.insert(num);
                                count++;
                                
                            }
                        }
                        if(count > 0 && resolve_flag == 0){
                            std::unordered_set<int> c;
                            
                            for(auto iter = visited.begin(); iter != visited.end(); iter++){
                                varToClause[*iter].push_back(clause_num);
                                c.insert(*iter);
                            }
                            
                            clauses.push_back(c);
                            clause_num++;
                        }
                        
                        
                    }
                }
                
            }
            for(int i =1;i <= variableNumber; i++){
                sor.push_back(i);
            }
            std::sort(sor.rbegin(),sor.rend(),[&](int i, int j)
                {return ((varToClause[i].size() + varToClause[-i].size()) < (varToClause[j].size() + varToClause[-j].size())) ;}
            );
          
            ifs.close();
        }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x468, %rsp            # imm = 0x468
movq %rdi, %rbx
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x260(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x21d0
leaq 0x4(%rsp), %rax
andl $0x0, (%rax)
leaq 0x98(%rbx), %rax
movq %rax, 0x10(%rsp)
leaq 0x68(%rbx), %rax
movq %rax, 0x8(%rsp)
leaq 0x50(%rbx), %rax
movq %rax, 0x18(%rsp)
leaq 0x38(%rbx), %rax
movq %rax, 0x20(%rsp)
leaq 0x260(%rsp), %r14
leaq 0xd0(%rsp), %rbp
leaq 0x88(%rsp), %r15
leaq 0x50(%rsp), %r13
movq 0x260(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x280(%rsp,%rax)
jne 0x27ed
movq %r14, %rdi
leaq 0x30(%rsp), %rsi
callq 0x2030
cmpq $0x0, 0x38(%rsp)
je 0x2525
movq 0x30(%rsp), %rdi
movzbl (%rdi), %eax
cmpl $0x63, %eax
je 0x2525
cmpl $0x70, %eax
jne 0x265a
leaq 0x2ab2(%rip), %rsi      # 0x5023
movq 0x10(%rsp), %rdx
leaq 0x2c(%rsp), %rcx
xorl %eax, %eax
callq 0x2140
andl $0x0, 0x9c(%rbx)
andl $0x0, 0xd0(%rsp)
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x2c38
pushq $0x1
popq %rax
movl %eax, %r12d
pushq $-0x1
popq %r14
leal -0x1(%r12), %eax
movq 0x10(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x2780
andl $0x0, 0xd0(%rsp)
movq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0x2c38
andl $0x0, 0xd0(%rsp)
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x2c38
xorps %xmm0, %xmm0
movaps %xmm0, 0xd0(%rsp)
andq $0x0, 0xe0(%rsp)
movaps %xmm0, 0x50(%rsp)
andq $0x0, 0x60(%rsp)
movl %r12d, 0x88(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2dc4
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2af4
movl %r14d, 0x88(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2dc4
movq %rax, %rdi
movq %r13, %rsi
callq 0x2af4
movq %r13, %rdi
callq 0x31bc
movq %rbp, %rdi
callq 0x31bc
decl %r14d
incl %r12d
jmp 0x25a8
movq %rbp, %rdi
leaq 0x30(%rsp), %rsi
pushq $0x18
popq %rdx
callq 0x21c0
leaq 0x80(%rsp), %rax
movq %rax, 0x50(%rsp)
movq $0x1, 0x58(%rsp)
leaq 0x60(%rsp), %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movl $0x3f800000, 0x70(%rsp) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
xorl %r14d, %r14d
xorl %r12d, %r12d
movl %r12d, %ecx
movl %ecx, %r12d
movq %rbp, %rdi
movq %rsp, %rsi
callq 0x20e0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2701
cmpl $0x0, (%rsp)
je 0x2701
movq %r13, %rdi
movq %rsp, %rsi
callq 0x3270
testq %rax, %rax
jne 0x26a3
xorl %eax, %eax
subl (%rsp), %eax
movl %eax, 0x88(%rsp)
movq %r13, %rdi
movq %r15, %rsi
callq 0x3270
pushq $0x1
popq %rcx
testq %rax, %rax
jne 0x26a0
movq %r13, %rdi
movq %rsp, %rsi
callq 0x3300
incl %r14d
jmp 0x269d
testl %r14d, %r14d
setne %al
testl %r12d, %r12d
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x27d0
leaq 0xb8(%rsp), %rax
movq %rax, 0x88(%rsp)
movq $0x1, 0x90(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, 0xa8(%rsp) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
leaq 0x60(%rsp), %r14
movq (%r14), %r14
testq %r14, %r14
je 0x27b7
leaq 0x8(%r14), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x360c
movq %rax, %rdi
leaq 0x4(%rsp), %rsi
callq 0x2bbe
movq %r15, %rdi
movq %r12, %rsi
callq 0x3300
jmp 0x274f
andl $0x0, 0xd0(%rsp)
movq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0x2c38
andl $0x0, 0xd0(%rsp)
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x2c38
leaq 0x260(%rsp), %r14
jmp 0x2525
movq 0x20(%rsp), %rdi
movq %r15, %rsi
callq 0x2bdc
incl 0x4(%rsp)
movq %r15, %rdi
callq 0x3bec
movq %r13, %rdi
callq 0x3bec
movq %rbp, %rdi
callq 0x2100
leaq 0x260(%rsp), %r14
jmp 0x2525
leaq 0x80(%rbx), %r15
pushq $0x1
popq %rax
leaq 0xd0(%rsp), %r12
movl %eax, 0xd0(%rsp)
movq 0x10(%rsp), %rcx
cmpl (%rcx), %eax
jg 0x2825
movq %r15, %rdi
movq %r12, %rsi
callq 0x2bbe
movl 0xd0(%rsp), %eax
incl %eax
jmp 0x27ff
movq 0x88(%rbx), %rax
leaq 0xc8(%rsp), %rdi
movq %rax, (%rdi)
movq 0x80(%rbx), %rax
leaq 0xc0(%rsp), %rsi
movq %rax, (%rsi)
movq %rbx, %rdx
callq 0x2c08
leaq 0x260(%rsp), %rdi
callq 0x2040
leaq 0x260(%rsp), %rdi
callq 0x2050
leaq 0x30(%rsp), %rdi
callq 0x20a0
addq $0x468, %rsp            # imm = 0x468
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x28d7
movq %rax, %rbx
jmp 0x28fe
jmp 0x28a2
jmp 0x28a7
jmp 0x28d7
jmp 0x28a2
jmp 0x28a2
jmp 0x28a2
jmp 0x28a2
jmp 0x28a2
jmp 0x28a2
jmp 0x28a2
movq %rax, %rbx
jmp 0x28f1
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x3bec
jmp 0x28da
jmp 0x28bb
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x31bc
leaq 0xd0(%rsp), %rdi
callq 0x31bc
jmp 0x28f1
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x3bec
leaq 0xd0(%rsp), %rdi
callq 0x2100
leaq 0x260(%rsp), %rdi
callq 0x2050
leaq 0x30(%rsp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2210