// File: /workspace/github_c_makefile_star2_O3/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 0x5d40(%rip), %rsi      # 0xb0d2
movq %r12, %rdi
callq 0x46d0
testq %rax, %rax
je 0x564f
movq %rax, %r14
movq %rbx, 0x30(%rsp)
xorl %r15d, %r15d
leaq 0x6(%rsp), %rbp
leaq 0x10(%rsp), %r13
movq $0x0, 0x28(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x8(%rsp)
movq %r14, %rdi
callq 0x4360
cmpl $0x22, %eax
jle 0x5409
cmpl $0x5b, %eax
je 0x5543
cmpl $0x23, %eax
jne 0x5423
movq %r14, %rdi
callq 0x4360
cmpl $-0x1, %eax
je 0x55b2
cmpl $0xa, %eax
jne 0x53ee
jmp 0x55b2
cmpl $0xa, %eax
je 0x55b2
cmpl $-0x1, %eax
je 0x569f
testl %eax, %eax
je 0x55c4
movw $0x0, 0x6(%rsp)
movb %al, 0x6(%rsp)
movq %rbp, %rdi
callq 0x41f0
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x55c4
movq %r14, %rdi
callq 0x4360
movl %eax, %ebx
leal 0x1(%rbx), %eax
cmpl $0x2, %eax
jb 0x55ba
cmpl $0xa, %ebx
je 0x55ba
cmpl $0x3d, %ebx
je 0x5484
movb %bl, 0x6(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x43b0
testl %eax, %eax
je 0x5444
cmpl $0x3d, %ebx
jne 0x55ba
movq %r12, 0x20(%rsp)
movq 0x10(%rsp), %r12
testq %r12, %r12
je 0x56c4
movq 0x18(%rsp), %rdi
callq 0x4260
movq $0x0, 0x10(%rsp)
movw $0x0, 0x6(%rsp)
movq %r14, %rdi
callq 0x4360
cmpl $-0x1, %eax
je 0x54e9
movl %eax, %ebx
testl %eax, %eax
je 0x5683
cmpl $0xa, %ebx
je 0x54e9
movb %bl, 0x6(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x43b0
testl %eax, %eax
je 0x54b1
cmpl $0xa, %ebx
jne 0x5683
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
jne 0x550b
leaq 0x5bbf(%rip), %rdi      # 0xb0b9
callq 0x41f0
movq %rax, %rbx
testq %rax, %rax
je 0x568d
movq 0x8(%rsp), %rdi
callq 0x4260
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x4820
testl %eax, %eax
jne 0x56ce
movq %r12, 0x18(%rsp)
movq %rbx, 0x8(%rsp)
movq 0x20(%rsp), %r12
jmp 0x55b2
movw $0x0, 0x6(%rsp)
leaq 0x5b68(%rip), %rdi      # 0xb0b9
callq 0x41f0
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x55c4
movq %r14, %rdi
callq 0x4360
movl %eax, %ebx
leal 0x1(%rbx), %eax
cmpl $0xb, %eax
ja 0x557c
movl $0x803, %ecx            # imm = 0x803
btl %eax, %ecx
jb 0x55ba
cmpl $0x5d, %ebx
je 0x5599
movb %bl, 0x6(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x43b0
testl %eax, %eax
je 0x5560
cmpl $0x5d, %ebx
jne 0x55ba
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
je 0x55c4
movq 0x28(%rsp), %rdi
callq 0x4260
movq %rbx, 0x28(%rsp)
incq %r15
jmp 0x53d3
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 0x5a79(%rip), %rsi      # 0xb068
leaq 0x5a7c(%rip), %rcx      # 0xb072
movl $0x1, %edi
movq %r12, %rdx
movq %r15, %r8
xorl %eax, %eax
callq 0x45d0
movl %eax, %ebx
movq %r14, %rdi
callq 0x4240
testl %eax, %eax
je 0x563e
callq 0x40e0
movl (%rax), %edi
movl %edi, %ebx
negl %ebx
callq 0x47a0
leaq 0x5a34(%rip), %rsi      # 0xb061
movl %ebx, %edi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x45d0
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 0x47a0
leaq 0x59fb(%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 0x45d0
movq 0x10(%rsp), %rdi
callq 0x4260
movq %r12, %r13
movq 0x20(%rsp), %r12
movq 0x8(%rsp), %rbx
jmp 0x55ce
movq 0x28(%rsp), %rdi
callq 0x4260
movq 0x18(%rsp), %rdi
callq 0x4260
movq 0x8(%rsp), %rdi
callq 0x4260
xorl %ebx, %ebx
jmp 0x560a
movq 0x20(%rsp), %r12
jmp 0x55c4
movq %r12, %r13
movq 0x20(%rsp), %r12
jmp 0x55ce