// File: /workspace/github_c_makefile_star2_O3/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 0x2dd2(%rip), %rdi      # 0x4010
leaq 0x2ddb(%rip), %rsi      # 0x4020
callq 0x10f0
movq %rax, %r14
movq %rax, %rdi
callq 0x17b4
movq %rax, %rbx
movq %r14, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
callq 0x1f50
movq %rax, %r14
callq 0x1060
movq %rax, %r13
leaq 0x2da0(%rip), %rdi      # 0x4022
leaq 0x2dae(%rip), %r15      # 0x4037
movq %r15, %rsi
callq 0x10f0
movq %rax, %rbp
subq %r12, %r13
cvtsi2sd %r13, %xmm0
divsd 0x2d64(%rip), %xmm0     # 0x4008
leaq 0x2d8e(%rip), %rsi      # 0x4039
movq %rax, %rdi
movb $0x1, %al
callq 0x10d0
movq %rbp, %rdi
callq 0x1070
movq %r14, %rdi
callq 0x255a
leaq 0x2d85(%rip), %rdi      # 0x4051
movq %r15, %rsi
callq 0x10f0
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x2d88(%rip), %r15      # 0x4068
addl $0x2, %ebp
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
movl %ebp, %esi
callq 0x281b
movq %rax, %r13
callq 0x1060
subq %r12, %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0x2cf8(%rip), %xmm0     # 0x4008
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
movb $0x1, %al
callq 0x10d0
movq %r13, %rdi
callq 0x255a
cmpl $0x1c, %ebp
jb 0x12e0
movq %r14, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r15
movq %rbx, %rdi
callq 0x2f97
movq %rax, %r12
callq 0x1060
movq %rax, %r13
leaq 0x2d1a(%rip), %rdi      # 0x4070
leaq 0x2cda(%rip), %r14      # 0x4037
movq %r14, %rsi
callq 0x10f0
movq %rax, %rbp
subq %r15, %r13
xorps %xmm0, %xmm0
cvtsi2sd %r13, %xmm0
movsd 0x2c8d(%rip), %xmm1     # 0x4008
divsd %xmm1, %xmm0
leaq 0x2cb3(%rip), %rsi      # 0x4039
movq %rax, %rdi
movb $0x1, %al
callq 0x10d0
movq %rbp, %rdi
callq 0x1070
movq %r12, %rdi
callq 0x255a
movq %rbx, %rdi
callq 0x1d5f
leaq 0x2cda(%rip), %rdi      # 0x4089
leaq 0x2c6a(%rip), %rsi      # 0x4020
callq 0x10f0
movq %rax, %r12
movq %rax, %rdi
callq 0x17b4
movq %rax, %rbx
movq %r12, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
callq 0x1f50
movq %rax, %r13
callq 0x1060
movq %rax, %rbp
leaq 0x2cae(%rip), %rdi      # 0x40a1
movq %r14, %rsi
callq 0x10f0
movq %rax, %r15
subq %r12, %rbp
xorps %xmm0, %xmm0
cvtsi2sd %rbp, %xmm0
divsd 0x2bf7(%rip), %xmm0     # 0x4008
movq %rax, %rdi
leaq 0x2c1e(%rip), %rsi      # 0x4039
movb $0x1, %al
callq 0x10d0
movq %r15, %rdi
callq 0x1070
movq %r13, %rdi
callq 0x255a
leaq 0x2c85(%rip), %rdi      # 0x40be
movq %r14, %rsi
callq 0x10f0
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x2c1b(%rip), %r15      # 0x4068
addl $0x5, %ebp
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
movl %ebp, %esi
callq 0x281b
movq %rax, %r13
callq 0x1060
subq %r12, %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0x2b8b(%rip), %xmm0     # 0x4008
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
movb $0x1, %al
callq 0x10d0
movq %r13, %rdi
callq 0x255a
cmpl $0x60, %ebp
jb 0x144d
movq %r14, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r15
movq %rbx, %rdi
callq 0x2f97
movq %rax, %r12
callq 0x1060
movq %rax, %r13
leaq 0x2c1a(%rip), %rdi      # 0x40dd
leaq 0x2b6d(%rip), %r14      # 0x4037
movq %r14, %rsi
callq 0x10f0
movq %rax, %rbp
subq %r15, %r13
xorps %xmm0, %xmm0
cvtsi2sd %r13, %xmm0
movsd 0x2b20(%rip), %xmm1     # 0x4008
divsd %xmm1, %xmm0
leaq 0x2b46(%rip), %rsi      # 0x4039
movq %rax, %rdi
movb $0x1, %al
callq 0x10d0
movq %rbp, %rdi
callq 0x1070
movq %r12, %rdi
callq 0x255a
movq %rbx, %rdi
callq 0x1d5f
leaq 0x2be2(%rip), %rdi      # 0x40fe
leaq 0x2afd(%rip), %rsi      # 0x4020
callq 0x10f0
movq %rax, %r12
movq %rax, %rdi
callq 0x17b4
movq %rax, %rbx
movq %r12, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
callq 0x1f50
movq %rax, %r13
callq 0x1060
movq %rax, %rbp
leaq 0x2bac(%rip), %rdi      # 0x410c
movq %r14, %rsi
callq 0x10f0
movq %rax, %r15
subq %r12, %rbp
xorps %xmm0, %xmm0
cvtsi2sd %rbp, %xmm0
divsd 0x2a8a(%rip), %xmm0     # 0x4008
movq %rax, %rdi
leaq 0x2ab1(%rip), %rsi      # 0x4039
movb $0x1, %al
callq 0x10d0
movq %r15, %rdi
callq 0x1070
movq %r13, %rdi
callq 0x255a
leaq 0x2b79(%rip), %rdi      # 0x411f
movq %r14, %rsi
callq 0x10f0
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x2aae(%rip), %r15      # 0x4068
addl $0xa, %ebp
callq 0x1060
movq %rax, %r12
movq %rbx, %rdi
movl %ebp, %esi
callq 0x281b
movq %rax, %r13
callq 0x1060
subq %r12, %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0x2a1e(%rip), %xmm0     # 0x4008
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
movb $0x1, %al
callq 0x10d0
movq %r13, %rdi
callq 0x255a
cmpl $0x3df, %ebp            # imm = 0x3DF
jb 0x15ba
movq %r14, %rdi
callq 0x1070
callq 0x1060
movq %rax, %r15
movq %rbx, %rdi
callq 0x2f97
movq %rax, %r14
callq 0x1060
movq %rax, %r12
leaq 0x2b01(%rip), %rdi      # 0x4134
leaq 0x29fd(%rip), %rsi      # 0x4037
callq 0x10f0
movq %rax, %r13
subq %r15, %r12
xorps %xmm0, %xmm0
cvtsi2sd %r12, %xmm0
divsd 0x29b3(%rip), %xmm0     # 0x4008
leaq 0x29dd(%rip), %rsi      # 0x4039
movq %rax, %rdi
movb $0x1, %al
callq 0x10d0
movq %r13, %rdi
callq 0x1070
movq %r14, %rdi
callq 0x255a
movq %rbx, %rdi
callq 0x1d5f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop