// File: /workspace/github_c_makefile_star2_O3/sasairc[P]clangsay/src/msg.c
// Function: read_msg
static
int read_msg(MSG** msg, int argc, int optind, char** argv)
{
    int     status  = 0;

    if ((*msg)->data != NULL) {
        free2d((*msg)->data, (*msg)->lines);
        (*msg)->lines = 0;
        (*msg)->data = NULL;
    }
    if (optind < argc) {    
        if (((*msg)->data = (char**)
                    smalloc(sizeof(char*) * (argc - optind), NULL)) == NULL) {
            status = -1; goto ERR;
        }
        while (optind < argc) {
            if ((*((*msg)->data + (*msg)->lines) = (char*)
                    smalloc(sizeof(char) * (strlen(*(argv + optind)) + 1), NULL)) == NULL) {
                status = -2; goto ERR;
            }
            memcpy(*((*msg)->data + (*msg)->lines),
                    *(argv + optind), strlen(*(argv + optind)) + 1);
            (*msg)->lines++;
            optind++;
        }
    } else {
        if (((*msg)->lines =
                    load_file_to_array(&(*msg)->data, TH_LINES, TH_LENGTH, stdin)) < 0) {
            status = -3; goto ERR;
        }
    }
    /* remove escape sequence */
    strunsecs(msg);

    return 0;

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

    return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0xacb6
movl 0x8(%rax), %esi
callq 0x4ca1
movq (%rbx), %rax
movl $0x0, 0x8(%rax)
movq $0x0, (%rax)
movl %ebp, %eax
subl %r15d, %eax
jle 0xad51
movslq %eax, %rdi
shlq $0x3, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x4b00
movq (%rbx), %rcx
movq %rax, (%rcx)
testq %rax, %rax
je 0xadc4
movslq %r15d, %r13
movslq %ebp, %rbp
movq (%r14,%r13,8), %rdi
callq 0x21b0
leaq 0x1(%rax), %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x4b00
movq (%rbx), %rcx
movq (%rcx), %rdx
movslq 0x8(%rcx), %rcx
movq %rax, (%rdx,%rcx,8)
testq %rax, %rax
je 0xadcc
movq (%rbx), %rax
movq (%rax), %rcx
movslq 0x8(%rax), %rax
movq (%rcx,%rax,8), %r15
movq (%r14,%r13,8), %r12
movq %r12, %rdi
callq 0x21b0
leaq 0x1(%rax), %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2470
movq (%rbx), %rcx
movl 0x8(%rcx), %eax
incl %eax
movl %eax, 0x8(%rcx)
incq %r13
cmpq %r13, %rbp
jne 0xace6
jmp 0xad77
movq (%rbx), %rdi
movq 0x6265(%rip), %rax      # 0x10fc0
movq (%rax), %rcx
movl $0x100, %esi            # imm = 0x100
movl $0x200, %edx            # imm = 0x200
callq 0x3df4
movq (%rbx), %rcx
movl %eax, 0x8(%rcx)
testl %eax, %eax
js 0xade4
testl %eax, %eax
jle 0xadbf
movl %eax, %r15d
decq %r15
xorl %r14d, %r14d
xorl %r12d, %r12d
movq (%rbx), %rax
movslq 0x8(%rax), %rcx
cmpq %rcx, %r12
jge 0xadd2
movq (%rax), %rax
movq (%rax,%r12,8), %rdi
callq 0x5dfc
movq (%rbx), %rax
movq (%rax), %rax
movq (%rax,%r15,8), %rdi
callq 0x5dfc
incq %r12
leaq -0x1(%r15), %rax
cmpq %r15, %r12
movq %rax, %r15
jl 0xad87
jmp 0xadd2
xorl %r14d, %r14d
jmp 0xadd2
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0xadd2
movl $0xfffffffe, %r14d      # imm = 0xFFFFFFFE
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2863
movl $0xfffffffd, %r14d      # imm = 0xFFFFFFFD
jmp 0xadd2