// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
testb %al, %al
je 0x15be
movaps %xmm0, -0xd0(%rbp)
movaps %xmm1, -0xc0(%rbp)
movaps %xmm2, -0xb0(%rbp)
movaps %xmm3, -0xa0(%rbp)
movaps %xmm4, -0x90(%rbp)
movaps %xmm5, -0x80(%rbp)
movaps %xmm6, -0x70(%rbp)
movaps %xmm7, -0x60(%rbp)
movq %r9, -0xd8(%rbp)
movq %r8, -0xe0(%rbp)
movq %rcx, -0xe8(%rbp)
movq %rdx, -0xf0(%rbp)
movq %rsi, -0xf8(%rbp)
movl %edi, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movslq -0xc(%rbp), %rdi
shlq $0x3, %rdi
callq 0x1090
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0x162f
jmp 0x17e2
leaq -0x50(%rbp), %rax
leaq -0x100(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x8, (%rax)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x16f4
leaq -0x50(%rbp), %rax
movq %rax, -0x110(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x104(%rbp)
cmpl $0x28, %eax
ja 0x169a
movq -0x110(%rbp), %rcx
movl -0x104(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x118(%rbp)
jmp 0x16b7
movq -0x110(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rax
movq (%rax), %rdx
movq -0x38(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1070
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x1653
leaq -0x50(%rbp), %rax
movq -0x28(%rbp), %rdi
addq $0x1, %rdi
shlq $0x0, %rdi
callq 0x1090
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x1718
jmp 0x17e2
movq $0x0, -0x20(%rbp)
movq $0x0, -0x18(%rbp)
movl $0x0, -0x10(%rbp)
movq -0x38(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1070
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movq -0x20(%rbp), %rdx
callq 0x1080
movq -0x20(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x17c3
movq -0x38(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1070
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rdi
addq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movq -0x20(%rbp), %rdx
callq 0x1080
movq -0x20(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x1772
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x38(%rbp), %rdi
callq 0x1030
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x181a
cmpq $0x0, -0x38(%rbp)
je 0x17fa
movq -0x38(%rbp), %rdi
callq 0x1030
movq $0x0, -0x38(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x1812
movq -0x30(%rbp), %rdi
callq 0x1030
movq $0x0, -0x30(%rbp)
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopw (%rax,%rax)