// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/troisInstancesMain.c
// Function: main
int main()
{
    FILE* f = NULL;
    clock_t start, end;
    double t_diff;
    FILE* f2 = NULL;

    // Instance 1
    // lecture et creation d'une instance de Chaines et de Reseau
    
    f = fopen("00014_burma.cha", "r");
    Chaines *c = lectureChaines(f);
    fclose(f);

    // construction du reseau, hachage et arbre
    // avec calcul du temps, et son ecriture dans un fichier
    start = clock();
    Reseau *L = reconstitueReseauListe(c);
    end = clock();
    f2 = fopen("00014_burmaListe.txt", "w");
    t_diff = (double)(end - start)/(CLOCKS_PER_SEC);
    fprintf(f2, "temps de calcusls: %lf\n", t_diff);
    fclose(f2);
    liberation_reseau(L);
    
    // Reconstruction par table hachage
    Reseau *H = NULL;
    f2 = fopen("00014_burmaHachage.txt", "w");
    for(int i = 2; i < 30; i+=2){
        start = clock();
        H = reconstitueReseauHachage(c, i);
        end = clock();
        t_diff = (double)(end - start)/(CLOCKS_PER_SEC);
        fprintf(f2, "%d %lf\n", i, t_diff);
        liberation_reseau(H);
    }
    fclose(f2);
    
    // Reconstruiction par Arbre
    start = clock();
    Reseau* A = reconstitueReseauArbre(c);
    end = clock();
    f2 = fopen("00014_burmaArbreQuat.txt", "w");
    t_diff = (double)(end - start)/(CLOCKS_PER_SEC);
    fprintf(f2, "temps de calcusls: %lf\n", t_diff);
    fclose(f2);
    liberation_reseau(A);


    // liberation de memoire
    liberer_chaines(c);

    // Instance 2
    // lecture et creation d'une instance de Chaines et de Reseau
    f = fopen("05000_USA-road-d-NY.cha", "r");
    Chaines* c2 = lectureChaines(f);
    fclose(f);

    // construction du reseau, hachage et arbre
    // avec calcul du temps, et son ecriture dans un fichier
    start = clock();
    Reseau* L2 = reconstitueReseauListe(c2);
    end = clock();
    f2 = fopen("05000_USA-road-d-NYListe.txt", "w");
    t_diff = (double)(end - start)*1.0/(CLOCKS_PER_SEC);
    fprintf(f2, "temps de calcusls: %lf\n", t_diff);
    fclose(f2);
    liberation_reseau(L2);
    
    // Reconstruction par table hachage
    Reseau* H2 = NULL;
    f2 = fopen("05000_USA-road-d-NYHachage.txt", "w");
    for(int i = 5; i <= 100; i+=5){
        start = clock();
        H2 = reconstitueReseauHachage(c2, i);
        end = clock();
        t_diff = (double)(end - start)*1.0/(CLOCKS_PER_SEC);
        fprintf(f2, "%d %lf\n", i, t_diff);
        liberation_reseau(H2);
    }
    fclose(f2);
    
    // Reconstruiction par Arbre
    start = clock();
    Reseau* A2 = reconstitueReseauArbre(c2);
    end = clock();
    f2 = fopen("05000_USA-road-d-NYArbreQuat.txt", "w");
    t_diff = (double)(end - start)*1.0/(CLOCKS_PER_SEC);
    fprintf(f2, "temps de calcusls: %lf\n", t_diff);
    fclose(f2);
    liberation_reseau(A2);


    // liberation de memoire
    liberer_chaines(c2);

    // Instance 3
    // lecture et creation d'une instance de Chaines et de Reseau
    f = fopen("07397_pla.cha", "r");
    Chaines* c3 = lectureChaines(f);
    fclose(f);

    // construction du reseau, hachage et arbre
    // avec calcul du temps, et son ecriture dans un fichier
    start = clock();
    Reseau* L3 = reconstitueReseauListe(c3);
    end = clock();
    f2 = fopen("07397_plaListe.txt", "w");
    t_diff = (double)(end - start)*1.0/(CLOCKS_PER_SEC);
    fprintf(f2, "temps de calcusls: %lf\n", t_diff);
    fclose(f2);
    liberation_reseau(L3);
    
    // Reconstruction par table hachage
    Reseau* H3 = NULL;
    f2 = fopen("07397_plaHachage.txt", "w");
    for(int i = 10; i <= 1000; i+=10){
        start = clock();
        H3 = reconstitueReseauHachage(c3, i);
        end = clock();
        t_diff = (double)(end - start)*1.0/(CLOCKS_PER_SEC);
        fprintf(f2, "%d %lf\n", i, t_diff);
        liberation_reseau(H3);
    }
    fclose(f2);
    
    // Reconstruiction par Arbre
    start = clock();
    Reseau* A3 = reconstitueReseauArbre(c3);
    end = clock();
    f2 = fopen("07397_plaArbreQuat.txt", "w");
    t_diff = (double)(end - start)*1.0/(CLOCKS_PER_SEC);
    fprintf(f2, "temps de calcusls: %lf\n", t_diff);
    fclose(f2);
    liberation_reseau(A3);

    // liberation de memoire
    liberer_chaines(c3);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x2dc2(%rip), %rdi      # 0x4010
leaq 0x2dcb(%rip), %rsi      # 0x4020
callq 0x10f0
movq %rax, %r14
movq %rax, %rdi
callq 0x17c4
movq %rax, %rbx
movq %r14, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
callq 0x2009
movq %rax, %r14
callq 0x1060
movq %rax, %r13
leaq 0x2d90(%rip), %rdi      # 0x4022
leaq 0x2d9e(%rip), %r15      # 0x4037
movq %r15, %rsi
callq 0x10f0
movq %rax, %rbp
subq %r12, %r13
cvtsi2sd %r13, %xmm0
divsd 0x2d54(%rip), %xmm0     # 0x4008
leaq 0x2d7e(%rip), %rsi      # 0x4039
movq %rax, %rdi
movb $0x1, %al
callq 0x10d0
movq %rbp, %rdi
callq 0x1070
movq %r14, %rdi
callq 0x2629
leaq 0x2d75(%rip), %rdi      # 0x4051
movq %r15, %rsi
callq 0x10f0
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x2d78(%rip), %r15      # 0x4068
addl $0x2, %ebp
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
movl %ebp, %esi
callq 0x28e7
movq %rax, %r13
callq 0x1060
subq %r12, %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0x2ce8(%rip), %xmm0     # 0x4008
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
movb $0x1, %al
callq 0x10d0
movq %r13, %rdi
callq 0x2629
cmpl $0x1c, %ebp
jb 0x12f0
movq %r14, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r15
movq %rbx, %rdi
callq 0x3157
movq %rax, %r12
callq 0x1060
movq %rax, %r13
leaq 0x2d0a(%rip), %rdi      # 0x4070
leaq 0x2cca(%rip), %r14      # 0x4037
movq %r14, %rsi
callq 0x10f0
movq %rax, %rbp
subq %r15, %r13
xorps %xmm0, %xmm0
cvtsi2sd %r13, %xmm0
movsd 0x2c7d(%rip), %xmm1     # 0x4008
divsd %xmm1, %xmm0
leaq 0x2ca3(%rip), %rsi      # 0x4039
movq %rax, %rdi
movb $0x1, %al
callq 0x10d0
movq %rbp, %rdi
callq 0x1070
movq %r12, %rdi
callq 0x2629
movq %rbx, %rdi
callq 0x1e1e
leaq 0x2cca(%rip), %rdi      # 0x4089
leaq 0x2c5a(%rip), %rsi      # 0x4020
callq 0x10f0
movq %rax, %r12
movq %rax, %rdi
callq 0x17c4
movq %rax, %rbx
movq %r12, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
callq 0x2009
movq %rax, %r13
callq 0x1060
movq %rax, %rbp
leaq 0x2c9e(%rip), %rdi      # 0x40a1
movq %r14, %rsi
callq 0x10f0
movq %rax, %r15
subq %r12, %rbp
xorps %xmm0, %xmm0
cvtsi2sd %rbp, %xmm0
divsd 0x2be7(%rip), %xmm0     # 0x4008
movq %rax, %rdi
leaq 0x2c0e(%rip), %rsi      # 0x4039
movb $0x1, %al
callq 0x10d0
movq %r15, %rdi
callq 0x1070
movq %r13, %rdi
callq 0x2629
leaq 0x2c75(%rip), %rdi      # 0x40be
movq %r14, %rsi
callq 0x10f0
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x2c0b(%rip), %r15      # 0x4068
addl $0x5, %ebp
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
movl %ebp, %esi
callq 0x28e7
movq %rax, %r13
callq 0x1060
subq %r12, %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0x2b7b(%rip), %xmm0     # 0x4008
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
movb $0x1, %al
callq 0x10d0
movq %r13, %rdi
callq 0x2629
cmpl $0x60, %ebp
jb 0x145d
movq %r14, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r15
movq %rbx, %rdi
callq 0x3157
movq %rax, %r12
callq 0x1060
movq %rax, %r13
leaq 0x2c0a(%rip), %rdi      # 0x40dd
leaq 0x2b5d(%rip), %r14      # 0x4037
movq %r14, %rsi
callq 0x10f0
movq %rax, %rbp
subq %r15, %r13
xorps %xmm0, %xmm0
cvtsi2sd %r13, %xmm0
movsd 0x2b10(%rip), %xmm1     # 0x4008
divsd %xmm1, %xmm0
leaq 0x2b36(%rip), %rsi      # 0x4039
movq %rax, %rdi
movb $0x1, %al
callq 0x10d0
movq %rbp, %rdi
callq 0x1070
movq %r12, %rdi
callq 0x2629
movq %rbx, %rdi
callq 0x1e1e
leaq 0x2bd2(%rip), %rdi      # 0x40fe
leaq 0x2aed(%rip), %rsi      # 0x4020
callq 0x10f0
movq %rax, %r12
movq %rax, %rdi
callq 0x17c4
movq %rax, %rbx
movq %r12, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
callq 0x2009
movq %rax, %r13
callq 0x1060
movq %rax, %rbp
leaq 0x2b9c(%rip), %rdi      # 0x410c
movq %r14, %rsi
callq 0x10f0
movq %rax, %r15
subq %r12, %rbp
xorps %xmm0, %xmm0
cvtsi2sd %rbp, %xmm0
divsd 0x2a7a(%rip), %xmm0     # 0x4008
movq %rax, %rdi
leaq 0x2aa1(%rip), %rsi      # 0x4039
movb $0x1, %al
callq 0x10d0
movq %r15, %rdi
callq 0x1070
movq %r13, %rdi
callq 0x2629
leaq 0x2b69(%rip), %rdi      # 0x411f
movq %r14, %rsi
callq 0x10f0
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x2a9e(%rip), %r15      # 0x4068
addl $0xa, %ebp
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
movl %ebp, %esi
callq 0x28e7
movq %rax, %r13
callq 0x1060
subq %r12, %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0x2a0e(%rip), %xmm0     # 0x4008
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
movb $0x1, %al
callq 0x10d0
movq %r13, %rdi
callq 0x2629
cmpl $0x3df, %ebp            # imm = 0x3DF
jb 0x15ca
movq %r14, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r15
movq %rbx, %rdi
callq 0x3157
movq %rax, %r14
callq 0x1060
movq %rax, %r12
leaq 0x2af1(%rip), %rdi      # 0x4134
leaq 0x29ed(%rip), %rsi      # 0x4037
callq 0x10f0
movq %rax, %r13
subq %r15, %r12
xorps %xmm0, %xmm0
cvtsi2sd %r12, %xmm0
divsd 0x29a3(%rip), %xmm0     # 0x4008
leaq 0x29cd(%rip), %rsi      # 0x4039
movq %rax, %rdi
movb $0x1, %al
callq 0x10d0
movq %r13, %rdi
callq 0x1070
movq %r14, %rdi
callq 0x2629
movq %rbx, %rdi
callq 0x1e1e
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop