// File: /workspace/github_cpp_makefile_star2_O3/menhits[P]phplus/src/Parser.cpp
// Function: parseType(std::vector<std::shared_ptr<TokenData>, std::allocator<std::shared_ptr<TokenData>>> const&, int, int)
unique_ptr<AstType> parseType(const vector<Token>& tokens, int left, int right)
{
	vector<AstTupleType::NamedType> types;
	
	while (left<=right)
	{
		//	skip commas
		while (left<=right && tokens[left]->getOp()==ops->comma)
		{
			left++;
		}
		
		//	if this is a named subtype
		if (left+2<=right && tokens[left+1]->getOp()==ops->colon)
		{
			if (tokens[left]->getType()!=TokenData::IDENTIFIER)
			{
				throw PhplusError("identifier must be to the left of ':' in type", SOURCE_ERROR, tokens[left]);
			}
			
			Token name=tokens[left];
			unique_ptr<AstType> type;
			
			if (tokens[left+2]->getType()==TokenData::IDENTIFIER)
			{
				type=AstTokenType::make(tokens[left+2]);
				left+=3;
			}
			else if (tokens[left+2]->getOp()==ops->openCrBrac)
			{
				int j=skipBrace(tokens, left+2);
				
				if (j>right)
				{
					throw PhplusError(FUNC+" skipping brance went outside of range", INTERNAL_ERROR, tokens[left+1]);
				}
				
				type=parseType(tokens, left+2+1, j-1);
				left=j+1;
			}
			else
			{
				throw PhplusError("invalid thingy '"+tokens[left+2]->getText()+"' in type", SOURCE_ERROR, tokens[left+2]);
			}
			
			types.push_back(AstTupleType::NamedType{name, move(type)});
		}
		else //	this is an unnamed subtype
		{
			types.push_back(AstTupleType::NamedType{nullptr, AstTokenType::make(tokens[left])});
			left+=1;
		}
	}
	
	if (types.size()==0)
		return AstVoidType::make();
	else if (types.size()==1 && !types[0].name)
		return move(types[0].type);
	else
		return AstTupleType::make(types);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movl %ecx, %r15d
movq %rsi, 0x8(%rsp)
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
xorl %eax, %eax
movl $0x0, %ecx
cmpl %r15d, %edx
jg 0x2ad2c
movl %edx, %r14d
movslq %r15d, %rax
movq %rax, 0xb0(%rsp)
movq %rbx, 0x48(%rsp)
movl %r15d, 0x3c(%rsp)
movslq %r14d, %r13
cmpl %r15d, %r13d
movl %r15d, %ebp
cmovgl %r13d, %ebp
incl %ebp
leaq -0x1(%r13), %rbx
shlq $0x4, %r13
movl %r14d, %r12d
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r13), %rax
movq 0x40(%rax), %r15
movq 0x48(%rax), %rdi
testq %rdi, %rdi
je 0x2a8e9
movq 0x6f6c9(%rip), %rax     # 0x99fa8
cmpb $0x0, (%rax)
je 0x2a8fb
incl 0x8(%rdi)
jmp 0x2a8ff
leaq 0x6fa18(%rip), %rax     # 0x9a308
movq (%rax), %rax
cmpq 0x50(%rax), %r15
je 0x2a917
jmp 0x2a92e
lock
incl 0x8(%rdi)
leaq 0x6fa02(%rip), %rax     # 0x9a308
movq (%rax), %rax
movq 0x50(%rax), %r14
callq 0xdce4
cmpq %r14, %r15
jne 0x2a92e
incl %r12d
incq %rbx
addq $0x10, %r13
cmpq 0xb0(%rsp), %rbx
jl 0x2a8bf
movl %ebp, %r12d
movl 0x3c(%rsp), %r15d
leal 0x2(%r12), %ebx
movq 0x8(%rsp), %rax
movq (%rax), %rax
movslq %r12d, %rbp
cmpl %r15d, %ebx
jg 0x2a9eb
movq %rbp, %rcx
shlq $0x4, %rcx
movq %rcx, 0x40(%rsp)
movq 0x10(%rax,%rcx), %rcx
movq 0x40(%rcx), %r13
movq 0x48(%rcx), %rdi
testq %rdi, %rdi
je 0x2a97b
movq 0x6f637(%rip), %rax     # 0x99fa8
cmpb $0x0, (%rax)
je 0x2a9c7
incl 0x8(%rdi)
jmp 0x2a9cb
leaq 0x6f986(%rip), %rcx     # 0x9a308
movq (%rcx), %rcx
cmpq 0x30(%rcx), %r13
jne 0x2a9eb
movq 0x40(%rsp), %rcx
movq (%rax,%rcx), %rbp
cmpl $0x2, 0x38(%rbp)
jne 0x2ade7
addq %rax, %rcx
movq 0x8(%rcx), %r13
testq %r13, %r13
je 0x2aae5
movq 0x6f5f3(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
je 0x2aad8
incl 0x8(%r13)
jmp 0x2aae5
lock
incl 0x8(%rdi)
leaq 0x6f936(%rip), %rax     # 0x9a308
movq (%rax), %rax
movq 0x30(%rax), %r14
callq 0xdce4
movq 0x8(%rsp), %rax
movq (%rax), %rax
cmpq %r14, %r13
je 0x2a98b
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
shlq $0x4, %rbp
movq (%rax,%rbp), %rcx
movq %rcx, 0x90(%rsp)
movq 0x8(%rax,%rbp), %rax
movq %rax, 0x98(%rsp)
testq %rax, %rax
je 0x2aa2a
movq 0x6f58c(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
je 0x2aa26
incl 0x8(%rax)
jmp 0x2aa2a
lock
incl 0x8(%rax)
leaq 0x70(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x2bc9e
movq 0x70(%rsp), %rax
movq $0x0, 0x70(%rsp)
movq %rax, 0x20(%rsp)
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x16f50
movq 0x20(%rsp), %rsi
testq %rsi, %rsi
je 0x2aa72
leaq 0x20(%rsp), %rdi
callq 0x17188
movq $0x0, 0x20(%rsp)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x2aa8a
callq 0xdce4
movq 0x70(%rsp), %rbx
testq %rbx, %rbx
je 0x2aaa4
movq %rbx, %rdi
callq 0x2c3ba
movq %rbx, %rdi
callq 0xa2b0
movq $0x0, 0x70(%rsp)
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x2aabf
callq 0xdce4
incl %r12d
movl %r12d, %r14d
movq 0x48(%rsp), %rbx
cmpl %r15d, %r14d
jle 0x2a8a5
jmp 0x2ad22
lock
incl 0x8(%r13)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq $0x0, (%rsp)
movslq %ebx, %rdx
shlq $0x4, %rdx
movq (%rax,%rdx), %rcx
cmpl $0x2, 0x38(%rcx)
jne 0x2ab2b
addq %rdx, %rax
movq %rcx, 0xa0(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0xa8(%rsp)
testq %rax, %rax
je 0x2ab75
movq 0x6f487(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
je 0x2ab71
incl 0x8(%rax)
jmp 0x2ab75
movq 0x40(%rcx), %r15
movq 0x48(%rcx), %rdi
testq %rdi, %rdi
movq %rdx, 0x68(%rsp)
je 0x2ab55
movq 0x6f464(%rip), %rax     # 0x99fa8
cmpb $0x0, (%rax)
je 0x2abf0
incl 0x8(%rdi)
jmp 0x2abf4
leaq 0x6f7ac(%rip), %rax     # 0x9a308
movq (%rax), %rax
cmpq 0x1d0(%rax), %r15
je 0x2ac13
jmp 0x2ae64
lock
incl 0x8(%rax)
leaq 0x10(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x2bc9e
movq 0x10(%rsp), %rax
movq $0x0, 0x10(%rsp)
movq (%rsp), %rsi
movq %rax, (%rsp)
testq %rsi, %rsi
je 0x2abc4
movq %rsp, %rdi
callq 0x17188
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
je 0x2abc4
movq %rbx, %rdi
callq 0x2c3ba
movq %rbx, %rdi
callq 0xa2b0
movq $0x0, 0x10(%rsp)
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x2abdf
callq 0xdce4
addl $0x3, %r12d
movl %r12d, %r14d
movq 0x48(%rsp), %rbx
jmp 0x2ac89
lock
incl 0x8(%rdi)
leaq 0x6f70d(%rip), %rax     # 0x9a308
movq (%rax), %rax
movq 0x1d0(%rax), %r14
callq 0xdce4
cmpq %r14, %r15
jne 0x2ae64
movq 0x8(%rsp), %rdi
movl %ebx, %esi
callq 0x27556
movl 0x3c(%rsp), %r15d
movl %eax, %r14d
cmpl %r15d, %eax
jg 0x2aef8
addl $0x3, %r12d
leal -0x1(%r14), %ecx
leaq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
movl %r12d, %edx
callq 0x2a850
movq 0x10(%rsp), %rax
movq $0x0, 0x10(%rsp)
movq (%rsp), %rsi
movq %rax, (%rsp)
testq %rsi, %rsi
movq 0x48(%rsp), %rbx
je 0x2ac86
movq %rsp, %rdi
callq 0x17188
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x2ac86
leaq 0x10(%rsp), %rdi
callq 0x17188
incl %r14d
movq %rbp, 0x10(%rsp)
movq %r13, 0x18(%rsp)
testq %r13, %r13
je 0x2acaf
movq 0x6f309(%rip), %rax     # 0x99fa8
cmpb $0x0, (%rax)
je 0x2acaa
incl 0x8(%r13)
jmp 0x2acaf
lock
incl 0x8(%r13)
movq (%rsp), %rax
movq %rax, 0x20(%rsp)
movq $0x0, (%rsp)
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x16f50
movq 0x20(%rsp), %rsi
testq %rsi, %rsi
je 0x2ace3
leaq 0x20(%rsp), %rdi
callq 0x17188
movq $0x0, 0x20(%rsp)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x2acfb
callq 0xdce4
movq (%rsp), %rsi
testq %rsi, %rsi
je 0x2ad0c
movq %rsp, %rdi
callq 0x17188
testq %r13, %r13
je 0x2aaca
movq %r13, %rdi
callq 0xdce4
jmp 0x2aaca
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq $0x1, %rdx
je 0x2ad9a
testq %rdx, %rdx
jne 0x2ada0
movl $0x88, %edi
callq 0xa2d0
movq %rax, %rcx
addq $0x18, %rcx
movq %rcx, 0x8(%rax)
movq $0x0, 0x10(%rax)
xorl %ecx, %ecx
movb %cl, 0x18(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rax)
movups %xmm0, 0x38(%rax)
movups %xmm0, 0x48(%rax)
movups %xmm0, 0x58(%rax)
movb %cl, 0x68(%rax)
movups %xmm0, 0x70(%rax)
movb %cl, 0x80(%rax)
leaq 0x6d11b(%rip), %rcx     # 0x97eb0
movq %rcx, (%rax)
jmp 0x2adb4
cmpq $0x0, (%rax)
je 0x2add6
leaq 0x10(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x2bd52
movq 0x10(%rsp), %rax
movq %rax, (%rbx)
leaq 0x50(%rsp), %rdi
callq 0x2bde4
movq %rbx, %rax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rax), %rcx
movq %rcx, (%rbx)
movq $0x0, 0x10(%rax)
jmp 0x2adb7
movl $0x38, %edi
callq 0xa1b0
movq %rax, %r14
leaq 0x138(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x4d7a4(%rip), %rsi     # 0x785ac
leaq 0x4d7ca(%rip), %rdx     # 0x785d9
leaq 0x128(%rsp), %rdi
callq 0xdfa8
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq 0x40(%rsp), %rdx
movq (%rax,%rdx), %rcx
movq %rcx, 0xd8(%rsp)
movq 0x8(%rax,%rdx), %rax
movq %rax, 0xe0(%rsp)
testq %rax, %rax
je 0x2af60
movq 0x6f156(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
jne 0x2af5d
lock
incl 0x8(%rax)
jmp 0x2af60
movq %r13, %r15
movl $0x38, %edi
callq 0xa1b0
movq %rax, %r12
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq 0x68(%rsp), %rcx
movq (%rax,%rcx), %rax
leaq 0x80(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x70(%rsp), %rdi
callq 0xde0c
leaq 0x4d75f(%rip), %rsi     # 0x7860b
leaq 0x10(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x158ca
leaq 0x4d70e(%rip), %rsi     # 0x785d0
leaq 0x10(%rsp), %rdi
callq 0xa560
leaq 0xf8(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x2b00a
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x2b01d
movq %r13, %r15
movl $0x38, %edi
callq 0xa1b0
movq %rax, %r12
leaq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
movq %rax, (%rdi)
leaq 0x4d6be(%rip), %rsi     # 0x785da
leaq 0x4d6c0(%rip), %rdx     # 0x785e3
callq 0xdfa8
leaq 0x4d6b5(%rip), %rsi     # 0x785e4
leaq 0x10(%rsp), %rdi
callq 0xa560
leaq 0x118(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x2af9a
movups (%rcx), %xmm0
movups %xmm0, (%r14)
jmp 0x2afad
incl 0x8(%rax)
movb $0x1, %bpl
leaq 0x128(%rsp), %rsi
leaq 0xd8(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x203f4
xorl %ebp, %ebp
leaq 0x6c6b2(%rip), %rsi     # 0x97638
leaq -0x16467(%rip), %rdx    # 0x14b26
movq %r14, %rdi
callq 0xa4f0
jmp 0x2b0ea
movq %rdx, 0x108(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x118(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x110(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq 0x40(%rsp), %rdx
movq 0x10(%rax,%rdx), %rcx
movq %rcx, 0xc8(%rsp)
movq 0x18(%rax,%rdx), %rax
movq %rax, 0xd0(%rsp)
testq %rax, %rax
je 0x2b078
movq 0x6efa9(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
jne 0x2b075
lock
incl 0x8(%rax)
jmp 0x2b078
movq %rdx, 0xe8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xf8(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0xf0(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq 0x68(%rsp), %rdx
movq (%rax,%rdx), %rcx
movq %rcx, 0xb8(%rsp)
movq 0x8(%rax,%rdx), %rax
movq %rax, 0xc0(%rsp)
testq %rax, %rax
je 0x2b0b5
movq 0x6ef3e(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
jne 0x2b0b2
lock
incl 0x8(%rax)
jmp 0x2b0b5
incl 0x8(%rax)
movb $0x1, %bpl
leaq 0x108(%rsp), %rsi
leaq 0xc8(%rsp), %rcx
movq %r12, %rdi
movl $0x3, %edx
callq 0x203f4
xorl %ebp, %ebp
leaq 0x6c597(%rip), %rsi     # 0x97638
leaq -0x16582(%rip), %rdx    # 0x14b26
movq %r12, %rdi
callq 0xa4f0
jmp 0x2b0ea
incl 0x8(%rax)
movb $0x1, %bpl
leaq 0xe8(%rsp), %rsi
leaq 0xb8(%rsp), %rcx
movq %r12, %rdi
xorl %edx, %edx
callq 0x203f4
xorl %ebp, %ebp
leaq 0x6c55d(%rip), %rsi     # 0x97638
leaq -0x165bc(%rip), %rdx    # 0x14b26
movq %r12, %rdi
callq 0xa4f0
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x2b0ff
callq 0xdce4
movq 0xe8(%rsp), %rdi
cmpq %r13, %rdi
je 0x2b119
callq 0xa2b0
jmp 0x2b119
movq %rax, %rbx
movb $0x1, %bpl
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x2b12d
callq 0xa2b0
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x2b13c
callq 0xa2b0
testb %bpl, %bpl
jne 0x2b1b5
jmp 0x2b234
jmp 0x2b1a8
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x2b15d
callq 0xdce4
movq 0x108(%rsp), %rdi
cmpq %r14, %rdi
je 0x2b16f
callq 0xa2b0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
jne 0x2b137
jmp 0x2b13c
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
jne 0x2b1a1
jmp 0x2b1b5
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x2b1b5
callq 0xa2b0
jmp 0x2b1b5
movq %rax, %rbx
jmp 0x2b296
jmp 0x2b1b2
movq %rax, %rbx
movq %r12, %rdi
callq 0xa240
jmp 0x2b234
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x2b1d4
callq 0xdce4
movq 0x128(%rsp), %rdi
cmpq %r12, %rdi
je 0x2b1e6
callq 0xa2b0
testb %bpl, %bpl
jne 0x2b1f3
jmp 0x2b296
movq %rax, %rbx
movq %r14, %rdi
callq 0xa240
jmp 0x2b296
movq %r13, %r15
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x2b234
callq 0xdce4
jmp 0x2b234
jmp 0x2b21c
movq %r13, %r15
movq %rax, %rbx
jmp 0x2b234
movq %r13, %r15
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x16f20
movq (%rsp), %rsi
testq %rsi, %rsi
je 0x2b245
movq %rsp, %rdi
callq 0x17188
testq %r15, %r15
je 0x2b296
movq %r15, %rdi
jmp 0x2b291
movq %rax, %rbx
movb $0x1, %bpl
jmp 0x2b270
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x16f20
leaq 0x70(%rsp), %rdi
callq 0x2bd24
xorl %ebp, %ebp
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x2b282
callq 0xdce4
testb %bpl, %bpl
je 0x2b296
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x2b296
callq 0xdce4
leaq 0x50(%rsp), %rdi
callq 0x2bde4
movq %rbx, %rdi
callq 0xa510