// File: /workspace/github_c_makefile_star2_O2/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, -0x4(%rsp)
movl (%rdi), %r11d
movl 0x4(%rdi), %ebp
leaq 0x180ec(%rip), %rax     # 0x1e3d8
movl %ebp, %r10d
movl %ebp, %r12d
movl %ebp, -0x8(%rsp)
movl %r11d, %r9d
movl %ebp, %r15d
cmpq %rdx, %r9
jae 0x675a
movb (%rsi,%r9), %r14b
movzbl %r14b, %ebx
leal -0x9(%rbx), %r9d
cmpl $0x2, %r9d
jb 0x65ae
cmpl $0xd, %ebx
je 0x65ae
cmpl $0x20, %ebx
je 0x65ae
cmpl $0x22, %ebx
je 0x6473
cmpl $0x2c, %ebx
je 0x658a
cmpl $0x3a, %ebx
je 0x657a
cmpl $0x5b, %ebx
je 0x640c
cmpl $0x5d, %ebx
je 0x63c0
cmpl $0x7b, %ebx
je 0x640c
cmpl $0x7d, %ebx
je 0x63c0
movl %r11d, %r14d
testl %ebx, %ebx
je 0x675a
movl %r14d, %r9d
cmpq %rdx, %r9
jae 0x65cb
movzbl (%rsi,%r9), %ebx
cmpq $0x3a, %rbx
ja 0x639a
movabsq $0x400100100002601, %r8 # imm = 0x400100100002601
btq %rbx, %r8
jb 0x65cb
cmpl $0x5d, %ebx
je 0x65cb
cmpl $0x7d, %ebx
je 0x65cb
addb $-0x7f, %bl
cmpb $-0x5f, %bl
jb 0x679d
incl %r14d
movl %r14d, (%rdi)
jmp 0x636f
testq %rcx, %rcx
je 0x65ae
xorl %r10d, %r10d
cmpb $0x7d, %r14b
setne %r10b
incl %r10d
leaq -0x1(%r15), %rbx
testl %ebx, %ebx
js 0x661c
movl %ebx, %r14d
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
shlq $0x4, %r14
cmpl $-0x1, 0x4(%rcx,%r14)
je 0x6407
addq %rcx, %r14
cmpl $-0x1, 0x8(%r14)
je 0x6607
movq %rbx, %r15
jmp 0x63d7
incl -0x8(%rsp)
testq %rcx, %rcx
je 0x65ae
cmpl -0x4(%rsp), %ebp
jae 0x67ab
leal 0x1(%rbp), %r13d
movl %r13d, 0x4(%rdi)
shlq $0x4, %r15
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movq %r8, 0x8(%rcx,%r15)
movslq 0x8(%rdi), %r9
cmpq $-0x1, %r9
je 0x644d
shlq $0x4, %r9
incl 0xc(%rcx,%r9)
addq %rcx, %r15
xorl %r9d, %r9d
cmpb $0x7b, %r14b
setne %r9b
incl %r9d
movl %r9d, (%r15)
movl %r11d, 0x4(%r15)
movl %ebp, 0x8(%rdi)
movl %r13d, %ebp
movl %r13d, %r10d
jmp 0x65b7
leal 0x1(%r11), %r13d
movl %r13d, %r15d
movl %r15d, (%rdi)
movl %r15d, %r9d
cmpq %rdx, %r9
jae 0x6750
movzbl (%rsi,%r9), %r9d
cmpl $0x5c, %r9d
je 0x64ac
testl %r9d, %r9d
je 0x6750
cmpl $0x22, %r9d
jne 0x656d
jmp 0x6691
leal 0x1(%r15), %ebx
cmpq %rdx, %rbx
jae 0x656d
movl %ebx, (%rdi)
movzbl (%rsi,%rbx), %r14d
leal -0x2f(%r14), %r9d
cmpl $0x37, %r9d
jbe 0x6544
leal -0x6e(%r14), %r9d
cmpl $0x7, %r9d
ja 0x6559
movslq (%rax,%r9,4), %r9
addq %rax, %r9
jmpq *%r9
leal 0x2(%r15), %r9d
movl %r9d, (%rdi)
leal 0x3(%r15), %ebx
xorl %r14d, %r14d
cmpl $-0x4, %r14d
je 0x6564
leal -0x1(%rbx), %r9d
movl %r9d, %r9d
cmpq %rdx, %r9
jae 0x6564
movb (%rsi,%r9), %r9b
testb %r9b, %r9b
je 0x6564
leal -0x30(%r9), %r8d
cmpb $0xa, %r8b
jb 0x653b
movzbl %r9b, %r9d
addl $-0x41, %r9d
cmpl $0x25, %r9d
ja 0x679d
movabsq $0x3f0000003f, %r8      # imm = 0x3F0000003F
btq %r9, %r8
jae 0x679d
movl %ebx, (%rdi)
decl %r14d
incl %ebx
jmp 0x64f0
movabsq $0x88200000000001, %r8  # imm = 0x88200000000001
btq %r9, %r8
jb 0x6570
jmp 0x64ca
cmpl $0x22, %r14d
je 0x6570
jmp 0x679d
subl %r14d, %r15d
incl %r15d
movl %r15d, (%rdi)
movl %r15d, %ebx
incl %ebx
movl %ebx, %r15d
jmp 0x647a
leal -0x1(%r10), %r8d
movl %r8d, 0x8(%rdi)
movl %ebp, %r13d
movl %r10d, %ebp
jmp 0x65b7
testq %rcx, %rcx
je 0x65ae
movslq 0x8(%rdi), %r9
cmpq $-0x1, %r9
je 0x65ae
shlq $0x4, %r9
movl (%rcx,%r9), %r8d
decl %r8d
cmpl $0x2, %r8d
jae 0x66cf
movl %ebp, %r13d
movl %r10d, %ebp
movl %r12d, %r10d
movl %r10d, %r12d
movl %ebp, %r10d
incl %r11d
movl %r11d, (%rdi)
movl %r13d, %ebp
jmp 0x62f6
testq %rcx, %rcx
je 0x6658
cmpl -0x4(%rsp), %ebp
jae 0x67b2
incl %ebp
movl %ebp, 0x4(%rdi)
shlq $0x4, %r15
movl $0x4, (%rcx,%r15)
movl %r11d, 0x4(%rcx,%r15)
movl %r14d, 0x8(%rcx,%r15)
andl $0x0, 0xc(%rcx,%r15)
movl %ebp, %r13d
movl %ebp, %r10d
jmp 0x6661
cmpl %r10d, (%r14)
jne 0x67a4
orl $-0x1, 0x8(%rdi)
leal 0x1(%r11), %r9d
movl %r9d, 0x8(%r14)
subq $0x1, %r15
jb 0x67a4
testl %r15d, %r15d
js 0x664d
movl %r15d, %r9d
shlq $0x4, %r9
cmpl $-0x1, 0x4(%rcx,%r9)
je 0x6644
addq %rcx, %r9
cmpl $-0x1, 0x8(%r9)
je 0x6649
decl %r15d
jmp 0x6626
movl %r15d, 0x8(%rdi)
movl %ebp, %r13d
movl %ebp, %r10d
jmp 0x65b7
movl %ebp, %r13d
movl %r10d, %ebp
movl %r12d, %r10d
testq %rcx, %rcx
sete %r8b
decl %r14d
incl -0x8(%rsp)
movslq 0x8(%rdi), %r9
cmpq $-0x1, %r9
sete %r11b
orb %r8b, %r11b
jne 0x6689
shlq $0x4, %r9
incl 0xc(%rcx,%r9)
movl %r14d, %r11d
jmp 0x65b7
testq %rcx, %rcx
je 0x6710
cmpl -0x4(%rsp), %r10d
jae 0x67b2
movl %r10d, %r9d
incl %r10d
movl %r10d, 0x4(%rdi)
shlq $0x4, %r9
movl $0x3, (%rcx,%r9)
movl %r13d, 0x4(%rcx,%r9)
movl %r15d, 0x8(%rcx,%r9)
andl $0x0, 0xc(%rcx,%r9)
movl %r10d, %r13d
movl %r10d, %ebp
jmp 0x6719
movl %r12d, %ebx
leaq -0x1(%rbx), %r14
testl %r14d, %r14d
js 0x65ae
movl %r14d, %r15d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
shlq $0x4, %r15
movl (%rcx,%r15), %r8d
decl %r8d
cmpl $0x2, %r8d
jae 0x670b
addq %rcx, %r15
cmpl $-0x1, 0x4(%r15)
je 0x670b
cmpl $-0x1, 0x8(%r15)
je 0x6746
movq %r14, %rbx
jmp 0x66d2
movl %ebp, %r13d
movl %r10d, %ebp
movl %r12d, %r10d
testq %rcx, %rcx
sete %r8b
incl -0x8(%rsp)
movslq 0x8(%rdi), %r9
cmpq $-0x1, %r9
sete %r11b
orb %r8b, %r11b
jne 0x673e
shlq $0x4, %r9
incl 0xc(%rcx,%r9)
movl %r15d, %r11d
jmp 0x65b7
decl %ebx
movl %ebx, 0x8(%rdi)
jmp 0x65ae
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
movl %r11d, (%rdi)
jmp 0x6792
testq %rcx, %rcx
je 0x678e
decq %r15
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
testl %r15d, %r15d
js 0x678e
movl %r15d, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
shlq $0x4, %rdx
cmpl $-0x1, 0x4(%rcx,%rdx)
je 0x6789
addq %rcx, %rdx
cmpl $-0x1, 0x8(%rdx)
je 0x6792
decq %r15
jmp 0x6767
movl -0x8(%rsp), %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x6755
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x6792
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x6792
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x6755