// File: /workspace/github_cpp_makefile_star2_O2/menhits[P]phplus/src/Parser.cpp
// Function: skipBrace(std::vector<std::shared_ptr<TokenData>, std::allocator<std::shared_ptr<TokenData>>> const&, int)
int skipBrace(const vector<Token>& tokens, int start)
{
	Operator open, close;
	int step;
	
	Operator op=tokens[start]->getOp();
	
	if (tokens[start]->getOp()==ops->openPeren)
	{
		open=ops->openPeren;
		close=ops->closePeren;
		step=1;
	}
	else if (tokens[start]->getOp()==ops->closePeren)
	{
		open=ops->closePeren;
		close=ops->openPeren;
		step=-1;
	}
	else if (tokens[start]->getOp()==ops->openSqBrac)
	{
		open=ops->openSqBrac;
		close=ops->closeSqBrac;
		step=1;
	}
	else if (tokens[start]->getOp()==ops->closeSqBrac)
	{
		open=ops->closeSqBrac;
		close=ops->openSqBrac;
		step=-1;
	}
	else if (tokens[start]->getOp()==ops->openCrBrac)
	{
		open=ops->openCrBrac;
		close=ops->closeCrBrac;
		step=1;
	}
	else if (tokens[start]->getOp()==ops->closeCrBrac)
	{
		open=ops->closeCrBrac;
		close=ops->openCrBrac;
		step=-1;
	}
	else
	{
		throw PhplusError(FUNC + " called with index that is not a valid brace", INTERNAL_ERROR, tokens[start]);
	}
	
	int c=1;
	int i=start;
	
	while(true)
	{
		i+=step;
		
		if (i>=int(tokens.size()))
		{
			throw PhplusError("no matching brace", SOURCE_ERROR, tokens[start]);
		}
		
		if (tokens[i]->getOp()==open)
		{
			c++;
		}
		else if (tokens[i]->getOp()==close)
		{
			c--;
			
			if (c<=0)
			{
				return i;
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rdi, %rbp
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movslq %esi, %r12
movq (%rdi), %rax
movq %r12, %r14
shlq $0x4, %r14
movq (%rax,%r14), %rsi
addq $0x40, %rsi
leaq 0x78(%rsp), %rdi
callq 0xc950
movq (%rbp), %rax
movq (%rax,%r14), %rsi
addq $0x40, %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0xc950
leaq 0x5aff3(%rip), %rbx     # 0x7a2f0
movq (%rbx), %rax
movq (%r15), %r15
movq 0x190(%rax), %r13
leaq 0x10(%rsp), %rdi
callq 0xc984
cmpq %r13, %r15
movq %rbp, 0x28(%rsp)
movq %r14, 0x30(%rsp)
je 0x1f450
movq (%rbp), %rax
movq (%rax,%r14), %rsi
addq $0x40, %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0xc950
movq (%rbx), %rax
movq (%r15), %r15
movq 0x1a0(%rax), %r13
leaq 0x10(%rsp), %rdi
callq 0xc984
pushq $-0x1
popq %rax
cmpq %r13, %r15
je 0x1f45d
movq (%rbp), %rax
movq (%rax,%r14), %rsi
addq $0x40, %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0xc950
movq (%rbx), %rax
movq (%r15), %r15
movq 0x1b0(%rax), %r13
leaq 0x10(%rsp), %rdi
callq 0xc984
cmpq %r13, %r15
je 0x1f46d
movq (%rbp), %rax
movq (%rax,%r14), %rsi
addq $0x40, %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0xc950
movq (%rbx), %rax
movq (%r15), %r15
movq 0x1c0(%rax), %r13
leaq 0x10(%rsp), %rdi
callq 0xc984
cmpq %r13, %r15
je 0x1f47a
movq (%rbp), %rax
movq (%rax,%r14), %rsi
addq $0x40, %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0xc950
movq (%rbx), %rax
movq (%r15), %r15
movq 0x1d0(%rax), %r13
leaq 0x10(%rsp), %rdi
callq 0xc984
cmpq %r13, %r15
je 0x1f489
movq (%rbp), %rax
movq (%rax,%r14), %rsi
addq $0x40, %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0xc950
movq (%rbx), %rax
movq (%r15), %r15
movq 0x1e0(%rax), %r13
leaq 0x10(%rsp), %rdi
callq 0xc984
cmpq %r13, %r15
jne 0x1f63f
movl $0x1d0, %r15d           # imm = 0x1D0
movl $0x1e0, %esi            # imm = 0x1E0
jmp 0x1f485
movl $0x1a0, %r15d           # imm = 0x1A0
movl $0x190, %esi            # imm = 0x190
jmp 0x1f494
movl $0x190, %r15d           # imm = 0x190
movl $0x1a0, %esi            # imm = 0x1A0
movq %rax, %r14
jmp 0x1f498
movl $0x1c0, %r15d           # imm = 0x1C0
movl $0x1b0, %esi            # imm = 0x1B0
jmp 0x1f494
movl $0x1b0, %r15d           # imm = 0x1B0
movl $0x1c0, %esi            # imm = 0x1C0
pushq $-0x1
jmp 0x1f496
movl $0x1e0, %r15d           # imm = 0x1E0
movl $0x1d0, %esi            # imm = 0x1D0
pushq $0x1
popq %r14
addq (%rbx), %rsi
leaq 0x50(%rsp), %rdi
callq 0xcabe
addq (%rbx), %r15
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
callq 0xcabe
movq %r14, %rax
shlq $0x4, %rax
movq %rax, 0x68(%rsp)
pushq $0x1
popq %rax
movl %eax, (%rsp)
leaq 0x8(%rsp), %r15
movq %r14, 0x38(%rsp)
leaq (%r14,%r12), %r13
shlq $0x4, %r13
movq 0x28(%rsp), %rbp
movq %r12, %rdx
addq %r14, %r12
movq (%rbp), %rax
movq 0x8(%rbp), %rcx
subq %rax, %rcx
shrq $0x4, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r12
jge 0x1f5c9
movq %rdx, 0x70(%rsp)
movq (%rax,%r13), %rsi
addq $0x40, %rsi
movq %r15, %rdi
callq 0xc950
movq 0x8(%rsp), %r14
movq 0x50(%rsp), %rbx
leaq 0x10(%rsp), %rdi
callq 0xc984
cmpq %rbx, %r14
je 0x1f579
movq 0x28(%rsp), %rbp
movq (%rbp), %rax
movq (%rax,%r13), %rsi
addq $0x40, %rsi
movq %r15, %rdi
callq 0xc950
movq 0x8(%rsp), %rbx
movq 0x40(%rsp), %r14
leaq 0x10(%rsp), %rdi
callq 0xc984
addq 0x68(%rsp), %r13
cmpq %r14, %rbx
movq 0x38(%rsp), %r14
jne 0x1f4de
movl (%rsp), %eax
cmpl $0x2, %eax
jl 0x1f593
decl %eax
jmp 0x1f583
movl (%rsp), %eax
incl %eax
movq 0x38(%rsp), %r14
movl %eax, (%rsp)
movq 0x70(%rsp), %r12
addq %r14, %r12
jmp 0x1f4d1
leaq 0x80(%rsp), %rdi
callq 0xc984
leaq 0x48(%rsp), %rdi
callq 0xc984
leaq 0x58(%rsp), %rdi
callq 0xc984
movl %r12d, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x38
popq %rdi
callq 0xa1b0
movq %rax, %r15
leaq 0x35f25(%rip), %rsi     # 0x55500
leaq 0xa8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xa150
movq 0x30(%rsp), %rsi
movq 0x28(%rsp), %rax
addq (%rax), %rsi
leaq 0x88(%rsp), %r14
movq %r14, %rdi
callq 0x12e2e
movb $0x1, %bpl
leaq 0xa8(%rsp), %rsi
movq %r15, %rdi
xorl %edx, %edx
movq %r14, %rcx
callq 0x19f06
xorl %ebp, %ebp
leaq 0x57f6d(%rip), %rsi     # 0x77598
leaq -0xdfa0(%rip), %rdx     # 0x11692
movq %r15, %rdi
callq 0xa4e0
jmp 0x1f6c7
pushq $0x38
popq %rdi
callq 0xa1b0
movq %rax, %r15
leaq 0x35e78(%rip), %rsi     # 0x554c9
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0xa150
leaq 0x35e6c(%rip), %rdx     # 0x554d3
leaq 0xc8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xc882
movq 0x30(%rsp), %rsi
movq 0x28(%rsp), %rax
addq (%rax), %rsi
leaq 0x98(%rsp), %r14
movq %r14, %rdi
callq 0x12e2e
movb $0x1, %bpl
leaq 0xc8(%rsp), %rsi
pushq $0x3
popq %rdx
movq %r15, %rdi
movq %r14, %rcx
callq 0x19f06
xorl %ebp, %ebp
leaq 0x57ee0(%rip), %rsi     # 0x77598
leaq -0xe02d(%rip), %rdx     # 0x11692
movq %r15, %rdi
callq 0xa4e0
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0xc984
leaq 0xc8(%rsp), %rdi
callq 0xa558
jmp 0x1f6ec
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x8(%rsp), %rdi
jmp 0x1f70d
jmp 0x1f719
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0xc984
leaq 0xa8(%rsp), %rdi
callq 0xa558
testb %bpl, %bpl
jne 0x1f71c
jmp 0x1f724
movq %rax, %rbx
movq %r15, %rdi
callq 0xa230
leaq 0x80(%rsp), %rdi
callq 0xc984
leaq 0x48(%rsp), %rdi
callq 0xc984
leaq 0x58(%rsp), %rdi
callq 0xc984
movq %rbx, %rdi
callq 0xa500