// File: /workspace/github_cpp_makefile_star2_O1/davidjosepha[P]slitherlink/src/shared/grid.cpp
// Function: Grid::setVLine(int, int, Edge)
bool Grid::setVLine(int i, int j, Edge edge) {
    assert(0 <= i && i < m_ && 0 <= j && j < n_+1);

    Edge prevEdge = getVLine(i, j);
    if (prevEdge == EMPTY) {
        vlines_[i][j] = edge;
    } else if (prevEdge != edge) {
        return false;
    } else if (prevEdge == edge) {
        return true;
    }

    // Update contour information
    if (edge == LINE) {
        updateContourMatrix(i, j, false);
    }

    // Update which parts of grid have possible rules that could be applied
    for (int x = std::max(0, i-2); x < std::min(i+1, getHeight()); x++) {
        for (int y = std::max(0, j-3); y < std::min(j+1, getWidth()); y++) {
            updateMatrix_[x][y] = true;
        }
    }

    // Update which parts of grid have possible contradictions
    for (int x = std::max(0, i-1); x < std::min(i+1, getHeight()); x++) {
        for (int y = std::max(0, j-2); y < std::min(j+1, getWidth()); y++) {
            contraMatrix_[x][y] = true;
        }
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
testl %esi, %esi
js 0x35fa
testl %edx, %edx
js 0x35fa
movl %esi, %r15d
movq %rdi, %r14
cmpl %esi, 0xc(%rdi)
jle 0x35fa
cmpl %edx, 0x10(%r14)
jl 0x35fa
movl %ecx, %r12d
movq %r14, %rdi
movl %r15d, %esi
movq %rdx, %rbx
callq 0x4360
testl %eax, %eax
je 0x348a
cmpl %r12d, %eax
sete %al
jmp 0x35eb
movq 0x28(%r14), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rax
movq %rbx, -0x38(%rbp)
movl %ebx, %ecx
movl %r12d, (%rax,%rcx,4)
cmpl $0x1, %r12d
jne 0x34b6
movq %r14, %rdi
movl %r15d, %esi
movq -0x38(%rbp), %rdx
xorl %ecx, %ecx
callq 0x32d6
cmpl $0x3, %r15d
movl $0x2, %eax
cmovgel %r15d, %eax
leal -0x2(%rax), %ecx
movq %r15, -0x58(%rbp)
leal 0x1(%r15), %esi
movq %r14, -0x50(%rbp)
movl 0xc(%r14), %edx
cmpl %esi, %edx
cmovll %edx, %esi
movl %esi, -0x2c(%rbp)
cmpl %esi, %ecx
jge 0x3559
movq -0x38(%rbp), %rcx
cmpl $0x4, %ecx
movl $0x3, %esi
cmovgel %ecx, %esi
leal -0x3(%rsi), %r14d
leal 0x1(%rcx), %r15d
movq -0x50(%rbp), %rdx
movl 0x10(%rdx), %ecx
cmpl %r15d, %ecx
cmovll %ecx, %r15d
movq 0x30(%rdx), %rcx
movq %rcx, -0x40(%rbp)
movl %r15d, %r12d
movq %rsi, -0x48(%rbp)
subl %esi, %r12d
addl $0x2, %r12d
incq %r12
movl %eax, %r13d
addq $-0x2, %r13
movslq -0x2c(%rbp), %rbx
cmpl %r15d, %r14d
jge 0x3551
movq -0x40(%rbp), %rax
movq (%rax,%r13,8), %rax
movq -0x48(%rbp), %rcx
leaq (%rax,%rcx), %rdi
addq $-0x3, %rdi
movl $0x1, %esi
movq %r12, %rdx
callq 0x20e0
incq %r13
cmpq %r13, %rbx
jne 0x352b
movq -0x58(%rbp), %rcx
cmpl $0x2, %ecx
movl $0x1, %r8d
cmovgel %ecx, %r8d
movb $0x1, %al
movl -0x2c(%rbp), %edi
cmpl %edi, %r8d
jg 0x35eb
movq -0x38(%rbp), %r12
cmpl $0x3, %r12d
movl $0x2, %r9d
cmovgel %r12d, %r9d
leal -0x2(%r9), %r13d
incl %r12d
movq -0x50(%rbp), %rsi
movl 0x10(%rsi), %ecx
cmpl %r12d, %ecx
cmovll %ecx, %r12d
movq 0x38(%rsi), %rax
movq %rax, -0x40(%rbp)
movl %r12d, %r14d
movq %r9, -0x48(%rbp)
subl %r9d, %r14d
incl %r14d
incq %r14
movl %r8d, %r15d
decq %r15
movl %edi, %ebx
cmpl %r12d, %r13d
jge 0x35e1
movq -0x40(%rbp), %rax
movq (%rax,%r15,8), %rax
movq -0x48(%rbp), %rcx
leaq (%rax,%rcx), %rdi
addq $-0x2, %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0x20e0
incq %r15
cmpq %r15, %rbx
jne 0x35bb
movb $0x1, %al
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xba84(%rip), %rdi      # 0xf085
leaq 0xba3d(%rip), %rsi      # 0xf045
leaq 0xba9d(%rip), %rcx      # 0xf0ac
movl $0xac, %edx
callq 0x2100
nop