// File: /workspace/github_cpp_makefile_star2_O1/yasz24[P]eau2/src/network/./../serialize/jsonHelper.h
// Function: JSONHelper::getPayloadValue(char*)
static String* getPayloadValue(char* s) {
        int len = strlen( s );
        bool valueStarted = false;
        char objStart = '{';
        char objEnd = '}';
        int startCharDepth = 0;
        char buff[len];
        int loc = 0;
        //find first colon as jumping off point:
        int colonIndex = 0;
        for(int i = 0; i < len; i++) {
            char temp=s[i];
            if(temp == ':') {
                colonIndex = i;
                break;
            }
        }
        //pull the top level object-value from the serialzed string
        for (int i = colonIndex; i < len; i++){
            char temp = s[i];
            if(!valueStarted) {
                //the three ways a payload in our JSON can start, will rely on this to know what character closes the value
                //also keeps track of depth if there are nested objects
                if(temp == '{' || temp == '[' || temp == '\'') {
                    objStart = temp;
                    startCharDepth = 1;
                    valueStarted = true;
                    if(temp == '{') {
                        objEnd = '}';
                    } else if(temp == '[') {
                        objEnd = ']';
                    } else if(temp == '\'') {
                        objEnd = '\'';
                    }   
                }
            } else if(temp == objStart && temp != objEnd && valueStarted) {
                startCharDepth++;
                buff[loc] = temp;
                loc++;
            } else if(temp == objEnd && valueStarted) {
                startCharDepth--;
                //if we've reached the final level of end character, break out of loop
                if(startCharDepth <= 0) {
                    break;
                }
                buff[loc] = temp;
                loc++;
            } else if(valueStarted) {
                buff[loc] = temp;
                loc++;
            }
        }
        buff[loc] = '\0';
        char* classValue = buff;
        String* str = new String(classValue);
        return str;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x7100
movl %eax, %ecx
movq %rsp, %rbx
addq $0xf, %rcx
andq $-0x10, %rcx
subq %rcx, %rbx
movq %rbx, %rsp
testl %eax, %eax
jle 0xca48
movl %eax, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
decq %rdx
xorl %esi, %esi
xorl %ecx, %ecx
cmpb $0x3a, (%r14,%rsi)
movl %ecx, %edi
movl %esi, %ecx
cmovnel %edi, %ecx
je 0xca4a
leaq 0x1(%rsi), %rdi
cmpq %rsi, %rdx
movq %rdi, %rsi
jne 0xca2c
jmp 0xca4a
xorl %ecx, %ecx
xorl %edx, %edx
cmpl %eax, %ecx
jge 0xcb13
movslq %ecx, %rsi
notl %ecx
addl %eax, %ecx
addq %rsi, %r14
movb $0x7d, %sil
movb $0x7b, %r9b
xorl %eax, %eax
xorl %r8d, %r8d
xorl %edi, %edi
movb (%r14,%rax), %r11b
testb $0x1, %r8b
je 0xcaaa
cmpb %r9b, %r11b
setne %r10b
cmpb %sil, %r11b
sete %r15b
orb %r10b, %r15b
je 0xcac8
cmpb %sil, %r11b
jne 0xcadb
leal -0x1(%rdx), %r15d
movb $0x1, %r10b
cmpl $0x2, %edx
jl 0xcaa5
movslq %edi, %rdx
movb %r11b, (%rbx,%rdx)
incl %edi
xorl %r10d, %r10d
movl %r15d, %edx
jmp 0xcafa
movzbl %r11b, %r10d
cmpl $0x27, %r10d
je 0xcae9
cmpl $0x5b, %r10d
je 0xcad3
cmpl $0x7b, %r10d
jne 0xcae4
movb $0x1, %r8b
movb $0x7d, %sil
jmp 0xcaef
incl %edx
movslq %edi, %rdi
movb %r11b, (%rbx,%rdi)
jmp 0xcae2
movb $0x1, %r8b
movb $0x5d, %sil
jmp 0xcaef
movslq %edi, %r10
movb %r11b, (%rbx,%r10)
incl %edi
xorl %r10d, %r10d
jmp 0xcafa
movb $0x1, %r8b
movb $0x27, %sil
movl $0x1, %edx
xorl %r10d, %r10d
movl %r11d, %r9d
testb %r10b, %r10b
jne 0xcb10
movq %rax, %r10
incq %r10
cmpl %eax, %ecx
movq %r10, %rax
jne 0xca6b
movslq %edi, %rdx
movb $0x0, (%rbx,%rdx)
movl $0x20, %edi
callq 0x7230
movq %rax, %r14
movq %rbx, %rdi
callq 0x7100
movq %rax, %r15
movq $0x0, 0x8(%r14)
leaq 0x1b91a(%rip), %rax     # 0x28458
movq %rax, (%r14)
movq %r15, 0x10(%r14)
leaq 0x1(%r15), %r12
movq %r12, %rdi
callq 0x7030
movq %rax, %r13
movq %rax, 0x18(%r14)
movq %rax, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x71a0
movb $0x0, (%r13,%r15)
movq %r14, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x7200
movq %rbx, %rdi
callq 0x73b0
nop