// File: jgeumlek[P]moltengamepadctl/source/oscpkt/oscpkt.hh
// Function: oscpkt::Message::buildFromRawData(void const*, unsigned long)
void buildFromRawData(const void *ptr, size_t sz) {
    clear();
    storage.assign((const char*)ptr, (const char*)ptr + sz);
    const char *address_beg = storage.begin();
    const char *address_end = (const char*)memchr(address_beg, 0, storage.end()-address_beg);
    if (!address_end || !isZeroPaddingCorrect(address_end+1) || address_beg[0] != '/') { 
      OSCPKT_SET_ERR(MALFORMED_ADDRESS_PATTERN); return; 
    } else address.assign(address_beg, address_end);

    const char *type_tags_beg = ceil4(address_end+1);
    const char *type_tags_end = (const char*)memchr(type_tags_beg, 0, storage.end()-type_tags_beg);
    if (!type_tags_end || !isZeroPaddingCorrect(type_tags_end+1) || type_tags_beg[0] != ',') { 
      OSCPKT_SET_ERR(MALFORMED_TYPE_TAGS); return; 
    } else type_tags.assign(type_tags_beg+1, type_tags_end); // we do not copy the initial ','

    const char *arg = ceil4(type_tags_end+1); assert(arg <= storage.end()); 
    size_t iarg = 0;
    while (isOk() && iarg < type_tags.size()) {
      assert(arg <= storage.end()); 
      size_t len = getArgSize(type_tags[iarg], arg);
      if (isOk()) arguments.push_back(std::make_pair(arg - storage.begin(), len));
      arg += ceil4(len); ++iarg;
    }
    if (iarg < type_tags.size() || arg != storage.end()) {
      OSCPKT_SET_ERR(MALFORMED_ARGUMENTS);
    }
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0x6f70
movq -0x88(%rbp), %rdi
addq $0x60, %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rdx
addq -0x18(%rbp), %rdx
callq 0x9d30
movq -0x88(%rbp), %rdi
addq $0x60, %rdi
callq 0x89f0
movq -0x88(%rbp), %rdi
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x80(%rbp)
addq $0x60, %rdi
callq 0x9d60
movq -0x80(%rbp), %rdi
movq %rax, %rdx
movq -0x20(%rbp), %rax
subq %rax, %rdx
xorl %esi, %esi
callq 0x3300
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x99ee
movq -0x28(%rbp), %rdi
addq $0x1, %rdi
callq 0x9da0
testb $0x1, %al
jne 0x99e2
jmp 0x99ee
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0x9a12
jmp 0x99f0
movq -0x88(%rbp), %rax
cmpl $0x0, 0x78(%rax)
jne 0x9a0b
movq -0x88(%rbp), %rax
movl $0x1, 0x78(%rax)
jmp 0x9a0d
jmp 0x9d24
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x9e00
movq -0x28(%rbp), %rdi
addq $0x1, %rdi
callq 0x9e70
movq -0x88(%rbp), %rdi
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x90(%rbp)
addq $0x60, %rdi
callq 0x9d60
movq -0x90(%rbp), %rdi
movq %rax, %rdx
movq -0x30(%rbp), %rax
subq %rax, %rdx
xorl %esi, %esi
callq 0x3300
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x9a98
movq -0x38(%rbp), %rdi
addq $0x1, %rdi
callq 0x9da0
testb $0x1, %al
jne 0x9a8c
jmp 0x9a98
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
je 0x9abc
jmp 0x9a9a
movq -0x88(%rbp), %rax
cmpl $0x0, 0x78(%rax)
jne 0x9ab5
movq -0x88(%rbp), %rax
movl $0x2, 0x78(%rax)
jmp 0x9ab7
jmp 0x9d24
movq -0x88(%rbp), %rdi
addq $0x28, %rdi
movq -0x30(%rbp), %rsi
addq $0x1, %rsi
movq -0x38(%rbp), %rdx
callq 0x9e00
movq -0x38(%rbp), %rdi
addq $0x1, %rdi
callq 0x9e70
movq -0x88(%rbp), %rdi
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x98(%rbp)
addq $0x60, %rdi
callq 0x9d60
movq %rax, %rcx
movq -0x98(%rbp), %rax
cmpq %rcx, %rax
ja 0x9b15
jmp 0x9b34
leaq 0x4932(%rip), %rdi      # 0xe44e
leaq 0x4832(%rip), %rsi      # 0xe355
movl $0x17b, %edx            # imm = 0x17B
leaq 0x4934(%rip), %rcx      # 0xe463
callq 0x31d0
movq $0x0, -0x48(%rbp)
movq -0x88(%rbp), %rdi
callq 0x8750
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x99(%rbp)
jne 0x9b59
jmp 0x9b8a
movq -0x88(%rbp), %rdi
movq -0x48(%rbp), %rax
movq %rax, -0xa8(%rbp)
addq $0x28, %rdi
callq 0x31f0
movq %rax, %rcx
movq -0xa8(%rbp), %rax
cmpq %rcx, %rax
setb %al
movb %al, -0x99(%rbp)
movb -0x99(%rbp), %al
testb $0x1, %al
jne 0x9b99
jmp 0x9caf
movq -0x88(%rbp), %rdi
movq -0x40(%rbp), %rax
movq %rax, -0xb0(%rbp)
addq $0x60, %rdi
callq 0x9d60
movq %rax, %rcx
movq -0xb0(%rbp), %rax
cmpq %rcx, %rax
ja 0x9bc5
jmp 0x9be4
leaq 0x4882(%rip), %rdi      # 0xe44e
leaq 0x4782(%rip), %rsi      # 0xe355
movl $0x17e, %edx            # imm = 0x17E
leaq 0x4884(%rip), %rcx      # 0xe463
callq 0x31d0
movq -0x88(%rbp), %rdi
addq $0x28, %rdi
movq -0x48(%rbp), %rsi
callq 0x34d0
movq -0x88(%rbp), %rdi
movsbl (%rax), %esi
movq -0x40(%rbp), %rdx
callq 0x9e90
movq -0x88(%rbp), %rdi
movq %rax, -0x50(%rbp)
callq 0x8750
testb $0x1, %al
jne 0x9c21
jmp 0x9c8d
movq -0x88(%rbp), %rdi
movq %rdi, %rax
addq $0x48, %rax
movq %rax, -0xb8(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0xc0(%rbp)
addq $0x60, %rdi
callq 0x89f0
movq %rax, %rcx
movq -0xc0(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x78(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xa110
movq %rax, -0x70(%rbp)
movq %rdx, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xa140
movq -0xb8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x7a90
movq -0x50(%rbp), %rdi
callq 0x8460
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x9b3c
movq -0x88(%rbp), %rdi
movq -0x48(%rbp), %rax
movq %rax, -0xc8(%rbp)
addq $0x28, %rdi
callq 0x31f0
movq %rax, %rcx
movq -0xc8(%rbp), %rax
cmpq %rcx, %rax
jb 0x9d03
movq -0x88(%rbp), %rdi
movq -0x40(%rbp), %rax
movq %rax, -0xd0(%rbp)
addq $0x60, %rdi
callq 0x9d60
movq %rax, %rcx
movq -0xd0(%rbp), %rax
cmpq %rcx, %rax
je 0x9d24
jmp 0x9d05
movq -0x88(%rbp), %rax
cmpl $0x0, 0x78(%rax)
jne 0x9d20
movq -0x88(%rbp), %rax
movl $0x3, 0x78(%rax)
jmp 0x9d22
jmp 0x9d24
addq $0xd0, %rsp
popq %rbp
retq
nopl (%rax)