// File: /workspace/github_c_makefile_star2_O3/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 %r8d, -0x14(%rsp)
movl (%rdi), %r14d
movl 0x4(%rdi), %r12d
cmpq %rdx, %r14
jae 0x6843
leaq 0x8(%rcx), %rax
movq %rax, -0x10(%rsp)
movl %r12d, %r15d
movl %r12d, %r9d
movl %r12d, %r10d
movl %r14d, %r11d
movb (%rsi,%r14), %al
movzbl %al, %ebp
cmpl $0x2b, %ebp
jle 0x63f4
cmpl $0x5c, %ebp
jg 0x652d
cmpl $0x2c, %ebp
je 0x66a8
cmpl $0x3a, %ebp
je 0x6731
movl %r11d, %r13d
cmpl $0x5b, %ebp
je 0x6643
jmp 0x65a8
cmpl $0xc, %ebp
jle 0x6591
cmpl $0xd, %ebp
je 0x670e
cmpl $0x20, %ebp
je 0x670e
movl %r11d, %r13d
cmpl $0x22, %ebp
jne 0x65a8
leal 0x1(%r11), %r14d
movl %r14d, (%rdi)
cmpq %rdx, %r14
jae 0x6879
movl %r9d, -0x4(%rsp)
movq %r14, %rbp
movl %r14d, %r13d
movzbl (%rsi,%rbp), %eax
cmpl $0x5c, %eax
je 0x6455
testl %eax, %eax
je 0x6879
cmpl $0x22, %eax
jne 0x64f5
jmp 0x67b1
leal 0x1(%r13), %ebp
cmpq %rdx, %rbp
jae 0x64f5
movl %ebp, (%rdi)
movzbl (%rsi,%rbp), %r9d
leal -0x2f(%r9), %eax
cmpl $0x37, %eax
jbe 0x650d
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
leal -0x6e(%r9), %ebx
cmpl $0x7, %ebx
ja 0x6522
leaq 0x18f49(%rip), %r8      # 0x1f3d8
movslq (%r8,%rbx,4), %r9
addq %r8, %r9
jmpq *%r9
addl $0x2, %r13d
movl %r13d, (%rdi)
movl $0x4, %r9d
movl %r13d, %ebp
movl %ebp, %ebx
cmpq %rdx, %rbx
jae 0x64f1
movb (%rsi,%rbx), %r13b
testb %r13b, %r13b
je 0x64f1
leal -0x30(%r13), %ebx
cmpb $0xa, %bl
jb 0x64e8
movzbl %r13b, %r13d
addl $-0x41, %r13d
cmpl $0x25, %r13d
ja 0x687e
movabsq $0x3f0000003f, %r8      # imm = 0x3F0000003F
btq %r13, %r8
jae 0x687e
incl %ebp
movl %ebp, (%rdi)
decl %r9d
jne 0x64a9
decl %ebp
jmp 0x64f8
movl %r13d, %ebp
incl %ebp
movl %ebp, (%rdi)
movl %ebp, %r13d
cmpq %rdx, %rbp
jb 0x6436
jmp 0x6879
movabsq $0x88200000000001, %r8  # imm = 0x88200000000001
btq %rax, %r8
jb 0x64f8
jmp 0x6476
cmpl $0x22, %r9d
je 0x64f8
jmp 0x687e
cmpl $0x5d, %ebp
je 0x6543
cmpl $0x7b, %ebp
je 0x6643
movl %r11d, %r13d
cmpl $0x7d, %ebp
jne 0x65a8
testq %rcx, %rcx
je 0x670e
xorl %r9d, %r9d
cmpb $0x7d, %al
setne %al
movl %r12d, %ebp
decl %ebp
js 0x6743
movb %al, %r9b
incl %r9d
movl %ebp, %ebx
leaq 0x1(%rbx), %rax
shlq $0x4, %rbx
addq -0x10(%rsp), %rbx
cmpl $-0x1, -0x4(%rbx)
je 0x6583
cmpl $-0x1, (%rbx)
je 0x6759
addq $-0x10, %rbx
decq %rax
jg 0x6574
jmp 0x6886
leal -0x9(%rbp), %eax
cmpl $0x2, %eax
jb 0x670e
movl %r11d, %r13d
testl %ebp, %ebp
je 0x68b1
movzbl (%rsi,%r14), %eax
cmpq $0x3a, %rax
ja 0x65c3
movabsq $0x400100100002601, %r8 # imm = 0x400100100002601
btq %rax, %r8
jb 0x65e5
cmpl $0x5d, %eax
je 0x65e5
cmpl $0x7d, %eax
je 0x65e5
addb $-0x7f, %al
cmpb $-0x5f, %al
jb 0x68a2
incl %r13d
movl %r13d, (%rdi)
movq %r13, %r14
cmpq %rdx, %r13
jb 0x65a8
testq %rcx, %rcx
je 0x6748
cmpl -0x14(%rsp), %r12d
jae 0x68b6
movl %r12d, %eax
incl %r12d
movl %r12d, 0x4(%rdi)
shlq $0x4, %rax
movl $0x4, (%rcx,%rax)
movl %r11d, 0x4(%rcx,%rax)
movl %r13d, 0x8(%rcx,%rax)
movl $0x0, 0xc(%rcx,%rax)
decl %r13d
incl %r10d
movslq 0x8(%rdi), %rax
cmpq $-0x1, %rax
je 0x6638
shlq $0x4, %rax
incl 0xc(%rcx,%rax)
movl %r12d, %ebp
movl %r12d, %r9d
jmp 0x6806
incl %r10d
testq %rcx, %rcx
je 0x670e
cmpl -0x14(%rsp), %r12d
jae 0x68a9
movl %r12d, %r9d
leal 0x1(%r12), %ebp
movl %ebp, 0x4(%rdi)
shlq $0x4, %r9
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movq %r8, 0x8(%rcx,%r9)
movslq 0x8(%rdi), %rbx
cmpq $-0x1, %rbx
je 0x6686
shlq $0x4, %rbx
incl 0xc(%rcx,%rbx)
addq %rcx, %r9
xorl %r8d, %r8d
cmpb $0x7b, %al
setne %r8b
incl %r8d
movl %r8d, (%r9)
movl %r11d, 0x4(%r9)
movl %r12d, 0x8(%rdi)
movl %ebp, %r12d
movl %ebp, %r9d
jmp 0x6714
testq %rcx, %rcx
je 0x670e
movslq 0x8(%rdi), %rax
cmpq $-0x1, %rax
je 0x670e
shlq $0x4, %rax
movl (%rcx,%rax), %eax
decl %eax
cmpl $0x2, %eax
jb 0x670e
movl %r9d, %eax
decl %eax
js 0x670e
movl %r9d, %r8d
movl %eax, %eax
movq %rax, %r9
shlq $0x4, %r9
addq -0x10(%rsp), %r9
movl -0x8(%r9), %ebx
decl %ebx
cmpl $0x1, %ebx
ja 0x66f9
cmpl $-0x1, -0x4(%r9)
je 0x66f9
cmpl $-0x1, (%r9)
je 0x6832
leaq -0x1(%rax), %rbx
addq $-0x10, %r9
testq %rax, %rax
movq %rbx, %rax
jg 0x66dd
jmp 0x6835
movl %r12d, %ebp
movl %r15d, %r12d
movl %r12d, %r15d
incl %r11d
movl %r11d, (%rdi)
movl %ebp, %r12d
movq %r11, %r14
cmpq %rdx, %r11
jb 0x63bc
jmp 0x6849
leal -0x1(%r15), %eax
movl %eax, 0x8(%rdi)
movl %r12d, %ebp
movl %r15d, %r12d
movl %r15d, %r9d
jmp 0x6714
movl %r12d, %eax
jmp 0x6774
decl %r13d
incl %r10d
movl %r12d, %ebp
movl %r15d, %r12d
jmp 0x6806
cmpl %r9d, -0x8(%rbx)
jne 0x6886
leal -0x1(%rax), %ebp
movl $0xffffffff, 0x8(%rdi)  # imm = 0xFFFFFFFF
leal 0x1(%r11), %r8d
movl %r8d, (%rbx)
testl %eax, %eax
je 0x6886
testl %ebp, %ebp
js 0x6811
movl %ebp, %eax
movq %rax, %r9
shlq $0x4, %r9
addq -0x10(%rsp), %r9
cmpl $-0x1, -0x4(%r9)
je 0x679f
cmpl $-0x1, (%r9)
je 0x680e
leaq -0x1(%rax), %r8
addq $-0x10, %r9
testq %rax, %rax
movq %r8, %rax
jg 0x6792
jmp 0x6811
testq %rcx, %rcx
je 0x681c
cmpl -0x14(%rsp), %r15d
jae 0x68b6
movl %r15d, %eax
incl %r15d
movl %r15d, 0x4(%rdi)
shlq $0x4, %rax
movl $0x3, (%rcx,%rax)
movl %r14d, 0x4(%rcx,%rax)
movl %r13d, 0x8(%rcx,%rax)
movl $0x0, 0xc(%rcx,%rax)
incl %r10d
movslq 0x8(%rdi), %rax
cmpq $-0x1, %rax
je 0x67fd
shlq $0x4, %rax
incl 0xc(%rcx,%rax)
movl %r15d, %ebp
movl %r15d, %r12d
movl %r15d, %r9d
movl %r13d, %r11d
jmp 0x6714
movl %eax, 0x8(%rdi)
movl %r12d, %ebp
movl %r12d, %r9d
jmp 0x6714
incl %r10d
movl %r12d, %ebp
movl %r15d, %r12d
movl %r13d, %r11d
movl -0x4(%rsp), %r9d
jmp 0x6714
movl %eax, 0x8(%rdi)
movl %r12d, %ebp
movl %r15d, %r12d
movl %r8d, %r9d
jmp 0x6714
movl %r12d, %ebp
movl %r12d, %r10d
testq %rcx, %rcx
je 0x6894
decl %ebp
js 0x6894
movl %ebp, %edx
leaq 0x1(%rdx), %rax
shlq $0x4, %rdx
addq %rdx, %rcx
addq $0x8, %rcx
cmpl $-0x1, -0x4(%rcx)
je 0x686e
cmpl $-0x1, (%rcx)
je 0x688e
addq $-0x10, %rcx
decq %rax
jg 0x6863
jmp 0x6894
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
movl %r11d, (%rdi)
movl %eax, %r10d
jmp 0x6894
movl $0xfffffffe, %r10d      # imm = 0xFFFFFFFE
jmp 0x6894
movl $0xfffffffd, %r10d      # imm = 0xFFFFFFFD
movl %r10d, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x687e
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
jmp 0x6894
movl %r12d, %ebp
jmp 0x6849
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x687e