// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/cactustree.c
// Function: insertCharacteristic
struct Characteristics *insertCharacteristic(struct Characteristics * characteristics, int size, int masterID, int patternRoot, int patternSubRoot, int treeID){
    struct Characteristics *start=characteristics, *hlp1=characteristics, *hlp2;
    //printf("\tchar %i %i %i %i\n", masterID, patternRoot,patternSubRoot,treeID);
    if(hlp1 && hlp1->masterID<=masterID){
        //printf("\t\t\tinster at middle of chars\n");
        while(hlp1->next && hlp1->next->masterID <= masterID){
            hlp1=hlp1->next;
        }
        if(hlp1->masterID<masterID){
       // printf("\t\t\tinster at new Entry of chars\n");
            hlp2=allocateCharacteristics(size, masterID);
            hlp2->next=hlp1->next;
            hlp1->next=hlp2;
            hlp1=hlp2;
        }
        // o/w hlp1 is already at the equal entry.
    }
    else{//hlp1==NULL or beginning is larger.
        //printf("\t\t\tinster at beginning of chars\n");
        start=allocateCharacteristics(size,masterID);
        start->next=hlp1;//hlp1 is either NULL or the beginning.
        hlp1=start;
        
        // o/w we have already the right entry as it has the correct masterID.
    }
   // printCharacteristics(hlp1);
    //printf("insert %i %i %i at master %i\n",patternRoot, patternSubRoot, treeID,hlp1->masterID);
    //printTL(hlp1->treeIDs[patternRoot][patternSubRoot]);
    hlp1->treeIDs[patternRoot][patternSubRoot]=insertTree(hlp1->treeIDs[patternRoot][patternSubRoot],treeID);
    //printTL(hlp1->treeIDs[patternRoot][patternSubRoot]);
   // printCharacteristics(hlp1);
    //printf("char for return \n");
    //printCharacteristics(start);
    return start;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movl %esi, 0x3c(%rsp)
movl %edx, 0x38(%rsp)
movl %ecx, 0x34(%rsp)
movl %r8d, 0x30(%rsp)
movl %r9d, 0x2c(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0x486f
movq 0x18(%rsp), %rax
movl (%rax), %eax
cmpl 0x38(%rsp), %eax
jg 0x486f
jmp 0x47e2
movq 0x18(%rsp), %rcx
xorl %eax, %eax
cmpq $0x0, 0x10(%rcx)
movb %al, 0xf(%rsp)
je 0x480a
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
movl (%rax), %eax
cmpl 0x38(%rsp), %eax
setle %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x4814
jmp 0x4824
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x18(%rsp)
jmp 0x47e2
movq 0x18(%rsp), %rax
movl (%rax), %eax
cmpl 0x38(%rsp), %eax
jge 0x486d
movl 0x3c(%rsp), %edi
movl 0x38(%rsp), %esi
callq 0x4a00
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x10(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x4899
movl 0x3c(%rsp), %edi
movl 0x38(%rsp), %esi
callq 0x4a00
movq %rax, 0x20(%rsp)
movq 0x18(%rsp), %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x20(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rax
movslq 0x34(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x30(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movl 0x2c(%rsp), %esi
callq 0x4c40
movq %rax, %rdx
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rax
movslq 0x34(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x30(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x20(%rsp), %rax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)