// File: /workspace/github_c_makefile_star2_O3/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
subq $0x18, %rsp
movq %r8, %r13
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movq %rcx, %rdi
callq 0x6a8a
testl %eax, %eax
je 0x6a68
movq %rsp, -0x38(%rbp)
movl %eax, %ecx
movq %rsp, %r8
shlq $0x4, %rcx
subq %rcx, %r8
movq %r8, %rsp
xorl %ecx, %ecx
leaq 0x30f5(%rip), %rdx      # 0x9900
movq %rbx, %rsi
movq %rbx, -0x30(%rbp)
movzbl (%rsi), %edi
leal -0x62(%rdi), %r9d
cmpl $0x12, %r9d
ja 0x6863
movslq (%rdx,%r9,4), %rdi
addq %rdx, %rdi
jmpq *%rdi
movl (%r13), %r9d
cmpq $0x28, %r9
ja 0x6843
movq %r9, %rdi
addq 0x10(%r13), %rdi
addl $0x8, %r9d
movl %r9d, (%r13)
jmp 0x684f
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 0x6a39
cmpl $0x53, %edi
jne 0x6a39
movl (%r13), %r9d
cmpq $0x28, %r9
ja 0x6887
movq %r9, %rdi
addq 0x10(%r13), %rdi
addl $0x8, %r9d
movl %r9d, (%r13)
jmp 0x6893
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 0x6a39
movl (%r13), %r9d
cmpq $0x28, %r9
ja 0x6975
movq %r9, %rdi
addq 0x10(%r13), %rdi
addl $0x8, %r9d
movl %r9d, (%r13)
jmp 0x6981
movl (%r13), %r10d
cmpq $0x29, %r10
jae 0x69b4
movq %r12, %rbx
movq %r15, %r12
movq %r14, %r15
movq 0x10(%r13), %rdi
movq %r10, %r9
addq $0x8, %r9
movl %r9d, (%r13)
movl (%rdi,%r10), %r11d
movl %ecx, %r14d
shlq $0x4, %r14
leaq (%r8,%r14), %rdi
movl %r11d, (%r8,%r14)
cmpl $0x20, %r10d
ja 0x6a17
addq 0x10(%r13), %r9
addl $0x10, %r10d
movl %r10d, (%r13)
movq %r15, %r14
movq %r12, %r15
movq %rbx, %r12
movq -0x30(%rbp), %rbx
jmp 0x6a30
movl 0x4(%r13), %r9d
cmpq $0xa0, %r9
ja 0x69d4
movq %r9, %rdi
addq 0x10(%r13), %rdi
addl $0x10, %r9d
movl %r9d, 0x4(%r13)
jmp 0x69e0
movl 0x4(%r13), %r9d
cmpq $0xa0, %r9
ja 0x69f4
movq %r9, %rdi
addq 0x10(%r13), %rdi
addl $0x10, %r9d
movl %r9d, 0x4(%r13)
jmp 0x6a00
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 0x6a39
movq 0x8(%r13), %rdi
leaq 0x8(%rdi), %r9
movq %r9, 0x8(%r13)
movl (%rdi), %r9d
movl %ecx, %r10d
shlq $0x4, %r10
leaq (%r8,%r10), %rdi
movl %r9d, (%r8,%r10)
jmp 0x6a24
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 0x6a39
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)
jmp 0x6a39
movq %r15, %r14
movq %r12, %r15
movq %rbx, %r12
movq -0x30(%rbp), %rbx
movq 0x8(%r13), %r9
leaq 0x8(%r9), %r10
movq %r10, 0x8(%r13)
movq (%r9), %r9
movq %r9, 0x8(%rdi)
incl %ecx
incq %rsi
cmpl %eax, %ecx
jb 0x6812
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x6acf
movq -0x38(%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 0x6acf