// File: Laakeri[P]maxpre/src/preprocessor.cpp
// Function: maxPreprocessor::Preprocessor::setVariable(int, bool)
int Preprocessor::setVariable(int var, bool value) {
	int removed = 0;
	trace.setVar(var, value);
	vector<int>& satClauses = (value == true) ? pi.litClauses[posLit(var)] : pi.litClauses[negLit(var)];
	vector<int>& notSatClauses = (value == true) ? pi.litClauses[negLit(var)] : pi.litClauses[posLit(var)];
	for (int c : satClauses) {
		pi.removeClause(c);
		removed++;
	}
	for (int c : notSatClauses) {
		if (value == true) pi.removeLiteralFromClause(negLit(var), c);
		else pi.removeLiteralFromClause(posLit(var), c);
	}
	return removed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
andb $0x1, %al
movb %al, -0xd(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x70(%rbp)
movl $0x0, -0x14(%rbp)
addq $0x2f0, %rdi            # imm = 0x2F0
movl -0xc(%rbp), %esi
movb -0xd(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
callq 0x5c160
movb -0xd(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x10ad2
movq -0x70(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x80(%rbp)
movl -0xc(%rbp), %edi
callq 0x3c5d0
movq -0x80(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, -0x78(%rbp)
jmp 0x10afc
movq -0x70(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x88(%rbp)
movl -0xc(%rbp), %edi
callq 0x3c5e0
movq -0x88(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x20(%rbp)
movb -0xd(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x10b40
movq -0x70(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x98(%rbp)
movl -0xc(%rbp), %edi
callq 0x3c5e0
movq -0x98(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, -0x90(%rbp)
jmp 0x10b6d
movq -0x70(%rbp), %rax
addq $0x18, %rax
movq %rax, -0xa0(%rbp)
movl -0xc(%rbp), %edi
callq 0x3c5d0
movq -0xa0(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0xa800
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0xa830
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x10bad
jmp 0x10bdb
leaq -0x38(%rbp), %rdi
callq 0xa8a0
movq -0x70(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %esi
callq 0x5f7f0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xa930
jmp 0x10b9a
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
callq 0xa800
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
callq 0xa830
movq %rax, -0x60(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x10c10
jmp 0x10c70
leaq -0x58(%rbp), %rdi
callq 0xa8a0
movl (%rax), %eax
movl %eax, -0x64(%rbp)
movb -0xd(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x10c48
movl -0xc(%rbp), %edi
callq 0x3c5e0
movq -0x70(%rbp), %rdi
movl %eax, %esi
movl -0x64(%rbp), %edx
movl $0x1, %ecx
callq 0x5fb90
jmp 0x10c63
movl -0xc(%rbp), %edi
callq 0x3c5d0
movq -0x70(%rbp), %rdi
movl %eax, %esi
movl -0x64(%rbp), %edx
movl $0x1, %ecx
callq 0x5fb90
jmp 0x10c65
leaq -0x58(%rbp), %rdi
callq 0xa930
jmp 0x10bfd
movl -0x14(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)