void test_linear_search_with_one_element_returns_index(void) {
  int length = 1;
  int array[] = {1};
  int element = 1;
  int index = linear_search(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_linear_search.c",
                    __FUNCTION__, 46)));
}


x86 assembly (clang, -O0):
<test_linear_search_with_one_element_returns_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    $0x0,%al
call   1030 <linear_search@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1162 <test_linear_search_with_one_element_returns_index+0x42>
jmp    1183 <test_linear_search_with_one_element_returns_index+0x63>
lea    0xe9b(%rip),%rdi
lea    0xe9f(%rip),%rsi
lea    0xf39(%rip),%rdx
mov    $0x2e,%ecx
mov    $0x0,%al
call   1040 <__test_fail@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_linear_search_with_one_element_returns_index>:
push   %rax
movl   $0x1,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <linear_search@plt>
test   %eax,%eax
je     1164 <test_linear_search_with_one_element_returns_index+0x44>
lea    0xeb6(%rip),%rdi
lea    0xeba(%rip),%rsi
lea    0xf54(%rip),%rdx
mov    $0x2e,%ecx
xor    %eax,%eax
call   1040 <__test_fail@plt>
pop    %rax
ret

LLVM IR (-O0):
@__const.test_linear_search_with_one_element_returns_index.array = [1 x i32] [i32 1]
@.str = [11 x i8] c"index == 0\00"
@.str.1 = [161 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_linear_search.c\00"
@__FUNCTION__.test_linear_search_with_one_element_returns_index = [50 x i8] c"test_linear_search_with_one_element_returns_index\00"
define void @test_linear_search_with_one_element_returns_index() {
%1 = alloca i32
%2 = alloca [1 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 1, i32* %1
%5 = bitcast [1 x i32]* %2 to i8*
store i32 1, i32* %3
%6 = getelementptr inbounds [1 x i32], [1 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 (...)* @linear_search 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 ([161 x i8], [161 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([50 x i8], [50 x i8]* @__FUNCTION__.test_linear_search_with_one_element_returns_index, i64 0, i64 0), i32 46)
br label %15
15: ; preds = %13, %12
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"index == 0\00"
@.str.1 = [161 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_linear_search.c\00"
@__FUNCTION__.test_linear_search_with_one_element_returns_index = [50 x i8] c"test_linear_search_with_one_element_returns_index\00"
define void @test_linear_search_with_one_element_returns_index() {
%1 = alloca [1 x i32]
%2 = bitcast [1 x i32]* %1 to i8*
%3 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
store i32 1, i32* %3
%4 = call i32 (i32*, i32, i32, ...) bitcast (i32 (...)* @linear_search to i32 (i32*, i32, i32, ...)*)(i32* %3, i32 1, 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 ([161 x i8], [161 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([50 x i8], [50 x i8]* @__FUNCTION__.test_linear_search_with_one_element_returns_index, i64 0, i64 0), i32 46)
br label %8
8: ; preds = %0, %6
ret void
}