// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, (%rax)
je 0x1108f
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %esi
callq 0x6400
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq $0x0, (%rax)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x111a1
movl -0x14(%rbp), %eax
subl -0x18(%rbp), %eax
movslq %eax, %rdi
shlq $0x3, %rdi
xorl %eax, %eax
movl %eax, %esi
movb $0x0, %al
callq 0x6160
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x110cf
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
jmp 0x111ed
jmp 0x110d1
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x1119f
movq -0x20(%rbp), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2190
movq %rax, %rdi
addq $0x1, %rdi
shlq $0x0, %rdi
xorl %eax, %eax
movl %eax, %esi
movb $0x0, %al
callq 0x6160
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movq (%rcx), %rcx
movq -0x10(%rbp), %rdx
movq (%rdx), %rdx
movslq 0x8(%rdx), %rdx
movq %rax, (%rcx,%rdx,8)
cmpq $0x0, %rax
jne 0x1112f
movl $0xfffffffe, -0x24(%rbp) # imm = 0xFFFFFFFE
jmp 0x111ed
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movslq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2190
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq %rax, %rdx
addq $0x1, %rdx
callq 0x2410
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x110d1
jmp 0x111db
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq 0x5e11(%rip), %rax      # 0x16fc0
movq (%rax), %rcx
movl $0x100, %esi            # imm = 0x100
movl $0x200, %edx            # imm = 0x200
callq 0x4a70
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movl %eax, 0x8(%rcx)
cmpl $0x0, %eax
jge 0x111d9
movl $0xfffffffd, -0x24(%rbp) # imm = 0xFFFFFFFD
jmp 0x111ed
jmp 0x111db
movq -0x10(%rbp), %rdi
callq 0x11810
movl $0x0, -0x4(%rbp)
jmp 0x11245
movl -0x24(%rbp), %eax
movl %eax, -0x3c(%rbp)
subl $-0x3, %eax
je 0x11209
jmp 0x111fa
movl -0x3c(%rbp), %eax
addl $0x2, %eax
subl $0x1, %eax
ja 0x1123f
jmp 0x11207
jmp 0x1123f
movq 0x5dd8(%rip), %rax      # 0x16fe8
movq (%rax), %rax
movq %rax, -0x48(%rbp)
callq 0x2350
movl (%rax), %edi
callq 0x2260
movq -0x48(%rbp), %rdi
movq %rax, %rcx
leaq 0x1748(%rip), %rsi      # 0x12979
leaq 0x1159(%rip), %rdx      # 0x12391
movb $0x0, %al
callq 0x23f0
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nop