#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 /*<<< orphan*/ printf(char *, int);
int sequential_search(int *, int, int);
char *test_null() {
  int *array = NULL;
  do {
    if (!(sequential_search(array, 10, 10) == -2)) {
      printf("Line number is: %d\n", 20);
      return "error, searched NULL array";
    }
  } while (0);
  do {
    if (!(sequential_search(array, -1, 100) == -2)) {
      printf("Line number is: %d\n", 21);
      return "error, searched NULL array";
    }
  } while (0);
  do {
    if (!(sequential_search(array, 0, 10) == -2)) {
      printf("Line number is: %d\n", 22);
      return "error, searched NULL array";
    }
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_null>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1040 <sequential_search@plt>
cmp    $0xfffffffe,%eax
je     116a <test_null+0x4a>
lea    0xeb0(%rip),%rdi
mov    $0x14,%esi
call   1030 <printf@plt>
lea    0xeb3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1202 <test_null+0xe2>
jmp    116f <test_null+0x4f>
jmp    1174 <test_null+0x54>
mov    -0x10(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x64,%edx
call   1040 <sequential_search@plt>
cmp    $0xfffffffe,%eax
je     11b1 <test_null+0x91>
lea    0xe69(%rip),%rdi
mov    $0x15,%esi
call   1030 <printf@plt>
lea    0xe6c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1202 <test_null+0xe2>
jmp    11b6 <test_null+0x96>
jmp    11bb <test_null+0x9b>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <sequential_search@plt>
cmp    $0xfffffffe,%eax
je     11f5 <test_null+0xd5>
lea    0xe25(%rip),%rdi
mov    $0x16,%esi
call   1030 <printf@plt>
lea    0xe28(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1202 <test_null+0xe2>
jmp    11fa <test_null+0xda>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_null>:
push   %rbx
xor    %edi,%edi
mov    $0xa,%esi
mov    $0xa,%edx
call   1040 <sequential_search@plt>
mov    $0x14,%esi
cmp    $0xfffffffe,%eax
jne    1171 <test_null+0x51>
xor    %edi,%edi
mov    $0xffffffff,%esi
mov    $0x64,%edx
call   1040 <sequential_search@plt>
mov    $0x15,%esi
cmp    $0xfffffffe,%eax
jne    1171 <test_null+0x51>
xor    %ebx,%ebx
xor    %edi,%edi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <sequential_search@plt>
mov    $0x16,%esi
cmp    $0xfffffffe,%eax
je     1184 <test_null+0x64>
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
lea    0xe90(%rip),%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Line number is: %d\0A\00"
@.str.1 = [27 x i8] c"error, searched NULL array\00"
define i8* @test_null() {
%1 = alloca i8*
%2 = alloca i32*
store i32* null, i32** %2
br label %3
3: ; preds = %0
%4 = load i32*, i32** %2
%5 = call i32 @sequential_search(i32* %4, i32 10, i32 10)
%6 = icmp eq i32 %5, -2
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 20)
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %27
9: ; preds = %3
br label %10
10: ; preds = %9
br label %11
11: ; preds = %10
%12 = load i32*, i32** %2
%13 = call i32 @sequential_search(i32* %12, i32 -1, i32 100)
%14 = icmp eq i32 %13, -2
br i1 %14, label %17, label %15
15: ; preds = %11
%16 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 21)
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %27
17: ; preds = %11
br label %18
18: ; preds = %17
br label %19
19: ; preds = %18
%20 = load i32*, i32** %2
%21 = call i32 @sequential_search(i32* %20, i32 0, i32 10)
%22 = icmp eq i32 %21, -2
br i1 %22, label %25, label %23
23: ; preds = %19
%24 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 22)
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %27
25: ; preds = %19
br label %26
26: ; preds = %25
store i8* null, i8** %1
br label %27
27: ; preds = %26, %23, %15, %7
%28 = load i8*, i8** %1
ret i8* %28
}

LLVM IR (-O2):
@.str = [20 x i8] c"Line number is: %d\0A\00"
@.str.1 = [27 x i8] c"error, searched NULL array\00"
define i8* @test_null() {
%1 = tail call i32 @sequential_search(i32* null, i32 10, i32 10)
%2 = icmp eq i32 %1, -2
br i1 %2, label %3, label %9
3: ; preds = %0
%4 = tail call i32 @sequential_search(i32* null, i32 -1, i32 100)
%5 = icmp eq i32 %4, -2
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @sequential_search(i32* null, i32 0, i32 10)
%8 = icmp eq i32 %7, -2
br i1 %8, label %12, label %9
9: ; preds = %6, %3, %0
%10 = phi i32 [ 20, %0 ], [ 21, %3 ], [ 22, %6 ]
%11 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %9, %6
%13 = phi i8* [ null, %6 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), %9 ]
ret i8* %13
}