// File: /workspace/github_cpp_makefile_star2_O3/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 $0x458, %rsp            # imm = 0x458
movq %rdi, %rbx
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x250(%rsp), %rdi
movl $0x8, %edx
callq 0x21d0
movl $0x0, (%rsp)
movq 0x250(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x270(%rsp,%rax)
jne 0x2acc
leaq (%rsp,%rax), %rdi
addq $0x250, %rdi            # imm = 0x250
leaq 0x98(%rbx), %r15
leaq 0x68(%rbx), %rax
movq %rax, 0x8(%rsp)
leaq 0x50(%rbx), %rax
movq %rax, 0x10(%rsp)
leaq 0x38(%rbx), %rax
movq %rax, 0x78(%rsp)
leaq 0x250(%rsp), %r12
leaq 0x18(%rsp), %r13
leaq 0xc0(%rsp), %r14
leaq 0x88(%rsp), %rbp
movl $0xa, %esi
callq 0x2140
movsbl %al, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x2230
cmpq $0x0, 0x20(%rsp)
je 0x2aab
movq 0x18(%rsp), %rdi
movzbl (%rdi), %eax
cmpl $0x63, %eax
je 0x2aab
cmpl $0x70, %eax
jne 0x26fc
leaq 0x39a5(%rip), %rsi      # 0x605f
movq %r15, %rdx
leaq 0x84(%rsp), %rcx
xorl %eax, %eax
callq 0x2150
xorl %eax, %eax
movl %eax, 0x9c(%rbx)
movl %eax, 0xc0(%rsp)
movq 0x70(%rbx), %rsi
cmpq 0x78(%rbx), %rsi
je 0x290e
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x70(%rbx)
jmp 0x291b
movq %r14, %rdi
movq %r13, %rsi
movl $0x18, %edx
callq 0x21c0
leaq 0x70(%rsp), %rax
movq %rax, 0x40(%rsp)
movq $0x1, 0x48(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, 0x60(%rsp) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
xorl %r13d, %r13d
xorl %r9d, %r9d
movl %r9d, %r12d
movq %r14, %rdi
leaq 0x4(%rsp), %rsi
callq 0x20d0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x281c
movl 0x4(%rsp), %edi
testl %edi, %edi
je 0x281c
movslq %edi, %rax
movq 0x40(%rsp), %r9
movq 0x48(%rsp), %r8
xorl %edx, %edx
divq %r8
movq (%r9,%rdx,8), %rax
testq %rax, %rax
je 0x27ac
movq %rdx, %rcx
movq (%rax), %r10
cmpl 0x8(%r10), %edi
je 0x273b
movq (%r10), %r10
testq %r10, %r10
je 0x27ac
movslq 0x8(%r10), %rsi
movq %rsi, %rax
xorl %edx, %edx
divq %r8
cmpq %rcx, %rdx
jne 0x27ac
cmpl %esi, %edi
jne 0x278d
jmp 0x273b
negl %edi
movslq %edi, %rax
xorl %edx, %edx
divq %r8
movq (%r9,%rdx,8), %rax
testq %rax, %rax
je 0x27f7
movq %rdx, %rcx
movq (%rax), %r10
movl $0x1, %r9d
cmpl %edi, 0x8(%r10)
je 0x2738
movq (%r10), %r10
testq %r10, %r10
je 0x27f7
movslq 0x8(%r10), %rsi
movq %rsi, %rax
xorl %edx, %edx
divq %r8
cmpq %rcx, %rdx
jne 0x27f7
cmpl %edi, %esi
jne 0x27d5
jmp 0x2738
leaq 0x40(%rsp), %rdi
movq %rdi, 0x88(%rsp)
leaq 0x4(%rsp), %rsi
movq %rbp, %rdx
callq 0x356c
incl %r13d
movl %r12d, %r9d
jmp 0x2738
testl %r13d, %r13d
setg %al
testl %r12d, %r12d
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x28d6
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)
movq 0x50(%rsp), %r12
testq %r12, %r12
je 0x28be
leaq 0x8(%r12), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x37f8
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x2898
movl (%rsp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rax)
jmp 0x28a3
movq %rax, %rdi
movq %rsp, %rdx
callq 0x38ce
movq %rbp, 0x38(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
leaq 0x38(%rsp), %rdx
callq 0x356c
movq (%r12), %r12
jmp 0x286a
movq 0x78(%rsp), %rdi
movq %rbp, %rsi
callq 0x3016
incl (%rsp)
movq %rbp, %rdi
callq 0x3d9a
leaq 0x40(%rsp), %rdi
callq 0x3d9a
movq %r14, %rdi
movq 0x66d6(%rip), %rsi      # 0x8fc0
callq 0x2100
leaq 0x140(%rsp), %rdi
callq 0x2070
leaq 0x250(%rsp), %r12
leaq 0x18(%rsp), %r13
jmp 0x2aab
movq 0x8(%rsp), %rdi
movq %r14, %rdx
callq 0x308a
cmpl $0x0, (%r15)
jle 0x2a32
xorl %r13d, %r13d
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl $0x0, 0xc0(%rsp)
movq 0x58(%rbx), %rsi
cmpq 0x60(%rbx), %rsi
je 0x2953
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x58(%rbx)
jmp 0x2960
movq 0x10(%rsp), %rdi
movq %r14, %rdx
callq 0x308a
movl $0x0, 0xc0(%rsp)
movq 0x70(%rbx), %rsi
cmpq 0x78(%rbx), %rsi
je 0x2985
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x70(%rbx)
jmp 0x2992
movq 0x8(%rsp), %rdi
movq %r14, %rdx
callq 0x308a
xorl %eax, %eax
movq %rax, 0xd0(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xc0(%rsp)
movq %rax, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
incl %r13d
movl %r13d, 0x88(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x31c6
movq %rax, %rdi
movq %r14, %rsi
callq 0x2f32
movl %r12d, 0x88(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x31c6
movq %rax, %rdi
leaq 0x40(%rsp), %rsi
callq 0x2f32
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x2a09
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x2a26
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
decl %r12d
cmpl (%r15), %r13d
jl 0x292e
movl $0x0, 0xc0(%rsp)
movq 0x58(%rbx), %rsi
cmpq 0x60(%rbx), %rsi
je 0x2a5f
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x58(%rbx)
leaq 0x250(%rsp), %r12
jmp 0x2a74
movq 0x10(%rsp), %rdi
movq %r14, %rdx
callq 0x308a
leaq 0x250(%rsp), %r12
movl $0x0, 0xc0(%rsp)
movq 0x70(%rbx), %rsi
cmpq 0x78(%rbx), %rsi
leaq 0x18(%rsp), %r13
je 0x2a9e
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x70(%rbx)
jmp 0x2aab
movq 0x8(%rsp), %rdi
movq %r14, %rdx
callq 0x308a
movq 0x250(%rsp), %rax
movq -0x18(%rax), %rax
leaq (%rsp,%rax), %rdi
addq $0x250, %rdi            # imm = 0x250
testb $0x5, 0x20(%rdi)
je 0x2679
movl $0x1, 0xc0(%rsp)
cmpl $0x0, 0x98(%rbx)
jle 0x2b37
leaq 0x80(%rbx), %r14
movl $0x1, %eax
leaq 0xc0(%rsp), %r15
movq 0x88(%rbx), %rsi
cmpq 0x90(%rbx), %rsi
je 0x2b13
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x88(%rbx)
jmp 0x2b1e
movq %r14, %rdi
movq %r15, %rdx
callq 0x38ce
movl 0xc0(%rsp), %ecx
leal 0x1(%rcx), %eax
movl %eax, 0xc0(%rsp)
cmpl 0x98(%rbx), %ecx
jl 0x2af4
movq 0x80(%rbx), %r14
movq 0x88(%rbx), %r15
movq %r15, %rax
subq %r14, %rax
je 0x2b94
leaq 0xc0(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x40(%rsp), %rsi
movq %r14, (%rsi)
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbx, %rcx
callq 0x3dbf
leaq 0x88(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x38(%rsp), %rsi
movq %r14, (%rsi)
movq %rbx, %rdx
callq 0x3f19
leaq 0x250(%rsp), %rdi
callq 0x2040
leaq 0x250(%rsp), %rdi
callq 0x2050
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x2bca
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2170
addq $0x458, %rsp            # imm = 0x458
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2bf8
jmp 0x2bf8
jmp 0x2bf8
movq %rax, %rbx
jmp 0x2c85
jmp 0x2bfd
jmp 0x2bf8
jmp 0x2bf8
jmp 0x2bf8
jmp 0x2c0f
jmp 0x2bf8
jmp 0x2bf8
movq %rax, %rbx
jmp 0x2c78
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x3d9a
jmp 0x2c12
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x3d9a
movq 0x639d(%rip), %rsi      # 0x8fc0
leaq 0xc0(%rsp), %rdi
callq 0x2100
leaq 0x140(%rsp), %rdi
callq 0x2070
jmp 0x2c78
jmp 0x2c41
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x2c5b
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x2c78
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
leaq 0x250(%rsp), %rdi
callq 0x2050
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x2ca1
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2210
nop