// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/debug.c
// Function: memtest_test_linux_anonymous_maps
int memtest_test_linux_anonymous_maps(void) {
    FILE *fp;
    char line[1024];
    char logbuf[1024];
    size_t start_addr, end_addr, size;
    size_t start_vect[MEMTEST_MAX_REGIONS];
    size_t size_vect[MEMTEST_MAX_REGIONS];
    int regions = 0, j;

    int fd = openDirectLogFiledes();
    if (!fd) return 0;

    fp = fopen("/proc/self/maps","r");
    if (!fp) return 0;
    while(fgets(line,sizeof(line),fp) != NULL) {
        char *start, *end, *p = line;

        start = p;
        p = strchr(p,'-');
        if (!p) continue;
        *p++ = '\0';
        end = p;
        p = strchr(p,' ');
        if (!p) continue;
        *p++ = '\0';
        if (strstr(p,"stack") ||
            strstr(p,"vdso") ||
            strstr(p,"vsyscall")) continue;
        if (!strstr(p,"00:00")) continue;
        if (!strstr(p,"rw")) continue;

        start_addr = strtoul(start,NULL,16);
        end_addr = strtoul(end,NULL,16);
        size = end_addr-start_addr;

        start_vect[regions] = start_addr;
        size_vect[regions] = size;
        snprintf(logbuf,sizeof(logbuf),
            "*** Preparing to test memory region %lx (%lu bytes)\n",
                (unsigned long) start_vect[regions],
                (unsigned long) size_vect[regions]);
        if (write(fd,logbuf,strlen(logbuf)) == -1) { /* Nothing to do. */ }
        regions++;
    }

    int errors = 0;
    for (j = 0; j < regions; j++) {
        if (write(fd,".",1) == -1) { /* Nothing to do. */ }
        errors += memtest_preserving_test((void*)start_vect[j],size_vect[j],1);
        if (write(fd, errors ? "E" : "O",1) == -1) { /* Nothing to do. */ }
    }
    if (write(fd,"\n",1) == -1) { /* Nothing to do. */ }

    /* NOTE: It is very important to close the file descriptor only now
     * because closing it before may result into unmapping of some memory
     * region that we are testing. */
    fclose(fp);
    closeDirectLogFiledes(fd);
    return errors;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1018, %rsp           # imm = 0x1018
leaq 0x9e8e2(%rip), %rax     # 0x1018a8
movq 0x7a0(%rax), %rdi
cmpb $0x0, (%rdi)
je 0x62ff1
xorl %r15d, %r15d
movl $0x441, %esi            # imm = 0x441
movl $0x1a4, %edx            # imm = 0x1A4
xorl %eax, %eax
callq 0x26690
movl %eax, %ebx
testl %eax, %eax
jne 0x62ff6
jmp 0x6322a
movl $0x1, %ebx
leaq 0x63e0c(%rip), %rdi     # 0xc6e09
leaq 0x5ca59(%rip), %rsi     # 0xbfa5d
callq 0x26ae0
testq %rax, %rax
je 0x63227
movq %rax, %r14
leaq 0xc10(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %rax, %rdx
callq 0x26440
testq %rax, %rax
je 0x631ed
leaq 0xc10(%rsp), %r15
leaq 0x63dd7(%rip), %r12     # 0xc6e19
movq $0x0, 0x8(%rsp)
movq %r15, %rdi
movl $0x2d, %esi
callq 0x267f0
testq %rax, %rax
je 0x630b9
movq %rax, %rbp
incq %rbp
movb $0x0, (%rax)
movq %rbp, %rdi
movl $0x20, %esi
callq 0x267f0
testq %rax, %rax
je 0x630b9
movq %rax, %r13
incq %r13
movb $0x0, (%rax)
movq %r13, %rdi
movq %r12, %rsi
callq 0x266b0
testq %rax, %rax
jne 0x630b9
movq %r13, %rdi
leaq 0x63d84(%rip), %rsi     # 0xc6e1f
callq 0x266b0
testq %rax, %rax
jne 0x630b9
movq %r13, %rdi
leaq 0x63d75(%rip), %rsi     # 0xc6e24
callq 0x266b0
testq %rax, %rax
je 0x630d7
movq %r15, %rdi
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdx
callq 0x26440
testq %rax, %rax
jne 0x6304b
jmp 0x63182
movq %r13, %rdi
leaq 0x63d4c(%rip), %rsi     # 0xc6e2d
callq 0x266b0
testq %rax, %rax
je 0x630b9
movq %r13, %rdi
leaq 0x63d3e(%rip), %rsi     # 0xc6e33
callq 0x266b0
testq %rax, %rax
je 0x630b9
movq %r15, %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x26c20
movq %rax, %r13
movq %rbp, %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x26c20
subq %r13, %rax
movq 0x8(%rsp), %rbp
movslq %ebp, %rbp
movq %r13, 0x410(%rsp,%rbp,8)
movq %rax, 0x10(%rsp,%rbp,8)
movl $0x400, %esi            # imm = 0x400
leaq 0x810(%rsp), %rdi
leaq 0x63cea(%rip), %rdx     # 0xc6e36
movq %r13, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x26120
leaq 0x810(%rsp), %r13
movq %r13, %rdi
callq 0x26500
movl %ebx, %edi
movq %r13, %rsi
movq %rax, %rdx
callq 0x26bb0
incl %ebp
movq %rbp, 0x8(%rsp)
jmp 0x630b9
movq 0x8(%rsp), %rax
testl %eax, %eax
jle 0x631ed
movl %eax, %r12d
xorl %r13d, %r13d
xorl %r15d, %r15d
movl %r15d, %ebp
movl $0x1, %edx
movl %ebx, %edi
leaq 0x67a46(%rip), %rsi     # 0xcabeb
callq 0x26bb0
movq 0x410(%rsp,%r13,8), %rdi
movq 0x10(%rsp,%r13,8), %rsi
movl $0x1, %edx
callq 0x735d5
movl %eax, %r15d
leaq 0x69a6e(%rip), %rsi     # 0xccc39
addl %ebp, %r15d
je 0x631d7
leaq 0x66072(%rip), %rsi     # 0xc9249
movl $0x1, %edx
movl %ebx, %edi
callq 0x26bb0
incq %r13
cmpq %r13, %r12
jne 0x63194
jmp 0x631f0
xorl %r15d, %r15d
leaq 0x5bcd2(%rip), %rsi     # 0xbeec9
movl $0x1, %edx
movl %ebx, %edi
callq 0x26bb0
movq %r14, %rdi
callq 0x26a10
leaq 0x9e696(%rip), %rax     # 0x1018a8
movq 0x7a0(%rax), %rax
cmpb $0x0, (%rax)
je 0x6322a
movl %ebx, %edi
callq 0x26180
jmp 0x6322a
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq