; LLVM IR from ryanlayer/giggle :: test/unit (test_bulk_insert)

; 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_index = type { ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.file_index = type { ptr, ptr }
%struct.unordered_list = type { ptr, i32, i32 }
%struct.chrm_index = type { ptr, ptr }
%struct.ordered_set = type { ptr, i32, i32, ptr, ptr, ptr }
%struct.offset_index = type { ptr, ptr, i32, ptr, i32 }
%struct.file_id_offset_pairs = type { i64, i64, ptr }
%struct.giggle_query_result = type { ptr, i32, ptr, i32 }
%struct.giggle_query_iter = type { ptr, i32, i32, i32, ptr, ptr, ptr }

@ORDER = external dso_local global i32, align 4
@.str.4 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [52 x i8], align 1
@giggle_data_handler = external dso_local global %struct.giggle_def, align 8
@.str.8 = external hidden unnamed_addr constant [2 x i8], align 1
@__const.test_giggle_bulk_insert_few.A_query_result_0 = external hidden unnamed_addr constant [3 x i32], align 4
@__const.test_giggle_bulk_insert_few.A_query_result_1 = external hidden unnamed_addr constant [2 x i32], align 4
@__const.test_giggle_bulk_insert_few.A_query_result_2 = external hidden unnamed_addr constant [2 x i32], align 4
@__const.test_giggle_bulk_insert_few.A_query_len = external hidden unnamed_addr constant [3 x i32], align 4
@cache = external dso_local global %struct.cache_def, align 8

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

declare void @UnityAssertEqualNumber(i64 noundef, i64 noundef, ptr noundef, i64 noundef, i32 noundef) #1

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

declare i32 @rmrf(ptr noundef) #1

; 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) #2

declare void @giggle_index_destroy(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @test_giggle_bulk_insert_few() #3 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca [3 x i32], align 4
  %7 = alloca [2 x i32], align 4
  %8 = alloca [2 x i32], align 4
  %9 = alloca [3 x ptr], align 16
  %10 = alloca [3 x i32], align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  store i32 5, ptr @ORDER, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  store ptr @.str.4, ptr %1, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  store ptr @.str.5, ptr %2, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %13 = load ptr, ptr %1, align 8, !tbaa !9
  %14 = load ptr, ptr %2, align 8, !tbaa !9
  %15 = call i64 @giggle_bulk_insert(ptr noundef %13, ptr noundef %14, i32 noundef 1)
  store i64 %15, ptr %3, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %16 = load ptr, ptr %2, align 8, !tbaa !9
  %17 = call ptr @giggle_load(ptr noundef %16, ptr noundef @uint64_t_ll_giggle_set_data_handler)
  store ptr %17, ptr %4, 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
  %18 = load ptr, ptr %4, align 8, !tbaa !9
  %19 = getelementptr inbounds %struct.giggle_index, ptr %18, i32 0, i32 1
  %20 = load i32, ptr %19, align 8, !tbaa !17
  %21 = zext i32 %20 to i64
  call void @UnityAssertEqualNumber(i64 noundef 1, i64 noundef %21, ptr noundef null, i64 noundef 1435, i32 noundef 148)
  %22 = load ptr, ptr %4, align 8, !tbaa !9
  %23 = getelementptr inbounds %struct.giggle_index, ptr %22, i32 0, i32 2
  %24 = load i32, ptr %23, align 4, !tbaa !19
  %25 = zext i32 %24 to i64
  call void @UnityAssertEqualNumber(i64 noundef 1, i64 noundef %25, ptr noundef null, i64 noundef 1436, i32 noundef 148)
  %26 = load ptr, ptr %4, align 8, !tbaa !9
  %27 = getelementptr inbounds %struct.giggle_index, ptr %26, i32 0, i32 4
  %28 = load ptr, ptr %27, align 8, !tbaa !20
  %29 = getelementptr inbounds %struct.file_index, ptr %28, i32 0, i32 1
  %30 = load ptr, ptr %29, align 8, !tbaa !21
  %31 = getelementptr inbounds %struct.unordered_list, ptr %30, i32 0, i32 1
  %32 = load i32, ptr %31, align 8, !tbaa !23
  %33 = zext i32 %32 to i64
  call void @UnityAssertEqualNumber(i64 noundef 3, i64 noundef %33, ptr noundef null, i64 noundef 1437, i32 noundef 148)
  %34 = load ptr, ptr %4, align 8, !tbaa !9
  %35 = getelementptr inbounds %struct.giggle_index, ptr %34, i32 0, i32 3
  %36 = load ptr, ptr %35, align 8, !tbaa !25
  %37 = getelementptr inbounds %struct.chrm_index, ptr %36, i32 0, i32 1
  %38 = load ptr, ptr %37, align 8, !tbaa !26
  %39 = getelementptr inbounds %struct.ordered_set, ptr %38, i32 0, i32 1
  %40 = load i32, ptr %39, align 8, !tbaa !28
  %41 = zext i32 %40 to i64
  call void @UnityAssertEqualNumber(i64 noundef 1, i64 noundef %41, ptr noundef null, i64 noundef 1438, i32 noundef 148)
  %42 = load ptr, ptr %4, align 8, !tbaa !9
  %43 = getelementptr inbounds %struct.giggle_index, ptr %42, i32 0, i32 5
  %44 = load ptr, ptr %43, align 8, !tbaa !30
  %45 = getelementptr inbounds %struct.offset_index, ptr %44, i32 0, i32 0
  %46 = load ptr, ptr %45, align 8, !tbaa !31
  %47 = getelementptr inbounds %struct.file_id_offset_pairs, ptr %46, i32 0, i32 0
  %48 = load i64, ptr %47, align 8, !tbaa !33
  call void @UnityAssertEqualNumber(i64 noundef 16, i64 noundef %48, ptr noundef null, i64 noundef 1439, i32 noundef 148)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store ptr null, ptr %5, align 8, !tbaa !9
  %49 = load ptr, ptr %4, align 8, !tbaa !9
  %50 = load ptr, ptr %5, align 8, !tbaa !9
  %51 = call ptr @giggle_query(ptr noundef %49, ptr noundef @.str.8, i32 noundef 1, i32 noundef 25, ptr noundef %50)
  store ptr %51, ptr %5, align 8, !tbaa !9
  %52 = load ptr, ptr %5, align 8, !tbaa !9
  %53 = getelementptr inbounds %struct.giggle_query_result, ptr %52, i32 0, i32 3
  %54 = load i32, ptr %53, align 8, !tbaa !35
  %55 = zext i32 %54 to i64
  call void @UnityAssertEqualNumber(i64 noundef 7, i64 noundef %55, ptr noundef null, i64 noundef 1444, i32 noundef 148)
  call void @llvm.lifetime.start.p0(i64 12, ptr %6) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 4 @__const.test_giggle_bulk_insert_few.A_query_result_0, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %7, ptr align 4 @__const.test_giggle_bulk_insert_few.A_query_result_1, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 @__const.test_giggle_bulk_insert_few.A_query_result_2, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #4
  %56 = getelementptr inbounds [3 x i32], ptr %6, i64 0, i64 0
  store ptr %56, ptr %9, align 8, !tbaa !9
  %57 = getelementptr inbounds ptr, ptr %9, i64 1
  %58 = getelementptr inbounds [2 x i32], ptr %7, i64 0, i64 0
  store ptr %58, ptr %57, align 8, !tbaa !9
  %59 = getelementptr inbounds ptr, ptr %9, i64 2
  %60 = getelementptr inbounds [2 x i32], ptr %8, i64 0, i64 0
  store ptr %60, ptr %59, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %10) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 @__const.test_giggle_bulk_insert_few.A_query_len, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %89, %0
  %62 = load i32, ptr %11, align 4, !tbaa !5
  %63 = load ptr, ptr %5, align 8, !tbaa !9
  %64 = getelementptr inbounds %struct.giggle_query_result, ptr %63, i32 0, i32 1
  %65 = load i32, ptr %64, align 8, !tbaa !37
  %66 = icmp ult i32 %62, %65
  br i1 %66, label %67, label %92

67:                                               ; preds = %61
  %68 = load i32, ptr %11, align 4, !tbaa !5
  %69 = zext i32 %68 to i64
  %70 = getelementptr inbounds [3 x i32], ptr %10, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = zext i32 %71 to i64
  %73 = load ptr, ptr %5, align 8, !tbaa !9
  %74 = load i32, ptr %11, align 4, !tbaa !5
  %75 = call i32 @giggle_get_query_len(ptr noundef %73, i32 noundef %74)
  %76 = zext i32 %75 to i64
  call void @UnityAssertEqualNumber(i64 noundef %72, i64 noundef %76, ptr noundef null, i64 noundef 1456, i32 noundef 148)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %77 = load ptr, ptr %5, align 8, !tbaa !9
  %78 = load i32, ptr %11, align 4, !tbaa !5
  %79 = call ptr @giggle_get_query_itr(ptr noundef %77, i32 noundef %78)
  store ptr %79, ptr %12, align 8, !tbaa !9
  %80 = load i32, ptr %11, align 4, !tbaa !5
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds [3 x i32], ptr %10, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = zext i32 %83 to i64
  %85 = load ptr, ptr %12, align 8, !tbaa !9
  %86 = getelementptr inbounds %struct.giggle_query_iter, ptr %85, i32 0, i32 3
  %87 = load i32, ptr %86, align 8, !tbaa !38
  %88 = zext i32 %87 to i64
  call void @UnityAssertEqualNumber(i64 noundef %84, i64 noundef %88, ptr noundef null, i64 noundef 1458, i32 noundef 148)
  call void @giggle_iter_destroy(ptr noundef %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %89

89:                                               ; preds = %67
  %90 = load i32, ptr %11, align 4, !tbaa !5
  %91 = add i32 %90, 1
  store i32 %91, ptr %11, align 4, !tbaa !5
  br label %61, !llvm.loop !40

92:                                               ; preds = %61
  call void @giggle_query_result_destroy(ptr noundef %5)
  call void @giggle_index_destroy(ptr noundef %4)
  %93 = load ptr, ptr getelementptr inbounds (%struct.cache_def, ptr @cache, i32 0, i32 6), align 8, !tbaa !42
  call void (...) %93()
  %94 = load ptr, ptr %2, align 8, !tbaa !9
  %95 = call i32 @rmrf(ptr noundef %94)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret void
}

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

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

declare void @uint64_t_ll_giggle_set_data_handler(...) #1

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

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

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

declare i32 @giggle_get_query_len(ptr noundef, i32 noundef) #1

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

declare void @giggle_iter_destroy(ptr noundef) #1

declare void @giggle_query_result_destroy(ptr noundef) #1

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

!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_index", !10, i64 0, !6, i64 8, !6, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56}
!19 = !{!18, !6, i64 12}
!20 = !{!18, !10, i64 24}
!21 = !{!22, !10, i64 8}
!22 = !{!"file_index", !10, i64 0, !10, i64 8}
!23 = !{!24, !6, i64 8}
!24 = !{!"unordered_list", !10, i64 0, !6, i64 8, !6, i64 12}
!25 = !{!18, !10, i64 16}
!26 = !{!27, !10, i64 8}
!27 = !{!"chrm_index", !10, i64 0, !10, i64 8}
!28 = !{!29, !6, i64 8}
!29 = !{!"ordered_set", !10, i64 0, !6, i64 8, !6, i64 12, !10, i64 16, !10, i64 24, !10, i64 32}
!30 = !{!18, !10, i64 32}
!31 = !{!32, !10, i64 0}
!32 = !{!"offset_index", !10, i64 0, !10, i64 8, !6, i64 16, !10, i64 24, !6, i64 32}
!33 = !{!34, !12, i64 0}
!34 = !{!"file_id_offset_pairs", !12, i64 0, !12, i64 8, !10, i64 16}
!35 = !{!36, !6, i64 24}
!36 = !{!"giggle_query_result", !10, i64 0, !6, i64 8, !10, i64 16, !6, i64 24}
!37 = !{!36, !6, i64 8}
!38 = !{!39, !6, i64 16}
!39 = !{!"giggle_query_iter", !10, i64 0, !6, i64 8, !6, i64 12, !6, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}
!40 = distinct !{!40, !41}
!41 = !{!"llvm.loop.mustprogress"}
!42 = !{!43, !10, i64 48}
!43 = !{!"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 }

@ORDER = external dso_local local_unnamed_addr global i32, align 4
@.str.4 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [52 x i8], align 1
@giggle_data_handler = external dso_local local_unnamed_addr global %struct.giggle_def, align 8
@.str.8 = external hidden unnamed_addr constant [2 x i8], align 1
@__const.test_giggle_bulk_insert_few.A_query_len = external hidden unnamed_addr constant [3 x i32], align 4
@cache = external dso_local local_unnamed_addr global %struct.cache_def, align 8

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

declare void @UnityAssertEqualNumber(i64 noundef, i64 noundef, ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

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

declare i32 @rmrf(ptr noundef) local_unnamed_addr #1

declare void @giggle_index_destroy(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @test_giggle_bulk_insert_few() local_unnamed_addr #2 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  store i32 5, ptr @ORDER, align 4, !tbaa !5
  %4 = tail call i64 @giggle_bulk_insert(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.5, i32 noundef 1) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #3
  %5 = tail call ptr @giggle_load(ptr noundef nonnull @.str.5, ptr noundef nonnull @uint64_t_ll_giggle_set_data_handler) #3
  store ptr %5, ptr %1, align 8, !tbaa !9
  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
  %6 = getelementptr inbounds i8, ptr %5, i64 8
  %7 = load i32, ptr %6, align 8, !tbaa !15
  %8 = zext i32 %7 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 1, i64 noundef %8, ptr noundef null, i64 noundef 1435, i32 noundef 148) #3
  %9 = getelementptr inbounds i8, ptr %5, i64 12
  %10 = load i32, ptr %9, align 4, !tbaa !17
  %11 = zext i32 %10 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 1, i64 noundef %11, ptr noundef null, i64 noundef 1436, i32 noundef 148) #3
  %12 = getelementptr inbounds i8, ptr %5, i64 24
  %13 = load ptr, ptr %12, align 8, !tbaa !18
  %14 = getelementptr inbounds i8, ptr %13, i64 8
  %15 = load ptr, ptr %14, align 8, !tbaa !19
  %16 = getelementptr inbounds i8, ptr %15, i64 8
  %17 = load i32, ptr %16, align 8, !tbaa !21
  %18 = zext i32 %17 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 3, i64 noundef %18, ptr noundef null, i64 noundef 1437, i32 noundef 148) #3
  %19 = getelementptr inbounds i8, ptr %5, i64 16
  %20 = load ptr, ptr %19, align 8, !tbaa !23
  %21 = getelementptr inbounds i8, ptr %20, i64 8
  %22 = load ptr, ptr %21, align 8, !tbaa !24
  %23 = getelementptr inbounds i8, ptr %22, i64 8
  %24 = load i32, ptr %23, align 8, !tbaa !26
  %25 = zext i32 %24 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 1, i64 noundef %25, ptr noundef null, i64 noundef 1438, i32 noundef 148) #3
  %26 = getelementptr inbounds i8, ptr %5, i64 32
  %27 = load ptr, ptr %26, align 8, !tbaa !28
  %28 = load ptr, ptr %27, align 8, !tbaa !29
  %29 = load i64, ptr %28, align 8, !tbaa !31
  tail call void @UnityAssertEqualNumber(i64 noundef 16, i64 noundef %29, ptr noundef null, i64 noundef 1439, i32 noundef 148) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  %30 = tail call ptr @giggle_query(ptr noundef %5, ptr noundef nonnull @.str.8, i32 noundef 1, i32 noundef 25, ptr noundef null) #3
  store ptr %30, ptr %2, align 8, !tbaa !9
  %31 = getelementptr inbounds i8, ptr %30, i64 24
  %32 = load i32, ptr %31, align 8, !tbaa !34
  %33 = zext i32 %32 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 7, i64 noundef %33, ptr noundef null, i64 noundef 1444, i32 noundef 148) #3
  %34 = getelementptr inbounds i8, ptr %30, i64 8
  %35 = load i32, ptr %34, align 8, !tbaa !36
  %.not = icmp eq i32 %35, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %36 = getelementptr inbounds [3 x i32], ptr @__const.test_giggle_bulk_insert_few.A_query_len, i64 0, i64 %indvars.iv
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = zext i32 %37 to i64
  %39 = trunc nuw i64 %indvars.iv to i32
  %40 = call i32 @giggle_get_query_len(ptr noundef nonnull %30, i32 noundef %39) #3
  %41 = zext i32 %40 to i64
  call void @UnityAssertEqualNumber(i64 noundef %38, i64 noundef %41, ptr noundef null, i64 noundef 1456, i32 noundef 148) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %42 = call ptr @giggle_get_query_itr(ptr noundef nonnull %30, i32 noundef %39) #3
  store ptr %42, ptr %3, align 8, !tbaa !9
  %43 = getelementptr inbounds i8, ptr %42, i64 16
  %44 = load i32, ptr %43, align 8, !tbaa !37
  %45 = zext i32 %44 to i64
  call void @UnityAssertEqualNumber(i64 noundef %38, i64 noundef %45, ptr noundef null, i64 noundef 1458, i32 noundef 148) #3
  call void @giggle_iter_destroy(ptr noundef nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %46 = load i32, ptr %34, align 8, !tbaa !36
  %47 = zext i32 %46 to i64
  %48 = icmp ult i64 %indvars.iv.next, %47
  br i1 %48, label %.lr.ph, label %._crit_edge, !llvm.loop !39

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @giggle_query_result_destroy(ptr noundef nonnull %2) #3
  call void @giggle_index_destroy(ptr noundef nonnull %1) #3
  %49 = load ptr, ptr getelementptr inbounds (i8, ptr @cache, i64 48), align 8, !tbaa !41
  call void (...) %49() #3
  %50 = call i32 @rmrf(ptr noundef nonnull @.str.5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #3
  ret void
}

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

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

declare void @uint64_t_ll_giggle_set_data_handler(...) #1

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

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

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

declare i32 @giggle_get_query_len(ptr noundef, i32 noundef) local_unnamed_addr #1

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

declare void @giggle_iter_destroy(ptr noundef) local_unnamed_addr #1

declare void @giggle_query_result_destroy(ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #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 #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 = { 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, !10, i64 120}
!12 = !{!"giggle_def", !13, i64 0, !13, 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}
!13 = !{!"cache_handler", !10, i64 0, !10, i64 8, !10, i64 16}
!14 = !{!12, !10, i64 128}
!15 = !{!16, !6, i64 8}
!16 = !{!"giggle_index", !10, i64 0, !6, i64 8, !6, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56}
!17 = !{!16, !6, i64 12}
!18 = !{!16, !10, i64 24}
!19 = !{!20, !10, i64 8}
!20 = !{!"file_index", !10, i64 0, !10, i64 8}
!21 = !{!22, !6, i64 8}
!22 = !{!"unordered_list", !10, i64 0, !6, i64 8, !6, i64 12}
!23 = !{!16, !10, i64 16}
!24 = !{!25, !10, i64 8}
!25 = !{!"chrm_index", !10, i64 0, !10, i64 8}
!26 = !{!27, !6, i64 8}
!27 = !{!"ordered_set", !10, i64 0, !6, i64 8, !6, i64 12, !10, i64 16, !10, i64 24, !10, i64 32}
!28 = !{!16, !10, i64 32}
!29 = !{!30, !10, i64 0}
!30 = !{!"offset_index", !10, i64 0, !10, i64 8, !6, i64 16, !10, i64 24, !6, i64 32}
!31 = !{!32, !33, i64 0}
!32 = !{!"file_id_offset_pairs", !33, i64 0, !33, i64 8, !10, i64 16}
!33 = !{!"long", !7, i64 0}
!34 = !{!35, !6, i64 24}
!35 = !{!"giggle_query_result", !10, i64 0, !6, i64 8, !10, i64 16, !6, i64 24}
!36 = !{!35, !6, i64 8}
!37 = !{!38, !6, i64 16}
!38 = !{!"giggle_query_iter", !10, i64 0, !6, i64 8, !6, i64 12, !6, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}
!39 = distinct !{!39, !40}
!40 = !{!"llvm.loop.mustprogress"}
!41 = !{!42, !10, i64 48}
!42 = !{!"cache_def", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48}


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