// File: /workspace/github_cpp_makefile_star2_O1/minirop[P]JDecomqiler/src/ClassFile.cpp
// Function: ClassFile::parseConstant()
bool ClassFile::parseConstant()
{
	bool isDoubleSize = false;
	
	CPinfo info;
	
	stream >> info.tag;
	
	switch(info.tag)
	{
		case CONSTANT_Utf8:
			{
				std::uint16_t length;
				stream >> length;
				char * string = new char[length+1];
				stream.readRawData(string, length);
				string[length] = 0;
				info.UTF8Info.bytes = string;
				toDelete.push_back(string);
			}
			break;
		case CONSTANT_Integer:
			stream >> info.IntegerInfo.bytes;
			break;
		case CONSTANT_Float:
			stream >> info.FloatInfo.bytes;
			break;
		case CONSTANT_Long:
			stream >> info.BigIntInfo.bytes;
			isDoubleSize = true;
			break;
		case CONSTANT_Double:
			stream >> info.DoubleInfo.bytes;
			isDoubleSize = true;
			break;
		case CONSTANT_Class:
			stream >> info.ClassInfo.name_index;
			break;
		case CONSTANT_String:
			stream >> info.StringInfo.string_index;
			break;
		case CONSTANT_Fieldref:
			stream >> info.RefInfo.class_index;
			stream >> info.RefInfo.name_and_type_index;
			break;
		case CONSTANT_Methodref:
			stream >> info.RefInfo.class_index;
			stream >> info.RefInfo.name_and_type_index;
			break;
		case CONSTANT_InterfaceMethodref:
			stream >> info.RefInfo.class_index;
			stream >> info.RefInfo.name_and_type_index;
			break;
		case CONSTANT_NameAndType:
			stream >> info.NameAndTypeInfo.name_index;
			stream >> info.NameAndTypeInfo.descriptor_index;
			break;
		case CONSTANT_MethodHandle:
			stream >> info.MethodHandleInfo.reference_kind;
			stream >> info.MethodHandleInfo.reference_index;
			break;
		case CONSTANT_MethodType:
			stream >> info.MethodTypeInfo.descriptor_index;
			break;
		case CONSTANT_InvokeDynamic:
			stream >> info.InvokeDynamicInfo.bootstrap_method_attr_index;
			stream >> info.InvokeDynamicInfo.name_and_type_index;
			break;
		default:
			cerr << "ERROR: unrecognize TAG" << endl;
			exit(1);
	}
	
	constant_pool.push_back(info);
	
	return isDoubleSize;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
leaq -0x20(%rbp), %rbx
movb $0x0, (%rbx)
movq 0xa8(%rdi), %rdi
movl $0x1, %edx
movq %rbx, %rsi
callq 0x22d0
movzbl (%rbx), %eax
movb %al, -0x38(%rbp)
decl %eax
cmpl $0x11, %eax
ja 0x3606
leaq 0x18bf3(%rip), %rcx     # 0x1c01c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %ebx, %ebx
leaq -0x20(%rbp), %r15
movw %bx, (%r15)
movq 0xa8(%r14), %rdi
movl $0x2, %edx
movq %r15, %rsi
callq 0x22d0
movzwl (%r15), %eax
rolw $0x8, %ax
movw %ax, -0x30(%rbp)
movw %bx, (%r15)
movq 0xa8(%r14), %rdi
leaq -0x20(%rbp), %r14
movl $0x2, %edx
movq %r14, %rsi
callq 0x22d0
movzwl (%r14), %eax
rolw $0x8, %ax
movw %ax, -0x2e(%rbp)
jmp 0x35c2
movw $0x0, (%rbx)
movq 0xa8(%r14), %rdi
movl $0x2, %edx
movq %rbx, %rsi
callq 0x22d0
movzwl (%rbx), %eax
rolw $0x8, %ax
movw %ax, -0x30(%rbp)
jmp 0x35c0
movl $0x0, (%rbx)
movq 0xa8(%r14), %rdi
movl $0x4, %edx
movq %rbx, %rsi
callq 0x22d0
movl (%rbx), %eax
bswapl %eax
movl %eax, -0x30(%rbp)
jmp 0x35c0
xorl %ebx, %ebx
leaq -0x20(%rbp), %rsi
movq %rbx, (%rsi)
movq 0xa8(%r14), %rdi
movl $0x8, %edx
callq 0x22d0
movq %rbx, -0x30(%rbp)
movb $0x1, %bl
jmp 0x35c2
movw $0x0, (%rbx)
movq 0xa8(%r14), %rdi
movl $0x2, %edx
movq %rbx, %rsi
callq 0x22d0
movzwl (%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %r15d
leaq 0x1(%r15), %rdi
callq 0x2030
movq %rax, (%rbx)
movq 0xa8(%r14), %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x22d0
movq (%rbx), %rax
movb $0x0, (%rax,%r15)
movq (%rbx), %rax
movq %rax, -0x28(%rbp)
movq 0x98(%r14), %rsi
cmpq 0xa0(%r14), %rsi
je 0x35ad
movq %rax, (%rsi)
addq $0x8, 0x98(%r14)
jmp 0x35c0
movb $0x0, (%rbx)
movq 0xa8(%r14), %rdi
movl $0x1, %edx
movq %rbx, %rsi
callq 0x22d0
movb (%rbx), %al
movb %al, -0x30(%rbp)
movw $0x0, (%rbx)
movq 0xa8(%r14), %rdi
movl $0x2, %edx
movq %rbx, %rsi
callq 0x22d0
movzwl (%rbx), %eax
rolw $0x8, %ax
movw %ax, -0x2e(%rbp)
jmp 0x35c0
addq $0x90, %r14
leaq -0x20(%rbp), %rdx
movq %r14, %rdi
callq 0x5138
xorl %ebx, %ebx
leaq 0x1fc4f(%rip), %rax     # 0x23218
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x35e9
movq -0x28(%rbp), %rcx
movq %rcx, 0x10(%rsi)
movups -0x38(%rbp), %xmm0
movups %xmm0, (%rsi)
addq $0x18, 0x8(%rax)
jmp 0x35f9
leaq 0x1fc28(%rip), %rdi     # 0x23218
leaq -0x38(%rbp), %rdx
callq 0x5272
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x1f9e3(%rip), %rdi     # 0x22ff0
leaq 0x18af6(%rip), %rsi     # 0x1c10a
callq 0x2220
movq %rax, %rdi
callq 0x2130
movl $0x1, %edi
callq 0x22a0
nop