// File: /workspace/github_c_makefile_star2_O1/mruby-zest[P]osc-bridge/test/mock-test.c
// Function: osc_request_hook_fn
int osc_request_hook_fn(bridge_t *br, const char *msg)
{
    // /schema        - return the schema file
    // /part0/Pvolume - return the volume
    char *buffer = NULL;

    const char *args = rtosc_argument_string(msg);
    //printf("[REQUEST] osc_request_hook_fn(%p,%s,%s)\n", br, msg,args);
    if(!strcmp(msg, "/schema") && !strcmp(args, "")) {
        size_t buf_size = rtosc_message(NULL, 0, "/schema", "s", "");
        buffer = malloc(buf_size);
        rtosc_message(buffer, buf_size, "/schema", "s", "");
        br_recv(br, buffer);
    } else if(!strcmp(msg, "/part0/Pvolume") && !strcmp(args, "")) {
        size_t buf_size = rtosc_message(NULL, 0, "/part0/Pvolume", "i", 32);
        buffer = malloc(buf_size);
        rtosc_message(buffer, 128, "/part0/Pvolume", "i", 32);
        br_recv(br, buffer);
    } else if(!strcmp(msg, "/part0/Penabled") && !strcmp(args, "")) {
        size_t buf_size = rtosc_message(NULL, 0, "/part0/Penabled", "T");
        buffer = malloc(buf_size);
        rtosc_message(buffer, buf_size, "/part0/Penabled", "T");
        br_recv(br, buffer);
    } else if(!strcmp(msg, "/vector/test")) {
        //do nothing
    } else {
        printf("[ERROR] unexpected message...\n");
        assert(false);
        return 0;
    }

    //TODO send the message

    free(buffer);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x6720
movq %rax, %r15
leaq 0x1b25(%rip), %rsi      # 0x9e1e
movq %r14, %rdi
callq 0x2190
testl %eax, %eax
jne 0x830b
cmpb $0x0, (%r15)
je 0x8364
leaq 0x1b14(%rip), %rsi      # 0x9e26
movq %r14, %rdi
callq 0x2190
testl %eax, %eax
jne 0x8328
cmpb $0x0, (%r15)
je 0x83b7
leaq 0x1b06(%rip), %rsi      # 0x9e35
movq %r14, %rdi
callq 0x2190
testl %eax, %eax
jne 0x8345
cmpb $0x0, (%r15)
je 0x8404
leaq 0x1afb(%rip), %rsi      # 0x9e47
movq %r14, %rdi
callq 0x2190
testl %eax, %eax
jne 0x8468
xorl %r14d, %r14d
jmp 0x844f
leaq 0x1ab3(%rip), %rdx      # 0x9e1e
leaq 0xde8(%rip), %r12       # 0x915a
leaq 0x1033(%rip), %r13      # 0x93ac
xorl %edi, %edi
xorl %esi, %esi
movq %r12, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x67f8
movq %rax, %r15
movq %rax, %rdi
callq 0x21f0
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
leaq 0x1a79(%rip), %rdx      # 0x9e1e
movq %r12, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x67f8
jmp 0x8444
leaq 0x1a68(%rip), %r15      # 0x9e26
leaq 0xdc4(%rip), %r12       # 0x9189
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
movl $0x20, %r8d
xorl %eax, %eax
callq 0x67f8
movq %rax, %rdi
callq 0x21f0
movq %rax, %r14
movl $0x80, %esi
movq %rax, %rdi
movq %r15, %rdx
movq %r12, %rcx
movl $0x20, %r8d
xorl %eax, %eax
callq 0x67f8
jmp 0x8444
leaq 0x1a2a(%rip), %r15      # 0x9e35
leaq 0x1a33(%rip), %r12      # 0x9e45
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x67f8
movq %rax, %r13
movq %rax, %rdi
callq 0x21f0
movq %rax, %r14
movq %rax, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x67f8
movq %rbx, %rdi
movq %r14, %rsi
callq 0x24de
movq %r14, %rdi
callq 0x2030
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1d17(%rip), %rdi      # 0xa186
callq 0x2080
leaq 0x19d9(%rip), %rdi      # 0x9e54
leaq 0x19d8(%rip), %rsi      # 0x9e5a
leaq 0x19e2(%rip), %rcx      # 0x9e6b
movl $0x30, %edx
callq 0x2120