; LLVM IR from ryanlayer/giggle :: src (giggle_index)

; 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.giggle_def = type { %struct.cache_handler, %struct.cache_handler, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.cache_handler = type { ptr, ptr, ptr }
%struct.giggle_index = type { ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.giggle_query_result = type { ptr, i32, ptr, i32 }
%struct.file_index = type { ptr, ptr }
%struct.unordered_list = type { ptr, i32, i32 }

@giggle_data_handler = external dso_local global %struct.giggle_def, align 8
@.str.16 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [31 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: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #1

; Function Attrs: noreturn
declare void @err(i32 noundef, ptr noundef, ...) #2

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @chrm_index_get(ptr noundef, ptr noundef) #4

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strncmp(ptr noundef, ptr noundef, i64 noundef) #5

; Function Attrs: nounwind uwtable
define dso_local ptr @giggle_query_with_query_filter(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5) #4 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i32 %2, ptr %9, align 4, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !9
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = call i32 @strncmp(ptr noundef @.str.16, ptr noundef %20, i64 noundef 3) #7
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %24

23:                                               ; preds = %6
  store i32 3, ptr %13, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %23, %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  store ptr null, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.giggle_index, ptr %25, i32 0, i32 3
  %27 = load ptr, ptr %26, align 8, !tbaa !11
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = load i32, ptr %13, align 4, !tbaa !9
  %30 = zext i32 %29 to i64
  %31 = getelementptr inbounds i8, ptr %28, i64 %30
  %32 = call ptr @chrm_index_get(ptr noundef %27, ptr noundef %31)
  store ptr %32, ptr %15, align 8, !tbaa !5
  %33 = load ptr, ptr %15, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %35, label %53

35:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = load i32, ptr %13, align 4, !tbaa !9
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds i8, ptr %37, i64 %39
  %41 = call i32 @giggle_get_chrm_id(ptr noundef %36, ptr noundef %40)
  store i32 %41, ptr %16, align 4, !tbaa !9
  %42 = load i32, ptr %16, align 4, !tbaa !9
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.giggle_index, ptr %43, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !13
  %46 = load i32, ptr %16, align 4, !tbaa !9
  %47 = zext i32 %46 to i64
  %48 = getelementptr inbounds i32, ptr %45, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = load i32, ptr %9, align 4, !tbaa !9
  %51 = load i32, ptr %10, align 4, !tbaa !9
  %52 = call ptr @giggle_search(i32 noundef %42, i32 noundef %49, i32 noundef %50, i32 noundef %51)
  store ptr %52, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %53

53:                                               ; preds = %35, %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %54 = load ptr, ptr %12, align 8, !tbaa !5
  %55 = icmp eq ptr %54, null
  br i1 %55, label %56, label %114

56:                                               ; preds = %53
  %57 = call noalias ptr @malloc(i64 noundef 32) #8
  store ptr %57, ptr %19, align 8, !tbaa !5
  %58 = load ptr, ptr %19, align 8, !tbaa !5
  %59 = icmp eq ptr %58, null
  br i1 %59, label %60, label %61

60:                                               ; preds = %56
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.35) #9
  unreachable

61:                                               ; preds = %56
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = load ptr, ptr %19, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.giggle_query_result, ptr %63, i32 0, i32 0
  store ptr %62, ptr %64, align 8, !tbaa !14
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.giggle_index, ptr %65, i32 0, i32 4
  %67 = load ptr, ptr %66, align 8, !tbaa !16
  %68 = getelementptr inbounds %struct.file_index, ptr %67, i32 0, i32 1
  %69 = load ptr, ptr %68, align 8, !tbaa !17
  %70 = getelementptr inbounds %struct.unordered_list, ptr %69, i32 0, i32 1
  %71 = load i32, ptr %70, align 8, !tbaa !19
  %72 = load ptr, ptr %19, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.giggle_query_result, ptr %72, i32 0, i32 1
  store i32 %71, ptr %73, align 8, !tbaa !21
  %74 = load ptr, ptr %19, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.giggle_query_result, ptr %74, i32 0, i32 3
  store i32 0, ptr %75, align 8, !tbaa !22
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.giggle_index, ptr %76, i32 0, i32 4
  %78 = load ptr, ptr %77, align 8, !tbaa !16
  %79 = getelementptr inbounds %struct.file_index, ptr %78, i32 0, i32 1
  %80 = load ptr, ptr %79, align 8, !tbaa !17
  %81 = getelementptr inbounds %struct.unordered_list, ptr %80, i32 0, i32 1
  %82 = load i32, ptr %81, align 8, !tbaa !19
  %83 = zext i32 %82 to i64
  %84 = call noalias ptr @calloc(i64 noundef %83, i64 noundef 8) #10
  %85 = load ptr, ptr %19, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.giggle_query_result, ptr %85, i32 0, i32 2
  store ptr %84, ptr %86, align 8, !tbaa !23
  %87 = load ptr, ptr %19, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.giggle_query_result, ptr %87, i32 0, i32 2
  %89 = load ptr, ptr %88, align 8, !tbaa !23
  %90 = icmp eq ptr %89, null
  br i1 %90, label %91, label %92

91:                                               ; preds = %61
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.36) #9
  unreachable

92:                                               ; preds = %61
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %93

93:                                               ; preds = %110, %92
  %94 = load i32, ptr %17, align 4, !tbaa !9
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.giggle_index, ptr %95, i32 0, i32 4
  %97 = load ptr, ptr %96, align 8, !tbaa !16
  %98 = getelementptr inbounds %struct.file_index, ptr %97, i32 0, i32 1
  %99 = load ptr, ptr %98, align 8, !tbaa !17
  %100 = getelementptr inbounds %struct.unordered_list, ptr %99, i32 0, i32 1
  %101 = load i32, ptr %100, align 8, !tbaa !19
  %102 = icmp ult i32 %94, %101
  br i1 %102, label %103, label %113

103:                                              ; preds = %93
  %104 = load ptr, ptr %19, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.giggle_query_result, ptr %104, i32 0, i32 2
  %106 = load ptr, ptr %105, align 8, !tbaa !23
  %107 = load i32, ptr %17, align 4, !tbaa !9
  %108 = zext i32 %107 to i64
  %109 = getelementptr inbounds ptr, ptr %106, i64 %108
  store ptr null, ptr %109, align 8, !tbaa !5
  br label %110

110:                                              ; preds = %103
  %111 = load i32, ptr %17, align 4, !tbaa !9
  %112 = add i32 %111, 1
  store i32 %112, ptr %17, align 4, !tbaa !9
  br label %93, !llvm.loop !24

113:                                              ; preds = %93
  br label %116

114:                                              ; preds = %53
  %115 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %115, ptr %19, align 8, !tbaa !5
  br label %116

116:                                              ; preds = %114, %113
  %117 = load ptr, ptr %11, align 8, !tbaa !5
  %118 = icmp ne ptr %117, null
  br i1 %118, label %119, label %122

119:                                              ; preds = %116
  %120 = load ptr, ptr %7, align 8, !tbaa !5
  %121 = load ptr, ptr %11, align 8, !tbaa !5
  call void @apply_query_filter_to_results(ptr noundef %120, ptr noundef %121, ptr noundef %14)
  br label %122

122:                                              ; preds = %119, %116
  %123 = load ptr, ptr getelementptr inbounds (%struct.giggle_def, ptr @giggle_data_handler, i32 0, i32 12), align 8, !tbaa !26
  %124 = load ptr, ptr %7, align 8, !tbaa !5
  %125 = load ptr, ptr %19, align 8, !tbaa !5
  %126 = load ptr, ptr %14, align 8, !tbaa !5
  call void %123(ptr noundef %124, ptr noundef %125, ptr noundef %126)
  %127 = load ptr, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  ret ptr %127
}

; Function Attrs: nounwind uwtable
declare dso_local void @apply_query_filter_to_results(ptr noundef, ptr noundef, ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { noreturn "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 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 #4 = { 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 #5 = { nounwind willreturn memory(read) "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 = { nounwind willreturn memory(read) }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { noreturn }
attributes #10 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 16}
!12 = !{!"giggle_index", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!13 = !{!12, !6, i64 0}
!14 = !{!15, !6, i64 0}
!15 = !{!"giggle_query_result", !6, i64 0, !10, i64 8, !6, i64 16, !10, i64 24}
!16 = !{!12, !6, i64 24}
!17 = !{!18, !6, i64 8}
!18 = !{!"file_index", !6, i64 0, !6, i64 8}
!19 = !{!20, !10, i64 8}
!20 = !{!"unordered_list", !6, i64 0, !10, i64 8, !10, i64 12}
!21 = !{!15, !10, i64 8}
!22 = !{!15, !10, i64 24}
!23 = !{!15, !6, i64 16}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!27, !6, i64 128}
!27 = !{!"giggle_def", !28, i64 0, !28, i64 24, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128}
!28 = !{!"cache_handler", !6, i64 0, !6, i64 8, !6, i64 16}


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

%struct.giggle_def = type { %struct.cache_handler, %struct.cache_handler, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.cache_handler = type { ptr, ptr, ptr }

@giggle_data_handler = external dso_local local_unnamed_addr global %struct.giggle_def, align 8
@.str.16 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [31 x i8], align 1

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

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

; Function Attrs: noreturn
declare void @err(i32 noundef, ptr noundef, ...) 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) #0

; 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 #3

; Function Attrs: nounwind uwtable
declare dso_local ptr @giggle_search(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare dso_local i32 @giggle_get_chrm_id(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare dso_local ptr @chrm_index_get(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strncmp(ptr nocapture noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @giggle_query_with_query_filter(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #4 {
  %7 = alloca ptr, align 8
  %8 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) @.str.16, ptr noundef nonnull dereferenceable(1) %1, i64 noundef 3) #6
  %9 = icmp eq i32 %8, 0
  %spec.store.select = select i1 %9, i64 3, i64 0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  store ptr null, ptr %7, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %12 = getelementptr inbounds i8, ptr %1, i64 %spec.store.select
  %13 = tail call ptr @chrm_index_get(ptr noundef %11, ptr noundef %12)
  %.not = icmp eq ptr %13, null
  br i1 %.not, label %21, label %14

14:                                               ; preds = %6
  %15 = tail call i32 @giggle_get_chrm_id(ptr noundef nonnull %0, ptr noundef %12)
  %16 = load ptr, ptr %0, align 8, !tbaa !12
  %17 = zext i32 %15 to i64
  %18 = getelementptr inbounds i32, ptr %16, i64 %17
  %19 = load i32, ptr %18, align 4, !tbaa !13
  %20 = tail call ptr @giggle_search(i32 noundef %15, i32 noundef %19, i32 noundef %2, i32 noundef %3)
  store ptr %20, ptr %7, align 8, !tbaa !5
  br label %21

21:                                               ; preds = %14, %6
  %22 = phi ptr [ %20, %14 ], [ null, %6 ]
  %23 = icmp eq ptr %5, null
  br i1 %23, label %24, label %.loopexit

24:                                               ; preds = %21
  %25 = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #8
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %28

27:                                               ; preds = %24
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.35) #9
  unreachable

28:                                               ; preds = %24
  store ptr %0, ptr %25, align 8, !tbaa !14
  %29 = getelementptr inbounds i8, ptr %0, i64 24
  %30 = load ptr, ptr %29, align 8, !tbaa !16
  %31 = getelementptr inbounds i8, ptr %30, i64 8
  %32 = load ptr, ptr %31, align 8, !tbaa !17
  %33 = getelementptr inbounds i8, ptr %32, i64 8
  %34 = load i32, ptr %33, align 8, !tbaa !19
  %35 = getelementptr inbounds i8, ptr %25, i64 8
  store i32 %34, ptr %35, align 8, !tbaa !21
  %36 = getelementptr inbounds i8, ptr %25, i64 24
  store i32 0, ptr %36, align 8, !tbaa !22
  %37 = zext i32 %34 to i64
  %38 = tail call noalias ptr @calloc(i64 noundef %37, i64 noundef 8) #10
  %39 = getelementptr inbounds i8, ptr %25, i64 16
  store ptr %38, ptr %39, align 8, !tbaa !23
  %40 = icmp eq ptr %38, null
  br i1 %40, label %44, label %.preheader

.preheader:                                       ; preds = %28
  %.not40 = icmp eq i32 %34, 0
  br i1 %.not40, label %.loopexit, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %min.iters.check = icmp ult i32 %34, 4
  br i1 %min.iters.check, label %.lr.ph.preheader42, label %vector.ph

.lr.ph.preheader42:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %37, 4294967292
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %41 = getelementptr inbounds ptr, ptr %38, i64 %index
  %42 = getelementptr inbounds i8, ptr %41, i64 16
  store <2 x ptr> zeroinitializer, ptr %41, align 8, !tbaa !5
  store <2 x ptr> zeroinitializer, ptr %42, align 8, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %43 = icmp eq i64 %index.next, %n.vec
  br i1 %43, label %middle.block, label %vector.body, !llvm.loop !24

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %37
  br i1 %cmp.n, label %.loopexit, label %.lr.ph.preheader42

44:                                               ; preds = %28
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.36) #9
  unreachable

.lr.ph:                                           ; preds = %.lr.ph.preheader42, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader42 ]
  %45 = getelementptr inbounds ptr, ptr %38, i64 %indvars.iv
  store ptr null, ptr %45, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %46 = icmp ult i64 %indvars.iv.next, %37
  br i1 %46, label %.lr.ph, label %.loopexit, !llvm.loop !28

.loopexit:                                        ; preds = %.lr.ph, %middle.block, %.preheader, %21
  %.0 = phi ptr [ %5, %21 ], [ %25, %.preheader ], [ %25, %middle.block ], [ %25, %.lr.ph ]
  %.not38 = icmp eq ptr %4, null
  br i1 %.not38, label %48, label %47

47:                                               ; preds = %.loopexit
  call void @apply_query_filter_to_results(ptr noundef nonnull %0, ptr noundef nonnull %4, ptr noundef nonnull %7)
  %.pre = load ptr, ptr %7, align 8, !tbaa !5
  br label %48

48:                                               ; preds = %47, %.loopexit
  %49 = phi ptr [ %.pre, %47 ], [ %22, %.loopexit ]
  %50 = load ptr, ptr getelementptr inbounds (i8, ptr @giggle_data_handler, i64 128), align 8, !tbaa !29
  call void %50(ptr noundef nonnull %0, ptr noundef nonnull %.0, ptr noundef %49) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  ret ptr %.0
}

; Function Attrs: nounwind uwtable
declare dso_local void @apply_query_filter_to_results(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { noreturn "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,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 #4 = { 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 #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 willreturn memory(read) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { noreturn nounwind }
attributes #10 = { 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, !6, i64 16}
!10 = !{!"giggle_index", !6, i64 0, !11, i64 8, !11, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!15, !6, i64 0}
!15 = !{!"giggle_query_result", !6, i64 0, !11, i64 8, !6, i64 16, !11, i64 24}
!16 = !{!10, !6, i64 24}
!17 = !{!18, !6, i64 8}
!18 = !{!"file_index", !6, i64 0, !6, i64 8}
!19 = !{!20, !11, i64 8}
!20 = !{!"unordered_list", !6, i64 0, !11, i64 8, !11, i64 12}
!21 = !{!15, !11, i64 8}
!22 = !{!15, !11, i64 24}
!23 = !{!15, !6, i64 16}
!24 = distinct !{!24, !25, !26, !27}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!"llvm.loop.isvectorized", i32 1}
!27 = !{!"llvm.loop.unroll.runtime.disable"}
!28 = distinct !{!28, !25, !27, !26}
!29 = !{!30, !6, i64 128}
!30 = !{!"giggle_def", !31, i64 0, !31, i64 24, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128}
!31 = !{!"cache_handler", !6, i64 0, !6, i64 8, !6, i64 16}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass