// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x1070, %rsp           # imm = 0x1070
movl $0x0, -0x1034(%rbp)
callq 0x78b10
movl %eax, -0x103c(%rbp)
cmpl $0x0, -0x103c(%rbp)
jne 0x78ed5
movl $0x0, -0x4(%rbp)
jmp 0x79257
leaq 0xc8255(%rip), %rdi     # 0x141131
leaq 0xc18e6(%rip), %rsi     # 0x13a7c9
callq 0x26ae0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x78eff
movl $0x0, -0x4(%rbp)
jmp 0x79257
jmp 0x78f01
leaq -0x410(%rbp), %rdi
movq -0x10(%rbp), %rdx
movl $0x400, %esi            # imm = 0x400
callq 0x26440
cmpq $0x0, %rax
je 0x79159
leaq -0x410(%rbp), %rax
movq %rax, -0x1058(%rbp)
movq -0x1058(%rbp), %rax
movq %rax, -0x1048(%rbp)
movq -0x1058(%rbp), %rdi
movl $0x2d, %esi
callq 0x267f0
movq %rax, -0x1058(%rbp)
cmpq $0x0, -0x1058(%rbp)
jne 0x78f60
jmp 0x78f01
movq -0x1058(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x1058(%rbp)
movb $0x0, (%rax)
movq -0x1058(%rbp), %rax
movq %rax, -0x1050(%rbp)
movq -0x1058(%rbp), %rdi
movl $0x20, %esi
callq 0x267f0
movq %rax, -0x1058(%rbp)
cmpq $0x0, -0x1058(%rbp)
jne 0x78fad
jmp 0x78f01
movq -0x1058(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x1058(%rbp)
movb $0x0, (%rax)
movq -0x1058(%rbp), %rdi
leaq 0xc816e(%rip), %rsi     # 0x141141
callq 0x266c0
cmpq $0x0, %rax
jne 0x79010
movq -0x1058(%rbp), %rdi
leaq 0xc815b(%rip), %rsi     # 0x141147
callq 0x266c0
cmpq $0x0, %rax
jne 0x79010
movq -0x1058(%rbp), %rdi
leaq 0xc8147(%rip), %rsi     # 0x14114c
callq 0x266c0
cmpq $0x0, %rax
je 0x79015
jmp 0x78f01
movq -0x1058(%rbp), %rdi
leaq 0xc8132(%rip), %rsi     # 0x141155
callq 0x266c0
cmpq $0x0, %rax
jne 0x79033
jmp 0x78f01
movq -0x1058(%rbp), %rdi
leaq 0xc811a(%rip), %rsi     # 0x14115b
callq 0x266c0
cmpq $0x0, %rax
jne 0x79051
jmp 0x78f01
movq -0x1048(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x10, %edx
callq 0x26c30
movq %rax, -0x818(%rbp)
movq -0x1050(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x10, %edx
callq 0x26c30
movq %rax, -0x820(%rbp)
movq -0x820(%rbp), %rax
subq -0x818(%rbp), %rax
movq %rax, -0x828(%rbp)
movq -0x818(%rbp), %rcx
movslq -0x1034(%rbp), %rax
movq %rcx, -0xc30(%rbp,%rax,8)
movq -0x828(%rbp), %rcx
movslq -0x1034(%rbp), %rax
movq %rcx, -0x1030(%rbp,%rax,8)
leaq -0x810(%rbp), %rdi
movslq -0x1034(%rbp), %rax
movq -0xc30(%rbp,%rax,8), %rcx
movslq -0x1034(%rbp), %rax
movq -0x1030(%rbp,%rax,8), %r8
movl $0x400, %esi            # imm = 0x400
leaq 0xc8063(%rip), %rdx     # 0x14115e
movb $0x0, %al
callq 0x26120
movl -0x103c(%rbp), %eax
movl %eax, -0x106c(%rbp)
leaq -0x810(%rbp), %rax
movq %rax, -0x1068(%rbp)
leaq -0x810(%rbp), %rdi
callq 0x264f0
movl -0x106c(%rbp), %edi
movq -0x1068(%rbp), %rsi
movq %rax, %rdx
callq 0x26bc0
cmpq $-0x1, %rax
jne 0x79145
jmp 0x79145
movl -0x1034(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1034(%rbp)
jmp 0x78f01
movl $0x0, -0x105c(%rbp)
movl $0x0, -0x1038(%rbp)
movl -0x1038(%rbp), %eax
cmpl -0x1034(%rbp), %eax
jge 0x7921b
movl -0x103c(%rbp), %edi
leaq 0xcb97f(%rip), %rsi     # 0x144b0b
movl $0x1, %edx
callq 0x26bc0
cmpq $-0x1, %rax
jne 0x7919e
jmp 0x7919e
movslq -0x1038(%rbp), %rax
movq -0xc30(%rbp,%rax,8), %rdi
movslq -0x1038(%rbp), %rax
movq -0x1030(%rbp,%rax,8), %rsi
movl $0x1, %edx
callq 0x8fc40
addl -0x105c(%rbp), %eax
movl %eax, -0x105c(%rbp)
movl -0x103c(%rbp), %edi
movl -0x105c(%rbp), %ecx
leaq 0xcd760(%rip), %rsi     # 0x146945
leaq 0xca0de(%rip), %rax     # 0x1432ca
cmpl $0x0, %ecx
cmovneq %rax, %rsi
movl $0x1, %edx
callq 0x26bc0
cmpq $-0x1, %rax
jne 0x79205
jmp 0x79205
jmp 0x79207
movl -0x1038(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1038(%rbp)
jmp 0x7916d
movl -0x103c(%rbp), %edi
leaq 0xc0c11(%rip), %rsi     # 0x139e39
movl $0x1, %edx
callq 0x26bc0
cmpq $-0x1, %rax
jne 0x7923a
jmp 0x7923a
movq -0x10(%rbp), %rdi
callq 0x26a10
movl -0x103c(%rbp), %edi
callq 0x78b80
movl -0x105c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1070, %rsp           # imm = 0x1070
popq %rbp
retq
nopw %cs:(%rax,%rax)