// File: /workspace/github_c_makefile_star2_O2/morozov312[P]documentary/./src/processing.c
// Function: Generate_html
int Generate_html(comment* list, char* path, int qty_structs, char* dest_dir)
{
    FILE *documentary, *styles;
    char* ptrFile;
    char* name = Generate_filename(path, dest_dir);
    documentary = fopen(name, "w");
    if (documentary == NULL) {
        printf("%s\n", "Error create html page!");
        return 0;
    }
    /// header
    styles = fopen("/usr/share/documentary/styles/styles.html", "r");
    if (styles == NULL) {
        /// in case when app not installed
        styles = fopen("./styles/styles.html", "r");
        if (styles == NULL) {
            printf("%s\n", "Error, stylesheet not found!");
            return 0;
        }
    }
    while (1) {
        char* temp = (char*)calloc(MAX_LEN_INP_STR, sizeof(char));
        ptrFile = fgets(temp, MAX_LEN_INP_STR, styles);
        if (ptrFile == NULL) {
            if (feof(styles) != 0) {
                break;
            } else {
                continue;
            }
        }
        fputs(temp, documentary);
        free(temp);
    }
    fclose(styles);
    char* filename = Get_filename_without_extension(path);
    fputs(filename, documentary);
    fputs("</h2>", documentary);
    /// document programming language definition
    fputs(Get_document_type(path), documentary);
    // main content
    for (int i = 0; i < qty_structs; i++) {
        if (list[i].comment_data) {
            fputs("<p class=\"comment\">", documentary);
            fputs(list[i].comment_data, documentary);
            fputs("</br></p>", documentary);
            if (strlen(list[i].code_string)) {
                fputs("<code>", documentary);
                fputs(list[i].code_string, documentary);
                fputs("</code></br></br>", documentary);
            }
        }
    }
    /// footer
    fputs("</div></body></html>", documentary);
    fclose(documentary);
    free(name);
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, -0x40(%rbp)
movq %rsi, %r13
movq %rdi, %r15
movq %rsi, %rdi
movq %rcx, %rsi
callq 0x4394
movq %rax, %r14
leaq 0x1793(%rip), %rsi      # 0x5c73
movq %rax, %rdi
callq 0x21f0
testq %rax, %rax
je 0x4668
movq %rax, %r12
leaq 0x1792(%rip), %rdi      # 0x5c8d
leaq 0x165e(%rip), %rsi      # 0x5b60
callq 0x21f0
testq %rax, %rax
jne 0x4528
leaq 0x17a4(%rip), %rdi      # 0x5cb7
leaq 0x1646(%rip), %rsi      # 0x5b60
callq 0x21f0
testq %rax, %rax
je 0x4685
movq %rax, %rbx
movq %r13, -0x30(%rbp)
movq %r14, -0x38(%rbp)
pushq $0x1
popq %r13
movl $0x1f4, %edi            # imm = 0x1F4
movq %r13, %rsi
callq 0x2180
movq %rax, %r14
movq %rax, %rdi
movl $0x1f4, %esi            # imm = 0x1F4
movq %rbx, %rdx
callq 0x2160
testq %rax, %rax
je 0x4571
movq %r14, %rdi
movq %r12, %rsi
callq 0x2140
movq %r14, %rdi
callq 0x2030
jmp 0x4537
movq %rbx, %rdi
callq 0x21a0
testl %eax, %eax
je 0x4537
movq %rbx, %rdi
callq 0x20b0
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
callq 0x3c51
movq %rax, %rdi
movq %r12, %rsi
callq 0x2140
leaq 0x1746(%rip), %rdi      # 0x5ce9
movq %r12, %rsi
callq 0x2140
movq %rbx, %rdi
callq 0x4454
movq %rax, %rdi
movq %r12, %rsi
callq 0x2140
xorl %r14d, %r14d
movq -0x40(%rbp), %rbx
testl %ebx, %ebx
cmovlel %r14d, %ebx
shlq $0x4, %rbx
leaq 0x172d(%rip), %r13      # 0x5d03
cmpq %r14, %rbx
je 0x4643
cmpq $0x0, (%r15,%r14)
je 0x463d
leaq 0x1706(%rip), %rdi      # 0x5cef
movq %r12, %rsi
callq 0x2140
movq (%r15,%r14), %rdi
movq %r12, %rsi
callq 0x2140
movq %r13, %rdi
movq %r12, %rsi
callq 0x2140
movq 0x8(%r15,%r14), %rax
cmpb $0x0, (%rax)
je 0x463d
leaq 0x16f4(%rip), %rdi      # 0x5d0d
movq %r12, %rsi
callq 0x2140
movq 0x8(%r15,%r14), %rdi
movq %r12, %rsi
callq 0x2140
leaq 0x16df(%rip), %rdi      # 0x5d14
movq %r12, %rsi
callq 0x2140
addq $0x10, %r14
jmp 0x45d6
leaq 0x16dc(%rip), %rdi      # 0x5d26
movq %r12, %rsi
callq 0x2140
movq %r12, %rdi
callq 0x20b0
movq -0x38(%rbp), %rdi
callq 0x2030
pushq $0x1
popq %rax
jmp 0x4676
leaq 0x1606(%rip), %rdi      # 0x5c75
callq 0x2080
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1640(%rip), %rdi      # 0x5ccc
jmp 0x466f