// File: /workspace/github_c_makefile_star2_O2/tomka[P]cliaspora/config.c
// Function: read_config
int
read_config(const char *label)
{
	int  lc;
	FILE *fp;
	char *ln, *path;
	
	(void)memset(&cfg, 0, sizeof(cfg));
	if ((path = cfgpath()) == NULL)
		return (-1);
	if ((fp = fopen(path, "r")) == NULL) {
		if (errno != ENOENT) {
			warn("fopen(%s)", path); free(path);
			return (-1);
		}
		free(path);
		return (ENOENT);
	}
	free(path);

	/*
	 * Get all global variables, that is, variables before the
	 * first labeled block.
	 */
	for (lc = 1; (ln = readln(fp)) != NULL && !is_label(ln); lc++) {
		(void)strtok(ln, "\n");
		if (parse_line(ln) == -1) {
			warnx("%s, line %d", path, lc); (void)fclose(fp);
			return (-1);
		}
	}
	if (label != NULL) {
		while (!cmp_label(ln, label) && (ln = readln(fp)) != NULL)
			lc++;
		if (ln == NULL || !is_label(ln)) {
			warnx("Profile '%s' not found", label);
			(void)fclose(fp); return (-1);
		}

	} else if (ln == NULL || !is_label(ln)) {
		warnx("No label found in config file");
		(void)fclose(fp); return (-1);
	}
	/* Read until the next label or EOF. */
	for (; (ln = readln(fp)) != NULL && !is_label(ln); lc++) {
		(void)strtok(ln, "\n");
		if (parse_line(ln) == -1) {
			warnx("%s, line %d", path, lc);
			(void)fclose(fp); return (-1);
		}
	}
	(void)fclose(fp);
	return (0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x8fc9(%rip)     # 0xf420
movups %xmm0, 0x8fb2(%rip)     # 0xf410
andq $0x0, 0x8fca(%rip)      # 0xf430
callq 0x63b4
pushq $-0x1
popq %rbx
testq %rax, %rax
je 0x65e4
movq %rax, %r15
leaq 0x403d(%rip), %rsi      # 0xa4be
movq %rax, %rdi
callq 0x23b0
testq %rax, %rax
je 0x64df
movq %rax, %r14
movq %r15, %rdi
callq 0x23d0
pushq $0x1
popq %rbp
leaq 0x508f(%rip), %rbx      # 0xb532
movq %r14, %rdi
callq 0x65f5
movq %rax, %r13
testq %rax, %rax
je 0x64fc
movq %r13, %rdi
callq 0x6609
testl %eax, %eax
jne 0x6514
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2510
movq %r13, %rdi
callq 0x6663
cmpl $-0x1, %eax
je 0x658c
incl %ebp
jmp 0x64a3
callq 0x2060
cmpl $0x2, (%rax)
jne 0x65bf
movq %r15, %rdi
callq 0x23d0
pushq $0x2
jmp 0x65bc
testq %r12, %r12
jne 0x652d
leaq 0x4fc0(%rip), %rdi      # 0xb4c8
xorl %eax, %eax
callq 0x22e0
jmp 0x65b2
testq %r12, %r12
jne 0x652d
jmp 0x654d
movq %r14, %rdi
callq 0x65f5
testq %rax, %rax
je 0x65a1
movq %rax, %r13
incl %ebp
movq %r13, %rdi
movq %r12, %rsi
callq 0x6964
testl %eax, %eax
je 0x651b
testq %r13, %r13
je 0x65a1
movq %r13, %rdi
callq 0x6609
testl %eax, %eax
je 0x65a1
leaq 0x4fde(%rip), %r12      # 0xb532
movq %r14, %rdi
callq 0x65f5
testq %rax, %rax
je 0x65da
movq %rax, %rbx
movq %rax, %rdi
callq 0x6609
testl %eax, %eax
jne 0x65da
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2510
movq %rbx, %rdi
callq 0x6663
cmpl $-0x1, %eax
je 0x658c
incl %ebp
jmp 0x6554
leaq 0x4f12(%rip), %rdi      # 0xb4a5
movq %r15, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x22e0
jmp 0x65b2
leaq 0x4f09(%rip), %rdi      # 0xb4b1
movq %r12, %rsi
xorl %eax, %eax
callq 0x22e0
movq %r14, %rdi
callq 0x2280
pushq $-0x1
popq %rbx
jmp 0x65e4
leaq 0x4ed5(%rip), %rdi      # 0xb49b
movq %r15, %rsi
xorl %eax, %eax
callq 0x2110
movq %r15, %rdi
callq 0x23d0
jmp 0x65e4
movq %r14, %rdi
callq 0x2280
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq