// File: stevedonovan[P]outstreams/instream.cpp
// Function: stream::Reader::formatted_read(char const*, char const*, char const*, ...)
Reader& Reader::formatted_read(const char *ctype, const char *def, const char *fmt, ...) {
    if (fail()) return *this;
    va_list ap;
    va_start(ap,fmt);
    if (fmt == nullptr) {
         fmt = def;
    }
    int res = read_fmt(fmt,ap);
    if (res == EOF) {
        if (errno != 0) { // we remain in hope
            set_error(strerror(errno),errno);
        } else { // but invariably it just means EOF
            set_error("EOF reading " + std::string(ctype),EOF);
        }
    } else
    if (res != 1 && *ctype != 'S') {
         std::string chars;
         (*this)(chars,"%5s");
         set_error("error reading " + std::string(ctype) + " at '" + chars + "'",1);
    }
    pos += fpos;
    va_end(ap);
    return *this;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x280, %rsp            # imm = 0x280
testb %al, %al
je 0x4487
movaps %xmm0, -0x210(%rbp)
movaps %xmm1, -0x200(%rbp)
movaps %xmm2, -0x1f0(%rbp)
movaps %xmm3, -0x1e0(%rbp)
movaps %xmm4, -0x1d0(%rbp)
movaps %xmm5, -0x1c0(%rbp)
movaps %xmm6, -0x1b0(%rbp)
movaps %xmm7, -0x1a0(%rbp)
movq %r9, -0x218(%rbp)
movq %r8, -0x220(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x4230
testb $0x1, %al
jne 0x44bb
jmp 0x44cb
movq -0x248(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x48f3
leaq -0x40(%rbp), %rax
leaq -0x240(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x20, (%rax)
cmpq $0x0, -0x28(%rbp)
jne 0x44fe
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x248(%rbp), %rdi
movq -0x28(%rbp), %rsi
leaq -0x40(%rbp), %rdx
movq (%rdi), %rax
callq *0x8(%rax)
movl %eax, -0x44(%rbp)
cmpl $-0x1, -0x44(%rbp)
jne 0x46b7
callq 0x3050
cmpl $0x0, (%rax)
je 0x45cb
callq 0x3050
movl (%rax), %edi
callq 0x30b0
movq %rax, -0x258(%rbp)
leaq -0x69(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0x3340
movq -0x258(%rbp), %rsi
movq -0x250(%rbp), %rdx
leaq -0x68(%rbp), %rdi
callq 0x3aa0
jmp 0x456a
callq 0x3050
movq -0x248(%rbp), %rdi
movl (%rax), %edx
leaq -0x68(%rbp), %rsi
callq 0x4400
jmp 0x4583
leaq -0x68(%rbp), %rdi
callq 0x33c8
leaq -0x69(%rbp), %rdi
callq 0x31e0
jmp 0x46b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x45bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x33c8
leaq -0x69(%rbp), %rdi
callq 0x31e0
jmp 0x4900
movq -0x18(%rbp), %rax
movq %rax, -0x268(%rbp)
leaq -0xc1(%rbp), %rdi
movq %rdi, -0x260(%rbp)
callq 0x3340
movq -0x268(%rbp), %rsi
movq -0x260(%rbp), %rdx
leaq -0xc0(%rbp), %rdi
callq 0x3aa0
jmp 0x4605
leaq 0x2ab4(%rip), %rsi      # 0x70c0
leaq -0xa0(%rbp), %rdi
leaq -0xc0(%rbp), %rdx
callq 0x5a40
jmp 0x4621
movq -0x248(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x4400
jmp 0x463b
leaq -0xa0(%rbp), %rdi
callq 0x33c8
leaq -0xc0(%rbp), %rdi
callq 0x33c8
leaq -0xc1(%rbp), %rdi
callq 0x31e0
jmp 0x46b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x46a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4695
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x33c8
leaq -0xc0(%rbp), %rdi
callq 0x33c8
leaq -0xc1(%rbp), %rdi
callq 0x31e0
jmp 0x4900
jmp 0x48db
cmpl $0x1, -0x44(%rbp)
je 0x48d9
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x53, %eax
je 0x48d9
leaq -0xe8(%rbp), %rdi
movq %rdi, -0x270(%rbp)
callq 0x32c0
movq -0x248(%rbp), %rdi
movq -0x270(%rbp), %rsi
leaq 0x29d4(%rip), %rdx      # 0x70cd
callq 0x4910
jmp 0x4700
movq -0x18(%rbp), %rax
movq %rax, -0x280(%rbp)
leaq -0x189(%rbp), %rdi
movq %rdi, -0x278(%rbp)
callq 0x3340
movq -0x280(%rbp), %rsi
movq -0x278(%rbp), %rdx
leaq -0x188(%rbp), %rdi
callq 0x3aa0
jmp 0x473a
leaq 0x2990(%rip), %rsi      # 0x70d1
leaq -0x168(%rbp), %rdi
leaq -0x188(%rbp), %rdx
callq 0x5a40
jmp 0x4756
leaq 0x2983(%rip), %rdx      # 0x70e0
leaq -0x148(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x5a90
jmp 0x4772
leaq -0x128(%rbp), %rdi
leaq -0x148(%rbp), %rsi
leaq -0xe8(%rbp), %rdx
callq 0x5ae0
jmp 0x478e
leaq 0x294f(%rip), %rdx      # 0x70e4
leaq -0x108(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x5a90
jmp 0x47aa
movq -0x248(%rbp), %rdi
leaq -0x108(%rbp), %rsi
movl $0x1, %edx
callq 0x4400
jmp 0x47c4
leaq -0x108(%rbp), %rdi
callq 0x33c8
leaq -0x128(%rbp), %rdi
callq 0x33c8
leaq -0x148(%rbp), %rdi
callq 0x33c8
leaq -0x168(%rbp), %rdi
callq 0x33c8
leaq -0x188(%rbp), %rdi
callq 0x33c8
leaq -0x189(%rbp), %rdi
callq 0x31e0
leaq -0xe8(%rbp), %rdi
callq 0x33c8
jmp 0x48d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x48cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x48bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x48b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x48a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x489b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x488f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x33c8
leaq -0x128(%rbp), %rdi
callq 0x33c8
leaq -0x148(%rbp), %rdi
callq 0x33c8
leaq -0x168(%rbp), %rdi
callq 0x33c8
leaq -0x188(%rbp), %rdi
callq 0x33c8
leaq -0x189(%rbp), %rdi
callq 0x31e0
leaq -0xe8(%rbp), %rdi
callq 0x33c8
jmp 0x4900
jmp 0x48db
movq -0x248(%rbp), %rax
movl 0x14(%rax), %ecx
addl 0x18(%rax), %ecx
movl %ecx, 0x18(%rax)
leaq -0x40(%rbp), %rcx
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x280, %rsp            # imm = 0x280
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x3330
nopl (%rax)