// File: /workspace/github_cpp_makefile_star2_O2/cybozu[P]yrmcds/cybozu/config_parser.cpp
// Function: cybozu::config_parser::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void config_parser::load(const std::string& path) {
    m_config.clear();

    std::ifstream is(path);
    if( !is )
        throw std::runtime_error("failed to open " + path);
    unsigned int lineno = 0;

    for( std::string l; std::getline(is, l); ) {
        lineno++;

        ltrim(l);
        rtrim(l);
        if( l.empty() || l[0] == '#' ) continue;

        std::size_t n = l.find('=');
        if( n == std::string::npos )
            throw parse_error(path, lineno);
        std::string key = l.substr(0, n);
        rtrim(key);
        std::string value = l.substr(n+1);
        ltrim(value);

        // unquote the value
        std::size_t len = value.size();
        if( len >= 2 && value[0] == '"' && value[len-1] == '"' ) {
            value = value.substr(1, len-2);
        }

        set(key, value);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rsi, %r14
movq %rdi, 0x28(%rsp)
callq 0xd86a
leaq 0x90(%rsp), %rbx
pushq $0x8
popq %rdx
movq %rbx, %rdi
movq %r14, (%rsp)
movq %r14, %rsi
callq 0x78b0
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xb0(%rsp,%rax)
jne 0x101cd
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
pushq $0x1
popq %rbp
leaq 0x8(%rsp), %r12
leaq 0x50(%rsp), %rbx
leaq 0x30(%rsp), %r13
leaq 0x70(%rsp), %r15
leaq 0x90(%rsp), %rdi
movq %r12, %rsi
callq 0x7070
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x10173
movq %r12, %rdi
callq 0x1028d
movq %r12, %rdi
callq 0x102ad
cmpq $0x0, 0x10(%rsp)
je 0x1016c
movq 0x8(%rsp), %rax
cmpb $0x23, (%rax)
je 0x1016c
movq %r12, %rdi
pushq $0x3d
popq %rsi
xorl %edx, %edx
callq 0x7690
cmpq $-0x1, %rax
je 0x1019c
movq %rax, %r14
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x7540
movq %rbx, %rdi
callq 0x102ad
incq %r14
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
pushq $-0x1
popq %rcx
callq 0x7540
movq %r13, %rdi
callq 0x1028d
movq 0x38(%rsp), %rcx
cmpq $0x2, %rcx
jb 0x1014c
movq 0x30(%rsp), %rax
cmpb $0x22, (%rax)
jne 0x1014c
cmpb $0x22, -0x1(%rax,%rcx)
jne 0x1014c
addq $-0x2, %rcx
movq %r15, %rdi
movq %r13, %rsi
pushq $0x1
popq %rdx
callq 0x7540
movq %r13, %rdi
movq %r15, %rsi
callq 0x75e0
movq %r15, %rdi
callq 0x71d0
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x103be
movq %r13, %rdi
callq 0x71d0
movq %rbx, %rdi
callq 0x71d0
incl %ebp
jmp 0x10071
leaq 0x8(%rsp), %rdi
callq 0x71d0
leaq 0x90(%rsp), %rdi
callq 0x70e0
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x7240
movq %rax, %r14
movq %rax, %rdi
movq (%rsp), %rsi
movl %ebp, %edx
callq 0x102de
leaq 0x2a2d4(%rip), %rsi     # 0x3a490
movq 0x2adbd(%rip), %rdx     # 0x3af80
movq %r14, %rdi
callq 0x7950
jmp 0x10215
pushq $0x10
popq %rdi
callq 0x7240
movq %rax, %r14
leaq 0x16a0d(%rip), %rsi     # 0x26bec
leaq 0x8(%rsp), %rdi
movq (%rsp), %rdx
callq 0x9655
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x78c0
xorl %ebp, %ebp
movq 0x2adea(%rip), %rsi     # 0x3aff0
movq 0x2ad63(%rip), %rdx     # 0x3af70
movq %r14, %rdi
callq 0x7950
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x71d0
testb %bpl, %bpl
jne 0x1022c
jmp 0x10278
movq %rax, %rbx
movq %r14, %rdi
callq 0x7390
jmp 0x10278
jmp 0x1024d
jmp 0x1026b
movq %rax, %rbx
movq %r14, %rdi
callq 0x7390
jmp 0x1026e
jmp 0x1025c
jmp 0x1026b
jmp 0x1024d
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x71d0
jmp 0x1025f
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x71d0
jmp 0x1026e
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x71d0
leaq 0x90(%rsp), %rdi
callq 0x70e0
movq %rbx, %rdi
callq 0x7990