// File: /workspace/github_c_makefile_star2_O3/mruby-zest[P]osc-bridge/src/bridge.c
// Function: run_callbacks
static void
run_callbacks(bridge_t *br, param_cache_t *line)
{
    char buffer[1024*16];
    int len = 0;
    if(line->type != 'v') {
        char args[2] = {line->type, 0};
        assert(valid_type(line->type));
        len = rtosc_amessage(buffer, sizeof(buffer), line->path, args, &line->val);
    } else {
        len = rtosc_amessage(buffer, sizeof(buffer), line->path, line->vec_type,
                line->vec_value);
    }

    if(len == 0) {
        //TODO USE DYNAMIC ALLOCATION...
        printf("[ERROR] Message Too long for cache line <%s>\n", line->path);
        if(line->type != 'v') {
            char args[2] = {line->type, 0};
            assert(valid_type(line->type));
            len = rtosc_amessage(0, 0, line->path, args, &line->val);
        } else {
            len = rtosc_amessage(0, 0, line->path, line->vec_type,
                    line->vec_value);
        }
        printf("[ERROR] Needs %d bytes of space...\n", len);
    }


    //run callbacks
    for(int i=0; i<br->callback_len; ++i)
        if(!strcmp(br->callback[i].path, line->path))
            br->callback[i].cb(buffer, br->callback[i].data);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4018, %rsp           # imm = 0x4018
movq %rsi, %r14
movq %rdi, -0x38(%rbp)
movzbl 0x9(%rsi), %eax
cmpl $0x76, %eax
jne 0x3f8e
movq (%r14), %rdx
movq 0x20(%r14), %rcx
movq 0x28(%r14), %r8
leaq -0x4040(%rbp), %rdi
jmp 0x3fc7
movb %al, -0x2a(%rbp)
movb $0x0, -0x29(%rbp)
addl $-0x46, %eax
cmpl $0x2e, %eax
ja 0x40b9
movabsq $0x708d70006109, %rcx   # imm = 0x708D70006109
btq %rax, %rcx
jae 0x40b9
movq (%r14), %rdx
leaq 0x20(%r14), %r8
leaq -0x4040(%rbp), %rdi
leaq -0x2a(%rbp), %rcx
movl $0x4000, %esi           # imm = 0x4000
callq 0x6acf
testl %eax, %eax
jne 0x4048
movq (%r14), %rsi
leaq 0x5415(%rip), %rdi      # 0x93f4
xorl %eax, %eax
callq 0x20f0
movzbl 0x9(%r14), %eax
cmpl $0x76, %eax
jne 0x3ffd
movq (%r14), %rdx
movq 0x20(%r14), %rcx
movq 0x28(%r14), %r8
jmp 0x402f
movb %al, -0x2a(%rbp)
movb $0x0, -0x29(%rbp)
addl $-0x46, %eax
cmpl $0x2e, %eax
ja 0x40d8
movabsq $0x708d70006109, %rcx   # imm = 0x708D70006109
btq %rax, %rcx
jae 0x40d8
movq (%r14), %rdx
leaq 0x20(%r14), %r8
leaq -0x2a(%rbp), %rcx
xorl %edi, %edi
xorl %esi, %esi
callq 0x6acf
leaq 0x51d4(%rip), %rdi      # 0x9213
movl %eax, %esi
xorl %eax, %eax
callq 0x20f0
movq -0x38(%rbp), %rax
movl 0x128(%rax), %r15d
testl %r15d, %r15d
jle 0x40a7
movl $0x10, %r12d
xorl %r13d, %r13d
movq -0x38(%rbp), %rax
movq 0x110(%rax), %rbx
movq -0x10(%rbx,%r12), %rdi
movq (%r14), %rsi
callq 0x21a0
testl %eax, %eax
jne 0x4098
movq (%rbx,%r12), %rsi
leaq -0x4040(%rbp), %rdi
callq *-0x8(%rbx,%r12)
movq -0x38(%rbp), %rax
movl 0x128(%rax), %r15d
incq %r13
movslq %r15d, %rax
addq $0x18, %r12
cmpq %rax, %r13
jl 0x4061
addq $0x4018, %rsp           # imm = 0x4018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x52ed(%rip), %rdi      # 0x93ad
leaq 0x50b5(%rip), %rsi      # 0x917c
leaq 0x52f6(%rip), %rcx      # 0x93c4
movl $0x23d, %edx            # imm = 0x23D
callq 0x2130
leaq 0x52ce(%rip), %rdi      # 0x93ad
leaq 0x5096(%rip), %rsi      # 0x917c
leaq 0x52d7(%rip), %rcx      # 0x93c4
movl $0x249, %edx            # imm = 0x249
callq 0x2130