// File: /workspace/github_c_makefile_star2_O1/baskerville[P]bspwm/src/jsmn.c
// Function: jsmn_parse
int jsmn_parse(jsmn_parser *parser, const char *js, size_t len,
		jsmntok_t *tokens, unsigned int num_tokens) {
	int r;
	int i;
	jsmntok_t *token;
	int count = parser->toknext;

	for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) {
		char c;
		jsmntype_t type;

		c = js[parser->pos];
		switch (c) {
			case '{': case '[':
				count++;
				if (tokens == NULL) {
					break;
				}
				token = jsmn_alloc_token(parser, tokens, num_tokens);
				if (token == NULL)
					return JSMN_ERROR_NOMEM;
				if (parser->toksuper != -1) {
					tokens[parser->toksuper].size++;
#ifdef JSMN_PARENT_LINKS
					token->parent = parser->toksuper;
#endif
				}
				token->type = (c == '{' ? JSMN_OBJECT : JSMN_ARRAY);
				token->start = parser->pos;
				parser->toksuper = parser->toknext - 1;
				break;
			case '}': case ']':
				if (tokens == NULL)
					break;
				type = (c == '}' ? JSMN_OBJECT : JSMN_ARRAY);
#ifdef JSMN_PARENT_LINKS
				if (parser->toknext < 1) {
					return JSMN_ERROR_INVAL;
				}
				token = &tokens[parser->toknext - 1];
				for (;;) {
					if (token->start != -1 && token->end == -1) {
						if (token->type != type) {
							return JSMN_ERROR_INVAL;
						}
						token->end = parser->pos + 1;
						parser->toksuper = token->parent;
						break;
					}
					if (token->parent == -1) {
						if(token->type != type || parser->toksuper == -1) {
							return JSMN_ERROR_INVAL;
						}
						break;
					}
					token = &tokens[token->parent];
				}
#else
				for (i = parser->toknext - 1; i >= 0; i--) {
					token = &tokens[i];
					if (token->start != -1 && token->end == -1) {
						if (token->type != type) {
							return JSMN_ERROR_INVAL;
						}
						parser->toksuper = -1;
						token->end = parser->pos + 1;
						break;
					}
				}
				/* Error if unmatched closing bracket */
				if (i == -1) return JSMN_ERROR_INVAL;
				for (; i >= 0; i--) {
					token = &tokens[i];
					if (token->start != -1 && token->end == -1) {
						parser->toksuper = i;
						break;
					}
				}
#endif
				break;
			case '\"':
				r = jsmn_parse_string(parser, js, len, tokens, num_tokens);
				if (r < 0) return r;
				count++;
				if (parser->toksuper != -1 && tokens != NULL)
					tokens[parser->toksuper].size++;
				break;
			case '\t' : case '\r' : case '\n' : case ' ':
				break;
			case ':':
				parser->toksuper = parser->toknext - 1;
				break;
			case ',':
				if (tokens != NULL && parser->toksuper != -1 &&
						tokens[parser->toksuper].type != JSMN_ARRAY &&
						tokens[parser->toksuper].type != JSMN_OBJECT) {
#ifdef JSMN_PARENT_LINKS
					parser->toksuper = tokens[parser->toksuper].parent;
#else
					for (i = parser->toknext - 1; i >= 0; i--) {
						if (tokens[i].type == JSMN_ARRAY || tokens[i].type == JSMN_OBJECT) {
							if (tokens[i].start != -1 && tokens[i].end == -1) {
								parser->toksuper = i;
								break;
							}
						}
					}
#endif
				}
				break;
#ifdef JSMN_STRICT
			/* In strict mode primitives are: numbers and booleans */
			case '-': case '0': case '1' : case '2': case '3' : case '4':
			case '5': case '6': case '7' : case '8': case '9':
			case 't': case 'f': case 'n' :
				/* And they must not be keys of the object */
				if (tokens != NULL && parser->toksuper != -1) {
					jsmntok_t *t = &tokens[parser->toksuper];
					if (t->type == JSMN_OBJECT ||
							(t->type == JSMN_STRING && t->size != 0)) {
						return JSMN_ERROR_INVAL;
					}
				}
#else
			/* In non-strict mode every unquoted value is a primitive */
			default:
#endif
				r = jsmn_parse_primitive(parser, js, len, tokens, num_tokens);
				if (r < 0) return r;
				count++;
				if (parser->toksuper != -1 && tokens != NULL)
					tokens[parser->toksuper].size++;
				break;

#ifdef JSMN_STRICT
			/* Unexpected char in strict mode */
			default:
				return JSMN_ERROR_INVAL;
#endif
		}
	}

	if (tokens != NULL) {
		for (i = parser->toknext - 1; i >= 0; i--) {
			/* Unmatched opened object or array */
			if (tokens[i].start != -1 && tokens[i].end == -1) {
				return JSMN_ERROR_PART;
			}
		}
	}

	return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl (%rdi), %eax
movl 0x4(%rdi), %r9d
cmpq %rdx, %rax
jae 0x694b
leaq 0x8(%rcx), %r10
movq %r10, -0x10(%rsp)
movl %eax, %r14d
movb (%rsi,%rax), %r12b
movzbl %r12b, %r13d
movb $0x1, %bpl
cmpl $0x2b, %r13d
jle 0x647a
cmpl $0x5c, %r13d
jg 0x6643
cmpl $0x2c, %r13d
je 0x678c
cmpl $0x3a, %r13d
je 0x683d
movl %r14d, %r11d
cmpl $0x5b, %r13d
je 0x674d
jmp 0x66d6
cmpl $0xc, %r13d
jle 0x66bc
cmpl $0xd, %r13d
je 0x6934
cmpl $0x20, %r13d
je 0x6934
movl %r14d, %r11d
cmpl $0x22, %r13d
jne 0x66d6
leal 0x1(%r14), %r13d
movl %r13d, (%rdi)
cmpq %rdx, %r13
jae 0x6801
movq %r13, %r10
movl %r13d, %r12d
movq %r13, -0x8(%rsp)
movzbl (%rsi,%r10), %r10d
cmpl $0x22, %r10d
je 0x6590
movb $0x1, %r11b
cmpl $0x5c, %r10d
je 0x64e6
testl %r10d, %r10d
jne 0x6610
jmp 0x6801
leal 0x1(%r12), %r15d
cmpq %rdx, %r15
jae 0x6610
movl %r15d, (%rdi)
movzbl (%rsi,%r15), %r10d
leal -0x2f(%r10), %ebx
cmpl $0x37, %ebx
jbe 0x65f4
leal -0x6e(%r10), %ebx
cmpl $0x7, %ebx
ja 0x6630
leaq 0x18ecb(%rip), %r13     # 0x1f3e8
movslq (%r13,%rbx,4), %r10
addq %r13, %r10
movq -0x8(%rsp), %r13
jmpq *%r10
addl $0x2, %r12d
movl %r12d, (%rdi)
movl $0x4, %r15d
movl %r12d, %r10d
cmpq %rdx, %r10
jae 0x6585
movb (%rsi,%r10), %r10b
testb %r10b, %r10b
je 0x6585
leal -0x30(%r10), %ebx
cmpb $0xa, %bl
jb 0x657a
movzbl %r10b, %r10d
addl $-0x41, %r10d
cmpl $0x25, %r10d
ja 0x6639
movabsq $0x3f0000003f, %rbx     # imm = 0x3F0000003F
btq %r10, %rbx
jae 0x6639
incl %r12d
movl %r12d, (%rdi)
decl %r15d
jne 0x653a
decl %r12d
movl %r12d, (%rdi)
jmp 0x6610
testq %rcx, %rcx
je 0x65dd
movl 0x4(%rdi), %r10d
cmpl %r8d, %r10d
jae 0x65c1
leal 0x1(%r10), %eax
movl %eax, 0x4(%rdi)
shlq $0x4, %r10
leaq (%rcx,%r10), %rax
movq $-0x1, 0x4(%rcx,%r10)
movl $0x0, 0xc(%rcx,%r10)
jmp 0x65c3
xorl %eax, %eax
testq %rax, %rax
je 0x65e4
movl $0x3, (%rax)
movl %r13d, 0x4(%rax)
movl %r12d, 0x8(%rax)
movl $0x0, 0xc(%rax)
xorl %eax, %eax
xorl %r11d, %r11d
jmp 0x6610
movl %r14d, (%rdi)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %r11d, %r11d
movl %r14d, %r12d
jmp 0x6610
movabsq $0x88200000000001, %r13 # imm = 0x88200000000001
btq %rbx, %r13
movq -0x8(%rsp), %r13
jae 0x6509
movl %r15d, %r12d
testb %r11b, %r11b
je 0x68e6
incl %r12d
movl %r12d, (%rdi)
movq %r12, %r10
cmpq %rdx, %r12
jb 0x64c0
jmp 0x6801
movl %r15d, %r12d
cmpl $0x22, %r10d
je 0x6610
movl %r14d, (%rdi)
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x65ec
cmpl $0x5d, %r13d
je 0x665c
cmpl $0x7b, %r13d
je 0x674d
movl %r14d, %r11d
cmpl $0x7d, %r13d
jne 0x66d6
testq %rcx, %rcx
je 0x6934
xorl %r11d, %r11d
cmpb $0x7d, %r12b
setne %r10b
movl 0x4(%rdi), %eax
movl %eax, %r12d
decl %r12d
js 0x686c
movb %r10b, %r11b
incl %r11d
movl %r12d, %r15d
leaq 0x1(%r15), %rax
shlq $0x4, %r15
addq -0x10(%rsp), %r15
cmpl $-0x1, -0x4(%r15)
je 0x66a6
cmpl $-0x1, (%r15)
je 0x6854
addq $-0x10, %r15
decq %rax
jg 0x6695
xorl %eax, %eax
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x686c
leal -0x9(%r13), %r10d
cmpl $0x2, %r10d
jb 0x6934
movl %r14d, %r11d
testl %r13d, %r13d
je 0x694b
movzbl (%rsi,%rax), %eax
cmpq $0x3a, %rax
ja 0x66f0
movabsq $0x400100100002601, %r10 # imm = 0x400100100002601
btq %rax, %r10
jb 0x6712
cmpl $0x5d, %eax
je 0x6712
cmpl $0x7d, %eax
je 0x6712
addb $-0x7f, %al
cmpb $-0x5f, %al
jb 0x691e
incl %r11d
movl %r11d, (%rdi)
movq %r11, %rax
cmpq %rdx, %r11
jb 0x66d6
testq %rcx, %rcx
je 0x68d9
movl 0x4(%rdi), %eax
cmpl %r8d, %eax
jae 0x68ba
leal 0x1(%rax), %r10d
movl %r10d, 0x4(%rdi)
shlq $0x4, %rax
leaq (%rcx,%rax), %r10
movq $-0x1, 0x4(%rcx,%rax)
movl $0x0, 0xc(%rcx,%rax)
jmp 0x68bd
incl %r9d
testq %rcx, %rcx
je 0x6934
movl 0x4(%rdi), %r10d
cmpl %r8d, %r10d
jae 0x680e
leal 0x1(%r10), %eax
movl %eax, 0x4(%rdi)
shlq $0x4, %r10
leaq (%rcx,%r10), %rax
movq $-0x1, 0x4(%rcx,%r10)
movl $0x0, 0xc(%rcx,%r10)
jmp 0x6810
testq %rcx, %rcx
je 0x6934
movslq 0x8(%rdi), %rax
cmpq $-0x1, %rax
je 0x6934
shlq $0x4, %rax
movl (%rcx,%rax), %eax
decl %eax
cmpl $0x2, %eax
jb 0x6934
movl 0x4(%rdi), %eax
decl %eax
js 0x6934
movl %eax, %eax
movq %rax, %r11
shlq $0x4, %r11
addq -0x10(%rsp), %r11
movl -0x8(%r11), %r10d
decl %r10d
cmpl $0x1, %r10d
ja 0x67ec
cmpl $-0x1, -0x4(%r11)
je 0x67ec
cmpl $-0x1, (%r11)
je 0x6919
leaq -0x1(%rax), %r10
addq $-0x10, %r11
testq %rax, %rax
movq %r10, %rax
jg 0x67ce
jmp 0x6934
movl %r14d, (%rdi)
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
jmp 0x68e9
xorl %eax, %eax
testq %rax, %rax
je 0x684a
movslq 0x8(%rdi), %r10
cmpq $-0x1, %r10
je 0x6828
shlq $0x4, %r10
incl 0xc(%rcx,%r10)
xorl %r10d, %r10d
cmpb $0x7b, %r12b
setne %r10b
incl %r10d
movl %r10d, (%rax)
movl %r14d, 0x4(%rax)
movl 0x4(%rdi), %eax
decl %eax
movl %eax, 0x8(%rdi)
jmp 0x6934
movl $0xffffffff, -0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x68b6
cmpl %r11d, -0x8(%r15)
jne 0x68ae
leal -0x1(%rax), %r12d
movl $0xffffffff, 0x8(%rdi)  # imm = 0xFFFFFFFF
leal 0x1(%r14), %r10d
movl %r10d, (%r15)
testl %eax, %eax
je 0x68ae
testl %r12d, %r12d
js 0x6934
movl %r12d, %eax
movq %rax, %r11
shlq $0x4, %r11
addq -0x10(%rsp), %r11
cmpl $-0x1, -0x4(%r11)
je 0x6899
cmpl $-0x1, (%r11)
je 0x6919
leaq -0x1(%rax), %r10
addq $-0x10, %r11
testq %rax, %rax
movq %r10, %rax
jg 0x6888
jmp 0x6934
movl $0xfffffffe, -0x14(%rsp) # imm = 0xFFFFFFFE
xorl %ebp, %ebp
jmp 0x6934
xorl %r10d, %r10d
testq %r10, %r10
je 0x6912
movl $0x4, (%r10)
movl %r14d, 0x4(%r10)
movl %r11d, 0x8(%r10)
movl $0x0, 0xc(%r10)
decl %r11d
xorl %r15d, %r15d
movl %r11d, %r14d
xorl %eax, %eax
jmp 0x6926
movl %r12d, %r14d
testl %eax, %eax
js 0x692e
testq %rcx, %rcx
sete %r10b
incl %r9d
movslq 0x8(%rdi), %rax
cmpq $-0x1, %rax
sete %r11b
orb %r10b, %r11b
jne 0x6934
shlq $0x4, %rax
incl 0xc(%rcx,%rax)
jmp 0x6934
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x6923
movl %eax, 0x8(%rdi)
jmp 0x6934
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
movb $0x1, %r15b
movl %r14d, (%rdi)
testb %r15b, %r15b
je 0x68ed
xorl %ebp, %ebp
movl %eax, -0x14(%rsp)
testb %bpl, %bpl
je 0x6981
incl %r14d
movl %r14d, (%rdi)
movq %r14, %rax
cmpq %rdx, %r14
jb 0x6439
testq %rcx, %rcx
je 0x697c
movl 0x4(%rdi), %eax
decl %eax
js 0x697c
movl %eax, %edx
leaq 0x1(%rdx), %rax
shlq $0x4, %rdx
addq %rdx, %rcx
addq $0x8, %rcx
cmpl $-0x1, -0x4(%rcx)
je 0x6973
cmpl $-0x1, (%rcx)
je 0x6987
addq $-0x10, %rcx
decq %rax
jg 0x6968
movl %r9d, %eax
jmp 0x698c
movl -0x14(%rsp), %eax
jmp 0x698c
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq