// File: /workspace/github_cpp_makefile_star2_O1/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 $0x168, %rsp            # imm = 0x168
movq %rsi, 0x10(%rsp)
movq %rdi, 0x80(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
movl %ecx, 0x1c(%rsp)
cmpl %ecx, %edx
jg 0x2a91c
movl %edx, %r14d
movslq 0x1c(%rsp), %rbp
movslq %r14d, %r14
movq %r14, %rbx
shlq $0x20, %rbx
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
addq %rax, %rbx
movq %r14, %r15
shlq $0x4, %r15
cmpq %rbp, %r14
jle 0x2a48e
xorl %r13d, %r13d
jmp 0x2a4d2
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r15), %rcx
movq 0x40(%rcx), %rax
movq 0x48(%rcx), %r12
testq %r12, %r12
je 0x2a4c0
movq 0x6eafa(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x2a4ba
incl 0x8(%r12)
jmp 0x2a4c0
lock
incl 0x8(%r12)
leaq 0x6ee41(%rip), %rcx     # 0x99308
movq (%rcx), %rcx
cmpq 0x50(%rcx), %rax
sete %r13b
cmpq %rbp, %r14
jg 0x2a4e4
testq %r12, %r12
je 0x2a4e4
movq %r12, %rdi
callq 0xdcba
incq %r14
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %rbx
addq $0x10, %r15
testb %r13b, %r13b
jne 0x2a484
leal 0x1(%r14), %esi
cmpl 0x1c(%rsp), %esi
jle 0x2a50c
xorl %r15d, %r15d
jmp 0x2a563
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rbx, %rcx
sarq $0x1c, %rcx
movq 0x10(%rax,%rcx), %rcx
movq 0x40(%rcx), %rax
movq 0x48(%rcx), %rcx
movq %rcx, 0x50(%rsp)
testq %rcx, %rcx
je 0x2a551
movq 0x6ea6f(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x2a548
movq 0x50(%rsp), %rcx
incl 0x8(%rcx)
jmp 0x2a551
movq 0x50(%rsp), %rcx
lock
incl 0x8(%rcx)
leaq 0x6edb0(%rip), %rcx     # 0x99308
movq (%rcx), %rcx
cmpq 0x30(%rcx), %rax
sete %r15b
cmpl 0x1c(%rsp), %esi
jg 0x2a581
cmpq $0x0, 0x50(%rsp)
je 0x2a581
movq 0x50(%rsp), %rdi
movl %esi, %r13d
callq 0xdcba
movl %r13d, %esi
testb %r15b, %r15b
je 0x2a5d4
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rbx, %r15
sarq $0x1c, %r15
movq (%rax,%r15), %rcx
movq %rcx, 0xd0(%rsp)
cmpl $0x2, 0x38(%rcx)
jne 0x2a9fa
addq %r15, %rax
movq 0x8(%rax), %r13
testq %r13, %r13
je 0x2a6c8
movq 0x6e9e6(%rip), %rax     # 0x98fa8
cmpb $0x0, (%rax)
je 0x2a6c3
incl 0x8(%r13)
jmp 0x2a6c8
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %rax
sarq $0x1c, %rbx
movq (%rax,%rbx), %rcx
movq %rcx, 0x88(%rsp)
movq 0x8(%rax,%rbx), %rax
movq %rax, 0x90(%rsp)
testq %rax, %rax
je 0x2a61b
movq 0x6e99b(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x2a617
incl 0x8(%rax)
jmp 0x2a61b
lock
incl 0x8(%rax)
leaq 0x98(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x2b934
movq 0x98(%rsp), %rax
movq $0x0, 0x98(%rsp)
movq %rax, 0x30(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x16cc8
movq 0x30(%rsp), %rsi
testq %rsi, %rsi
je 0x2a66c
leaq 0x30(%rsp), %rdi
callq 0x16f04
movq $0x0, 0x30(%rsp)
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x2a684
callq 0xdcba
movq 0x98(%rsp), %rbx
testq %rbx, %rbx
je 0x2a6a1
movq %rbx, %rdi
callq 0x2c0f6
movq %rbx, %rdi
callq 0xa2b0
movq $0x0, 0x98(%rsp)
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
jne 0x2a90c
jmp 0x2a911
lock
incl 0x8(%r13)
movq $0x0, 0x8(%rsp)
movslq %esi, %rbx
movq 0x10(%rsp), %rax
movq (%rax), %rax
shlq $0x4, %rbx
movq (%rax,%rbx), %rcx
cmpl $0x2, 0x38(%rcx)
jne 0x2a71a
addq %rbx, %rax
movq (%rax), %rcx
movq %rcx, 0xb8(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0xc0(%rsp)
testq %rax, %rax
je 0x2a744
movq 0x6e898(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x2a740
incl 0x8(%rax)
jmp 0x2a744
movq 0x40(%rcx), %rdx
movq 0x48(%rcx), %rdi
testq %rdi, %rdi
je 0x2a7bf
movq 0x6e876(%rip), %rax     # 0x98fa8
cmpb $0x0, (%rax)
je 0x2a7bb
incl 0x8(%rdi)
jmp 0x2a7bf
lock
incl 0x8(%rax)
leaq 0x20(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x2b934
movq 0x20(%rsp), %rax
movq $0x0, 0x20(%rsp)
movq 0x8(%rsp), %rsi
movq %rax, 0x8(%rsp)
testq %rsi, %rsi
je 0x2a77d
leaq 0x8(%rsp), %rdi
callq 0x16f04
movq 0x20(%rsp), %rbx
testq %rbx, %rbx
je 0x2a797
movq %rbx, %rdi
callq 0x2c0f6
movq %rbx, %rdi
callq 0xa2b0
movq $0x0, 0x20(%rsp)
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x2a7b2
callq 0xdcba
addl $0x2, %r14d
jmp 0x2a874
lock
incl 0x8(%rdi)
movq %r13, 0x48(%rsp)
leaq 0x6eb3d(%rip), %rax     # 0x99308
movq (%rax), %rax
movq 0x1d0(%rax), %r13
testq %rdi, %rdi
je 0x2a7f7
movl %esi, 0x5c(%rsp)
movq %rdx, 0xc8(%rsp)
callq 0xdcba
movq 0xc8(%rsp), %rdx
movl 0x5c(%rsp), %esi
cmpq %r13, %rdx
jne 0x2aae2
movq 0x10(%rsp), %rdi
movq 0x48(%rsp), %r13
callq 0x27318
movl %eax, %ebx
cmpl 0x1c(%rsp), %eax
jg 0x2aa79
addl $0x2, %r14d
leal -0x1(%rbx), %ecx
leaq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl %r14d, %edx
callq 0x2a423
movq 0x20(%rsp), %rax
movq $0x0, 0x20(%rsp)
movq 0x8(%rsp), %rsi
movq %rax, 0x8(%rsp)
testq %rsi, %rsi
je 0x2a85b
leaq 0x8(%rsp), %rdi
callq 0x16f04
movq 0x20(%rsp), %rsi
testq %rsi, %rsi
je 0x2a86f
leaq 0x20(%rsp), %rdi
callq 0x16f04
incl %ebx
movl %ebx, %r14d
movq 0xd0(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %r13, 0x28(%rsp)
testq %r13, %r13
je 0x2a8a2
movq 0x6e716(%rip), %rax     # 0x98fa8
cmpb $0x0, (%rax)
je 0x2a89d
incl 0x8(%r13)
jmp 0x2a8a2
lock
incl 0x8(%r13)
movq 0x8(%rsp), %rax
movq %rax, 0x30(%rsp)
movq $0x0, 0x8(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x16cc8
movq 0x30(%rsp), %rsi
testq %rsi, %rsi
je 0x2a8d8
leaq 0x30(%rsp), %rdi
callq 0x16f04
movq $0x0, 0x30(%rsp)
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x2a8f0
callq 0xdcba
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0x2a904
leaq 0x8(%rsp), %rdi
callq 0x16f04
testq %r13, %r13
je 0x2a911
movq %r13, %rdi
callq 0xdcba
cmpl 0x1c(%rsp), %r14d
jle 0x2a466
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
cmpq $0x1, %rcx
je 0x2a99c
testq %rcx, %rcx
movq 0x80(%rsp), %rbx
jne 0x2a9aa
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 0x6c519(%rip), %rcx     # 0x96eb0
movq %rcx, (%rax)
jmp 0x2a9c7
cmpq $0x0, (%rax)
movq 0x80(%rsp), %rbx
je 0x2a9e9
leaq 0x20(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x2b9ec
movq 0x20(%rsp), %rax
movq $0x0, 0x20(%rsp)
movq %rax, (%rbx)
leaq 0x60(%rsp), %rdi
callq 0x2ba6a
movq %rbx, %rax
addq $0x168, %rsp            # imm = 0x168
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 0x2a9ca
movl $0x38, %edi
callq 0xa1b0
movq %rax, %r14
leaq 0x158(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x4cb92(%rip), %rsi     # 0x775ac
leaq 0x4cbb8(%rip), %rdx     # 0x775d9
leaq 0x148(%rsp), %rdi
callq 0xdf6a
sarq $0x20, %rbx
movq 0x10(%rsp), %rax
movq (%rax), %rax
shlq $0x4, %rbx
movq (%rax,%rbx), %rcx
movq %rcx, 0xf8(%rsp)
movq 0x8(%rax,%rbx), %rax
movq %rax, 0x100(%rsp)
testq %rax, %rax
je 0x2ab76
movq 0x6e541(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
jne 0x2ab73
lock
incl 0x8(%rax)
jmp 0x2ab76
movl $0x38, %edi
callq 0xa1b0
movq %rax, %r12
leaq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
movq %rax, (%rdi)
leaq 0x4cb40(%rip), %rsi     # 0x775da
leaq 0x4cb42(%rip), %rdx     # 0x775e3
callq 0xdf6a
leaq 0x4cb37(%rip), %rsi     # 0x775e4
leaq 0x20(%rsp), %rdi
callq 0xa560
leaq 0x138(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x2abb0
movups (%rcx), %xmm0
movups %xmm0, (%r14)
jmp 0x2abc3
movl $0x38, %edi
callq 0xa1b0
movq %rax, %r12
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax,%rbx), %rax
leaq 0xa8(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x98(%rsp), %rdi
callq 0xdde2
leaq 0x4cae6(%rip), %rsi     # 0x7760b
leaq 0x20(%rsp), %rdi
leaq 0x98(%rsp), %rdx
callq 0x1562b
leaq 0x4ca92(%rip), %rsi     # 0x775d0
leaq 0x20(%rsp), %rdi
callq 0xa560
leaq 0x118(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x2ac57
movups (%rcx), %xmm0
movups %xmm0, (%r15)
jmp 0x2ac6a
incl 0x8(%rax)
movb $0x1, %bpl
leaq 0x148(%rsp), %rsi
leaq 0xf8(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x200e4
xorl %ebp, %ebp
leaq 0x6ba9c(%rip), %rsi     # 0x96638
leaq -0x162ab(%rip), %rdx    # 0x148f8
movq %r14, %rdi
callq 0xa4f0
jmp 0x2acf5
movq %rdx, 0x128(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x138(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x130(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rax,%r15), %rcx
movq %rcx, 0xe8(%rsp)
movq 0x18(%rax,%r15), %rax
movq %rax, 0xf0(%rsp)
testq %rax, %rax
je 0x2ac1a
movq 0x6e39c(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
jne 0x2ac17
lock
incl 0x8(%rax)
jmp 0x2ac1a
incl 0x8(%rax)
movb $0x1, %bpl
leaq 0x128(%rsp), %rsi
leaq 0xe8(%rsp), %rcx
movq %r12, %rdi
movl $0x3, %edx
callq 0x200e4
xorl %ebp, %ebp
leaq 0x6b9f5(%rip), %rsi     # 0x96638
leaq -0x16352(%rip), %rdx    # 0x148f8
movq %r12, %rdi
callq 0xa4f0
jmp 0x2acf5
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 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax,%rbx), %rcx
movq %rcx, 0xd8(%rsp)
movq 0x8(%rax,%rbx), %rax
movq %rax, 0xe0(%rsp)
testq %rax, %rax
je 0x2acc0
movq 0x6e2f6(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
jne 0x2acbd
lock
incl 0x8(%rax)
jmp 0x2acc0
incl 0x8(%rax)
movb $0x1, %bpl
leaq 0x108(%rsp), %rsi
leaq 0xd8(%rsp), %rcx
movq %r12, %rdi
xorl %edx, %edx
callq 0x200e4
xorl %ebp, %ebp
leaq 0x6b952(%rip), %rsi     # 0x96638
leaq -0x163f5(%rip), %rdx    # 0x148f8
movq %r12, %rdi
callq 0xa4f0
jmp 0x2ad3c
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x2ad0c
callq 0xdcba
movq 0x108(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ad26
callq 0xa2b0
jmp 0x2ad26
movq %rax, %rbx
movb $0x1, %bpl
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x2ad4a
callq 0xa2b0
jmp 0x2ad4a
movq %rax, %rbx
jmp 0x2aea6
movq %rax, %rbx
movb $0x1, %bpl
movq 0x98(%rsp), %rdi
cmpq %r14, %rdi
jne 0x2ad97
jmp 0x2ada6
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x2ad6e
callq 0xdcba
movq 0x128(%rsp), %rdi
cmpq %r14, %rdi
je 0x2ad88
callq 0xa2b0
jmp 0x2ad88
movq %rax, %rbx
movb $0x1, %bpl
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x2ada6
callq 0xa2b0
jmp 0x2ada6
jmp 0x2ada0
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x2ae80
movq %r12, %rdi
callq 0xa240
jmp 0x2ae80
jmp 0x2adbe
movq %rax, %rbx
jmp 0x2ae80
movq %rax, %rbx
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0x2addb
callq 0xdcba
movq 0x148(%rsp), %rdi
cmpq %r15, %rdi
je 0x2adf5
callq 0xa2b0
jmp 0x2adf5
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x2aea6
movq %r14, %rdi
callq 0xa240
jmp 0x2aea6
movq %r13, 0x48(%rsp)
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x2ae80
callq 0xdcba
jmp 0x2ae80
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x16c98
leaq 0x98(%rsp), %rdi
callq 0x2b9be
xorl %ebp, %ebp
jmp 0x2ae4b
movq %rax, %rbx
movb $0x1, %bpl
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x2ae5d
callq 0xdcba
testb %bpl, %bpl
je 0x2aea6
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
jne 0x2aea1
jmp 0x2aea6
movq %r13, 0x48(%rsp)
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x16c98
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0x2ae94
leaq 0x8(%rsp), %rdi
callq 0x16f04
cmpq $0x0, 0x48(%rsp)
je 0x2aea6
movq 0x48(%rsp), %rdi
callq 0xdcba
leaq 0x60(%rsp), %rdi
callq 0x2ba6a
movq %rbx, %rdi
callq 0xa510