// File: /workspace/github_cpp_makefile_star2_O2/greenpau[P]mnpa/main.cpp
// Function: stop()
void stop() {
    std::string pid_title = "Name:\\tmnpa";
    int pid = -1;
    std::string stop_pid = std::to_string(getpid());
    DIR *dp = opendir("/proc");
    if (dp == NULL) {
        logit(ERROR,"failed to open /proc directory");
        exit(1);
    }
    struct dirent *dir;
    std::vector<pid_t> pids;
    std::regex stop_pid_rgx ("Name:\\tmnpa");
    while (pid < 0 && (dir = readdir(dp))) {
        int cid = atoi(dir->d_name);
        if (cid > 0) {
            std::string cur_pid = std::to_string(cid);
            std::string cur_pid_file = "/proc/" + cur_pid + "/status";
            std::ifstream cid_fs;
            cid_fs.open(cur_pid_file, std::ifstream::in);
            if (cid_fs.is_open()) {
                std::string cur_pid_status;
                getline(cid_fs, cur_pid_status);
                cid_fs.close();
                if (std::regex_match(cur_pid_status, stop_pid_rgx)) {
                    if (stop_pid != cur_pid) {
                        pids.push_back(cid);
                    }
                }
            }
        }
    }
    if (pids.size() > 0) {
        logit(INFO,"mnpa is running, stopping processes ...");
        for (auto &i : pids) {
            kill(i, SIGQUIT);
        }
        sleep(5);
        for (auto &i : pids) {
            if (kill(i, 0) == 0) {
                logit(INFO,"mnpa with PID #" + std::to_string(i) + " is still running!");
            } else {
                logit(INFO,"mnpa with PID #" + std::to_string(i) + " was stopped successfully");
            }
        }
    } else {
        logit(INFO,"mnpa is not running ...");
    }
    closedir(dp);
    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x398, %rsp            # imm = 0x398
leaq 0xc1a59(%rip), %rsi     # 0xda15a
leaq 0x110(%rsp), %rdi
leaq 0x190(%rsp), %rdx
callq 0x1dcb8
callq 0x152c0
leaq 0xf0(%rsp), %rdi
movl %eax, %esi
callq 0x1dcfc
leaq 0xc1a35(%rip), %rdi     # 0xda166
callq 0x15390
movq %rax, 0x28(%rsp)
testq %rax, %rax
je 0x18a55
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
leaq 0xc1a01(%rip), %rsi     # 0xda15a
leaq 0xb0(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x1dd56
leaq 0x50(%rsp), %r15
leaq 0x190(%rsp), %r13
leaq 0x170(%rsp), %r14
pushq $0x8
popq %r12
leaq 0x30(%rsp), %rbp
movq 0x28(%rsp), %rdi
callq 0x153f0
testq %rax, %rax
je 0x18891
addq $0x13, %rax
movq %rax, %rdi
callq 0x15520
movl %eax, 0xc(%rsp)
testl %eax, %eax
jle 0x18787
movq %r15, %rdi
movl %eax, %esi
callq 0x1dcfc
movq %r13, %rdi
leaq 0xc19c9(%rip), %rsi     # 0xda18b
movq %r15, %rdx
callq 0x1dddb
movq %r14, %rdi
movq %r13, %rsi
leaq 0xc19bb(%rip), %rdx     # 0xda192
callq 0x1ddbc
movq %r13, %rdi
callq 0xa7730
movq %r13, %rdi
callq 0x727d0
movq %r13, %rdi
movq %r14, %rsi
movl %r12d, %edx
callq 0x730d0
leaq 0x208(%rsp), %rdi
callq 0x2cbc0
testb %al, %al
je 0x18874
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
andq $0x0, 0x38(%rsp)
movb $0x0, 0x40(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0xa9e70
movq %r13, %rdi
callq 0x74230
movq %rbp, %rdi
leaq 0xb0(%rsp), %rsi
xorl %edx, %edx
callq 0x1de51
testb %al, %al
je 0x1886c
leaq 0xf0(%rsp), %rdi
movq %r15, %rsi
callq 0x1de68
testb %al, %al
je 0x1886c
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x1de72
movq %rbp, %rdi
callq 0xa7730
movq %r13, %rdi
callq 0x745e0
movq %r14, %rdi
callq 0xa7730
movq %r15, %rdi
callq 0xa7730
jmp 0x18787
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x189d9
leaq 0xc18f2(%rip), %rsi     # 0xda19a
leaq 0x90(%rsp), %rdi
leaq 0x190(%rsp), %rdx
callq 0x1dcb8
leaq 0x90(%rsp), %rsi
xorl %edi, %edi
callq 0x1861f
leaq 0x90(%rsp), %rdi
callq 0xa7730
movq 0x10(%rsp), %r14
movq 0x18(%rsp), %r15
pushq $0x3
popq %rbp
cmpq %r15, %r14
je 0x188fb
movl (%r14), %edi
movl %ebp, %esi
callq 0x154b0
addq $0x4, %r14
jmp 0x188e6
pushq $0x5
popq %rdi
callq 0x15440
movq 0x10(%rsp), %r15
movq 0x18(%rsp), %rbp
leaq 0x50(%rsp), %r14
leaq 0x190(%rsp), %r12
leaq 0x130(%rsp), %r13
cmpq %rbp, %r15
je 0x18a08
movl (%r15), %edi
xorl %esi, %esi
callq 0x154b0
testl %eax, %eax
je 0x18977
movl (%r15), %esi
movq %r14, %rdi
callq 0x1dcfc
movq %r12, %rdi
leaq 0xc1874(%rip), %rsi     # 0xda1c2
movq %r14, %rdx
callq 0x1de90
movq %r13, %rdi
movq %r12, %rsi
leaq 0xc1882(%rip), %rdx     # 0xda1e5
callq 0x1ddbc
xorl %edi, %edi
movq %r13, %rsi
callq 0x1861f
movq %r13, %rdi
jmp 0x189bb
movl (%r15), %esi
movq %r14, %rdi
callq 0x1dcfc
movq %r12, %rdi
leaq 0xc1836(%rip), %rsi     # 0xda1c2
movq %r14, %rdx
callq 0x1de90
leaq 0x150(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
leaq 0xc1829(%rip), %rdx     # 0xda1d2
callq 0x1ddbc
xorl %edi, %edi
movq %rbx, %rsi
callq 0x1861f
movq %rbx, %rdi
callq 0xa7730
movq %r12, %rdi
callq 0xa7730
movq %r14, %rdi
callq 0xa7730
addq $0x4, %r15
jmp 0x18922
leaq 0xc181f(%rip), %rsi     # 0xda1ff
leaq 0x70(%rsp), %rdi
leaq 0x190(%rsp), %rdx
callq 0x1dcb8
leaq 0x70(%rsp), %rsi
xorl %edi, %edi
callq 0x1861f
leaq 0x70(%rsp), %rdi
callq 0xa7730
movq 0x28(%rsp), %rdi
callq 0x15750
leaq 0xb0(%rsp), %rdi
callq 0x1deb4
leaq 0x10(%rsp), %rdi
callq 0x1eaba
leaq 0xf0(%rsp), %rdi
callq 0xa7730
leaq 0x110(%rsp), %rdi
callq 0xa7730
addq $0x398, %rsp            # imm = 0x398
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc1710(%rip), %rsi     # 0xda16c
leaq 0xd0(%rsp), %rdi
leaq 0x190(%rsp), %rdx
callq 0x1dcb8
pushq $0x2
popq %rdi
leaq 0xd0(%rsp), %rsi
callq 0x1861f
leaq 0xd0(%rsp), %rdi
callq 0xa7730
pushq $0x1
popq %rdi
callq 0x151a0
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0xa7730
jmp 0x18b85
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
jmp 0x18b64
jmp 0x18b6b
movq %rax, %rbx
jmp 0x18b85
jmp 0x18b6b
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
jmp 0x18b64
jmp 0x18b6b
movq %rax, %rbx
jmp 0x18b7b
movq %rax, %rbx
jmp 0x18b92
jmp 0x18b2b
jmp 0x18b26
jmp 0x18b6b
movq %rax, %rbx
leaq 0x150(%rsp), %rdi
jmp 0x18b13
jmp 0x18b6b
jmp 0x18b26
jmp 0x18b2b
movq %rax, %rbx
leaq 0x130(%rsp), %rdi
callq 0xa7730
jmp 0x18b2e
movq %rax, %rbx
jmp 0x18b52
jmp 0x18b6b
movq %rax, %rbx
jmp 0x18b45
movq %rax, %rbx
jmp 0x18b5f
movq %rax, %rbx
leaq 0x190(%rsp), %rdi
jmp 0x18b5a
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xa7730
leaq 0x190(%rsp), %rdi
callq 0x745e0
leaq 0x170(%rsp), %rdi
callq 0xa7730
leaq 0x50(%rsp), %rdi
callq 0xa7730
jmp 0x18b6e
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x1deb4
leaq 0x10(%rsp), %rdi
callq 0x1eaba
leaq 0xf0(%rsp), %rdi
callq 0xa7730
leaq 0x110(%rsp), %rdi
callq 0xa7730
movq %rbx, %rdi
callq 0xd6ab0