; LLVM IR from MostafaTwfiq/C-DataStructures-And-Algorithms :: DataStructure/Tables/Sources (LinkedListHashMap)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.LinkedListHashMap = type { ptr, i32, i32, ptr, ptr, ptr, ptr }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [42 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [28 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local ptr @linkedListHashMapInitialization(i32 noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #1 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  store i32 %0, ptr %6, align 4, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !9
  %12 = load i32, ptr %6, align 4, !tbaa !5
  %13 = icmp sle i32 %12, 0
  br i1 %13, label %14, label %17

14:                                               ; preds = %5
  %15 = load ptr, ptr @stderr, align 8, !tbaa !9
  %16 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.2) #6
  call void @exit(i32 noundef -83384987) #7
  unreachable

17:                                               ; preds = %5
  %18 = load ptr, ptr %7, align 8, !tbaa !9
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %23

20:                                               ; preds = %17
  %21 = load ptr, ptr @stderr, align 8, !tbaa !9
  %22 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef @.str, ptr noundef @.str.3, ptr noundef @.str.2) #6
  call void @exit(i32 noundef -83384987) #7
  unreachable

23:                                               ; preds = %17
  %24 = load ptr, ptr %8, align 8, !tbaa !9
  %25 = icmp eq ptr %24, null
  br i1 %25, label %26, label %29

26:                                               ; preds = %23
  %27 = load ptr, ptr @stderr, align 8, !tbaa !9
  %28 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef @.str, ptr noundef @.str.4, ptr noundef @.str.2) #6
  call void @exit(i32 noundef -83384987) #7
  unreachable

29:                                               ; preds = %23
  %30 = load ptr, ptr %9, align 8, !tbaa !9
  %31 = icmp eq ptr %30, null
  br i1 %31, label %32, label %35

32:                                               ; preds = %29
  %33 = load ptr, ptr @stderr, align 8, !tbaa !9
  %34 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef @.str, ptr noundef @.str.5, ptr noundef @.str.2) #6
  call void @exit(i32 noundef -83384987) #7
  unreachable

35:                                               ; preds = %29
  %36 = load ptr, ptr %9, align 8, !tbaa !9
  %37 = icmp eq ptr %36, null
  br i1 %37, label %38, label %41

38:                                               ; preds = %35
  %39 = load ptr, ptr @stderr, align 8, !tbaa !9
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef @.str, ptr noundef @.str.6, ptr noundef @.str.2) #6
  call void @exit(i32 noundef -83384987) #7
  unreachable

41:                                               ; preds = %35
  br label %42

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  br label %45

45:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %46 = call noalias ptr @malloc(i64 noundef 48) #8
  store ptr %46, ptr %11, align 8, !tbaa !9
  %47 = load ptr, ptr %11, align 8, !tbaa !9
  %48 = icmp eq ptr %47, null
  br i1 %48, label %49, label %52

49:                                               ; preds = %45
  %50 = load ptr, ptr @stderr, align 8, !tbaa !9
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef @.str.7, ptr noundef @.str.8, ptr noundef @.str.2) #6
  call void @exit(i32 noundef -833811484) #7
  unreachable

52:                                               ; preds = %45
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = load ptr, ptr %11, align 8, !tbaa !9
  %55 = getelementptr inbounds %struct.LinkedListHashMap, ptr %54, i32 0, i32 1
  store i32 %53, ptr %55, align 8, !tbaa !11
  %56 = load ptr, ptr %11, align 8, !tbaa !9
  %57 = getelementptr inbounds %struct.LinkedListHashMap, ptr %56, i32 0, i32 1
  %58 = load i32, ptr %57, align 8, !tbaa !11
  %59 = sext i32 %58 to i64
  %60 = call noalias ptr @calloc(i64 noundef 8, i64 noundef %59) #9
  %61 = load ptr, ptr %11, align 8, !tbaa !9
  %62 = getelementptr inbounds %struct.LinkedListHashMap, ptr %61, i32 0, i32 0
  store ptr %60, ptr %62, align 8, !tbaa !13
  %63 = load ptr, ptr %11, align 8, !tbaa !9
  %64 = getelementptr inbounds %struct.LinkedListHashMap, ptr %63, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8, !tbaa !13
  %66 = icmp eq ptr %65, null
  br i1 %66, label %67, label %70

67:                                               ; preds = %52
  %68 = load ptr, ptr @stderr, align 8, !tbaa !9
  %69 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef @.str.7, ptr noundef @.str.9, ptr noundef @.str.2) #6
  call void @exit(i32 noundef -833811484) #7
  unreachable

70:                                               ; preds = %52
  %71 = load ptr, ptr %11, align 8, !tbaa !9
  %72 = getelementptr inbounds %struct.LinkedListHashMap, ptr %71, i32 0, i32 2
  store i32 0, ptr %72, align 4, !tbaa !14
  %73 = load ptr, ptr %7, align 8, !tbaa !9
  %74 = load ptr, ptr %11, align 8, !tbaa !9
  %75 = getelementptr inbounds %struct.LinkedListHashMap, ptr %74, i32 0, i32 3
  store ptr %73, ptr %75, align 8, !tbaa !15
  %76 = load ptr, ptr %8, align 8, !tbaa !9
  %77 = load ptr, ptr %11, align 8, !tbaa !9
  %78 = getelementptr inbounds %struct.LinkedListHashMap, ptr %77, i32 0, i32 4
  store ptr %76, ptr %78, align 8, !tbaa !16
  %79 = load ptr, ptr %9, align 8, !tbaa !9
  %80 = load ptr, ptr %11, align 8, !tbaa !9
  %81 = getelementptr inbounds %struct.LinkedListHashMap, ptr %80, i32 0, i32 5
  store ptr %79, ptr %81, align 8, !tbaa !17
  %82 = load ptr, ptr %10, align 8, !tbaa !9
  %83 = load ptr, ptr %11, align 8, !tbaa !9
  %84 = getelementptr inbounds %struct.LinkedListHashMap, ptr %83, i32 0, i32 6
  store ptr %82, ptr %84, align 8, !tbaa !18
  %85 = load ptr, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  ret ptr %85
}

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #3

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #4

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind allocsize(0,1) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { noreturn nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { nounwind allocsize(0,1) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"LinkedListHashMap", !10, i64 0, !6, i64 8, !6, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}
!13 = !{!12, !10, i64 0}
!14 = !{!12, !6, i64 12}
!15 = !{!12, !10, i64 16}
!16 = !{!12, !10, i64 24}
!17 = !{!12, !10, i64 32}
!18 = !{!12, !10, i64 40}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [42 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [28 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noalias noundef ptr @linkedListHashMapInitialization(i32 noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = icmp slt i32 %0, 1
  br i1 %6, label %7, label %10

7:                                                ; preds = %5
  %8 = load ptr, ptr @stderr, align 8, !tbaa !5
  %9 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %8, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2) #5
  tail call void @exit(i32 noundef -83384987) #6
  unreachable

10:                                               ; preds = %5
  %11 = icmp eq ptr %1, null
  br i1 %11, label %12, label %15

12:                                               ; preds = %10
  %13 = load ptr, ptr @stderr, align 8, !tbaa !5
  %14 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %13, ptr noundef nonnull @.str, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.2) #5
  tail call void @exit(i32 noundef -83384987) #6
  unreachable

15:                                               ; preds = %10
  %16 = icmp eq ptr %2, null
  br i1 %16, label %17, label %20

17:                                               ; preds = %15
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str, ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.2) #5
  tail call void @exit(i32 noundef -83384987) #6
  unreachable

20:                                               ; preds = %15
  %21 = icmp eq ptr %3, null
  br i1 %21, label %22, label %25

22:                                               ; preds = %20
  %23 = load ptr, ptr @stderr, align 8, !tbaa !5
  %24 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef nonnull @.str, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.2) #5
  tail call void @exit(i32 noundef -83384987) #6
  unreachable

25:                                               ; preds = %20
  %26 = tail call noalias dereferenceable_or_null(48) ptr @malloc(i64 noundef 48) #7
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %31

28:                                               ; preds = %25
  %29 = load ptr, ptr @stderr, align 8, !tbaa !5
  %30 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %29, ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.2) #5
  tail call void @exit(i32 noundef -833811484) #6
  unreachable

31:                                               ; preds = %25
  %32 = getelementptr inbounds i8, ptr %26, i64 8
  store i32 %0, ptr %32, align 8, !tbaa !9
  %33 = zext nneg i32 %0 to i64
  %34 = tail call noalias ptr @calloc(i64 noundef 8, i64 noundef %33) #8
  store ptr %34, ptr %26, align 8, !tbaa !12
  %35 = icmp eq ptr %34, null
  br i1 %35, label %36, label %39

36:                                               ; preds = %31
  %37 = load ptr, ptr @stderr, align 8, !tbaa !5
  %38 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %37, ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.2) #5
  tail call void @exit(i32 noundef -833811484) #6
  unreachable

39:                                               ; preds = %31
  %40 = getelementptr inbounds i8, ptr %26, i64 12
  store i32 0, ptr %40, align 4, !tbaa !13
  %41 = getelementptr inbounds i8, ptr %26, i64 16
  store ptr %1, ptr %41, align 8, !tbaa !14
  %42 = getelementptr inbounds i8, ptr %26, i64 24
  store ptr %2, ptr %42, align 8, !tbaa !15
  %43 = getelementptr inbounds i8, ptr %26, i64 32
  store ptr %3, ptr %43, align 8, !tbaa !16
  %44 = getelementptr inbounds i8, ptr %26, i64 40
  store ptr %4, ptr %44, align 8, !tbaa !17
  ret ptr %26
}

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #4

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { cold nounwind }
attributes #6 = { noreturn nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { nounwind allocsize(0,1) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 8}
!10 = !{!"LinkedListHashMap", !6, i64 0, !11, i64 8, !11, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 0}
!13 = !{!10, !11, i64 12}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 24}
!16 = !{!10, !6, i64 32}
!17 = !{!10, !6, i64 40}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass