; LLVM IR from unum-cloud/usearch :: c (test)

; 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.20 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [21 x i8], align 1
@__const.main.collection_sizes = external hidden unnamed_addr constant [2 x i64], align 16
@__const.main.dimensions = external hidden unnamed_addr constant [2 x i64], align 16

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @test_init(i64 noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @test_add_vector(i64 noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @test_find_vector(i64 noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @test_get_vector(i64 noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @test_remove_vector(i64 noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @test_save_load(i64 noundef, i64 noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
declare dso_local void @test_view(i64 noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca [2 x i64], align 16
  %7 = alloca [2 x i64], align 16
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  %11 = call i32 (ptr, ...) @printf(ptr noundef @.str.20)
  %12 = call ptr @usearch_version()
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str.21, ptr noundef %12)
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %6, ptr align 16 @__const.main.collection_sizes, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %7, ptr align 16 @__const.main.dimensions, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i64 0, ptr %8, align 8, !tbaa !11
  br label %14

14:                                               ; preds = %70, %2
  %15 = load i64, ptr %8, align 8, !tbaa !11
  %16 = icmp ult i64 %15, 2
  br i1 %16, label %18, label %17

17:                                               ; preds = %14
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %73

18:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  store i64 0, ptr %10, align 8, !tbaa !11
  br label %19

19:                                               ; preds = %66, %18
  %20 = load i64, ptr %10, align 8, !tbaa !11
  %21 = icmp ult i64 %20, 2
  br i1 %21, label %23, label %22

22:                                               ; preds = %19
  store i32 5, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %69

23:                                               ; preds = %19
  %24 = load i64, ptr %8, align 8, !tbaa !11
  %25 = getelementptr inbounds [2 x i64], ptr %6, i64 0, i64 %24
  %26 = load i64, ptr %25, align 8, !tbaa !11
  %27 = load i64, ptr %10, align 8, !tbaa !11
  %28 = getelementptr inbounds [2 x i64], ptr %7, i64 0, i64 %27
  %29 = load i64, ptr %28, align 8, !tbaa !11
  call void @test_init(i64 noundef %26, i64 noundef %29)
  %30 = load i64, ptr %8, align 8, !tbaa !11
  %31 = getelementptr inbounds [2 x i64], ptr %6, i64 0, i64 %30
  %32 = load i64, ptr %31, align 8, !tbaa !11
  %33 = load i64, ptr %10, align 8, !tbaa !11
  %34 = getelementptr inbounds [2 x i64], ptr %7, i64 0, i64 %33
  %35 = load i64, ptr %34, align 8, !tbaa !11
  call void @test_add_vector(i64 noundef %32, i64 noundef %35)
  %36 = load i64, ptr %8, align 8, !tbaa !11
  %37 = getelementptr inbounds [2 x i64], ptr %6, i64 0, i64 %36
  %38 = load i64, ptr %37, align 8, !tbaa !11
  %39 = load i64, ptr %10, align 8, !tbaa !11
  %40 = getelementptr inbounds [2 x i64], ptr %7, i64 0, i64 %39
  %41 = load i64, ptr %40, align 8, !tbaa !11
  call void @test_find_vector(i64 noundef %38, i64 noundef %41)
  %42 = load i64, ptr %8, align 8, !tbaa !11
  %43 = getelementptr inbounds [2 x i64], ptr %6, i64 0, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !11
  %45 = load i64, ptr %10, align 8, !tbaa !11
  %46 = getelementptr inbounds [2 x i64], ptr %7, i64 0, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !11
  call void @test_get_vector(i64 noundef %44, i64 noundef %47)
  %48 = load i64, ptr %8, align 8, !tbaa !11
  %49 = getelementptr inbounds [2 x i64], ptr %6, i64 0, i64 %48
  %50 = load i64, ptr %49, align 8, !tbaa !11
  %51 = load i64, ptr %10, align 8, !tbaa !11
  %52 = getelementptr inbounds [2 x i64], ptr %7, i64 0, i64 %51
  %53 = load i64, ptr %52, align 8, !tbaa !11
  call void @test_remove_vector(i64 noundef %50, i64 noundef %53)
  %54 = load i64, ptr %8, align 8, !tbaa !11
  %55 = getelementptr inbounds [2 x i64], ptr %6, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !11
  %57 = load i64, ptr %10, align 8, !tbaa !11
  %58 = getelementptr inbounds [2 x i64], ptr %7, i64 0, i64 %57
  %59 = load i64, ptr %58, align 8, !tbaa !11
  call void @test_save_load(i64 noundef %56, i64 noundef %59)
  %60 = load i64, ptr %8, align 8, !tbaa !11
  %61 = getelementptr inbounds [2 x i64], ptr %6, i64 0, i64 %60
  %62 = load i64, ptr %61, align 8, !tbaa !11
  %63 = load i64, ptr %10, align 8, !tbaa !11
  %64 = getelementptr inbounds [2 x i64], ptr %7, i64 0, i64 %63
  %65 = load i64, ptr %64, align 8, !tbaa !11
  call void @test_view(i64 noundef %62, i64 noundef %65)
  br label %66

66:                                               ; preds = %23
  %67 = load i64, ptr %10, align 8, !tbaa !11
  %68 = add i64 %67, 1
  store i64 %68, ptr %10, align 8, !tbaa !11
  br label %19, !llvm.loop !13

69:                                               ; preds = %22
  br label %70

70:                                               ; preds = %69
  %71 = load i64, ptr %8, align 8, !tbaa !11
  %72 = add i64 %71, 1
  store i64 %72, ptr %8, align 8, !tbaa !11
  br label %14, !llvm.loop !15

73:                                               ; preds = %17
  %74 = load i32, ptr %4, align 4, !tbaa !5
  %75 = load ptr, ptr %5, align 8, !tbaa !9
  store i32 0, ptr %3, align 4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #4
  %76 = load i32, ptr %3, align 4
  ret i32 %76
}

declare ptr @usearch_version() #0

attributes #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 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind }

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


; 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.20 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [21 x i8], align 1
@__const.main.collection_sizes = external hidden unnamed_addr constant [2 x i64], align 16
@__const.main.dimensions = external hidden unnamed_addr constant [2 x i64], align 16

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

; Function Attrs: nounwind uwtable
declare dso_local void @test_init(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @test_add_vector(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @test_find_vector(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @test_get_vector(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @test_remove_vector(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @test_save_load(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @test_view(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #1 {
.preheader:
  %2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20)
  %3 = tail call ptr @usearch_version() #3
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, ptr noundef %3)
  %5 = load i64, ptr @__const.main.collection_sizes, align 16, !tbaa !5
  %6 = load i64, ptr @__const.main.dimensions, align 16, !tbaa !5
  tail call void @test_init(i64 noundef %5, i64 noundef %6)
  tail call void @test_add_vector(i64 noundef %5, i64 noundef %6)
  tail call void @test_find_vector(i64 noundef %5, i64 noundef %6)
  tail call void @test_get_vector(i64 noundef %5, i64 noundef %6)
  tail call void @test_remove_vector(i64 noundef %5, i64 noundef %6)
  tail call void @test_save_load(i64 noundef %5, i64 noundef %6)
  tail call void @test_view(i64 noundef %5, i64 noundef %6)
  %7 = load i64, ptr getelementptr inbounds (i8, ptr @__const.main.dimensions, i64 8), align 8, !tbaa !5
  tail call void @test_init(i64 noundef %5, i64 noundef %7)
  tail call void @test_add_vector(i64 noundef %5, i64 noundef %7)
  tail call void @test_find_vector(i64 noundef %5, i64 noundef %7)
  tail call void @test_get_vector(i64 noundef %5, i64 noundef %7)
  tail call void @test_remove_vector(i64 noundef %5, i64 noundef %7)
  tail call void @test_save_load(i64 noundef %5, i64 noundef %7)
  tail call void @test_view(i64 noundef %5, i64 noundef %7)
  %8 = load i64, ptr getelementptr inbounds (i8, ptr @__const.main.collection_sizes, i64 8), align 8, !tbaa !5
  tail call void @test_init(i64 noundef %8, i64 noundef %6)
  tail call void @test_add_vector(i64 noundef %8, i64 noundef %6)
  tail call void @test_find_vector(i64 noundef %8, i64 noundef %6)
  tail call void @test_get_vector(i64 noundef %8, i64 noundef %6)
  tail call void @test_remove_vector(i64 noundef %8, i64 noundef %6)
  tail call void @test_save_load(i64 noundef %8, i64 noundef %6)
  tail call void @test_view(i64 noundef %8, i64 noundef %6)
  tail call void @test_init(i64 noundef %8, i64 noundef %7)
  tail call void @test_add_vector(i64 noundef %8, i64 noundef %7)
  tail call void @test_find_vector(i64 noundef %8, i64 noundef %7)
  tail call void @test_get_vector(i64 noundef %8, i64 noundef %7)
  tail call void @test_remove_vector(i64 noundef %8, i64 noundef %7)
  tail call void @test_save_load(i64 noundef %8, i64 noundef %7)
  tail call void @test_view(i64 noundef %8, i64 noundef %7)
  ret i32 0
}

declare ptr @usearch_version() local_unnamed_addr #2

attributes #0 = { 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 #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 = { "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 = { nounwind }

!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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass