// File: /workspace/github_c_makefile_star2_O2/mruby-zest[P]osc-bridge/rtosc/rtosc.c
// Function: rtosc_vmessage
size_t rtosc_vmessage(char   *buffer,
                      size_t      len,
                      const char *address,
                      const char *arguments,
                      va_list ap)
{
    const unsigned nargs = nreserved(arguments);
    if(!nargs)
        return rtosc_amessage(buffer,len,address,arguments,NULL);

    rtosc_arg_t args[nargs];

    unsigned arg_pos = 0;
    const char *arg_str = arguments;
    uint8_t *midi_tmp;
    while(arg_pos < nargs)
    {
        switch(*arg_str++) {
            case 'h':
            case 't':
                args[arg_pos++].h = va_arg(ap, int64_t);
                break;
            case 'd':
                args[arg_pos++].d = va_arg(ap, double);
                break;
            case 'c':
            case 'i':
            case 'r':
                args[arg_pos++].i = va_arg(ap, int);
                break;
            case 'm':
                midi_tmp = va_arg(ap, uint8_t *);
                args[arg_pos].m[0] = midi_tmp[0];
                args[arg_pos].m[1] = midi_tmp[1];
                args[arg_pos].m[2] = midi_tmp[2];
                args[arg_pos++].m[3] = midi_tmp[3];
                break;
            case 'S':
            case 's':
                args[arg_pos++].s = va_arg(ap, const char *);
                break;
            case 'b':
                args[arg_pos].b.len = va_arg(ap, int);
                args[arg_pos].b.data = va_arg(ap, unsigned char *);
                arg_pos++;
                break;
            case 'f':
                args[arg_pos++].f = va_arg(ap, double);
                break;
            default:
                ;
        }
    }

    return rtosc_amessage(buffer,len,address,arguments,args);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r13
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movq %rcx, %rdi
callq 0x6488
testl %eax, %eax
je 0x6466
movq %rsp, -0x30(%rbp)
movl %eax, %ecx
movq %rsp, %r8
shlq $0x4, %rcx
subq %rcx, %r8
movq %r8, %rsp
xorl %ecx, %ecx
leaq 0x2665(%rip), %rdx      # 0x88b8
movq %rbx, %rsi
cmpl %eax, %ecx
jae 0x6442
movzbl (%rsi), %r9d
incq %rsi
leal -0x62(%r9), %r10d
movl %ecx, %edi
cmpl $0x12, %r10d
ja 0x62b1
movslq (%rdx,%r10,4), %r9
addq %rdx, %r9
jmpq *%r9
movl (%r13), %r10d
cmpq $0x28, %r10
ja 0x6296
movq %r10, %r9
addq 0x10(%r13), %r9
addl $0x8, %r10d
movl %r10d, (%r13)
jmp 0x62a2
movq 0x8(%r13), %r9
leaq 0x8(%r9), %r10
movq %r10, 0x8(%r13)
movl (%r9), %r9d
incl %ecx
shlq $0x4, %rdi
movl %r9d, (%r8,%rdi)
jmp 0x6256
cmpl $0x53, %r9d
jne 0x6256
movl (%r13), %r10d
cmpq $0x28, %r10
ja 0x62d2
movq %r10, %r9
addq 0x10(%r13), %r9
addl $0x8, %r10d
movl %r10d, (%r13)
jmp 0x62de
movq 0x8(%r13), %r9
leaq 0x8(%r9), %r10
movq %r10, 0x8(%r13)
movq (%r9), %r9
incl %ecx
shlq $0x4, %rdi
movq %r9, (%r8,%rdi)
jmp 0x6256
movl (%r13), %r10d
cmpq $0x28, %r10
ja 0x6377
movq %r10, %r9
addq 0x10(%r13), %r9
addl $0x8, %r10d
movl %r10d, (%r13)
jmp 0x6383
movl 0x4(%r13), %r10d
cmpq $0xa0, %r10
ja 0x63b3
movq %r10, %r9
addq 0x10(%r13), %r9
addl $0x10, %r10d
movl %r10d, 0x4(%r13)
jmp 0x63bf
movl (%r13), %r9d
cmpq $0x28, %r9
ja 0x63d5
movq %r9, %r10
addq 0x10(%r13), %r10
addl $0x8, %r9d
movl %r9d, (%r13)
jmp 0x63e1
movl 0x4(%r13), %r10d
cmpq $0xa0, %r10
ja 0x6420
movq %r10, %r9
addq 0x10(%r13), %r9
addl $0x10, %r10d
movl %r10d, 0x4(%r13)
jmp 0x642c
movq 0x8(%r13), %r9
leaq 0x8(%r9), %r10
movq %r10, 0x8(%r13)
movq (%r9), %r9
movb (%r9), %r10b
shlq $0x4, %rdi
movb %r10b, (%r8,%rdi)
movb 0x1(%r9), %r10b
movb %r10b, 0x1(%r8,%rdi)
movb 0x2(%r9), %r10b
movb %r10b, 0x2(%r8,%rdi)
movb 0x3(%r9), %r9b
incl %ecx
movb %r9b, 0x3(%r8,%rdi)
jmp 0x6256
movq 0x8(%r13), %r9
leaq 0x8(%r9), %r10
movq %r10, 0x8(%r13)
movsd (%r9), %xmm0
incl %ecx
shlq $0x4, %rdi
movsd %xmm0, (%r8,%rdi)
jmp 0x6256
movq 0x8(%r13), %r10
leaq 0x8(%r10), %r11
movq %r11, 0x8(%r13)
movl (%r10), %r10d
shlq $0x4, %rdi
movl %r10d, (%r8,%rdi)
cmpl $0x28, %r9d
ja 0x6403
movl %r9d, %r10d
addq 0x10(%r13), %r10
addl $0x8, %r9d
movl %r9d, (%r13)
jmp 0x640f
movq 0x8(%r13), %r10
leaq 0x8(%r10), %r9
movq %r9, 0x8(%r13)
addq %r8, %rdi
movq (%r10), %r9
movq %r9, 0x8(%rdi)
incl %ecx
jmp 0x6256
movq 0x8(%r13), %r9
leaq 0x8(%r9), %r10
movq %r10, 0x8(%r13)
cvtsd2ss (%r9), %xmm0
incl %ecx
shlq $0x4, %rdi
movss %xmm0, (%r8,%rdi)
jmp 0x6256
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x64d1
movq -0x30(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
xorl %r8d, %r8d
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x64d1