; 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.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }
%struct.priority = type { i32, [50 x i8] }
%struct.giggle_index = type { ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.pri_queue_t = type { ptr, i32, i32 }

@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@OFFSET_INDEX_FILE_NAME = external dso_local global ptr, align 8
@CHRM_INDEX_FILE_NAME = external dso_local global ptr, align 8

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

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

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

declare void @input_file_destroy(ptr noundef) #1

declare void @file_index_destroy(ptr noundef) #1

; Function Attrs: nounwind
declare void @free(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 uwtable
define dso_local void @test_giggle_bulk_insert_prime_pq() #3 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca %struct.stat, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca %struct.priority, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #6
  store ptr @.str, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store ptr @.str.1, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 144, ptr %3) #6
  call void @llvm.memset.p0.i64(ptr align 8 %3, i8 0, i64 144, i1 false)
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = call i32 @stat(ptr noundef %15, ptr noundef %3) #6
  %17 = icmp eq i32 %16, -1
  br i1 %17, label %18, label %21

18:                                               ; preds = %0
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = call i32 @mkdir(ptr noundef %19, i32 noundef 448) #6
  br label %26

21:                                               ; preds = %0
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = call i32 @rmrf(ptr noundef %22)
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = call i32 @mkdir(ptr noundef %24, i32 noundef 448) #6
  br label %26

26:                                               ; preds = %21, %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %27 = call noalias ptr @malloc(i64 noundef 64) #7
  store ptr %27, ptr %4, align 8, !tbaa !5
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = call noalias ptr @strdup(ptr noundef %28) #6
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.giggle_index, ptr %30, i32 0, i32 7
  store ptr %29, ptr %31, align 8, !tbaa !9
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.giggle_index, ptr %32, i32 0, i32 4
  store ptr null, ptr %33, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %34 = load ptr, ptr %1, align 8, !tbaa !5
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.giggle_index, ptr %35, i32 0, i32 7
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.giggle_index, ptr %38, i32 0, i32 4
  %40 = call i32 @giggle_bulk_insert_open_files(ptr noundef %34, ptr noundef %37, ptr noundef %5, ptr noundef %39)
  store i32 %40, ptr %6, align 4, !tbaa !13
  %41 = load i32, ptr %6, align 4, !tbaa !13
  %42 = zext i32 %41 to i64
  call void @UnityAssertEqualNumber(i64 noundef 22, i64 noundef %42, ptr noundef null, i64 noundef 825, i32 noundef 148)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.giggle_index, ptr %43, i32 0, i32 7
  %45 = load ptr, ptr %44, align 8, !tbaa !9
  %46 = load ptr, ptr @OFFSET_INDEX_FILE_NAME, align 8, !tbaa !5
  %47 = call i32 (ptr, ptr, ...) @asprintf(ptr noundef %7, ptr noundef @.str.2, ptr noundef %45, ptr noundef %46) #6
  store i32 %47, ptr %8, align 4, !tbaa !13
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = call ptr @offset_index_init(i32 noundef 1000, ptr noundef %48)
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.giggle_index, ptr %50, i32 0, i32 5
  store ptr %49, ptr %51, align 8, !tbaa !14
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %52) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store ptr null, ptr %9, align 8, !tbaa !5
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.giggle_index, ptr %53, i32 0, i32 7
  %55 = load ptr, ptr %54, align 8, !tbaa !9
  %56 = load ptr, ptr @CHRM_INDEX_FILE_NAME, align 8, !tbaa !5
  %57 = call i32 (ptr, ptr, ...) @asprintf(ptr noundef %9, ptr noundef @.str.2, ptr noundef %55, ptr noundef %56) #6
  store i32 %57, ptr %8, align 4, !tbaa !13
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = call ptr @chrm_index_init(i32 noundef 24, ptr noundef %58)
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.giggle_index, ptr %60, i32 0, i32 3
  store ptr %59, ptr %61, align 8, !tbaa !15
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  call void @free(ptr noundef %62) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %63 = load i32, ptr %6, align 4, !tbaa !13
  %64 = call ptr @priq_new(i32 noundef %63)
  store ptr %64, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %65 = load i32, ptr %6, align 4, !tbaa !13
  %66 = zext i32 %65 to i64
  %67 = mul i64 %66, 16
  %68 = call noalias ptr @malloc(i64 noundef %67) #7
  store ptr %68, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %69 = load i32, ptr %6, align 4, !tbaa !13
  %70 = call ptr @priq_new(i32 noundef %69)
  store ptr %70, ptr %12, align 8, !tbaa !5
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = load ptr, ptr %11, align 8, !tbaa !5
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = load i32, ptr %6, align 4, !tbaa !13
  call void @giggle_bulk_insert_prime_pqs(ptr noundef %71, ptr noundef %10, ptr noundef %72, ptr noundef %12, ptr noundef %73, i32 noundef %74)
  %75 = load i32, ptr %6, align 4, !tbaa !13
  %76 = zext i32 %75 to i64
  %77 = load ptr, ptr %10, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.pri_queue_t, ptr %77, i32 0, i32 1
  %79 = load i32, ptr %78, align 8, !tbaa !16
  %80 = sub nsw i32 %79, 1
  %81 = sext i32 %80 to i64
  call void @UnityAssertEqualNumber(i64 noundef %76, i64 noundef %81, ptr noundef null, i64 noundef 862, i32 noundef 148)
  %82 = load i32, ptr %6, align 4, !tbaa !13
  %83 = zext i32 %82 to i64
  %84 = load ptr, ptr %12, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.pri_queue_t, ptr %84, i32 0, i32 1
  %86 = load i32, ptr %85, align 8, !tbaa !16
  %87 = sub nsw i32 %86, 1
  %88 = sext i32 %87 to i64
  call void @UnityAssertEqualNumber(i64 noundef %83, i64 noundef %88, ptr noundef null, i64 noundef 863, i32 noundef 148)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !13
  br label %89

89:                                               ; preds = %98, %26
  %90 = load i32, ptr %13, align 4, !tbaa !13
  %91 = load i32, ptr %6, align 4, !tbaa !13
  %92 = icmp ult i32 %90, %91
  br i1 %92, label %93, label %101

93:                                               ; preds = %89
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = load i32, ptr %13, align 4, !tbaa !13
  %96 = zext i32 %95 to i64
  %97 = getelementptr inbounds ptr, ptr %94, i64 %96
  call void @input_file_destroy(ptr noundef %97)
  br label %98

98:                                               ; preds = %93
  %99 = load i32, ptr %13, align 4, !tbaa !13
  %100 = add i32 %99, 1
  store i32 %100, ptr %13, align 4, !tbaa !13
  br label %89, !llvm.loop !18

101:                                              ; preds = %89
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %102) #6
  %103 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %103) #6
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  call void @priq_free(ptr noundef %104)
  call void @llvm.lifetime.start.p0(i64 56, ptr %14) #6
  br label %105

105:                                              ; preds = %109, %101
  %106 = load ptr, ptr %12, align 8, !tbaa !5
  %107 = call ptr @priq_top(ptr noundef %106, ptr noundef %14)
  %108 = icmp ne ptr %107, null
  br i1 %108, label %109, label %112

109:                                              ; preds = %105
  %110 = load ptr, ptr %12, align 8, !tbaa !5
  %111 = call ptr @priq_pop(ptr noundef %110, ptr noundef %14)
  call void @free(ptr noundef %111) #6
  br label %105, !llvm.loop !20

112:                                              ; preds = %105
  %113 = load ptr, ptr %12, align 8, !tbaa !5
  call void @priq_free(ptr noundef %113)
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.giggle_index, ptr %114, i32 0, i32 7
  %116 = load ptr, ptr %115, align 8, !tbaa !9
  call void @free(ptr noundef %116) #6
  %117 = load ptr, ptr %4, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.giggle_index, ptr %117, i32 0, i32 4
  call void @file_index_destroy(ptr noundef %118)
  %119 = load ptr, ptr %4, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.giggle_index, ptr %119, i32 0, i32 5
  call void @offset_index_destroy(ptr noundef %120)
  %121 = load ptr, ptr %4, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.giggle_index, ptr %121, i32 0, i32 3
  call void @chrm_index_destroy(ptr noundef %122)
  %123 = load ptr, ptr %4, align 8, !tbaa !5
  call void @free(ptr noundef %123) #6
  %124 = load ptr, ptr %2, align 8, !tbaa !5
  %125 = call i32 @rmrf(ptr noundef %124)
  call void @llvm.lifetime.end.p0(i64 56, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, 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 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 144, 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
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: nounwind
declare i32 @stat(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind
declare i32 @mkdir(ptr noundef, i32 noundef) #2

declare i32 @rmrf(ptr noundef) #1

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #5

; Function Attrs: nounwind
declare noalias ptr @strdup(ptr noundef) #2

; Function Attrs: nounwind
declare i32 @asprintf(ptr noundef, ptr noundef, ...) #2

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

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

declare ptr @priq_new(i32 noundef) #1

declare void @giggle_bulk_insert_prime_pqs(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1

declare void @priq_free(ptr noundef) #1

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

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

declare void @offset_index_destroy(ptr noundef) #1

declare void @chrm_index_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 = { 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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!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 48}
!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 24}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !6, i64 32}
!15 = !{!10, !6, i64 16}
!16 = !{!17, !11, i64 8}
!17 = !{!"", !6, i64 0, !11, i64 8, !11, i64 12}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}


; 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.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }
%struct.priority = type { i32, [50 x i8] }

@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@OFFSET_INDEX_FILE_NAME = external dso_local local_unnamed_addr global ptr, align 8
@CHRM_INDEX_FILE_NAME = external dso_local local_unnamed_addr global ptr, 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 i32 @giggle_bulk_insert_open_files(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare void @input_file_destroy(ptr noundef) local_unnamed_addr #1

declare void @file_index_destroy(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture 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: nounwind uwtable
define dso_local void @test_giggle_bulk_insert_prime_pq() local_unnamed_addr #3 {
  %1 = alloca %struct.stat, align 8
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %struct.priority, align 4
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %1) #9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(144) %1, i8 0, i64 144, i1 false)
  %8 = call i32 @stat(ptr noundef nonnull @.str.1, ptr noundef nonnull %1) #9
  %9 = icmp eq i32 %8, -1
  br i1 %9, label %12, label %10

10:                                               ; preds = %0
  %11 = tail call i32 @rmrf(ptr noundef nonnull @.str.1) #9
  br label %12

12:                                               ; preds = %0, %10
  %13 = tail call i32 @mkdir(ptr noundef nonnull @.str.1, i32 noundef 448) #9
  %14 = tail call noalias dereferenceable_or_null(64) ptr @malloc(i64 noundef 64) #10
  %15 = tail call noalias ptr @strdup(ptr noundef nonnull @.str.1) #9
  %16 = getelementptr inbounds i8, ptr %14, i64 48
  store ptr %15, ptr %16, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %14, i64 24
  store ptr null, ptr %17, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #9
  store ptr null, ptr %2, align 8, !tbaa !12
  %18 = call i32 @giggle_bulk_insert_open_files(ptr noundef nonnull @.str, ptr noundef %15, ptr noundef nonnull %2, ptr noundef nonnull %17) #9
  %19 = zext i32 %18 to i64
  call void @UnityAssertEqualNumber(i64 noundef 22, i64 noundef %19, ptr noundef null, i64 noundef 825, i32 noundef 148) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #9
  store ptr null, ptr %3, align 8, !tbaa !12
  %20 = load ptr, ptr %16, align 8, !tbaa !5
  %21 = load ptr, ptr @OFFSET_INDEX_FILE_NAME, align 8, !tbaa !12
  %22 = call i32 (ptr, ptr, ...) @asprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.2, ptr noundef %20, ptr noundef %21) #9
  %23 = load ptr, ptr %3, align 8, !tbaa !12
  %24 = call ptr @offset_index_init(i32 noundef 1000, ptr noundef %23) #9
  %25 = getelementptr inbounds i8, ptr %14, i64 32
  store ptr %24, ptr %25, align 8, !tbaa !13
  %26 = load ptr, ptr %3, align 8, !tbaa !12
  call void @free(ptr noundef %26) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #9
  store ptr null, ptr %4, align 8, !tbaa !12
  %27 = load ptr, ptr %16, align 8, !tbaa !5
  %28 = load ptr, ptr @CHRM_INDEX_FILE_NAME, align 8, !tbaa !12
  %29 = call i32 (ptr, ptr, ...) @asprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.2, ptr noundef %27, ptr noundef %28) #9
  %30 = load ptr, ptr %4, align 8, !tbaa !12
  %31 = call ptr @chrm_index_init(i32 noundef 24, ptr noundef %30) #9
  %32 = getelementptr inbounds i8, ptr %14, i64 16
  store ptr %31, ptr %32, align 8, !tbaa !14
  %33 = load ptr, ptr %4, align 8, !tbaa !12
  call void @free(ptr noundef %33) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #9
  %34 = call ptr @priq_new(i32 noundef %18) #9
  store ptr %34, ptr %5, align 8, !tbaa !12
  %35 = shl nuw nsw i64 %19, 4
  %36 = call noalias ptr @malloc(i64 noundef %35) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #9
  %37 = call ptr @priq_new(i32 noundef %18) #9
  store ptr %37, ptr %6, align 8, !tbaa !12
  %38 = load ptr, ptr %2, align 8, !tbaa !12
  call void @giggle_bulk_insert_prime_pqs(ptr noundef %14, ptr noundef nonnull %5, ptr noundef %36, ptr noundef nonnull %6, ptr noundef %38, i32 noundef %18) #9
  %39 = load ptr, ptr %5, align 8, !tbaa !12
  %40 = getelementptr inbounds i8, ptr %39, i64 8
  %41 = load i32, ptr %40, align 8, !tbaa !15
  %42 = add nsw i32 %41, -1
  %43 = sext i32 %42 to i64
  call void @UnityAssertEqualNumber(i64 noundef %19, i64 noundef %43, ptr noundef null, i64 noundef 862, i32 noundef 148) #9
  %44 = load ptr, ptr %6, align 8, !tbaa !12
  %45 = getelementptr inbounds i8, ptr %44, i64 8
  %46 = load i32, ptr %45, align 8, !tbaa !15
  %47 = add nsw i32 %46, -1
  %48 = sext i32 %47 to i64
  call void @UnityAssertEqualNumber(i64 noundef %19, i64 noundef %48, ptr noundef null, i64 noundef 863, i32 noundef 148) #9
  %.not38 = icmp eq i32 %18, 0
  br i1 %.not38, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %12, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %12 ]
  %49 = load ptr, ptr %2, align 8, !tbaa !12
  %50 = getelementptr inbounds ptr, ptr %49, i64 %indvars.iv
  call void @input_file_destroy(ptr noundef %50) #9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %19
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !17

._crit_edge:                                      ; preds = %.lr.ph, %12
  %51 = load ptr, ptr %2, align 8, !tbaa !12
  call void @free(ptr noundef %51) #9
  call void @free(ptr noundef %36) #9
  %52 = load ptr, ptr %5, align 8, !tbaa !12
  call void @priq_free(ptr noundef %52) #9
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %7) #9
  %53 = load ptr, ptr %6, align 8, !tbaa !12
  %54 = call ptr @priq_top(ptr noundef %53, ptr noundef nonnull %7) #9
  %.not34 = icmp eq ptr %54, null
  br i1 %.not34, label %._crit_edge37, label %.lr.ph36

.lr.ph36:                                         ; preds = %._crit_edge, %.lr.ph36
  %55 = load ptr, ptr %6, align 8, !tbaa !12
  %56 = call ptr @priq_pop(ptr noundef %55, ptr noundef nonnull %7) #9
  call void @free(ptr noundef %56) #9
  %57 = load ptr, ptr %6, align 8, !tbaa !12
  %58 = call ptr @priq_top(ptr noundef %57, ptr noundef nonnull %7) #9
  %.not = icmp eq ptr %58, null
  br i1 %.not, label %._crit_edge37, label %.lr.ph36, !llvm.loop !19

._crit_edge37:                                    ; preds = %.lr.ph36, %._crit_edge
  %59 = load ptr, ptr %6, align 8, !tbaa !12
  call void @priq_free(ptr noundef %59) #9
  %60 = load ptr, ptr %16, align 8, !tbaa !5
  call void @free(ptr noundef %60) #9
  call void @file_index_destroy(ptr noundef nonnull %17) #9
  call void @offset_index_destroy(ptr noundef nonnull %25) #9
  call void @chrm_index_destroy(ptr noundef nonnull %32) #9
  call void @free(ptr noundef %14) #9
  %61 = call i32 @rmrf(ptr noundef nonnull @.str.1) #9
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %7) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #9
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %1) #9
  ret void
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

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

declare i32 @rmrf(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias ptr @strdup(ptr nocapture noundef readonly) local_unnamed_addr #7

; Function Attrs: nounwind
declare i32 @asprintf(ptr noundef, ptr noundef, ...) local_unnamed_addr #8

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

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

declare ptr @priq_new(i32 noundef) local_unnamed_addr #1

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

declare void @priq_free(ptr noundef) local_unnamed_addr #1

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

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

declare void @offset_index_destroy(ptr noundef) local_unnamed_addr #1

declare void @chrm_index_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 = { 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 #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 #7 = { mustprogress nofree nounwind willreturn 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 #8 = { 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 #9 = { nounwind }
attributes #10 = { nounwind allocsize(0) }

!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, !7, i64 48}
!6 = !{!"giggle_index", !7, i64 0, !10, i64 8, !10, i64 12, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 24}
!12 = !{!7, !7, i64 0}
!13 = !{!6, !7, i64 32}
!14 = !{!6, !7, i64 16}
!15 = !{!16, !10, i64 8}
!16 = !{!"", !7, i64 0, !10, i64 8, !10, i64 12}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


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