#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ insert_l(int *, int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int search_l(int *, int);
void process_linear() {
  int *HASH_MAP = (int *)calloc(sizeof(int), 1000);
  int N;
  scanf("%d", &N);
  int i;
  int num;
  for (i = 0; i < N; i++) {
    scanf("%d", &num);
    insert_l(HASH_MAP, num);
  }
  int S;
  scanf("%d", &S);
  for (i = 0; i < S; i++) {
    scanf("%d", &num);
    printf("Is value %d present in HASH_MAP : %d\n", num,
           search_l(HASH_MAP, num));
  }
}


x86 assembly (clang, -O0):
<process_linear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x4,%edi
mov    $0x3e8,%esi
call   1040 <calloc@plt>
mov    %rax,-0x8(%rbp)
lea    0xe8e(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b8 <process_linear+0x68>
lea    0xe6b(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1070 <insert_l@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1182 <process_linear+0x32>
lea    0xe41(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    121c <process_linear+0xcc>
lea    0xe1e(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <search_l@plt>
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
lea    0xdfa(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11cf <process_linear+0x7f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_linear>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x4,%edi
mov    $0x3e8,%esi
call   1040 <calloc@plt>
mov    %rax,%r13
lea    0xe89(%rip),%rdi
lea    0x14(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0x14(%rsp)
jle    11c0 <process_linear+0x70>
xor    %ebx,%ebx
lea    0xe6f(%rip),%r14
lea    0xc(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
mov    %r13,%rdi
call   1070 <insert_l@plt>
add    $0x1,%ebx
cmp    0x14(%rsp),%ebx
jl     11a0 <process_linear+0x50>
lea    0xe39(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0x10(%rsp)
jle    121e <process_linear+0xce>
xor    %ebx,%ebx
lea    0xe1f(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xe16(%rip),%r12
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%ebp
mov    %r13,%rdi
mov    %ebp,%esi
call   1050 <search_l@plt>
mov    %r12,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    0x10(%rsp),%ebx
jl     11f0 <process_linear+0xa0>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [38 x i8] c"Is value %d present in HASH_MAP : %d\0A\00"
define void @process_linear() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = call i64 @calloc(i32 4, i32 1000)
%7 = inttoptr i64 %6 to i32*
store i32* %7, i32** %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %9
9: ; preds = %18, %0
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %21
13: ; preds = %9
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%15 = load i32*, i32** %1
%16 = load i32, i32* %4
%17 = call i32 @insert_l(i32* %15, i32 %16)
br label %18
18: ; preds = %13
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %9
21: ; preds = %9
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
store i32 0, i32* %3
br label %23
23: ; preds = %34, %21
%24 = load i32, i32* %3
%25 = load i32, i32* %5
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %37
27: ; preds = %23
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%29 = load i32, i32* %4
%30 = load i32*, i32** %1
%31 = load i32, i32* %4
%32 = call i32 @search_l(i32* %30, i32 %31)
%33 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %29, i32 %32)
br label %34
34: ; preds = %27
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %23
37: ; preds = %23
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [38 x i8] c"Is value %d present in HASH_MAP : %d\0A\00"
define void @process_linear() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = tail call i64 @calloc(i32 4, i32 1000)
%5 = inttoptr i64 %4 to i32*
%6 = bitcast i32* %1 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = bitcast i32* %2 to i8*
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %0, %11
%12 = phi i32 [ %16, %11 ], [ 0, %0 ]
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
%15 = call i32 @insert_l(i32* %5, i32 %14)
%16 = add nuw nsw i32 %12, 1
%17 = load i32, i32* %1
%18 = icmp slt i32 %16, %17
br i1 %18, label %11, label %19
19: ; preds = %11, %0
%20 = bitcast i32* %3 to i8*
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%22 = load i32, i32* %3
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %33
24: ; preds = %19, %24
%25 = phi i32 [ %30, %24 ], [ 0, %19 ]
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%27 = load i32, i32* %2
%28 = call i32 @search_l(i32* %5, i32 %27)
%29 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %27, i32 %28)
%30 = add nuw nsw i32 %25, 1
%31 = load i32, i32* %3
%32 = icmp slt i32 %30, %31
br i1 %32, label %24, label %33
33: ; preds = %24, %19
ret void
}