// File: /workspace/github_cpp_makefile_star2_O3/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 0x3632
testl %edx, %edx
js 0x3632
movl %esi, %r15d
movq %rdi, %r14
cmpl %esi, 0xc(%rdi)
jle 0x3632
cmpl %edx, 0x10(%r14)
jl 0x3632
movl %ecx, %r12d
movq %r14, %rdi
movl %r15d, %esi
movq %rdx, %rbx
callq 0x4368
testl %eax, %eax
je 0x34cc
cmpl %r12d, %eax
sete %al
jmp 0x3623
movq 0x28(%r14), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rax
movq %rbx, -0x30(%rbp)
movl %ebx, %ecx
movl %r12d, (%rax,%rcx,4)
cmpl $0x1, %r12d
jne 0x34f8
movq %r14, %rdi
movl %r15d, %esi
movq -0x30(%rbp), %rdx
xorl %ecx, %ecx
callq 0x3332
cmpl $0x3, %r15d
movl $0x2, %eax
cmovael %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, %r13d
movl %esi, -0x44(%rbp)
cmpl %esi, %ecx
jge 0x3599
movq -0x30(%rbp), %rcx
cmpl $0x4, %ecx
movl $0x3, %esi
cmovael %ecx, %esi
leal 0x1(%rcx), %r15d
movq -0x50(%rbp), %rdx
movl 0x10(%rdx), %ecx
cmpl %r15d, %ecx
cmovll %ecx, %r15d
leal -0x3(%rsi), %r14d
movq 0x30(%rdx), %rcx
movq %rcx, -0x38(%rbp)
movl %r15d, %r12d
movq %rsi, -0x40(%rbp)
subl %esi, %r12d
addl $0x2, %r12d
incq %r12
movl %eax, %ebx
addq $-0x2, %rbx
cmpl %r15d, %r14d
jge 0x3591
movq -0x38(%rbp), %rax
movq (%rax,%rbx,8), %rax
movq -0x40(%rbp), %rcx
leaq (%rax,%rcx), %rdi
addq $-0x3, %rdi
movl $0x1, %esi
movq %r12, %rdx
callq 0x20e0
incq %rbx
cmpq %rbx, %r13
jne 0x356b
movq -0x58(%rbp), %rcx
cmpl $0x2, %ecx
movl $0x1, %edi
cmovgel %ecx, %edi
movb $0x1, %al
cmpl -0x44(%rbp), %edi
jg 0x3623
movq -0x30(%rbp), %r12
cmpl $0x3, %r12d
movl $0x2, %r8d
cmovgel %r12d, %r8d
incl %r12d
movq -0x50(%rbp), %rsi
movl 0x10(%rsi), %ecx
cmpl %r12d, %ecx
cmovll %ecx, %r12d
leal -0x2(%r8), %r15d
movq 0x38(%rsi), %rax
movq %rax, -0x38(%rbp)
movl %r12d, %r14d
movq %r8, -0x40(%rbp)
subl %r8d, %r14d
incl %r14d
incq %r14
movl %edi, %ebx
decq %rbx
cmpl %r12d, %r15d
jge 0x3619
movq -0x38(%rbp), %rax
movq (%rax,%rbx,8), %rax
movq -0x40(%rbp), %rcx
leaq (%rax,%rcx), %rdi
addq $-0x2, %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0x20e0
incq %rbx
cmpq %rbx, %r13
jne 0x35f3
movb $0x1, %al
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xba4c(%rip), %rdi      # 0xf085
leaq 0xba05(%rip), %rsi      # 0xf045
leaq 0xba65(%rip), %rcx      # 0xf0ac
movl $0xac, %edx
callq 0x2100
nop