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

@.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.25 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [4 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 ptr @tstore_dtype_str(i32 noundef) #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @stream_write_chk(ptr noalias noundef, i64 noundef, ptr noalias 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

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

declare i32 @stream_flush(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @tsu_tensor_extract(ptr noundef %0) #3 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  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
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.TStoreUtil, ptr %12, i32 0, i32 4
  %14 = getelementptr inbounds %struct.anon, ptr %13, i32 0, i32 3
  %15 = load ptr, ptr %14, align 8, !tbaa !11
  %16 = icmp ne ptr %15, null
  br i1 %16, label %30, label %17

17:                                               ; preds = %1
  br label %18

18:                                               ; preds = %17
  br label %19

19:                                               ; preds = %18
  %20 = call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %20, label %21, label %22

21:                                               ; preds = %19
  call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef @.str.25)
  br label %22

22:                                               ; preds = %21, %19
  br label %23

23:                                               ; preds = %22
  br label %24

24:                                               ; preds = %23
  br label %25

25:                                               ; preds = %24
  store i32 -1, ptr %4, align 4, !tbaa !9
  br label %173

26:                                               ; No predecessors!
  br label %27

27:                                               ; preds = %26
  br label %28

28:                                               ; preds = %27
  br label %29

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %29, %1
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.TStoreUtil, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.TStoreUtil, ptr %33, i32 0, i32 4
  %35 = getelementptr inbounds %struct.anon, ptr %34, i32 0, i32 3
  %36 = load ptr, ptr %35, align 8, !tbaa !11
  %37 = call ptr @tstore_tensor_get(ptr noundef %32, ptr noundef %36)
  store ptr %37, ptr %5, align 8, !tbaa !5
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = icmp ne ptr %38, null
  br i1 %39, label %57, label %40

40:                                               ; preds = %30
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41
  %43 = call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %43, label %44, label %49

44:                                               ; preds = %42
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.TStoreUtil, ptr %45, i32 0, i32 4
  %47 = getelementptr inbounds %struct.anon, ptr %46, i32 0, i32 3
  %48 = load ptr, ptr %47, align 8, !tbaa !11
  call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef @.str.26, ptr noundef %48)
  br label %49

49:                                               ; preds = %44, %42
  br label %50

50:                                               ; preds = %49
  br label %51

51:                                               ; preds = %50
  br label %52

52:                                               ; preds = %51
  store i32 -1, ptr %4, align 4, !tbaa !9
  br label %173

53:                                               ; No predecessors!
  br label %54

54:                                               ; preds = %53
  br label %55

55:                                               ; preds = %54
  br label %56

56:                                               ; preds = %55
  br label %57

57:                                               ; preds = %56, %30
  br label %58

58:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.TSTensorEntry, ptr %59, i32 0, i32 6
  %61 = load ptr, ptr %60, align 8, !tbaa !20
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.TSTensorEntry, ptr %62, i32 0, i32 4
  %64 = load i64, ptr %63, align 8, !tbaa !22
  %65 = call i32 @stream_seek(ptr noundef %61, i64 noundef %64, i32 noundef 0)
  store i32 %65, ptr %6, align 4, !tbaa !9
  %66 = load i32, ptr %6, align 4, !tbaa !9
  %67 = icmp slt i32 %66, 0
  br i1 %67, label %68, label %85

68:                                               ; preds = %58
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  %71 = call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %71, label %72, label %76

72:                                               ; preds = %70
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.TSTensorEntry, ptr %73, i32 0, i32 4
  %75 = load i64, ptr %74, align 8, !tbaa !22
  call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef @.str.18, i64 noundef %75)
  br label %76

76:                                               ; preds = %72, %70
  br label %77

77:                                               ; preds = %76
  br label %78

78:                                               ; preds = %77
  br label %79

79:                                               ; preds = %78
  %80 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %80, ptr %4, align 4, !tbaa !9
  store i32 8, ptr %7, align 4
  br label %86

81:                                               ; No predecessors!
  br label %82

82:                                               ; preds = %81
  br label %83

83:                                               ; preds = %82
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84, %58
  store i32 0, ptr %7, align 4
  br label %86

86:                                               ; preds = %85, %79
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %87 = load i32, ptr %7, align 4
  switch i32 %87, label %175 [
    i32 0, label %88
    i32 8, label %173
  ]

88:                                               ; preds = %86
  br label %89

89:                                               ; preds = %88
  br label %90

90:                                               ; preds = %89
  br label %91

91:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.TSTensorEntry, ptr %92, i32 0, i32 6
  %94 = load ptr, ptr %93, align 8, !tbaa !20
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.TSTensorEntry, ptr %95, i32 0, i32 5
  %97 = load i64, ptr %96, align 8, !tbaa !23
  %98 = call i32 @stream_read_prep(ptr noundef %94, i64 noundef %97)
  store i32 %98, ptr %8, align 4, !tbaa !9
  %99 = load i32, ptr %8, align 4, !tbaa !9
  %100 = icmp slt i32 %99, 0
  br i1 %100, label %101, label %115

101:                                              ; preds = %91
  br label %102

102:                                              ; preds = %101
  br label %103

103:                                              ; preds = %102
  %104 = call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %104, label %105, label %106

105:                                              ; preds = %103
  call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef @.str.19)
  br label %106

106:                                              ; preds = %105, %103
  br label %107

107:                                              ; preds = %106
  br label %108

108:                                              ; preds = %107
  br label %109

109:                                              ; preds = %108
  %110 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %110, ptr %4, align 4, !tbaa !9
  store i32 8, ptr %7, align 4
  br label %116

111:                                              ; No predecessors!
  br label %112

112:                                              ; preds = %111
  br label %113

113:                                              ; preds = %112
  br label %114

114:                                              ; preds = %113
  br label %115

115:                                              ; preds = %114, %91
  store i32 0, ptr %7, align 4
  br label %116

116:                                              ; preds = %115, %109
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  %117 = load i32, ptr %7, align 4
  switch i32 %117, label %175 [
    i32 0, label %118
    i32 8, label %173
  ]

118:                                              ; preds = %116
  br label %119

119:                                              ; preds = %118
  br label %120

120:                                              ; preds = %119
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.TSTensorEntry, ptr %121, i32 0, i32 6
  %123 = load ptr, ptr %122, align 8, !tbaa !20
  %124 = call ptr @stream_buffer_get_(ptr noundef %123, ptr noundef null)
  store ptr %124, ptr %9, align 8, !tbaa !5
  %125 = load ptr, ptr %9, align 8, !tbaa !5
  %126 = load ptr, ptr %5, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.TSTensorEntry, ptr %126, i32 0, i32 5
  %128 = load i64, ptr %127, align 8, !tbaa !23
  %129 = getelementptr inbounds i8, ptr %125, i64 %128
  store ptr %129, ptr %10, align 8, !tbaa !5
  %130 = load ptr, ptr %3, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.TStoreUtil, ptr %130, i32 0, i32 2
  %132 = load ptr, ptr %5, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.TSTensorEntry, ptr %132, i32 0, i32 1
  %134 = load i32, ptr %133, align 4, !tbaa !24
  %135 = call ptr @tstore_dtype_str(i32 noundef %134)
  %136 = call i32 (ptr, ptr, ...) @stream_printf(ptr noundef %131, ptr noundef @.str.27, ptr noundef %135)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %137

137:                                              ; preds = %154, %120
  %138 = load i32, ptr %11, align 4, !tbaa !9
  %139 = load ptr, ptr %5, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.TSTensorEntry, ptr %139, i32 0, i32 2
  %141 = load i32, ptr %140, align 8, !tbaa !25
  %142 = icmp ult i32 %138, %141
  br i1 %142, label %144, label %143

143:                                              ; preds = %137
  store i32 31, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %157

144:                                              ; preds = %137
  %145 = load ptr, ptr %3, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.TStoreUtil, ptr %145, i32 0, i32 2
  %147 = load ptr, ptr %5, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.TSTensorEntry, ptr %147, i32 0, i32 3
  %149 = load i32, ptr %11, align 4, !tbaa !9
  %150 = zext i32 %149 to i64
  %151 = getelementptr inbounds [4 x i32], ptr %148, i64 0, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !9
  %153 = call i32 (ptr, ptr, ...) @stream_printf(ptr noundef %146, ptr noundef @.str.28, i32 noundef %152)
  br label %154

154:                                              ; preds = %144
  %155 = load i32, ptr %11, align 4, !tbaa !9
  %156 = add i32 %155, 1
  store i32 %156, ptr %11, align 4, !tbaa !9
  br label %137, !llvm.loop !26

157:                                              ; preds = %143
  %158 = load ptr, ptr %3, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.TStoreUtil, ptr %158, i32 0, i32 2
  %160 = call i32 @stream_char_put(ptr noundef %159, i32 noundef 10)
  %161 = load ptr, ptr %3, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.TStoreUtil, ptr %161, i32 0, i32 2
  %163 = load ptr, ptr %10, align 8, !tbaa !5
  %164 = load ptr, ptr %9, align 8, !tbaa !5
  %165 = ptrtoint ptr %163 to i64
  %166 = ptrtoint ptr %164 to i64
  %167 = sub i64 %165, %166
  %168 = load ptr, ptr %9, align 8, !tbaa !5
  %169 = call i32 @stream_write_chk(ptr noundef %162, i64 noundef %167, ptr noundef %168)
  %170 = load ptr, ptr %3, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.TStoreUtil, ptr %170, i32 0, i32 2
  %172 = call i32 @stream_flush(ptr noundef %171)
  br label %173

173:                                              ; preds = %157, %116, %86, %52, %25
  %174 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %174, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %175

175:                                              ; preds = %173, %116, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %176 = load i32, ptr %2, align 4
  ret i32 %176
}

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

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

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, !6, i64 264}
!12 = !{!"TStoreUtil", !13, i64 0, !14, i64 40, !14, i64 120, !17, i64 200, !19, i64 240}
!13 = !{!"TensorStore", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!14 = !{!"Stream", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !15, i64 40, !16, i64 64, !10, i64 72}
!15 = !{!"StreamInt", !7, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!"StringStore", !6, i64 0, !6, i64 8, !18, i64 16}
!18 = !{!"AllocatorArena", !16, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !10, i64 40}
!20 = !{!21, !6, i64 48}
!21 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !7, i64 12, !16, i64 32, !16, i64 40, !6, i64 48, !6, i64 56}
!22 = !{!21, !16, i64 32}
!23 = !{!21, !16, i64 40}
!24 = !{!21, !10, i64 4}
!25 = !{!21, !10, i64 8}
!26 = distinct !{!26, !27}
!27 = !{!"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"

@.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.25 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [4 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 ptr @tstore_dtype_str(i32 noundef) local_unnamed_addr #1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @stream_write_chk(ptr noalias noundef, i64 noundef, ptr noalias 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

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

declare i32 @stream_flush(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @tsu_tensor_extract(ptr noundef %0) local_unnamed_addr #2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 264
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %4, label %7

4:                                                ; preds = %1
  %5 = tail call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %5, label %6, label %.thread

6:                                                ; preds = %4
  tail call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef nonnull @.str.25) #3
  br label %.thread

7:                                                ; preds = %1
  %8 = tail call ptr @tstore_tensor_get(ptr noundef nonnull %0, ptr noundef nonnull %3)
  %.not42 = icmp eq ptr %8, null
  br i1 %.not42, label %9, label %13

9:                                                ; preds = %7
  %10 = tail call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %10, label %11, label %.thread

11:                                               ; preds = %9
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  tail call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef nonnull @.str.26, ptr noundef %12) #3
  br label %.thread

13:                                               ; preds = %7
  %14 = getelementptr inbounds i8, ptr %8, i64 48
  %15 = load ptr, ptr %14, align 8, !tbaa !18
  %16 = getelementptr inbounds i8, ptr %8, i64 32
  %17 = load i64, ptr %16, align 8, !tbaa !20
  %18 = tail call i32 @stream_seek(ptr noundef %15, i64 noundef %17, i32 noundef 0)
  %19 = icmp slt i32 %18, 0
  br i1 %19, label %20, label %24

20:                                               ; preds = %13
  %21 = tail call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %21, label %22, label %.thread

22:                                               ; preds = %20
  %23 = load i64, ptr %16, align 8, !tbaa !20
  tail call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef nonnull @.str.18, i64 noundef %23) #3
  br label %.thread

24:                                               ; preds = %13
  %25 = load ptr, ptr %14, align 8, !tbaa !18
  %26 = getelementptr inbounds i8, ptr %8, i64 40
  %27 = load i64, ptr %26, align 8, !tbaa !21
  %28 = tail call i32 @stream_read_prep(ptr noundef %25, i64 noundef %27) #3
  %29 = icmp slt i32 %28, 0
  br i1 %29, label %30, label %33

30:                                               ; preds = %24
  %31 = tail call zeroext i1 @log_level_check(i32 noundef 10)
  br i1 %31, label %32, label %.thread

32:                                               ; preds = %30
  tail call void (i32, ptr, ...) @log_logf(i32 noundef 10, ptr noundef nonnull @.str.19) #3
  br label %.thread

33:                                               ; preds = %24
  %34 = load ptr, ptr %14, align 8, !tbaa !18
  %35 = tail call ptr @stream_buffer_get_(ptr noundef %34, ptr noundef null)
  %36 = load i64, ptr %26, align 8, !tbaa !21
  %37 = getelementptr inbounds i8, ptr %0, i64 120
  %38 = getelementptr inbounds i8, ptr %8, i64 4
  %39 = load i32, ptr %38, align 4, !tbaa !22
  %40 = tail call ptr @tstore_dtype_str(i32 noundef %39) #3
  %41 = tail call i32 (ptr, ptr, ...) @stream_printf(ptr noundef nonnull %37, ptr noundef nonnull @.str.27, ptr noundef %40) #3
  %42 = getelementptr inbounds i8, ptr %8, i64 8
  %43 = load i32, ptr %42, align 8, !tbaa !23
  %.not56 = icmp eq i32 %43, 0
  br i1 %.not56, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %33
  %44 = getelementptr inbounds i8, ptr %8, i64 12
  br label %48

._crit_edge:                                      ; preds = %48, %33
  %45 = tail call i32 @stream_char_put(ptr noundef nonnull %37, i32 noundef 10)
  %46 = tail call i32 @stream_write_chk(ptr noundef nonnull %37, i64 noundef %36, ptr noundef %35)
  %47 = tail call i32 @stream_flush(ptr noundef nonnull %37) #3
  br label %.thread

48:                                               ; preds = %.lr.ph, %48
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %48 ]
  %49 = getelementptr inbounds [4 x i32], ptr %44, i64 0, i64 %indvars.iv
  %50 = load i32, ptr %49, align 4, !tbaa !24
  %51 = tail call i32 (ptr, ptr, ...) @stream_printf(ptr noundef nonnull %37, ptr noundef nonnull @.str.28, i32 noundef %50) #3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %52 = load i32, ptr %42, align 8, !tbaa !23
  %53 = zext i32 %52 to i64
  %54 = icmp ult i64 %indvars.iv.next, %53
  br i1 %54, label %48, label %._crit_edge, !llvm.loop !25

.thread:                                          ; preds = %32, %30, %22, %20, %._crit_edge, %4, %6, %9, %11
  %.2 = phi i32 [ 1, %._crit_edge ], [ -1, %4 ], [ -1, %6 ], [ -1, %9 ], [ -1, %11 ], [ %18, %20 ], [ %18, %22 ], [ %28, %30 ], [ %28, %32 ]
  ret i32 %.2
}

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

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

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 = { 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 264}
!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, !8, i64 48}
!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, !14, i64 4}
!23 = !{!19, !14, i64 8}
!24 = !{!14, !14, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}


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