// File: /workspace/github_c_makefile_star2_O3/trumabrat[P]GrandProjet/reseau.c
// Function: reconstitueReseauListe
Reseau* reconstitueReseauListe(Chaines *C){
    int i;
    Reseau* reso = (Reseau*) calloc(1, sizeof(Reseau));
    reso->gamma = C->gamma;

    CellChaine* chaineTmp = C->chaines;
    CellPoint* pointTmp = NULL;
    CellPoint* pointPrev = NULL;
    CellPoint* pointTete = NULL;
    Noeud* noeudPrev = NULL;
    Noeud* noeudTmp = NULL;
    Noeud* noeudTete = NULL;
    CellCommodite* commoditeTmp = NULL;
    // On parcourt une `a une chaque cha^ıne:
    
    for ( i = 0; i < C->nbChaines; i++, chaineTmp = chaineTmp->suiv)
    {
        // si Chaines est bien construit, les deux assert ne pose pas de probleme
        // si chaineTmp == NULL, on a mal compte le nombre de chaines
        assert(chaineTmp);

        pointTete = chaineTmp->points;// on fait hypothese que ce n'est pas NULL
        pointTmp = pointTete;

        // On s'occupe du premier neoud
        noeudTete = rechercheCreeNoeudListe(reso, pointTmp->x, pointTmp->y);
        noeudPrev = noeudTete;
        pointPrev = pointTmp;
        pointTmp = pointTmp->suiv;

        // Pour chaque point p de la cha^ıne:
        while(pointTmp){
            // Si p !∈ V (on teste si le point n’a pas d´ej`a ´et´e rencontr´e auparavant)
                // On ajoute dans V un nœud correspond au point p.
            noeudTmp = rechercheCreeNoeudListe(reso, pointTmp->x, pointTmp->y);
            
            // On met `a jour la liste des voisins de p et celles de ses voisins.
            noeudPrev = ajouterVoisin(noeudPrev, noeudTmp);

            // passe au point suivant
            pointPrev = pointTmp;
            pointTmp = pointTmp->suiv;
        }
        
            
            
        // On conserve la commodit´e de la cha^ıne.
        assert(noeudTete && noeudTmp);
        commoditeTmp = creerCellCommodite(noeudTete, noeudTmp, commoditeTmp);
    }
    // si chaineTmp == NULL, on a mal compte le nombre de chaines
    assert(!chaineTmp);

    reso->commodites = commoditeTmp;
    return reso;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r15
movl $0x1, %edi
movl $0x18, %esi
callq 0x10c0
movq %rax, %rbx
movl (%r15), %eax
movl %eax, 0x4(%rbx)
movq 0x8(%r15), %rbp
xorl %r14d, %r14d
movq %r15, 0x8(%rsp)
cmpl $0x0, 0x4(%r15)
jle 0x1fb2
xorl %edx, %edx
xorl %r15d, %r15d
movq %rdx, 0x10(%rsp)
testq %rbp, %rbp
je 0x1fcf
movq 0x8(%rbp), %r12
movsd (%r12), %xmm0
movsd 0x8(%r12), %xmm1
movq %rbx, %rdi
callq 0x1ce4
movq %rax, (%rsp)
movq 0x10(%r12), %r12
testq %r12, %r12
je 0x1f6a
movq (%rsp), %r13
movsd (%r12), %xmm0
movsd 0x8(%r12), %xmm1
movq %rbx, %rdi
callq 0x1ce4
movq %rax, %r15
movq %r13, %rdi
movq %rax, %rsi
callq 0x1e23
movq 0x10(%r12), %r12
movq %r15, %r13
testq %r12, %r12
jne 0x1f3a
movq (%rsp), %r12
testq %r12, %r12
je 0x1fee
testq %r15, %r15
je 0x1fee
movl $0x1, %edi
movl $0x18, %esi
callq 0x10c0
movq %r12, (%rax)
movq %r15, 0x8(%rax)
movq 0x10(%rsp), %rcx
movq %rcx, 0x10(%rax)
incl %r14d
movq 0x10(%rbp), %rbp
movq %rax, %rdx
movq 0x8(%rsp), %rcx
cmpl 0x4(%rcx), %r14d
jl 0x1f01
jmp 0x1fb4
xorl %eax, %eax
testq %rbp, %rbp
jne 0x200d
movq %rax, 0x10(%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x21cc(%rip), %rdi      # 0x41a2
leaq 0x217b(%rip), %rsi      # 0x4158
leaq 0x217d(%rip), %rcx      # 0x4161
movl $0x66, %edx
callq 0x10a0
leaq 0x2196(%rip), %rdi      # 0x418b
leaq 0x215c(%rip), %rsi      # 0x4158
leaq 0x215e(%rip), %rcx      # 0x4161
movl $0x82, %edx
callq 0x10a0
leaq 0x218d(%rip), %rdi      # 0x41a1
leaq 0x213d(%rip), %rsi      # 0x4158
leaq 0x213f(%rip), %rcx      # 0x4161
movl $0x86, %edx
callq 0x10a0