; LLVM IR from huawei-noah/bolt :: inference/engine/src (bolt_c)

; 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.TensorDesc = type { i32, i32, i32, [20 x i32] }
%struct.DataDesc = type { i32, i32, i32, [20 x i32], [128 x i8], ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%struct.ResultHandleInner = type { i32, ptr, i32 }

@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1
@stdout = external global ptr, align 8
@.str.22 = external hidden unnamed_addr constant [13 x i8], align 1
@__FUNCTION__.GetOutputDataFromResultHandleWithTransformFormat = external hidden unnamed_addr constant [49 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z18assert_not_nullptrPKcS0_PKv(ptr noundef, ptr 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind
declare i64 @syscall(i64 noundef, ...) #4

declare i32 @printf(ptr noundef, ...) #5

declare i32 @fflush(ptr noundef) #5

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #6

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z10UNI_MEMCPYPvPKvm(ptr noundef, ptr noundef, i64 noundef) #7

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

; Function Attrs: mustprogress uwtable
define dso_local i32 @GetOutputDataFromResultHandleWithTransformFormat(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) #8 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %struct.TensorDesc, align 4
  %15 = alloca %struct.DataDesc, align 8
  %16 = alloca %struct.TensorDesc, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca %struct.TensorDesc, align 8
  %22 = alloca %struct.TensorDesc, align 8
  %23 = alloca %struct.TensorDesc, align 8
  %24 = alloca %struct.TensorDesc, align 8
  %25 = alloca i32, align 4
  %26 = alloca %"class.std::__cxx11::basic_string", align 8
  %27 = alloca %struct.TensorDesc, align 8
  %28 = alloca ptr, align 8
  %29 = alloca i32, align 4
  %30 = alloca %struct.TensorDesc, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  store i32 0, ptr %9, align 4, !tbaa !9
  %31 = load i32, ptr %6, align 4, !tbaa !9
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %33, label %182

33:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %34, ptr %10, align 8, !tbaa !5
  %35 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_Z18assert_not_nullptrPKcS0_PKv(ptr noundef @__FUNCTION__.GetOutputDataFromResultHandleWithTransformFormat, ptr noundef @.str.22, ptr noundef %35)
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_Z19print_result_handleP17ResultHandleInner(ptr noundef %36)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #9
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.ResultHandleInner, ptr %37, i32 0, i32 1
  %39 = load ptr, ptr %38, align 8, !tbaa !11
  store ptr %39, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %177, %33
  %41 = load i32, ptr %12, align 4, !tbaa !9
  %42 = load i32, ptr %6, align 4, !tbaa !9
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  store i32 2, ptr %13, align 4
  br label %180

45:                                               ; preds = %40
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = load i32, ptr %12, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds ptr, ptr %46, i64 %48
  %50 = load ptr, ptr %49, align 8, !tbaa !5
  call void @_Z18assert_not_nullptrPKcS0_PKv(ptr noundef @__FUNCTION__.GetOutputDataFromResultHandleWithTransformFormat, ptr noundef @.str.24, ptr noundef %50)
  call void @llvm.lifetime.start.p0(i64 92, ptr %14) #9
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  %52 = load i32, ptr %12, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds %struct.DataDesc, ptr %51, i64 %53
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 %54, i64 232, i1 false), !tbaa.struct !14
  call void @_Z19DataDesc2TensorDesc8DataDesc(ptr dead_on_unwind writable sret(%struct.TensorDesc) align 4 %14, ptr noundef byval(%struct.DataDesc) align 8 %15)
  call void @llvm.lifetime.start.p0(i64 92, ptr %16) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 4 %14, i64 92, i1 false), !tbaa.struct !20
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.ResultHandleInner, ptr %55, i32 0, i32 2
  %57 = load i32, ptr %56, align 8, !tbaa !21
  %58 = icmp eq i32 %57, 10
  br i1 %58, label %126, label %59

59:                                               ; preds = %45
  %60 = load ptr, ptr %10, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.ResultHandleInner, ptr %60, i32 0, i32 2
  %62 = load i32, ptr %61, align 8, !tbaa !21
  %63 = icmp eq i32 %62, 11
  br i1 %63, label %126, label %64

64:                                               ; preds = %59
  %65 = getelementptr inbounds %struct.TensorDesc, ptr %16, i32 0, i32 1
  %66 = load i32, ptr %65, align 4, !tbaa !22
  %67 = icmp eq i32 %66, 2
  br i1 %67, label %72, label %68

68:                                               ; preds = %64
  %69 = getelementptr inbounds %struct.TensorDesc, ptr %16, i32 0, i32 1
  %70 = load i32, ptr %69, align 4, !tbaa !22
  %71 = icmp eq i32 %70, 22
  br i1 %71, label %72, label %126

72:                                               ; preds = %68, %64
  %73 = getelementptr inbounds %struct.TensorDesc, ptr %16, i32 0, i32 1
  store i32 0, ptr %73, align 4, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  store i32 0, ptr %17, align 4, !tbaa !9
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = icmp ne ptr %74, null
  br i1 %75, label %76, label %107

76:                                               ; preds = %72
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = load i32, ptr %12, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds i32, ptr %77, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !9
  store i32 %81, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #9
  %82 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 2
  %83 = load i32, ptr %82, align 4, !tbaa !24
  %84 = sub i32 %83, 2
  store i32 %84, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  %85 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %86 = load i32, ptr %18, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [20 x i32], ptr %85, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !9
  store i32 %89, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %14, i64 92, i1 false), !tbaa.struct !20
  %90 = call noundef i32 @_Z17tensorNumElements10TensorDesc(ptr noundef byval(%struct.TensorDesc) align 8 %21)
  %91 = load i32, ptr %19, align 4, !tbaa !9
  %92 = udiv i32 %90, %91
  store i32 %92, ptr %20, align 4, !tbaa !9
  %93 = load i32, ptr %17, align 4, !tbaa !9
  %94 = load i32, ptr %19, align 4, !tbaa !9
  %95 = load i32, ptr %20, align 4, !tbaa !9
  %96 = mul i32 %94, %95
  %97 = icmp ne i32 %93, %96
  br i1 %97, label %98, label %106

98:                                               ; preds = %76
  %99 = load i32, ptr %17, align 4, !tbaa !9
  %100 = load i32, ptr %20, align 4, !tbaa !9
  %101 = udiv i32 %99, %100
  %102 = getelementptr inbounds %struct.TensorDesc, ptr %16, i32 0, i32 3
  %103 = load i32, ptr %18, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [20 x i32], ptr %102, i64 0, i64 %104
  store i32 %101, ptr %105, align 4, !tbaa !9
  br label %106

106:                                              ; preds = %98, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  br label %107

107:                                              ; preds = %106, %72
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %14, i64 92, i1 false), !tbaa.struct !20
  %108 = load ptr, ptr %11, align 8, !tbaa !5
  %109 = load i32, ptr %12, align 4, !tbaa !9
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds %struct.DataDesc, ptr %108, i64 %110
  %112 = getelementptr inbounds %struct.DataDesc, ptr %111, i32 0, i32 5
  %113 = load ptr, ptr %112, align 8, !tbaa !25
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %16, i64 92, i1 false), !tbaa.struct !20
  %114 = load ptr, ptr %8, align 8, !tbaa !5
  %115 = load i32, ptr %12, align 4, !tbaa !9
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds ptr, ptr %114, i64 %116
  %118 = load ptr, ptr %117, align 8, !tbaa !5
  %119 = call noundef i32 @_Z15transformToNCHW10TensorDescPKvS_Pv(ptr noundef byval(%struct.TensorDesc) align 8 %22, ptr noundef %113, ptr noundef byval(%struct.TensorDesc) align 8 %23, ptr noundef %118)
  %120 = icmp ne i32 0, %119
  br i1 %120, label %121, label %122

121:                                              ; preds = %107
  store i32 1, ptr %9, align 4, !tbaa !9
  store i32 2, ptr %13, align 4
  br label %123

122:                                              ; preds = %107
  store i32 0, ptr %13, align 4
  br label %123

123:                                              ; preds = %122, %121
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  %124 = load i32, ptr %13, align 4
  switch i32 %124, label %174 [
    i32 0, label %125
  ]

125:                                              ; preds = %123
  br label %173

126:                                              ; preds = %68, %59, %45
  %127 = load ptr, ptr %7, align 8, !tbaa !5
  %128 = icmp ne ptr %127, null
  br i1 %128, label %129, label %159

129:                                              ; preds = %126
  %130 = load ptr, ptr %7, align 8, !tbaa !5
  %131 = load i32, ptr %12, align 4, !tbaa !9
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds i32, ptr %130, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %14, i64 92, i1 false), !tbaa.struct !20
  %135 = call noundef i32 @_Z17tensorNumElements10TensorDesc(ptr noundef byval(%struct.TensorDesc) align 8 %24)
  %136 = icmp ne i32 %134, %135
  br i1 %136, label %137, label %159

137:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #9
  %138 = call i64 (i64, ...) @syscall(i64 noundef 186) #9
  %139 = trunc i64 %138 to i32
  store i32 %139, ptr %25, align 4, !tbaa !9
  %140 = load i32, ptr %25, align 4, !tbaa !9
  %141 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %140)
  %142 = load ptr, ptr @stdout, align 8, !tbaa !5
  %143 = call i32 @fflush(ptr noundef %142)
  %144 = load i32, ptr %12, align 4, !tbaa !9
  %145 = load ptr, ptr %7, align 8, !tbaa !5
  %146 = load i32, ptr %12, align 4, !tbaa !9
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds i32, ptr %145, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %26) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 4 %14, i64 92, i1 false), !tbaa.struct !20
  call void @_Z14tensorDesc2StrB5cxx1110TensorDesc(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %26, ptr noundef byval(%struct.TensorDesc) align 8 %27)
  %150 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %26) #9
  %151 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.25, i32 noundef %144, i32 noundef %149, ptr noundef %150)
          to label %152 unwind label %155

152:                                              ; preds = %137
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %26) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %26) #9
  %153 = load ptr, ptr @stdout, align 8, !tbaa !5
  %154 = call i32 @fflush(ptr noundef %153)
  call void @exit(i32 noundef 1) #10
  unreachable

155:                                              ; preds = %137
  %156 = landingpad { ptr, i32 }
          cleanup
  %157 = extractvalue { ptr, i32 } %156, 0
  store ptr %157, ptr %28, align 8
  %158 = extractvalue { ptr, i32 } %156, 1
  store i32 %158, ptr %29, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %26) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %26) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #9
  call void @llvm.lifetime.end.p0(i64 92, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 92, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  br label %184

159:                                              ; preds = %129, %126
  %160 = load ptr, ptr %8, align 8, !tbaa !5
  %161 = load i32, ptr %12, align 4, !tbaa !9
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds ptr, ptr %160, i64 %162
  %164 = load ptr, ptr %163, align 8, !tbaa !5
  %165 = load ptr, ptr %11, align 8, !tbaa !5
  %166 = load i32, ptr %12, align 4, !tbaa !9
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds %struct.DataDesc, ptr %165, i64 %167
  %169 = getelementptr inbounds %struct.DataDesc, ptr %168, i32 0, i32 5
  %170 = load ptr, ptr %169, align 8, !tbaa !25
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %30, ptr align 4 %14, i64 92, i1 false), !tbaa.struct !20
  %171 = call noundef i32 @_Z14tensorNumBytes10TensorDesc(ptr noundef byval(%struct.TensorDesc) align 8 %30)
  %172 = zext i32 %171 to i64
  call void @_Z10UNI_MEMCPYPvPKvm(ptr noundef %164, ptr noundef %170, i64 noundef %172)
  br label %173

173:                                              ; preds = %159, %125
  store i32 0, ptr %13, align 4
  br label %174

174:                                              ; preds = %173, %123
  call void @llvm.lifetime.end.p0(i64 92, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 92, ptr %14) #9
  %175 = load i32, ptr %13, align 4
  switch i32 %175, label %180 [
    i32 0, label %176
  ]

176:                                              ; preds = %174
  br label %177

177:                                              ; preds = %176
  %178 = load i32, ptr %12, align 4, !tbaa !9
  %179 = add nsw i32 %178, 1
  store i32 %179, ptr %12, align 4, !tbaa !9
  br label %40, !llvm.loop !27

180:                                              ; preds = %174, %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  br label %181

181:                                              ; preds = %180
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  br label %182

182:                                              ; preds = %181, %4
  %183 = load i32, ptr %9, align 4, !tbaa !9
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  ret i32 %183

184:                                              ; preds = %155
  %185 = load ptr, ptr %28, align 8
  %186 = load i32, ptr %29, align 4
  %187 = insertvalue { ptr, i32 } poison, ptr %185, 0
  %188 = insertvalue { ptr, i32 } %187, i32 %186, 1
  resume { ptr, i32 } %188
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z19DataDesc2TensorDesc8DataDesc(ptr dead_on_unwind noalias writable sret(%struct.TensorDesc) align 4, ptr noundef byval(%struct.DataDesc) align 8) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z17tensorNumElements10TensorDesc(ptr noundef byval(%struct.TensorDesc) align 8) #0

declare noundef i32 @_Z15transformToNCHW10TensorDescPKvS_Pv(ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef, ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z14tensorDesc2StrB5cxx1110TensorDesc(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef byval(%struct.TensorDesc) align 8) #7

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z14tensorNumBytes10TensorDesc(ptr noundef byval(%struct.TensorDesc) align 8) #7

attributes #0 = { inlinehint mustprogress 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 = { mustprogress 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 nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { "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 #6 = { noreturn 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 = { inlinehint mustprogress 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 #8 = { mustprogress 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 #9 = { nounwind }
attributes #10 = { noreturn 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"_ZTS17ResultHandleInner", !10, i64 0, !6, i64 8, !13, i64 16}
!13 = !{!"_ZTS13HARDWARE_TYPE", !7, i64 0}
!14 = !{i64 0, i64 4, !15, i64 4, i64 4, !17, i64 8, i64 4, !9, i64 12, i64 80, !19, i64 92, i64 128, !19, i64 224, i64 8, !5}
!15 = !{!16, !16, i64 0}
!16 = !{!"_ZTS8DataType", !7, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"_ZTS10DataFormat", !7, i64 0}
!19 = !{!7, !7, i64 0}
!20 = !{i64 0, i64 4, !15, i64 4, i64 4, !17, i64 8, i64 4, !9, i64 12, i64 80, !19}
!21 = !{!12, !13, i64 16}
!22 = !{!23, !18, i64 4}
!23 = !{!"_ZTS10TensorDesc", !16, i64 0, !18, i64 4, !10, i64 8, !7, i64 12}
!24 = !{!23, !10, i64 8}
!25 = !{!26, !6, i64 224}
!26 = !{!"_ZTS8DataDesc", !16, i64 0, !18, i64 4, !10, i64 8, !7, i64 12, !7, i64 92, !6, i64 224}
!27 = distinct !{!27, !28}
!28 = !{!"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.TensorDesc = type { i32, i32, i32, [20 x i32] }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%struct.DataDesc = type { i32, i32, i32, [20 x i32], [128 x i8], ptr }

@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.22 = external hidden unnamed_addr constant [13 x i8], align 1
@__FUNCTION__.GetOutputDataFromResultHandleWithTransformFormat = external hidden unnamed_addr constant [49 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z18assert_not_nullptrPKcS0_PKv(ptr noundef, ptr 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind
declare i64 @syscall(i64 noundef, ...) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z10UNI_MEMCPYPvPKvm(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #7

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

; Function Attrs: mustprogress uwtable
define dso_local range(i32 0, 2) i32 @GetOutputDataFromResultHandleWithTransformFormat(ptr noundef %0, i32 noundef %1, ptr noundef readonly %2, ptr nocapture noundef readonly %3) local_unnamed_addr #8 personality ptr @__gxx_personality_v0 {
  %5 = alloca %struct.TensorDesc, align 8
  %6 = alloca %struct.TensorDesc, align 8
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = icmp sgt i32 %1, 0
  br i1 %8, label %9, label %.loopexit

9:                                                ; preds = %4
  tail call void @_Z18assert_not_nullptrPKcS0_PKv(ptr noundef nonnull @__FUNCTION__.GetOutputDataFromResultHandleWithTransformFormat, ptr noundef nonnull @.str.22, ptr noundef %0)
  tail call void @_Z19print_result_handleP17ResultHandleInner(ptr noundef %0)
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 16
  %13 = getelementptr inbounds i8, ptr %6, i64 4
  %.not = icmp eq ptr %2, null
  %14 = getelementptr inbounds i8, ptr %5, i64 8
  %15 = getelementptr inbounds i8, ptr %5, i64 12
  %16 = getelementptr inbounds i8, ptr %6, i64 12
  %wide.trip.count = zext nneg i32 %1 to i64
  br label %17

17:                                               ; preds = %9, %select.unfold
  %indvars.iv = phi i64 [ 0, %9 ], [ %indvars.iv.next, %select.unfold ]
  %18 = getelementptr inbounds ptr, ptr %3, i64 %indvars.iv
  %19 = load ptr, ptr %18, align 8, !tbaa !12
  call void @_Z18assert_not_nullptrPKcS0_PKv(ptr noundef nonnull @__FUNCTION__.GetOutputDataFromResultHandleWithTransformFormat, ptr noundef nonnull @.str.24, ptr noundef %19)
  call void @llvm.lifetime.start.p0(i64 92, ptr nonnull %5) #10
  %20 = getelementptr inbounds %struct.DataDesc, ptr %11, i64 %indvars.iv
  call void @_Z19DataDesc2TensorDesc8DataDesc(ptr dead_on_unwind nonnull writable sret(%struct.TensorDesc) align 4 %5, ptr noundef nonnull byval(%struct.DataDesc) align 8 %20)
  call void @llvm.lifetime.start.p0(i64 92, ptr nonnull %6) #10
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(92) %6, ptr noundef nonnull align 8 dereferenceable(92) %5, i64 92, i1 false), !tbaa.struct !13
  %21 = load i32, ptr %12, align 8, !tbaa !20
  %22 = and i32 %21, -2
  %switch = icmp eq i32 %22, 10
  br i1 %switch, label %45, label %23

23:                                               ; preds = %17
  %24 = load i32, ptr %13, align 4
  switch i32 %24, label %45 [
    i32 22, label %25
    i32 2, label %25
  ]

25:                                               ; preds = %23, %23
  store i32 0, ptr %13, align 4, !tbaa !21
  br i1 %.not, label %40, label %26

26:                                               ; preds = %25
  %27 = getelementptr inbounds i32, ptr %2, i64 %indvars.iv
  %28 = load i32, ptr %27, align 4, !tbaa !18
  %29 = load i32, ptr %14, align 8, !tbaa !23
  %30 = add i32 %29, -2
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [20 x i32], ptr %15, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !18
  %34 = call noundef i32 @_Z17tensorNumElements10TensorDesc(ptr noundef nonnull byval(%struct.TensorDesc) align 8 %5)
  %35 = udiv i32 %34, %33
  %36 = mul i32 %35, %33
  %.not53 = icmp eq i32 %28, %36
  br i1 %.not53, label %40, label %37

37:                                               ; preds = %26
  %38 = udiv i32 %28, %35
  %39 = getelementptr inbounds [20 x i32], ptr %16, i64 0, i64 %31
  store i32 %38, ptr %39, align 4, !tbaa !18
  br label %40

40:                                               ; preds = %26, %37, %25
  %41 = getelementptr inbounds i8, ptr %20, i64 224
  %42 = load ptr, ptr %41, align 8, !tbaa !24
  %43 = load ptr, ptr %18, align 8, !tbaa !12
  %44 = call noundef i32 @_Z15transformToNCHW10TensorDescPKvS_Pv(ptr noundef nonnull byval(%struct.TensorDesc) align 8 %5, ptr noundef %42, ptr noundef nonnull byval(%struct.TensorDesc) align 8 %6, ptr noundef %43)
  %.not54 = icmp eq i32 %44, 0
  br i1 %.not54, label %select.unfold, label %69

45:                                               ; preds = %17, %23
  br i1 %.not, label %63, label %46

46:                                               ; preds = %45
  %47 = getelementptr inbounds i32, ptr %2, i64 %indvars.iv
  %48 = load i32, ptr %47, align 4, !tbaa !18
  %49 = call noundef i32 @_Z17tensorNumElements10TensorDesc(ptr noundef nonnull byval(%struct.TensorDesc) align 8 %5)
  %.not56 = icmp eq i32 %48, %49
  br i1 %.not56, label %63, label %50

50:                                               ; preds = %46
  %51 = getelementptr inbounds i32, ptr %2, i64 %indvars.iv
  %52 = trunc nuw nsw i64 %indvars.iv to i32
  %53 = call i64 (i64, ...) @syscall(i64 noundef 186) #10
  %54 = trunc i64 %53 to i32
  %55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %54)
  %56 = load ptr, ptr @stdout, align 8, !tbaa !12
  %57 = call i32 @fflush(ptr noundef %56)
  %58 = load i32, ptr %51, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #10
  call void @_Z14tensorDesc2StrB5cxx1110TensorDesc(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %7, ptr noundef nonnull byval(%struct.TensorDesc) align 8 %5)
  %59 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %7) #10
  %60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.25, i32 noundef %52, i32 noundef %58, ptr noundef %59)
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #10
  %61 = load ptr, ptr @stdout, align 8, !tbaa !12
  %62 = call i32 @fflush(ptr noundef %61)
  call void @exit(i32 noundef 1) #11
  unreachable

63:                                               ; preds = %46, %45
  %64 = load ptr, ptr %18, align 8, !tbaa !12
  %65 = getelementptr inbounds i8, ptr %20, i64 224
  %66 = load ptr, ptr %65, align 8, !tbaa !24
  %67 = call noundef i32 @_Z14tensorNumBytes10TensorDesc(ptr noundef nonnull byval(%struct.TensorDesc) align 8 %5)
  %68 = zext i32 %67 to i64
  call void @_Z10UNI_MEMCPYPvPKvm(ptr noundef %64, ptr noundef %66, i64 noundef %68)
  br label %select.unfold

69:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 92, ptr nonnull %6) #10
  call void @llvm.lifetime.end.p0(i64 92, ptr nonnull %5) #10
  br label %.loopexit

select.unfold:                                    ; preds = %40, %63
  call void @llvm.lifetime.end.p0(i64 92, ptr nonnull %6) #10
  call void @llvm.lifetime.end.p0(i64 92, ptr nonnull %5) #10
  %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 %.loopexit, label %17, !llvm.loop !26

.loopexit:                                        ; preds = %select.unfold, %69, %4
  %.5 = phi i32 [ 0, %4 ], [ 1, %69 ], [ 0, %select.unfold ]
  ret i32 %.5
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z19DataDesc2TensorDesc8DataDesc(ptr dead_on_unwind noalias writable sret(%struct.TensorDesc) align 4, ptr noundef byval(%struct.DataDesc) align 8) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z17tensorNumElements10TensorDesc(ptr noundef byval(%struct.TensorDesc) align 8) local_unnamed_addr #0

declare noundef i32 @_Z15transformToNCHW10TensorDescPKvS_Pv(ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef, ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef) local_unnamed_addr #9

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z14tensorDesc2StrB5cxx1110TensorDesc(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef byval(%struct.TensorDesc) align 8) local_unnamed_addr #7

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z14tensorNumBytes10TensorDesc(ptr noundef byval(%struct.TensorDesc) align 8) local_unnamed_addr #7

attributes #0 = { inlinehint mustprogress 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 = { mustprogress 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 #6 = { noreturn 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 = { inlinehint mustprogress 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 #8 = { mustprogress 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 #9 = { "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 #10 = { nounwind }
attributes #11 = { noreturn nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 8}
!6 = !{!"_ZTS17ResultHandleInner", !7, i64 0, !10, i64 8, !11, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_ZTS13HARDWARE_TYPE", !8, i64 0}
!12 = !{!10, !10, i64 0}
!13 = !{i64 0, i64 4, !14, i64 4, i64 4, !16, i64 8, i64 4, !18, i64 12, i64 80, !19}
!14 = !{!15, !15, i64 0}
!15 = !{!"_ZTS8DataType", !8, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"_ZTS10DataFormat", !8, i64 0}
!18 = !{!7, !7, i64 0}
!19 = !{!8, !8, i64 0}
!20 = !{!6, !11, i64 16}
!21 = !{!22, !17, i64 4}
!22 = !{!"_ZTS10TensorDesc", !15, i64 0, !17, i64 4, !7, i64 8, !8, i64 12}
!23 = !{!22, !7, i64 8}
!24 = !{!25, !10, i64 224}
!25 = !{!"_ZTS8DataDesc", !15, i64 0, !17, i64 4, !7, i64 8, !8, i64 12, !8, i64 92, !10, i64 224}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


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