// File: /workspace/github_cpp_makefile_star2_O3/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, 0x38(%rsp)
movq 0x30(%rdi), %rdi
callq 0x3ac0
movq %rax, 0x40(%rsp)
testq %rax, %rax
je 0x4327
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 0x431d
movq %rax, %rbx
movq %rax, %rdi
movq 0x38(%rsp), %rsi
xorl %edx, %edx
callq 0x30f0
testq %rax, %rax
je 0x431d
movq %rax, %r14
movq %rax, %rdi
callq 0x3130
movq %rax, 0x70(%rsp)
testq %rax, %rax
je 0x431d
movq %rbx, 0x68(%rsp)
leaq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rax
movq %rax, (%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movl $0xffffffff, 0x18(%rdi) # imm = 0xFFFFFFFF
movb $0x0, 0x1c(%rdi)
callq 0x4512
testb %al, %al
je 0x428c
leaq 0x2048(%rip), %r12      # 0x6101
leaq 0x48(%rsp), %rbp
movq %r14, (%rsp)
movq 0x50(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x3140
testl %eax, %eax
je 0x41c2
movq %r15, %rdi
leaq 0x2024(%rip), %rsi      # 0x6108
callq 0x3140
movq 0x58(%rsp), %rbx
testl %eax, %eax
je 0x41d9
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 0x4309
movl 0x14(%rsp), %eax
movslq 0x10(%rsp), %rcx
movq 0x8(%rsp), %r14
cmpl %ecx, %eax
jl 0x4164
leal (%rcx,%rcx), %eax
movl %eax, 0x10(%rsp)
shlq $0x5, %rcx
leaq (%rcx,%rcx,4), %rsi
movq %r14, %rdi
callq 0x31a0
movq %rax, %r14
movq %rax, 0x8(%rsp)
movl 0x14(%rsp), %eax
movq 0x50(%rsp), %r15
leal 0x1(%rax), %ecx
movl %ecx, 0x14(%rsp)
cltq
leaq (%rax,%rax,4), %r12
shlq $0x4, %r12
leaq (%r14,%r12), %rbp
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x3868
movl %eax, (%r14,%r12)
testq %r13, %r13
je 0x4217
movb $0x0, (%r13)
leaq 0x1(%r13), %rsi
leaq 0x28(%rbp), %rdi
callq 0x37de
movq $-0x1, 0x48(%rbp)
testq %rbx, %rbx
sete %bl
movq (%rsp), %r14
leaq 0x1f44(%rip), %r12      # 0x6101
jmp 0x4255
movq 0x58(%rsp), %rdx
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
callq 0x3969
jmp 0x427c
movl 0x24(%rsp), %ecx
movslq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rax
cmpl %esi, %ecx
jl 0x4207
leal (%rsi,%rsi), %ecx
movl %ecx, 0x20(%rsp)
shlq $0x4, %rsi
movq %rax, %rdi
callq 0x31a0
movq %rax, 0x18(%rsp)
movl 0x24(%rsp), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x24(%rsp)
movslq %ecx, %rcx
movq %rbx, (%rax,%rcx,8)
jmp 0x427c
testq %rbx, %rbx
leaq 0x1ee0(%rip), %r12      # 0x6101
je 0x424f
movb $0x0, (%rbx)
incq %rbx
movl 0x60(%rsp), %edi
leaq 0x48(%rbp), %rdx
movq (%rsp), %r14
movq %r14, %rsi
movq %rbx, %rcx
callq 0x38d9
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbp)
movups %xmm0, 0x28(%rbp)
xorl %ebx, %ebx
jmp 0x4255
movb $0x1, %bl
movq (%rsp), %r14
addq $0x8, %rbp
movq 0x58(%rsp), %rsi
movq %rbp, %rdi
callq 0x37de
testb %bl, %bl
leaq 0x48(%rsp), %rbp
je 0x427c
testl %eax, %eax
jne 0x427c
testq %r13, %r13
je 0x4313
movq %rbp, %rdi
callq 0x4512
testb %al, %al
jne 0x40c2
leaq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rbx
movq %rbx, %rsi
callq 0x3de6
cmpb $0x0, 0x28(%rbx)
jne 0x42b4
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x3b52
movq 0x40(%rsp), %rdi
callq 0x3040
movq 0x70(%rsp), %rdi
callq 0x3210
movq %r14, %rdi
callq 0x3180
movq 0x68(%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 0x60(%rsp), %rdi
callq 0x349f
leaq 0x60(%rsp), %rdi
callq 0x3479
movl $0x1, %edi
callq 0x3230
movq 0x38(%rsp), %rdi
addq $0x30, %rdi
callq 0x34c5