#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*/ HashInsert(int *, int);
int /*<<< orphan*/ HashSearch(int *, int);
int /*<<< orphan*/ Print(int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, i, k;
  int T[7];
  for (i = 0; i <= 7; i++)
    T[i] = -1;
  do {
    printf("1. Insert Key in Hash Table\n");
    printf("2. Search Key in Hash Table\n");
    printf("0. Exit\n");
    printf("Input: ");
    scanf("%d", &n);
    switch (n) {
    case 1:
      printf("Enter Key: ");
      scanf("%d", &k);
      HashInsert(T, k);
      Print(T);
      break;
    case 2:
      printf("Enter Key: ");
      scanf("%d", &k);
      HashSearch(T, k);
    case 0:
      break;
    default:
      printf("Invalid Input. Try Again.\n");
    }
  } while (n != 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
jg     118a <main+0x3a>
movslq -0xc(%rbp),%rax
movl   $0xffffffff,-0x30(%rbp,%rax,4)
ff
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1166 <main+0x16>
jmp    118f <main+0x3f>
lea    0xe6a(%rip),%rdi
call   1050 <printf@plt>
lea    0xe7b(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8c(%rip),%rdi
call   1050 <printf@plt>
lea    0xe89(%rip),%rdi
call   1050 <printf@plt>
lea    0xe85(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x34(%rbp)
test   %eax,%eax
je     1262 <main+0x112>
jmp    11e2 <main+0x92>
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
je     1204 <main+0xb4>
jmp    11f3 <main+0xa3>
mov    -0x34(%rbp),%eax
sub    $0x2,%eax
je     123a <main+0xea>
jmp    1267 <main+0x117>
lea    0xe43(%rip),%rdi
call   1050 <printf@plt>
lea    0xe34(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <HashInsert@plt>
lea    -0x30(%rbp),%rdi
call   1070 <Print@plt>
jmp    1273 <main+0x123>
lea    0xe0d(%rip),%rdi
call   1050 <printf@plt>
lea    0xdfe(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1040 <HashSearch@plt>
jmp    1273 <main+0x123>
lea    0xdec(%rip),%rdi
call   1050 <printf@plt>
jmp    1278 <main+0x128>
cmpl   $0x0,-0x8(%rbp)
jne    118f <main+0x3f>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
pcmpeqd %xmm0,%xmm0
movdqa %xmm0,0x20(%rsp)
movdqa %xmm0,0x10(%rsp)
lea    0xeae(%rip),%r15
lea    0xec3(%rip),%r12
lea    0xe6d(%rip),%r13
lea    0xe6e(%rip),%rbx
lea    0xc(%rsp),%rbp
lea    0x10(%rsp),%r14
jmp    11e0 <main+0x80>
cs nopw 0x0(%rax,%rax,1)
lea    0xe54(%rip),%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
lea    0x8(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x8(%rsp),%esi
mov    %r14,%rdi
call   1050 <HashSearch@plt>
cmpl   $0x0,0xc(%rsp)
je     1262 <main+0x102>
lea    0xe30(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x1,%eax
je     1230 <main+0xd0>
cmp    $0x2,%eax
je     11b0 <main+0x50>
test   %eax,%eax
je     1262 <main+0x102>
lea    0xe2f(%rip),%rdi
call   1030 <puts@plt>
jmp    11d5 <main+0x75>
nop
lea    0xdd4(%rip),%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
lea    0x8(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x8(%rsp),%esi
mov    %r14,%rdi
call   1040 <HashInsert@plt>
mov    %r14,%rdi
call   1080 <Print@plt>
jmp    11d5 <main+0x75>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"1. Insert Key in Hash Table\0A\00"
@.str.1 = [29 x i8] c"2. Search Key in Hash Table\0A\00"
@.str.2 = [9 x i8] c"0. Exit\0A\00"
@.str.3 = [8 x i8] c"Input: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [12 x i8] c"Enter Key: \00"
@.str.6 = [27 x i8] c"Invalid Input. Try Again.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [7 x i32]
store i32 0, i32* %1
store i32 0, i32* %3
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 7
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [7 x i32], [7 x i32]* %5, i64 0, i64 %11
store i32 -1, i32* %12
br label %13
13: ; preds = %9
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %6
16: ; preds = %6
br label %17
17: ; preds = %42, %16
%18 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%23 = load i32, i32* %2
switch i32 %23, label %39 [
i32 1, label %24
i32 2, label %32
i32 0, label %38
]
24: ; preds = %17
%25 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%27 = getelementptr inbounds [7 x i32], [7 x i32]* %5, i64 0, i64 0
%28 = load i32, i32* %4
%29 = call i32 @HashInsert(i32* %27, i32 %28)
%30 = getelementptr inbounds [7 x i32], [7 x i32]* %5, i64 0, i64 0
%31 = call i32 @Print(i32* %30)
br label %41
32: ; preds = %17
%33 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%35 = getelementptr inbounds [7 x i32], [7 x i32]* %5, i64 0, i64 0
%36 = load i32, i32* %4
%37 = call i32 @HashSearch(i32* %35, i32 %36)
br label %38
38: ; preds = %17, %32
br label %41
39: ; preds = %17
%40 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
br label %41
41: ; preds = %39, %38, %24
br label %42
42: ; preds = %41
%43 = load i32, i32* %2
%44 = icmp ne i32 %43, 0
br i1 %44, label %17, label %45
45: ; preds = %42
%46 = load i32, i32* %1
ret i32 %46
}

LLVM IR (-O2):
@.str.3 = [8 x i8] c"Input: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [12 x i8] c"Enter Key: \00"
@str = [28 x i8] c"1. Insert Key in Hash Table\00"
@str.7 = [28 x i8] c"2. Search Key in Hash Table\00"
@str.8 = [8 x i8] c"0. Exit\00"
@str.9 = [26 x i8] c"Invalid Input. Try Again.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [7 x i32]
%4 = bitcast [7 x i32]* %3 to i8*
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
br label %8
8: ; preds = %0, %28
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.7, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.8, i64 0, i64 0))
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
switch i32 %14, label %26 [
i32 1, label %15
i32 2, label %21
i32 0, label %31
]
15: ; preds = %8
%16 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%18 = load i32, i32* %2
%19 = call i32 @HashInsert(i32* %7, i32 %18)
%20 = call i32 @Print(i32* %7)
br label %28
21: ; preds = %8
%22 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%24 = load i32, i32* %2
%25 = call i32 @HashSearch(i32* %7, i32 %24)
br label %28
26: ; preds = %8
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.9, i64 0, i64 0))
br label %28
28: ; preds = %15, %21, %26
%29 = load i32, i32* %1
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %8
31: ; preds = %8, %28
ret i32 0
}