#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_invalid_size() {
  int array[] = {1, 6, 4};
  do {
    if (!(sequential_search(array, -20, 10) == -3)) {
      printf("Line number is: %d\n", 29);
      return "error, searched array with negative size";
    }
  } while (0);
  do {
    if (!(sequential_search(array, 0, 30) == -3)) {
      printf("Line number is: %d\n", 30);
      return "error, searched array with zero size";
    }
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_invalid_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x14(%rbp)
mov    0xecf(%rip),%eax
mov    %eax,-0xc(%rbp)
lea    -0x14(%rbp),%rdi
mov    $0xffffffec,%esi
mov    $0xa,%edx
call   1040 <sequential_search@plt>
cmp    $0xfffffffd,%eax
je     1179 <test_invalid_size+0x59>
lea    0xead(%rip),%rdi
mov    $0x1d,%esi
call   1030 <printf@plt>
lea    0xeb0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ca <test_invalid_size+0xaa>
jmp    117e <test_invalid_size+0x5e>
jmp    1183 <test_invalid_size+0x63>
lea    -0x14(%rbp),%rdi
xor    %esi,%esi
mov    $0x1e,%edx
call   1040 <sequential_search@plt>
cmp    $0xfffffffd,%eax
je     11bd <test_invalid_size+0x9d>
lea    0xe69(%rip),%rdi
mov    $0x1e,%esi
call   1030 <printf@plt>
lea    0xe95(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ca <test_invalid_size+0xaa>
jmp    11c2 <test_invalid_size+0xa2>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_invalid_size>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    0xedc(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xec9(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0xffffffec,%esi
mov    $0xa,%edx
call   1040 <sequential_search@plt>
cmp    $0xfffffffd,%eax
jne    117b <test_invalid_size+0x5b>
lea    0x8(%rsp),%rdi
xor    %ebx,%ebx
mov    $0x1e,%ebp
xor    %esi,%esi
mov    $0x1e,%edx
call   1040 <sequential_search@plt>
cmp    $0xfffffffd,%eax
je     1195 <test_invalid_size+0x75>
lea    0xed0(%rip),%rbx
jmp    1187 <test_invalid_size+0x67>
lea    0xe9e(%rip),%rbx
mov    $0x1d,%ebp
lea    0xe7e(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.test_invalid_size.array = [3 x i32] [i32 1, i32 6, i32 4]
@.str = [20 x i8] c"Line number is: %d\0A\00"
@.str.1 = [41 x i8] c"error, searched array with negative size\00"
@.str.2 = [37 x i8] c"error, searched array with zero size\00"
define i8* @test_invalid_size() {
%1 = alloca i8*
%2 = alloca [3 x i32]
%3 = bitcast [3 x i32]* %2 to i8*
br label %4
4: ; preds = %0
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%6 = call i32 @sequential_search(i32* %5, i32 -20, i32 10)
%7 = icmp eq i32 %6, -3
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 29)
store i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %20
10: ; preds = %4
br label %11
11: ; preds = %10
br label %12
12: ; preds = %11
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%14 = call i32 @sequential_search(i32* %13, i32 0, i32 30)
%15 = icmp eq i32 %14, -3
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 30)
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8** %1
br label %20
18: ; preds = %12
br label %19
19: ; preds = %18
store i8* null, i8** %1
br label %20
20: ; preds = %19, %16, %8
%21 = load i8*, i8** %1
ret i8* %21
}

LLVM IR (-O2):
@__const.test_invalid_size.array = [3 x i32] [i32 1, i32 6, i32 4]
@.str = [20 x i8] c"Line number is: %d\0A\00"
@.str.1 = [41 x i8] c"error, searched array with negative size\00"
@.str.2 = [37 x i8] c"error, searched array with zero size\00"
define i8* @test_invalid_size() {
%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 @sequential_search(i32* %3, i32 -20, i32 10)
%5 = icmp eq i32 %4, -3
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = call i32 @sequential_search(i32* %3, i32 0, i32 30)
%8 = icmp eq i32 %7, -3
br i1 %8, label %13, label %9
9: ; preds = %6, %0
%10 = phi i32 [ 29, %0 ], [ 30, %6 ]
%11 = phi i8* [ getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), %0 ], [ getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), %6 ]
%12 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %13
13: ; preds = %9, %6
%14 = phi i8* [ null, %6 ], [ %11, %9 ]
ret i8* %14
}