// File: /workspace/github_cpp_makefile_star2_O3/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 $0x2a8, %rsp            # imm = 0x2A8
movq %rsi, %r14
movq %rdi, 0x78(%rsp)
callq 0xe9f0
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
movq %r14, 0x30(%rsp)
movq %r14, %rsi
movl $0x8, %edx
callq 0x78a0
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xc0(%rsp,%rax)
jne 0x117ee
leaq 0x20(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
movl $0x1, %ebp
leaq 0xa0(%rsp), %r14
leaq 0x10(%rsp), %r13
leaq 0x23796(%rip), %r15     # 0x34cab
leaq 0x58(%rsp), %rbx
leaq (%rsp,%rax), %rdi
addq $0xa0, %rdi
movl $0xa, %esi
callq 0x74d0
movsbl %al, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x7a10
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1174d
movl $0x6, %ecx
movq %r13, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x7910
movq %r13, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x70a0
movl $0x6, %ecx
movq %r13, %rdi
movq %r15, %rsi
movq $-0x1, %rdx
callq 0x78c0
incq %rax
movq 0x18(%rsp), %rcx
cmpq %rax, %rcx
jb 0x11788
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rcx
movb $0x0, (%rcx,%rax)
cmpq $0x0, 0x18(%rsp)
je 0x1173a
movq 0x10(%rsp), %rax
cmpb $0x23, (%rax)
je 0x1173a
movl %ebp, 0xc(%rsp)
movq %r15, %rbp
movq %rbx, %r14
movq %r13, %rdi
movl $0x3d, %esi
xorl %edx, %edx
callq 0x7670
cmpq $-0x1, %rax
je 0x117b8
movq %rax, %rbx
movq %r14, %r15
movq %r14, %rdi
movq %r13, %r12
movq %r13, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x7520
movl $0x6, %ecx
movq %r15, %rdi
movq %rbp, %rsi
movq $-0x1, %rdx
callq 0x78c0
incq %rax
movq 0x60(%rsp), %rcx
cmpq %rax, %rcx
jb 0x117a0
movq %rax, 0x60(%rsp)
movq 0x58(%rsp), %rcx
movb $0x0, (%rcx,%rax)
incq %rbx
leaq 0x38(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq $-0x1, %rcx
callq 0x7520
movl $0x6, %ecx
movq %r15, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x7910
movq %r15, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x70a0
movq %r14, %rbx
movq 0x40(%rsp), %rcx
cmpq $0x2, %rcx
leaq 0xa0(%rsp), %r14
movq %rbp, %r15
movl 0xc(%rsp), %ebp
movq %r12, %r13
jb 0x116f0
movq 0x38(%rsp), %rax
cmpb $0x22, (%rax)
jne 0x116f0
cmpb $0x22, -0x1(%rax,%rcx)
jne 0x116f0
addq $-0x2, %rcx
movl $0x1, %edx
leaq 0x80(%rsp), %rdi
leaq 0x38(%rsp), %r12
movq %r12, %rsi
callq 0x7520
movq %r12, %rdi
leaq 0x80(%rsp), %rsi
callq 0x75d0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x116f0
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x7500
movq 0x78(%rsp), %rdi
movq %rbx, %rsi
leaq 0x38(%rsp), %rdx
callq 0x11b9a
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x1171e
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x7500
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x1173a
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x7500
movq 0xa0(%rsp), %rax
movq -0x18(%rax), %rax
incl %ebp
jmp 0x1151a
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x11769
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x7500
leaq 0xa0(%rsp), %rdi
callq 0x70c0
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x234a5(%rip), %rdi     # 0x34c34
leaq 0x2348a(%rip), %rsi     # 0x34c20
movq %rax, %rdx
xorl %eax, %eax
callq 0x7810
leaq 0x2348d(%rip), %rdi     # 0x34c34
leaq 0x23472(%rip), %rsi     # 0x34c20
movq %rax, %rdx
xorl %eax, %eax
callq 0x7810
movl $0x10, %edi
callq 0x7220
movq %rax, %r14
movq %rax, %rdi
movq 0x30(%rsp), %rsi
movl 0xc(%rsp), %edx
callq 0x118fe
leaq 0x33cb3(%rip), %rsi     # 0x45490
movq 0x347a4(%rip), %rdx     # 0x45f88
movq %r14, %rdi
callq 0x7960
jmp 0x11839
movl $0x10, %edi
callq 0x7220
movq %rax, %r14
leaq 0x2340e(%rip), %rsi     # 0x34c10
leaq 0x10(%rsp), %rdi
movq 0x30(%rsp), %rdx
callq 0xa064
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x78b0
xorl %ebp, %ebp
movq 0x347c6(%rip), %rsi     # 0x45ff0
movq 0x3473f(%rip), %rdx     # 0x45f70
movq %r14, %rdi
callq 0x7960
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11857
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x7500
testb %bpl, %bpl
jne 0x11864
jmp 0x118e8
movq %rax, %rbx
movq %r14, %rdi
callq 0x7370
jmp 0x118e8
jmp 0x11881
jmp 0x118c9
movq %rax, %rbx
movq %r14, %rdi
callq 0x7370
jmp 0x118cc
jmp 0x11881
movq %rax, %rbx
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x118a7
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x7500
jmp 0x118a7
jmp 0x118a4
movq %rax, %rbx
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x118cc
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x7500
jmp 0x118cc
jmp 0x118c9
jmp 0x118c9
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x118e8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x7500
leaq 0xa0(%rsp), %rdi
callq 0x70c0
movq %rbx, %rdi
callq 0x79a0
nop