// File: /workspace/github_c_makefile_star2_O3/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 0x43c1
movq %rdi, %r14
testq %rbx, %rbx
je 0x42f8
movl (%r14), %eax
movl (%rbx), %ecx
cmpl %ecx, %eax
jne 0x4300
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %r12
movq 0x8(%r14), %r15
movl 0x4(%r14), %edx
movq %r15, %rdi
callq 0x4daf
movq %r15, 0x8(%r14)
cmpl $0x0, 0x4(%rbx)
jle 0x42de
xorl %r15d, %r15d
movq 0x8(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x1030
incq %r15
movslq 0x4(%rbx), %rax
cmpq %rax, %r15
jl 0x42c5
movq 0x8(%rbx), %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
movl (%r14), %eax
movl (%r12), %ecx
jmp 0x4303
movq %r14, %rbx
jmp 0x43c1
movq %rbx, %r12
cmpl %ecx, %eax
movq %r14, %rbx
cmovgq %r12, %rbx
cmovgq %r14, %r12
movq 0x10(%rbx), %r14
movq %rbx, %rax
testq %r14, %r14
je 0x43bd
movl (%r12), %ecx
cmpl %ecx, (%r14)
jge 0x4339
movq %r14, 0x10(%rax)
movq 0x10(%r14), %rdx
movq %r12, %rcx
movq %r14, %rax
jmp 0x439f
movq %r12, 0x10(%rax)
jne 0x4394
movq 0x8(%r12), %r15
movq 0x8(%r14), %rsi
movl 0x4(%r14), %edx
movq %r15, %rdi
callq 0x4daf
movq %r15, 0x8(%r12)
cmpl $0x0, 0x4(%r14)
jle 0x437c
xorl %r15d, %r15d
movq 0x8(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x1030
incq %r15
movslq 0x4(%r14), %rax
cmpq %rax, %r15
jl 0x4363
movq 0x8(%r14), %rdi
callq 0x1030
movq 0x10(%r14), %r15
movq %r14, %rdi
callq 0x1030
movq %r15, %r14
movq 0x10(%r12), %rcx
movq %r14, %rdx
movq %r12, %rax
testq %rdx, %rdx
je 0x43b3
movq %rcx, %r12
movq %rdx, %r14
testq %rcx, %rcx
jne 0x4320
testq %rdx, %rdx
cmovneq %rdx, %rcx
movq %rcx, %r12
movq %r12, 0x10(%rax)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq