// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
movq %rdi, 0x78(%rsp)
callq 0xea14
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
movq %rbx, 0x30(%rsp)
movq %rbx, %rsi
movl $0x8, %edx
callq 0x78b0
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xc0(%rsp,%rax)
jne 0x117a0
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movl $0x1, %ebp
leaq 0x10(%rsp), %r13
leaq 0x23792(%rip), %r15     # 0x34c67
leaq 0x58(%rsp), %rbx
movq 0xa0(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x74e0
movsbl %al, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x7a20
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x116ff
movl $0x6, %ecx
movq %r13, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x7920
movq %r13, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x70a0
movl $0x6, %ecx
movq %r13, %rdi
movq %r15, %rsi
movq $-0x1, %rdx
callq 0x78d0
incq %rax
movq 0x18(%rsp), %rcx
cmpq %rax, %rcx
jb 0x1173a
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rcx
movb $0x0, (%rcx,%rax)
cmpq $0x0, 0x18(%rsp)
je 0x116f8
movq 0x10(%rsp), %rax
cmpb $0x23, (%rax)
je 0x116f8
movl %ebp, 0xc(%rsp)
movq %rbx, %rbp
movq %r13, %rdi
movl $0x3d, %esi
xorl %edx, %edx
callq 0x7680
cmpq $-0x1, %rax
je 0x1176a
movq %rax, %rbx
movq %rbp, %r14
movq %rbp, %rdi
movq %r13, %r12
movq %r13, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x7530
movl $0x6, %ecx
movq %r14, %rdi
movq %r15, %rsi
movq $-0x1, %rdx
callq 0x78d0
incq %rax
movq 0x60(%rsp), %rcx
cmpq %rax, %rcx
jb 0x11752
movq %rax, 0x60(%rsp)
movq 0x58(%rsp), %rcx
movb $0x0, (%rcx,%rax)
incq %rbx
leaq 0x38(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq $-0x1, %rcx
callq 0x7530
movl $0x6, %ecx
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x7920
movq %r14, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x70a0
movq %rbp, %rbx
movq 0x40(%rsp), %rcx
cmpq $0x2, %rcx
leaq 0xa0(%rsp), %r14
movl 0xc(%rsp), %ebp
movq %r12, %r13
jb 0x116ae
movq 0x38(%rsp), %rax
cmpb $0x22, (%rax)
jne 0x116ae
cmpb $0x22, -0x1(%rax,%rcx)
jne 0x116ae
addq $-0x2, %rcx
movl $0x1, %edx
leaq 0x80(%rsp), %rdi
leaq 0x38(%rsp), %r12
movq %r12, %rsi
callq 0x7530
movq %r12, %rdi
leaq 0x80(%rsp), %rsi
callq 0x75e0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x116ae
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x7510
movq 0x78(%rsp), %rdi
movq %rbx, %rsi
leaq 0x38(%rsp), %rdx
callq 0x11b52
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x116dc
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x7510
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x116f8
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x7510
incl %ebp
jmp 0x114da
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x1171b
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x7510
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 0x234af(%rip), %rdi     # 0x34bf0
leaq 0x23494(%rip), %rsi     # 0x34bdc
movq %rax, %rdx
xorl %eax, %eax
callq 0x7820
leaq 0x23497(%rip), %rdi     # 0x34bf0
leaq 0x2347c(%rip), %rsi     # 0x34bdc
movq %rax, %rdx
xorl %eax, %eax
callq 0x7820
movl $0x10, %edi
callq 0x7220
movq %rax, %r14
movq %rax, %rdi
movq 0x30(%rsp), %rsi
movl 0xc(%rsp), %edx
callq 0x118b4
leaq 0x33d01(%rip), %rsi     # 0x45490
movq 0x347f2(%rip), %rdx     # 0x45f88
movq %r14, %rdi
callq 0x7970
jmp 0x117eb
movl $0x10, %edi
callq 0x7220
movq %rax, %r14
leaq 0x23418(%rip), %rsi     # 0x34bcc
leaq 0x10(%rsp), %rdi
movq 0x30(%rsp), %rdx
callq 0xa085
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x78c0
xorl %ebp, %ebp
movq 0x34814(%rip), %rsi     # 0x45ff0
movq 0x3478d(%rip), %rdx     # 0x45f70
movq %r14, %rdi
callq 0x7970
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11811
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x7510
jmp 0x11811
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x1189e
movq %r14, %rdi
callq 0x7370
jmp 0x1189e
jmp 0x11837
jmp 0x1187f
movq %rax, %rbx
movq %r14, %rdi
callq 0x7370
jmp 0x11882
jmp 0x11837
movq %rax, %rbx
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x1185d
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x7510
jmp 0x1185d
jmp 0x1185a
movq %rax, %rbx
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x11882
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x7510
jmp 0x11882
jmp 0x1187f
jmp 0x1187f
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x1189e
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x7510
leaq 0xa0(%rsp), %rdi
callq 0x70c0
movq %rbx, %rdi
callq 0x79b0
nop