; LLVM IR from OAID/AutoKernel :: autokernel_plugin/tests/common/tengine_operations.ll (Z6imreadPKciiPfS1_9FUNCSTYLE)

; 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.image = type { i32, i32, i32, ptr }

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

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

; 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) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10make_imageiii(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z12imread2caffe5imageiiPfS0_(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef byval(%struct.image) align 8, i32 noundef, i32 noundef, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z10free_image5image(ptr noundef byval(%struct.image) align 8) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z12imread2mxnet5imageiiPfS0_(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef byval(%struct.image) align 8, i32 noundef, i32 noundef, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13imread2tflite5imageiiPfS0_(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef byval(%struct.image) align 8, i32 noundef, i32 noundef, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6imreadPKciiPfS1_9FUNCSTYLE(ptr dead_on_unwind noalias writable sret(%struct.image) align 8 %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5, i32 noundef %6) #2 {
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca %struct.image, align 8
  %15 = alloca i32, align 4
  %16 = alloca %struct.image, align 8
  %17 = alloca %struct.image, align 8
  %18 = alloca %struct.image, align 8
  %19 = alloca %struct.image, align 8
  %20 = alloca %struct.image, align 8
  %21 = alloca %struct.image, align 8
  %22 = alloca %struct.image, align 8
  %23 = alloca i32, align 4
  %24 = alloca %struct.image, align 8
  %25 = alloca %struct.image, align 8
  %26 = alloca %struct.image, align 8
  %27 = alloca %struct.image, align 8
  %28 = alloca %struct.image, align 8
  %29 = alloca %struct.image, align 8
  %30 = alloca %struct.image, align 8
  %31 = alloca %struct.image, align 8
  %32 = alloca %struct.image, align 8
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i32 %2, ptr %9, align 4, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  store i32 %6, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #4
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_Z6imreadPKc(ptr dead_on_unwind writable sret(%struct.image) align 8 %14, ptr noundef %33)
  %34 = load i32, ptr %9, align 4, !tbaa !9
  %35 = load i32, ptr %10, align 4, !tbaa !9
  %36 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 2
  %37 = load i32, ptr %36, align 8, !tbaa !13
  call void @_Z10make_imageiii(ptr dead_on_unwind writable sret(%struct.image) align 8 %0, i32 noundef %34, i32 noundef %35, i32 noundef %37)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 0, ptr %15, align 4, !tbaa !9
  %38 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 2
  %39 = load i32, ptr %38, align 8, !tbaa !13
  %40 = icmp eq i32 %39, 1
  br i1 %40, label %41, label %42

41:                                               ; preds = %7
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %43

42:                                               ; preds = %7
  store i32 2, ptr %15, align 4, !tbaa !9
  br label %43

43:                                               ; preds = %42, %41
  %44 = load i32, ptr %15, align 4, !tbaa !9
  switch i32 %44, label %52 [
    i32 0, label %45
    i32 1, label %46
    i32 2, label %47
  ]

45:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %17, ptr align 8 %14, i64 24, i1 false), !tbaa.struct !15
  call void @_Z8gray2bgr5image(ptr dead_on_unwind writable sret(%struct.image) align 8 %16, ptr noundef byval(%struct.image) align 8 %17)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %14, ptr align 8 %16, i64 24, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #4
  br label %53

46:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 24, ptr %18) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 %14, i64 24, i1 false), !tbaa.struct !15
  call void @_Z8rgb2gray5image(ptr dead_on_unwind writable sret(%struct.image) align 8 %18, ptr noundef byval(%struct.image) align 8 %19)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %14, ptr align 8 %18, i64 24, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 24, ptr %18) #4
  br label %53

47:                                               ; preds = %43
  %48 = load i32, ptr %13, align 4, !tbaa !11
  %49 = icmp ne i32 %48, 2
  br i1 %49, label %50, label %51

50:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 24, ptr %20) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %21, ptr align 8 %14, i64 24, i1 false), !tbaa.struct !15
  call void @_Z15rgb2bgr_premute5image(ptr dead_on_unwind writable sret(%struct.image) align 8 %20, ptr noundef byval(%struct.image) align 8 %21)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %14, ptr align 8 %20, i64 24, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #4
  br label %51

51:                                               ; preds = %50, %47
  br label %53

52:                                               ; preds = %43
  br label %53

53:                                               ; preds = %52, %51, %46, %45
  %54 = load i32, ptr %13, align 4, !tbaa !11
  switch i32 %54, label %138 [
    i32 0, label %55
    i32 1, label %70
    i32 2, label %87
    i32 3, label %104
    i32 4, label %121
  ]

55:                                               ; preds = %53
  %56 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 3
  %57 = load ptr, ptr %56, align 8, !tbaa !16
  %58 = getelementptr inbounds %struct.image, ptr %0, i32 0, i32 3
  %59 = load ptr, ptr %58, align 8, !tbaa !16
  %60 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 0
  %61 = load i32, ptr %60, align 8, !tbaa !17
  %62 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 1
  %63 = load i32, ptr %62, align 4, !tbaa !18
  %64 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 2
  %65 = load i32, ptr %64, align 8, !tbaa !13
  %66 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 1
  %67 = load i32, ptr %66, align 4, !tbaa !18
  %68 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 0
  %69 = load i32, ptr %68, align 8, !tbaa !17
  call void @_Z14tengine_resizeIfEvPT_Pfiiiii(ptr noundef %57, ptr noundef %59, i32 noundef %61, i32 noundef %63, i32 noundef %65, i32 noundef %67, i32 noundef %69)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %22, ptr align 8 %14, i64 24, i1 false), !tbaa.struct !15
  call void @_Z10free_image5image(ptr noundef byval(%struct.image) align 8 %22)
  store i32 1, ptr %23, align 4
  br label %140

70:                                               ; preds = %53
  %71 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 3
  %72 = load ptr, ptr %71, align 8, !tbaa !16
  %73 = getelementptr inbounds %struct.image, ptr %0, i32 0, i32 3
  %74 = load ptr, ptr %73, align 8, !tbaa !16
  %75 = load i32, ptr %9, align 4, !tbaa !9
  %76 = load i32, ptr %10, align 4, !tbaa !9
  %77 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 2
  %78 = load i32, ptr %77, align 8, !tbaa !13
  %79 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 1
  %80 = load i32, ptr %79, align 4, !tbaa !18
  %81 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 0
  %82 = load i32, ptr %81, align 8, !tbaa !17
  call void @_Z14tengine_resizeIfEvPT_Pfiiiii(ptr noundef %72, ptr noundef %74, i32 noundef %75, i32 noundef %76, i32 noundef %78, i32 noundef %80, i32 noundef %82)
  call void @llvm.lifetime.start.p0(i64 24, ptr %24) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %25, ptr align 8 %0, i64 24, i1 false), !tbaa.struct !15
  %83 = load i32, ptr %9, align 4, !tbaa !9
  %84 = load i32, ptr %10, align 4, !tbaa !9
  %85 = load ptr, ptr %11, align 8, !tbaa !5
  %86 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_Z12imread2caffe5imageiiPfS0_(ptr dead_on_unwind writable sret(%struct.image) align 8 %24, ptr noundef byval(%struct.image) align 8 %25, i32 noundef %83, i32 noundef %84, ptr noundef %85, ptr noundef %86)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %0, ptr align 8 %24, i64 24, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 24, ptr %24) #4
  br label %139

87:                                               ; preds = %53
  %88 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 3
  %89 = load ptr, ptr %88, align 8, !tbaa !16
  %90 = getelementptr inbounds %struct.image, ptr %0, i32 0, i32 3
  %91 = load ptr, ptr %90, align 8, !tbaa !16
  %92 = load i32, ptr %9, align 4, !tbaa !9
  %93 = load i32, ptr %10, align 4, !tbaa !9
  %94 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 2
  %95 = load i32, ptr %94, align 8, !tbaa !13
  %96 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 1
  %97 = load i32, ptr %96, align 4, !tbaa !18
  %98 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 0
  %99 = load i32, ptr %98, align 8, !tbaa !17
  call void @_Z14tengine_resizeIfEvPT_Pfiiiii(ptr noundef %89, ptr noundef %91, i32 noundef %92, i32 noundef %93, i32 noundef %95, i32 noundef %97, i32 noundef %99)
  call void @llvm.lifetime.start.p0(i64 24, ptr %26) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %27, ptr align 8 %0, i64 24, i1 false), !tbaa.struct !15
  %100 = load i32, ptr %9, align 4, !tbaa !9
  %101 = load i32, ptr %10, align 4, !tbaa !9
  %102 = load ptr, ptr %11, align 8, !tbaa !5
  %103 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_Z12imread2caffe5imageiiPfS0_(ptr dead_on_unwind writable sret(%struct.image) align 8 %26, ptr noundef byval(%struct.image) align 8 %27, i32 noundef %100, i32 noundef %101, ptr noundef %102, ptr noundef %103)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %0, ptr align 8 %26, i64 24, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 24, ptr %26) #4
  br label %139

104:                                              ; preds = %53
  %105 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 3
  %106 = load ptr, ptr %105, align 8, !tbaa !16
  %107 = getelementptr inbounds %struct.image, ptr %0, i32 0, i32 3
  %108 = load ptr, ptr %107, align 8, !tbaa !16
  %109 = load i32, ptr %9, align 4, !tbaa !9
  %110 = load i32, ptr %10, align 4, !tbaa !9
  %111 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 2
  %112 = load i32, ptr %111, align 8, !tbaa !13
  %113 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 1
  %114 = load i32, ptr %113, align 4, !tbaa !18
  %115 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 0
  %116 = load i32, ptr %115, align 8, !tbaa !17
  call void @_Z14tengine_resizeIfEvPT_Pfiiiii(ptr noundef %106, ptr noundef %108, i32 noundef %109, i32 noundef %110, i32 noundef %112, i32 noundef %114, i32 noundef %116)
  call void @llvm.lifetime.start.p0(i64 24, ptr %28) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %29, ptr align 8 %0, i64 24, i1 false), !tbaa.struct !15
  %117 = load i32, ptr %9, align 4, !tbaa !9
  %118 = load i32, ptr %10, align 4, !tbaa !9
  %119 = load ptr, ptr %11, align 8, !tbaa !5
  %120 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_Z12imread2mxnet5imageiiPfS0_(ptr dead_on_unwind writable sret(%struct.image) align 8 %28, ptr noundef byval(%struct.image) align 8 %29, i32 noundef %117, i32 noundef %118, ptr noundef %119, ptr noundef %120)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %0, ptr align 8 %28, i64 24, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 24, ptr %28) #4
  br label %139

121:                                              ; preds = %53
  %122 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 3
  %123 = load ptr, ptr %122, align 8, !tbaa !16
  %124 = getelementptr inbounds %struct.image, ptr %0, i32 0, i32 3
  %125 = load ptr, ptr %124, align 8, !tbaa !16
  %126 = load i32, ptr %9, align 4, !tbaa !9
  %127 = load i32, ptr %10, align 4, !tbaa !9
  %128 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 2
  %129 = load i32, ptr %128, align 8, !tbaa !13
  %130 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 1
  %131 = load i32, ptr %130, align 4, !tbaa !18
  %132 = getelementptr inbounds %struct.image, ptr %14, i32 0, i32 0
  %133 = load i32, ptr %132, align 8, !tbaa !17
  call void @_Z14tengine_resizeIfEvPT_Pfiiiii(ptr noundef %123, ptr noundef %125, i32 noundef %126, i32 noundef %127, i32 noundef %129, i32 noundef %131, i32 noundef %133)
  call void @llvm.lifetime.start.p0(i64 24, ptr %30) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %31, ptr align 8 %0, i64 24, i1 false), !tbaa.struct !15
  %134 = load i32, ptr %9, align 4, !tbaa !9
  %135 = load i32, ptr %10, align 4, !tbaa !9
  %136 = load ptr, ptr %11, align 8, !tbaa !5
  %137 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_Z13imread2tflite5imageiiPfS0_(ptr dead_on_unwind writable sret(%struct.image) align 8 %30, ptr noundef byval(%struct.image) align 8 %31, i32 noundef %134, i32 noundef %135, ptr noundef %136, ptr noundef %137)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %0, ptr align 8 %30, i64 24, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 24, ptr %30) #4
  br label %138

138:                                              ; preds = %121, %53
  br label %139

139:                                              ; preds = %138, %104, %87, %70
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %32, ptr align 8 %14, i64 24, i1 false), !tbaa.struct !15
  call void @_Z10free_image5image(ptr noundef byval(%struct.image) align 8 %32)
  store i32 1, ptr %23, align 4
  br label %140

140:                                              ; preds = %139, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #4
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6imreadPKc(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8gray2bgr5image(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef byval(%struct.image) align 8) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8rgb2gray5image(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef byval(%struct.image) align 8) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z15rgb2bgr_premute5image(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef byval(%struct.image) align 8) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z14tengine_resizeIfEvPT_Pfiiiii(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_ZTS9FUNCSTYLE", !7, i64 0}
!13 = !{!14, !10, i64 8}
!14 = !{!"_ZTS5image", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16}
!15 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 4, !9, i64 16, i64 8, !5}
!16 = !{!14, !6, i64 16}
!17 = !{!14, !10, i64 0}
!18 = !{!14, !10, i64 4}


; 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.image = type { i32, i32, i32, ptr }

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

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

; 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) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10make_imageiii(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z12imread2caffe5imageiiPfS0_(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef byval(%struct.image) align 8, i32 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z10free_image5image(ptr noundef byval(%struct.image) align 8) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z12imread2mxnet5imageiiPfS0_(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef byval(%struct.image) align 8, i32 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13imread2tflite5imageiiPfS0_(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef byval(%struct.image) align 8, i32 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6imreadPKciiPfS1_9FUNCSTYLE(ptr dead_on_unwind noalias writable sret(%struct.image) align 8 %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5, i32 noundef %6) local_unnamed_addr #2 {
  %8 = alloca %struct.image, align 8
  %9 = alloca %struct.image, align 8
  %10 = alloca %struct.image, align 8
  %11 = alloca %struct.image, align 8
  %12 = alloca %struct.image, align 8
  %13 = alloca %struct.image, align 8
  %14 = alloca %struct.image, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #4
  call void @_Z6imreadPKc(ptr dead_on_unwind nonnull writable sret(%struct.image) align 8 %8, ptr noundef %1)
  %15 = getelementptr inbounds i8, ptr %8, i64 8
  %16 = load i32, ptr %15, align 8, !tbaa !5
  call void @_Z10make_imageiii(ptr dead_on_unwind writable sret(%struct.image) align 8 %0, i32 noundef %2, i32 noundef %3, i32 noundef %16)
  %17 = load i32, ptr %15, align 8, !tbaa !5
  %18 = icmp eq i32 %17, 1
  br i1 %18, label %19, label %20

19:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #4
  call void @_Z8gray2bgr5image(ptr dead_on_unwind nonnull writable sret(%struct.image) align 8 %9, ptr noundef nonnull byval(%struct.image) align 8 %8)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %9, i64 24, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #4
  br label %22

20:                                               ; preds = %7
  %cond = icmp eq i32 %6, 2
  br i1 %cond, label %41, label %21

21:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #4
  call void @_Z15rgb2bgr_premute5image(ptr dead_on_unwind nonnull writable sret(%struct.image) align 8 %10, ptr noundef nonnull byval(%struct.image) align 8 %8)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %10, i64 24, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #4
  br label %22

22:                                               ; preds = %21, %19
  switch i32 %6, label %68 [
    i32 0, label %23
    i32 1, label %32
    i32 2, label %._crit_edge
    i32 3, label %50
    i32 4, label %59
  ]

._crit_edge:                                      ; preds = %22
  %.pre = load i32, ptr %15, align 8, !tbaa !5
  br label %41

23:                                               ; preds = %22
  %24 = getelementptr inbounds i8, ptr %8, i64 16
  %25 = load ptr, ptr %24, align 8, !tbaa !14
  %26 = getelementptr inbounds i8, ptr %0, i64 16
  %27 = load ptr, ptr %26, align 8, !tbaa !14
  %28 = load i32, ptr %8, align 8, !tbaa !15
  %29 = getelementptr inbounds i8, ptr %8, i64 4
  %30 = load i32, ptr %29, align 4, !tbaa !16
  %31 = load i32, ptr %15, align 8, !tbaa !5
  call void @_Z14tengine_resizeIfEvPT_Pfiiiii(ptr noundef %25, ptr noundef %27, i32 noundef %28, i32 noundef %30, i32 noundef %31, i32 noundef %30, i32 noundef %28)
  br label %68

32:                                               ; preds = %22
  %33 = getelementptr inbounds i8, ptr %8, i64 16
  %34 = load ptr, ptr %33, align 8, !tbaa !14
  %35 = getelementptr inbounds i8, ptr %0, i64 16
  %36 = load ptr, ptr %35, align 8, !tbaa !14
  %37 = load i32, ptr %15, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %8, i64 4
  %39 = load i32, ptr %38, align 4, !tbaa !16
  %40 = load i32, ptr %8, align 8, !tbaa !15
  call void @_Z14tengine_resizeIfEvPT_Pfiiiii(ptr noundef %34, ptr noundef %36, i32 noundef %2, i32 noundef %3, i32 noundef %37, i32 noundef %39, i32 noundef %40)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #4
  call void @_Z12imread2caffe5imageiiPfS0_(ptr dead_on_unwind nonnull writable sret(%struct.image) align 8 %11, ptr noundef nonnull byval(%struct.image) align 8 %0, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %11, i64 24, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #4
  br label %68

41:                                               ; preds = %._crit_edge, %20
  %42 = phi i32 [ %.pre, %._crit_edge ], [ %17, %20 ]
  %43 = getelementptr inbounds i8, ptr %8, i64 16
  %44 = load ptr, ptr %43, align 8, !tbaa !14
  %45 = getelementptr inbounds i8, ptr %0, i64 16
  %46 = load ptr, ptr %45, align 8, !tbaa !14
  %47 = getelementptr inbounds i8, ptr %8, i64 4
  %48 = load i32, ptr %47, align 4, !tbaa !16
  %49 = load i32, ptr %8, align 8, !tbaa !15
  call void @_Z14tengine_resizeIfEvPT_Pfiiiii(ptr noundef %44, ptr noundef %46, i32 noundef %2, i32 noundef %3, i32 noundef %42, i32 noundef %48, i32 noundef %49)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %12) #4
  call void @_Z12imread2caffe5imageiiPfS0_(ptr dead_on_unwind nonnull writable sret(%struct.image) align 8 %12, ptr noundef nonnull byval(%struct.image) align 8 %0, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %12, i64 24, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #4
  br label %68

50:                                               ; preds = %22
  %51 = getelementptr inbounds i8, ptr %8, i64 16
  %52 = load ptr, ptr %51, align 8, !tbaa !14
  %53 = getelementptr inbounds i8, ptr %0, i64 16
  %54 = load ptr, ptr %53, align 8, !tbaa !14
  %55 = load i32, ptr %15, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %8, i64 4
  %57 = load i32, ptr %56, align 4, !tbaa !16
  %58 = load i32, ptr %8, align 8, !tbaa !15
  call void @_Z14tengine_resizeIfEvPT_Pfiiiii(ptr noundef %52, ptr noundef %54, i32 noundef %2, i32 noundef %3, i32 noundef %55, i32 noundef %57, i32 noundef %58)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %13) #4
  call void @_Z12imread2mxnet5imageiiPfS0_(ptr dead_on_unwind nonnull writable sret(%struct.image) align 8 %13, ptr noundef nonnull byval(%struct.image) align 8 %0, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %13, i64 24, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %13) #4
  br label %68

59:                                               ; preds = %22
  %60 = getelementptr inbounds i8, ptr %8, i64 16
  %61 = load ptr, ptr %60, align 8, !tbaa !14
  %62 = getelementptr inbounds i8, ptr %0, i64 16
  %63 = load ptr, ptr %62, align 8, !tbaa !14
  %64 = load i32, ptr %15, align 8, !tbaa !5
  %65 = getelementptr inbounds i8, ptr %8, i64 4
  %66 = load i32, ptr %65, align 4, !tbaa !16
  %67 = load i32, ptr %8, align 8, !tbaa !15
  call void @_Z14tengine_resizeIfEvPT_Pfiiiii(ptr noundef %61, ptr noundef %63, i32 noundef %2, i32 noundef %3, i32 noundef %64, i32 noundef %66, i32 noundef %67)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %14) #4
  call void @_Z13imread2tflite5imageiiPfS0_(ptr dead_on_unwind nonnull writable sret(%struct.image) align 8 %14, ptr noundef nonnull byval(%struct.image) align 8 %0, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %14, i64 24, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %14) #4
  br label %68

68:                                               ; preds = %32, %41, %50, %59, %22, %23
  call void @_Z10free_image5image(ptr noundef nonnull byval(%struct.image) align 8 %8)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #4
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6imreadPKc(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8gray2bgr5image(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef byval(%struct.image) align 8) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z15rgb2bgr_premute5image(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef byval(%struct.image) align 8) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z14tengine_resizeIfEvPT_Pfiiiii(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #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, !7, i64 8}
!6 = !{!"_ZTS5image", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{i64 0, i64 4, !12, i64 4, i64 4, !12, i64 8, i64 4, !12, i64 16, i64 8, !13}
!12 = !{!7, !7, i64 0}
!13 = !{!10, !10, i64 0}
!14 = !{!6, !10, i64 16}
!15 = !{!6, !7, i64 0}
!16 = !{!6, !7, i64 4}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass