// File: /workspace/github_c_makefile_star2_O3/cbouilla[P]AES-attacks-finder/Bazar.c
// Function: NextSet
int NextSet(int * X, int l, int n)
{
	int i;
	for (i = 1; i <= l; i++)
	{
		if (X[l-i]!=n-i)
		{
			int j;
			int add = ++X[l-i];
			for (j = l-i+1; j < l; j++) X[j] = ++add;
			return 1;
		}
	}
			
	for (i = 0; i < l; i++) X[i]=i;
	return 0;
}

// Assembly:
testl %esi, %esi
jle 0x2fdb
movl %esi, %ecx
decl %edx
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movq %rcx, %rax
movq %rcx, %r8
movl -0x4(%rdi,%r8,4), %r10d
cmpl %r10d, %edx
jne 0x2fde
incl %r9d
decq %r8
decl %edx
decq %rax
jne 0x2f35
leal 0x1(%rcx), %eax
andl $-0x2, %eax
decq %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0x261a5(%rip), %xmm1    # 0x29110
xorl %ecx, %ecx
movdqa 0x261ab(%rip), %xmm2    # 0x29120
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0x261db(%rip), %xmm4    # 0x29160
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, %edx
notl %edx
testb $0x1, %dl
je 0x2fb9
movl %ecx, (%rdi,%rcx,4)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %edx
testb $0x1, %dl
je 0x2fce
leal 0x1(%rcx), %edx
movl %edx, 0x4(%rdi,%rcx,4)
addq $0x2, %rcx
paddq %xmm4, %xmm1
cmpq %rcx, %rax
jne 0x2f85
xorl %eax, %eax
retq
incl %r10d
movl %r10d, -0x4(%rdi,%r8,4)
movl $0x1, %eax
cmpl %esi, %r8d
jge 0x3138
movl %r9d, %ecx
movd %r10d, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
paddd 0x26127(%rip), %xmm0    # 0x29130
movq %rcx, %xmm1
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
addq $0x4, %rcx
andq $-0x4, %rcx
movslq %r8d, %rdx
leaq (%rdi,%rdx,4), %rdx
addq $0xc, %rdx
xorl %esi, %esi
movdqa 0x26110(%rip), %xmm2    # 0x29140
movdqa 0x260d8(%rip), %xmm3    # 0x29110
movdqa 0x260e0(%rip), %xmm4    # 0x29120
pxor %xmm4, %xmm1
pcmpeqd %xmm5, %xmm5
movdqa 0x26100(%rip), %xmm6    # 0x29150
movq %rsi, %xmm7
pshufd $0x44, %xmm7, %xmm8     # xmm8 = xmm7[0,1,0,1]
movdqa %xmm8, %xmm7
por %xmm3, %xmm7
pxor %xmm4, %xmm7
movdqa %xmm7, %xmm9
pcmpgtd %xmm1, %xmm9
pcmpeqd %xmm1, %xmm7
pshufd $0xf5, %xmm7, %xmm7     # xmm7 = xmm7[1,1,3,3]
pand %xmm9, %xmm7
pshufd $0xf5, %xmm9, %xmm9     # xmm9 = xmm9[1,1,3,3]
por %xmm7, %xmm9
movdqa %xmm0, %xmm7
psubd %xmm5, %xmm7
movd %xmm9, %edi
notl %edi
testb $0x1, %dil
je 0x30a6
movd %xmm7, -0xc(%rdx,%rsi,4)
pxor %xmm5, %xmm9
pextrw $0x4, %xmm9, %edi
testb $0x1, %dil
je 0x30c4
pshufd $0x55, %xmm7, %xmm9     # xmm9 = xmm7[1,1,1,1]
movd %xmm9, -0x8(%rdx,%rsi,4)
por %xmm2, %xmm8
pxor %xmm4, %xmm8
movdqa %xmm8, %xmm9
pcmpgtd %xmm1, %xmm9
pcmpeqd %xmm1, %xmm8
pshufd $0xf5, %xmm8, %xmm10    # xmm10 = xmm8[1,1,3,3]
pand %xmm9, %xmm10
pshufd $0xf5, %xmm9, %xmm8     # xmm8 = xmm9[1,1,3,3]
por %xmm10, %xmm8
pxor %xmm5, %xmm8
pextrw $0x0, %xmm8, %edi
testb $0x1, %dil
je 0x3111
pshufd $0xee, %xmm7, %xmm9     # xmm9 = xmm7[2,3,2,3]
movd %xmm9, -0x4(%rdx,%rsi,4)
pextrw $0x4, %xmm8, %edi
testb $0x1, %dil
je 0x3127
pshufd $0xff, %xmm7, %xmm7     # xmm7 = xmm7[3,3,3,3]
movd %xmm7, (%rdx,%rsi,4)
addq $0x4, %rsi
paddd %xmm6, %xmm0
cmpq %rsi, %rcx
jne 0x3050
retq
nopl (%rax)