// File: /workspace/github_c_makefile_star2_O1/sasairc[P]yasuna/src/libbenly/src/string.c
// Function: strlion
char* strlion(int argnum, ...)
{
    int     i       = 0;

    size_t  destlen = 0,
            blklen  = 0,
            arglen  = 0;

    char*   dest    = NULL,
        **  argmnt  = NULL;

    va_list list;       /* list of variable arguments */

    if ((argmnt = (char**)
                malloc(sizeof(char*) * argnum)) == NULL)
        goto ERR;

    /* processing of variable arguments */
    va_start(list, argnum);
    while (i < argnum) {
        *(argmnt + i) = va_arg(list, char*);
        arglen += strlen(*(argmnt + i));
        i++;
    }
    va_end(list);

    /* memory allocation */
    if ((dest = (char*)
                malloc(sizeof(char) * (arglen + 1))) == NULL)
        goto ERR;

    /* concat strings */
    i = destlen = blklen = 0;
    blklen = strlen(*(argmnt + i));
    memcpy(dest, *(argmnt + i), blklen);
    destlen += blklen;

    i++;
    while(i < argnum) {
        blklen = strlen(*(argmnt + i));
        memcpy(dest + destlen, *(argmnt + i), blklen);
        destlen += blklen;
        i++;
    }
    *(dest + destlen) = '\0';

    free(argmnt);

    return dest;

ERR:
    if (argmnt != NULL) {
        free(argmnt);
        argmnt = NULL;
    }
    if (dest != NULL) {
        free(dest);
        dest = NULL;
    }

    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movl %edi, %ebp
movq %rsi, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
movq %rcx, 0x48(%rsp)
movq %r8, 0x50(%rsp)
movq %r9, 0x58(%rsp)
testb %al, %al
je 0x1412
movaps %xmm0, 0x60(%rsp)
movaps %xmm1, 0x70(%rsp)
movaps %xmm2, 0x80(%rsp)
movaps %xmm3, 0x90(%rsp)
movaps %xmm4, 0xa0(%rsp)
movaps %xmm5, 0xb0(%rsp)
movaps %xmm6, 0xc0(%rsp)
movaps %xmm7, 0xd0(%rsp)
movslq %edi, %rdi
shlq $0x3, %rdi
callq 0x1090
testq %rax, %rax
je 0x14ba
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x120(%rsp), %rax
movq %rax, 0x18(%rsp)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, 0x10(%rsp)
testl %ebp, %ebp
jle 0x14c1
movl 0x10(%rsp), %r15d
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
movq 0x18(%rsp), %rax
movl %ebp, 0xc(%rsp)
movl %ebp, %r13d
xorl %ebp, %ebp
xorl %r14d, %r14d
cmpl $0x28, %r15d
ja 0x148e
movq %rax, %r12
movl %r15d, %eax
addq (%rsp), %rax
addl $0x8, %r15d
movl %r15d, 0x10(%rsp)
jmp 0x1497
leaq 0x8(%rax), %r12
movq %r12, 0x18(%rsp)
movq (%rax), %rdi
movq %rdi, (%rbx,%rbp,8)
callq 0x1070
addq %rax, %r14
incq %rbp
movq %r12, %rax
cmpq %rbp, %r13
jne 0x1473
incq %r14
movl 0xc(%rsp), %ebp
jmp 0x14c7
xorl %ebp, %ebp
jmp 0x154b
movl $0x1, %r14d
movq %r14, %rdi
callq 0x1090
testq %rax, %rax
je 0x1536
movq %rax, %r14
movq (%rbx), %r12
movq %r12, %rdi
callq 0x1070
movq %rax, %r15
movq %r14, %r13
movq %r14, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x1080
cmpl $0x2, %ebp
jl 0x153a
movl %ebp, %eax
movq %rax, (%rsp)
movl $0x1, %r14d
movq %r13, %rbp
movq (%rbx,%r14,8), %r12
movq %r12, %rdi
callq 0x1070
movq %rax, %r13
leaq (%r15,%rbp), %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x1080
addq %r13, %r15
incq %r14
cmpq %r14, (%rsp)
jne 0x150a
jmp 0x153d
xorl %ebp, %ebp
jmp 0x1543
movq %r13, %rbp
movb $0x0, (%rbp,%r15)
movq %rbx, %rdi
callq 0x1030
movq %rbp, %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq