// File: /workspace/github_c_makefile_star2_O2/sasairc[P]clangsay/src/msg.c
// Function: print_msg
static
int print_msg(MSG* msg)
{
    int         i       = 0,
                j       = 0,
                len     = 0,
                maxlen  = 0;

#ifdef  WITH_REGEX
    int     status      = 0;

    char    errstr[128] = {'\0'};

    regex_t reg;

    /* compile regex */
    if ((status = regcomp(&reg, ANSI_ESCSEQ, REG_EXTENDED)) != 0) {
        fprintf(stdout, "error");
        regerror(status, &reg, errstr, sizeof(errstr));
        fprintf(stderr, "%s: regcomp(): %s\n",
                PROGNAME, errstr);

        return -1;
    }
    /* get max length */
    maxlen = strmax_with_regex(msg->lines, msg->data, &reg);
#else
    maxlen = strmax(msg->lines, msg->data);
/* WITH_REGEX */
#endif

    /*
     * single line
     */
    putchar(' ');
    i = maxlen;
    while (i >= 0) {
        putchar('_');
        i--;
    }
    if (msg->lines == 1) {
        fprintf(stdout, "\n< %s >\n ",
                *(msg->data));

        while (maxlen >= 0) {
            putchar('-');
            maxlen--;
        }
        puts("");

        return 0;
    }

    /*
     * multi line
     */
    i = 0;
    while (i < msg->lines) {
#ifdef  WITH_REGEX
        len = mbstrlen_with_regex(*(msg->data + i), &reg);
#else
        len = mbstrlen(*(msg->data + i));
/* WITH_REGEX */
#endif
        if (i == 0)
            fprintf(stdout, "\n/ %s",
                    *(msg->data + i));
        else if (i == (msg->lines - 1))
            fprintf(stdout, "\\ %s",
                    *(msg->data + i));
        else
            fprintf(stdout, "| %s",
                    *(msg->data + i));

        j = maxlen - len;
        while (j > 0) {
            putchar(' ');
            j--;
        }

        if (i == 0)
            puts(" \\");
        else if (i == (msg->lines - 1))
            fprintf(stdout, " /\n ");
        else
            puts(" |");

        i++;
    }
    while (maxlen >= 0) {
        putchar('-');
        maxlen--;
    }
    puts("");
#ifdef  WITH_REGEX
    regfree(&reg);
/* WITH_REGEX */
#endif

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
leaq 0xf6e(%rip), %rsi       # 0xb0a5
movq %rsp, %rdi
pushq $0x1
popq %rdx
callq 0x2300
testl %eax, %eax
jne 0xa2d2
movl 0x8(%r14), %edi
movq (%r14), %rsi
movq %rsp, %rdx
callq 0x5945
movl %eax, %r13d
pushq $0x20
popq %rdi
callq 0x20d0
pushq $0x5f
popq %rbp
movl %r13d, %ebx
testl %ebx, %ebx
js 0xa179
movl %ebp, %edi
callq 0x20d0
decl %ebx
jmp 0xa16a
movl 0x8(%r14), %eax
cmpl $0x1, %eax
jne 0xa1b8
movq 0x6e67(%rip), %rax      # 0x10ff0
movq (%rax), %rdi
movq (%r14), %rax
movq (%rax), %rdx
leaq 0x169c(%rip), %rsi      # 0xb835
xorl %eax, %eax
callq 0x2450
pushq $0x2d
popq %rbp
testl %r13d, %r13d
js 0xa290
movl %ebp, %edi
callq 0x20d0
decl %r13d
jmp 0xa1a3
pushq $0x20
popq %rbp
xorl %r15d, %r15d
cltq
cmpq %rax, %r15
jge 0xa29a
movq (%r14), %rax
movq (%rax,%r15,8), %rdi
movq %rsp, %rsi
callq 0x587a
movl %eax, %r12d
testq %r15, %r15
je 0xa205
movl 0x8(%r14), %eax
decl %eax
movq 0x6e03(%rip), %rcx      # 0x10ff0
movq (%rcx), %rdi
movq (%r14), %rcx
movq (%rcx,%r15,8), %rdx
cmpq %rax, %r15
jne 0xa21e
leaq 0x1642(%rip), %rsi      # 0xb845
jmp 0xa225
movq 0x6de4(%rip), %rax      # 0x10ff0
movq (%rax), %rdi
movq (%r14), %rax
movq (%rax), %rdx
leaq 0x1623(%rip), %rsi      # 0xb83f
jmp 0xa225
leaq 0x1625(%rip), %rsi      # 0xb84a
xorl %eax, %eax
callq 0x2450
movl %r13d, %ebx
subl %r12d, %ebx
testl %ebx, %ebx
jle 0xa241
movl %ebp, %edi
callq 0x20d0
decl %ebx
jmp 0xa232
testq %r15, %r15
je 0xa26f
movl 0x8(%r14), %eax
decl %eax
cmpq %rax, %r15
jne 0xa278
movq 0x6d98(%rip), %rax      # 0x10ff0
movq (%rax), %rcx
leaq 0x15f0(%rip), %rdi      # 0xb852
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
jmp 0xa284
leaq 0x15d9(%rip), %rdi      # 0xb84f
jmp 0xa27f
leaq 0x15d8(%rip), %rdi      # 0xb857
callq 0x2080
incq %r15
movl 0x8(%r14), %eax
jmp 0xa1be
pushq $0xa
popq %rdi
callq 0x20d0
jmp 0xa2be
pushq $0x2d
popq %rbp
testl %r13d, %r13d
js 0xa2ae
movl %ebp, %edi
callq 0x20d0
decl %r13d
jmp 0xa29d
pushq $0xa
popq %rdi
callq 0x20d0
movq %rsp, %rdi
callq 0x23b0
xorl %eax, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %ebx
movq 0x6d15(%rip), %rax      # 0x10ff0
movq (%rax), %rcx
leaq 0x1537(%rip), %rdi      # 0xb81c
pushq $0x5
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
movq %rsp, %rsi
leaq 0x40(%rsp), %r14
movl $0x80, %ecx
movl %ebx, %edi
movq %r14, %rdx
callq 0x2250
movq 0x6cd2(%rip), %rax      # 0x10fe0
movq (%rax), %rdi
leaq 0x150a(%rip), %rsi      # 0xb822
leaq 0xefe(%rip), %rdx       # 0xb21d
movq %r14, %rcx
xorl %eax, %eax
callq 0x2450
pushq $-0x1
popq %rax
jmp 0xa2c0