// File: Laakeri[P]maxpre/src/preprocessorinterface.cpp
// Function: maxPreprocessor::PreprocessorInterface::alterWeight(int, unsigned long)
bool PreprocessorInterface::alterWeight(int lbl, uint64_t weight) {
		if (!inProcessMode) return false;
		if (lbl < 1) return false;
		int iVar = solverVarToPPVar[lbl-1]-1;
		assert(iVar >= 0);
		int softClause = -1;
		if (preprocessor.pi.isLabel[iVar] == VAR_TRUE) {
			assert(preprocessor.pi.litClauses[posLit(iVar)].size() == 1);
			softClause = preprocessor.pi.litClauses[posLit(iVar)][0];
		}
		else if (preprocessor.pi.isLabel[iVar] == VAR_FALSE) {
			assert(preprocessor.pi.litClauses[negLit(iVar)].size() == 1);
			softClause = preprocessor.pi.litClauses[negLit(iVar)][0];
		}
		else {
			return false;
		}
		if (weight >= topWeight) {
			preprocessor.pi.isLabel[iVar] = 0;
			weight = HARDWEIGHT;
		}
		assert(!preprocessor.pi.clauses[softClause].isHard());
		preprocessor.pi.clauses[softClause].weight = weight;
		if (weight == HARDWEIGHT) {
			assert(preprocessor.pi.clauses[softClause].isHard());
		}
		else {
			assert(preprocessor.pi.labelWeight(iVar) == weight);
		}
		return true;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
testb $0x1, 0x1850(%rax)
jne 0x784cd
movb $0x0, -0x1(%rbp)
jmp 0x787b5
cmpl $0x1, -0x14(%rbp)
jge 0x784dc
movb $0x0, -0x1(%rbp)
jmp 0x787b5
movq -0x30(%rbp), %rdi
addq $0x1868, %rdi           # imm = 0x1868
movl -0x14(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xa7c0
movl (%rax), %eax
subl $0x1, %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0x78505
jmp 0x78524
leaq 0xf81a(%rip), %rdi      # 0x87d26
leaq 0xf711(%rip), %rsi      # 0x87c24
movl $0x8f, %edx
leaq 0xf811(%rip), %rcx      # 0x87d30
callq 0x4260
movq -0x30(%rbp), %rdi
movl $0xffffffff, -0x28(%rbp) # imm = 0xFFFFFFFF
addq $0x8, %rdi
addq $0x48, %rdi
movslq -0x24(%rbp), %rsi
callq 0xa7c0
cmpl $0x1, (%rax)
jne 0x785d6
movq -0x30(%rbp), %rax
addq $0x8, %rax
addq $0x18, %rax
movq %rax, -0x38(%rbp)
movl -0x24(%rbp), %edi
callq 0x3c5d0
movq -0x38(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, %rdi
callq 0xf940
cmpq $0x1, %rax
jne 0x7857d
jmp 0x7859c
leaq 0xf7f4(%rip), %rdi      # 0x87d78
leaq 0xf699(%rip), %rsi      # 0x87c24
movl $0x92, %edx
leaq 0xf799(%rip), %rcx      # 0x87d30
callq 0x4260
movq -0x30(%rbp), %rax
addq $0x8, %rax
addq $0x18, %rax
movq %rax, -0x40(%rbp)
movl -0x24(%rbp), %edi
callq 0x3c5d0
movq -0x40(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movl (%rax), %eax
movl %eax, -0x28(%rbp)
jmp 0x78689
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
addq $0x48, %rdi
movslq -0x24(%rbp), %rsi
callq 0xa7c0
cmpl $0x2, (%rax)
jne 0x7867e
movq -0x30(%rbp), %rax
addq $0x8, %rax
addq $0x18, %rax
movq %rax, -0x48(%rbp)
movl -0x24(%rbp), %edi
callq 0x3c5e0
movq -0x48(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, %rdi
callq 0xf940
cmpq $0x1, %rax
jne 0x78628
jmp 0x78647
leaq 0xf77e(%rip), %rdi      # 0x87dad
leaq 0xf5ee(%rip), %rsi      # 0x87c24
movl $0x96, %edx
leaq 0xf6ee(%rip), %rcx      # 0x87d30
callq 0x4260
movq -0x30(%rbp), %rax
addq $0x8, %rax
addq $0x18, %rax
movq %rax, -0x50(%rbp)
movl -0x24(%rbp), %edi
callq 0x3c5e0
movq -0x50(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movl (%rax), %eax
movl %eax, -0x28(%rbp)
jmp 0x78687
movb $0x0, -0x1(%rbp)
jmp 0x787b5
jmp 0x78689
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
cmpq 0x1848(%rcx), %rax
jb 0x786c3
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
addq $0x48, %rdi
movslq -0x24(%rbp), %rsi
callq 0xa7c0
movl $0x0, (%rax)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
movslq -0x28(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0x60e90
xorb $-0x1, %al
testb $0x1, %al
jne 0x786e4
jmp 0x786e6
jmp 0x78705
leaq 0xf6f5(%rip), %rdi      # 0x87de2
leaq 0xf530(%rip), %rsi      # 0x87c24
movl $0xa0, %edx
leaq 0xf630(%rip), %rcx      # 0x87d30
callq 0x4260
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
addq $0x8, %rdi
movslq -0x28(%rbp), %rsi
callq 0x3c600
movq -0x58(%rbp), %rcx
movq %rcx, 0x18(%rax)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
cmpq %rax, -0x20(%rbp)
jne 0x78778
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
movslq -0x28(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0x60e90
testb $0x1, %al
jne 0x78755
jmp 0x78757
jmp 0x78776
leaq 0xf685(%rip), %rdi      # 0x87de3
leaq 0xf4bf(%rip), %rsi      # 0x87c24
movl $0xa3, %edx
leaq 0xf5bf(%rip), %rcx      # 0x87d30
callq 0x4260
jmp 0x787b1
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
movl -0x24(%rbp), %esi
callq 0x5ed50
cmpq -0x20(%rbp), %rax
jne 0x78790
jmp 0x787af
leaq 0xf679(%rip), %rdi      # 0x87e10
leaq 0xf486(%rip), %rsi      # 0x87c24
movl $0xa6, %edx
leaq 0xf586(%rip), %rcx      # 0x87d30
callq 0x4260
jmp 0x787b1
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq