; LLVM IR from glotzerlab/hoomd-blue :: hoomd/extern (gsd)

; 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.gsd_index_entry = type { i64, i64, i64, i32, i16, i8, i8 }
%struct.gsd_handle = type { i32, %struct.gsd_header, %struct.gsd_index_buffer, %struct.gsd_index_buffer, %struct.gsd_index_buffer, %struct.gsd_byte_buffer, %struct.gsd_name_buffer, %struct.gsd_name_buffer, i64, i64, i32, %struct.gsd_name_id_map, i64, i64, i64 }
%struct.gsd_header = type { i64, i64, i64, i64, i64, i32, i32, [64 x i8], [64 x i8], [80 x i8] }
%struct.gsd_index_buffer = type { ptr, i64, i64, ptr, i64 }
%struct.gsd_byte_buffer = type { ptr, i64, i64 }
%struct.gsd_name_buffer = type { %struct.gsd_byte_buffer, i64 }
%struct.gsd_name_id_map = type { ptr, i64 }

; Function Attrs: nounwind uwtable
declare dso_local i32 @gsd_make_version(i32 noundef, i32 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @gsd_flush(ptr noundef) #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @gsd_name_id_map_find(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @gsd_get_nframes(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local ptr @gsd_find_chunk(ptr noundef %0, i64 noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i16, align 2
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca %struct.gsd_index_entry, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = icmp eq ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %3
  store ptr null, ptr %4, align 8
  br label %195

23:                                               ; preds = %3
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = icmp eq ptr %24, null
  br i1 %25, label %26, label %27

26:                                               ; preds = %23
  store ptr null, ptr %4, align 8
  br label %195

27:                                               ; preds = %23
  %28 = load i64, ptr %6, align 8, !tbaa !9
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = call i64 @gsd_get_nframes(ptr noundef %29)
  %31 = icmp uge i64 %28, %30
  br i1 %31, label %32, label %33

32:                                               ; preds = %27
  store ptr null, ptr %4, align 8
  br label %195

33:                                               ; preds = %27
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.gsd_handle, ptr %34, i32 0, i32 10
  %36 = load i32, ptr %35, align 8, !tbaa !11
  %37 = icmp ne i32 %36, 2
  br i1 %37, label %38, label %48

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = call i32 @gsd_flush(ptr noundef %39)
  store i32 %40, ptr %8, align 4, !tbaa !19
  %41 = load i32, ptr %8, align 4, !tbaa !19
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %44

43:                                               ; preds = %38
  store ptr null, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %45

44:                                               ; preds = %38
  store i32 0, ptr %9, align 4
  br label %45

45:                                               ; preds = %44, %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %46 = load i32, ptr %9, align 4
  switch i32 %46, label %197 [
    i32 0, label %47
    i32 1, label %195
  ]

47:                                               ; preds = %45
  br label %48

48:                                               ; preds = %47, %33
  call void @llvm.lifetime.start.p0(i64 2, ptr %10) #3
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.gsd_handle, ptr %49, i32 0, i32 11
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = call zeroext i16 @gsd_name_id_map_find(ptr noundef %50, ptr noundef %51)
  store i16 %52, ptr %10, align 2, !tbaa !20
  %53 = load i16, ptr %10, align 2, !tbaa !20
  %54 = zext i16 %53 to i32
  %55 = icmp eq i32 %54, 65535
  br i1 %55, label %56, label %57

56:                                               ; preds = %48
  store ptr null, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %194

57:                                               ; preds = %48
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.gsd_handle, ptr %58, i32 0, i32 1
  %60 = getelementptr inbounds %struct.gsd_header, ptr %59, i32 0, i32 6
  %61 = load i32, ptr %60, align 4, !tbaa !22
  %62 = call i32 @gsd_make_version(i32 noundef 2, i32 noundef 0)
  %63 = icmp uge i32 %61, %62
  br i1 %63, label %64, label %117

64:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store i64 0, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.gsd_handle, ptr %65, i32 0, i32 2
  %67 = getelementptr inbounds %struct.gsd_index_buffer, ptr %66, i32 0, i32 1
  %68 = load i64, ptr %67, align 8, !tbaa !23
  %69 = sub i64 %68, 1
  store i64 %69, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #3
  %70 = load i64, ptr %6, align 8, !tbaa !9
  %71 = getelementptr inbounds %struct.gsd_index_entry, ptr %13, i32 0, i32 0
  store i64 %70, ptr %71, align 8, !tbaa !24
  %72 = load i16, ptr %10, align 2, !tbaa !20
  %73 = getelementptr inbounds %struct.gsd_index_entry, ptr %13, i32 0, i32 4
  store i16 %72, ptr %73, align 4, !tbaa !26
  br label %74

74:                                               ; preds = %112, %64
  %75 = load i64, ptr %11, align 8, !tbaa !9
  %76 = load i64, ptr %12, align 8, !tbaa !9
  %77 = icmp sle i64 %75, %76
  br i1 %77, label %78, label %113

78:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %79 = load i64, ptr %11, align 8, !tbaa !9
  %80 = load i64, ptr %12, align 8, !tbaa !9
  %81 = add nsw i64 %79, %80
  %82 = sdiv i64 %81, 2
  store i64 %82, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.gsd_handle, ptr %83, i32 0, i32 2
  %85 = getelementptr inbounds %struct.gsd_index_buffer, ptr %84, i32 0, i32 0
  %86 = load ptr, ptr %85, align 8, !tbaa !27
  %87 = load i64, ptr %14, align 8, !tbaa !9
  %88 = getelementptr inbounds %struct.gsd_index_entry, ptr %86, i64 %87
  %89 = call i32 @gsd_cmp_index_entry(ptr noundef %88, ptr noundef %13)
  store i32 %89, ptr %15, align 4, !tbaa !19
  %90 = load i32, ptr %15, align 4, !tbaa !19
  %91 = icmp eq i32 %90, -1
  br i1 %91, label %92, label %95

92:                                               ; preds = %78
  %93 = load i64, ptr %14, align 8, !tbaa !9
  %94 = add i64 %93, 1
  store i64 %94, ptr %11, align 8, !tbaa !9
  br label %109

95:                                               ; preds = %78
  %96 = load i32, ptr %15, align 4, !tbaa !19
  %97 = icmp eq i32 %96, 1
  br i1 %97, label %98, label %101

98:                                               ; preds = %95
  %99 = load i64, ptr %14, align 8, !tbaa !9
  %100 = sub i64 %99, 1
  store i64 %100, ptr %12, align 8, !tbaa !9
  br label %108

101:                                              ; preds = %95
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.gsd_handle, ptr %102, i32 0, i32 2
  %104 = getelementptr inbounds %struct.gsd_index_buffer, ptr %103, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8, !tbaa !27
  %106 = load i64, ptr %14, align 8, !tbaa !9
  %107 = getelementptr inbounds %struct.gsd_index_entry, ptr %105, i64 %106
  store ptr %107, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %110

108:                                              ; preds = %98
  br label %109

109:                                              ; preds = %108, %92
  store i32 0, ptr %9, align 4
  br label %110

110:                                              ; preds = %109, %101
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  %111 = load i32, ptr %9, align 4
  switch i32 %111, label %114 [
    i32 0, label %112
  ]

112:                                              ; preds = %110
  br label %74, !llvm.loop !28

113:                                              ; preds = %74
  store i32 0, ptr %9, align 4
  br label %114

114:                                              ; preds = %113, %110
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  %115 = load i32, ptr %9, align 4
  switch i32 %115, label %194 [
    i32 0, label %116
  ]

116:                                              ; preds = %114
  br label %193

117:                                              ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  store i64 0, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.gsd_handle, ptr %118, i32 0, i32 2
  %120 = getelementptr inbounds %struct.gsd_index_buffer, ptr %119, i32 0, i32 1
  %121 = load i64, ptr %120, align 8, !tbaa !23
  store i64 %121, ptr %17, align 8, !tbaa !9
  br label %122

122:                                              ; preds = %142, %117
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %123 = load i64, ptr %16, align 8, !tbaa !9
  %124 = load i64, ptr %17, align 8, !tbaa !9
  %125 = add i64 %123, %124
  %126 = udiv i64 %125, 2
  store i64 %126, ptr %18, align 8, !tbaa !9
  %127 = load i64, ptr %6, align 8, !tbaa !9
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.gsd_handle, ptr %128, i32 0, i32 2
  %130 = getelementptr inbounds %struct.gsd_index_buffer, ptr %129, i32 0, i32 0
  %131 = load ptr, ptr %130, align 8, !tbaa !27
  %132 = load i64, ptr %18, align 8, !tbaa !9
  %133 = getelementptr inbounds %struct.gsd_index_entry, ptr %131, i64 %132
  %134 = getelementptr inbounds %struct.gsd_index_entry, ptr %133, i32 0, i32 0
  %135 = load i64, ptr %134, align 8, !tbaa !24
  %136 = icmp ult i64 %127, %135
  br i1 %136, label %137, label %139

137:                                              ; preds = %122
  %138 = load i64, ptr %18, align 8, !tbaa !9
  store i64 %138, ptr %17, align 8, !tbaa !9
  br label %141

139:                                              ; preds = %122
  %140 = load i64, ptr %18, align 8, !tbaa !9
  store i64 %140, ptr %16, align 8, !tbaa !9
  br label %141

141:                                              ; preds = %139, %137
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  br label %142

142:                                              ; preds = %141
  %143 = load i64, ptr %17, align 8, !tbaa !9
  %144 = load i64, ptr %16, align 8, !tbaa !9
  %145 = sub i64 %143, %144
  %146 = icmp ugt i64 %145, 1
  br i1 %146, label %122, label %147, !llvm.loop !30

147:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %148 = load i64, ptr %16, align 8, !tbaa !9
  store i64 %148, ptr %19, align 8, !tbaa !9
  br label %149

149:                                              ; preds = %186, %147
  %150 = load i64, ptr %19, align 8, !tbaa !9
  %151 = icmp sge i64 %150, 0
  br i1 %151, label %152, label %163

152:                                              ; preds = %149
  %153 = load ptr, ptr %5, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.gsd_handle, ptr %153, i32 0, i32 2
  %155 = getelementptr inbounds %struct.gsd_index_buffer, ptr %154, i32 0, i32 0
  %156 = load ptr, ptr %155, align 8, !tbaa !27
  %157 = load i64, ptr %19, align 8, !tbaa !9
  %158 = getelementptr inbounds %struct.gsd_index_entry, ptr %156, i64 %157
  %159 = getelementptr inbounds %struct.gsd_index_entry, ptr %158, i32 0, i32 0
  %160 = load i64, ptr %159, align 8, !tbaa !24
  %161 = load i64, ptr %6, align 8, !tbaa !9
  %162 = icmp eq i64 %160, %161
  br label %163

163:                                              ; preds = %152, %149
  %164 = phi i1 [ false, %149 ], [ %162, %152 ]
  br i1 %164, label %165, label %189

165:                                              ; preds = %163
  %166 = load i16, ptr %10, align 2, !tbaa !20
  %167 = zext i16 %166 to i32
  %168 = load ptr, ptr %5, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.gsd_handle, ptr %168, i32 0, i32 2
  %170 = getelementptr inbounds %struct.gsd_index_buffer, ptr %169, i32 0, i32 0
  %171 = load ptr, ptr %170, align 8, !tbaa !27
  %172 = load i64, ptr %19, align 8, !tbaa !9
  %173 = getelementptr inbounds %struct.gsd_index_entry, ptr %171, i64 %172
  %174 = getelementptr inbounds %struct.gsd_index_entry, ptr %173, i32 0, i32 4
  %175 = load i16, ptr %174, align 4, !tbaa !26
  %176 = zext i16 %175 to i32
  %177 = icmp eq i32 %167, %176
  br i1 %177, label %178, label %185

178:                                              ; preds = %165
  %179 = load ptr, ptr %5, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.gsd_handle, ptr %179, i32 0, i32 2
  %181 = getelementptr inbounds %struct.gsd_index_buffer, ptr %180, i32 0, i32 0
  %182 = load ptr, ptr %181, align 8, !tbaa !27
  %183 = load i64, ptr %19, align 8, !tbaa !9
  %184 = getelementptr inbounds %struct.gsd_index_entry, ptr %182, i64 %183
  store ptr %184, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %190

185:                                              ; preds = %165
  br label %186

186:                                              ; preds = %185
  %187 = load i64, ptr %19, align 8, !tbaa !9
  %188 = add nsw i64 %187, -1
  store i64 %188, ptr %19, align 8, !tbaa !9
  br label %149, !llvm.loop !31

189:                                              ; preds = %163
  store i32 0, ptr %9, align 4
  br label %190

190:                                              ; preds = %189, %178
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  %191 = load i32, ptr %9, align 4
  switch i32 %191, label %194 [
    i32 0, label %192
  ]

192:                                              ; preds = %190
  br label %193

193:                                              ; preds = %192, %116
  store ptr null, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %194

194:                                              ; preds = %193, %190, %114, %56
  call void @llvm.lifetime.end.p0(i64 2, ptr %10) #3
  br label %195

195:                                              ; preds = %194, %45, %32, %26, %22
  %196 = load ptr, ptr %4, align 8
  ret ptr %196

197:                                              ; preds = %45
  unreachable
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @gsd_cmp_index_entry(ptr noundef, ptr noundef) #2

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 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 = !{!"long", !7, i64 0}
!11 = !{!12, !13, i64 488}
!12 = !{!"gsd_handle", !13, i64 0, !14, i64 8, !15, i64 264, !15, i64 304, !15, i64 344, !16, i64 384, !17, i64 408, !17, i64 440, !10, i64 472, !10, i64 480, !13, i64 488, !18, i64 496, !10, i64 512, !10, i64 520, !10, i64 528}
!13 = !{!"int", !7, i64 0}
!14 = !{!"gsd_header", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !13, i64 40, !13, i64 44, !7, i64 48, !7, i64 112, !7, i64 176}
!15 = !{!"gsd_index_buffer", !6, i64 0, !10, i64 8, !10, i64 16, !6, i64 24, !10, i64 32}
!16 = !{!"gsd_byte_buffer", !6, i64 0, !10, i64 8, !10, i64 16}
!17 = !{!"gsd_name_buffer", !16, i64 0, !10, i64 24}
!18 = !{!"gsd_name_id_map", !6, i64 0, !10, i64 8}
!19 = !{!13, !13, i64 0}
!20 = !{!21, !21, i64 0}
!21 = !{!"short", !7, i64 0}
!22 = !{!12, !13, i64 52}
!23 = !{!12, !10, i64 272}
!24 = !{!25, !10, i64 0}
!25 = !{!"gsd_index_entry", !10, i64 0, !10, i64 8, !10, i64 16, !13, i64 24, !21, i64 28, !7, i64 30, !7, i64 31}
!26 = !{!25, !21, i64 28}
!27 = !{!12, !6, i64 264}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = distinct !{!30, !29}
!31 = distinct !{!31, !29}


; 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.gsd_index_entry = type { i64, i64, i64, i32, i16, i8, i8 }

; Function Attrs: nounwind uwtable
declare dso_local i32 @gsd_make_version(i32 noundef, i32 noundef) local_unnamed_addr #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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @gsd_flush(ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @gsd_name_id_map_find(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @gsd_get_nframes(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local ptr @gsd_find_chunk(ptr noundef %0, i64 noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = alloca %struct.gsd_index_entry, align 8
  %5 = icmp eq ptr %0, null
  %6 = icmp eq ptr %2, null
  %or.cond = or i1 %5, %6
  br i1 %or.cond, label %.critedge, label %7

7:                                                ; preds = %3
  %8 = tail call i64 @gsd_get_nframes(ptr noundef nonnull %0)
  %.not = icmp ugt i64 %8, %1
  br i1 %.not, label %9, label %.critedge

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %0, i64 488
  %11 = load i32, ptr %10, align 8, !tbaa !5
  %.not73 = icmp eq i32 %11, 2
  br i1 %.not73, label %14, label %12

12:                                               ; preds = %9
  %13 = tail call i32 @gsd_flush(ptr noundef nonnull %0)
  %.not74.not = icmp eq i32 %13, 0
  br i1 %.not74.not, label %14, label %.critedge

14:                                               ; preds = %12, %9
  %15 = getelementptr inbounds i8, ptr %0, i64 496
  %16 = tail call zeroext i16 @gsd_name_id_map_find(ptr noundef nonnull %15, ptr noundef nonnull %2)
  %17 = icmp eq i16 %16, -1
  br i1 %17, label %.critedge, label %18

18:                                               ; preds = %14
  %19 = getelementptr inbounds i8, ptr %0, i64 52
  %20 = load i32, ptr %19, align 4, !tbaa !17
  %21 = tail call i32 @gsd_make_version(i32 noundef 2, i32 noundef 0)
  %.not75 = icmp ult i32 %20, %21
  %22 = getelementptr inbounds i8, ptr %0, i64 264
  %23 = getelementptr inbounds i8, ptr %0, i64 272
  %24 = load i64, ptr %23, align 8, !tbaa !18
  br i1 %.not75, label %41, label %25

25:                                               ; preds = %18
  %26 = add i64 %24, -1
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #3
  store i64 %1, ptr %4, align 8, !tbaa !19
  %27 = getelementptr inbounds i8, ptr %4, i64 28
  store i16 %16, ptr %27, align 4, !tbaa !22
  %.not7686 = icmp slt i64 %26, 0
  br i1 %.not7686, label %.thread81, label %.lr.ph

.thread81:                                        ; preds = %37, %25
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #3
  br label %.critedge

.lr.ph:                                           ; preds = %25, %37
  %.06288 = phi i64 [ %.264, %37 ], [ 0, %25 ]
  %.06587 = phi i64 [ %.267, %37 ], [ %26, %25 ]
  %28 = add nuw nsw i64 %.06288, %.06587
  %29 = lshr i64 %28, 1
  %30 = load ptr, ptr %22, align 8, !tbaa !23
  %31 = getelementptr inbounds %struct.gsd_index_entry, ptr %30, i64 %29
  %32 = call i32 @gsd_cmp_index_entry(ptr noundef %31, ptr noundef nonnull %4)
  switch i32 %32, label %38 [
    i32 -1, label %33
    i32 1, label %35
  ]

33:                                               ; preds = %.lr.ph
  %34 = add nuw i64 %29, 1
  br label %37

35:                                               ; preds = %.lr.ph
  %36 = add nsw i64 %29, -1
  br label %37

37:                                               ; preds = %33, %35
  %.267 = phi i64 [ %.06587, %33 ], [ %36, %35 ]
  %.264 = phi i64 [ %34, %33 ], [ %.06288, %35 ]
  %.not76 = icmp sgt i64 %.264, %.267
  br i1 %.not76, label %.thread81, label %.lr.ph, !llvm.loop !24

38:                                               ; preds = %.lr.ph
  %39 = load ptr, ptr %22, align 8, !tbaa !23
  %40 = getelementptr inbounds %struct.gsd_index_entry, ptr %39, i64 %29
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #3
  br label %.critedge

41:                                               ; preds = %18
  %42 = load ptr, ptr %22, align 8, !tbaa !23
  br label %43

43:                                               ; preds = %43, %41
  %.056 = phi i64 [ 0, %41 ], [ %.056., %43 ]
  %.054 = phi i64 [ %24, %41 ], [ %..054, %43 ]
  %44 = add i64 %.054, %.056
  %45 = lshr i64 %44, 1
  %46 = getelementptr inbounds %struct.gsd_index_entry, ptr %42, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !19
  %48 = icmp ugt i64 %47, %1
  %.056. = select i1 %48, i64 %.056, i64 %45
  %..054 = select i1 %48, i64 %45, i64 %.054
  %49 = sub i64 %..054, %.056.
  %50 = icmp ugt i64 %49, 1
  br i1 %50, label %43, label %.lr.ph90, !llvm.loop !26

51:                                               ; preds = %57
  %52 = add nsw i64 %.089, -1
  %53 = icmp sgt i64 %.089, 0
  br i1 %53, label %.lr.ph90, label %.critedge, !llvm.loop !27

.lr.ph90:                                         ; preds = %43, %51
  %.089 = phi i64 [ %52, %51 ], [ %.056., %43 ]
  %54 = getelementptr inbounds %struct.gsd_index_entry, ptr %42, i64 %.089
  %55 = load i64, ptr %54, align 8, !tbaa !19
  %56 = icmp eq i64 %55, %1
  br i1 %56, label %57, label %.critedge

57:                                               ; preds = %.lr.ph90
  %58 = getelementptr inbounds i8, ptr %54, i64 28
  %59 = load i16, ptr %58, align 4, !tbaa !22
  %60 = icmp eq i16 %16, %59
  br i1 %60, label %.critedge, label %51

.critedge:                                        ; preds = %57, %51, %.lr.ph90, %.thread81, %38, %12, %14, %7, %3
  %.7 = phi ptr [ null, %12 ], [ null, %3 ], [ null, %7 ], [ %40, %38 ], [ null, %14 ], [ null, %.thread81 ], [ %54, %57 ], [ null, %51 ], [ null, %.lr.ph90 ]
  ret ptr %.7
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @gsd_cmp_index_entry(ptr noundef, ptr noundef) local_unnamed_addr #2

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 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, !7, i64 488}
!6 = !{!"gsd_handle", !7, i64 0, !10, i64 8, !12, i64 264, !12, i64 304, !12, i64 344, !14, i64 384, !15, i64 408, !15, i64 440, !11, i64 472, !11, i64 480, !7, i64 488, !16, i64 496, !11, i64 512, !11, i64 520, !11, i64 528}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"gsd_header", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !7, i64 40, !7, i64 44, !8, i64 48, !8, i64 112, !8, i64 176}
!11 = !{!"long", !8, i64 0}
!12 = !{!"gsd_index_buffer", !13, i64 0, !11, i64 8, !11, i64 16, !13, i64 24, !11, i64 32}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!"gsd_byte_buffer", !13, i64 0, !11, i64 8, !11, i64 16}
!15 = !{!"gsd_name_buffer", !14, i64 0, !11, i64 24}
!16 = !{!"gsd_name_id_map", !13, i64 0, !11, i64 8}
!17 = !{!6, !7, i64 52}
!18 = !{!6, !11, i64 272}
!19 = !{!20, !11, i64 0}
!20 = !{!"gsd_index_entry", !11, i64 0, !11, i64 8, !11, i64 16, !7, i64 24, !21, i64 28, !8, i64 30, !8, i64 31}
!21 = !{!"short", !8, i64 0}
!22 = !{!20, !21, i64 28}
!23 = !{!6, !13, i64 264}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}
!27 = distinct !{!27, !25}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass