// File: /workspace/github_c_makefile_star2_O0/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
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5140
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x5a95
movq -0x10(%rbp), %rdx
leaq 0x1002(%rip), %rdi      # 0x6a7d
leaq 0x129d(%rip), %rsi      # 0x6d1f
movb $0x0, %al
callq 0x20f0
movl $0x0, -0x4(%rbp)
jmp 0x5c46
movq -0x10(%rbp), %rdi
callq 0x48b0
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x5abc
movl $0x0, -0x4(%rbp)
jmp 0x5c46
movl $0x0, -0x38(%rbp)
cmpl $0xc350, -0x38(%rbp)    # imm = 0xC350
jge 0x5b19
movq -0x30(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x20c0
cmpq $0x0, %rax
je 0x5b0c
movq -0x30(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4530
movq %rax, %rdx
movq -0x30(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x5b0e
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x5ac3
cmpl $0x1, -0x34(%rbp)
jg 0x5b59
movq -0x10(%rbp), %rdx
leaq 0x1096(%rip), %rdi      # 0x6bc0
leaq 0x120c(%rip), %rsi      # 0x6d3d
movb $0x0, %al
callq 0x20f0
leaq 0xfc6(%rip), %rdi       # 0x6b05
leaq 0x120b(%rip), %rsi      # 0x6d51
movb $0x0, %al
callq 0x20f0
movl $0x0, -0x4(%rbp)
jmp 0x5c46
movl -0x34(%rbp), %edi
movq -0x30(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
leaq -0x20(%rbp), %rcx
callq 0x5760
movq %rax, -0x40(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x5b9c
movq -0x10(%rbp), %rdx
leaq 0xefb(%rip), %rdi       # 0x6a7d
leaq 0x11e5(%rip), %rsi      # 0x6d6e
movb $0x0, %al
callq 0x20f0
movl $0x0, -0x4(%rbp)
jmp 0x5c46
cmpl $0x0, -0x1c(%rbp)
jne 0x5bcb
movq -0x10(%rbp), %rdx
leaq 0xece(%rip), %rdi       # 0x6a7b
leaq 0x11d2(%rip), %rsi      # 0x6d86
leaq 0x11d6(%rip), %rcx      # 0x6d91
movb $0x0, %al
callq 0x20f0
movl $0x0, -0x4(%rbp)
jmp 0x5c46
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %edx
movq -0x18(%rbp), %rcx
callq 0x5490
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
je 0x5c01
movq -0x10(%rbp), %rdx
leaq 0xe8a(%rip), %rdi       # 0x6a7d
leaq 0x11ba(%rip), %rsi      # 0x6db4
movb $0x0, %al
callq 0x20f0
movl $0x0, -0x48(%rbp)
cmpl $0xc350, -0x48(%rbp)    # imm = 0xC350
jge 0x5c2d
movq -0x30(%rbp), %rax
movslq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2030
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x5c08
movq -0x30(%rbp), %rdi
callq 0x2030
movq -0x40(%rbp), %rdi
callq 0x2030
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq