// File: /workspace/github_c_makefile_star2_O1/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, 0x30(%rsp)
leaq 0x5d6e(%rip), %rsi      # 0xb0d2
movq %r12, %rdi
callq 0x46c0
testq %rax, %rax
je 0x564b
movq %rax, %r14
movq %r12, 0x28(%rsp)
xorl %r15d, %r15d
leaq 0x6(%rsp), %rbx
leaq 0x8(%rsp), %rbp
movq $0x0, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x4360
cmpl $0x22, %eax
jle 0x53d5
cmpl $0x5b, %eax
je 0x5466
cmpl $0x23, %eax
jne 0x53ef
movq %r14, %rdi
callq 0x4360
cmpl $-0x1, %eax
je 0x55b5
cmpl $0xa, %eax
jne 0x53ba
jmp 0x55b5
cmpl $0xa, %eax
je 0x55b5
cmpl $-0x1, %eax
je 0x55bd
testl %eax, %eax
je 0x55e7
movw $0x0, 0x6(%rsp)
movb %al, 0x6(%rsp)
movq %rbx, %rdi
callq 0x41f0
movq %rax, 0x8(%rsp)
testq %rax, %rax
movq %r13, 0x20(%rsp)
je 0x54fd
movq %r14, %rdi
callq 0x4360
movl %eax, %r12d
leal 0x1(%r12), %eax
cmpl $0x2, %eax
jb 0x54f3
cmpl $0xa, %r12d
je 0x54f3
cmpl $0x3d, %r12d
je 0x545c
movb %r12b, 0x6(%rsp)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x43b0
testl %eax, %eax
je 0x5415
cmpl $0x3d, %r12d
jne 0x54f3
movq 0x8(%rsp), %r13
jmp 0x5500
movw $0x0, 0x6(%rsp)
leaq 0x5c45(%rip), %rdi      # 0xb0b9
callq 0x41f0
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x54d3
movq %r14, %rdi
callq 0x4360
movl %eax, %r12d
leal 0x1(%r12), %eax
cmpl $0xb, %eax
ja 0x54a2
movl $0x803, %ecx            # imm = 0x803
btl %eax, %ecx
jb 0x54c9
cmpl $0x5d, %r12d
je 0x54c2
movb %r12b, 0x6(%rsp)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x43b0
testl %eax, %eax
je 0x5483
cmpl $0x5d, %r12d
jne 0x54c9
movq 0x8(%rsp), %r12
jmp 0x54d6
movq 0x8(%rsp), %rdi
callq 0x4260
xorl %r12d, %r12d
testq %r12, %r12
je 0x55e7
movq 0x18(%rsp), %rdi
callq 0x4260
movq %r12, 0x18(%rsp)
jmp 0x55b5
movq 0x8(%rsp), %rdi
callq 0x4260
xorl %r13d, %r13d
testq %r13, %r13
je 0x55e2
movq 0x10(%rsp), %rdi
callq 0x4260
movq $0x0, 0x8(%rsp)
movw $0x0, 0x6(%rsp)
movq %r14, %rdi
callq 0x4360
cmpl $-0x1, %eax
je 0x555d
movl %eax, %r12d
testl %eax, %eax
je 0x5578
cmpl $0xa, %r12d
je 0x555d
movb %r12b, 0x6(%rsp)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x43b0
testl %eax, %eax
je 0x5523
cmpl $-0x1, %r12d
je 0x555d
cmpl $0xa, %r12d
jne 0x5578
movq 0x8(%rsp), %r12
testq %r12, %r12
jne 0x5585
leaq 0x5b4b(%rip), %rdi      # 0xb0b9
callq 0x41f0
movq %rax, %r12
jmp 0x5585
movq 0x8(%rsp), %rdi
callq 0x4260
xorl %r12d, %r12d
testq %r12, %r12
je 0x55ee
movq 0x20(%rsp), %rdi
callq 0x4260
movq 0x30(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x4810
testl %eax, %eax
jne 0x55f8
movq %r13, 0x10(%rsp)
movq %r12, %r13
incq %r15
jmp 0x539f
movq 0x18(%rsp), %rdi
callq 0x4260
movq 0x10(%rsp), %rdi
callq 0x4260
movq %r13, %rdi
callq 0x4260
xorl %ebx, %ebx
movq 0x28(%rsp), %r12
jmp 0x563f
movq 0x20(%rsp), %r13
movq 0x10(%rsp), %rbx
jmp 0x55fe
movq %r13, %rbx
movq 0x20(%rsp), %r13
jmp 0x55fe
movq %r13, %rbx
movq %r12, %r13
movq 0x18(%rsp), %rdi
callq 0x4260
movq %rbx, %rdi
callq 0x4260
movq %r13, %rdi
callq 0x4260
leaq 0x5a49(%rip), %rsi      # 0xb068
leaq 0x5a4c(%rip), %rcx      # 0xb072
movl $0x1, %edi
movq 0x28(%rsp), %r12
movq %r12, %rdx
movq %r15, %r8
xorl %eax, %eax
callq 0x45d0
movl %eax, %ebx
movq %r14, %rdi
callq 0x4240
testl %eax, %eax
je 0x5673
callq 0x40e0
movl (%rax), %edi
movl %edi, %ebx
negl %ebx
callq 0x4790
leaq 0x59ff(%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