#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*/ cleanup();
int /*<<< orphan*/ displaytable();
char *get(char *);
int /*<<< orphan*/ inithashtab();
int /*<<< orphan*/ install(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
main() {
  int i;
  char *names[] = {"name", "address", "phone", "k101", "k110"};
  char *descs[] = {"Sourav", "Sinagor", "26300788", "Value1", "Value2"};
  inithashtab();
  for (i = 0; i < 5; i++)
    install(names[i], descs[i]);
  printf("Done ");
  printf("If we didnt do anything wrong.."
         "we should see %s ",
         get("k110"));
  install("phone", "9433120451");
  printf("Again if we go right, we have %s and %s ", get("k101"), get("phone"));
  displaytable();
  cleanup();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
lea    0xe6a(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe64(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xe61(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xe5c(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xe56(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
lea    0xe40(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xe3c(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xe39(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0xe37(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xe33(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    $0x0,%al
call   1070 <inithashtab@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    124a <main+0xda>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
movslq -0x8(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rsi
call   1050 <install@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    121b <main+0xab>
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdb9(%rip),%rdi
call   1080 <get@plt>
mov    %rax,%rsi
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd91(%rip),%rdi
lea    0xdf7(%rip),%rsi
call   1050 <install@plt>
lea    0xd84(%rip),%rdi
call   1080 <get@plt>
mov    %rax,-0x68(%rbp)
lea    0xd6e(%rip),%rdi
call   1080 <get@plt>
mov    -0x68(%rbp),%rsi
mov    %rax,%rdx
lea    0xdd3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <displaytable@plt>
mov    $0x0,%al
call   1090 <cleanup@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1060 <inithashtab@plt>
lea    0xe8d(%rip),%rdi
lea    0xea3(%rip),%rsi
call   1040 <install@plt>
lea    0xe7f(%rip),%rdi
lea    0xe97(%rip),%rsi
call   1040 <install@plt>
lea    0xe74(%rip),%r15
lea    0xe8c(%rip),%rsi
mov    %r15,%rdi
call   1040 <install@plt>
lea    0xe64(%rip),%r14
lea    0xe7f(%rip),%rsi
mov    %r14,%rdi
call   1040 <install@plt>
lea    0xe53(%rip),%rbx
lea    0xe70(%rip),%rsi
mov    %rbx,%rdi
call   1040 <install@plt>
lea    0xe68(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1070 <get@plt>
lea    0xe58(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe78(%rip),%rsi
mov    %r15,%rdi
call   1040 <install@plt>
mov    %r14,%rdi
call   1070 <get@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1070 <get@plt>
lea    0xe61(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <displaytable@plt>
xor    %eax,%eax
call   1080 <cleanup@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"name\00"
@.str.1 = [8 x i8] c"address\00"
@.str.2 = [6 x i8] c"phone\00"
@.str.3 = [5 x i8] c"k101\00"
@.str.4 = [5 x i8] c"k110\00"
@.str.5 = [7 x i8] c"Sourav\00"
@.str.6 = [8 x i8] c"Sinagor\00"
@.str.7 = [9 x i8] c"26300788\00"
@.str.8 = [7 x i8] c"Value1\00"
@.str.9 = [7 x i8] c"Value2\00"
@.str.10 = [6 x i8] c"Done \00"
@.str.11 = [49 x i8] c"If we didnt do anything wrong..we should see %s \00"
@.str.12 = [11 x i8] c"9433120451\00"
@.str.13 = [41 x i8] c"Again if we go right, we have %s and %s \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [5 x i8*]
%4 = alloca [5 x i8*]
store i32 0, i32* %1
%5 = bitcast [5 x i8*]* %3 to i8*
%6 = bitcast i8* %5 to [5 x i8*]*
%7 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8** %7
%8 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i32 0, i32 1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8** %8
%9 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i32 0, i32 2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8** %9
%10 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i32 0, i32 3
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8** %10
%11 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i32 0, i32 4
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8** %11
%12 = bitcast [5 x i8*]* %4 to i8*
%13 = bitcast i8* %12 to [5 x i8*]*
%14 = getelementptr inbounds [5 x i8*], [5 x i8*]* %13, i32 0, i32 0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8** %14
%15 = getelementptr inbounds [5 x i8*], [5 x i8*]* %13, i32 0, i32 1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i32 0, i32 0), i8** %15
%16 = getelementptr inbounds [5 x i8*], [5 x i8*]* %13, i32 0, i32 2
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i32 0, i32 0), i8** %16
%17 = getelementptr inbounds [5 x i8*], [5 x i8*]* %13, i32 0, i32 3
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i8** %17
%18 = getelementptr inbounds [5 x i8*], [5 x i8*]* %13, i32 0, i32 4
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i32 0, i32 0), i8** %18
%19 = call i32 (...) @inithashtab()
store i32 0, i32* %2
br label %20
20: ; preds = %33, %0
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, 5
br i1 %22, label %23, label %36
23: ; preds = %20
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 %25
%27 = load i8*, i8** %26
%28 = load i32, i32* %2
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 %29
%31 = load i8*, i8** %30
%32 = call i32 @install(i8* %27, i8* %31)
br label %33
33: ; preds = %23
%34 = load i32, i32* %2
%35 = add nsw i32 %34, 1
store i32 %35, i32* %2
br label %20
36: ; preds = %20
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
%38 = call i8* @get(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i64 0, i64 0), i8* %38)
%40 = call i32 @install(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
%41 = call i8* @get(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%42 = call i8* @get(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.13, i64 0, i64 0), i8* %41, i8* %42)
%44 = call i32 (...) @displaytable()
%45 = call i32 (...) @cleanup()
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"name\00"
@.str.1 = [8 x i8] c"address\00"
@.str.2 = [6 x i8] c"phone\00"
@.str.3 = [5 x i8] c"k101\00"
@.str.4 = [5 x i8] c"k110\00"
@.str.5 = [7 x i8] c"Sourav\00"
@.str.6 = [8 x i8] c"Sinagor\00"
@.str.7 = [9 x i8] c"26300788\00"
@.str.8 = [7 x i8] c"Value1\00"
@.str.9 = [7 x i8] c"Value2\00"
@.str.10 = [6 x i8] c"Done \00"
@.str.11 = [49 x i8] c"If we didnt do anything wrong..we should see %s \00"
@.str.12 = [11 x i8] c"9433120451\00"
@.str.13 = [41 x i8] c"Again if we go right, we have %s and %s \00"
define i32 @main() {
%1 = tail call i32 (...) @inithashtab()
%2 = tail call i32 @install(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%3 = tail call i32 @install(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%4 = tail call i32 @install(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%5 = tail call i32 @install(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%6 = tail call i32 @install(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
%8 = tail call i8* @get(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i64 0, i64 0), i8* %8)
%10 = tail call i32 @install(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
%11 = tail call i8* @get(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%12 = tail call i8* @get(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.13, i64 0, i64 0), i8* %11, i8* %12)
%14 = tail call i32 (...) @displaytable()
%15 = tail call i32 (...) @cleanup()
ret i32 0
}