// File: /workspace/github_c_makefile_star2_O3/keithnoguchi[P]pearls-in-action/0x9/find_first_test.c
// Function: generate_array
static void generate_array(int x[], int n, enum dup_pos p, int count)
{
	int i, value, start;

	for (i = 0; i < n; i++)
		x[i] = i;
	if (count == 1)
		goto out;

	/* create duplicate */
	switch (p) {
	case DUPLICATE_FRONT:
		value = x[0];
		start = 0;
		break;
	case DUPLICATE_MIDDLE:
		value = x[(n-1)/2];
		start = (n-count)/2;
		break;
	case DUPLICATE_BACK:
		value = x[n-1];
		start = n-count;
		break;
	}
	for (i = 0; i < count; i++)
		x[start+i] = value;
out:
	dump_array(x, n);
}

// Assembly:
testl %esi, %esi
jle 0x139b
movl %esi, %r8d
leal 0x1(%rsi), %eax
andl $-0x2, %eax
decq %r8
movq %r8, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0xd2e(%rip), %xmm1      # 0x2050
xorl %r8d, %r8d
movdqa 0xd33(%rip), %xmm2      # 0x2060
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0xd33(%rip), %xmm4      # 0x2070
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %r9d
notl %r9d
testb $0x1, %r9b
je 0x1375
movl %r8d, (%rdi,%r8,4)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %r9d
testb $0x1, %r9b
je 0x138e
leal 0x1(%r8), %r9d
movl %r9d, 0x4(%rdi,%r8,4)
addq $0x2, %r8
paddq %xmm4, %xmm1
cmpq %r8, %rax
jne 0x133d
cmpl $0x1, %ecx
je 0x14df
cmpl $0x2, %edx
je 0x13d2
cmpl $0x1, %edx
je 0x13b9
testl %edx, %edx
jne 0x13de
movl (%rdi), %eax
xorl %r8d, %r8d
jmp 0x13de
leal -0x1(%rsi), %eax
shrl %eax
movl (%rdi,%rax,4), %eax
subl %ecx, %esi
movl %esi, %r8d
shrl $0x1f, %r8d
addl %esi, %r8d
sarl %r8d
jmp 0x13de
movslq %esi, %rax
movl -0x4(%rdi,%rax,4), %eax
subl %ecx, %esi
movl %esi, %r8d
testl %ecx, %ecx
jle 0x14df
movslq %r8d, %rdx
movl %ecx, %esi
addl $0x3, %ecx
decq %rsi
movq %rsi, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
leaq (%rdi,%rdx,4), %rdx
addq $0xc, %rdx
shrl $0x2, %ecx
shlq $0x4, %rcx
movdqa 0xc6e(%rip), %xmm1      # 0x2080
movdqa 0xc36(%rip), %xmm2      # 0x2050
xorl %esi, %esi
movdqa 0xc3c(%rip), %xmm3      # 0x2060
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movdqa 0xc5c(%rip), %xmm5      # 0x2090
movdqa %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %edi
notl %edi
testb $0x1, %dil
je 0x146d
movl %eax, -0xc(%rdx,%rsi)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %edi
testb $0x1, %dil
je 0x1480
movl %eax, -0x8(%rdx,%rsi)
movdqa %xmm1, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
pxor %xmm4, %xmm6
pextrw $0x0, %xmm6, %edi
testb $0x1, %dil
je 0x14bc
movl %eax, -0x4(%rdx,%rsi)
pextrw $0x4, %xmm6, %edi
testb $0x1, %dil
je 0x14ca
movl %eax, (%rdx,%rsi)
paddq %xmm5, %xmm2
paddq %xmm5, %xmm1
addq $0x10, %rsi
cmpq %rsi, %rcx
jne 0x1434
retq