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

    while ((c = fgetc(fp)) != EOF) {
        switch (c) {
            case '\r':
                break;
            case '\n':
                if (x != width) {
                    fprintf(stderr, "x (%d) != width (%d) at newline while reading board\n",
                            x, width);
                    exit(1);
                }
                return;
            case '+':
                break;
            case '-':
                if (x >= width) {
                    fprintf(stderr, "x (%d) >= width (%d) at dash while reading board\n",
                            x, width);
                    exit(1);
                }
                edges[edge_index(Edge(HORIZ, x, y))] = true;
                ++x;
                break;
            case ' ':
                if (x >= width) {
                    fprintf(stderr, "x (%d) >= width (%d) at space while reading board\n",
                            x, width);
                    exit(1);
                }
                edges[edge_index(Edge(HORIZ, x, y))] = false;
                ++x;
                break;
            default:
                fprintf(stderr, "unexpected character %d while reading board\n", c);
                exit(1);
        }
    }

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x23b0
movl %eax, -0x1c(%rbp)
cmpl $-0x1, %eax
je 0x4ca7
movl -0x1c(%rbp), %eax
addl $-0xa, %eax
movl %eax, %ecx
movq %rcx, -0x60(%rbp)
subl $0x23, %eax
ja 0x4c7d
movq -0x60(%rbp), %rax
leaq 0x55e1(%rip), %rcx      # 0xa0f8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x4ca2
movq -0x58(%rbp), %rcx
movl -0x20(%rbp), %eax
cmpl (%rcx), %eax
je 0x4b5b
movq -0x58(%rbp), %rax
movq 0xa49d(%rip), %rcx      # 0xefd8
movq (%rcx), %rdi
movl -0x20(%rbp), %edx
movl (%rax), %ecx
leaq 0x56b0(%rip), %rsi      # 0xa1fa
movb $0x0, %al
callq 0x2340
movl $0x1, %edi
callq 0x22e0
jmp 0x4cb4
jmp 0x4ca2
movq -0x58(%rbp), %rcx
movl -0x20(%rbp), %eax
cmpl (%rcx), %eax
jl 0x4b9b
movq -0x58(%rbp), %rax
movq 0xa45d(%rip), %rcx      # 0xefd8
movq (%rcx), %rdi
movl -0x20(%rbp), %edx
movl (%rax), %ecx
leaq 0x56a5(%rip), %rsi      # 0xa22f
movb $0x0, %al
callq 0x2340
movl $0x1, %edi
callq 0x22e0
movq -0x58(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x68(%rbp)
movl -0x20(%rbp), %edx
movl -0xc(%rbp), %ecx
leaq -0x34(%rbp), %rdi
xorl %esi, %esi
callq 0x41d0
movq -0x58(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x32f0
movq -0x68(%rbp), %rdi
movslq %eax, %rsi
callq 0x3290
movq %rax, -0x30(%rbp)
movq %rdx, -0x28(%rbp)
leaq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0x3380
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x4ca2
movq -0x58(%rbp), %rcx
movl -0x20(%rbp), %eax
cmpl (%rcx), %eax
jl 0x4c2a
movq -0x58(%rbp), %rax
movq 0xa3ce(%rip), %rcx      # 0xefd8
movq (%rcx), %rdi
movl -0x20(%rbp), %edx
movl (%rax), %ecx
leaq 0x5648(%rip), %rsi      # 0xa261
movb $0x0, %al
callq 0x2340
movl $0x1, %edi
callq 0x22e0
movq -0x58(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x70(%rbp)
movl -0x20(%rbp), %edx
movl -0xc(%rbp), %ecx
leaq -0x4c(%rbp), %rdi
xorl %esi, %esi
callq 0x41d0
movq -0x58(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x32f0
movq -0x70(%rbp), %rdi
movslq %eax, %rsi
callq 0x3290
movq %rax, -0x48(%rbp)
movq %rdx, -0x40(%rbp)
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x3380
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x4ca2
movq 0xa354(%rip), %rax      # 0xefd8
movq (%rax), %rdi
movl -0x1c(%rbp), %edx
leaq 0x5603(%rip), %rsi      # 0xa294
movb $0x0, %al
callq 0x2340
movl $0x1, %edi
callq 0x22e0
jmp 0x4ae2
cmpl $-0x1, -0x1c(%rbp)
jne 0x4cb4
xorl %edi, %edi
callq 0x22e0
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)