#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*/ free(int *);
int hashsearch(int *, int, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int *Number, res = 0;
  int n, target;
  printf("Please input the number of the array :\n");
  scanf("%d", &n);
  Number = (int *)malloc(sizeof(int) * n);
  if (NULL == Number) {
    printf("No memory !\n");
    return 0;
  }
  printf("Please input the array:\n");
  for (int i = 0; i < n; i++) {
    scanf("%d", &Number[i]);
  }
  printf("Please input the target !:\n");
  scanf("%d", &target);
  res = hashsearch(Number, n, target);
  if (res) {
    printf("Target is found!\n");
  } else {
    printf("No target !\n");
  }
  free(Number);
  Number = NULL;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xe8c(%rip),%rdi
call   1050 <printf@plt>
lea    0xea8(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1070 <scanf@plt>
movslq -0x20(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
jne    11c0 <main+0x70>
lea    0xe7c(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1275 <main+0x125>
lea    0xe71(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1208 <main+0xb8>
mov    -0x18(%rbp),%rsi
movslq -0x28(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe33(%rip),%rdi
call   1070 <scanf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11d3 <main+0x83>
lea    0xe42(%rip),%rdi
call   1050 <printf@plt>
lea    0xe0d(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1040 <hashsearch@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1251 <main+0x101>
lea    0xe26(%rip),%rdi
call   1050 <printf@plt>
jmp    125d <main+0x10d>
lea    0xe27(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xea4(%rip),%rdi
call   1050 <puts@plt>
lea    0xe95(%rip),%rdi
mov    %rsp,%rsi
call   1070 <scanf@plt>
mov    (%rsp),%edi
shl    $0x2,%edi
call   1060 <malloc@plt>
test   %rax,%rax
je     121b <main+0xcb>
mov    %rax,%r14
lea    0xe99(%rip),%rdi
call   1050 <puts@plt>
cmpl   $0x0,(%rsp)
jle    11cc <main+0x7c>
xor    %r12d,%r12d
lea    0xe5a(%rip),%r15
mov    %r14,%rbx
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
add    $0x1,%r12
movslq (%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%r12
jl     11b0 <main+0x60>
lea    0xe6f(%rip),%rdi
call   1050 <puts@plt>
lea    0xe21(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
mov    %r14,%rdi
call   1040 <hashsearch@plt>
test   %eax,%eax
lea    0xe5c(%rip),%rax
lea    0xe61(%rip),%rdi
cmove  %rax,%rdi
call   1050 <puts@plt>
mov    %r14,%rdi
call   1030 <free@plt>
jmp    1227 <main+0xd7>
lea    0xe58(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Please input the number of the array :\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"No memory !\0A\00"
@.str.3 = [25 x i8] c"Please input the array:\0A\00"
@.str.4 = [28 x i8] c"Please input the target !:\0A\00"
@.str.5 = [18 x i8] c"Target is found!\0A\00"
@.str.6 = [13 x i8] c"No target !\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%11 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%13 = load i32, i32* %8
%14 = sext i32 %13 to i64
%15 = mul i64 4, %14
%16 = trunc i64 %15 to i32
%17 = call i64 @malloc(i32 %16)
%18 = inttoptr i64 %17 to i32*
store i32* %18, i32** %6
%19 = load i32*, i32** %6
%20 = icmp eq i32* null, %19
br i1 %20, label %21, label %23
21: ; preds = %2
%22 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %54
23: ; preds = %2
%24 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %10
br label %25
25: ; preds = %35, %23
%26 = load i32, i32* %10
%27 = load i32, i32* %8
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %38
29: ; preds = %25
%30 = load i32*, i32** %6
%31 = load i32, i32* %10
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %33)
br label %35
35: ; preds = %29
%36 = load i32, i32* %10
%37 = add nsw i32 %36, 1
store i32 %37, i32* %10
br label %25
38: ; preds = %25
%39 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%40 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%41 = load i32*, i32** %6
%42 = load i32, i32* %8
%43 = load i32, i32* %9
%44 = call i32 @hashsearch(i32* %41, i32 %42, i32 %43)
store i32 %44, i32* %7
%45 = load i32, i32* %7
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %38
%48 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %51
49: ; preds = %38
%50 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %51
51: ; preds = %49, %47
%52 = load i32*, i32** %6
%53 = call i32 @free(i32* %52)
store i32* null, i32** %6
store i32 0, i32* %3
br label %54
54: ; preds = %51, %21
%55 = load i32, i32* %3
ret i32 %55
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [39 x i8] c"Please input the number of the array :\00"
@str.7 = [24 x i8] c"Please input the array:\00"
@str.8 = [27 x i8] c"Please input the target !:\00"
@str.9 = [12 x i8] c"No target !\00"
@str.10 = [17 x i8] c"Target is found!\00"
@str.11 = [12 x i8] c"No memory !\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = load i32, i32* %3
%10 = shl i32 %9, 2
%11 = call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to i32*
%13 = icmp eq i64 %11, 0
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.11, i64 0, i64 0))
br label %38
16: ; preds = %2
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.7, i64 0, i64 0))
%18 = load i32, i32* %3
%19 = icmp sgt i32 %18, 0
br i1 %19, label %30, label %20
20: ; preds = %30, %16
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.8, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = call i32 @hashsearch(i32* %12, i32 %23, i32 %24)
%26 = icmp eq i32 %25, 0
%27 = select i1 %26, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.9, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str.10, i64 0, i64 0)
%28 = call i32 @puts(i8* dereferenceable(1) %27)
%29 = call i32 @free(i32* %12)
br label %38
30: ; preds = %16, %30
%31 = phi i64 [ %34, %30 ], [ 0, %16 ]
%32 = getelementptr inbounds i32, i32* %12, i64 %31
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %32)
%34 = add nuw nsw i64 %31, 1
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = icmp slt i64 %34, %36
br i1 %37, label %30, label %20
38: ; preds = %20, %14
ret i32 0
}