void test_binary_search_iterative_returns_first_index(void) {
  int length = 3;
  int array[] = {1, 2, 3};
  int element = 1;
  int index = binary_search_iterative(array, length, element);
  ((void)((index == 0)
              ? ((void)0)
              : __test_fail("index == 0",
                            "/scratch/repos/new/home/jordi_armengol_estape/"
                            "c-scraper/outputs/2022-01-22/02-19-57/repos/"
                            "michaelreneer/Algorithms/refs/heads/master/c/test/"
                            "test_binary_search_iterative.c",
                            __FUNCTION__, 14)));
}


x86 assembly (clang, -O0):
<test_binary_search_iterative_returns_first_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x3,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x1,-0x14(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    $0x0,%al
call   1040 <binary_search_iterative@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    116d <test_binary_search_iterative_returns_first_index+0x4d>
jmp    118e <test_binary_search_iterative_returns_first_index+0x6e>
lea    0xe98(%rip),%rdi
lea    0xe9c(%rip),%rsi
lea    0xf40(%rip),%rdx
mov    $0xe,%ecx
mov    $0x0,%al
call   1030 <__test_fail@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_binary_search_iterative_returns_first_index>:
sub    $0x18,%rsp
mov    0xede(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xecb(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <binary_search_iterative@plt>
test   %eax,%eax
je     1175 <test_binary_search_iterative_returns_first_index+0x55>
lea    0xeb1(%rip),%rdi
lea    0xeb5(%rip),%rsi
lea    0xf59(%rip),%rdx
mov    $0xe,%ecx
xor    %eax,%eax
call   1030 <__test_fail@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.test_binary_search_iterative_returns_first_index.array = [3 x i32] [i32 1, i32 2, i32 3]
@.str = [11 x i8] c"index == 0\00"
@.str.1 = [171 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/michaelreneer/Algorithms/refs/heads/master/c/test/test_binary_search_iterative.c\00"
@__FUNCTION__.test_binary_search_iterative_returns_first_index = [49 x i8] c"test_binary_search_iterative_returns_first_index\00"
define void @test_binary_search_iterative_returns_first_index() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 3, i32* %1
%5 = bitcast [3 x i32]* %2 to i8*
store i32 1, i32* %3
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%7 = load i32, i32* %1
%8 = load i32, i32* %3
%9 = call i32 (i32*, i32, i32, ...) bitcast (i32 (...)* @binary_search_iterative to i32 (i32*, i32, i32, ...)*)(i32* %6, i32 %7, i32 %8)
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %0
br label %15
13: ; preds = %0
%14 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @__test_fail to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([49 x i8], [49 x i8]* @__FUNCTION__.test_binary_search_iterative_returns_first_index, i64 0, i64 0), i32 14)
br label %15
15: ; preds = %13, %12
ret void
}

LLVM IR (-O2):
@__const.test_binary_search_iterative_returns_first_index.array = [3 x i32] [i32 1, i32 2, i32 3]
@.str = [11 x i8] c"index == 0\00"
@.str.1 = [171 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/michaelreneer/Algorithms/refs/heads/master/c/test/test_binary_search_iterative.c\00"
@__FUNCTION__.test_binary_search_iterative_returns_first_index = [49 x i8] c"test_binary_search_iterative_returns_first_index\00"
define void @test_binary_search_iterative_returns_first_index() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%4 = call i32 (i32*, i32, i32, ...) bitcast (i32 (...)* @binary_search_iterative to i32 (i32*, i32, i32, ...)*)(i32* %3, i32 3, i32 1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @__test_fail to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([49 x i8], [49 x i8]* @__FUNCTION__.test_binary_search_iterative_returns_first_index, i64 0, i64 0), i32 14)
br label %8
8: ; preds = %0, %6
ret void
}