// File: /workspace/github_c_makefile_star2_O0/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
subq $0x4020, %rsp           # imm = 0x4020
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x4014(%rbp)
movq -0x10(%rbp), %rax
movsbl 0x9(%rax), %eax
cmpl $0x76, %eax
je 0x4b70
movq -0x10(%rbp), %rax
movb 0x9(%rax), %al
movb %al, -0x4016(%rbp)
movb $0x0, -0x4015(%rbp)
movq -0x10(%rbp), %rax
movsbl 0x9(%rax), %edi
callq 0x3fa0
cmpl $0x0, %eax
je 0x4b22
jmp 0x4b41
leaq 0x79ca(%rip), %rdi      # 0xc4f3
leaq 0x76df(%rip), %rsi      # 0xc20f
movl $0x23d, %edx            # imm = 0x23D
leaq 0x79ce(%rip), %rcx      # 0xc50a
callq 0x2120
leaq -0x4010(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq -0x4016(%rbp), %rcx
movq -0x10(%rbp), %r8
addq $0x20, %r8
movl $0x4000, %esi           # imm = 0x4000
callq 0x8f70
movl %eax, -0x4014(%rbp)
jmp 0x4b9e
leaq -0x4010(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x28(%rax), %r8
movl $0x4000, %esi           # imm = 0x4000
callq 0x8f70
movl %eax, -0x4014(%rbp)
cmpl $0x0, -0x4014(%rbp)
jne 0x4c7b
movq -0x10(%rbp), %rax
movq (%rax), %rsi
leaq 0x7981(%rip), %rdi      # 0xc53a
movb $0x0, %al
callq 0x20e0
movq -0x10(%rbp), %rax
movsbl 0x9(%rax), %eax
cmpl $0x76, %eax
je 0x4c3e
movq -0x10(%rbp), %rax
movb 0x9(%rax), %al
movb %al, -0x4018(%rbp)
movb $0x0, -0x4017(%rbp)
movq -0x10(%rbp), %rax
movsbl 0x9(%rax), %edi
callq 0x3fa0
cmpl $0x0, %eax
je 0x4bf5
jmp 0x4c14
leaq 0x78f7(%rip), %rdi      # 0xc4f3
leaq 0x760c(%rip), %rsi      # 0xc20f
movl $0x249, %edx            # imm = 0x249
leaq 0x78fb(%rip), %rcx      # 0xc50a
callq 0x2120
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq -0x4018(%rbp), %rcx
movq -0x10(%rbp), %r8
addq $0x20, %r8
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0x8f70
movl %eax, -0x4014(%rbp)
jmp 0x4c67
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x28(%rax), %r8
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0x8f70
movl %eax, -0x4014(%rbp)
movl -0x4014(%rbp), %esi
leaq 0x7696(%rip), %rdi      # 0xc30a
movb $0x0, %al
callq 0x20e0
movl $0x0, -0x401c(%rbp)
movl -0x401c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x128(%rcx), %eax
jge 0x4d21
movq -0x8(%rbp), %rax
movq 0x110(%rax), %rax
movslq -0x401c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x21a0
cmpl $0x0, %eax
jne 0x4d0b
movq -0x8(%rbp), %rax
movq 0x110(%rax), %rax
movslq -0x401c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
leaq -0x4010(%rbp), %rdi
movq -0x8(%rbp), %rcx
movq 0x110(%rcx), %rcx
movslq -0x401c(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movq 0x10(%rcx), %rsi
callq *%rax
jmp 0x4d0d
movl -0x401c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x401c(%rbp)
jmp 0x4c85
addq $0x4020, %rsp           # imm = 0x4020
popq %rbp
retq
nopw (%rax,%rax)