int find_biggest_t_below_number_in_array(int number, double *array,
                                         int arrayNumberOfRows) {
  double *index = array;
  int i;
  int found = 0;
  if (*index >= number) {
    return -2;
  }
  for (i = 0; i < arrayNumberOfRows; i++) {
    if (*index >= number) {
      found = 1;
      break;
    }
    index += 3;
  }
  if (found) {
    i--;
  } else {
    i = -1;
  }
  return i;
}


x86 assembly (clang, -O0):
<find_biggest_t_below_number_in_array>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jb     1140 <find_biggest_t_below_number_in_array+0x40>
movl   $0xfffffffe,-0x4(%rbp)
jmp    11b5 <find_biggest_t_below_number_in_array+0xb5>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1190 <find_biggest_t_below_number_in_array+0x90>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jb     1176 <find_biggest_t_below_number_in_array+0x76>
movl   $0x1,-0x28(%rbp)
jmp    1190 <find_biggest_t_below_number_in_array+0x90>
mov    -0x20(%rbp),%rax
add    $0x18,%rax
mov    %rax,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1147 <find_biggest_t_below_number_in_array+0x47>
cmpl   $0x0,-0x28(%rbp)
je     11a8 <find_biggest_t_below_number_in_array+0xa8>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    11af <find_biggest_t_below_number_in_array+0xaf>
movl   $0xffffffff,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_biggest_t_below_number_in_array>:
cvtsi2sd %edi,%xmm0
movsd  (%rsi),%xmm1
mov    $0xfffffffe,%eax
ucomisd %xmm0,%xmm1
jae    1159 <find_biggest_t_below_number_in_array+0x59>
mov    $0xffffffff,%eax
test   %edx,%edx
jle    1159 <find_biggest_t_below_number_in_array+0x59>
ucomisd %xmm0,%xmm1
jae    1159 <find_biggest_t_below_number_in_array+0x59>
add    $0x18,%rsi
mov    $0x1,%ecx
sub    %edx,%ecx
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%rcx,%rax,1),%edx
cmp    $0xffffffff,%edx
je     115a <find_biggest_t_below_number_in_array+0x5a>
movsd  (%rsi),%xmm1
add    $0x18,%rsi
add    $0x1,%eax
ucomisd %xmm0,%xmm1
jb     1140 <find_biggest_t_below_number_in_array+0x40>
ret
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @find_biggest_t_below_number_in_array(i32 %0, double* nocapture %1, i32 %2) {
%4 = load double, double* %1
%5 = sitofp i32 %0 to double
%6 = fcmp ult double %4, %5
br i1 %6, label %7, label %20
7: ; preds = %3
%8 = icmp sgt i32 %2, 0
%9 = fcmp ult double %4, %5
%10 = select i1 %8, i1 %9, i1 false
br i1 %10, label %11, label %20
11: ; preds = %7, %17
%12 = phi double* [ %14, %17 ], [ %1, %7 ]
%13 = phi i32 [ %15, %17 ], [ 0, %7 ]
%14 = getelementptr inbounds double, double* %12, i64 3
%15 = add nuw nsw i32 %13, 1
%16 = icmp eq i32 %15, %2
br i1 %16, label %20, label %17
17: ; preds = %11
%18 = load double, double* %14
%19 = fcmp ult double %18, %5
br i1 %19, label %11, label %20
20: ; preds = %11, %17, %7, %3
%21 = phi i32 [ -2, %3 ], [ -1, %7 ], [ -1, %11 ], [ %13, %17 ]
ret i32 %21
}