void test_binary_search_iterative_with_heap_elements(void) {
  int length = 10;
  int array[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  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__, 54)));
}


x86 assembly (clang, -O0):
<test_binary_search_iterative_with_heap_elements>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0xa,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movl   $0x1,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    $0x0,%al
call   1050 <binary_search_iterative@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jne    117e <test_binary_search_iterative_with_heap_elements+0x4e>
jmp    119f <test_binary_search_iterative_with_heap_elements+0x6f>
lea    0xea3(%rip),%rdi
lea    0xea7(%rip),%rsi
lea    0xf4b(%rip),%rdx
mov    $0x36,%ecx
mov    $0x0,%al
call   1030 <__test_fail@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_binary_search_iterative_with_heap_elements>:
sub    $0x28,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <binary_search_iterative@plt>
test   %eax,%eax
je     1180 <test_binary_search_iterative_with_heap_elements+0x60>
lea    0xec2(%rip),%rdi
lea    0xec6(%rip),%rsi
lea    0xf6a(%rip),%rdx
mov    $0x36,%ecx
xor    %eax,%eax
call   1030 <__test_fail@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.test_binary_search_iterative_with_heap_elements.array = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10]
@.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_with_heap_elements = [48 x i8] c"test_binary_search_iterative_with_heap_elements\00"
define void @test_binary_search_iterative_with_heap_elements() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 10, i32* %1
%5 = bitcast [10 x i32]* %2 to i8*
store i32 1, i32* %3
%6 = getelementptr inbounds [10 x i32], [10 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 ([48 x i8], [48 x i8]* @__FUNCTION__.test_binary_search_iterative_with_heap_elements, i64 0, i64 0), i32 54)
br label %15
15: ; preds = %13, %12
ret void
}

LLVM IR (-O2):
@__const.test_binary_search_iterative_with_heap_elements.array = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10]
@.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_with_heap_elements = [48 x i8] c"test_binary_search_iterative_with_heap_elements\00"
define void @test_binary_search_iterative_with_heap_elements() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 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 10, 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 ([48 x i8], [48 x i8]* @__FUNCTION__.test_binary_search_iterative_with_heap_elements, i64 0, i64 0), i32 54)
br label %8
8: ; preds = %0, %6
ret void
}