; LLVM IR from jingweizhanghuai/Morn :: src/image (morn_image)

; 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.__va_list_tag = type { i32, i32, ptr, ptr }
%struct.MImage = type { i32, i32, i32, [4 x ptr], ptr }
%struct.MHandle = type { i32, i32, ptr, ptr }
%struct.HandleImageChannelSplit = type { [64 x i32], [64 x ptr], i32 }

@.str = external hidden unnamed_addr constant [78 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [22 x i8], align 1
@__FUNCTION__.mImageChannelSplit = external hidden unnamed_addr constant [19 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [20 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

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

; 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: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare dso_local ptr @ImageCreate(i32 noundef, i32 noundef, i32 noundef, ptr noundef) #3

declare ptr @GetHandle(ptr noundef, i32 noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @endImageChannelSplit(ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local ptr @mImageChannelSplit(ptr noundef %0, i32 noundef %1, ...) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca [4 x i32], align 16
  %11 = alloca [4 x ptr], align 16
  %12 = alloca [1 x %struct.__va_list_tag], align 16
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = icmp eq ptr %20, null
  br i1 %21, label %26, label %22

22:                                               ; preds = %19
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = ptrtoint ptr %23 to i64
  %25 = icmp eq i64 %24, -1
  br i1 %25, label %26, label %27

26:                                               ; preds = %22, %19
  br label %56

27:                                               ; preds = %22
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.MImage, ptr %28, i32 0, i32 3
  %30 = getelementptr inbounds [4 x ptr], ptr %29, i64 0, i64 0
  %31 = icmp eq ptr %30, null
  br i1 %31, label %53, label %32

32:                                               ; preds = %27
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.MImage, ptr %33, i32 0, i32 3
  %35 = getelementptr inbounds [4 x ptr], ptr %34, i64 0, i64 0
  %36 = ptrtoint ptr %35 to i64
  %37 = icmp eq i64 %36, -1
  br i1 %37, label %53, label %38

38:                                               ; preds = %32
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.MImage, ptr %39, i32 0, i32 0
  %41 = load i32, ptr %40, align 8, !tbaa !11
  %42 = icmp sle i32 %41, 0
  br i1 %42, label %53, label %43

43:                                               ; preds = %38
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.MImage, ptr %44, i32 0, i32 1
  %46 = load i32, ptr %45, align 4, !tbaa !13
  %47 = icmp sle i32 %46, 0
  br i1 %47, label %53, label %48

48:                                               ; preds = %43
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.MImage, ptr %49, i32 0, i32 2
  %51 = load i32, ptr %50, align 8, !tbaa !14
  %52 = icmp sle i32 %51, 0
  br label %53

53:                                               ; preds = %48, %43, %38, %32, %27
  %54 = phi i1 [ true, %43 ], [ true, %38 ], [ true, %32 ], [ true, %27 ], [ %52, %48 ]
  %55 = zext i1 %54 to i32
  br label %56

56:                                               ; preds = %53, %26
  %57 = phi i32 [ 1, %26 ], [ %55, %53 ]
  store i32 %57, ptr %6, align 4, !tbaa !9
  %58 = load i32, ptr %6, align 4, !tbaa !9
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %62

60:                                               ; preds = %56
  %61 = load i32, ptr %6, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %61, i32 noundef -1, ptr noundef @.str, i32 noundef 762, ptr noundef @__FUNCTION__.mImageChannelSplit, ptr noundef @.str.15)
  br label %62

62:                                               ; preds = %60, %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %63

63:                                               ; preds = %62
  br label %64

64:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %65 = load i32, ptr %5, align 4, !tbaa !9
  %66 = icmp sge i32 %65, 4
  %67 = zext i1 %66 to i32
  store i32 %67, ptr %7, align 4, !tbaa !9
  %68 = load i32, ptr %7, align 4, !tbaa !9
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %70, label %72

70:                                               ; preds = %64
  %71 = load i32, ptr %7, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %71, i32 noundef -1, ptr noundef @.str, i32 noundef 763, ptr noundef @__FUNCTION__.mImageChannelSplit, ptr noundef @.str.2)
  br label %72

72:                                               ; preds = %70, %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %73

73:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = call ptr @GetHandle(ptr noundef %74, i32 noundef 776, i32 noundef 1105239643, ptr noundef @endImageChannelSplit)
  store ptr %75, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.MHandle, ptr %76, i32 0, i32 3
  %78 = load ptr, ptr %77, align 8, !tbaa !15
  store ptr %78, ptr %9, align 8, !tbaa !5
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.MHandle, ptr %79, i32 0, i32 1
  store volatile i32 1, ptr %80, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #5
  call void @llvm.memset.p0.i64(ptr align 16 %10, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #5
  %81 = getelementptr inbounds [1 x %struct.__va_list_tag], ptr %12, i64 0, i64 0
  call void @llvm.va_start.p0(ptr %81)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %121, %73
  %83 = load i32, ptr %13, align 4, !tbaa !9
  %84 = load i32, ptr %5, align 4, !tbaa !9
  %85 = icmp slt i32 %83, %84
  br i1 %85, label %87, label %86

86:                                               ; preds = %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %124

87:                                               ; preds = %82
  %88 = getelementptr inbounds [1 x %struct.__va_list_tag], ptr %12, i64 0, i64 0
  %89 = getelementptr inbounds %struct.__va_list_tag, ptr %88, i32 0, i32 0
  %90 = load i32, ptr %89, align 16
  %91 = icmp ule i32 %90, 40
  br i1 %91, label %92, label %97

92:                                               ; preds = %87
  %93 = getelementptr inbounds %struct.__va_list_tag, ptr %88, i32 0, i32 3
  %94 = load ptr, ptr %93, align 16
  %95 = getelementptr i8, ptr %94, i32 %90
  %96 = add i32 %90, 8
  store i32 %96, ptr %89, align 16
  br label %101

97:                                               ; preds = %87
  %98 = getelementptr inbounds %struct.__va_list_tag, ptr %88, i32 0, i32 2
  %99 = load ptr, ptr %98, align 8
  %100 = getelementptr i8, ptr %99, i32 8
  store ptr %100, ptr %98, align 8
  br label %101

101:                                              ; preds = %97, %92
  %102 = phi ptr [ %95, %92 ], [ %99, %97 ]
  %103 = load i32, ptr %102, align 4, !tbaa !9
  %104 = load i32, ptr %13, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [4 x i32], ptr %10, i64 0, i64 %105
  store i32 %103, ptr %106, align 4, !tbaa !9
  br label %107

107:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %108 = load i32, ptr %13, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [4 x i32], ptr %10, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !9
  %112 = icmp sge i32 %111, 4
  %113 = zext i1 %112 to i32
  store i32 %113, ptr %14, align 4, !tbaa !9
  %114 = load i32, ptr %14, align 4, !tbaa !9
  %115 = icmp ne i32 %114, 0
  br i1 %115, label %116, label %118

116:                                              ; preds = %107
  %117 = load i32, ptr %14, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %117, i32 noundef -1, ptr noundef @.str, i32 noundef 772, ptr noundef @__FUNCTION__.mImageChannelSplit, ptr noundef @.str.7)
  br label %118

118:                                              ; preds = %116, %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %119

119:                                              ; preds = %118
  br label %120

120:                                              ; preds = %119
  br label %121

121:                                              ; preds = %120
  %122 = load i32, ptr %13, align 4, !tbaa !9
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %13, align 4, !tbaa !9
  br label %82, !llvm.loop !18

124:                                              ; preds = %86
  %125 = getelementptr inbounds [1 x %struct.__va_list_tag], ptr %12, i64 0, i64 0
  call void @llvm.va_end.p0(ptr %125)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %126 = getelementptr inbounds [4 x i32], ptr %10, i64 0, i64 0
  %127 = load i32, ptr %126, align 16, !tbaa !9
  %128 = add nsw i32 %127, 1
  %129 = shl i32 %128, 24
  %130 = getelementptr inbounds [4 x i32], ptr %10, i64 0, i64 1
  %131 = load i32, ptr %130, align 4, !tbaa !9
  %132 = add nsw i32 %131, 1
  %133 = shl i32 %132, 16
  %134 = add nsw i32 %129, %133
  %135 = getelementptr inbounds [4 x i32], ptr %10, i64 0, i64 2
  %136 = load i32, ptr %135, align 8, !tbaa !9
  %137 = add nsw i32 %136, 1
  %138 = shl i32 %137, 8
  %139 = add nsw i32 %134, %138
  %140 = getelementptr inbounds [4 x i32], ptr %10, i64 0, i64 3
  %141 = load i32, ptr %140, align 4, !tbaa !9
  %142 = add nsw i32 %141, 1
  %143 = add nsw i32 %139, %142
  store i32 %143, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %144

144:                                              ; preds = %168, %124
  %145 = load i32, ptr %16, align 4, !tbaa !9
  %146 = load ptr, ptr %9, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.HandleImageChannelSplit, ptr %146, i32 0, i32 2
  %148 = load i32, ptr %147, align 8, !tbaa !20
  %149 = icmp slt i32 %145, %148
  br i1 %149, label %151, label %150

150:                                              ; preds = %144
  store i32 11, ptr %17, align 4
  br label %171

151:                                              ; preds = %144
  %152 = load i32, ptr %15, align 4, !tbaa !9
  %153 = load ptr, ptr %9, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.HandleImageChannelSplit, ptr %153, i32 0, i32 0
  %155 = load i32, ptr %16, align 4, !tbaa !9
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [64 x i32], ptr %154, i64 0, i64 %156
  %158 = load i32, ptr %157, align 4, !tbaa !9
  %159 = icmp eq i32 %152, %158
  br i1 %159, label %160, label %167

160:                                              ; preds = %151
  %161 = load ptr, ptr %9, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.HandleImageChannelSplit, ptr %161, i32 0, i32 1
  %163 = load i32, ptr %16, align 4, !tbaa !9
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [64 x ptr], ptr %162, i64 0, i64 %164
  %166 = load ptr, ptr %165, align 8, !tbaa !5
  store ptr %166, ptr %3, align 8
  store i32 1, ptr %17, align 4
  br label %171

167:                                              ; preds = %151
  br label %168

168:                                              ; preds = %167
  %169 = load i32, ptr %16, align 4, !tbaa !9
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %16, align 4, !tbaa !9
  br label %144, !llvm.loop !22

171:                                              ; preds = %160, %150
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  %172 = load i32, ptr %17, align 4
  switch i32 %172, label %208 [
    i32 11, label %173
  ]

173:                                              ; preds = %171
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %174 = load ptr, ptr %9, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.HandleImageChannelSplit, ptr %174, i32 0, i32 2
  %176 = load i32, ptr %175, align 8, !tbaa !20
  store i32 %176, ptr %18, align 4, !tbaa !9
  %177 = load i32, ptr %5, align 4, !tbaa !9
  %178 = add nsw i32 %177, 0
  %179 = load ptr, ptr %4, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.MImage, ptr %179, i32 0, i32 1
  %181 = load i32, ptr %180, align 4, !tbaa !13
  %182 = load ptr, ptr %4, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.MImage, ptr %182, i32 0, i32 2
  %184 = load i32, ptr %183, align 8, !tbaa !14
  %185 = getelementptr inbounds [4 x ptr], ptr %11, i64 0, i64 0
  %186 = call ptr @ImageCreate(i32 noundef %178, i32 noundef %181, i32 noundef %184, ptr noundef %185)
  %187 = load ptr, ptr %9, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.HandleImageChannelSplit, ptr %187, i32 0, i32 1
  %189 = load i32, ptr %18, align 4, !tbaa !9
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [64 x ptr], ptr %188, i64 0, i64 %190
  store ptr %186, ptr %191, align 8, !tbaa !5
  %192 = load i32, ptr %15, align 4, !tbaa !9
  %193 = load ptr, ptr %9, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.HandleImageChannelSplit, ptr %193, i32 0, i32 0
  %195 = load i32, ptr %18, align 4, !tbaa !9
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [64 x i32], ptr %194, i64 0, i64 %196
  store i32 %192, ptr %197, align 4, !tbaa !9
  %198 = load i32, ptr %18, align 4, !tbaa !9
  %199 = add nsw i32 %198, 1
  %200 = load ptr, ptr %9, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.HandleImageChannelSplit, ptr %200, i32 0, i32 2
  store i32 %199, ptr %201, align 8, !tbaa !20
  %202 = load ptr, ptr %9, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.HandleImageChannelSplit, ptr %202, i32 0, i32 1
  %204 = load i32, ptr %18, align 4, !tbaa !9
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds [64 x ptr], ptr %203, i64 0, i64 %205
  %207 = load ptr, ptr %206, align 8, !tbaa !5
  store ptr %207, ptr %3, align 8
  store i32 1, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %208

208:                                              ; preds = %173, %171
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %209 = load ptr, ptr %3, align 8
  ret ptr %209
}

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.va_start.p0(ptr) #4

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.va_end.p0(ptr) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { nocallback nofree nosync nounwind willreturn }
attributes #5 = { 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, !10, i64 0}
!12 = !{!"MImage", !10, i64 0, !10, i64 4, !10, i64 8, !7, i64 16, !6, i64 48}
!13 = !{!12, !10, i64 4}
!14 = !{!12, !10, i64 8}
!15 = !{!16, !6, i64 16}
!16 = !{!"MHandle", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16}
!17 = !{!16, !10, i64 4}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!21, !10, i64 768}
!21 = !{!"HandleImageChannelSplit", !7, i64 0, !7, i64 256, !10, i64 768}
!22 = distinct !{!22, !19}


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

@.str = external hidden unnamed_addr constant [78 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [22 x i8], align 1
@__FUNCTION__.mImageChannelSplit = external hidden unnamed_addr constant [19 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [20 x i8], align 1

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

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

; 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: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare dso_local ptr @ImageCreate(i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare ptr @GetHandle(ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @endImageChannelSplit(ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local ptr @mImageChannelSplit(ptr noundef %0, i32 noundef %1, ...) local_unnamed_addr #3 {
  %3 = alloca [4 x i32], align 16
  %4 = alloca [4 x ptr], align 16
  %5 = alloca [1 x %struct.__va_list_tag], align 16
  %magicptr = ptrtoint ptr %0 to i64
  switch i64 %magicptr, label %6 [
    i64 -1, label %.critedge
    i64 0, label %.critedge
  ]

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = icmp eq ptr %7, inttoptr (i64 -1 to ptr)
  br i1 %8, label %.critedge, label %9

9:                                                ; preds = %6
  %10 = load i32, ptr %0, align 8, !tbaa !5
  %11 = icmp slt i32 %10, 1
  br i1 %11, label %.critedge, label %12

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %0, i64 4
  %14 = load i32, ptr %13, align 4, !tbaa !11
  %15 = icmp slt i32 %14, 1
  br i1 %15, label %.critedge, label %16

16:                                               ; preds = %12
  %17 = getelementptr inbounds i8, ptr %0, i64 8
  %18 = load i32, ptr %17, align 8, !tbaa !12
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %20, label %.critedge

.critedge:                                        ; preds = %2, %2, %12, %9, %6, %16
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 762, ptr noundef nonnull @__FUNCTION__.mImageChannelSplit, ptr noundef nonnull @.str.15) #5
  br label %20

20:                                               ; preds = %.critedge, %16
  %21 = icmp sgt i32 %1, 3
  br i1 %21, label %22, label %23

22:                                               ; preds = %20
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 763, ptr noundef nonnull @__FUNCTION__.mImageChannelSplit, ptr noundef nonnull @.str.2) #5
  br label %23

23:                                               ; preds = %22, %20
  %24 = tail call ptr @GetHandle(ptr noundef %0, i32 noundef 776, i32 noundef 1105239643, ptr noundef nonnull @endImageChannelSplit) #5
  %25 = getelementptr inbounds i8, ptr %24, i64 16
  %26 = load ptr, ptr %25, align 8, !tbaa !13
  %27 = getelementptr inbounds i8, ptr %24, i64 4
  store volatile i32 1, ptr %27, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %3, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #5
  call void @llvm.va_start.p0(ptr nonnull %5)
  %28 = icmp sgt i32 %1, 0
  br i1 %28, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %23
  %29 = getelementptr inbounds i8, ptr %5, i64 8
  %30 = getelementptr inbounds i8, ptr %5, i64 16
  %wide.trip.count = zext nneg i32 %1 to i64
  br label %41

._crit_edge.loopexit:                             ; preds = %58
  %.pre = load i32, ptr %3, align 16, !tbaa !16
  %.phi.trans.insert = getelementptr inbounds i8, ptr %3, i64 4
  %.pre77 = load i32, ptr %.phi.trans.insert, align 4, !tbaa !16
  %.phi.trans.insert78 = getelementptr inbounds i8, ptr %3, i64 8
  %.pre79 = load i32, ptr %.phi.trans.insert78, align 8, !tbaa !16
  %.phi.trans.insert80 = getelementptr inbounds i8, ptr %3, i64 12
  %.pre81 = load i32, ptr %.phi.trans.insert80, align 4, !tbaa !16
  %31 = shl i32 %.pre, 24
  %32 = shl i32 %.pre77, 16
  %33 = shl i32 %.pre79, 8
  %34 = add i32 %31, 16843009
  %35 = add i32 %34, %32
  %36 = add i32 %35, %33
  %37 = add i32 %36, %.pre81
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %23
  %38 = phi i32 [ %37, %._crit_edge.loopexit ], [ 16843009, %23 ]
  call void @llvm.va_end.p0(ptr nonnull %5)
  %39 = getelementptr inbounds i8, ptr %26, i64 768
  %40 = load i32, ptr %39, align 8, !tbaa !17
  %.not5865 = icmp sgt i32 %40, 0
  br i1 %.not5865, label %.lr.ph68.preheader, label %._crit_edge69

.lr.ph68.preheader:                               ; preds = %._crit_edge
  %wide.trip.count75 = zext nneg i32 %40 to i64
  br label %.lr.ph68

41:                                               ; preds = %.lr.ph, %58
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %58 ]
  %42 = load i32, ptr %5, align 16
  %43 = icmp ult i32 %42, 41
  br i1 %43, label %44, label %49

44:                                               ; preds = %41
  %45 = load ptr, ptr %30, align 16
  %46 = zext nneg i32 %42 to i64
  %47 = getelementptr i8, ptr %45, i64 %46
  %48 = add nuw nsw i32 %42, 8
  store i32 %48, ptr %5, align 16
  br label %52

49:                                               ; preds = %41
  %50 = load ptr, ptr %29, align 8
  %51 = getelementptr i8, ptr %50, i64 8
  store ptr %51, ptr %29, align 8
  br label %52

52:                                               ; preds = %49, %44
  %53 = phi ptr [ %47, %44 ], [ %50, %49 ]
  %54 = load i32, ptr %53, align 4, !tbaa !16
  %55 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 %indvars.iv
  store i32 %54, ptr %55, align 4, !tbaa !16
  %56 = icmp sgt i32 %54, 3
  br i1 %56, label %57, label %58

57:                                               ; preds = %52
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 772, ptr noundef nonnull @__FUNCTION__.mImageChannelSplit, ptr noundef nonnull @.str.7) #5
  br label %58

58:                                               ; preds = %57, %52
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %41, !llvm.loop !19

59:                                               ; preds = %.lr.ph68
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %exitcond76.not = icmp eq i64 %indvars.iv.next73, %wide.trip.count75
  br i1 %exitcond76.not, label %._crit_edge69, label %.lr.ph68, !llvm.loop !21

.lr.ph68:                                         ; preds = %.lr.ph68.preheader, %59
  %indvars.iv72 = phi i64 [ 0, %.lr.ph68.preheader ], [ %indvars.iv.next73, %59 ]
  %60 = getelementptr inbounds [64 x i32], ptr %26, i64 0, i64 %indvars.iv72
  %61 = load i32, ptr %60, align 4, !tbaa !16
  %62 = icmp eq i32 %38, %61
  br i1 %62, label %.thread, label %59

.thread:                                          ; preds = %.lr.ph68
  %63 = getelementptr inbounds i8, ptr %26, i64 256
  %64 = getelementptr inbounds [64 x ptr], ptr %63, i64 0, i64 %indvars.iv72
  %65 = load ptr, ptr %64, align 8, !tbaa !22
  br label %76

._crit_edge69:                                    ; preds = %59, %._crit_edge
  %66 = getelementptr inbounds i8, ptr %0, i64 4
  %67 = load i32, ptr %66, align 4, !tbaa !11
  %68 = getelementptr inbounds i8, ptr %0, i64 8
  %69 = load i32, ptr %68, align 8, !tbaa !12
  %70 = call ptr @ImageCreate(i32 noundef %1, i32 noundef %67, i32 noundef %69, ptr noundef nonnull %4)
  %71 = getelementptr inbounds i8, ptr %26, i64 256
  %72 = sext i32 %40 to i64
  %73 = getelementptr inbounds [64 x ptr], ptr %71, i64 0, i64 %72
  store ptr %70, ptr %73, align 8, !tbaa !22
  %74 = getelementptr inbounds [64 x i32], ptr %26, i64 0, i64 %72
  store i32 %38, ptr %74, align 4, !tbaa !16
  %75 = add nsw i32 %40, 1
  store i32 %75, ptr %39, align 8, !tbaa !17
  br label %76

76:                                               ; preds = %.thread, %._crit_edge69
  %.1 = phi ptr [ %70, %._crit_edge69 ], [ %65, %.thread ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  ret ptr %.1
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.va_start.p0(ptr) #4

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.va_end.p0(ptr) #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { 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 0}
!6 = !{!"MImage", !7, i64 0, !7, i64 4, !7, i64 8, !8, i64 16, !10, i64 48}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !7, i64 8}
!13 = !{!14, !10, i64 16}
!14 = !{!"MHandle", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16}
!15 = !{!14, !7, i64 4}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !7, i64 768}
!18 = !{!"HandleImageChannelSplit", !8, i64 0, !8, i64 256, !7, i64 768}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}
!22 = !{!10, !10, i64 0}


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