// File: /workspace/github_c_makefile_star2_O2/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, %rbx
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x10c0
movq %rax, %r14
movl (%rbx), %eax
movl %eax, 0x4(%r14)
movq %rbx, (%rsp)
addq $0x8, %rbx
xorl %ecx, %ecx
xorl %r12d, %r12d
xorl %edx, %edx
movq (%rbx), %rbx
movq (%rsp), %rax
cmpl 0x4(%rax), %ecx
jge 0x1e28
movq %rdx, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
testq %rbx, %rbx
je 0x1e43
movq 0x8(%rbx), %r15
movsd (%r15), %xmm0
movsd 0x8(%r15), %xmm1
movq %r14, %rdi
callq 0x1bf0
movq %rax, %r13
movq %rax, %rbp
movq 0x10(%r15), %r15
testq %r15, %r15
je 0x1dfb
movsd (%r15), %xmm0
movsd 0x8(%r15), %xmm1
movq %r14, %rdi
callq 0x1bf0
movq %rax, %r12
movq %rbp, %rdi
movq %rax, %rsi
callq 0x1cdd
movq %r12, %rbp
jmp 0x1dcc
testq %r13, %r13
je 0x1e60
testq %r12, %r12
je 0x1e60
movq %r13, %rdi
movq %r12, %rsi
movq 0x8(%rsp), %rdx
callq 0x1d2e
movq %rax, %rdx
movq 0x10(%rsp), %rcx
incl %ecx
addq $0x10, %rbx
jmp 0x1d8c
testq %rbx, %rbx
jne 0x1e7f
movq %rdx, 0x10(%r14)
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1358(%rip), %rdi      # 0x31a2
leaq 0x1307(%rip), %rsi      # 0x3158
leaq 0x1309(%rip), %rcx      # 0x3161
pushq $0x66
popq %rdx
callq 0x10a0
leaq 0x1324(%rip), %rdi      # 0x318b
leaq 0x12ea(%rip), %rsi      # 0x3158
leaq 0x12ec(%rip), %rcx      # 0x3161
movl $0x82, %edx
callq 0x10a0
leaq 0x131b(%rip), %rdi      # 0x31a1
leaq 0x12cb(%rip), %rsi      # 0x3158
leaq 0x12cd(%rip), %rcx      # 0x3161
movl $0x86, %edx
callq 0x10a0