// File: /workspace/github_c_makefile_star2_O0/devkot[P]SearchEngine/Crawler/trie.c
// Function: addToPostingList
PostingListNode * addToPostingList(PostingListNode *head, int lineNumber, int *newDoc, char *fileName){
    PostingListNode *newNode, *lineNode;

    if(!strcmp(head->fileName, fileName) && (head->lineNumber == lineNumber)) {
        (head->n)++;            // simply increase frequency

        *newDoc = 0;            // do not count this doc as new doc the word has appeared into

        return head;
    }
    else if (!strcmp(head->fileName, fileName) && (head->lineNumber != lineNumber)){  // if this is not the first time the word is found in the document /head->fileName == fileName
        lineNode = (PostingListNode *) malloc(sizeof(PostingListNode));
        lineNode->fileName = (char *) malloc(strlen(fileName) + 2);

        lineNode->lineNumber = lineNumber;
        lineNode->n = head->n + 1;
        strcpy(lineNode->fileName, fileName);
        lineNode->next       = head;

        *newDoc = 0;            // do not count this doc as new doc the word has appeared into

        return lineNode;            // head remains as is
    }
    else{                       // if this is the first time the word is found in the document
        newNode = (PostingListNode *) malloc(sizeof(PostingListNode));
        newNode->fileName = (char *) malloc(strlen(fileName) + 2);

        newNode->lineNumber = lineNumber;   // node points to the document the word is in
        newNode->n          = 1;            // frequency of the word inside the document is 1, since it is its first appearance
//        newNode->fileName   = fileName;     // set the fileName
        strcpy(newNode->fileName, fileName);
        newNode->next       = head;         // next node of the new node is the old head

        *newDoc = 1;            // make sure we count this doc in the unique docs the word has appeared

        return newNode;         // new node becomes the new head of the list
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x10e0
cmpl $0x0, %eax
jne 0x201c
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x201c
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc(%rax)
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2129
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x10e0
cmpl $0x0, %eax
jne 0x20b9
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x14(%rbp), %eax
je 0x20b9
movl $0x18, %edi
callq 0x1110
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
callq 0x1080
movq %rax, %rdi
addq $0x2, %rdi
callq 0x1110
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movl -0x14(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x1040
movq -0x10(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2129
movl $0x18, %edi
callq 0x1110
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0x1080
movq %rax, %rdi
addq $0x2, %rdi
callq 0x1110
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movl -0x14(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x30(%rbp), %rax
movl $0x1, 0xc(%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x1040
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movl $0x1, (%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)