#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 alphasVectorCount(float *);
scalar_t__ examineExample(float);
int /*<<< orphan*/ free(float *);
int /*<<< orphan*/ initializeVariables();
float *nonzeroNonCAlphasPos();
void smo() {
  int i, n;
  int numChanged = 0, examineAll = 1;
  float *nonzeroNonCAlphasVector;
  initializeVariables();
  while (numChanged > 0 || examineAll) {
    numChanged = 0;
    if (examineAll) {
      for (i = 0; i < 8; i++) {
        numChanged += examineExample(i);
      }
    } else {
      nonzeroNonCAlphasVector = nonzeroNonCAlphasPos();
      n = alphasVectorCount(nonzeroNonCAlphasVector);
      for (i = 0; i < n; i++) {
        numChanged += examineExample(nonzeroNonCAlphasVector[i]);
      }
      free(nonzeroNonCAlphasVector);
    }
    if (examineAll) {
      examineAll = 0;
    } else if (!numChanged) {
      examineAll = 1;
    }
  }
}


x86 assembly (clang, -O0):
<smo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    $0x0,%al
call   1060 <initializeVariables@plt>
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x19(%rbp)
jg     1186 <smo+0x36>
cmpl   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1196 <smo+0x46>
jmp    1273 <smo+0x123>
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11e2 <smo+0x92>
movl   $0x0,-0x4(%rbp)
cmpl   $0x8,-0x4(%rbp)
jge    11dd <smo+0x8d>
cvtsi2ssl -0x4(%rbp),%xmm0
call   1050 <examineExample@plt>
mov    %rax,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11ae <smo+0x5e>
jmp    1242 <smo+0xf2>
mov    $0x0,%al
call   1040 <nonzeroNonCAlphasPos@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <alphasVectorCount@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1239 <smo+0xe9>
mov    -0x18(%rbp),%rax
movslq -0x4(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1050 <examineExample@plt>
mov    %rax,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1200 <smo+0xb0>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x10(%rbp)
je     1258 <smo+0x108>
movl   $0x0,-0x10(%rbp)
jmp    126e <smo+0x11e>
cmpl   $0x0,-0xc(%rbp)
jne    1269 <smo+0x119>
movl   $0x1,-0x10(%rbp)
jmp    126e <smo+0x11e>
jmp    116d <smo+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smo>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %eax,%eax
call   1060 <initializeVariables@plt>
mov    $0x1,%r15b
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   $0x1,%r15b
je     1210 <smo+0xc0>
xorps  %xmm0,%xmm0
call   1050 <examineExample@plt>
mov    %rax,%r14
movss  0xe73(%rip),%xmm0
call   1050 <examineExample@plt>
mov    %rax,%rbx
add    %r14d,%ebx
movss  0xe64(%rip),%xmm0
call   1050 <examineExample@plt>
mov    %rax,%r14
add    %ebx,%r14d
movss  0xe55(%rip),%xmm0
call   1050 <examineExample@plt>
mov    %rax,%rbx
add    %r14d,%ebx
movss  0xe46(%rip),%xmm0
call   1050 <examineExample@plt>
mov    %rax,%r14
add    %ebx,%r14d
movss  0xe37(%rip),%xmm0
call   1050 <examineExample@plt>
mov    %rax,%rbx
add    %r14d,%ebx
movss  0xe28(%rip),%xmm0
call   1050 <examineExample@plt>
mov    %rax,%r14
add    %ebx,%r14d
movss  0xe19(%rip),%xmm0
call   1050 <examineExample@plt>
mov    %rax,%rbx
add    %r14d,%ebx
jmp    124e <smo+0xfe>
nopl   0x0(%rax)
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <nonzeroNonCAlphasPos@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1070 <alphasVectorCount@plt>
test   %eax,%eax
jle    1246 <smo+0xf6>
mov    %eax,%r12d
xor    %ebp,%ebp
xor    %ebx,%ebx
nop
movss  (%r14,%rbp,4),%xmm0
call   1050 <examineExample@plt>
add    %eax,%ebx
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1230 <smo+0xe0>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15d,%eax
not    %al
test   %ebx,%ebx
sete   %r15b
and    %al,%r15b
test   %ebx,%ebx
jg     1170 <smo+0x20>
test   %r15b,%r15b
jne    1170 <smo+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @smo() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float*
store i32 0, i32* %3
store i32 1, i32* %4
%6 = call i32 (...) @initializeVariables()
br label %7
7: ; preds = %68, %0
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 0
br label %13
13: ; preds = %10, %7
%14 = phi i1 [ true, %7 ], [ %12, %10 ]
br i1 %14, label %15, label %69
15: ; preds = %13
store i32 0, i32* %3
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %34
18: ; preds = %15
store i32 0, i32* %1
br label %19
19: ; preds = %30, %18
%20 = load i32, i32* %1
%21 = icmp slt i32 %20, 8
br i1 %21, label %22, label %33
22: ; preds = %19
%23 = load i32, i32* %1
%24 = sitofp i32 %23 to float
%25 = call i64 @examineExample(float %24)
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = add nsw i64 %27, %25
%29 = trunc i64 %28 to i32
store i32 %29, i32* %3
br label %30
30: ; preds = %22
%31 = load i32, i32* %1
%32 = add nsw i32 %31, 1
store i32 %32, i32* %1
br label %19
33: ; preds = %19
br label %59
34: ; preds = %15
%35 = call float* (...) @nonzeroNonCAlphasPos()
store float* %35, float** %5
%36 = load float*, float** %5
%37 = call i32 @alphasVectorCount(float* %36)
store i32 %37, i32* %2
store i32 0, i32* %1
br label %38
38: ; preds = %53, %34
%39 = load i32, i32* %1
%40 = load i32, i32* %2
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %56
42: ; preds = %38
%43 = load float*, float** %5
%44 = load i32, i32* %1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds float, float* %43, i64 %45
%47 = load float, float* %46
%48 = call i64 @examineExample(float %47)
%49 = load i32, i32* %3
%50 = sext i32 %49 to i64
%51 = add nsw i64 %50, %48
%52 = trunc i64 %51 to i32
store i32 %52, i32* %3
br label %53
53: ; preds = %42
%54 = load i32, i32* %1
%55 = add nsw i32 %54, 1
store i32 %55, i32* %1
br label %38
56: ; preds = %38
%57 = load float*, float** %5
%58 = call i32 @free(float* %57)
br label %59
59: ; preds = %56, %33
%60 = load i32, i32* %4
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %63
62: ; preds = %59
store i32 0, i32* %4
br label %68
63: ; preds = %59
%64 = load i32, i32* %3
%65 = icmp ne i32 %64, 0
br i1 %65, label %67, label %66
66: ; preds = %63
store i32 1, i32* %4
br label %67
67: ; preds = %66, %63
br label %68
68: ; preds = %67, %62
br label %7
69: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @smo() {
%1 = tail call i32 (...) @initializeVariables()
br label %2
2: ; preds = %0, %47
%3 = phi i1 [ true, %0 ], [ %51, %47 ]
br i1 %3, label %4, label %28
4: ; preds = %2
%5 = tail call i64 @examineExample(float 0.000000e+00)
%6 = trunc i64 %5 to i32
%7 = tail call i64 @examineExample(float 1.000000e+00)
%8 = trunc i64 %7 to i32
%9 = add i32 %6, %8
%10 = tail call i64 @examineExample(float 2.000000e+00)
%11 = trunc i64 %10 to i32
%12 = add i32 %9, %11
%13 = tail call i64 @examineExample(float 3.000000e+00)
%14 = trunc i64 %13 to i32
%15 = add i32 %12, %14
%16 = tail call i64 @examineExample(float 4.000000e+00)
%17 = trunc i64 %16 to i32
%18 = add i32 %15, %17
%19 = tail call i64 @examineExample(float 5.000000e+00)
%20 = trunc i64 %19 to i32
%21 = add i32 %18, %20
%22 = tail call i64 @examineExample(float 6.000000e+00)
%23 = trunc i64 %22 to i32
%24 = add i32 %21, %23
%25 = tail call i64 @examineExample(float 7.000000e+00)
%26 = trunc i64 %25 to i32
%27 = add i32 %24, %26
br label %47
28: ; preds = %2
%29 = tail call float* (...) @nonzeroNonCAlphasPos()
%30 = tail call i32 @alphasVectorCount(float* %29)
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %44
32: ; preds = %28
%33 = zext i32 %30 to i64
br label %34
34: ; preds = %32, %34
%35 = phi i64 [ 0, %32 ], [ %42, %34 ]
%36 = phi i32 [ 0, %32 ], [ %41, %34 ]
%37 = getelementptr inbounds float, float* %29, i64 %35
%38 = load float, float* %37
%39 = tail call i64 @examineExample(float %38)
%40 = trunc i64 %39 to i32
%41 = add i32 %36, %40
%42 = add nuw nsw i64 %35, 1
%43 = icmp eq i64 %42, %33
br i1 %43, label %44, label %34
44: ; preds = %34, %28
%45 = phi i32 [ 0, %28 ], [ %41, %34 ]
%46 = tail call i32 @free(float* %29)
br label %47
47: ; preds = %4, %44
%48 = phi i32 [ %45, %44 ], [ %27, %4 ]
%49 = xor i1 %3, true
%50 = icmp eq i32 %48, 0
%51 = select i1 %49, i1 %50, i1 false
%52 = icmp sgt i32 %48, 0
%53 = or i1 %52, %51
br i1 %53, label %2, label %54
54: ; preds = %47
ret void
}