// File: /workspace/github_c_makefile_star2_O1/giannisdravilas[P]Disease-Monitor/tests/../modules/DiseaseMonitor.c
// Function: dm_get_records
List dm_get_records(String disease, String country, Date date_from, Date date_to){
    
    List list = list_create(NULL);
    
    // Διακρίνουμε τις διάφορες περιπτώσεις ανάλογα με το αν είναι NULL κάποιο από τα
    // disease, country, και τα δύο ή κανένα από τα δύο. Κάθε φορά βρίσκουμε το set στο
    // οποίο ανήκει η εγγραφή, καθώς και τους κόμβους του Set που αντιστοιχούν στην
    // date_from και την επόμενη της date_to. Αν η εγγραφή πληροί όλες τις απαραίτητες
    // προϋποθέσεις τότε εισάγεται στη λίστα.
    if(disease){
        Set set = map_find(map_diseases_dates, disease);
        SetNode date_from_node = get_date_from_node(set, date_from);
        SetNode date_to_node = get_date_to_node(set, date_to);
        if(country){
            for(SetNode node = date_from_node; node != date_to_node; node = set_next(set, node)){
                Record record = set_node_value(set, node);
                if(strcmp(record->country, country) == 0){
                    list_insert_next(list, list_last(list), record);
                }
            }
        }else{
            for(SetNode node = date_from_node; node != date_to_node; node = set_next(set, node)){
                Record record = set_node_value(set, node);
                list_insert_next(list, list_last(list), record);
            }
        }
    }else{
        if(country){
            Set set = map_find(map_countries_dates, country);
            SetNode date_from_node = get_date_from_node(set, date_from);
            SetNode date_to_node = get_date_to_node(set, date_to);
            for(SetNode node = date_from_node; node != date_to_node; node = set_next(set, node)){
                Record record = set_node_value(set, node);
                list_insert_next(list, list_last(list), record);
            }
        }else{
            for(MapNode node = map_first(map_diseases_dates); node != MAP_EOF; node = map_next(map_diseases_dates, node)){
                Set set = map_node_value(map_diseases_dates, node);
                if(set_size(set)){
                    SetNode date_from_node = get_date_from_node(set, date_from);
                    SetNode date_to_node = get_date_to_node(set, date_to);
                    for(SetNode node_set = date_from_node; node_set != date_to_node; node_set = set_next(set, node_set)){
                        Record record = set_node_value(set, node_set);
                        list_insert_next(list, list_last(list), record);
                    }
                }
            }
        }
    }

    return list;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbp
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %r14
xorl %edi, %edi
callq 0x6062
movq %rax, %rbx
testq %r14, %r14
je 0x54d6
movq 0x92e7(%rip), %rdi      # 0xe738
movq %r14, %rsi
callq 0x6abd
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
callq 0x52e4
movq %rax, %r15
movq %r12, %rdi
movq %rbp, %rsi
callq 0x5350
movq %rax, %r14
testq %r13, %r13
je 0x5552
cmpq %r14, %r15
je 0x564e
movq %r12, %rdi
movq %r15, %rsi
callq 0x83e0
movq %rax, %rbp
movq 0x18(%rax), %rdi
movq %r13, %rsi
callq 0x2190
testl %eax, %eax
jne 0x54be
movq %rbx, %rdi
callq 0x6341
movq %rbx, %rdi
movq %rax, %rsi
movq %rbp, %rdx
callq 0x60e3
movq %r12, %rdi
movq %r15, %rsi
callq 0x83ac
movq %rax, %r15
cmpq %r14, %rax
jne 0x548a
jmp 0x564e
testq %r13, %r13
je 0x5597
movq 0x925a(%rip), %rdi      # 0xe740
movq %r13, %rsi
callq 0x6abd
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
callq 0x52e4
movq %rax, %r15
movq %r12, %rdi
movq %rbp, %rsi
callq 0x5350
cmpq %rax, %r15
je 0x564e
movq %rax, %r14
movq %r12, %rdi
movq %r15, %rsi
callq 0x83e0
movq %rax, %r13
movq %rbx, %rdi
callq 0x6341
movq %rbx, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x60e3
movq %r12, %rdi
movq %r15, %rsi
callq 0x83ac
movq %rax, %r15
cmpq %r14, %rax
jne 0x5516
jmp 0x564e
cmpq %r14, %r15
je 0x564e
movq %r12, %rdi
movq %r15, %rsi
callq 0x83e0
movq %rax, %r13
movq %rbx, %rdi
callq 0x6341
movq %rbx, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x60e3
movq %r12, %rdi
movq %r15, %rsi
callq 0x83ac
movq %rax, %r15
cmpq %r14, %rax
jne 0x555b
jmp 0x564e
movq %r15, 0x8(%rsp)
movq %rbp, 0x10(%rsp)
movq 0x9190(%rip), %rdi      # 0xe738
callq 0x6c9f
testq %rax, %rax
je 0x564e
movq %rax, %r12
movq 0x9178(%rip), %rdi      # 0xe738
movq %r12, %rsi
callq 0x6f0b
movq %rax, %r13
movq %rax, %rdi
callq 0x8123
testl %eax, %eax
je 0x5633
movq %r13, %rdi
movq 0x8(%rsp), %rsi
callq 0x52e4
movq %rax, %rbp
movq %r13, %rdi
movq 0x10(%rsp), %rsi
callq 0x5350
cmpq %rax, %rbp
je 0x5633
movq %rax, %r14
movq %r13, %rdi
movq %rbp, %rsi
callq 0x83e0
movq %rax, %r15
movq %rbx, %rdi
callq 0x6341
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x60e3
movq %r13, %rdi
movq %rbp, %rsi
callq 0x83ac
movq %rax, %rbp
cmpq %r14, %rax
jne 0x55fc
movq 0x90fe(%rip), %rdi      # 0xe738
movq %r12, %rsi
callq 0x6d5b
movq %rax, %r12
testq %rax, %rax
jne 0x55b9
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq