// File: /workspace/github_cpp_makefile_star2_O2/shuhaosun[P]ECM-Sketch/./ECM_Sketch.h
// Function: ECM_Sketch::Insert_bucket(int, int, int)
void Insert_bucket(int i, int j, int t)
	{
		int z = counter[i][j].number;
		int p = -1;
		int value = 0;
		int first = 0;
		if (counter[i][j].number == -1)
		{
			counter[i][j].bucket[0].exponent = 0;
			counter[i][j].bucket[0].start = t;
			counter[i][j].bucket[0].end = t;
			counter[i][j].number = 1;
		}
		else
		{
			while (p < z)
			{
				if ((counter[i][j].bucket[p + 2].exponent == value) && (p == -1))    // p+2 = 1
				{
					counter[i][j].bucket[p + 2].exponent++;
					counter[i][j].bucket[p + 2].end = counter[i][j].bucket[p + 1].end;
					counter[i][j].bucket[p + 1].start = counter[i][j].bucket[p + 2].end;
					counter[i][j].bucket[p + 1].end = t;
					p = p + 2;
					value = counter[i][j].bucket[p].exponent;
				}
				else if ((counter[i][j].bucket[p + 2].exponent == value) && (p != -1))
				{
					counter[i][j].bucket[p + 2].exponent++;
					counter[i][j].bucket[p + 2].end = counter[i][j].bucket[p + 1].end;
					counter[i][j].bucket[p + 1].start = counter[i][j].bucket[p + 2].end;
					for (int q = p + 1; q > first; q--)
					{
						counter[i][j].bucket[q].exponent = counter[i][j].bucket[q - 1].exponent;
						counter[i][j].bucket[q].start = counter[i][j].bucket[q - 1].start;
						counter[i][j].bucket[q].end = counter[i][j].bucket[q - 1].end;
					}
					first++;
					counter[i][j].number--;
					p = p + 2;
					value = counter[i][j].bucket[p].exponent;
				}
				else if ((counter[i][j].bucket[p + 2].exponent != value) && (p != -1))
				{
					break;
				}
				else
				{
					for (int q = z; q > 0; q--)
					{
						counter[i][j].bucket[q].exponent = counter[i][j].bucket[q - 1].exponent;
						counter[i][j].bucket[q].start = counter[i][j].bucket[q - 1].start;
						counter[i][j].bucket[q].end = counter[i][j].bucket[q - 1].end;
					}
					counter[i][j].number++;
					counter[i][j].bucket[0].exponent = 0;
					counter[i][j].bucket[0].start = counter[i][j].bucket[1].end;
					counter[i][j].bucket[0].end = t;
					break;
				}
			}
			int qq = 0;
			if (first != 0)
			{
				for (int q = first; q < first + counter[i][j].number; ++q)
				{
					counter[i][j].bucket[qq].exponent = counter[i][j].bucket[q].exponent;
					counter[i][j].bucket[qq].start = counter[i][j].bucket[q].start;
					counter[i][j].bucket[qq].end = counter[i][j].bucket[q].end;
					qq++;
				}
				for (int q = qq; q < qq + first; ++q)
				{
					counter[i][j].bucket[q].exponent = -1;
					counter[i][j].bucket[q].start = -1;
					counter[i][j].bucket[q].end = -1;
				}
			}
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq %esi, %rax
movq 0xf0(%rdi,%rax,8), %rsi
movslq %edx, %rax
imulq $0x4b4, %rax, %rdx      # imm = 0x4B4
leaq (%rsi,%rdx), %r9
leaq (%rsi,%rdx), %r11
addq $0x4, %r11
movslq 0x4ac(%r11), %r14
cmpq $-0x1, %r14
je 0x1d75
movl %r14d, %eax
movq %rax, -0x8(%rsp)
movq %rsi, -0x18(%rsp)
movq %rdx, -0x20(%rsp)
leaq (%rsi,%rdx), %rax
addq $0x4b0, %rax            # imm = 0x4B0
movq %rax, -0x10(%rsp)
xorl %ebp, %ebp
movabsq $-0x1, %r15
movl %r14d, %edi
xorl %r12d, %r12d
xorl %eax, %eax
movslq %eax, %rbx
cmpq %r14, %r15
jge 0x1de1
leaq 0x2(%r15), %rsi
imulq $0xc, %rsi, %rdx
leaq (%r9,%rdx), %r13
movl (%r9,%rdx), %r8d
cmpq $-0x1, %r15
jne 0x1d0f
cmpl %r12d, %r8d
jne 0x1d0f
incl %r12d
movl %r12d, (%r13)
movl 0x4(%r9), %r8d
movl %r8d, 0x4(%r9,%rdx)
movl %r8d, 0x8(%r9)
movl %ecx, (%r11)
jmp 0x1d6a
cmpq $-0x1, %r15
je 0x1d90
cmpl %r12d, %r8d
jne 0x1d90
movslq %ebp, %r10
imulq $0xc, %r10, %r8
addq %r9, %r8
incl %r12d
movl %r12d, (%r13)
imulq $0xc, %r15, %r15
movl 0x10(%r15,%r9), %r12d
movl %r12d, 0x4(%r9,%rdx)
movl %r12d, 0x14(%r15,%r9)
cmpq %rbx, %r10
jle 0x1d5b
decq %r10
movl -0x4(%r8), %edx
movl %edx, 0x8(%r8)
movq -0xc(%r8), %rdx
movq %rdx, (%r8)
addq $-0xc, %r8
jmp 0x1d3e
incl %eax
decl %edi
movq -0x10(%rsp), %rdx
movl %edi, (%rdx)
movl (%r13), %r12d
addl $0x2, %ebp
movq %rsi, %r15
jmp 0x1ccf
andl $0x0, (%r9)
movl %ecx, 0x8(%rsi,%rdx)
movl %ecx, (%r11)
movl $0x1, 0x4b0(%rsi,%rdx)
jmp 0x1e3d
cmpq $-0x1, %r15
je 0x1d9b
cmpl %r12d, %r8d
jne 0x1de1
movq -0x8(%rsp), %r8
imulq $0xc, %r8, %rdx
addq -0x20(%rsp), %rdx
addq -0x18(%rsp), %rdx
testq %r8, %r8
jle 0x1dc9
decq %r8
movl -0x4(%rdx), %esi
movl %esi, 0x8(%rdx)
movq -0xc(%rdx), %rsi
movq %rsi, (%rdx)
addq $-0xc, %rdx
jmp 0x1dae
incl %edi
movq -0x10(%rsp), %rdx
movl %edi, (%rdx)
andl $0x0, (%r9)
movl 0x10(%r9), %edx
movl %edx, 0x8(%r9)
movl %ecx, (%r11)
testl %eax, %eax
je 0x1e3d
addl %eax, %edi
movslq %edi, %rsi
movq -0x18(%rsp), %rcx
movq -0x20(%rsp), %rdx
addq %rdx, %rcx
addq $0x8, %rcx
imulq $0xc, %rbx, %rdi
xorl %edx, %edx
leaq (%rbx,%rdx), %r8
cmpq %rsi, %r8
jge 0x1e23
movl (%rcx,%rdi), %r8d
movl %r8d, (%rcx)
movq -0x8(%rcx,%rdi), %r8
movq %r8, -0x8(%rcx)
incq %rdx
addq $0xc, %rcx
jmp 0x1e01
addl %edx, %eax
cltq
cmpq %rax, %rdx
jge 0x1e3d
orq $-0x1, -0x8(%rcx)
orl $-0x1, (%rcx)
incq %rdx
addq $0xc, %rcx
jmp 0x1e27
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq