// File: /workspace/github_c_makefile_star2_O0/sasairc[P]clangsay/src/libbenly/src/proc.c
// Function: init_mproc
int init_mproc(MPROC** mproc)
{
    int     i       = 0,
            status  = 0;

    MPROC*  mprc    = NULL;

    if ((mprc = (MPROC*)
                malloc(sizeof(MPROC))) == NULL) {
        status = -1; goto ERR;
    }
    if ((mprc->proc = (PROC**)
                malloc(sizeof(PROC*) * MPROC_MAX)) == NULL) {
        status = -2; goto ERR;
    } else {
        i = 0;
        while (i < MPROC_MAX && (mprc->proc[i] = NULL))
            i++;
    }
    {
        mprc->procs     = 0;
        mprc->proc_no   = 0;
        mprc->add       = add_mproc;
        mprc->del       = del_mproc;
        mprc->fork      = fork_mproc;
#ifdef  _GNU_SOURCE
        mprc->rfork     = rfork_mproc;
/* _GNU_SOURCE */
#endif
        mprc->is_parent = is_parent_mproc;
        mprc->is_child  = is_child_mproc;
        mprc->exec      = exec_mproc;
        mprc->wait      = wait_mproc;
        mprc->kill      = kill_mproc;
        mprc->killall   = killall_mproc;
        mprc->release   = release_mproc;
    }
    *mproc = mprc;

    return 0;

ERR:
    switch (status) {
        case    -1:
            break;
        case    -2:
            if (mprc != NULL)
                free(mprc);
            break;
    }

    return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x68, %edi
callq 0x20e0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x6f42
movl $0xffffffff, -0x18(%rbp) # imm = 0xFFFFFFFF
jmp 0x7074
movl $0x100, %edi            # imm = 0x100
callq 0x20e0
movq -0x20(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x6f65
movl $0xfffffffe, -0x18(%rbp) # imm = 0xFFFFFFFE
jmp 0x7074
movl $0x0, -0x14(%rbp)
xorl %eax, %eax
cmpl $0x20, -0x14(%rbp)
movb %al, -0x21(%rbp)
jge 0x6f8f
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
xorl %eax, %eax
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x6f98
jmp 0x6fa3
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x6f6c
jmp 0x6fa5
movq -0x20(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x20(%rbp), %rax
leaq 0xea(%rip), %rcx        # 0x70b0
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
leaq 0x15b(%rip), %rcx       # 0x7130
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
leaq 0x21c(%rip), %rcx       # 0x7200
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rax
leaq 0x29d(%rip), %rcx       # 0x7290
movq %rcx, 0x28(%rax)
movq -0x20(%rbp), %rax
leaq 0x31e(%rip), %rcx       # 0x7320
movq %rcx, 0x30(%rax)
movq -0x20(%rbp), %rax
leaq 0x33f(%rip), %rcx       # 0x7350
movq %rcx, 0x38(%rax)
movq -0x20(%rbp), %rax
leaq 0x370(%rip), %rcx       # 0x7390
movq %rcx, 0x40(%rax)
movq -0x20(%rbp), %rax
leaq 0x3a1(%rip), %rcx       # 0x73d0
movq %rcx, 0x48(%rax)
movq -0x20(%rbp), %rax
leaq 0x402(%rip), %rcx       # 0x7440
movq %rcx, 0x50(%rax)
movq -0x20(%rbp), %rax
leaq 0x453(%rip), %rcx       # 0x74a0
movq %rcx, 0x58(%rax)
movq -0x20(%rbp), %rax
leaq 0x4c4(%rip), %rcx       # 0x7520
movq %rcx, 0x60(%rax)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x70a5
movl -0x18(%rbp), %eax
movl %eax, -0x28(%rbp)
subl $-0x2, %eax
je 0x708d
jmp 0x7081
movl -0x28(%rbp), %eax
subl $-0x1, %eax
jne 0x709f
jmp 0x708b
jmp 0x709f
cmpq $0x0, -0x20(%rbp)
je 0x709d
movq -0x20(%rbp), %rdi
callq 0x2180
jmp 0x709f
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop