// File: /workspace/github_c_makefile_star2_O3/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, 0x8ad5(%rip)     # 0xf410
movups %xmm0, 0x8abe(%rip)     # 0xf400
movq $0x0, 0x8ad3(%rip) # 0xf420
callq 0x6898
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x6b63
movq %rax, %r15
leaq 0x3b54(%rip), %rsi      # 0xa4be
movq %rax, %rdi
callq 0x23a0
testq %rax, %rax
je 0x6a01
movq %rax, %r14
movq %r15, (%rsp)
movq %r15, %rdi
callq 0x23c0
leaq 0x8a9f(%rip), %rdi      # 0xf430
movl $0x800, %esi            # imm = 0x800
movq %r14, %rdx
callq 0x2520
testq %rax, %rax
je 0x6a1d
movq %rax, %r13
movl $0x1, %ebp
leaq 0x4b80(%rip), %rbx      # 0xb532
leaq 0x8a77(%rip), %r15      # 0xf430
movq %r13, %rdi
callq 0x6b74
testl %eax, %eax
jne 0x6a5d
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2500
movq %r13, %rdi
callq 0x6bd2
cmpl $-0x1, %eax
je 0x6b42
incl %ebp
movq %r15, %rdi
movl $0x800, %esi            # imm = 0x800
movq %r14, %rdx
callq 0x2520
movq %rax, %r13
testq %rax, %rax
jne 0x69b9
jmp 0x6a22
callq 0x2060
cmpl $0x2, (%rax)
jne 0x6a2c
movq %r15, %rdi
callq 0x23c0
movl $0x2, %ebx
jmp 0x6b63
movl $0x1, %ebp
testq %r12, %r12
je 0x6a4a
xorl %r13d, %r13d
jmp 0x6a62
leaq 0x4a68(%rip), %rdi      # 0xb49b
movq %r15, %rsi
xorl %eax, %eax
callq 0x2110
movq %r15, %rdi
callq 0x23c0
jmp 0x6b63
leaq 0x4a77(%rip), %rdi      # 0xb4c8
xorl %eax, %eax
callq 0x22d0
jmp 0x6b56
testq %r12, %r12
je 0x6abb
movq %r13, %rdi
movq %r12, %rsi
callq 0x6f06
testl %eax, %eax
je 0x6a7b
testq %r13, %r13
jne 0x6aaf
jmp 0x6b2f
leaq 0x89ae(%rip), %rbx      # 0xf430
movq %rbx, %rdi
movl $0x800, %esi            # imm = 0x800
movq %r14, %rdx
callq 0x2520
testq %rax, %rax
je 0x6b2f
movq %rax, %r13
incl %ebp
movq %rax, %rdi
movq %r12, %rsi
callq 0x6f06
testl %eax, %eax
je 0x6a82
movq %r13, %rdi
callq 0x6b74
testl %eax, %eax
je 0x6b2f
leaq 0x896e(%rip), %rdi      # 0xf430
movl $0x800, %esi            # imm = 0x800
movq %r14, %rdx
callq 0x2520
testq %rax, %rax
je 0x6b23
movq %rax, %r12
leaq 0x4a54(%rip), %rbx      # 0xb532
leaq 0x894b(%rip), %r15      # 0xf430
movq %r12, %rdi
callq 0x6b74
testl %eax, %eax
jne 0x6b23
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2500
movq %r12, %rdi
callq 0x6bd2
cmpl $-0x1, %eax
je 0x6b42
incl %ebp
movq %r15, %rdi
movl $0x800, %esi            # imm = 0x800
movq %r14, %rdx
callq 0x2520
movq %rax, %r12
testq %rax, %rax
jne 0x6ae5
movq %r14, %rdi
callq 0x2280
xorl %ebx, %ebx
jmp 0x6b63
leaq 0x497b(%rip), %rdi      # 0xb4b1
movq %r12, %rsi
xorl %eax, %eax
callq 0x22d0
jmp 0x6b56
leaq 0x495c(%rip), %rdi      # 0xb4a5
movq (%rsp), %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x22d0
movq %r14, %rdi
callq 0x2280
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq