// File: /workspace/github_c_makefile_star2_O2/DeforaOS[P]libSystem/src/config.c
// Function: config_load
int config_load(Config * config, String const * filename)
{
	int ret = 0;
	size_t line;
	FILE * fp;
	String * section = NULL;
	String * variable = NULL;
	String * value = NULL;
	int c;
	String * str;

	if((fp = fopen(filename, "r")) == NULL)
		return error_set_code(-errno, "%s: %s", filename,
				strerror(errno));
	for(line = 0; (c = fgetc(fp)) != EOF; line++)
		if(c == CONFIG_COMMENT)
			/* skip the comment */
			while((c = fgetc(fp)) != EOF && c != '\n');
		else if(c == '[')
		{
			if((str = _load_section(fp)) == NULL)
				break;
			string_delete(section);
			section = str;
		}
		else if(_load_isprint(c))
		{
			if((str = _load_variable(fp, c)) == NULL)
				break;
			string_delete(variable);
			variable = str;
			if((str = _load_value(fp)) == NULL)
				break;
			string_delete(value);
			value = str;
			if(config_set(config, section, variable, value) != 0)
				break;
		}
		else if(c != '\n')
			break;
	string_delete(section);
	string_delete(variable);
	string_delete(value);
	if(c != EOF)
		ret = error_set_code(1, "%s: %s%ld", filename, "Syntax error"
				" at line ", line);
	if(fclose(fp) != 0)
		ret = error_set_code(-errno, "%s: %s", filename,
				strerror(errno));
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x5e4c(%rip), %rsi      # 0xb0d2
movq %r12, %rdi
callq 0x4720
testq %rax, %rax
je 0x5536
movq %rax, %r14
movq %rbx, 0x30(%rsp)
xorl %r15d, %r15d
leaq 0x10(%rsp), %rbp
leaq 0x6(%rsp), %r13
movq $0x0, 0x28(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x8(%rsp)
movq %r14, %rdi
callq 0x4380
cmpl $0xa, %eax
je 0x549b
cmpl $0x23, %eax
je 0x5419
cmpl $0x5b, %eax
je 0x542d
cmpl $-0x1, %eax
je 0x5586
testl %eax, %eax
je 0x54ad
andw $0x0, 0x6(%rsp)
movb %al, 0x6(%rsp)
movq %r13, %rdi
callq 0x41f0
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x54ad
movq %r14, %rdi
callq 0x4380
movl %eax, %ebx
leal 0x1(%rbx), %eax
cmpl $0x2, %eax
jb 0x54a3
cmpl $0xa, %ebx
je 0x54a3
cmpl $0x3d, %ebx
je 0x535b
movb %bl, 0x6(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
callq 0x43d0
testl %eax, %eax
je 0x531b
cmpl $0x3d, %ebx
jne 0x54a3
movq %r12, 0x20(%rsp)
movq 0x10(%rsp), %r12
testq %r12, %r12
je 0x55ab
movq 0x18(%rsp), %rdi
callq 0x4260
andq $0x0, 0x10(%rsp)
andw $0x0, 0x6(%rsp)
movq %r14, %rdi
callq 0x4380
cmpl $-0x1, %eax
je 0x53bc
movl %eax, %ebx
testl %eax, %eax
je 0x556a
cmpl $0xa, %ebx
je 0x53bc
movb %bl, 0x6(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
callq 0x43d0
testl %eax, %eax
je 0x5384
cmpl $0xa, %ebx
jne 0x556a
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
jne 0x53de
leaq 0x5cec(%rip), %rdi      # 0xb0b9
callq 0x41f0
movq %rax, %rbx
testq %rax, %rax
je 0x5574
movq 0x8(%rsp), %rdi
callq 0x4260
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x4880
testl %eax, %eax
jne 0x55b5
movq %r12, 0x18(%rsp)
movq %rbx, 0x8(%rsp)
movq 0x20(%rsp), %r12
jmp 0x549b
movq %r14, %rdi
callq 0x4380
cmpl $-0x1, %eax
je 0x549b
cmpl $0xa, %eax
jne 0x5419
jmp 0x549b
andw $0x0, 0x6(%rsp)
leaq 0x5c7f(%rip), %rdi      # 0xb0b9
callq 0x41f0
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x54ad
movq %r14, %rdi
callq 0x4380
movl %eax, %ebx
leal 0x1(%rbx), %eax
cmpl $0xb, %eax
ja 0x5465
movl $0x803, %ecx            # imm = 0x803
btl %eax, %ecx
jb 0x54a3
cmpl $0x5d, %ebx
je 0x5482
movb %bl, 0x6(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
callq 0x43d0
testl %eax, %eax
je 0x5449
cmpl $0x5d, %ebx
jne 0x54a3
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
je 0x54ad
movq 0x28(%rsp), %rdi
callq 0x4260
movq %rbx, 0x28(%rsp)
incq %r15
jmp 0x52c7
movq 0x10(%rsp), %rdi
callq 0x4260
movq 0x8(%rsp), %rbx
movq 0x18(%rsp), %r13
movq 0x28(%rsp), %rdi
callq 0x4260
movq %r13, %rdi
callq 0x4260
movq %rbx, %rdi
callq 0x4260
leaq 0x5b90(%rip), %rsi      # 0xb068
leaq 0x5b93(%rip), %rcx      # 0xb072
pushq $0x1
popq %rdi
movq %r12, %rdx
movq %r15, %r8
xorl %eax, %eax
callq 0x4610
movl %eax, %ebx
movq %r14, %rdi
callq 0x4240
testl %eax, %eax
je 0x5525
callq 0x40e0
movl (%rax), %edi
movl %edi, %ebx
negl %ebx
callq 0x47f0
leaq 0x5b4d(%rip), %rsi      # 0xb061
movl %ebx, %edi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x4610
movl %eax, %ebx
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x40e0
movl (%rax), %edi
movl %edi, %ebx
negl %ebx
callq 0x47f0
leaq 0x5b14(%rip), %rsi      # 0xb061
movl %ebx, %edi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4610
movq 0x10(%rsp), %rdi
callq 0x4260
movq %r12, %r13
movq 0x20(%rsp), %r12
movq 0x8(%rsp), %rbx
jmp 0x54b7
movq 0x28(%rsp), %rdi
callq 0x4260
movq 0x18(%rsp), %rdi
callq 0x4260
movq 0x8(%rsp), %rdi
callq 0x4260
xorl %ebx, %ebx
jmp 0x54f1
movq 0x20(%rsp), %r12
jmp 0x54ad
movq %r12, %r13
movq 0x20(%rsp), %r12
jmp 0x54b7