// File: /workspace/github_cpp_makefile_star2_O3/exrok[P]evdoublebind/./src/make_config.cc
// Function: generate_hfile(Config&, Settings&)
void generate_hfile(Config &config, Settings &settings) {
     FILE * hfile;
     if (settings.evdoublebind_conf_output == NULL) {
         hfile = stdout;
     } else {
         hfile = fopen(settings.evdoublebind_conf_output, "w");
     }
     if (hfile == NULL) {
         perror("Failed Creating xkb config file: ");
     }
     for (auto &kbd : config.keyboards){
         fprintf(hfile,"%s ", kbd);
         auto unused = config.unused_keys.begin();
         bool first = true;
         for (auto & mapping: config.mappings) {
             if (mapping.tap_map[0] != NULL) {
                 if (unused == config.unused_keys.end()) {
                     fprintf(stderr,"ERROR: not enough unused keys specified for config\n");
                     exit(1);
                 }
                 if (!first) {
                     fprintf(hfile,",");
                 }
                 first = false;
                 fprintf(hfile,"%d:%d", mapping.keycode - 8, *unused - 8);
                 unused++;
             } else if (mapping.tap_raw[0] != -1) {
                 if (!first) {
                     fprintf(hfile,",");
                 }
                 first = false;
                 fprintf(hfile,"%d:%d", mapping.keycode - 8, mapping.tap_raw[0] - 8);
                 if (mapping.tap_raw[1] != -1) {
                     fprintf(hfile,"|%d", mapping.tap_raw[1] - 8);
                 }
             }
         }
         fprintf(hfile,"\n");
     }
     if (settings.evdoublebind_conf_output != NULL) {
         fclose(hfile); //don't close stdout
     } else {
         fflush(stdout);
     }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x40(%rsi), %rdi
testq %rdi, %rdi
je 0x3e18
leaq 0x221c(%rip), %rsi      # 0x602a
callq 0x31e0
movq %rax, %r15
jmp 0x3e22
movq 0x51a1(%rip), %rax      # 0x8fc0
movq (%rax), %r15
testq %r15, %r15
je 0x3fbc
movq 0x8(%rsp), %rax
movslq 0x1c(%rax), %rax
testq %rax, %rax
je 0x3f7d
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rcx
leaq (%rcx,%rax,8), %rax
movq %rax, 0x18(%rsp)
movq %rcx, 0x20(%rsp)
movq (%rcx), %rdx
movq %r15, %rdi
leaq 0x2271(%rip), %rsi      # 0x60d2
xorl %eax, %eax
callq 0x3150
movq 0x8(%rsp), %rax
movslq 0xc(%rax), %rax
testq %rax, %rax
je 0x3f5c
movq 0x8(%rsp), %rcx
movq (%rcx), %r12
movq 0x20(%rcx), %rbp
shlq $0x4, %rax
leaq (%rax,%rax,4), %rbx
movb $0x1, %r14b
xorl %r13d, %r13d
cmpq $0x0, 0x28(%r12,%r13)
je 0x3ef9
movq 0x8(%rsp), %rcx
movslq 0x2c(%rcx), %rax
shlq $0x2, %rax
addq 0x20(%rcx), %rax
cmpq %rax, %rbp
je 0x3fcd
testb $0x1, %r14b
jne 0x3ec9
movl $0x2c, %edi
movq %r15, %rsi
callq 0x3110
movl (%r12,%r13), %edx
addl $-0x8, %edx
movl (%rbp), %ecx
addl $-0x8, %ecx
xorl %r14d, %r14d
movq %r15, %rdi
leaq 0x21f3(%rip), %rsi      # 0x60d6
xorl %eax, %eax
callq 0x3150
addq $0x4, %rbp
addq $0x50, %r13
cmpq %r13, %rbx
jne 0x3e94
jmp 0x3f5c
movl 0x48(%r12,%r13), %ecx
cmpl $-0x1, %ecx
je 0x3eee
testb $0x1, %r14b
jne 0x3f1b
movl $0x2c, %edi
movq %r15, %rsi
callq 0x3110
movl 0x48(%r12,%r13), %ecx
movl (%r12,%r13), %edx
addl $-0x8, %edx
addl $-0x8, %ecx
xorl %r14d, %r14d
movq %r15, %rdi
leaq 0x21a4(%rip), %rsi      # 0x60d6
xorl %eax, %eax
callq 0x3150
movl 0x4c(%r12,%r13), %edx
cmpl $-0x1, %edx
je 0x3eee
addl $-0x8, %edx
xorl %r14d, %r14d
movq %r15, %rdi
leaq 0x2189(%rip), %rsi      # 0x60dc
xorl %eax, %eax
callq 0x3150
jmp 0x3eee
movl $0xa, %edi
movq %r15, %rsi
callq 0x3110
movq 0x20(%rsp), %rcx
addq $0x8, %rcx
cmpq 0x18(%rsp), %rcx
jne 0x3e4f
movq 0x10(%rsp), %rax
cmpq $0x0, 0x40(%rax)
je 0x3f9f
movq %r15, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3070
movq 0x501a(%rip), %rax      # 0x8fc0
movq (%rax), %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3190
leaq 0x2069(%rip), %rdi      # 0x602c
callq 0x31f0
jmp 0x3e2b
callq 0x3454