// File: /workspace/github_c_makefile_star2_O0/tomka[P]cliaspora/json.c
// Function: parse_json
char *
parse_json(json_node_t *node, char *str)
{
	int  curpos;
	char *p;
	bool error;

	for (; str != NULL;) {
		str = (char *)skip_ws(str);
		if (*str == '\0') {
			node->next = NULL;
			return (str);
		}
		if (*str == '"') {
			p = get_string(str, &error, &curpos);
			if (p == NULL && error)
				return (NULL);
			str = (char *)skip_ws(str + curpos);
			if (*str == ':') {
				node->var = strdup(p);
				str++;
			} else {
				node->type = JSON_TYPE_STRING;
				if ((node->val = strdup(p)) == NULL)
					return (NULL);
			}
		} else if (isdigit(*str)) {
			p = get_string(str, &error, &curpos);
			if (p == NULL && error)
				return (NULL);
			node->type = JSON_TYPE_NUMBER;
			if ((node->val = malloc(sizeof(int))) == NULL)
				return (NULL);
			*(int *)node->val = strtol(p, NULL, 10);
			str += curpos;
		} else if (strncmp(str, "null",  4) == 0) {
			p = get_string(str, &error, &curpos);
			if (p == NULL && error)
				return (NULL);
			node->type = JSON_TYPE_NUMBER;
			if ((node->val = malloc(sizeof(int))) == NULL)
				return (NULL);
			*(int *)node->val  = 0;
			str += curpos;
		} else if (strncmp(str, "true",  4) == 0) {
			p = get_string(str, &error, &curpos);
			if (p == NULL && error)
				return (NULL);
			node->type = JSON_TYPE_BOOL;
			if ((node->val = malloc(sizeof(bool))) == NULL)
				return (NULL);
			*(bool *)node->val  = true;
			str += curpos;
		} else if (strncmp(str, "false", 5) == 0) {
			p = get_string(str, &error, &curpos);
			if (p == NULL && error)
				return (NULL);
			node->type = JSON_TYPE_BOOL;
			if ((node->val = malloc(sizeof(bool))) == NULL)
				return (NULL);
			*(bool *)node->val  = false;
			str += curpos;
		} else if (*str == '{') {
			if ((node->val = new_json_node()) == NULL)
				return (NULL);
			node->type = JSON_TYPE_OBJECT;
			str = parse_json(node->val, ++str);
		} else if (*str == '[') {
			if ((node->val = new_json_node()) == NULL)
				return (NULL);
			node->type = JSON_TYPE_ARRAY;
			str = parse_json(node->val, ++str);
		} else if (*str == ',') {
			if ((node->next = new_json_node()) == NULL)
				return (NULL);
			++str; node = node->next;
		} else if (*str == '\0') {
			node->next = NULL;
			return (str);
		} else if (*str == '}' || *str == ']') {
			node->next = NULL;
			return (++str);
		} else {
			warnx("Syntax error in JSON string.");
			return (NULL);
		}
	}
	return (str);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xbe01
movq -0x18(%rbp), %rdi
callq 0xbe20
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0xb95d
movq -0x10(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xbe09
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
jne 0xba10
movq -0x18(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
callq 0xbe90
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xb99c
cmpl $0x0, -0x2c(%rbp)
je 0xb99c
movq $0x0, -0x8(%rbp)
jmp 0xbe09
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rax
addq %rax, %rdi
callq 0xbe20
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jne 0xb9de
movq -0x28(%rbp), %rdi
callq 0x2580
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0xba0b
movq -0x10(%rbp), %rax
movb $0x1, (%rax)
movq -0x28(%rbp), %rdi
callq 0x2580
movq -0x10(%rbp), %rcx
movq %rax, 0x10(%rcx)
cmpq $0x0, %rax
jne 0xba09
movq $0x0, -0x8(%rbp)
jmp 0xbe09
jmp 0xba0b
jmp 0xbdfc
callq 0x2300
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xbac3
movq -0x18(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
callq 0xbe90
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xba63
cmpl $0x0, -0x2c(%rbp)
je 0xba63
movq $0x0, -0x8(%rbp)
jmp 0xbe09
movq -0x10(%rbp), %rax
movb $0x2, (%rax)
movl $0x4, %edi
callq 0x2430
movq -0x10(%rbp), %rcx
movq %rax, 0x10(%rcx)
cmpq $0x0, %rax
jne 0xba8f
movq $0x0, -0x8(%rbp)
jmp 0xbe09
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x2470
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl %ecx, (%rax)
movl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0xbdfa
movq -0x18(%rbp), %rdi
leaq 0x4096(%rip), %rsi      # 0xfb64
movl $0x4, %edx
callq 0x2180
cmpl $0x0, %eax
jne 0xbb5c
movq -0x18(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
callq 0xbe90
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xbb0c
cmpl $0x0, -0x2c(%rbp)
je 0xbb0c
movq $0x0, -0x8(%rbp)
jmp 0xbe09
movq -0x10(%rbp), %rax
movb $0x2, (%rax)
movl $0x4, %edi
callq 0x2430
movq -0x10(%rbp), %rcx
movq %rax, 0x10(%rcx)
cmpq $0x0, %rax
jne 0xbb38
movq $0x0, -0x8(%rbp)
jmp 0xbe09
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl $0x0, (%rax)
movl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0xbdf8
movq -0x18(%rbp), %rdi
leaq 0x3b42(%rip), %rsi      # 0xf6a9
movl $0x4, %edx
callq 0x2180
cmpl $0x0, %eax
jne 0xbbf5
movq -0x18(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
callq 0xbe90
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xbba5
cmpl $0x0, -0x2c(%rbp)
je 0xbba5
movq $0x0, -0x8(%rbp)
jmp 0xbe09
movq -0x10(%rbp), %rax
movb $0x5, (%rax)
movl $0x4, %edi
callq 0x2430
movq -0x10(%rbp), %rcx
movq %rax, 0x10(%rcx)
cmpq $0x0, %rax
jne 0xbbd1
movq $0x0, -0x8(%rbp)
jmp 0xbe09
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl $0x1, (%rax)
movl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0xbdf6
movq -0x18(%rbp), %rdi
leaq 0x3a02(%rip), %rsi      # 0xf602
movl $0x5, %edx
callq 0x2180
cmpl $0x0, %eax
jne 0xbc8e
movq -0x18(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
callq 0xbe90
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xbc3e
cmpl $0x0, -0x2c(%rbp)
je 0xbc3e
movq $0x0, -0x8(%rbp)
jmp 0xbe09
movq -0x10(%rbp), %rax
movb $0x5, (%rax)
movl $0x4, %edi
callq 0x2430
movq -0x10(%rbp), %rcx
movq %rax, 0x10(%rcx)
cmpq $0x0, %rax
jne 0xbc6a
movq $0x0, -0x8(%rbp)
jmp 0xbe09
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl $0x0, (%rax)
movl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0xbdf4
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7b, %eax
jne 0xbce3
callq 0xb820
movq -0x10(%rbp), %rcx
movq %rax, 0x10(%rcx)
cmpq $0x0, %rax
jne 0xbcba
movq $0x0, -0x8(%rbp)
jmp 0xbe09
movq -0x10(%rbp), %rax
movb $0x4, (%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x1, %rsi
movq %rsi, -0x18(%rbp)
callq 0xb910
movq %rax, -0x18(%rbp)
jmp 0xbdf2
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5b, %eax
jne 0xbd38
callq 0xb820
movq -0x10(%rbp), %rcx
movq %rax, 0x10(%rcx)
cmpq $0x0, %rax
jne 0xbd0f
movq $0x0, -0x8(%rbp)
jmp 0xbe09
movq -0x10(%rbp), %rax
movb $0x3, (%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x1, %rsi
movq %rsi, -0x18(%rbp)
callq 0xb910
movq %rax, -0x18(%rbp)
jmp 0xbdf0
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
jne 0xbd7e
callq 0xb820
movq -0x10(%rbp), %rcx
movq %rax, 0x18(%rcx)
cmpq $0x0, %rax
jne 0xbd64
movq $0x0, -0x8(%rbp)
jmp 0xbe09
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0xbdee
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0xbda0
movq -0x10(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xbe09
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7d, %eax
je 0xbdb8
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5d, %eax
jne 0xbdd6
movq -0x10(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq %rax, -0x8(%rbp)
jmp 0xbe09
leaq 0x3d8c(%rip), %rdi      # 0xfb69
movb $0x0, %al
callq 0x22f0
movq $0x0, -0x8(%rbp)
jmp 0xbe09
jmp 0xbdf0
jmp 0xbdf2
jmp 0xbdf4
jmp 0xbdf6
jmp 0xbdf8
jmp 0xbdfa
jmp 0xbdfc
jmp 0xb920
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)