// File: /workspace/github_cpp_makefile_star2_O2/yasz24[P]eau2/src/network/./../serialize/jsonHelper.h
// Function: JSONHelper::getArrayValueAt(char*, int)
static String* getArrayValueAt(char* s, int index) {
       int len = strlen( s );
        bool valueStarted = false;
        char objStart = '{';
        char objEnd = '}';
        int startCharDepth = 0;
        char buff[len];
        int loc = 0;
        int currIndex = 0;
        //pull the top level object-value from the serialzed string
        for (int i = 0; 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 = '\'';
                        startCharDepth = 0;
                        //due to issue with indexing with apostrophes
                        currIndex = -1;
                    }   
                }
            } else if(temp == objStart) {
                startCharDepth++;
            }

            if(temp == objEnd && valueStarted) {
                if(temp != objStart) {
                    startCharDepth--;
                }
                if(index == currIndex && objEnd != objStart) {
                    buff[loc] = temp;
                    loc++;
                }
                //if we've reached the final level of end character, break out of loop
                if(startCharDepth <= 0  || (temp == objStart && startCharDepth % 2 == 0)) {
                    currIndex++;
                    if(currIndex > index) {
                        break;
                    }
                }
            } else if(valueStarted && index == currIndex) {
                if(objStart != objEnd || startCharDepth % 2 == 0) {
                    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
movl %esi, %r14d
movq %rdi, %r15
callq 0x7110
movl %eax, %ecx
movq %rsp, %rdx
addq $0xf, %rcx
andq $-0x10, %rcx
subq %rcx, %rdx
movq %rdx, -0x30(%rbp)
movq %rdx, %rsp
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
movb $0x7b, %r8b
movb $0x7d, %r9b
xorl %r11d, %r11d
xorl %edi, %edi
xorl %r10d, %r10d
xorl %r12d, %r12d
cmpq %rcx, %rax
je 0xc5f1
movb (%r15,%rcx), %r13b
movslq %edi, %rdx
testb $0x1, %r12b
je 0xc53c
xorl %esi, %esi
cmpb %r8b, %r13b
sete %sil
addl %esi, %r10d
cmpb %r9b, %r13b
jne 0xc564
movl %r12d, %esi
jmp 0xc5a7
movzbl %r13b, %ebx
movb $0x1, %sil
cmpl $0x27, %ebx
je 0xc59a
cmpl $0x7b, %ebx
je 0xc557
cmpl $0x5b, %ebx
jne 0xc564
movb $0x5d, %r9b
jmp 0xc55a
movb $0x7d, %r9b
movb $0x1, %r12b
movl %r13d, %r8d
pushq $0x1
popq %r10
cmpl %r14d, %r11d
sete %sil
andb %r12b, %sil
cmpb $0x1, %sil
jne 0xc5e9
cmpb %r9b, %r8b
jne 0xc589
movl %r10d, %esi
andl $0x1, %esi
je 0xc589
movl %r14d, %r11d
movl %r8d, %r9d
jmp 0xc5e9
movq -0x30(%rbp), %rsi
movb %r13b, (%rsi,%rdx)
incl %edx
movl %edx, %edi
movl %r14d, %r11d
jmp 0xc5e9
xorl %r10d, %r10d
pushq $-0x1
popq %r11
movl %r13d, %r9d
movl %r13d, %r8d
xorl %r12d, %r12d
cmpb %r8b, %r13b
setne %bl
cmpl %r14d, %r11d
jne 0xc5c6
cmpb %r8b, %r9b
je 0xc5c6
movq -0x30(%rbp), %rdi
movb %r13b, (%rdi,%rdx)
incl %edx
movl %edx, %edi
movb %bl, %r12b
subl %r12d, %r10d
testl %r10d, %r10d
jle 0xc5de
cmpb %r8b, %r13b
jne 0xc5e6
movl %r10d, %edx
andl $0x1, %edx
jne 0xc5e6
cmpl %r14d, %r11d
jge 0xc5f1
incl %r11d
movl %esi, %r12d
incq %rcx
jmp 0xc510
movslq %edi, %rax
movq -0x30(%rbp), %rbx
movb $0x0, (%rbx,%rax)
pushq $0x20
popq %rdi
callq 0x7250
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x8e1e
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 0x7220
movq %rbx, %rdi
callq 0x7390