// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
testq %rdi, %rdi
je 0x43be
movq %rdi, %r14
testq %rbx, %rbx
je 0x42e0
movl (%r14), %eax
cmpl (%rbx), %eax
jne 0x42e8
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %r12
movq 0x8(%r14), %r15
movl 0x4(%r14), %edx
movq %r15, %rdi
callq 0x4d99
movq %r15, 0x8(%r14)
cmpl $0x0, 0x4(%rbx)
jle 0x42cd
xorl %r15d, %r15d
movq 0x8(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x1030
incq %r15
movslq 0x4(%rbx), %rax
cmpq %rax, %r15
jl 0x42b4
movq 0x8(%rbx), %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
jmp 0x42eb
movq %r14, %rbx
jmp 0x43be
movq %rbx, %r12
movl (%r14), %eax
cmpl (%r12), %eax
movq %r14, %rbx
cmovgq %r12, %rbx
cmovgq %r14, %r12
movq 0x10(%rbx), %r14
testq %r14, %r14
setne %sil
je 0x43aa
movq %rbx, %rax
movl (%r12), %ecx
cmpl %ecx, (%r14)
jge 0x432a
movq %r14, 0x10(%rax)
movq 0x10(%r14), %rcx
movq %r12, %rdx
movq %r14, %rax
jmp 0x4390
movq %r12, 0x10(%rax)
jne 0x4385
movq 0x8(%r12), %r15
movq 0x8(%r14), %rsi
movl 0x4(%r14), %edx
movq %r15, %rdi
callq 0x4d99
movq %r15, 0x8(%r12)
cmpl $0x0, 0x4(%r14)
jle 0x436d
xorl %r15d, %r15d
movq 0x8(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x1030
incq %r15
movslq 0x4(%r14), %rax
cmpq %rax, %r15
jl 0x4354
movq 0x8(%r14), %rdi
callq 0x1030
movq 0x10(%r14), %r15
movq %r14, %rdi
callq 0x1030
movq %r15, %r14
movq 0x10(%r12), %rdx
movq %r14, %rcx
movq %r12, %rax
testq %rcx, %rcx
setne %sil
je 0x43b3
movq %rdx, %r12
movq %rcx, %r14
testq %rdx, %rdx
jne 0x4311
jmp 0x43b3
movq %r14, %rcx
movq %r12, %rdx
movq %rbx, %rax
testb %sil, %sil
cmoveq %rdx, %rcx
movq %rcx, 0x10(%rax)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq