// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
leaq -0xb0(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x2050
leaq -0xf0(%rbp), %rdi
leaq 0xe02(%rip), %rsi       # 0x120a5
movl $0x1, %edx
callq 0x22d0
movl %eax, -0x24(%rbp)
cmpl $0x0, %eax
je 0x1131a
movq 0x5d3c(%rip), %rax      # 0x16ff8
movq (%rax), %rdi
leaq 0x16e0(%rip), %rsi      # 0x129a6
movb $0x0, %al
callq 0x23f0
movl -0x24(%rbp), %edi
leaq -0xb0(%rbp), %rdx
leaq -0xf0(%rbp), %rsi
movl $0x80, %ecx
callq 0x2230
movq 0x5cf9(%rip), %rax      # 0x16fe8
movq (%rax), %rdi
leaq -0xb0(%rbp), %rcx
leaq 0x16ac(%rip), %rsi      # 0x129ac
leaq 0x108a(%rip), %rdx      # 0x12391
movb $0x0, %al
callq 0x23f0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x11543
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
leaq -0xf0(%rbp), %rdx
callq 0x8f20
movl %eax, -0x20(%rbp)
movl $0x20, %edi
callq 0x20d0
movl -0x20(%rbp), %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jl 0x11362
movl $0x5f, %edi
callq 0x20d0
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x11347
movq -0x10(%rbp), %rax
cmpl $0x1, 0x8(%rax)
jne 0x113c1
movq 0x5c85(%rip), %rax      # 0x16ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rdx
leaq 0x1638(%rip), %rsi      # 0x129bf
movb $0x0, %al
callq 0x23f0
cmpl $0x0, -0x20(%rbp)
jl 0x113a9
movl $0x2d, %edi
callq 0x20d0
movl -0x20(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1138e
leaq 0x116c(%rip), %rdi      # 0x1251c
callq 0x2080
movl $0x0, -0x4(%rbp)
jmp 0x11543
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x11507
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x8de0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x11425
movq 0x5bf5(%rip), %rax      # 0x16ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x15ad(%rip), %rsi      # 0x129c9
movb $0x0, %al
callq 0x23f0
jmp 0x11488
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x8(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1145f
movq 0x5bbb(%rip), %rax      # 0x16ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x1579(%rip), %rsi      # 0x129cf
movb $0x0, %al
callq 0x23f0
jmp 0x11486
movq 0x5b92(%rip), %rax      # 0x16ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x1555(%rip), %rsi      # 0x129d4
movb $0x0, %al
callq 0x23f0
jmp 0x11488
movl -0x20(%rbp), %eax
subl -0x1c(%rbp), %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jle 0x114ac
movl $0x20, %edi
callq 0x20d0
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x11491
cmpl $0x0, -0x14(%rbp)
jne 0x114c0
leaq 0x1520(%rip), %rdi      # 0x129d9
callq 0x2080
jmp 0x114f9
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x8(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x114eb
movq 0x5b20(%rip), %rax      # 0x16ff8
movq (%rax), %rdi
leaq 0x14fa(%rip), %rsi      # 0x129dc
movb $0x0, %al
callq 0x23f0
jmp 0x114f7
leaq 0x14ef(%rip), %rdi      # 0x129e1
callq 0x2080
jmp 0x114f9
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x113c8
jmp 0x11509
cmpl $0x0, -0x20(%rbp)
jl 0x11524
movl $0x2d, %edi
callq 0x20d0
movl -0x20(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x11509
leaq 0xff1(%rip), %rdi       # 0x1251c
callq 0x2080
leaq -0xf0(%rbp), %rdi
callq 0x2370
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xf0, %rsp
popq %rbp
retq
nop