#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ free(float *);
float *nonvalueAlphasPos(float);
int nonvalueAlphasCount(float value) {
  int i;
  float *nonvalueVector = nonvalueAlphasPos(value);
  for (i = 0; i < 8; i++) {
    if (nonvalueVector[i] == -1) {
      break;
    }
  }
  free(nonvalueVector);
  return i;
}


x86 assembly (clang, -O0):
<nonvalueAlphasCount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <nonvalueAlphasPos@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    1188 <nonvalueAlphasCount+0x68>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  0xe9f(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1175 <nonvalueAlphasCount+0x55>
jp     1175 <nonvalueAlphasCount+0x55>
jmp    1188 <nonvalueAlphasCount+0x68>
jmp    117a <nonvalueAlphasCount+0x5a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <nonvalueAlphasCount+0x22>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nonvalueAlphasCount>:
push   %rbx
call   1040 <nonvalueAlphasPos@plt>
movss  (%rax),%xmm0
xor    %ebx,%ebx
ucomiss 0xecd(%rip),%xmm0
jne    113b <nonvalueAlphasCount+0x1b>
jnp    11d7 <nonvalueAlphasCount+0xb7>
movss  0x4(%rax),%xmm0
mov    $0x1,%ebx
ucomiss 0xeb4(%rip),%xmm0
jne    1154 <nonvalueAlphasCount+0x34>
jnp    11d7 <nonvalueAlphasCount+0xb7>
movss  0x8(%rax),%xmm0
mov    $0x2,%ebx
ucomiss 0xe9b(%rip),%xmm0
jne    1169 <nonvalueAlphasCount+0x49>
jnp    11d7 <nonvalueAlphasCount+0xb7>
movss  0xc(%rax),%xmm0
mov    $0x3,%ebx
ucomiss 0xe86(%rip),%xmm0
jne    117e <nonvalueAlphasCount+0x5e>
jnp    11d7 <nonvalueAlphasCount+0xb7>
movss  0x10(%rax),%xmm0
mov    $0x4,%ebx
ucomiss 0xe71(%rip),%xmm0
jne    1193 <nonvalueAlphasCount+0x73>
jnp    11d7 <nonvalueAlphasCount+0xb7>
movss  0x14(%rax),%xmm0
mov    $0x5,%ebx
ucomiss 0xe5c(%rip),%xmm0
jne    11a8 <nonvalueAlphasCount+0x88>
jnp    11d7 <nonvalueAlphasCount+0xb7>
movss  0x18(%rax),%xmm0
mov    $0x6,%ebx
ucomiss 0xe47(%rip),%xmm0
jne    11bd <nonvalueAlphasCount+0x9d>
jnp    11d7 <nonvalueAlphasCount+0xb7>
movss  0x1c(%rax),%xmm0
mov    $0x7,%ebx
ucomiss 0xe32(%rip),%xmm0
jne    11d2 <nonvalueAlphasCount+0xb2>
jnp    11d7 <nonvalueAlphasCount+0xb7>
mov    $0x8,%ebx
mov    %rax,%rdi
call   1030 <free@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @nonvalueAlphasCount(float %0) {
%2 = alloca float
%3 = alloca i32
%4 = alloca float*
store float %0, float* %2
%5 = load float, float* %2
%6 = call float* @nonvalueAlphasPos(float %5)
store float* %6, float** %4
store i32 0, i32* %3
br label %7
7: ; preds = %19, %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 8
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = load float*, float** %4
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds float, float* %11, i64 %13
%15 = load float, float* %14
%16 = fcmp oeq float %15, -1.000000e+00
br i1 %16, label %17, label %18
17: ; preds = %10
br label %22
18: ; preds = %10
br label %19
19: ; preds = %18
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %7
22: ; preds = %17, %7
%23 = load float*, float** %4
%24 = call i32 @free(float* %23)
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @nonvalueAlphasCount(float %0) {
%2 = tail call float* @nonvalueAlphasPos(float %0)
%3 = load float, float* %2
%4 = fcmp oeq float %3, -1.000000e+00
br i1 %4, label %34, label %5
5: ; preds = %1
%6 = getelementptr inbounds float, float* %2, i64 1
%7 = load float, float* %6
%8 = fcmp oeq float %7, -1.000000e+00
br i1 %8, label %34, label %9
9: ; preds = %5
%10 = getelementptr inbounds float, float* %2, i64 2
%11 = load float, float* %10
%12 = fcmp oeq float %11, -1.000000e+00
br i1 %12, label %34, label %13
13: ; preds = %9
%14 = getelementptr inbounds float, float* %2, i64 3
%15 = load float, float* %14
%16 = fcmp oeq float %15, -1.000000e+00
br i1 %16, label %34, label %17
17: ; preds = %13
%18 = getelementptr inbounds float, float* %2, i64 4
%19 = load float, float* %18
%20 = fcmp oeq float %19, -1.000000e+00
br i1 %20, label %34, label %21
21: ; preds = %17
%22 = getelementptr inbounds float, float* %2, i64 5
%23 = load float, float* %22
%24 = fcmp oeq float %23, -1.000000e+00
br i1 %24, label %34, label %25
25: ; preds = %21
%26 = getelementptr inbounds float, float* %2, i64 6
%27 = load float, float* %26
%28 = fcmp oeq float %27, -1.000000e+00
br i1 %28, label %34, label %29
29: ; preds = %25
%30 = getelementptr inbounds float, float* %2, i64 7
%31 = load float, float* %30
%32 = fcmp oeq float %31, -1.000000e+00
br i1 %32, label %34, label %33
33: ; preds = %29
br label %34
34: ; preds = %33, %29, %25, %21, %17, %13, %9, %5, %1
%35 = phi i32 [ 0, %1 ], [ 1, %5 ], [ 2, %9 ], [ 3, %13 ], [ 4, %17 ], [ 5, %21 ], [ 6, %25 ], [ 7, %29 ], [ 8, %33 ]
%36 = tail call i32 @free(float* %2)
ret i32 %35
}