// File: grogers0[P]dots_and_boxes/InputOutput.cpp
// Function: Board::read_vert_edges(int, _IO_FILE*)
void Board::read_vert_edges(int y, FILE *fp)
{
    int c, x = 0;
    bool reading_cell = false;

    while ((c = fgetc(fp)) != EOF) {
        switch (c) {
            case '\r':
                break;
            case '\n':
                if (x != width + 1) {
                    fprintf(stderr, "x (%d) != width + 1 (%d) at '\\n', vert edges, y = %d\n",
                            x, width + 1, y);
                    exit(1);
                }
                return;
            case '|':
                if (x > width) {
                    fprintf(stderr, "x (%d) > width (%d) at '|', vert edges, y = %d\n",
                            x, width, y);
                    exit(1);
                }
                edges[edge_index(Edge(VERT, x, y))] = true;
                ++x;
                break;
            case ' ':
                if (x > width) {
                    fprintf(stderr, "x (%d) > width (%d) at ' ', vert edges, y = %d\n",
                            x, width, y);
                    exit(1);
                }

                if (!reading_cell) {
                    edges[edge_index(Edge(VERT, x, y))] = false;
                    ++x;
                }
                break;
            case '#':
                break;
            default:
                fprintf(stderr, "unexpected character %d reading board, vert edges, y = %d\n",
                        c, y);
                exit(1);
        }

        reading_cell = !reading_cell;
    }

    if (c == EOF)
        exit(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movl $0x0, -0x20(%rbp)
movb $0x0, -0x21(%rbp)
movq -0x18(%rbp), %rdi
callq 0x23b0
movl %eax, -0x1c(%rbp)
cmpl $-0x1, %eax
je 0x4eef
movl -0x1c(%rbp), %eax
movl %eax, -0x64(%rbp)
subl $0xa, %eax
je 0x4d43
jmp 0x4d0b
movl -0x64(%rbp), %eax
subl $0xd, %eax
je 0x4d3e
jmp 0x4d15
movl -0x64(%rbp), %eax
subl $0x20, %eax
je 0x4e20
jmp 0x4d23
movl -0x64(%rbp), %eax
subl $0x23, %eax
je 0x4eb6
jmp 0x4d31
movl -0x64(%rbp), %eax
subl $0x7c, %eax
je 0x4d8a
jmp 0x4eb8
jmp 0x4ee0
movq -0x60(%rbp), %rcx
movl -0x20(%rbp), %eax
movl (%rcx), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
je 0x4d85
movq -0x60(%rbp), %rax
movq 0xa27a(%rip), %rcx      # 0xefd8
movq (%rcx), %rdi
movl -0x20(%rbp), %edx
movl (%rax), %ecx
addl $0x1, %ecx
movl -0xc(%rbp), %r8d
leaq 0x554d(%rip), %rsi      # 0xa2c1
movb $0x0, %al
callq 0x2340
movl $0x1, %edi
callq 0x22e0
jmp 0x4efc
movq -0x60(%rbp), %rcx
movl -0x20(%rbp), %eax
cmpl (%rcx), %eax
jle 0x4dc4
movq -0x60(%rbp), %rax
movq 0xa238(%rip), %rcx      # 0xefd8
movq (%rcx), %rdi
movl -0x20(%rbp), %edx
movl (%rax), %ecx
movl -0xc(%rbp), %r8d
leaq 0x5544(%rip), %rsi      # 0xa2f7
movb $0x0, %al
callq 0x2340
movl $0x1, %edi
callq 0x22e0
movq -0x60(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x70(%rbp)
movl -0x20(%rbp), %edx
movl -0xc(%rbp), %ecx
leaq -0x3c(%rbp), %rdi
movl $0x1, %esi
callq 0x41d0
movq -0x60(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x32f0
movq -0x70(%rbp), %rdi
movslq %eax, %rsi
callq 0x3290
movq %rax, -0x38(%rbp)
movq %rdx, -0x30(%rbp)
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x3380
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x4ee0
movq -0x60(%rbp), %rcx
movl -0x20(%rbp), %eax
cmpl (%rcx), %eax
jle 0x4e5a
movq -0x60(%rbp), %rax
movq 0xa1a2(%rip), %rcx      # 0xefd8
movq (%rcx), %rdi
movl -0x20(%rbp), %edx
movl (%rax), %ecx
movl -0xc(%rbp), %r8d
leaq 0x54de(%rip), %rsi      # 0xa327
movb $0x0, %al
callq 0x2340
movl $0x1, %edi
callq 0x22e0
testb $0x1, -0x21(%rbp)
jne 0x4eb4
movq -0x60(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x78(%rbp)
movl -0x20(%rbp), %edx
movl -0xc(%rbp), %ecx
leaq -0x54(%rbp), %rdi
movl $0x1, %esi
callq 0x41d0
movq -0x60(%rbp), %rdi
movl -0x54(%rbp), %esi
callq 0x32f0
movq -0x78(%rbp), %rdi
movslq %eax, %rsi
callq 0x3290
movq %rax, -0x50(%rbp)
movq %rdx, -0x48(%rbp)
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x3380
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x4ee0
jmp 0x4ee0
movq 0xa119(%rip), %rax      # 0xefd8
movq (%rax), %rdi
movl -0x1c(%rbp), %edx
movl -0xc(%rbp), %ecx
leaq 0x5488(%rip), %rsi      # 0xa357
movb $0x0, %al
callq 0x2340
movl $0x1, %edi
callq 0x22e0
movb -0x21(%rbp), %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x21(%rbp)
jmp 0x4ce9
cmpl $-0x1, -0x1c(%rbp)
jne 0x4efc
xorl %edi, %edi
callq 0x22e0
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)