// File: /workspace/github_c_makefile_star2_O0/sasairc[P]clangsay/src/msg.c
// Function: recursive_msg
static
int recursive_msg(MSG** msg, int n)
{
    int     status  = 0,
            fd[2]   = {0};

    while (n > 1) {
        if (pipe(fd) < 0) {
            status = -1; goto ERR;
        }
        switch (fork()) {
            case    -1:
                status = -2; goto ERR;
            case    0:
                close(fd[0]);
                dup2(fd[1], STDOUT_FILENO);
                close(fd[1]);
                (*msg)->print(*msg);
                (*msg)->release(*msg);
                exit(0);
            default:
                close(fd[1]);
                if (read_recursive_msg(&(*msg), fd[0]) < 0) {
                    status = -3; goto ERR;
                }
                close(fd[0]);
        }
        wait(&status);
        n--;
    }

    return 0;

ERR:
    switch (status) {
        case    -1:
            fprintf(stderr, "%s: pipe(): %s\n",
                    PROGNAME, strerror(errno));
            break;
        case    -2:
            fprintf(stderr, "%s: fork(): %s\n",
                    PROGNAME, strerror(errno));
            break;
        case    -3:
            break;
    }

    return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x2050
cmpl $0x1, -0x14(%rbp)
jle 0x1164d
leaq -0x20(%rbp), %rdi
callq 0x2220
cmpl $0x0, %eax
jge 0x1159a
movl $0xffffffff, -0x18(%rbp) # imm = 0xFFFFFFFF
jmp 0x11659
callq 0x23b0
movl %eax, %ecx
movl %ecx, -0x24(%rbp)
subl $-0x1, %eax
je 0x115b4
jmp 0x115ab
movl -0x24(%rbp), %eax
testl %eax, %eax
je 0x115c0
jmp 0x1160c
movl $0xfffffffe, -0x18(%rbp) # imm = 0xFFFFFFFE
jmp 0x11659
movl -0x20(%rbp), %edi
callq 0x2060
movl -0x1c(%rbp), %edi
movl $0x1, %esi
callq 0x2040
movl -0x1c(%rbp), %edi
callq 0x2060
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
xorl %edi, %edi
callq 0x20c0
movl -0x1c(%rbp), %edi
callq 0x2060
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %esi
callq 0x118b0
cmpl $0x0, %eax
jge 0x1162e
movl $0xfffffffd, -0x18(%rbp) # imm = 0xFFFFFFFD
jmp 0x11659
movl -0x20(%rbp), %edi
callq 0x2060
leaq -0x18(%rbp), %rdi
callq 0x2070
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x11576
movl $0x0, -0x4(%rbp)
jmp 0x116f6
movl -0x18(%rbp), %eax
movl %eax, -0x28(%rbp)
subl $-0x3, %eax
je 0x116ee
jmp 0x1166a
movl -0x28(%rbp), %eax
subl $-0x2, %eax
je 0x116b6
jmp 0x11674
movl -0x28(%rbp), %eax
subl $-0x1, %eax
jne 0x116f0
jmp 0x1167e
movq 0x5963(%rip), %rax      # 0x16fe8
movq (%rax), %rax
movq %rax, -0x30(%rbp)
callq 0x2350
movl (%rax), %edi
callq 0x2260
movq -0x30(%rbp), %rdi
movq %rax, %rcx
leaq 0x133e(%rip), %rsi      # 0x129e4
leaq 0xce4(%rip), %rdx       # 0x12391
movb $0x0, %al
callq 0x23f0
jmp 0x116f0
movq 0x592b(%rip), %rax      # 0x16fe8
movq (%rax), %rax
movq %rax, -0x38(%rbp)
callq 0x2350
movl (%rax), %edi
callq 0x2260
movq -0x38(%rbp), %rdi
movq %rax, %rcx
leaq 0x1316(%rip), %rsi      # 0x129f4
leaq 0xcac(%rip), %rdx       # 0x12391
movb $0x0, %al
callq 0x23f0
jmp 0x116f0
jmp 0x116f0
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop