// File: /workspace/github_c_makefile_star2_O3/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 0xb82d(%rip), %r14      # 0x1afb0
movq %rsi, 0x18(%rsp)
movq %rsi, %rbp
movl %ecx, 0xc(%rsp)
movb (%rbp), %r15b
cmpq %r13, %rbx
je 0xf79d
movq %rbx, %rax
jmp 0xf7be
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 0xf78f
movzbl %r15b, %ecx
cmpl $0x7a, %ecx
jg 0xf7f0
cmpl $0x5c, %ecx
jne 0xf7fc
cmpb $0xa, (%rbp)
jne 0xf802
incq %rbp
jmp 0xf860
cmpl $0x7d, %ecx
je 0xf868
cmpl $0x7b, %ecx
jne 0xf78f
jmp 0xf876
testl %ecx, %ecx
jne 0xf78f
jmp 0xf881
leaq -0x1(%rbp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x42c0
cmpl $0x2, 0x8(%rsp)
jl 0xf85d
movq %rbx, %rax
cmpq %r13, %rax
jne 0xf840
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 0xf81a
jmp 0xf860
movq %rbx, %rax
movq %rax, %rbx
jmp 0xf78f
movl 0xc(%rsp), %ecx
decl %ecx
jne 0xf78b
jmp 0xf8b8
movl 0xc(%rsp), %ecx
incl %ecx
jmp 0xf78b
leaq 0x65f2(%rip), %rsi      # 0x15e7a
movq 0x10(%rsp), %rdi
xorl %edx, %edx
callq 0x44f0
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 0xf8a1