; LLVM IR from aagdev/mlimgsynth :: src (main_tstore_util)

; 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.StrSlice = type { ptr, i64 }
%struct.TStoreUtil = type { %struct.TensorStore, %struct.Stream, %struct.Stream, %struct.StringStore, %struct.anon }
%struct.TensorStore = type { ptr, ptr, ptr, ptr, ptr }
%struct.Stream = type { ptr, ptr, ptr, ptr, ptr, %struct.StreamInt, i64, i32 }
%struct.StreamInt = type { [3 x ptr] }
%struct.StringStore = type { ptr, ptr, %struct.AllocatorArena }
%struct.AllocatorArena = type { i64, ptr, ptr }
%struct.anon = type { ptr, ptr, ptr, ptr, ptr, i32 }
%struct.TSTensorEntry = type { i32, i32, i32, [4 x i32], i64, i64, ptr, ptr }

@.str.17 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [32 x i8], align 1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @log_level_check(i32 noundef) #1

declare void @log_logf(i32 noundef, ptr noundef, ...) #2

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

declare double @timing_time(...) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @dynbuf_count(ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden { ptr, i64 } @strsto_get(ptr noundef, i32 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @stream_seek(ptr noundef, i64 noundef, i32 noundef) #1

declare i32 @stream_read_prep(ptr noundef, i64 noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @stream_buffer_get_(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @tsu_checksum(ptr noundef %0) #3 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca double, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %struct.StrSlice, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %19 = call double (...) @timing_time()
  store double %19, ptr %5, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store i64 0, ptr %6, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store ptr null, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store ptr null, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.TStoreUtil, ptr %20, i32 0, i32 0
  %22 = getelementptr inbounds %struct.TensorStore, ptr %21, i32 0, i32 0
  %23 = load ptr, ptr %22, align 8, !tbaa !15
  %24 = call i32 @dynbuf_count(ptr noundef %23)
  store i32 %24, ptr %11, align 4, !tbaa !9
  br label %25

25:                                               ; preds = %165, %1
  %26 = load i32, ptr %10, align 4, !tbaa !9
  %27 = load i32, ptr %11, align 4, !tbaa !9
  %28 = icmp ult i32 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  store i32 2, ptr %12, align 4
  br label %168

30:                                               ; preds = %25
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.TStoreUtil, ptr %31, i32 0, i32 0
  %33 = getelementptr inbounds %struct.TensorStore, ptr %32, i32 0, i32 0
  %34 = load ptr, ptr %33, align 8, !tbaa !15
  %35 = load i32, ptr %10, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = getelementptr inbounds %struct.TSTensorEntry, ptr %34, i64 %36
  store ptr %37, ptr %8, align 8, !tbaa !5
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.TStoreUtil, ptr %38, i32 0, i32 3
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.TSTensorEntry, ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 8, !tbaa !23
  %43 = call { ptr, i64 } @strsto_get(ptr noundef %39, i32 noundef %42)
  %44 = getelementptr inbounds { ptr, i64 }, ptr %13, i32 0, i32 0
  %45 = extractvalue { ptr, i64 } %43, 0
  store ptr %45, ptr %44, align 8
  %46 = getelementptr inbounds { ptr, i64 }, ptr %13, i32 0, i32 1
  %47 = extractvalue { ptr, i64 } %43, 1
  store i64 %47, ptr %46, align 8
  %48 = getelementptr inbounds %struct.StrSlice, ptr %13, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !25
  store ptr %49, ptr %9, align 8, !tbaa !5
  br label %50

50:                                               ; preds = %30
  %51 = call zeroext i1 @log_level_check(i32 noundef 60)
  br i1 %51, label %52, label %60

52:                                               ; preds = %50
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.TSTensorEntry, ptr %54, i32 0, i32 4
  %56 = load i64, ptr %55, align 8, !tbaa !27
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.TSTensorEntry, ptr %57, i32 0, i32 5
  %59 = load i64, ptr %58, align 8, !tbaa !28
  call void (i32, ptr, ...) @log_logf(i32 noundef 60, ptr noundef @.str.17, ptr noundef %53, i64 noundef %56, i64 noundef %59)
  br label %60

60:                                               ; preds = %52, %50
  br label %61

61:                                               ; preds = %60
  br label %62

62:                                               ; preds = %61
  br label %63

63:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.TSTensorEntry, ptr %64, i32 0, i32 6
  %66 = load ptr, ptr %65, align 8, !tbaa !29
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.TSTensorEntry, ptr %67, i32 0, i32 4
  %69 = load i64, ptr %68, align 8, !tbaa !27
  %70 = call i32 @stream_seek(ptr noundef %66, i64 noundef %69, i32 noundef 0)
  store i32 %70, ptr %14, align 4, !tbaa !9
  %71 = load i32, ptr %14, align 4, !tbaa !9
  %72 = icmp slt i32 %71, 0
  br i1 %72, label %73, label %90

73:                                               ; preds = %63
  br label %74

74:                                               ; preds = %73
  br label %75

75:                                               ; preds = %74
  %76 = call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %76, label %77, label %81

77:                                               ; preds = %75
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.TSTensorEntry, ptr %78, i32 0, i32 4
  %80 = load i64, ptr %79, align 8, !tbaa !27
  call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef @.str.18, i64 noundef %80)
  br label %81

81:                                               ; preds = %77, %75
  br label %82

82:                                               ; preds = %81
  br label %83

83:                                               ; preds = %82
  br label %84

84:                                               ; preds = %83
  %85 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %85, ptr %4, align 4, !tbaa !9
  store i32 15, ptr %12, align 4
  br label %91

86:                                               ; No predecessors!
  br label %87

87:                                               ; preds = %86
  br label %88

88:                                               ; preds = %87
  br label %89

89:                                               ; preds = %88
  br label %90

90:                                               ; preds = %89, %63
  store i32 0, ptr %12, align 4
  br label %91

91:                                               ; preds = %90, %84
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  %92 = load i32, ptr %12, align 4
  switch i32 %92, label %168 [
    i32 0, label %93
  ]

93:                                               ; preds = %91
  br label %94

94:                                               ; preds = %93
  br label %95

95:                                               ; preds = %94
  br label %96

96:                                               ; preds = %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %97 = load ptr, ptr %8, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.TSTensorEntry, ptr %97, i32 0, i32 6
  %99 = load ptr, ptr %98, align 8, !tbaa !29
  %100 = load ptr, ptr %8, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.TSTensorEntry, ptr %100, i32 0, i32 5
  %102 = load i64, ptr %101, align 8, !tbaa !28
  %103 = call i32 @stream_read_prep(ptr noundef %99, i64 noundef %102)
  store i32 %103, ptr %15, align 4, !tbaa !9
  %104 = load i32, ptr %15, align 4, !tbaa !9
  %105 = icmp slt i32 %104, 0
  br i1 %105, label %106, label %120

106:                                              ; preds = %96
  br label %107

107:                                              ; preds = %106
  br label %108

108:                                              ; preds = %107
  %109 = call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %109, label %110, label %111

110:                                              ; preds = %108
  call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef @.str.19)
  br label %111

111:                                              ; preds = %110, %108
  br label %112

112:                                              ; preds = %111
  br label %113

113:                                              ; preds = %112
  br label %114

114:                                              ; preds = %113
  %115 = load i32, ptr %15, align 4, !tbaa !9
  store i32 %115, ptr %4, align 4, !tbaa !9
  store i32 15, ptr %12, align 4
  br label %121

116:                                              ; No predecessors!
  br label %117

117:                                              ; preds = %116
  br label %118

118:                                              ; preds = %117
  br label %119

119:                                              ; preds = %118
  br label %120

120:                                              ; preds = %119, %96
  store i32 0, ptr %12, align 4
  br label %121

121:                                              ; preds = %120, %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  %122 = load i32, ptr %12, align 4
  switch i32 %122, label %168 [
    i32 0, label %123
  ]

123:                                              ; preds = %121
  br label %124

124:                                              ; preds = %123
  br label %125

125:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %126 = load ptr, ptr %8, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.TSTensorEntry, ptr %126, i32 0, i32 6
  %128 = load ptr, ptr %127, align 8, !tbaa !29
  %129 = call ptr @stream_buffer_get_(ptr noundef %128, ptr noundef null)
  store ptr %129, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %130 = load ptr, ptr %17, align 8, !tbaa !5
  %131 = load ptr, ptr %8, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.TSTensorEntry, ptr %131, i32 0, i32 5
  %133 = load i64, ptr %132, align 8, !tbaa !28
  %134 = udiv i64 %133, 4
  %135 = getelementptr inbounds i32, ptr %130, i64 %134
  store ptr %135, ptr %18, align 8, !tbaa !5
  br label %136

136:                                              ; preds = %145, %125
  %137 = load ptr, ptr %17, align 8, !tbaa !5
  %138 = load ptr, ptr %18, align 8, !tbaa !5
  %139 = icmp ult ptr %137, %138
  br i1 %139, label %140, label %148

140:                                              ; preds = %136
  %141 = load ptr, ptr %17, align 8, !tbaa !5
  %142 = load i32, ptr %141, align 4, !tbaa !9
  %143 = load i32, ptr %16, align 4, !tbaa !9
  %144 = add i32 %143, %142
  store i32 %144, ptr %16, align 4, !tbaa !9
  br label %145

145:                                              ; preds = %140
  %146 = load ptr, ptr %17, align 8, !tbaa !5
  %147 = getelementptr inbounds i32, ptr %146, i32 1
  store ptr %147, ptr %17, align 8, !tbaa !5
  br label %136, !llvm.loop !30

148:                                              ; preds = %136
  %149 = load i32, ptr %16, align 4, !tbaa !9
  %150 = load i32, ptr %7, align 4, !tbaa !9
  %151 = add i32 %150, %149
  store i32 %151, ptr %7, align 4, !tbaa !9
  %152 = load ptr, ptr %8, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.TSTensorEntry, ptr %152, i32 0, i32 5
  %154 = load i64, ptr %153, align 8, !tbaa !28
  %155 = load i64, ptr %6, align 8, !tbaa !13
  %156 = add i64 %155, %154
  store i64 %156, ptr %6, align 8, !tbaa !13
  %157 = load ptr, ptr %3, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.TStoreUtil, ptr %157, i32 0, i32 2
  %159 = load ptr, ptr %9, align 8, !tbaa !5
  %160 = load i32, ptr %16, align 4, !tbaa !9
  %161 = call i32 (ptr, ptr, ...) @stream_printf(ptr noundef %158, ptr noundef @.str.22, ptr noundef %159, i32 noundef %160)
  %162 = load ptr, ptr %3, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.TStoreUtil, ptr %162, i32 0, i32 2
  %164 = call i32 @stream_flush(ptr noundef %163)
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %165

165:                                              ; preds = %148
  %166 = load i32, ptr %10, align 4, !tbaa !9
  %167 = add i32 %166, 1
  store i32 %167, ptr %10, align 4, !tbaa !9
  br label %25, !llvm.loop !32

168:                                              ; preds = %121, %91, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  %169 = load i32, ptr %12, align 4
  switch i32 %169, label %218 [
    i32 2, label %170
    i32 15, label %196
  ]

170:                                              ; preds = %168
  %171 = load ptr, ptr %3, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.TStoreUtil, ptr %171, i32 0, i32 2
  %173 = load i32, ptr %7, align 4, !tbaa !9
  %174 = call i32 (ptr, ptr, ...) @stream_printf(ptr noundef %172, ptr noundef @.str.23, i32 noundef %173)
  %175 = load ptr, ptr %3, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.TStoreUtil, ptr %175, i32 0, i32 2
  %177 = call i32 @stream_flush(ptr noundef %176)
  %178 = call double (...) @timing_time()
  %179 = load double, ptr %5, align 8, !tbaa !11
  %180 = fsub double %178, %179
  store double %180, ptr %5, align 8, !tbaa !11
  br label %181

181:                                              ; preds = %170
  %182 = call zeroext i1 @log_level_check(i32 noundef 30)
  br i1 %182, label %183, label %193

183:                                              ; preds = %181
  %184 = load ptr, ptr %3, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.TStoreUtil, ptr %184, i32 0, i32 0
  %186 = getelementptr inbounds %struct.TensorStore, ptr %185, i32 0, i32 0
  %187 = load ptr, ptr %186, align 8, !tbaa !15
  %188 = call i32 @dynbuf_count(ptr noundef %187)
  %189 = load double, ptr %5, align 8, !tbaa !11
  %190 = load i64, ptr %6, align 8, !tbaa !13
  %191 = uitofp i64 %190 to double
  %192 = fmul double %191, 0x3E10000000000000
  call void (i32, ptr, ...) @log_logf(i32 noundef 30, ptr noundef @.str.24, i32 noundef %188, double noundef %189, double noundef %192)
  br label %193

193:                                              ; preds = %183, %181
  br label %194

194:                                              ; preds = %193
  br label %195

195:                                              ; preds = %194
  br label %196

196:                                              ; preds = %195, %168
  %197 = load i32, ptr %4, align 4, !tbaa !9
  %198 = icmp slt i32 %197, 0
  br i1 %198, label %199, label %216

199:                                              ; preds = %196
  %200 = load ptr, ptr %8, align 8, !tbaa !5
  %201 = icmp ne ptr %200, null
  br i1 %201, label %202, label %216

202:                                              ; preds = %199
  br label %203

203:                                              ; preds = %202
  %204 = call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %204, label %205, label %213

205:                                              ; preds = %203
  %206 = load ptr, ptr %9, align 8, !tbaa !5
  %207 = load ptr, ptr %8, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.TSTensorEntry, ptr %207, i32 0, i32 4
  %209 = load i64, ptr %208, align 8, !tbaa !27
  %210 = load ptr, ptr %8, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.TSTensorEntry, ptr %210, i32 0, i32 5
  %212 = load i64, ptr %211, align 8, !tbaa !28
  call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef @.str.21, ptr noundef %206, i64 noundef %209, i64 noundef %212)
  br label %213

213:                                              ; preds = %205, %203
  br label %214

214:                                              ; preds = %213
  br label %215

215:                                              ; preds = %214
  br label %216

216:                                              ; preds = %215, %199, %196
  %217 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %217, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %218

218:                                              ; preds = %216, %168
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %219 = load i32, ptr %2, align 4
  ret i32 %219
}

declare i32 @stream_printf(ptr noundef, ptr noundef, ...) #2

declare i32 @stream_flush(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 = { 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, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!16, !6, i64 0}
!16 = !{!"TStoreUtil", !17, i64 0, !18, i64 40, !18, i64 120, !20, i64 200, !22, i64 240}
!17 = !{!"TensorStore", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!18 = !{!"Stream", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !19, i64 40, !14, i64 64, !10, i64 72}
!19 = !{!"StreamInt", !7, i64 0}
!20 = !{!"StringStore", !6, i64 0, !6, i64 8, !21, i64 16}
!21 = !{!"AllocatorArena", !14, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !10, i64 40}
!23 = !{!24, !10, i64 0}
!24 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !7, i64 12, !14, i64 32, !14, i64 40, !6, i64 48, !6, i64 56}
!25 = !{!26, !6, i64 0}
!26 = !{!"StrSlice", !6, i64 0, !14, i64 8}
!27 = !{!24, !14, i64 32}
!28 = !{!24, !14, i64 40}
!29 = !{!24, !6, i64 48}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = distinct !{!32, !31}


; 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.TSTensorEntry = type { i32, i32, i32, [4 x i32], i64, i64, ptr, ptr }

@.str.17 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @log_level_check(i32 noundef) local_unnamed_addr #0

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

declare double @timing_time(...) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @dynbuf_count(ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden { ptr, i64 } @strsto_get(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @stream_seek(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @stream_buffer_get_(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 -2147483648, 2) i32 @tsu_checksum(ptr noundef %0) local_unnamed_addr #2 {
  %2 = tail call double (...) @timing_time() #4
  %3 = load ptr, ptr %0, align 8, !tbaa !5
  %4 = tail call i32 @dynbuf_count(ptr noundef %3)
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %._crit_edge108, label %.lr.ph107

.lr.ph107:                                        ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 200
  %6 = getelementptr inbounds i8, ptr %0, i64 120
  %wide.trip.count = zext i32 %4 to i64
  br label %7

7:                                                ; preds = %.lr.ph107, %._crit_edge
  %indvars.iv = phi i64 [ 0, %.lr.ph107 ], [ %indvars.iv.next, %._crit_edge ]
  %.057105 = phi i64 [ 0, %.lr.ph107 ], [ %65, %._crit_edge ]
  %.058104 = phi i32 [ 0, %.lr.ph107 ], [ %64, %._crit_edge ]
  %8 = load ptr, ptr %0, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.TSTensorEntry, ptr %8, i64 %indvars.iv
  %10 = load i32, ptr %9, align 8, !tbaa !18
  %11 = tail call { ptr, i64 } @strsto_get(ptr noundef nonnull %5, i32 noundef %10)
  %12 = extractvalue { ptr, i64 } %11, 0
  %13 = tail call zeroext i1 @log_level_check(i32 noundef 60)
  br i1 %13, label %14, label %19

14:                                               ; preds = %7
  %15 = getelementptr inbounds i8, ptr %9, i64 32
  %16 = load i64, ptr %15, align 8, !tbaa !20
  %17 = getelementptr inbounds i8, ptr %9, i64 40
  %18 = load i64, ptr %17, align 8, !tbaa !21
  tail call void (i32, ptr, ...) @log_logf(i32 noundef 60, ptr noundef nonnull @.str.17, ptr noundef %12, i64 noundef %16, i64 noundef %18) #4
  br label %19

19:                                               ; preds = %7, %14
  %20 = getelementptr inbounds i8, ptr %9, i64 48
  %21 = load ptr, ptr %20, align 8, !tbaa !22
  %22 = getelementptr inbounds i8, ptr %9, i64 32
  %23 = load i64, ptr %22, align 8, !tbaa !20
  %24 = tail call i32 @stream_seek(ptr noundef %21, i64 noundef %23, i32 noundef 0)
  %25 = icmp sgt i32 %24, -1
  br i1 %25, label %31, label %26

26:                                               ; preds = %19
  %27 = tail call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %27, label %28, label %.thread75

28:                                               ; preds = %26
  %29 = getelementptr inbounds i8, ptr %9, i64 32
  %30 = load i64, ptr %29, align 8, !tbaa !20
  tail call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef nonnull @.str.18, i64 noundef %30) #4
  br label %.thread75

31:                                               ; preds = %19
  %32 = load ptr, ptr %20, align 8, !tbaa !22
  %33 = getelementptr inbounds i8, ptr %9, i64 40
  %34 = load i64, ptr %33, align 8, !tbaa !21
  %35 = tail call i32 @stream_read_prep(ptr noundef %32, i64 noundef %34) #4
  %36 = icmp sgt i32 %35, -1
  br i1 %36, label %40, label %37

37:                                               ; preds = %31
  %38 = tail call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %38, label %39, label %.thread75

39:                                               ; preds = %37
  tail call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef nonnull @.str.19) #4
  br label %.thread75

40:                                               ; preds = %31
  %41 = load ptr, ptr %20, align 8, !tbaa !22
  %42 = tail call ptr @stream_buffer_get_(ptr noundef %41, ptr noundef null)
  %43 = load i64, ptr %33, align 8, !tbaa !21
  %44 = lshr i64 %43, 2
  %45 = getelementptr inbounds i32, ptr %42, i64 %44
  %.idx = and i64 %43, -4
  %46 = icmp sgt i64 %.idx, 0
  br i1 %46, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %40
  %47 = ptrtoint ptr %42 to i64
  %48 = add i64 %.idx, %47
  %49 = add i64 %47, 4
  %umax = tail call i64 @llvm.umax.i64(i64 %48, i64 %49)
  %50 = xor i64 %47, -1
  %51 = add i64 %umax, %50
  %52 = lshr i64 %51, 2
  %53 = add nuw nsw i64 %52, 1
  %min.iters.check = icmp ult i64 %51, 28
  br i1 %min.iters.check, label %.lr.ph.preheader165, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %53, 9223372036854775800
  %54 = shl i64 %n.vec, 2
  %ind.end = getelementptr i8, ptr %42, i64 %54
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %56, %vector.body ]
  %vec.phi162 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %57, %vector.body ]
  %offset.idx = shl i64 %index, 2
  %next.gep = getelementptr i8, ptr %42, i64 %offset.idx
  %55 = getelementptr i8, ptr %next.gep, i64 16
  %wide.load = load <4 x i32>, ptr %next.gep, align 4, !tbaa !23
  %wide.load164 = load <4 x i32>, ptr %55, align 4, !tbaa !23
  %56 = add <4 x i32> %wide.load, %vec.phi
  %57 = add <4 x i32> %wide.load164, %vec.phi162
  %index.next = add nuw i64 %index, 8
  %58 = icmp eq i64 %index.next, %n.vec
  br i1 %58, label %middle.block, label %vector.body, !llvm.loop !24

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %57, %56
  %59 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %53, %n.vec
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader165

.lr.ph.preheader165:                              ; preds = %middle.block, %.lr.ph.preheader
  %.054101.ph = phi ptr [ %42, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  %.055100.ph = phi i32 [ 0, %.lr.ph.preheader ], [ %59, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader165, %.lr.ph
  %.054101 = phi ptr [ %62, %.lr.ph ], [ %.054101.ph, %.lr.ph.preheader165 ]
  %.055100 = phi i32 [ %61, %.lr.ph ], [ %.055100.ph, %.lr.ph.preheader165 ]
  %60 = load i32, ptr %.054101, align 4, !tbaa !23
  %61 = add i32 %60, %.055100
  %62 = getelementptr inbounds i8, ptr %.054101, i64 4
  %63 = icmp ult ptr %62, %45
  br i1 %63, label %.lr.ph, label %._crit_edge, !llvm.loop !28

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %40
  %.055.lcssa = phi i32 [ 0, %40 ], [ %59, %middle.block ], [ %61, %.lr.ph ]
  %64 = add i32 %.055.lcssa, %.058104
  %65 = add i64 %43, %.057105
  %66 = tail call i32 (ptr, ptr, ...) @stream_printf(ptr noundef nonnull %6, ptr noundef nonnull @.str.22, ptr noundef %12, i32 noundef %.055.lcssa) #4
  %67 = tail call i32 @stream_flush(ptr noundef nonnull %6) #4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge108.loopexit, label %7, !llvm.loop !29

._crit_edge108.loopexit:                          ; preds = %._crit_edge
  %68 = uitofp i64 %65 to double
  %69 = fmul double %68, 0x3E10000000000000
  br label %._crit_edge108

._crit_edge108:                                   ; preds = %._crit_edge108.loopexit, %1
  %.058.lcssa = phi i32 [ 0, %1 ], [ %64, %._crit_edge108.loopexit ]
  %.057.lcssa = phi double [ 0.000000e+00, %1 ], [ %69, %._crit_edge108.loopexit ]
  %70 = getelementptr inbounds i8, ptr %0, i64 120
  %71 = tail call i32 (ptr, ptr, ...) @stream_printf(ptr noundef nonnull %70, ptr noundef nonnull @.str.23, i32 noundef %.058.lcssa) #4
  %72 = tail call i32 @stream_flush(ptr noundef nonnull %70) #4
  %73 = tail call double (...) @timing_time() #4
  %74 = tail call zeroext i1 @log_level_check(i32 noundef 30)
  br i1 %74, label %75, label %.thread75.thread

75:                                               ; preds = %._crit_edge108
  %76 = fsub double %73, %2
  %77 = load ptr, ptr %0, align 8, !tbaa !5
  %78 = tail call i32 @dynbuf_count(ptr noundef %77)
  tail call void (i32, ptr, ...) @log_logf(i32 noundef 30, ptr noundef nonnull @.str.24, i32 noundef %78, double noundef %76, double noundef %.057.lcssa) #4
  br label %.thread75.thread

.thread75:                                        ; preds = %28, %26, %39, %37
  %.382 = phi i32 [ %24, %28 ], [ %24, %26 ], [ %35, %39 ], [ %35, %37 ]
  %79 = tail call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %79, label %80, label %.thread75.thread

80:                                               ; preds = %.thread75
  %81 = getelementptr inbounds i8, ptr %9, i64 32
  %82 = load i64, ptr %81, align 8, !tbaa !20
  %83 = getelementptr inbounds i8, ptr %9, i64 40
  %84 = load i64, ptr %83, align 8, !tbaa !21
  tail call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef nonnull @.str.21, ptr noundef %12, i64 noundef %82, i64 noundef %84) #4
  br label %.thread75.thread

.thread75.thread:                                 ; preds = %75, %._crit_edge108, %80, %.thread75
  %.382131 = phi i32 [ %.382, %80 ], [ %.382, %.thread75 ], [ 1, %._crit_edge108 ], [ 1, %75 ]
  ret i32 %.382131
}

declare i32 @stream_printf(ptr noundef, ptr noundef, ...) local_unnamed_addr #1

declare i32 @stream_flush(ptr noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !8, i64 0}
!6 = !{!"TStoreUtil", !7, i64 0, !11, i64 40, !11, i64 120, !15, i64 200, !17, i64 240}
!7 = !{!"TensorStore", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"Stream", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !12, i64 40, !13, i64 64, !14, i64 72}
!12 = !{!"StreamInt", !9, i64 0}
!13 = !{!"long", !9, i64 0}
!14 = !{!"int", !9, i64 0}
!15 = !{!"StringStore", !8, i64 0, !8, i64 8, !16, i64 16}
!16 = !{!"AllocatorArena", !13, i64 0, !8, i64 8, !8, i64 16}
!17 = !{!"", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !14, i64 40}
!18 = !{!19, !14, i64 0}
!19 = !{!"", !14, i64 0, !14, i64 4, !14, i64 8, !9, i64 12, !13, i64 32, !13, i64 40, !8, i64 48, !8, i64 56}
!20 = !{!19, !13, i64 32}
!21 = !{!19, !13, i64 40}
!22 = !{!19, !8, i64 48}
!23 = !{!14, !14, i64 0}
!24 = distinct !{!24, !25, !26, !27}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!"llvm.loop.isvectorized", i32 1}
!27 = !{!"llvm.loop.unroll.runtime.disable"}
!28 = distinct !{!28, !25, !27, !26}
!29 = distinct !{!29, !25}


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