int nonzerosNonCAlphasRandomLoop(int i2) {
  int i, n;
  int *randomAlphas;
  float *nonzerosNonCAlphasVector;
  nonzerosNonCAlphasVector = nonzeroNonCAlphasPos();
  n = alphasVectorCount(nonzerosNonCAlphasVector);
  randomAlphas = randomPermutation(n);
  for (i = 0; i < n; i++) {
    if (takeStep(randomAlphas[i], i2)) {
      free(randomAlphas);
      free(nonzerosNonCAlphasVector);
      return 1;
    }
  }
  free(randomAlphas);
  free(nonzerosNonCAlphasVector);
  return 0;
}


x86 assembly (clang, -O0):
<nonzerosNonCAlphasRandomLoop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <nonzeroNonCAlphasPos@plt>
cltq
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1060 <alphasVectorCount@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    $0x0,%al
call   1070 <randomPermutation@plt>
cltq
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11e8 <nonzerosNonCAlphasRandomLoop+0x98>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x8(%rbp),%esi
mov    $0x0,%al
call   1050 <takeStep@plt>
cmp    $0x0,%eax
je     11d5 <nonzerosNonCAlphasRandomLoop+0x85>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    1201 <nonzerosNonCAlphasRandomLoop+0xb1>
jmp    11da <nonzerosNonCAlphasRandomLoop+0x8a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118d <nonzerosNonCAlphasRandomLoop+0x3d>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nonzerosNonCAlphasRandomLoop>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r13d
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <nonzeroNonCAlphasPos@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <alphasVectorCount@plt>
mov    %eax,%r12d
mov    %eax,%edi
xor    %eax,%eax
call   1070 <randomPermutation@plt>
movslq %eax,%r14
test   %r12d,%r12d
jle    11ca <nonzerosNonCAlphasRandomLoop+0x7a>
mov    %rbx,(%rsp)
mov    %r12d,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14,%rbx,4),%edi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <takeStep@plt>
test   %eax,%eax
jne    11c0 <nonzerosNonCAlphasRandomLoop+0x70>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11a0 <nonzerosNonCAlphasRandomLoop+0x50>
xor    %r15d,%r15d
jmp    11c6 <nonzerosNonCAlphasRandomLoop+0x76>
mov    $0x1,%r15d
mov    (%rsp),%rbx
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @nonzerosNonCAlphasRandomLoop(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca float*
store i32 %0, i32* %3
%8 = call i32 (...) @nonzeroNonCAlphasPos()
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to float*
store float* %10, float** %7
%11 = load float*, float** %7
%12 = call i32 (float*, ...) bitcast (i32 (...)* @alphasVectorCount to i32 (float*, ...)*)(float* %11)
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = call i32 (i32, ...) bitcast (i32 (...)* @randomPermutation to i32 (i32, ...)*)(i32 %13)
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
store i32* %16, i32** %6
store i32 0, i32* %4
br label %17
17: ; preds = %36, %1
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %39
21: ; preds = %17
%22 = load i32*, i32** %6
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
%26 = load i32, i32* %25
%27 = load i32, i32* %3
%28 = call i32 (i32, i32, ...) bitcast (i32 (...)* @takeStep to i32 (i32, i32, ...)*)(i32 %26, i32 %27)
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %21
%31 = load i32*, i32** %6
%32 = bitcast i32* %31 to i8*
%33 = load float*, float** %7
%34 = bitcast float* %33 to i8*
store i32 1, i32* %2
br label %44
35: ; preds = %21
br label %36
36: ; preds = %35
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
br label %17
39: ; preds = %17
%40 = load i32*, i32** %6
%41 = bitcast i32* %40 to i8*
%42 = load float*, float** %7
%43 = bitcast float* %42 to i8*
store i32 0, i32* %2
br label %44
44: ; preds = %39, %30
%45 = load i32, i32* %2
ret i32 %45
}

LLVM IR (-O2):
define i32 @nonzerosNonCAlphasRandomLoop(i32 %0) {
%2 = tail call i32 (...) @nonzeroNonCAlphasPos()
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to float*
%5 = tail call i32 (float*, ...) bitcast (i32 (...)* @alphasVectorCount to i32 (float*, ...)*)(float* %4)
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @randomPermutation to i32 (i32, ...)*)(i32 %5)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = icmp sgt i32 %5, 0
br i1 %9, label %10, label %21
10: ; preds = %1
%11 = zext i32 %5 to i64
br label %14
12: ; preds = %14
%13 = icmp eq i64 %20, %11
br i1 %13, label %21, label %14
14: ; preds = %10, %12
%15 = phi i64 [ 0, %10 ], [ %20, %12 ]
%16 = getelementptr inbounds i32, i32* %8, i64 %15
%17 = load i32, i32* %16
%18 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @takeStep to i32 (i32, i32, ...)*)(i32 %17, i32 %0)
%19 = icmp eq i32 %18, 0
%20 = add nuw nsw i64 %15, 1
br i1 %19, label %12, label %21
21: ; preds = %12, %14, %1
%22 = phi i32 [ 0, %1 ], [ 1, %14 ], [ 0, %12 ]
%23 = inttoptr i64 %7 to i8*
tail call void @free(i8* %23)
%24 = inttoptr i64 %3 to i8*
tail call void @free(i8* %24)
ret i32 %22
}