// File: /workspace/github_c_makefile_star2_O0/baskerville[P]sxhkd/src/parse.c
// Function: load_config
void load_config(const char *config_file)
{
	PRINTF("load configuration '%s'\n", config_file);
	FILE *cfg = fopen(config_file, "r");
	if (cfg == NULL)
		err("Can't open configuration file: '%s'.\n", config_file);

	char buf[3 * MAXLEN];
	char chain[MAXLEN] = {0};
	char command[2 * MAXLEN] = {0};
	int offset = 0;
	char first;

	while (fgets(buf, sizeof(buf), cfg) != NULL) {
		first = buf[0];
		if (strlen(buf) < 2 || first == START_COMMENT) {
			continue;
		} else {
			char *start = lgraph(buf);
			if (start == NULL)
				continue;
			char *end = rgraph(buf);
			*(end + 1) = '\0';

			if (isgraph(first))
				snprintf(chain + offset, sizeof(chain) - offset, "%s", start);
			else
				snprintf(command + offset, sizeof(command) - offset, "%s", start);

			if (*end == PARTIAL_LINE) {
				offset += end - start;
				continue;
			} else {
				offset = 0;
			}

			if (isspace(first) && strlen(chain) > 0 && strlen(command) > 0) {
				process_hotkey(chain, command);
				chain[0] = '\0';
				command[0] = '\0';
			}
		}
	}

	fclose(cfg);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x630, %rsp            # imm = 0x630
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x5428(%rip), %rsi      # 0x14e52
callq 0xe330
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xfa4c
movq -0x8(%rbp), %rsi
leaq 0x9874(%rip), %rdi      # 0x192b9
movb $0x0, %al
callq 0xf6e0
leaq -0x410(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0xe190
leaq -0x610(%rbp), %rdi
xorl %esi, %esi
movl $0x200, %edx            # imm = 0x200
callq 0xe190
movl $0x0, -0x614(%rbp)
leaq -0x310(%rbp), %rdi
movq -0x10(%rbp), %rdx
movl $0x300, %esi            # imm = 0x300
callq 0xe1f0
cmpq $0x0, %rax
je 0xfc3b
movb -0x310(%rbp), %al
movb %al, -0x615(%rbp)
leaq -0x310(%rbp), %rdi
callq 0xe120
cmpq $0x2, %rax
jb 0xfac5
movsbl -0x615(%rbp), %eax
cmpl $0x23, %eax
jne 0xfac7
jmp 0xfa7c
leaq -0x310(%rbp), %rdi
callq 0xf8e0
movq %rax, -0x620(%rbp)
cmpq $0x0, -0x620(%rbp)
jne 0xfae6
jmp 0xfa7c
leaq -0x310(%rbp), %rdi
callq 0xf980
movq %rax, -0x628(%rbp)
movq -0x628(%rbp), %rax
movb $0x0, 0x1(%rax)
callq 0xe400
movq (%rax), %rax
movsbl -0x615(%rbp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
je 0xfb5b
leaq -0x410(%rbp), %rdi
movslq -0x614(%rbp), %rax
addq %rax, %rdi
movslq -0x614(%rbp), %rax
movl $0x100, %esi            # imm = 0x100
subq %rax, %rsi
movq -0x620(%rbp), %rcx
leaq 0x3627(%rip), %rdx      # 0x13179
movb $0x0, %al
callq 0xe170
jmp 0xfb90
leaq -0x610(%rbp), %rdi
movslq -0x614(%rbp), %rax
addq %rax, %rdi
movslq -0x614(%rbp), %rax
movl $0x200, %esi            # imm = 0x200
subq %rax, %rsi
movq -0x620(%rbp), %rcx
leaq 0x35f0(%rip), %rdx      # 0x13179
movb $0x0, %al
callq 0xe170
movq -0x628(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5c, %eax
jne 0xfbc5
movq -0x628(%rbp), %rcx
movq -0x620(%rbp), %rax
subq %rax, %rcx
movslq -0x614(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x614(%rbp)
jmp 0xfa7c
movl $0x0, -0x614(%rbp)
callq 0xe400
movq (%rax), %rax
movsbl -0x615(%rbp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0xfc34
leaq -0x410(%rbp), %rdi
callq 0xe120
cmpq $0x0, %rax
jbe 0xfc34
leaq -0x610(%rbp), %rdi
callq 0xe120
cmpq $0x0, %rax
jbe 0xfc34
leaq -0x410(%rbp), %rdi
leaq -0x610(%rbp), %rsi
callq 0xfc50
movb $0x0, -0x410(%rbp)
movb $0x0, -0x610(%rbp)
jmp 0xfc36
jmp 0xfa7c
movq -0x10(%rbp), %rdi
callq 0xe0e0
addq $0x630, %rsp            # imm = 0x630
popq %rbp
retq
nopl (%rax)