// File: /workspace/github_c_makefile_star2_O2/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 0x1dd2(%rip), %rdi      # 0x3010
leaq 0x1ddb(%rip), %rsi      # 0x3020
callq 0x10f0
movq %rax, %r14
movq %rax, %rdi
callq 0x1778
movq %rax, %rbx
movq %r14, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
callq 0x1de0
movq %rax, %r14
callq 0x1060
movq %rax, %r13
leaq 0x1da0(%rip), %rdi      # 0x3022
leaq 0x1dae(%rip), %r15      # 0x3037
movq %r15, %rsi
callq 0x10f0
movq %rax, %rbp
subq %r12, %r13
cvtsi2sd %r13, %xmm0
divsd 0x1d64(%rip), %xmm0     # 0x3008
leaq 0x1d8e(%rip), %rsi      # 0x3039
movq %rax, %rdi
movb $0x1, %al
callq 0x10d0
movq %rbp, %rdi
callq 0x1070
movq %r14, %rdi
callq 0x2315
leaq 0x1d85(%rip), %rdi      # 0x3051
movq %r15, %rsi
callq 0x10f0
movq %rax, %r14
pushq $0x2
popq %rbp
leaq 0x1d87(%rip), %r15      # 0x3068
cmpl $0x1e, %ebp
jae 0x132c
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
movl %ebp, %esi
callq 0x25c5
movq %rax, %r13
callq 0x1060
subq %r12, %rax
cvtsi2sd %rax, %xmm0
divsd 0x1cf8(%rip), %xmm0     # 0x3008
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
movb $0x1, %al
callq 0x10d0
movq %r13, %rdi
callq 0x2315
addl $0x2, %ebp
jmp 0x12e1
movq %r14, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r15
movq %rbx, %rdi
callq 0x2c48
movq %rax, %r12
callq 0x1060
movq %rax, %r13
leaq 0x1d1a(%rip), %rdi      # 0x3070
leaq 0x1cda(%rip), %r14      # 0x3037
movq %r14, %rsi
callq 0x10f0
movq %rax, %rbp
subq %r15, %r13
cvtsi2sd %r13, %xmm0
movsd 0x1c90(%rip), %xmm1     # 0x3008
divsd %xmm1, %xmm0
leaq 0x1cb6(%rip), %rsi      # 0x3039
movq %rax, %rdi
movb $0x1, %al
callq 0x10d0
movq %rbp, %rdi
callq 0x1070
movq %r12, %rdi
callq 0x2315
movq %rbx, %rdi
callq 0x1c60
leaq 0x1cdd(%rip), %rdi      # 0x3089
leaq 0x1c6d(%rip), %rsi      # 0x3020
callq 0x10f0
movq %rax, %r12
movq %rax, %rdi
callq 0x1778
movq %rax, %rbx
movq %r12, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
callq 0x1de0
movq %rax, %r13
callq 0x1060
movq %rax, %rbp
leaq 0x1cb1(%rip), %rdi      # 0x30a1
movq %r14, %rsi
callq 0x10f0
movq %rax, %r15
subq %r12, %rbp
cvtsi2sd %rbp, %xmm0
divsd 0x1bfd(%rip), %xmm0     # 0x3008
movq %rax, %rdi
leaq 0x1c24(%rip), %rsi      # 0x3039
movb $0x1, %al
callq 0x10d0
movq %r15, %rdi
callq 0x1070
movq %r13, %rdi
callq 0x2315
leaq 0x1c8b(%rip), %rdi      # 0x30be
movq %r14, %rsi
callq 0x10f0
movq %rax, %r14
pushq $0x5
popq %rbp
leaq 0x1c20(%rip), %r15      # 0x3068
cmpl $0x65, %ebp
jae 0x1493
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
movl %ebp, %esi
callq 0x25c5
movq %rax, %r13
callq 0x1060
subq %r12, %rax
cvtsi2sd %rax, %xmm0
divsd 0x1b91(%rip), %xmm0     # 0x3008
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
movb $0x1, %al
callq 0x10d0
movq %r13, %rdi
callq 0x2315
addl $0x5, %ebp
jmp 0x1448
movq %r14, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r15
movq %rbx, %rdi
callq 0x2c48
movq %rax, %r12
callq 0x1060
movq %rax, %r13
leaq 0x1c20(%rip), %rdi      # 0x30dd
leaq 0x1b73(%rip), %r14      # 0x3037
movq %r14, %rsi
callq 0x10f0
movq %rax, %rbp
subq %r15, %r13
cvtsi2sd %r13, %xmm0
movsd 0x1b29(%rip), %xmm1     # 0x3008
divsd %xmm1, %xmm0
leaq 0x1b4f(%rip), %rsi      # 0x3039
movq %rax, %rdi
movb $0x1, %al
callq 0x10d0
movq %rbp, %rdi
callq 0x1070
movq %r12, %rdi
callq 0x2315
movq %rbx, %rdi
callq 0x1c60
leaq 0x1beb(%rip), %rdi      # 0x30fe
leaq 0x1b06(%rip), %rsi      # 0x3020
callq 0x10f0
movq %rax, %r12
movq %rax, %rdi
callq 0x1778
movq %rax, %rbx
movq %r12, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
callq 0x1de0
movq %rax, %r13
callq 0x1060
movq %rax, %rbp
leaq 0x1bb5(%rip), %rdi      # 0x310c
movq %r14, %rsi
callq 0x10f0
movq %rax, %r15
subq %r12, %rbp
cvtsi2sd %rbp, %xmm0
divsd 0x1a96(%rip), %xmm0     # 0x3008
movq %rax, %rdi
leaq 0x1abd(%rip), %rsi      # 0x3039
movb $0x1, %al
callq 0x10d0
movq %r15, %rdi
callq 0x1070
movq %r13, %rdi
callq 0x2315
leaq 0x1b85(%rip), %rdi      # 0x311f
movq %r14, %rsi
callq 0x10f0
movq %rax, %r14
pushq $0xa
popq %rbp
leaq 0x1ab9(%rip), %r15      # 0x3068
cmpl $0x3e9, %ebp            # imm = 0x3E9
jae 0x15fd
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
movl %ebp, %esi
callq 0x25c5
movq %rax, %r13
callq 0x1060
subq %r12, %rax
cvtsi2sd %rax, %xmm0
divsd 0x1a27(%rip), %xmm0     # 0x3008
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
movb $0x1, %al
callq 0x10d0
movq %r13, %rdi
callq 0x2315
addl $0xa, %ebp
jmp 0x15af
movq %r14, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r15
movq %rbx, %rdi
callq 0x2c48
movq %rax, %r14
callq 0x1060
movq %rax, %r12
leaq 0x1b0d(%rip), %rdi      # 0x3134
leaq 0x1a09(%rip), %rsi      # 0x3037
callq 0x10f0
movq %rax, %r13
subq %r15, %r12
cvtsi2sd %r12, %xmm0
divsd 0x19c2(%rip), %xmm0     # 0x3008
leaq 0x19ec(%rip), %rsi      # 0x3039
movq %rax, %rdi
movb $0x1, %al
callq 0x10d0
movq %r13, %rdi
callq 0x1070
movq %r14, %rdi
callq 0x2315
movq %rbx, %rdi
callq 0x1c60
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq