// File: /workspace/github_c_makefile_star2_O0/lh3[P]bgt/bgt.c
// Function: bgt_parse_fields
kexpr_t **bgt_parse_fields(const char *str, int *_n)
{
	int m = 0, n = 0, n_par = 0, i;
	char **s = 0;
	const char *q, *p;
	kexpr_t **e = 0;
	*_n = 0;
	for (q = p = str;; ++p) {
		if (*p == '(') ++n_par;
		else if (*p == ')') --n_par;
		else if (*p == 0 || (*p == ',' && n_par == 0)) {
			if (m == n) {
				m = m? m<<1 : 16;
				s = (char**)realloc(s, m * sizeof(void*));
			}
			s[n] = (char*)calloc(p - q + 1, 1);
			strncpy(s[n++], q, p - q);
			q = p + 1;
			if (*p == 0) break;
		}
	}
	if (n_par == 0) {
		e = (kexpr_t**)calloc(n, sizeof(kexpr_t*));
		for (i = m = 0; i < n; ++i) {
			int err, j;
			e[i] = ke_parse(s[i], &err);
			if (err) {
				for (j = 0; j <= i; ++j)
					ke_destroy(e[j]);
				break;
			}
		}
		if (i < n) {
			free(e);
			e = 0, *_n = 0;
		} else *_n = n;
	}
	for (i = 0; i < n; ++i) free(s[i]);
	free(s);
	return e;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x28, %eax
jne 0x1f1f5
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1f2e4
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x29, %eax
jne 0x1f20f
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1f2e2
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x1f235
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
jne 0x1f2e0
cmpl $0x0, -0x1c(%rbp)
jne 0x1f2e0
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jne 0x1f272
cmpl $0x0, -0x14(%rbp)
je 0x1f24d
movl -0x14(%rbp), %eax
shll %eax
movl %eax, -0x4c(%rbp)
jmp 0x1f257
movl $0x10, %eax
movl %eax, -0x4c(%rbp)
jmp 0x1f257
movl -0x4c(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0x28(%rbp), %rdi
movslq -0x14(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2340
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rax
subq %rax, %rdi
addq $0x1, %rdi
movl $0x1, %esi
callq 0x2230
movq %rax, %rdx
movq -0x28(%rbp), %rax
movslq -0x18(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
movl -0x18(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x18(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rax
subq %rax, %rdx
callq 0x2070
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x1f2de
jmp 0x1f2f7
jmp 0x1f2e0
jmp 0x1f2e2
jmp 0x1f2e4
jmp 0x1f2e6
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x1f1db
cmpl $0x0, -0x1c(%rbp)
jne 0x1f3bd
movslq -0x18(%rbp), %rdi
movl $0x8, %esi
callq 0x2230
movq %rax, -0x40(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x1f38d
movq -0x28(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq -0x44(%rbp), %rsi
callq 0x22f50
movq %rax, %rdx
movq -0x40(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
cmpl $0x0, -0x44(%rbp)
je 0x1f380
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x20(%rbp), %eax
jg 0x1f37e
movq -0x40(%rbp), %rax
movslq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x23c00
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x1f35a
jmp 0x1f38d
jmp 0x1f382
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1f321
movl -0x20(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x1f3b2
movq -0x40(%rbp), %rdi
callq 0x2040
movq $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
jmp 0x1f3bb
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1f3bd
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x1f3e8
movq -0x28(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2040
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1f3c4
movq -0x28(%rbp), %rdi
callq 0x2040
movq -0x40(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)