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

; 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.cache_def = type { 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.bpt_node = type { ptr }
%struct.uint64_t_ll_bpt_leading_data = type { ptr }
%struct.uint64_t_ll = type { i64, ptr, ptr }
%struct.uint64_t_ll_node = type { i64, ptr }
%struct.uint64_t_ll_bpt_non_leading_data = type { ptr, ptr }

@ORDER = external dso_local global i32, align 4
@cache = external dso_local global %struct.cache_def, align 8
@bpt_node_cache_handler = external dso_local global %struct.cache_handler, align 8
@.str = external hidden unnamed_addr constant [25 x i8], align 1
@uint64_t_ll_leading_cache_handler = external dso_local global %struct.cache_handler, align 8
@uint64_t_ll_non_leading_cache_handler = external dso_local global %struct.cache_handler, 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

declare void @UnityFail(ptr noundef, i64 noundef) #1

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

declare i64 @uint64_t_ll_contains(ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @valid_giggle_index(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %13

13:                                               ; preds = %213, %1
  %14 = load i32, ptr %3, align 4, !tbaa !9
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.giggle_index, ptr %15, i32 0, i32 2
  %17 = load i32, ptr %16, align 4, !tbaa !11
  %18 = icmp ult i32 %14, %17
  br i1 %18, label %19, label %216

19:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %20 = load ptr, ptr getelementptr inbounds (%struct.cache_def, ptr @cache, i32 0, i32 3), align 8, !tbaa !13
  %21 = load i32, ptr %3, align 4, !tbaa !9
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.giggle_index, ptr %22, i32 0, i32 0
  %24 = load ptr, ptr %23, align 8, !tbaa !15
  %25 = load i32, ptr %3, align 4, !tbaa !9
  %26 = zext i32 %25 to i64
  %27 = getelementptr inbounds i32, ptr %24, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !9
  %29 = sub i32 %28, 1
  %30 = call ptr %20(i32 noundef %21, i32 noundef %29, ptr noundef @bpt_node_cache_handler)
  store ptr %30, ptr %6, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %38, %19
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.bpt_node, ptr %32, i32 0, i32 0
  %34 = load ptr, ptr %33, align 8, !tbaa !16
  %35 = getelementptr inbounds i32, ptr %34, i64 2
  %36 = load i32, ptr %35, align 4, !tbaa !9
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %38, label %54

38:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.bpt_node, ptr %39, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8, !tbaa !16
  %42 = load i32, ptr @ORDER, align 4, !tbaa !9
  %43 = add i32 6, %42
  %44 = add i32 %43, 2
  %45 = zext i32 %44 to i64
  %46 = getelementptr inbounds i32, ptr %41, i64 %45
  %47 = getelementptr inbounds i32, ptr %46, i64 0
  %48 = load i32, ptr %47, align 4, !tbaa !9
  store i32 %48, ptr %7, align 4, !tbaa !9
  %49 = load ptr, ptr getelementptr inbounds (%struct.cache_def, ptr @cache, i32 0, i32 3), align 8, !tbaa !13
  %50 = load i32, ptr %3, align 4, !tbaa !9
  %51 = load i32, ptr %7, align 4, !tbaa !9
  %52 = sub i32 %51, 1
  %53 = call ptr %49(i32 noundef %50, i32 noundef %52, ptr noundef @bpt_node_cache_handler)
  store ptr %53, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %31, !llvm.loop !18

54:                                               ; preds = %31
  br label %55

55:                                               ; preds = %200, %54
  br label %56

56:                                               ; preds = %55
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.bpt_node, ptr %57, i32 0, i32 0
  %59 = load ptr, ptr %58, align 8, !tbaa !16
  %60 = getelementptr inbounds i32, ptr %59, i64 3
  %61 = load i32, ptr %60, align 4, !tbaa !9
  %62 = icmp eq i32 %61, 0
  br i1 %62, label %63, label %66

63:                                               ; preds = %56
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = icmp eq ptr %64, null
  br i1 %65, label %76, label %66

66:                                               ; preds = %63, %56
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.bpt_node, ptr %67, i32 0, i32 0
  %69 = load ptr, ptr %68, align 8, !tbaa !16
  %70 = getelementptr inbounds i32, ptr %69, i64 3
  %71 = load i32, ptr %70, align 4, !tbaa !9
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %77

73:                                               ; preds = %66
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = icmp ne ptr %74, null
  br i1 %75, label %76, label %77

76:                                               ; preds = %73, %63
  br label %78

77:                                               ; preds = %73, %66
  call void @UnityFail(ptr noundef @.str, i64 noundef 1409)
  br label %78

78:                                               ; preds = %77, %76
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.bpt_node, ptr %79, i32 0, i32 0
  %81 = load ptr, ptr %80, align 8, !tbaa !16
  %82 = getelementptr inbounds i32, ptr %81, i64 3
  %83 = load i32, ptr %82, align 4, !tbaa !9
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %119

85:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %86 = load ptr, ptr getelementptr inbounds (%struct.cache_def, ptr @cache, i32 0, i32 3), align 8, !tbaa !13
  %87 = load i32, ptr %3, align 4, !tbaa !9
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.bpt_node, ptr %88, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8, !tbaa !16
  %91 = getelementptr inbounds i32, ptr %90, i64 3
  %92 = load i32, ptr %91, align 4, !tbaa !9
  %93 = sub i32 %92, 1
  %94 = call ptr %86(i32 noundef %87, i32 noundef %93, ptr noundef @uint64_t_ll_leading_cache_handler)
  store ptr %94, ptr %8, align 8, !tbaa !5
  %95 = load ptr, ptr %8, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.uint64_t_ll_bpt_leading_data, ptr %95, i32 0, i32 0
  %97 = load ptr, ptr %96, align 8, !tbaa !20
  %98 = icmp ne ptr %97, null
  br i1 %98, label %99, label %118

99:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %100 = load ptr, ptr %8, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.uint64_t_ll_bpt_leading_data, ptr %100, i32 0, i32 0
  %102 = load ptr, ptr %101, align 8, !tbaa !20
  %103 = getelementptr inbounds %struct.uint64_t_ll, ptr %102, i32 0, i32 1
  %104 = load ptr, ptr %103, align 8, !tbaa !22
  store ptr %104, ptr %9, align 8, !tbaa !5
  br label %105

105:                                              ; preds = %108, %99
  %106 = load ptr, ptr %9, align 8, !tbaa !5
  %107 = icmp ne ptr %106, null
  br i1 %107, label %108, label %117

108:                                              ; preds = %105
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = load ptr, ptr %9, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.uint64_t_ll_node, ptr %110, i32 0, i32 0
  %112 = load i64, ptr %111, align 8, !tbaa !25
  %113 = call i64 @uint64_t_ll_contains(ptr noundef %109, i64 noundef %112)
  call void @UnityAssertEqualNumber(i64 noundef 1, i64 noundef %113, ptr noundef null, i64 noundef 1422, i32 noundef 148)
  %114 = load ptr, ptr %9, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.uint64_t_ll_node, ptr %114, i32 0, i32 1
  %116 = load ptr, ptr %115, align 8, !tbaa !27
  store ptr %116, ptr %9, align 8, !tbaa !5
  br label %105, !llvm.loop !28

117:                                              ; preds = %105
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %118

118:                                              ; preds = %117, %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %119

119:                                              ; preds = %118, %78
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %120

120:                                              ; preds = %189, %119
  %121 = load i32, ptr %4, align 4, !tbaa !9
  %122 = load ptr, ptr %6, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.bpt_node, ptr %122, i32 0, i32 0
  %124 = load ptr, ptr %123, align 8, !tbaa !16
  %125 = getelementptr inbounds i32, ptr %124, i64 5
  %126 = load i32, ptr %125, align 4, !tbaa !9
  %127 = icmp ult i32 %121, %126
  br i1 %127, label %128, label %192

128:                                              ; preds = %120
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %129 = load ptr, ptr getelementptr inbounds (%struct.cache_def, ptr @cache, i32 0, i32 3), align 8, !tbaa !13
  %130 = load i32, ptr %3, align 4, !tbaa !9
  %131 = load ptr, ptr %6, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.bpt_node, ptr %131, i32 0, i32 0
  %133 = load ptr, ptr %132, align 8, !tbaa !16
  %134 = load i32, ptr @ORDER, align 4, !tbaa !9
  %135 = add i32 6, %134
  %136 = add i32 %135, 2
  %137 = zext i32 %136 to i64
  %138 = getelementptr inbounds i32, ptr %133, i64 %137
  %139 = load i32, ptr %4, align 4, !tbaa !9
  %140 = zext i32 %139 to i64
  %141 = getelementptr inbounds i32, ptr %138, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !9
  %143 = sub i32 %142, 1
  %144 = call ptr %129(i32 noundef %130, i32 noundef %143, ptr noundef @uint64_t_ll_non_leading_cache_handler)
  store ptr %144, ptr %10, align 8, !tbaa !5
  %145 = load ptr, ptr %10, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.uint64_t_ll_bpt_non_leading_data, ptr %145, i32 0, i32 0
  %147 = load ptr, ptr %146, align 8, !tbaa !29
  %148 = icmp ne ptr %147, null
  br i1 %148, label %149, label %166

149:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %150 = load ptr, ptr %10, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.uint64_t_ll_bpt_non_leading_data, ptr %150, i32 0, i32 0
  %152 = load ptr, ptr %151, align 8, !tbaa !29
  %153 = getelementptr inbounds %struct.uint64_t_ll, ptr %152, i32 0, i32 1
  %154 = load ptr, ptr %153, align 8, !tbaa !22
  store ptr %154, ptr %11, align 8, !tbaa !5
  br label %155

155:                                              ; preds = %158, %149
  %156 = load ptr, ptr %11, align 8, !tbaa !5
  %157 = icmp ne ptr %156, null
  br i1 %157, label %158, label %165

158:                                              ; preds = %155
  %159 = load ptr, ptr %11, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.uint64_t_ll_node, ptr %159, i32 0, i32 0
  %161 = load i64, ptr %160, align 8, !tbaa !25
  call void @uint64_t_ll_uniq_append(ptr noundef %5, i64 noundef %161)
  %162 = load ptr, ptr %11, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.uint64_t_ll_node, ptr %162, i32 0, i32 1
  %164 = load ptr, ptr %163, align 8, !tbaa !27
  store ptr %164, ptr %11, align 8, !tbaa !5
  br label %155, !llvm.loop !31

165:                                              ; preds = %155
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br label %166

166:                                              ; preds = %165, %128
  %167 = load ptr, ptr %10, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.uint64_t_ll_bpt_non_leading_data, ptr %167, i32 0, i32 1
  %169 = load ptr, ptr %168, align 8, !tbaa !32
  %170 = icmp ne ptr %169, null
  br i1 %170, label %171, label %188

171:                                              ; preds = %166
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %172 = load ptr, ptr %10, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.uint64_t_ll_bpt_non_leading_data, ptr %172, i32 0, i32 1
  %174 = load ptr, ptr %173, align 8, !tbaa !32
  %175 = getelementptr inbounds %struct.uint64_t_ll, ptr %174, i32 0, i32 1
  %176 = load ptr, ptr %175, align 8, !tbaa !22
  store ptr %176, ptr %12, align 8, !tbaa !5
  br label %177

177:                                              ; preds = %180, %171
  %178 = load ptr, ptr %12, align 8, !tbaa !5
  %179 = icmp ne ptr %178, null
  br i1 %179, label %180, label %187

180:                                              ; preds = %177
  %181 = load ptr, ptr %12, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.uint64_t_ll_node, ptr %181, i32 0, i32 0
  %183 = load i64, ptr %182, align 8, !tbaa !25
  call void @uint64_t_ll_remove(ptr noundef %5, i64 noundef %183)
  %184 = load ptr, ptr %12, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.uint64_t_ll_node, ptr %184, i32 0, i32 1
  %186 = load ptr, ptr %185, align 8, !tbaa !27
  store ptr %186, ptr %12, align 8, !tbaa !5
  br label %177, !llvm.loop !33

187:                                              ; preds = %177
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  br label %188

188:                                              ; preds = %187, %166
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %189

189:                                              ; preds = %188
  %190 = load i32, ptr %4, align 4, !tbaa !9
  %191 = add i32 %190, 1
  store i32 %191, ptr %4, align 4, !tbaa !9
  br label %120, !llvm.loop !34

192:                                              ; preds = %120
  %193 = load ptr, ptr %6, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.bpt_node, ptr %193, i32 0, i32 0
  %195 = load ptr, ptr %194, align 8, !tbaa !16
  %196 = getelementptr inbounds i32, ptr %195, i64 4
  %197 = load i32, ptr %196, align 4, !tbaa !9
  %198 = icmp eq i32 %197, 0
  br i1 %198, label %199, label %200

199:                                              ; preds = %192
  br label %210

200:                                              ; preds = %192
  %201 = load ptr, ptr getelementptr inbounds (%struct.cache_def, ptr @cache, i32 0, i32 3), align 8, !tbaa !13
  %202 = load i32, ptr %3, align 4, !tbaa !9
  %203 = load ptr, ptr %6, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.bpt_node, ptr %203, i32 0, i32 0
  %205 = load ptr, ptr %204, align 8, !tbaa !16
  %206 = getelementptr inbounds i32, ptr %205, i64 4
  %207 = load i32, ptr %206, align 4, !tbaa !9
  %208 = sub i32 %207, 1
  %209 = call ptr %201(i32 noundef %202, i32 noundef %208, ptr noundef @bpt_node_cache_handler)
  store ptr %209, ptr %6, align 8, !tbaa !5
  br label %55

210:                                              ; preds = %199
  %211 = load ptr, ptr %5, align 8, !tbaa !5
  %212 = ptrtoint ptr %211 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %212, ptr noundef null, i64 noundef 1458, i32 noundef 148)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  br label %213

213:                                              ; preds = %210
  %214 = load i32, ptr %3, align 4, !tbaa !9
  %215 = add i32 %214, 1
  store i32 %215, ptr %3, align 4, !tbaa !9
  br label %13, !llvm.loop !35

216:                                              ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

declare void @uint64_t_ll_uniq_append(ptr noundef, i64 noundef) #1

declare void @uint64_t_ll_remove(ptr noundef, i64 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 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 = !{!"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, !10, i64 12}
!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 = !{!14, !6, i64 24}
!14 = !{!"cache_def", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!15 = !{!12, !6, i64 0}
!16 = !{!17, !6, i64 0}
!17 = !{!"bpt_node", !6, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!21, !6, i64 0}
!21 = !{!"uint64_t_ll_bpt_leading_data", !6, i64 0}
!22 = !{!23, !6, i64 8}
!23 = !{!"uint64_t_ll", !24, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!"long", !7, i64 0}
!25 = !{!26, !24, i64 0}
!26 = !{!"uint64_t_ll_node", !24, i64 0, !6, i64 8}
!27 = !{!26, !6, i64 8}
!28 = distinct !{!28, !19}
!29 = !{!30, !6, i64 0}
!30 = !{!"uint64_t_ll_bpt_non_leading_data", !6, i64 0, !6, i64 8}
!31 = distinct !{!31, !19}
!32 = !{!30, !6, i64 8}
!33 = distinct !{!33, !19}
!34 = distinct !{!34, !19}
!35 = distinct !{!35, !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.cache_def = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.cache_handler = type { ptr, ptr, ptr }

@ORDER = external dso_local local_unnamed_addr global i32, align 4
@cache = external dso_local local_unnamed_addr global %struct.cache_def, align 8
@bpt_node_cache_handler = external dso_local global %struct.cache_handler, align 8
@.str = external hidden unnamed_addr constant [25 x i8], align 1
@uint64_t_ll_leading_cache_handler = external dso_local global %struct.cache_handler, align 8
@uint64_t_ll_non_leading_cache_handler = external dso_local global %struct.cache_handler, 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

declare void @UnityFail(ptr noundef, i64 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 i64 @uint64_t_ll_contains(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @valid_giggle_index(ptr nocapture noundef readonly %0) local_unnamed_addr #2 {
  %2 = alloca ptr, align 8
  %3 = getelementptr inbounds i8, ptr %0, i64 12
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %.not86 = icmp eq i32 %4, 0
  br i1 %.not86, label %._crit_edge85, label %.lr.ph84

.lr.ph84:                                         ; preds = %1, %77
  %indvars.iv91 = phi i64 [ %indvars.iv.next92, %77 ], [ 0, %1 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  store ptr null, ptr %2, align 8, !tbaa !11
  %5 = load ptr, ptr getelementptr inbounds (i8, ptr @cache, i64 24), align 8, !tbaa !12
  %6 = load ptr, ptr %0, align 8, !tbaa !14
  %7 = getelementptr inbounds i32, ptr %6, i64 %indvars.iv91
  %8 = load i32, ptr %7, align 4, !tbaa !15
  %9 = add i32 %8, -1
  %10 = trunc nuw i64 %indvars.iv91 to i32
  %11 = call ptr %5(i32 noundef %10, i32 noundef %9, ptr noundef nonnull @bpt_node_cache_handler) #3
  %12 = load ptr, ptr %11, align 8, !tbaa !16
  %13 = getelementptr inbounds i8, ptr %12, i64 8
  %14 = load i32, ptr %13, align 4, !tbaa !15
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %.lr.ph, label %.preheader63.preheader

.lr.ph:                                           ; preds = %.lr.ph84, %.lr.ph
  %16 = phi ptr [ %25, %.lr.ph ], [ %12, %.lr.ph84 ]
  %17 = load i32, ptr @ORDER, align 4, !tbaa !15
  %18 = add i32 %17, 8
  %19 = zext i32 %18 to i64
  %20 = getelementptr inbounds i32, ptr %16, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !15
  %22 = load ptr, ptr getelementptr inbounds (i8, ptr @cache, i64 24), align 8, !tbaa !12
  %23 = add i32 %21, -1
  %24 = call ptr %22(i32 noundef %10, i32 noundef %23, ptr noundef nonnull @bpt_node_cache_handler) #3
  %25 = load ptr, ptr %24, align 8, !tbaa !16
  %26 = getelementptr inbounds i8, ptr %25, i64 8
  %27 = load i32, ptr %26, align 4, !tbaa !15
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %.lr.ph, label %.preheader63.preheader, !llvm.loop !18

.preheader63.preheader:                           ; preds = %.lr.ph, %.lr.ph84
  %.ph = phi ptr [ %12, %.lr.ph84 ], [ %25, %.lr.ph ]
  %.1.ph = phi ptr [ %11, %.lr.ph84 ], [ %24, %.lr.ph ]
  br label %.preheader63

.preheader63:                                     ; preds = %.preheader63.preheader, %73
  %29 = phi ptr [ %.pre, %73 ], [ %.ph, %.preheader63.preheader ]
  %.1 = phi ptr [ %76, %73 ], [ %.1.ph, %.preheader63.preheader ]
  %30 = getelementptr inbounds i8, ptr %29, i64 12
  %31 = load i32, ptr %30, align 4, !tbaa !15
  %32 = icmp eq i32 %31, 0
  %33 = load ptr, ptr %2, align 8
  %34 = icmp eq ptr %33, null
  %or.cond = select i1 %32, i1 %34, i1 false
  br i1 %or.cond, label %.loopexit62, label %35

35:                                               ; preds = %.preheader63
  %36 = icmp ne i32 %31, 0
  %37 = icmp ne ptr %33, null
  %or.cond3 = select i1 %36, i1 %37, i1 false
  br i1 %or.cond3, label %.thread97, label %38

38:                                               ; preds = %35
  call void @UnityFail(ptr noundef nonnull @.str, i64 noundef 1409) #3
  %.pre94 = load ptr, ptr %.1, align 8, !tbaa !16
  %.phi.trans.insert = getelementptr inbounds i8, ptr %.pre94, i64 12
  %.pre95 = load i32, ptr %.phi.trans.insert, align 4, !tbaa !15
  %.not = icmp eq i32 %.pre95, 0
  br i1 %.not, label %.loopexit62, label %.thread97

.thread97:                                        ; preds = %35, %38
  %39 = phi i32 [ %.pre95, %38 ], [ %31, %35 ]
  %40 = load ptr, ptr getelementptr inbounds (i8, ptr @cache, i64 24), align 8, !tbaa !12
  %41 = add i32 %39, -1
  %42 = call ptr %40(i32 noundef %10, i32 noundef %41, ptr noundef nonnull @uint64_t_ll_leading_cache_handler) #3
  %43 = load ptr, ptr %42, align 8, !tbaa !20
  %.not51 = icmp eq ptr %43, null
  br i1 %.not51, label %.loopexit62, label %.preheader61

.preheader61:                                     ; preds = %.thread97
  %.043.in64 = getelementptr inbounds i8, ptr %43, i64 8
  %.04365 = load ptr, ptr %.043.in64, align 8, !tbaa !11
  %.not5266 = icmp eq ptr %.04365, null
  br i1 %.not5266, label %.loopexit62, label %.lr.ph68

.lr.ph68:                                         ; preds = %.preheader61, %.lr.ph68
  %.04367 = phi ptr [ %.043, %.lr.ph68 ], [ %.04365, %.preheader61 ]
  %44 = load ptr, ptr %2, align 8, !tbaa !11
  %45 = load i64, ptr %.04367, align 8, !tbaa !22
  %46 = call i64 @uint64_t_ll_contains(ptr noundef %44, i64 noundef %45) #3
  call void @UnityAssertEqualNumber(i64 noundef 1, i64 noundef %46, ptr noundef null, i64 noundef 1422, i32 noundef 148) #3
  %.043.in = getelementptr inbounds i8, ptr %.04367, i64 8
  %.043 = load ptr, ptr %.043.in, align 8, !tbaa !11
  %.not52 = icmp eq ptr %.043, null
  br i1 %.not52, label %.loopexit62, label %.lr.ph68, !llvm.loop !25

.loopexit62:                                      ; preds = %.lr.ph68, %.preheader63, %.preheader61, %.thread97, %38
  %47 = load ptr, ptr %.1, align 8, !tbaa !16
  %48 = getelementptr inbounds i8, ptr %47, i64 20
  %49 = load i32, ptr %48, align 4, !tbaa !15
  %.not87 = icmp eq i32 %49, 0
  br i1 %.not87, label %._crit_edge, label %.lr.ph80

.lr.ph80:                                         ; preds = %.loopexit62, %.loopexit
  %indvars.iv = phi i64 [ %indvars.iv.next, %.loopexit ], [ 0, %.loopexit62 ]
  %50 = phi ptr [ %65, %.loopexit ], [ %47, %.loopexit62 ]
  %51 = load ptr, ptr getelementptr inbounds (i8, ptr @cache, i64 24), align 8, !tbaa !12
  %52 = load i32, ptr @ORDER, align 4, !tbaa !15
  %53 = add i32 %52, 8
  %54 = zext i32 %53 to i64
  %55 = getelementptr inbounds i32, ptr %50, i64 %54
  %56 = getelementptr inbounds i32, ptr %55, i64 %indvars.iv
  %57 = load i32, ptr %56, align 4, !tbaa !15
  %58 = add i32 %57, -1
  %59 = call ptr %51(i32 noundef %10, i32 noundef %58, ptr noundef nonnull @uint64_t_ll_non_leading_cache_handler) #3
  %60 = load ptr, ptr %59, align 8, !tbaa !26
  %.not53 = icmp eq ptr %60, null
  br i1 %.not53, label %.loopexit60, label %.preheader59

.preheader59:                                     ; preds = %.lr.ph80
  %.041.in69 = getelementptr inbounds i8, ptr %60, i64 8
  %.04170 = load ptr, ptr %.041.in69, align 8, !tbaa !11
  %.not5471 = icmp eq ptr %.04170, null
  br i1 %.not5471, label %.loopexit60, label %.lr.ph73

.lr.ph73:                                         ; preds = %.preheader59, %.lr.ph73
  %.04172 = phi ptr [ %.041, %.lr.ph73 ], [ %.04170, %.preheader59 ]
  %61 = load i64, ptr %.04172, align 8, !tbaa !22
  call void @uint64_t_ll_uniq_append(ptr noundef nonnull %2, i64 noundef %61) #3
  %.041.in = getelementptr inbounds i8, ptr %.04172, i64 8
  %.041 = load ptr, ptr %.041.in, align 8, !tbaa !11
  %.not54 = icmp eq ptr %.041, null
  br i1 %.not54, label %.loopexit60, label %.lr.ph73, !llvm.loop !28

.loopexit60:                                      ; preds = %.lr.ph73, %.preheader59, %.lr.ph80
  %62 = getelementptr inbounds i8, ptr %59, i64 8
  %63 = load ptr, ptr %62, align 8, !tbaa !29
  %.not55 = icmp eq ptr %63, null
  br i1 %.not55, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %.loopexit60
  %.0.in74 = getelementptr inbounds i8, ptr %63, i64 8
  %.075 = load ptr, ptr %.0.in74, align 8, !tbaa !11
  %.not5676 = icmp eq ptr %.075, null
  br i1 %.not5676, label %.loopexit, label %.lr.ph78

.lr.ph78:                                         ; preds = %.preheader, %.lr.ph78
  %.077 = phi ptr [ %.0, %.lr.ph78 ], [ %.075, %.preheader ]
  %64 = load i64, ptr %.077, align 8, !tbaa !22
  call void @uint64_t_ll_remove(ptr noundef nonnull %2, i64 noundef %64) #3
  %.0.in = getelementptr inbounds i8, ptr %.077, i64 8
  %.0 = load ptr, ptr %.0.in, align 8, !tbaa !11
  %.not56 = icmp eq ptr %.0, null
  br i1 %.not56, label %.loopexit, label %.lr.ph78, !llvm.loop !30

.loopexit:                                        ; preds = %.lr.ph78, %.preheader, %.loopexit60
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %65 = load ptr, ptr %.1, align 8, !tbaa !16
  %66 = getelementptr inbounds i8, ptr %65, i64 20
  %67 = load i32, ptr %66, align 4, !tbaa !15
  %68 = zext i32 %67 to i64
  %69 = icmp ult i64 %indvars.iv.next, %68
  br i1 %69, label %.lr.ph80, label %._crit_edge, !llvm.loop !31

._crit_edge:                                      ; preds = %.loopexit, %.loopexit62
  %.lcssa = phi ptr [ %47, %.loopexit62 ], [ %65, %.loopexit ]
  %70 = getelementptr inbounds i8, ptr %.lcssa, i64 16
  %71 = load i32, ptr %70, align 4, !tbaa !15
  %72 = icmp eq i32 %71, 0
  br i1 %72, label %77, label %73

73:                                               ; preds = %._crit_edge
  %74 = load ptr, ptr getelementptr inbounds (i8, ptr @cache, i64 24), align 8, !tbaa !12
  %75 = add i32 %71, -1
  %76 = call ptr %74(i32 noundef %10, i32 noundef %75, ptr noundef nonnull @bpt_node_cache_handler) #3
  %.pre = load ptr, ptr %76, align 8, !tbaa !16
  br label %.preheader63

77:                                               ; preds = %._crit_edge
  %78 = load ptr, ptr %2, align 8, !tbaa !11
  %79 = ptrtoint ptr %78 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %79, ptr noundef null, i64 noundef 1458, i32 noundef 148) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
  %80 = load i32, ptr %3, align 4, !tbaa !5
  %81 = zext i32 %80 to i64
  %82 = icmp ult i64 %indvars.iv.next92, %81
  br i1 %82, label %.lr.ph84, label %._crit_edge85, !llvm.loop !32

._crit_edge85:                                    ; preds = %77, %1
  ret void
}

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

declare void @uint64_t_ll_remove(ptr noundef, i64 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, !10, i64 12}
!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 = !{!7, !7, i64 0}
!12 = !{!13, !7, i64 24}
!13 = !{!"cache_def", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48}
!14 = !{!6, !7, i64 0}
!15 = !{!10, !10, i64 0}
!16 = !{!17, !7, i64 0}
!17 = !{!"bpt_node", !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!21, !7, i64 0}
!21 = !{!"uint64_t_ll_bpt_leading_data", !7, i64 0}
!22 = !{!23, !24, i64 0}
!23 = !{!"uint64_t_ll_node", !24, i64 0, !7, i64 8}
!24 = !{!"long", !8, i64 0}
!25 = distinct !{!25, !19}
!26 = !{!27, !7, i64 0}
!27 = !{!"uint64_t_ll_bpt_non_leading_data", !7, i64 0, !7, i64 8}
!28 = distinct !{!28, !19}
!29 = !{!27, !7, i64 8}
!30 = distinct !{!30, !19}
!31 = distinct !{!31, !19}
!32 = distinct !{!32, !19}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass