// File: /workspace/github_c_makefile_star2_O1/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, %r15
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
movq (%rdi), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0xaed6
movl 0x8(%rax), %esi
callq 0x4e2d
movq (%rbx), %rax
movl $0x0, 0x8(%rax)
movq $0x0, (%rax)
movl %r14d, %eax
subl %ebp, %eax
jle 0xaf80
movslq %eax, %rdi
shlq $0x3, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x4c84
movq (%rbx), %rcx
movq %rax, (%rcx)
testq %rax, %rax
je 0xaff8
movl %ebp, 0x4(%rsp)
movl %r14d, (%rsp)
cmpl %ebp, %r14d
jle 0xafa6
movslq 0x4(%rsp), %rbp
movslq (%rsp), %r14
movq (%r15,%rbp,8), %rdi
callq 0x21b0
leaq 0x1(%rax), %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x4c84
movq (%rbx), %rcx
movq (%rcx), %rdx
movslq 0x8(%rcx), %rcx
movq %rax, (%rdx,%rcx,8)
testq %rax, %rax
je 0xb008
movq (%rbx), %rax
movq (%rax), %rcx
movslq 0x8(%rax), %rax
movq (%rcx,%rax,8), %r12
movq (%r15,%rbp,8), %r13
movq %r13, %rdi
callq 0x21b0
leaq 0x1(%rax), %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0x2460
movq (%rbx), %rax
incl 0x8(%rax)
incq %rbp
cmpq %rbp, %r14
jne 0xaf1a
jmp 0xafa6
movq (%rbx), %rdi
movq 0x6036(%rip), %rax      # 0x10fc0
movq (%rax), %rcx
movl $0x100, %esi            # imm = 0x100
movl $0x200, %edx            # imm = 0x200
callq 0x3ec5
movq (%rbx), %rcx
movl %eax, 0x8(%rcx)
testl %eax, %eax
js 0xb000
movq (%rbx), %rax
movslq 0x8(%rax), %r14
testq %r14, %r14
jle 0xaff3
decq %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
movq (%rbx), %rax
movslq 0x8(%rax), %rcx
cmpq %rcx, %r12
jge 0xb01b
movq (%rax), %rax
movq (%rax,%r12,8), %rdi
callq 0x5ff2
movq (%rbx), %rax
movq (%rax), %rax
movq (%rax,%r14,8), %rdi
callq 0x5ff2
incq %r12
leaq -0x1(%r14), %rax
cmpq %r14, %r12
movq %rax, %r14
jl 0xafbb
jmp 0xb01b
xorl %r15d, %r15d
jmp 0xb01b
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0xb016
movl $0xfffffffd, %r15d      # imm = 0xFFFFFFFD
jmp 0xb016
movl $0xfffffffe, %r15d      # imm = 0xFFFFFFFE
movl 0x4(%rsp), %ebp
movl (%rsp), %r14d
cmpl %ebp, %r14d
jle 0xb02d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2903
jmp 0xb01b