// File: /workspace/github_c_makefile_star2_O1/haxlang[P]hax/haxParse.c
// Function: HaxParseBraces
int
HaxParseBraces(
    Hax_Interp *interp,		/* Interpreter to use for nested command
				 * evaluations and error messages. */
    char *string,		/* Character just after opening bracket. */
    char **termPtr,		/* Store address of terminating character
				 * here. */
    ParseValue *pvPtr		/* Information about where to place
				 * result of command. */)
{
    int level;
    char *src, *dst, *end;
    char c;

    src = string;
    dst = pvPtr->next;
    end = pvPtr->end;
    level = 1;

    /*
     * Copy the characters one at a time to the result area, stopping
     * when the matching close-brace is found.
     */

    while (1) {
	c = *src;
	src++;
	if (dst == end) {
	    pvPtr->next = dst;
	    (*pvPtr->expandProc)(interp, pvPtr, 20);
	    dst = pvPtr->next;
	    end = pvPtr->end;
	}
	*dst = c;
	dst++;
	if (CHAR_TYPE(c) == HAX_NORMAL) {
	    continue;
	} else if (c == '{') {
	    level++;
	} else if (c == '}') {
	    level--;
	    if (level == 0) {
		dst--;			/* Don't copy the last close brace. */
		break;
	    }
	} else if (c == '\\') {
	    int count;

	    /*
	     * Must always squish out backslash-newlines, even when in
	     * braces.  This is needed so that this sequence can appear
	     * anywhere in a command, such as the middle of an expression.
	     */

	    if (*src == '\n') {
		dst--;
		src++;
	    } else {
		(void) Hax_Backslash(src-1, &count);
		while (count > 1) {
                    if (dst == end) {
                        pvPtr->next = dst;
                        (*pvPtr->expandProc)(interp, pvPtr, 20);
                        dst = pvPtr->next;
                        end = pvPtr->end;
                    }
		    *dst = *src;
		    dst++;
		    src++;
		    count--;
		}
	    }
	} else if (c == '\0') {
	    Hax_SetResult(interp, (char *) "missing close-brace", HAX_STATIC);
	    *termPtr = string-1;
	    return HAX_ERROR;
	}
    }

    *dst = '\0';
    pvPtr->next = dst;
    *termPtr = src;
    return HAX_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r12
movq %rdx, 0x20(%rsp)
movq %rdi, 0x10(%rsp)
movq 0x8(%rcx), %rbx
movq 0x10(%rcx), %r13
movl $0x1, %ecx
movq 0xc1b7(%rip), %r14      # 0x1bfb0
movq %rsi, 0x18(%rsp)
movq %rsi, %rbp
movl %ecx, 0xc(%rsp)
movb (%rbp), %r15b
cmpq %r13, %rbx
je 0xfe13
movq %rbx, %rax
jmp 0xfe34
movq %rbx, 0x8(%r12)
movq 0x10(%rsp), %rdi
movq %r12, %rsi
movl $0x14, %edx
callq *0x18(%r12)
movq 0x8(%r12), %rax
movq 0x10(%r12), %r13
movsbq %r15b, %rcx
incq %rbp
movb %r15b, (%rax)
leaq 0x1(%rax), %rbx
cmpb $0x0, 0x80(%r14,%rcx)
je 0xfe05
movzbl %r15b, %ecx
cmpl $0x7a, %ecx
jg 0xfe66
cmpl $0x5c, %ecx
jne 0xfe72
cmpb $0xa, (%rbp)
jne 0xfe78
incq %rbp
jmp 0xfed6
cmpl $0x7d, %ecx
je 0xfede
cmpl $0x7b, %ecx
jne 0xfe05
jmp 0xfeec
testl %ecx, %ecx
jne 0xfe05
jmp 0xfef7
leaq -0x1(%rbp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x42c0
cmpl $0x2, 0x8(%rsp)
jl 0xfed3
movq %rbx, %rax
cmpq %r13, %rax
jne 0xfeb6
movq %rax, 0x8(%r12)
movq 0x10(%rsp), %rdi
movq %r12, %rsi
movl $0x14, %edx
callq *0x18(%r12)
movq 0x8(%r12), %rax
movq 0x10(%r12), %r13
movb (%rbp), %cl
movb %cl, (%rax)
incq %rax
incq %rbp
movl 0x8(%rsp), %ecx
leal -0x1(%rcx), %edx
movl %edx, 0x8(%rsp)
cmpl $0x2, %ecx
jg 0xfe90
jmp 0xfed6
movq %rbx, %rax
movq %rax, %rbx
jmp 0xfe05
movl 0xc(%rsp), %ecx
decl %ecx
jne 0xfe01
jmp 0xff2e
movl 0xc(%rsp), %ecx
incl %ecx
jmp 0xfe01
leaq 0x7278(%rip), %rsi      # 0x17176
movq 0x10(%rsp), %rdi
xorl %edx, %edx
callq 0x44e0
movq 0x18(%rsp), %rbp
decq %rbp
movl $0x1, %eax
movq 0x20(%rsp), %rcx
movq %rbp, (%rcx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x0, (%rax)
movq %rax, 0x8(%r12)
xorl %eax, %eax
jmp 0xff17