// File: /workspace/github_c_makefile_star2_O1/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 0x6b0f
testl %eax, %eax
je 0x6aed
movq %rsp, -0x30(%rbp)
movl %eax, %ecx
movq %rsp, %r8
shlq $0x4, %rcx
subq %rcx, %r8
movq %r8, %rsp
xorl %ecx, %ecx
leaq 0x3030(%rip), %rdx      # 0x9900
movq %rbx, %rsi
movzbl (%rsi), %edi
leal -0x62(%rdi), %r9d
cmpl $0x12, %r9d
ja 0x6924
movslq (%rdx,%r9,4), %rdi
addq %rdx, %rdi
jmpq *%rdi
movl (%r13), %r9d
cmpq $0x28, %r9
ja 0x6904
movq %r9, %rdi
addq 0x10(%r13), %rdi
addl $0x8, %r9d
movl %r9d, (%r13)
jmp 0x6910
movq 0x8(%r13), %rdi
leaq 0x8(%rdi), %r9
movq %r9, 0x8(%r13)
movl (%rdi), %edi
movl %ecx, %r9d
incl %ecx
shlq $0x4, %r9
movl %edi, (%r8,%r9)
jmp 0x6abe
cmpl $0x53, %edi
jne 0x6abe
movl (%r13), %r9d
cmpq $0x28, %r9
ja 0x6948
movq %r9, %rdi
addq 0x10(%r13), %rdi
addl $0x8, %r9d
movl %r9d, (%r13)
jmp 0x6954
movq 0x8(%r13), %rdi
leaq 0x8(%rdi), %r9
movq %r9, 0x8(%r13)
movq (%rdi), %rdi
movl %ecx, %r9d
incl %ecx
shlq $0x4, %r9
movq %rdi, (%r8,%r9)
jmp 0x6abe
movl (%r13), %r9d
cmpq $0x28, %r9
ja 0x69f0
movq %r9, %rdi
addq 0x10(%r13), %rdi
addl $0x8, %r9d
movl %r9d, (%r13)
jmp 0x69fc
movl (%r13), %r9d
cmpq $0x28, %r9
ja 0x6a2f
movq %r9, %rdi
addq 0x10(%r13), %rdi
addl $0x8, %r9d
movl %r9d, (%r13)
jmp 0x6a3b
movl 0x4(%r13), %r9d
cmpq $0xa0, %r9
ja 0x6a7d
movq %r9, %rdi
addq 0x10(%r13), %rdi
addl $0x10, %r9d
movl %r9d, 0x4(%r13)
jmp 0x6a89
movl 0x4(%r13), %r9d
cmpq $0xa0, %r9
ja 0x6a9d
movq %r9, %rdi
addq 0x10(%r13), %rdi
addl $0x10, %r9d
movl %r9d, 0x4(%r13)
jmp 0x6aa9
movq 0x8(%r13), %rdi
leaq 0x8(%rdi), %r9
movq %r9, 0x8(%r13)
movq (%rdi), %rdi
movb (%rdi), %r9b
movl %ecx, %r10d
shlq $0x4, %r10
movb %r9b, (%r8,%r10)
movb 0x1(%rdi), %r9b
movb %r9b, 0x1(%r8,%r10)
movb 0x2(%rdi), %r9b
movb %r9b, 0x2(%r8,%r10)
movb 0x3(%rdi), %dil
incl %ecx
movb %dil, 0x3(%r8,%r10)
jmp 0x6abe
movq 0x8(%r13), %rdi
leaq 0x8(%rdi), %r9
movq %r9, 0x8(%r13)
movl (%rdi), %r9d
movl %ecx, %edi
shlq $0x4, %rdi
movl %r9d, (%r8,%rdi)
movl (%r13), %r10d
cmpq $0x28, %r10
ja 0x6a63
movq %r10, %r9
addq 0x10(%r13), %r9
addl $0x8, %r10d
movl %r10d, (%r13)
jmp 0x6a6f
movq 0x8(%r13), %r9
leaq 0x8(%r9), %r10
movq %r10, 0x8(%r13)
addq %r8, %rdi
movq (%r9), %r9
movq %r9, 0x8(%rdi)
incl %ecx
jmp 0x6abe
movq 0x8(%r13), %rdi
leaq 0x8(%rdi), %r9
movq %r9, 0x8(%r13)
movsd (%rdi), %xmm0
movl %ecx, %edi
incl %ecx
shlq $0x4, %rdi
movsd %xmm0, (%r8,%rdi)
jmp 0x6abe
movq 0x8(%r13), %rdi
leaq 0x8(%rdi), %r9
movq %r9, 0x8(%r13)
xorps %xmm0, %xmm0
cvtsd2ss (%rdi), %xmm0
movl %ecx, %edi
incl %ecx
shlq $0x4, %rdi
movss %xmm0, (%r8,%rdi)
incq %rsi
cmpl %eax, %ecx
jb 0x68d3
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x6b54
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 0x6b54