; 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.45 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [38 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
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

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

12:                                               ; preds = %25, %0
  %13 = load i32, ptr %4, align 4, !tbaa !9
  %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 %4) #6
  br label %28

16:                                               ; preds = %12
  %17 = load ptr, ptr %1, align 8, !tbaa !5
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = load i32, ptr %4, align 4, !tbaa !9
  %20 = zext i32 %19 to i64
  %21 = getelementptr inbounds i32, ptr %18, i64 %20
  %22 = load i32, ptr %21, align 4, !tbaa !9
  %23 = call ptr @createData(i32 noundef %22)
  %24 = call zeroext i1 @hash_insert(ptr noundef %17, ptr noundef %23)
  br label %25

25:                                               ; preds = %16
  %26 = load i32, ptr %4, align 4, !tbaa !9
  %27 = add i32 %26, 1
  store i32 %27, ptr %4, align 4, !tbaa !9
  br label %12, !llvm.loop !11

28:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %29 = call i64 @clock() #6
  store i64 %29, ptr %5, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %85, %28
  %31 = load i32, ptr %6, align 4, !tbaa !9
  %32 = icmp ult i32 %31, 2000000
  br i1 %32, label %34, label %33

33:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %88

34:                                               ; preds = %30
  br label %35

35:                                               ; preds = %34
  %36 = load ptr, ptr %1, align 8, !tbaa !5
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = load i32, ptr %6, align 4, !tbaa !9
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds i32, ptr %37, i64 %39
  %41 = call zeroext i1 @hash_exists(ptr noundef %36, ptr noundef %40)
  %42 = zext i1 %41 to i32
  %43 = call i32 (i32, ptr, i32, ptr, ...) @acutest_check_(i32 noundef %42, ptr noundef @.str.38, i32 noundef 70, ptr noundef @.str.5, ptr noundef @.str.42)
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %46, label %45

45:                                               ; preds = %35
  call void @acutest_abort_() #7
  unreachable

46:                                               ; preds = %35
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47
  %49 = load ptr, ptr %1, align 8, !tbaa !5
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = load i32, ptr %6, align 4, !tbaa !9
  %52 = zext i32 %51 to i64
  %53 = getelementptr inbounds i32, ptr %50, i64 %52
  %54 = call zeroext i1 @hash_remove(ptr noundef %49, ptr noundef %53)
  br label %55

55:                                               ; preds = %48
  %56 = load ptr, ptr %1, align 8, !tbaa !5
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = load i32, ptr %6, align 4, !tbaa !9
  %59 = zext i32 %58 to i64
  %60 = getelementptr inbounds i32, ptr %57, i64 %59
  %61 = call zeroext i1 @hash_exists(ptr noundef %56, ptr noundef %60)
  %62 = xor i1 %61, true
  %63 = zext i1 %62 to i32
  %64 = call i32 (i32, ptr, i32, ptr, ...) @acutest_check_(i32 noundef %63, ptr noundef @.str.38, i32 noundef 76, ptr noundef @.str.5, ptr noundef @.str.41)
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %67, label %66

66:                                               ; preds = %55
  call void @acutest_abort_() #7
  unreachable

67:                                               ; preds = %55
  br label %68

68:                                               ; preds = %67
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  %71 = load ptr, ptr %1, align 8, !tbaa !5
  %72 = call i64 @hash_size(ptr noundef %71)
  %73 = load i32, ptr %6, align 4, !tbaa !9
  %74 = sub i32 2000000, %73
  %75 = sub i32 %74, 1
  %76 = zext i32 %75 to i64
  %77 = icmp eq i64 %72, %76
  %78 = zext i1 %77 to i32
  %79 = call i32 (i32, ptr, i32, ptr, ...) @acutest_check_(i32 noundef %78, ptr noundef @.str.38, i32 noundef 79, ptr noundef @.str.5, ptr noundef @.str.45)
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %82, label %81

81:                                               ; preds = %70
  call void @acutest_abort_() #7
  unreachable

82:                                               ; preds = %70
  br label %83

83:                                               ; preds = %82
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  %86 = load i32, ptr %6, align 4, !tbaa !9
  %87 = add i32 %86, 1
  store i32 %87, ptr %6, align 4, !tbaa !9
  br label %30, !llvm.loop !15

88:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %89 = call i64 @clock() #6
  %90 = load i64, ptr %5, align 8, !tbaa !13
  %91 = sub nsw i64 %89, %90
  %92 = sitofp i64 %91 to double
  %93 = fdiv double %92, 1.000000e+06
  store double %93, ptr %7, align 8, !tbaa !16
  %94 = load ptr, ptr %1, align 8, !tbaa !5
  call void @hash_destroy(ptr noundef %94)
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %95) #6
  %96 = load double, ptr %7, align 8, !tbaa !16
  %97 = call i32 (ptr, ...) @printf(ptr noundef @.str.46, double noundef %96)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #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
}

declare zeroext i1 @hash_remove(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 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !12}
!16 = !{!17, !17, i64 0}
!17 = !{!"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.45 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [38 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
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

; Function Attrs: nounwind uwtable
define dso_local void @test_remove() 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)
  br label %8

6:                                                ; preds = %8
  %7 = call i64 @clock() #8
  br label %20

8:                                                ; preds = %0, %8
  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %8 ]
  %9 = getelementptr inbounds i32, ptr %5, i64 %indvars.iv
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = call ptr @createData(i32 noundef %10)
  %12 = call zeroext i1 @hash_insert(ptr noundef %2, ptr noundef %11) #8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 2000000
  br i1 %exitcond.not, label %6, label %8, !llvm.loop !9

13:                                               ; preds = %33
  %indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
  %exitcond30.not = icmp eq i64 %indvars.iv.next28, 2000000
  br i1 %exitcond30.not, label %14, label %20, !llvm.loop !11

14:                                               ; preds = %13
  %15 = call i64 @clock() #8
  %16 = sub nsw i64 %15, %7
  %17 = sitofp i64 %16 to double
  %18 = fdiv double %17, 1.000000e+06
  call void @hash_destroy(ptr noundef %2) #8
  call void @free(ptr noundef %5) #8
  %19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.46, double noundef %18)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  ret void

20:                                               ; preds = %6, %13
  %indvars.iv27 = phi i64 [ 0, %6 ], [ %indvars.iv.next28, %13 ]
  %21 = getelementptr inbounds i32, ptr %5, i64 %indvars.iv27
  %22 = call zeroext i1 @hash_exists(ptr noundef %2, ptr noundef %21) #8
  %23 = zext i1 %22 to i32
  %24 = call i32 (i32, ptr, i32, ptr, ...) @acutest_check_(i32 noundef %23, ptr noundef nonnull @.str.38, i32 noundef 70, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.42)
  %.not = icmp eq i32 %24, 0
  br i1 %.not, label %25, label %26

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

26:                                               ; preds = %20
  %27 = call zeroext i1 @hash_remove(ptr noundef %2, ptr noundef %21) #8
  %28 = call zeroext i1 @hash_exists(ptr noundef %2, ptr noundef %21) #8
  %29 = xor i1 %28, true
  %30 = zext i1 %29 to i32
  %31 = call i32 (i32, ptr, i32, ptr, ...) @acutest_check_(i32 noundef %30, ptr noundef nonnull @.str.38, i32 noundef 76, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.41)
  %.not22 = icmp eq i32 %31, 0
  br i1 %.not22, label %32, label %33

32:                                               ; preds = %26
  call void @acutest_abort_() #9
  unreachable

33:                                               ; preds = %26
  %34 = call i64 @hash_size(ptr noundef %2) #8
  %35 = sub nuw nsw i64 1999999, %indvars.iv27
  %36 = icmp eq i64 %34, %35
  %37 = zext i1 %36 to i32
  %38 = call i32 (i32, ptr, i32, ptr, ...) @acutest_check_(i32 noundef %37, ptr noundef nonnull @.str.38, i32 noundef 79, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.45)
  %.not23 = icmp eq i32 %38, 0
  br i1 %.not23, label %39, label %13

39:                                               ; preds = %33
  call void @acutest_abort_() #9
  unreachable
}

declare zeroext i1 @hash_remove(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"}
!11 = distinct !{!11, !10}


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