// File: /workspace/github_c_makefile_star2_O3/morozov312[P]documentary/./src/processing.c
// Function: Create_document
int Create_document(char* path, char* dest_dir)
{
    /** if founded begin of multiline documentary comment -> start flag == true
     */
    int qty_structs = 0, start_flag = 0;
    int valid_Check = Check_extension(path);
    if (!valid_Check) {
        printf("%s%s\n", "Unsupported file format on - ", path);
        return 0;
    }
    char** document_data = Get_data_from_document(path);
    int count_of_lines = 0;
    /// if file cannot be read
    if (document_data == NULL) {
        return 0;
    }
    for (int i = 0; i < MAX_QTY_STR; i++) {
        if (strlen(document_data[i]) != 0) {
            document_data[i] = Escape_html(document_data[i]);
            count_of_lines++;
        }
    }
    /// this error appears if the document empty ot has 1 line
    if (count_of_lines <= 1) {
        printf("%s%s", "Error,file on path ", path);
        printf("%s\n", " too small for documentation");
        return 0;
    }
    /// calling function of the main algorithm
    comment* comments_array = Create_struct_of_data(
            count_of_lines, document_data, &qty_structs, &start_flag);
    /// if was a beginning of a documentary comment but there wasn't end
    if (start_flag) {
        printf("%s%s\n", "Syntax error in file - ", path);
        return 0;
    }
    if (qty_structs == 0) {
        printf("%s%s%s\n",
               "In file - ",
               path,
               " there are no documentary comments");
        return 0;
    }
    int creation_flag
            = Generate_html(comments_array, path, qty_structs, dest_dir);
    if (creation_flag) {
        printf("%s%s\n",
               "\x1b[32mSuccessfully created documentation on file - \x1b[0m",
               path);
    }
    //======================================
    for (int i = 0; i < MAX_QTY_STR; i++) {
        free(document_data[i]);
    }
    free(document_data);
    free(comments_array);
    //=======================================
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
xorl %eax, %eax
movl %eax, -0x2c(%rbp)
movl %eax, -0x30(%rbp)
callq 0x437c
testl %eax, %eax
je 0x4a34
movq %rbx, %rdi
callq 0x3e63
testq %rax, %rax
je 0x4a79
movq %rax, %r14
xorl %r13d, %r13d
xorl %r12d, %r12d
movq (%r14,%r13,8), %rdi
cmpb $0x0, (%rdi)
je 0x49fc
callq 0x3c58
movq %rax, (%r14,%r13,8)
incl %r12d
incq %r13
cmpq $0xc350, %r13           # imm = 0xC350
jne 0x49e7
cmpl $0x2, %r12d
jge 0x4a44
leaq 0x11c7(%rip), %rdi      # 0x5bdc
leaq 0x133d(%rip), %rsi      # 0x5d59
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2100
leaq 0x1340(%rip), %rdi      # 0x5d6d
callq 0x2080
jmp 0x4a79
leaq 0x1033(%rip), %rdi      # 0x5a6e
leaq 0x12f9(%rip), %rsi      # 0x5d3b
jmp 0x4a6f
leaq -0x2c(%rbp), %rdx
leaq -0x30(%rbp), %r13
movl %r12d, %edi
movq %r14, %rsi
movq %r13, %rcx
callq 0x4798
cmpl $0x0, (%r13)
je 0x4a8a
leaq 0x1006(%rip), %rdi      # 0x5a6e
leaq 0x131b(%rip), %rsi      # 0x5d8a
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2100
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl -0x2c(%rbp), %edx
testl %edx, %edx
je 0x4ae7
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rcx
callq 0x4584
testl %eax, %eax
je 0x4abe
leaq 0xfc1(%rip), %rdi       # 0x5a6e
leaq 0x131c(%rip), %rsi      # 0x5dd0
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2100
xorl %ebx, %ebx
movq (%r14,%rbx,8), %rdi
callq 0x2030
incq %rbx
cmpq $0xc350, %rbx           # imm = 0xC350
jne 0x4ac0
movq %r14, %rdi
callq 0x2030
movq %r12, %rdi
callq 0x2030
jmp 0x4a79
leaq 0xf7e(%rip), %rdi       # 0x5a6c
leaq 0x12ad(%rip), %rsi      # 0x5da2
leaq 0x12b1(%rip), %rcx      # 0x5dad
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2100
jmp 0x4a79