// File: /workspace/github_c_makefile_star2_O2/pwelke[P]GraphMiningTools/cactustree.c
// Function: mergeCharacteristics
struct Characteristics *mergeCharacteristics(struct Characteristics *one, struct Characteristics *two){
    struct Characteristics *start, *hlp1=one, *hlp2=two, *hlp3;
    int i=0;
    if(one == NULL) return two;
    if(two == NULL) return one;
    /*
    printf("\n\t\t\tmerging chars\n\n");
    printCharacteristics(one);
    printf("\n===============\n");
    printCharacteristics(two);
    printf("\t both are not null\n");
    printf("\t %i\n",hlp1);
    printf("\t %i\n", hlp2->masterID);
    */
    if(hlp1->masterID==hlp2->masterID){
   // printf("\t equal\n");
        hlp3=hlp2;
        hlp2=hlp2->next;
        hlp1->treeIDs=mergeTreeArrays(hlp1->treeIDs, hlp3->treeIDs, hlp1->size);
        for(;i<hlp3->size;++i){
            free(hlp3->treeIDs[i]);
        }
        free(hlp3->treeIDs);
        free(hlp3);
    }
    if(hlp1->masterID>hlp2->masterID){
    //printf("\t first larger\n");
        hlp3=hlp1;
        hlp1=hlp2;
        hlp2=hlp3;
    }
    start=hlp1;
    hlp1=start->next;
    hlp3=start;
    while(hlp1 && hlp2){
    //printf("\t while loop\n");
        if(hlp1->masterID<hlp2->masterID){
            hlp3->next=hlp1;
            hlp3=hlp1;
            hlp1=hlp1->next;
        }
        else{
            hlp3->next=hlp2;
            hlp3=hlp2;
            if(hlp1->masterID==hlp3->masterID){
                hlp3->treeIDs=mergeTreeArrays(hlp3->treeIDs, hlp1->treeIDs, hlp1->size);
                for(i=0;i<hlp1->size;++i){
                    free(hlp1->treeIDs[i]);
                }
                free(hlp1->treeIDs);
                hlp2=hlp1->next;
                free(hlp1);
                hlp1=hlp2;
            }
            hlp2=hlp3->next;
        }
    }
    if(hlp1) hlp3->next=hlp1;
    else hlp3->next=hlp2;
    //printCharacteristics(start);
    return start;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
testq %rdi, %rdi
je 0x25b6
movq %rdi, %r14
testq %rbx, %rbx
je 0x24ee
movl (%r14), %eax
movl (%rbx), %ecx
cmpl %ecx, %eax
jne 0x24f6
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %r13
movq 0x8(%r14), %r15
movl 0x4(%r14), %edx
movq %r15, %rdi
callq 0x2ec3
movq %r15, 0x8(%r14)
xorl %r15d, %r15d
movslq 0x4(%rbx), %rax
movq 0x8(%rbx), %rdi
cmpq %rax, %r15
jge 0x24fb
movq (%rdi,%r15,8), %rdi
callq 0x1030
incq %r15
jmp 0x24d3
movq %r14, %rbx
jmp 0x25b6
movq %rbx, %r13
jmp 0x250f
callq 0x1030
movq %rbx, %rdi
callq 0x1030
movl (%r14), %eax
movl (%r13), %ecx
cmpl %ecx, %eax
movq %r14, %rbx
cmovgq %r13, %rbx
cmovgq %r14, %r13
movq 0x10(%rbx), %rcx
movq %rbx, %r12
movq %r12, %rax
movq %r13, %r12
movq %rcx, %r14
testq %rcx, %rcx
je 0x25ab
testq %r12, %r12
je 0x25ab
movl (%r12), %ecx
cmpl %ecx, (%r14)
jge 0x254c
movq %r14, 0x10(%rax)
movq 0x10(%r14), %rcx
movq %r14, %rax
jmp 0x2529
movq %r12, 0x10(%rax)
jne 0x259e
movq 0x8(%r12), %r15
movq 0x8(%r14), %rsi
movl 0x4(%r14), %edx
movq %r15, %rdi
callq 0x2ec3
movq %r15, 0x8(%r12)
xorl %r15d, %r15d
movslq 0x4(%r14), %rax
movq 0x8(%r14), %rdi
cmpq %rax, %r15
jge 0x258a
movq (%rdi,%r15,8), %rdi
callq 0x1030
incq %r15
jmp 0x256f
callq 0x1030
movq 0x10(%r14), %r15
movq %r14, %rdi
callq 0x1030
movq %r15, %r14
movq 0x10(%r12), %r13
movq %r14, %rcx
jmp 0x2523
testq %r14, %r14
cmovneq %r14, %r12
movq %r12, 0x10(%rax)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq