// File: /workspace/github_cpp_makefile_star2_O1/exrok[P]evdoublebind/./src/make_config.cc
// Function: gen(Settings&)
int gen(Settings &settings) {
    char * buffer = file_contents(settings.input_conf);
    if (!buffer) {
        fprintf(stderr,"Error Reading Config File [%s]: ", settings.input_conf);
        perror("");
        exit(1);
    }
    Config config;

    struct xkb_keymap *keymap;
    struct xkb_context *ctx;

    ctx = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
    if (!ctx) {
        exit(1);
    }
    keymap = xkb_keymap_new_from_names(ctx, &settings.xkb_names,
                                       XKB_KEYMAP_COMPILE_NO_FLAGS);
    if (!keymap) {
        exit(1);
    }
    struct xkb_state *state;
    state = xkb_state_new(keymap);

    if (!state) {
        exit(1);
    }

    auto entry = ConfigParser(buffer);
    while (entry.next()) {
        if (strcmp(entry.key, "unused") == 0)  {
            parse_unused_keys(keymap, config, entry.value);
        } else if (strcmp(entry.key, "kbd") == 0) {
            config.keyboards.push(entry.value);
        } else {
            char *symtap_sep = strchr(entry.value, '|');
            char *evtap_sep = strchr(entry.value, '@');
            if (symtap_sep && evtap_sep) {
                fprintf(stderr,"CONFIG ERROR[line:%d]: Both symkey and raw keycode taps specfied.\n",
                        entry.line);
                exit(1);
            }
            auto map = config.mappings.top_new();
            map->keycode = parse_keycode(keymap, entry.key);
            if (symtap_sep != NULL){
                *symtap_sep = '\0';
                symtap_sep++;
                int i = parse_symlevel(map->tap_map, symtap_sep);
                for (int i = 0; i < 2; i++) map->tap_raw[i] = -1;
            } else if (evtap_sep != NULL) {
                *evtap_sep = '\0';
                evtap_sep++;
                parse_raw_tap(entry.line, keymap,map->tap_raw, evtap_sep);
                for (int i = 0; i < 4; i++) map->tap_map[i] = NULL;
            }
            int count = parse_symlevel(map->hold_map, entry.value);
            if (count == 0 && symtap_sep == NULL && evtap_sep == NULL) {
                fprintf(stderr,"CONFIG ERROR[line:%d]: No mappings Specified\n",
                        entry.line);
                exit(1);
            }
        }
    }
    generate_hfile(config,settings);
    if (!settings.only_arguments) {
        generate_xkb_file(keymap,config, settings);
    }
    free(buffer);

    xkb_state_unref(state);
    xkb_keymap_unref(keymap);
    xkb_context_unref(ctx);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %r14
movq 0x30(%rdi), %rdi
callq 0x3abf
movq %rax, 0x38(%rsp)
testq %rax, %rax
je 0x4313
movl $0x8, %ebx
movq %rbx, 0x10(%rsp)
movl $0x280, %edi            # imm = 0x280
callq 0x3170
movq %rax, 0x8(%rsp)
movq %rbx, 0x20(%rsp)
movl $0x40, %edi
callq 0x3170
movq %rax, 0x18(%rsp)
movq %rbx, 0x30(%rsp)
movl $0x20, %edi
callq 0x3170
movq %rax, 0x28(%rsp)
xorl %edi, %edi
callq 0x3160
testq %rax, %rax
je 0x4309
movq %rax, %rbx
movq %rax, %rdi
movq %r14, 0x70(%rsp)
movq %r14, %rsi
xorl %edx, %edx
callq 0x30f0
testq %rax, %rax
je 0x4309
movq %rax, %r12
movq %rax, %rdi
callq 0x3130
movq %rax, 0x68(%rsp)
testq %rax, %rax
je 0x4309
movq %rbx, 0x60(%rsp)
leaq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rax
movq %rax, (%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movl $0xffffffff, 0x18(%rdi) # imm = 0xFFFFFFFF
movb $0x0, 0x1c(%rdi)
callq 0x4500
testb %al, %al
je 0x4278
leaq 0x204a(%rip), %r14      # 0x6101
leaq 0x40(%rsp), %r15
movq 0x48(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3140
testl %eax, %eax
je 0x41b1
movq %rbx, %rdi
leaq 0x202a(%rip), %rsi      # 0x6108
callq 0x3140
testl %eax, %eax
je 0x41c8
movq 0x50(%rsp), %rbx
movq %rbx, %rdi
movl $0x7c, %esi
callq 0x3090
movq %rax, %r13
movq %rbx, %rdi
movl $0x40, %esi
callq 0x3090
movq %rax, %rbx
testq %r13, %r13
sete %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
je 0x42f5
movslq 0x10(%rsp), %rax
cmpl %eax, 0x14(%rsp)
jl 0x414d
leal (%rax,%rax), %ecx
movl %ecx, 0x10(%rsp)
movq 0x8(%rsp), %rdi
shlq $0x5, %rax
leaq (%rax,%rax,4), %rsi
callq 0x31a0
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rbp
movslq 0x14(%rsp), %rax
leal 0x1(%rax), %ecx
movl %ecx, 0x14(%rsp)
leaq (%rax,%rax,4), %r14
shlq $0x4, %r14
leaq (%r14,%rbp), %r15
movq 0x48(%rsp), %rsi
movq %r12, %rdi
callq 0x3868
movl %eax, (%rbp,%r14)
testq %r13, %r13
je 0x4209
movb $0x0, (%r13)
leaq 0x1(%r13), %rsi
leaq 0x28(%r15), %rdi
callq 0x37de
movq $-0x1, 0x48(%r15)
testq %rbx, %rbx
sete %bl
leaq 0x1f55(%rip), %r14      # 0x6101
jmp 0x4241
movq 0x50(%rsp), %rdx
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
callq 0x3968
jmp 0x4268
movq 0x50(%rsp), %rbx
movslq 0x20(%rsp), %rsi
cmpl %esi, 0x24(%rsp)
jl 0x41f2
leal (%rsi,%rsi), %eax
movl %eax, 0x20(%rsp)
movq 0x18(%rsp), %rdi
shlq $0x4, %rsi
callq 0x31a0
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movslq 0x24(%rsp), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x24(%rsp)
movq %rbx, (%rax,%rcx,8)
jmp 0x4268
testq %rbx, %rbx
leaq 0x1eee(%rip), %r14      # 0x6101
je 0x423f
movb $0x0, (%rbx)
incq %rbx
movl 0x58(%rsp), %edi
leaq 0x48(%r15), %rdx
movq %r12, %rsi
movq %rbx, %rcx
callq 0x38d9
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%r15)
movups %xmm0, 0x28(%r15)
xorl %ebx, %ebx
jmp 0x4241
movb $0x1, %bl
addq $0x8, %r15
movq 0x50(%rsp), %rsi
movq %r15, %rdi
callq 0x37de
testb %bl, %bl
leaq 0x40(%rsp), %r15
je 0x4268
testl %eax, %eax
jne 0x4268
testq %r13, %r13
je 0x42ff
movq %r15, %rdi
callq 0x4500
testb %al, %al
jne 0x40bc
leaq 0x8(%rsp), %rdi
movq 0x70(%rsp), %rbx
movq %rbx, %rsi
callq 0x3de5
cmpb $0x0, 0x28(%rbx)
jne 0x42a0
leaq 0x8(%rsp), %rsi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x3b51
movq 0x38(%rsp), %rdi
callq 0x3040
movq 0x68(%rsp), %rdi
callq 0x3210
movq %r12, %rdi
callq 0x3180
movq 0x60(%rsp), %rdi
callq 0x3060
movq 0x28(%rsp), %rdi
callq 0x3040
movq 0x18(%rsp), %rdi
callq 0x3040
movq 0x8(%rsp), %rdi
callq 0x3040
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x58(%rsp), %rdi
callq 0x349f
leaq 0x58(%rsp), %rdi
callq 0x3479
movl $0x1, %edi
callq 0x3230
addq $0x30, %r14
movq %r14, %rdi
callq 0x34c5