; 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.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 }

@help_string = external dso_local constant [741 x i8], align 16
@.str.29 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @tsu_free(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @tsu_argv_load(ptr noundef, i32 noundef, ptr 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: inlinehint nounwind uwtable
declare hidden zeroext i1 @log_level_check(i32 noundef) #2

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

; 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 @tsu_setup(ptr noundef) #0

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #4

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %struct.TStoreUtil, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 288, ptr %8) #6
  call void @llvm.memset.p0.i64(ptr align 8 %8, i8 0, i64 288, i1 false)
  br label %17

17:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %19 = load ptr, ptr %5, align 8, !tbaa !9
  %20 = call i32 @tsu_argv_load(ptr noundef %8, i32 noundef %18, ptr noundef %19)
  store i32 %20, ptr %7, align 4, !tbaa !5
  store i32 %20, ptr %9, align 4, !tbaa !5
  %21 = load i32, ptr %9, align 4, !tbaa !5
  %22 = icmp slt i32 %21, 0
  br i1 %22, label %23, label %28

23:                                               ; preds = %17
  br label %24

24:                                               ; preds = %23
  %25 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %25, ptr %6, align 4, !tbaa !5
  store i32 6, ptr %10, align 4
  br label %29

26:                                               ; No predecessors!
  br label %27

27:                                               ; preds = %26
  br label %28

28:                                               ; preds = %27, %17
  store i32 0, ptr %10, align 4
  br label %29

29:                                               ; preds = %28, %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  %30 = load i32, ptr %10, align 4
  switch i32 %30, label %209 [
    i32 0, label %31
    i32 6, label %194
  ]

31:                                               ; preds = %29
  br label %32

32:                                               ; preds = %31
  br label %33

33:                                               ; preds = %32
  %34 = load i32, ptr %7, align 4, !tbaa !5
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %38, label %36

36:                                               ; preds = %33
  %37 = call i32 @puts(ptr noundef @help_string)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %209

38:                                               ; preds = %33
  br label %39

39:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %40 = call i32 @tsu_setup(ptr noundef %8)
  store i32 %40, ptr %11, align 4, !tbaa !5
  %41 = load i32, ptr %11, align 4, !tbaa !5
  %42 = icmp slt i32 %41, 0
  br i1 %42, label %43, label %48

43:                                               ; preds = %39
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %45, ptr %6, align 4, !tbaa !5
  store i32 6, ptr %10, align 4
  br label %49

46:                                               ; No predecessors!
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47, %39
  store i32 0, ptr %10, align 4
  br label %49

49:                                               ; preds = %48, %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  %50 = load i32, ptr %10, align 4
  switch i32 %50, label %209 [
    i32 0, label %51
    i32 6, label %194
  ]

51:                                               ; preds = %49
  br label %52

52:                                               ; preds = %51
  br label %53

53:                                               ; preds = %52
  %54 = getelementptr inbounds %struct.TStoreUtil, ptr %8, i32 0, i32 4
  %55 = getelementptr inbounds %struct.anon, ptr %54, i32 0, i32 0
  %56 = load ptr, ptr %55, align 8, !tbaa !11
  %57 = icmp ne ptr %56, null
  br i1 %57, label %60, label %58

58:                                               ; preds = %53
  %59 = call i32 @puts(ptr noundef @.str.29)
  br label %193

60:                                               ; preds = %53
  %61 = getelementptr inbounds %struct.TStoreUtil, ptr %8, i32 0, i32 4
  %62 = getelementptr inbounds %struct.anon, ptr %61, i32 0, i32 0
  %63 = load ptr, ptr %62, align 8, !tbaa !11
  %64 = call i32 @strcmp(ptr noundef %63, ptr noundef @.str.30) #7
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %70, label %66

66:                                               ; preds = %60
  %67 = getelementptr inbounds %struct.TStoreUtil, ptr %8, i32 0, i32 0
  %68 = getelementptr inbounds %struct.TStoreUtil, ptr %8, i32 0, i32 2
  %69 = call i32 @tstore_info_dump(ptr noundef %67, ptr noundef %68)
  br label %192

70:                                               ; preds = %60
  %71 = getelementptr inbounds %struct.TStoreUtil, ptr %8, i32 0, i32 4
  %72 = getelementptr inbounds %struct.anon, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !11
  %74 = call i32 @strcmp(ptr noundef %73, ptr noundef @.str.31) #7
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %106, label %76

76:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %100, %76
  %78 = load i32, ptr %12, align 4, !tbaa !5
  %79 = getelementptr inbounds %struct.TStoreUtil, ptr %8, i32 0, i32 4
  %80 = getelementptr inbounds %struct.anon, ptr %79, i32 0, i32 5
  %81 = load i32, ptr %80, align 8, !tbaa !20
  %82 = icmp ult i32 %78, %81
  br i1 %82, label %84, label %83

83:                                               ; preds = %77
  store i32 11, ptr %10, align 4
  br label %103

84:                                               ; preds = %77
  br label %85

85:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %86 = call i32 @tsu_bench(ptr noundef %8)
  store i32 %86, ptr %13, align 4, !tbaa !5
  %87 = load i32, ptr %13, align 4, !tbaa !5
  %88 = icmp slt i32 %87, 0
  br i1 %88, label %89, label %94

89:                                               ; preds = %85
  br label %90

90:                                               ; preds = %89
  %91 = load i32, ptr %13, align 4, !tbaa !5
  store i32 %91, ptr %6, align 4, !tbaa !5
  store i32 6, ptr %10, align 4
  br label %95

92:                                               ; No predecessors!
  br label %93

93:                                               ; preds = %92
  br label %94

94:                                               ; preds = %93, %85
  store i32 0, ptr %10, align 4
  br label %95

95:                                               ; preds = %94, %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  %96 = load i32, ptr %10, align 4
  switch i32 %96, label %103 [
    i32 0, label %97
  ]

97:                                               ; preds = %95
  br label %98

98:                                               ; preds = %97
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99
  %101 = load i32, ptr %12, align 4, !tbaa !5
  %102 = add i32 %101, 1
  store i32 %102, ptr %12, align 4, !tbaa !5
  br label %77, !llvm.loop !21

103:                                              ; preds = %95, %83
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  %104 = load i32, ptr %10, align 4
  switch i32 %104, label %209 [
    i32 11, label %105
    i32 6, label %194
  ]

105:                                              ; preds = %103
  br label %191

106:                                              ; preds = %70
  %107 = getelementptr inbounds %struct.TStoreUtil, ptr %8, i32 0, i32 4
  %108 = getelementptr inbounds %struct.anon, ptr %107, i32 0, i32 0
  %109 = load ptr, ptr %108, align 8, !tbaa !11
  %110 = call i32 @strcmp(ptr noundef %109, ptr noundef @.str.32) #7
  %111 = icmp ne i32 %110, 0
  br i1 %111, label %128, label %112

112:                                              ; preds = %106
  br label %113

113:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %114 = call i32 @tsu_checksum(ptr noundef %8)
  store i32 %114, ptr %14, align 4, !tbaa !5
  %115 = load i32, ptr %14, align 4, !tbaa !5
  %116 = icmp slt i32 %115, 0
  br i1 %116, label %117, label %122

117:                                              ; preds = %113
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %119, ptr %6, align 4, !tbaa !5
  store i32 6, ptr %10, align 4
  br label %123

120:                                              ; No predecessors!
  br label %121

121:                                              ; preds = %120
  br label %122

122:                                              ; preds = %121, %113
  store i32 0, ptr %10, align 4
  br label %123

123:                                              ; preds = %122, %118
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  %124 = load i32, ptr %10, align 4
  switch i32 %124, label %209 [
    i32 0, label %125
    i32 6, label %194
  ]

125:                                              ; preds = %123
  br label %126

126:                                              ; preds = %125
  br label %127

127:                                              ; preds = %126
  br label %190

128:                                              ; preds = %106
  %129 = getelementptr inbounds %struct.TStoreUtil, ptr %8, i32 0, i32 4
  %130 = getelementptr inbounds %struct.anon, ptr %129, i32 0, i32 0
  %131 = load ptr, ptr %130, align 8, !tbaa !11
  %132 = call i32 @strcmp(ptr noundef %131, ptr noundef @.str.33) #7
  %133 = icmp ne i32 %132, 0
  br i1 %133, label %150, label %134

134:                                              ; preds = %128
  br label %135

135:                                              ; preds = %134
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %136 = call i32 @tsu_dtype_convert(ptr noundef %8)
  store i32 %136, ptr %15, align 4, !tbaa !5
  %137 = load i32, ptr %15, align 4, !tbaa !5
  %138 = icmp slt i32 %137, 0
  br i1 %138, label %139, label %144

139:                                              ; preds = %135
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %15, align 4, !tbaa !5
  store i32 %141, ptr %6, align 4, !tbaa !5
  store i32 6, ptr %10, align 4
  br label %145

142:                                              ; No predecessors!
  br label %143

143:                                              ; preds = %142
  br label %144

144:                                              ; preds = %143, %135
  store i32 0, ptr %10, align 4
  br label %145

145:                                              ; preds = %144, %140
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  %146 = load i32, ptr %10, align 4
  switch i32 %146, label %209 [
    i32 0, label %147
    i32 6, label %194
  ]

147:                                              ; preds = %145
  br label %148

148:                                              ; preds = %147
  br label %149

149:                                              ; preds = %148
  br label %189

150:                                              ; preds = %128
  %151 = getelementptr inbounds %struct.TStoreUtil, ptr %8, i32 0, i32 4
  %152 = getelementptr inbounds %struct.anon, ptr %151, i32 0, i32 0
  %153 = load ptr, ptr %152, align 8, !tbaa !11
  %154 = call i32 @strcmp(ptr noundef %153, ptr noundef @.str.34) #7
  %155 = icmp ne i32 %154, 0
  br i1 %155, label %172, label %156

156:                                              ; preds = %150
  br label %157

157:                                              ; preds = %156
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %158 = call i32 @tsu_tensor_extract(ptr noundef %8)
  store i32 %158, ptr %16, align 4, !tbaa !5
  %159 = load i32, ptr %16, align 4, !tbaa !5
  %160 = icmp slt i32 %159, 0
  br i1 %160, label %161, label %166

161:                                              ; preds = %157
  br label %162

162:                                              ; preds = %161
  %163 = load i32, ptr %16, align 4, !tbaa !5
  store i32 %163, ptr %6, align 4, !tbaa !5
  store i32 6, ptr %10, align 4
  br label %167

164:                                              ; No predecessors!
  br label %165

165:                                              ; preds = %164
  br label %166

166:                                              ; preds = %165, %157
  store i32 0, ptr %10, align 4
  br label %167

167:                                              ; preds = %166, %162
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  %168 = load i32, ptr %10, align 4
  switch i32 %168, label %209 [
    i32 0, label %169
    i32 6, label %194
  ]

169:                                              ; preds = %167
  br label %170

170:                                              ; preds = %169
  br label %171

171:                                              ; preds = %170
  br label %188

172:                                              ; preds = %150
  br label %173

173:                                              ; preds = %172
  br label %174

174:                                              ; preds = %173
  %175 = call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %175, label %176, label %180

176:                                              ; preds = %174
  %177 = getelementptr inbounds %struct.TStoreUtil, ptr %8, i32 0, i32 4
  %178 = getelementptr inbounds %struct.anon, ptr %177, i32 0, i32 0
  %179 = load ptr, ptr %178, align 8, !tbaa !11
  call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef @.str.35, ptr noundef %179)
  br label %180

180:                                              ; preds = %176, %174
  br label %181

181:                                              ; preds = %180
  br label %182

182:                                              ; preds = %181
  br label %183

183:                                              ; preds = %182
  store i32 -1, ptr %6, align 4, !tbaa !5
  br label %194

184:                                              ; No predecessors!
  br label %185

185:                                              ; preds = %184
  br label %186

186:                                              ; preds = %185
  br label %187

187:                                              ; preds = %186
  br label %188

188:                                              ; preds = %187, %171
  br label %189

189:                                              ; preds = %188, %149
  br label %190

190:                                              ; preds = %189, %127
  br label %191

191:                                              ; preds = %190, %105
  br label %192

192:                                              ; preds = %191, %66
  br label %193

193:                                              ; preds = %192, %58
  br label %194

194:                                              ; preds = %193, %183, %167, %145, %123, %103, %49, %29
  %195 = load i32, ptr %6, align 4, !tbaa !5
  %196 = icmp slt i32 %195, 0
  br i1 %196, label %197, label %206

197:                                              ; preds = %194
  br label %198

198:                                              ; preds = %197
  %199 = call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %199, label %200, label %203

200:                                              ; preds = %198
  %201 = load i32, ptr %6, align 4, !tbaa !5
  %202 = sub nsw i32 0, %201
  call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef @.str.36, i32 noundef %202)
  br label %203

203:                                              ; preds = %200, %198
  br label %204

204:                                              ; preds = %203
  br label %205

205:                                              ; preds = %204
  br label %206

206:                                              ; preds = %205, %194
  call void @tsu_free(ptr noundef %8)
  %207 = load i32, ptr %6, align 4, !tbaa !5
  %208 = sub nsw i32 0, %207
  store i32 %208, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %209

209:                                              ; preds = %206, %167, %145, %123, %103, %49, %36, %29
  call void @llvm.lifetime.end.p0(i64 288, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %210 = load i32, ptr %3, align 4
  ret i32 %210
}

declare i32 @puts(ptr noundef) #3

declare i32 @tstore_info_dump(ptr noundef, ptr noundef) #3

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 = { "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 willreturn memory(read) "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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 240}
!12 = !{!"TStoreUtil", !13, i64 0, !14, i64 40, !14, i64 120, !17, i64 200, !19, i64 240}
!13 = !{!"TensorStore", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!14 = !{!"Stream", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !15, i64 40, !16, i64 64, !6, i64 72}
!15 = !{!"StreamInt", !7, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!"StringStore", !10, i64 0, !10, i64 8, !18, i64 16}
!18 = !{!"AllocatorArena", !16, i64 0, !10, i64 8, !10, i64 16}
!19 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !6, i64 40}
!20 = !{!12, !6, i64 280}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


; 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.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 }

@help_string = external dso_local constant [741 x i8], align 16
@.str.29 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [15 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @tsu_argv_load(ptr noundef, i32 noundef, ptr 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: inlinehint nounwind uwtable
declare hidden zeroext i1 @log_level_check(i32 noundef) local_unnamed_addr #2

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

; 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 @tsu_setup(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, -2147483648) i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.TStoreUtil, align 8
  call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %3) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(288) %3, i8 0, i64 288, i1 false)
  %4 = call i32 @tsu_argv_load(ptr noundef nonnull %3, i32 noundef %0, ptr noundef %1)
  %5 = icmp slt i32 %4, 0
  br i1 %5, label %.thread59, label %6

6:                                                ; preds = %2
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %7, label %9

7:                                                ; preds = %6
  %8 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @help_string)
  br label %53

9:                                                ; preds = %6
  %10 = call i32 @tsu_setup(ptr noundef nonnull %3)
  %11 = icmp slt i32 %10, 0
  br i1 %11, label %.thread59, label %12

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %3, i64 240
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  %.not43 = icmp eq ptr %14, null
  br i1 %.not43, label %15, label %17

15:                                               ; preds = %12
  %16 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.29)
  br label %.thread.thread

17:                                               ; preds = %12
  %18 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %14, ptr noundef nonnull dereferenceable(1) @.str.30) #9
  %.not44 = icmp eq i32 %18, 0
  br i1 %.not44, label %19, label %22

19:                                               ; preds = %17
  %20 = getelementptr inbounds i8, ptr %3, i64 120
  %21 = call i32 @tstore_info_dump(ptr noundef nonnull %3, ptr noundef nonnull %20) #8
  br label %.thread.thread

22:                                               ; preds = %17
  %23 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %14, ptr noundef nonnull dereferenceable(1) @.str.31) #9
  %.not45 = icmp eq i32 %23, 0
  br i1 %.not45, label %.preheader, label %32

.preheader:                                       ; preds = %22
  %24 = getelementptr inbounds i8, ptr %3, i64 280
  %25 = load i32, ptr %24, align 8, !tbaa !18
  %.not66 = icmp eq i32 %25, 0
  br i1 %.not66, label %.thread.thread, label %.lr.ph

26:                                               ; preds = %.lr.ph
  %27 = add nuw i32 %.03563, 1
  %28 = load i32, ptr %24, align 8, !tbaa !18
  %29 = icmp ult i32 %27, %28
  br i1 %29, label %.lr.ph, label %.thread.thread, !llvm.loop !19

.lr.ph:                                           ; preds = %.preheader, %26
  %.03563 = phi i32 [ %27, %26 ], [ 0, %.preheader ]
  %30 = call i32 @tsu_bench(ptr noundef nonnull %3)
  %31 = icmp sgt i32 %30, -1
  br i1 %31, label %26, label %.thread59

32:                                               ; preds = %22
  %33 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %14, ptr noundef nonnull dereferenceable(1) @.str.32) #9
  %.not46 = icmp eq i32 %33, 0
  br i1 %.not46, label %34, label %36

34:                                               ; preds = %32
  %35 = call i32 @tsu_checksum(ptr noundef nonnull %3)
  br label %.thread

36:                                               ; preds = %32
  %37 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %14, ptr noundef nonnull dereferenceable(1) @.str.33) #9
  %.not47 = icmp eq i32 %37, 0
  br i1 %.not47, label %38, label %40

38:                                               ; preds = %36
  %39 = call i32 @tsu_dtype_convert(ptr noundef nonnull %3)
  br label %.thread

40:                                               ; preds = %36
  %41 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %14, ptr noundef nonnull dereferenceable(1) @.str.34) #9
  %.not48 = icmp eq i32 %41, 0
  br i1 %.not48, label %42, label %44

42:                                               ; preds = %40
  %43 = call i32 @tsu_tensor_extract(ptr noundef nonnull %3)
  br label %.thread

44:                                               ; preds = %40
  %45 = call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %45, label %46, label %.thread59

46:                                               ; preds = %44
  %47 = load ptr, ptr %13, align 8, !tbaa !5
  call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef nonnull @.str.35, ptr noundef %47) #8
  br label %.thread59

.thread:                                          ; preds = %42, %38, %34
  %.sink = phi i32 [ %43, %42 ], [ %39, %38 ], [ %35, %34 ]
  %...4956 = call i32 @llvm.smin.i32(i32 %.sink, i32 0)
  %48 = icmp slt i32 %.sink, 0
  br i1 %48, label %.thread59, label %.thread.thread

.thread59:                                        ; preds = %.lr.ph, %9, %2, %46, %44, %.thread
  %.862 = phi i32 [ %...4956, %.thread ], [ -1, %44 ], [ -1, %46 ], [ %10, %9 ], [ %4, %2 ], [ %30, %.lr.ph ]
  %49 = call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %49, label %50, label %.thread.thread

50:                                               ; preds = %.thread59
  %51 = sub nsw i32 0, %.862
  call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef nonnull @.str.36, i32 noundef %51) #8
  br label %.thread.thread

.thread.thread:                                   ; preds = %26, %.preheader, %15, %19, %.thread59, %50, %.thread
  %.861 = phi i32 [ %.862, %.thread59 ], [ %.862, %50 ], [ 0, %.thread ], [ 0, %19 ], [ 0, %15 ], [ 0, %.preheader ], [ 0, %26 ]
  call void @tsu_free(ptr noundef nonnull %3)
  %52 = sub nsw i32 0, %.861
  br label %53

53:                                               ; preds = %.thread.thread, %7
  %.0 = phi i32 [ %52, %.thread.thread ], [ 0, %7 ]
  call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %3) #8
  ret i32 %.0
}

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6

declare i32 @tstore_info_dump(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }

!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 240}
!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 = !{!6, !14, i64 280}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


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