; LLVM IR from ryanlayer/giggle :: src (api_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"

%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.cache_def = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.giggle_query_result = type { ptr, i32, ptr, i32 }
%struct.uint_flt_pair = type { i32, float }

@.str = external hidden unnamed_addr constant [60 x i8], align 1
@offset_data_size = external dso_local global i32, align 4
@offset_data_append_data = external dso_local global ptr, align 8
@giggle_data_handler = external dso_local global %struct.giggle_def, align 8
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@cache = external dso_local global %struct.cache_def, align 8

; Function Attrs: nounwind uwtable
declare dso_local void @offset_data_append_uint_flt(ptr 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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #2

; 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
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, 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
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = icmp ne i32 %19, 6
  br i1 %20, label %21, label %25

21:                                               ; preds = %2
  %22 = load ptr, ptr %5, align 8, !tbaa !9
  %23 = getelementptr inbounds ptr, ptr %22, i64 0
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  call void (i32, ptr, ...) @errx(i32 noundef 1, ptr noundef @.str, ptr noundef %24) #5
  unreachable

25:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %26 = load ptr, ptr %5, align 8, !tbaa !9
  %27 = getelementptr inbounds ptr, ptr %26, i64 1
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  store ptr %28, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %29 = load ptr, ptr %5, align 8, !tbaa !9
  %30 = getelementptr inbounds ptr, ptr %29, i64 2
  %31 = load ptr, ptr %30, align 8, !tbaa !9
  store ptr %31, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %32 = load ptr, ptr %5, align 8, !tbaa !9
  %33 = getelementptr inbounds ptr, ptr %32, i64 3
  %34 = load ptr, ptr %33, align 8, !tbaa !9
  store ptr %34, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %35 = load ptr, ptr %5, align 8, !tbaa !9
  %36 = getelementptr inbounds ptr, ptr %35, i64 4
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %38 = call i32 @atoi(ptr noundef %37) #7
  store i32 %38, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %39 = load ptr, ptr %5, align 8, !tbaa !9
  %40 = getelementptr inbounds ptr, ptr %39, i64 5
  %41 = load ptr, ptr %40, align 8, !tbaa !9
  %42 = call i32 @atoi(ptr noundef %41) #7
  store i32 %42, ptr %10, align 4, !tbaa !5
  store i32 8, ptr @offset_data_size, align 4, !tbaa !5
  store ptr @offset_data_append_uint_flt, ptr @offset_data_append_data, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %43 = load ptr, ptr %6, align 8, !tbaa !9
  %44 = load ptr, ptr %7, align 8, !tbaa !9
  %45 = call i64 @giggle_bulk_insert(ptr noundef %43, ptr noundef %44, i32 noundef 1)
  store i64 %45, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %46 = load ptr, ptr %7, align 8, !tbaa !9
  %47 = call ptr @giggle_load(ptr noundef %46, ptr noundef @uint64_t_ll_giggle_set_data_handler)
  store ptr %47, ptr %12, align 8, !tbaa !9
  store ptr @giggle_collect_intersection_data_in_block, ptr getelementptr inbounds (%struct.giggle_def, ptr @giggle_data_handler, i32 0, i32 11), align 8, !tbaa !13
  store ptr @leaf_data_map_intersection_to_offset_list, ptr getelementptr inbounds (%struct.giggle_def, ptr @giggle_data_handler, i32 0, i32 12), align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %48 = load ptr, ptr %12, align 8, !tbaa !9
  %49 = load ptr, ptr %8, align 8, !tbaa !9
  %50 = load i32, ptr %9, align 4, !tbaa !5
  %51 = load i32, ptr %10, align 4, !tbaa !5
  %52 = call ptr @giggle_query(ptr noundef %48, ptr noundef %49, i32 noundef %50, i32 noundef %51, ptr noundef null)
  store ptr %52, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %71, %25
  %54 = load i32, ptr %14, align 4, !tbaa !5
  %55 = load ptr, ptr %13, align 8, !tbaa !9
  %56 = getelementptr inbounds %struct.giggle_query_result, ptr %55, i32 0, i32 1
  %57 = load i32, ptr %56, align 8, !tbaa !17
  %58 = icmp ult i32 %54, %57
  br i1 %58, label %59, label %74

59:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  store ptr null, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %60 = load ptr, ptr %13, align 8, !tbaa !9
  %61 = load i32, ptr %14, align 4, !tbaa !5
  %62 = call ptr @giggle_get_query_itr(ptr noundef %60, i32 noundef %61)
  store ptr %62, ptr %16, align 8, !tbaa !9
  br label %63

63:                                               ; preds = %67, %59
  %64 = load ptr, ptr %16, align 8, !tbaa !9
  %65 = call i32 @giggle_query_next(ptr noundef %64, ptr noundef %15)
  %66 = icmp eq i32 %65, 0
  br i1 %66, label %67, label %70

67:                                               ; preds = %63
  %68 = load ptr, ptr %15, align 8, !tbaa !9
  %69 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, ptr noundef %68)
  br label %63, !llvm.loop !19

70:                                               ; preds = %63
  call void @giggle_iter_destroy(ptr noundef %16)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %14, align 4, !tbaa !5
  %73 = add i32 %72, 1
  store i32 %73, ptr %14, align 4, !tbaa !5
  br label %53, !llvm.loop !21

74:                                               ; preds = %53
  call void @giggle_query_result_destroy(ptr noundef %13)
  %75 = load ptr, ptr %12, align 8, !tbaa !9
  %76 = load ptr, ptr %8, align 8, !tbaa !9
  %77 = load i32, ptr %9, align 4, !tbaa !5
  %78 = load i32, ptr %10, align 4, !tbaa !5
  %79 = call ptr @giggle_query(ptr noundef %75, ptr noundef %76, i32 noundef %77, i32 noundef %78, ptr noundef null)
  store ptr %79, ptr %13, align 8, !tbaa !9
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %104, %74
  %81 = load i32, ptr %14, align 4, !tbaa !5
  %82 = load ptr, ptr %13, align 8, !tbaa !9
  %83 = getelementptr inbounds %struct.giggle_query_result, ptr %82, i32 0, i32 1
  %84 = load i32, ptr %83, align 8, !tbaa !17
  %85 = icmp ult i32 %81, %84
  br i1 %85, label %86, label %107

86:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  store ptr null, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %87 = load ptr, ptr %13, align 8, !tbaa !9
  %88 = load i32, ptr %14, align 4, !tbaa !5
  %89 = call ptr @giggle_get_query_data_itr(ptr noundef %87, i32 noundef %88)
  store ptr %89, ptr %18, align 8, !tbaa !9
  br label %90

90:                                               ; preds = %94, %86
  %91 = load ptr, ptr %18, align 8, !tbaa !9
  %92 = call i32 @giggle_query_next_data(ptr noundef %91, ptr noundef %17)
  %93 = icmp eq i32 %92, 0
  br i1 %93, label %94, label %103

94:                                               ; preds = %90
  %95 = load ptr, ptr %17, align 8, !tbaa !9
  %96 = getelementptr inbounds %struct.uint_flt_pair, ptr %95, i32 0, i32 0
  %97 = load i32, ptr %96, align 4, !tbaa !22
  %98 = load ptr, ptr %17, align 8, !tbaa !9
  %99 = getelementptr inbounds %struct.uint_flt_pair, ptr %98, i32 0, i32 1
  %100 = load float, ptr %99, align 4, !tbaa !25
  %101 = fpext float %100 to double
  %102 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %97, double noundef %101)
  br label %90, !llvm.loop !26

103:                                              ; preds = %90
  call void @giggle_iter_destroy(ptr noundef %18)
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %104

104:                                              ; preds = %103
  %105 = load i32, ptr %14, align 4, !tbaa !5
  %106 = add i32 %105, 1
  store i32 %106, ptr %14, align 4, !tbaa !5
  br label %80, !llvm.loop !27

107:                                              ; preds = %80
  call void @giggle_index_destroy(ptr noundef %12)
  %108 = load ptr, ptr getelementptr inbounds (%struct.cache_def, ptr @cache, i32 0, i32 6), align 8, !tbaa !28
  call void (...) %108()
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %109 = load i32, ptr %3, align 4
  ret i32 %109
}

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

declare i64 @giggle_bulk_insert(ptr noundef, ptr noundef, i32 noundef) #4

declare ptr @giggle_load(ptr noundef, ptr noundef) #4

declare void @uint64_t_ll_giggle_set_data_handler(...) #4

declare ptr @giggle_collect_intersection_data_in_block(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #4

declare void @leaf_data_map_intersection_to_offset_list(ptr noundef, ptr noundef, ptr noundef) #4

declare ptr @giggle_query(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #4

declare ptr @giggle_get_query_itr(ptr noundef, i32 noundef) #4

declare i32 @giggle_query_next(ptr noundef, ptr noundef) #4

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

declare void @giggle_iter_destroy(ptr noundef) #4

declare void @giggle_query_result_destroy(ptr noundef) #4

declare ptr @giggle_get_query_data_itr(ptr noundef, i32 noundef) #4

declare i32 @giggle_query_next_data(ptr noundef, ptr noundef) #4

declare void @giggle_index_destroy(ptr noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint nounwind willreturn memory(read) 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 = { 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 #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 = { noreturn }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!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 = !{!14, !10, i64 120}
!14 = !{!"giggle_def", !15, i64 0, !15, i64 24, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128}
!15 = !{!"cache_handler", !10, i64 0, !10, i64 8, !10, i64 16}
!16 = !{!14, !10, i64 128}
!17 = !{!18, !6, i64 8}
!18 = !{!"giggle_query_result", !10, i64 0, !6, i64 8, !10, i64 16, !6, i64 24}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}
!22 = !{!23, !6, i64 0}
!23 = !{!"uint_flt_pair", !6, i64 0, !24, i64 4}
!24 = !{!"float", !7, i64 0}
!25 = !{!23, !24, i64 4}
!26 = distinct !{!26, !20}
!27 = distinct !{!27, !20}
!28 = !{!29, !10, i64 48}
!29 = !{!"cache_def", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48}


; 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 }
%struct.cache_def = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [60 x i8], align 1
@offset_data_size = external dso_local local_unnamed_addr global i32, align 4
@offset_data_append_data = external dso_local local_unnamed_addr global ptr, align 8
@giggle_data_handler = external dso_local local_unnamed_addr global %struct.giggle_def, align 8
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@cache = external dso_local local_unnamed_addr global %struct.cache_def, align 8

; Function Attrs: nounwind uwtable
declare dso_local void @offset_data_append_uint_flt(ptr noundef, ptr noundef) #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: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) 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: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %.not = icmp eq i32 %0, 6
  br i1 %.not, label %11, label %9

9:                                                ; preds = %2
  %10 = load ptr, ptr %1, align 8, !tbaa !5
  tail call void (i32, ptr, ...) @errx(i32 noundef 1, ptr noundef nonnull @.str, ptr noundef %10) #6
  unreachable

11:                                               ; preds = %2
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %1, i64 16
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %1, i64 24
  %17 = load ptr, ptr %16, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %1, i64 32
  %19 = load ptr, ptr %18, align 8, !tbaa !5
  %20 = tail call i32 @atoi(ptr nocapture noundef %19) #7
  %21 = getelementptr inbounds i8, ptr %1, i64 40
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  %23 = tail call i32 @atoi(ptr nocapture noundef %22) #7
  store i32 8, ptr @offset_data_size, align 4, !tbaa !9
  store ptr @offset_data_append_uint_flt, ptr @offset_data_append_data, align 8, !tbaa !5
  %24 = tail call i64 @giggle_bulk_insert(ptr noundef %13, ptr noundef %15, i32 noundef 1) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  %25 = tail call ptr @giggle_load(ptr noundef %15, ptr noundef nonnull @uint64_t_ll_giggle_set_data_handler) #8
  store ptr %25, ptr %3, align 8, !tbaa !5
  store ptr @giggle_collect_intersection_data_in_block, ptr getelementptr inbounds (i8, ptr @giggle_data_handler, i64 120), align 8, !tbaa !11
  store ptr @leaf_data_map_intersection_to_offset_list, ptr getelementptr inbounds (i8, ptr @giggle_data_handler, i64 128), align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %26 = tail call ptr @giggle_query(ptr noundef %25, ptr noundef %17, i32 noundef %20, i32 noundef %23, ptr noundef null) #8
  store ptr %26, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %26, i64 8
  %28 = load i32, ptr %27, align 8, !tbaa !15
  %.not33 = icmp eq i32 %28, 0
  br i1 %.not33, label %._crit_edge25, label %.lr.ph24

.lr.ph24:                                         ; preds = %11, %._crit_edge
  %.022 = phi i32 [ %37, %._crit_edge ], [ 0, %11 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  %29 = call ptr @giggle_get_query_itr(ptr noundef nonnull %26, i32 noundef %.022) #8
  store ptr %29, ptr %6, align 8, !tbaa !5
  %30 = call i32 @giggle_query_next(ptr noundef %29, ptr noundef nonnull %5) #8
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph24, %.lr.ph
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef %32)
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = call i32 @giggle_query_next(ptr noundef %34, ptr noundef nonnull %5) #8
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %.lr.ph, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph24
  call void @giggle_iter_destroy(ptr noundef nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  %37 = add nuw i32 %.022, 1
  %38 = load i32, ptr %27, align 8, !tbaa !15
  %39 = icmp ult i32 %37, %38
  br i1 %39, label %.lr.ph24, label %._crit_edge25, !llvm.loop !19

._crit_edge25:                                    ; preds = %._crit_edge, %11
  call void @giggle_query_result_destroy(ptr noundef nonnull %4) #8
  %40 = call ptr @giggle_query(ptr noundef %25, ptr noundef %17, i32 noundef %20, i32 noundef %23, ptr noundef null) #8
  store ptr %40, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %40, i64 8
  %42 = load i32, ptr %41, align 8, !tbaa !15
  %.not34 = icmp eq i32 %42, 0
  br i1 %.not34, label %._crit_edge32, label %.lr.ph31

.lr.ph31:                                         ; preds = %._crit_edge25, %._crit_edge28
  %43 = phi ptr [ %57, %._crit_edge28 ], [ %40, %._crit_edge25 ]
  %.129 = phi i32 [ %56, %._crit_edge28 ], [ 0, %._crit_edge25 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %44 = call ptr @giggle_get_query_data_itr(ptr noundef nonnull %43, i32 noundef %.129) #8
  store ptr %44, ptr %8, align 8, !tbaa !5
  %45 = call i32 @giggle_query_next_data(ptr noundef %44, ptr noundef nonnull %7) #8
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %.lr.ph27, label %._crit_edge28

.lr.ph27:                                         ; preds = %.lr.ph31, %.lr.ph27
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = load i32, ptr %47, align 4, !tbaa !20
  %49 = getelementptr inbounds i8, ptr %47, i64 4
  %50 = load float, ptr %49, align 4, !tbaa !23
  %51 = fpext float %50 to double
  %52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %48, double noundef %51)
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = call i32 @giggle_query_next_data(ptr noundef %53, ptr noundef nonnull %7) #8
  %55 = icmp eq i32 %54, 0
  br i1 %55, label %.lr.ph27, label %._crit_edge28, !llvm.loop !24

._crit_edge28:                                    ; preds = %.lr.ph27, %.lr.ph31
  call void @giggle_iter_destroy(ptr noundef nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  %56 = add nuw i32 %.129, 1
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %57, i64 8
  %59 = load i32, ptr %58, align 8, !tbaa !15
  %60 = icmp ult i32 %56, %59
  br i1 %60, label %.lr.ph31, label %._crit_edge32, !llvm.loop !25

._crit_edge32:                                    ; preds = %._crit_edge28, %._crit_edge25
  call void @giggle_index_destroy(ptr noundef nonnull %3) #8
  %61 = load ptr, ptr getelementptr inbounds (i8, ptr @cache, i64 48), align 8, !tbaa !26
  call void (...) %61() #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  ret i32 0
}

; Function Attrs: noreturn
declare void @errx(i32 noundef, ptr noundef, ...) local_unnamed_addr #3

declare i64 @giggle_bulk_insert(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

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

declare void @uint64_t_ll_giggle_set_data_handler(...) #4

declare ptr @giggle_collect_intersection_data_in_block(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #4

declare void @leaf_data_map_intersection_to_offset_list(ptr noundef, ptr noundef, ptr noundef) #4

declare ptr @giggle_query(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

declare ptr @giggle_get_query_itr(ptr noundef, i32 noundef) local_unnamed_addr #4

declare i32 @giggle_query_next(ptr noundef, ptr noundef) local_unnamed_addr #4

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

declare void @giggle_iter_destroy(ptr noundef) local_unnamed_addr #4

declare void @giggle_query_result_destroy(ptr noundef) local_unnamed_addr #4

declare ptr @giggle_get_query_data_itr(ptr noundef, i32 noundef) local_unnamed_addr #4

declare i32 @giggle_query_next_data(ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @giggle_index_destroy(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 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 = { 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 #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 = { 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 #6 = { noreturn nounwind }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { 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 = !{!"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 120}
!12 = !{!"giggle_def", !13, i64 0, !13, 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}
!13 = !{!"cache_handler", !6, i64 0, !6, i64 8, !6, i64 16}
!14 = !{!12, !6, i64 128}
!15 = !{!16, !10, i64 8}
!16 = !{!"giggle_query_result", !6, i64 0, !10, i64 8, !6, i64 16, !10, i64 24}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = !{!21, !10, i64 0}
!21 = !{!"uint_flt_pair", !10, i64 0, !22, i64 4}
!22 = !{!"float", !7, i64 0}
!23 = !{!21, !22, i64 4}
!24 = distinct !{!24, !18}
!25 = distinct !{!25, !18}
!26 = !{!27, !6, i64 48}
!27 = !{!"cache_def", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}


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