; LLVM IR from pavlosdais/Abstract-Data-Types :: tests (test_HashTable)

; 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"

@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [41 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @acutest_check_(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #0

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

declare i32 @printf(ptr noundef, ...) #2

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

; Function Attrs: noreturn nounwind uwtable
declare dso_local void @acutest_abort_() #3

; Function Attrs: nounwind uwtable
declare dso_local ptr @createData(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @compareFunction(ptr noundef, ptr noundef) #0

declare ptr @hash_create(ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @hash_int1(ptr noundef) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

declare i64 @hash_size(ptr noundef) #2

declare void @hash_destroy(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @test_insert() #0 {
  %1 = alloca ptr, align 8
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #6
  %7 = call ptr @hash_create(ptr noundef @hash_int1, ptr noundef @compareFunction, ptr noundef @free)
  store ptr %7, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  %8 = call i64 @time(ptr noundef %2) #6
  %9 = trunc i64 %8 to i32
  call void @srand(i32 noundef %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %10 = call ptr @create_shuffled_array(i32 noundef 2000000)
  store ptr %10, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %11 = call i64 @clock() #6
  store i64 %11, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !11
  br label %12

12:                                               ; preds = %68, %0
  %13 = load i32, ptr %5, align 4, !tbaa !11
  %14 = icmp ult i32 %13, 2000000
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %71

16:                                               ; preds = %12
  br label %17

17:                                               ; preds = %16
  %18 = load ptr, ptr %1, align 8, !tbaa !5
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = load i32, ptr %5, align 4, !tbaa !11
  %21 = zext i32 %20 to i64
  %22 = getelementptr inbounds i32, ptr %19, i64 %21
  %23 = call zeroext i1 @hash_exists(ptr noundef %18, ptr noundef %22)
  %24 = xor i1 %23, true
  %25 = zext i1 %24 to i32
  %26 = call i32 (i32, ptr, i32, ptr, ...) @acutest_check_(i32 noundef %25, ptr noundef @.str.38, i32 noundef 30, ptr noundef @.str.5, ptr noundef @.str.41)
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %29, label %28

28:                                               ; preds = %17
  call void @acutest_abort_() #7
  unreachable

29:                                               ; preds = %17
  br label %30

30:                                               ; preds = %29
  br label %31

31:                                               ; preds = %30
  %32 = load ptr, ptr %1, align 8, !tbaa !5
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = load i32, ptr %5, align 4, !tbaa !11
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds i32, ptr %33, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !11
  %38 = call ptr @createData(i32 noundef %37)
  %39 = call zeroext i1 @hash_insert(ptr noundef %32, ptr noundef %38)
  br label %40

40:                                               ; preds = %31
  %41 = load ptr, ptr %1, align 8, !tbaa !5
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = load i32, ptr %5, align 4, !tbaa !11
  %44 = zext i32 %43 to i64
  %45 = getelementptr inbounds i32, ptr %42, i64 %44
  %46 = call zeroext i1 @hash_exists(ptr noundef %41, ptr noundef %45)
  %47 = zext i1 %46 to i32
  %48 = call i32 (i32, ptr, i32, ptr, ...) @acutest_check_(i32 noundef %47, ptr noundef @.str.38, i32 noundef 36, ptr noundef @.str.5, ptr noundef @.str.42)
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %51, label %50

50:                                               ; preds = %40
  call void @acutest_abort_() #7
  unreachable

51:                                               ; preds = %40
  br label %52

52:                                               ; preds = %51
  br label %53

53:                                               ; preds = %52
  br label %54

54:                                               ; preds = %53
  %55 = load ptr, ptr %1, align 8, !tbaa !5
  %56 = call i64 @hash_size(ptr noundef %55)
  %57 = load i32, ptr %5, align 4, !tbaa !11
  %58 = add i32 %57, 1
  %59 = zext i32 %58 to i64
  %60 = icmp eq i64 %56, %59
  %61 = zext i1 %60 to i32
  %62 = call i32 (i32, ptr, i32, ptr, ...) @acutest_check_(i32 noundef %61, ptr noundef @.str.38, i32 noundef 39, ptr noundef @.str.5, ptr noundef @.str.43)
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %65, label %64

64:                                               ; preds = %54
  call void @acutest_abort_() #7
  unreachable

65:                                               ; preds = %54
  br label %66

66:                                               ; preds = %65
  br label %67

67:                                               ; preds = %66
  br label %68

68:                                               ; preds = %67
  %69 = load i32, ptr %5, align 4, !tbaa !11
  %70 = add i32 %69, 1
  store i32 %70, ptr %5, align 4, !tbaa !11
  br label %12, !llvm.loop !13

71:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %72 = call i64 @clock() #6
  %73 = load i64, ptr %4, align 8, !tbaa !9
  %74 = sub nsw i64 %72, %73
  %75 = sitofp i64 %74 to double
  %76 = fdiv double %75, 1.000000e+06
  store double %76, ptr %6, align 8, !tbaa !15
  %77 = load ptr, ptr %1, align 8, !tbaa !5
  call void @hash_destroy(ptr noundef %77)
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %78) #6
  %79 = load double, ptr %6, align 8, !tbaa !15
  %80 = call i32 (ptr, ...) @printf(ptr noundef @.str.44, double noundef %79)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #6
  ret void
}

; Function Attrs: nounwind
declare void @srand(i32 noundef) #4

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @create_shuffled_array(i32 noundef) #5

; Function Attrs: nounwind
declare i64 @clock() #4

declare zeroext i1 @hash_exists(ptr noundef, ptr noundef) #2

declare zeroext i1 @hash_insert(ptr noundef, ptr noundef) #2

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 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 #4 = { 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 #5 = { inlinehint 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 #6 = { nounwind }
attributes #7 = { noreturn }

!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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"double", !7, i64 0}


; 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"

@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [41 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @acutest_check_(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #0

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

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

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

; Function Attrs: noreturn nounwind uwtable
declare dso_local void @acutest_abort_() local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local ptr @createData(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @compareFunction(ptr noundef, ptr noundef) #0

declare ptr @hash_create(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare i32 @hash_int1(ptr noundef) #4

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) #5

declare i64 @hash_size(ptr noundef) local_unnamed_addr #4

declare void @hash_destroy(ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local void @test_insert() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = tail call ptr @hash_create(ptr noundef nonnull @hash_int1, ptr noundef nonnull @compareFunction, ptr noundef nonnull @free) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  %3 = call i64 @time(ptr noundef nonnull %1) #8
  %4 = trunc i64 %3 to i32
  call void @srand(i32 noundef %4) #8
  %5 = call ptr @create_shuffled_array(i32 noundef 2000000)
  %6 = call i64 @clock() #8
  br label %7

7:                                                ; preds = %29, %0
  %indvars.iv = phi i64 [ %indvars.iv.next, %29 ], [ 0, %0 ]
  %exitcond.not = icmp eq i64 %indvars.iv, 2000000
  br i1 %exitcond.not, label %8, label %14

8:                                                ; preds = %7
  %9 = call i64 @clock() #8
  %10 = sub nsw i64 %9, %6
  %11 = sitofp i64 %10 to double
  %12 = fdiv double %11, 1.000000e+06
  call void @hash_destroy(ptr noundef %2) #8
  call void @free(ptr noundef %5) #8
  %13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.44, double noundef %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  ret void

14:                                               ; preds = %7
  %15 = getelementptr inbounds i32, ptr %5, i64 %indvars.iv
  %16 = call zeroext i1 @hash_exists(ptr noundef %2, ptr noundef %15) #8
  %17 = xor i1 %16, true
  %18 = zext i1 %17 to i32
  %19 = call i32 (i32, ptr, i32, ptr, ...) @acutest_check_(i32 noundef %18, ptr noundef nonnull @.str.38, i32 noundef 30, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.41)
  %.not = icmp eq i32 %19, 0
  br i1 %.not, label %20, label %21

20:                                               ; preds = %14
  call void @acutest_abort_() #9
  unreachable

21:                                               ; preds = %14
  %22 = load i32, ptr %15, align 4, !tbaa !5
  %23 = call ptr @createData(i32 noundef %22)
  %24 = call zeroext i1 @hash_insert(ptr noundef %2, ptr noundef %23) #8
  %25 = call zeroext i1 @hash_exists(ptr noundef %2, ptr noundef nonnull %15) #8
  %26 = zext i1 %25 to i32
  %27 = call i32 (i32, ptr, i32, ptr, ...) @acutest_check_(i32 noundef %26, ptr noundef nonnull @.str.38, i32 noundef 36, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.42)
  %.not16 = icmp eq i32 %27, 0
  br i1 %.not16, label %28, label %29

28:                                               ; preds = %21
  call void @acutest_abort_() #9
  unreachable

29:                                               ; preds = %21
  %30 = call i64 @hash_size(ptr noundef %2) #8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %31 = icmp eq i64 %30, %indvars.iv.next
  %32 = zext i1 %31 to i32
  %33 = call i32 (i32, ptr, i32, ptr, ...) @acutest_check_(i32 noundef %32, ptr noundef nonnull @.str.38, i32 noundef 39, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.43)
  %.not17 = icmp eq i32 %33, 0
  br i1 %.not17, label %34, label %7, !llvm.loop !9

34:                                               ; preds = %29
  call void @acutest_abort_() #9
  unreachable
}

; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #6

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @create_shuffled_array(i32 noundef) local_unnamed_addr #7

; Function Attrs: nounwind
declare i64 @clock() local_unnamed_addr #6

declare zeroext i1 @hash_exists(ptr noundef, ptr noundef) local_unnamed_addr #4

declare zeroext i1 @hash_insert(ptr noundef, ptr 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { noreturn 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 #4 = { "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, 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 #6 = { 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 #7 = { inlinehint 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 #8 = { nounwind }
attributes #9 = { noreturn }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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