; LLVM IR from openxrlab/xrsfm :: 3rdparty/apriltag/common (image_u8x4)

; 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.pnm = type { i32, i32, i32, i32, i32, ptr }
%struct.image_u8x4 = type { i32, i32, i32, ptr }

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

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

; Function Attrs: 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) #2

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

; Function Attrs: nounwind uwtable
define dso_local ptr @image_u8x4_create_from_pnm(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca %struct.pnm, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %struct.image_u8x4, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i8, align 1
  %12 = alloca %struct.image_u8x4, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i8, align 1
  %16 = alloca i8, align 1
  %17 = alloca i8, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = call ptr @pnm_create_from_file(ptr noundef %18)
  store ptr %19, ptr %4, align 8, !tbaa !5
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = icmp eq ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %1
  store ptr null, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %243

23:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #4
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %24, i64 32, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store ptr null, ptr %7, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.pnm, ptr %6, i32 0, i32 2
  %26 = load i32, ptr %25, align 8, !tbaa !12
  switch i32 %26, label %240 [
    i32 5, label %27
    i32 6, label %118
  ]

27:                                               ; preds = %23
  %28 = getelementptr inbounds %struct.pnm, ptr %6, i32 0, i32 0
  %29 = load i32, ptr %28, align 8, !tbaa !14
  %30 = getelementptr inbounds %struct.pnm, ptr %6, i32 0, i32 1
  %31 = load i32, ptr %30, align 4, !tbaa !15
  %32 = call ptr @image_u8x4_create(i32 noundef %29, i32 noundef %31)
  store ptr %32, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #4
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %33, i64 24, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !10
  br label %34

34:                                               ; preds = %114, %27
  %35 = load i32, ptr %9, align 4, !tbaa !10
  %36 = getelementptr inbounds %struct.image_u8x4, ptr %8, i32 0, i32 1
  %37 = load i32, ptr %36, align 4, !tbaa !17
  %38 = icmp slt i32 %35, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %34
  store i32 3, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %117

40:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !10
  br label %41

41:                                               ; preds = %110, %40
  %42 = load i32, ptr %10, align 4, !tbaa !10
  %43 = getelementptr inbounds %struct.image_u8x4, ptr %8, i32 0, i32 0
  %44 = load i32, ptr %43, align 8, !tbaa !19
  %45 = icmp slt i32 %42, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %41
  store i32 6, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %113

47:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #4
  %48 = getelementptr inbounds %struct.pnm, ptr %6, i32 0, i32 5
  %49 = load ptr, ptr %48, align 8, !tbaa !20
  %50 = load i32, ptr %9, align 4, !tbaa !10
  %51 = getelementptr inbounds %struct.pnm, ptr %6, i32 0, i32 0
  %52 = load i32, ptr %51, align 8, !tbaa !14
  %53 = mul nsw i32 %50, %52
  %54 = load i32, ptr %10, align 4, !tbaa !10
  %55 = add nsw i32 %53, %54
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds i8, ptr %49, i64 %56
  %58 = load i8, ptr %57, align 1, !tbaa !21
  store i8 %58, ptr %11, align 1, !tbaa !21
  %59 = load i8, ptr %11, align 1, !tbaa !21
  %60 = getelementptr inbounds %struct.image_u8x4, ptr %8, i32 0, i32 3
  %61 = load ptr, ptr %60, align 8, !tbaa !22
  %62 = load i32, ptr %9, align 4, !tbaa !10
  %63 = getelementptr inbounds %struct.image_u8x4, ptr %8, i32 0, i32 2
  %64 = load i32, ptr %63, align 8, !tbaa !23
  %65 = mul nsw i32 %62, %64
  %66 = load i32, ptr %10, align 4, !tbaa !10
  %67 = mul nsw i32 4, %66
  %68 = add nsw i32 %65, %67
  %69 = add nsw i32 %68, 0
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds i8, ptr %61, i64 %70
  store i8 %59, ptr %71, align 1, !tbaa !21
  %72 = load i8, ptr %11, align 1, !tbaa !21
  %73 = getelementptr inbounds %struct.image_u8x4, ptr %8, i32 0, i32 3
  %74 = load ptr, ptr %73, align 8, !tbaa !22
  %75 = load i32, ptr %9, align 4, !tbaa !10
  %76 = getelementptr inbounds %struct.image_u8x4, ptr %8, i32 0, i32 2
  %77 = load i32, ptr %76, align 8, !tbaa !23
  %78 = mul nsw i32 %75, %77
  %79 = load i32, ptr %10, align 4, !tbaa !10
  %80 = mul nsw i32 4, %79
  %81 = add nsw i32 %78, %80
  %82 = add nsw i32 %81, 1
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds i8, ptr %74, i64 %83
  store i8 %72, ptr %84, align 1, !tbaa !21
  %85 = load i8, ptr %11, align 1, !tbaa !21
  %86 = getelementptr inbounds %struct.image_u8x4, ptr %8, i32 0, i32 3
  %87 = load ptr, ptr %86, align 8, !tbaa !22
  %88 = load i32, ptr %9, align 4, !tbaa !10
  %89 = getelementptr inbounds %struct.image_u8x4, ptr %8, i32 0, i32 2
  %90 = load i32, ptr %89, align 8, !tbaa !23
  %91 = mul nsw i32 %88, %90
  %92 = load i32, ptr %10, align 4, !tbaa !10
  %93 = mul nsw i32 4, %92
  %94 = add nsw i32 %91, %93
  %95 = add nsw i32 %94, 2
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds i8, ptr %87, i64 %96
  store i8 %85, ptr %97, align 1, !tbaa !21
  %98 = getelementptr inbounds %struct.image_u8x4, ptr %8, i32 0, i32 3
  %99 = load ptr, ptr %98, align 8, !tbaa !22
  %100 = load i32, ptr %9, align 4, !tbaa !10
  %101 = getelementptr inbounds %struct.image_u8x4, ptr %8, i32 0, i32 2
  %102 = load i32, ptr %101, align 8, !tbaa !23
  %103 = mul nsw i32 %100, %102
  %104 = load i32, ptr %10, align 4, !tbaa !10
  %105 = mul nsw i32 4, %104
  %106 = add nsw i32 %103, %105
  %107 = add nsw i32 %106, 3
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds i8, ptr %99, i64 %108
  store i8 -1, ptr %109, align 1, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #4
  br label %110

110:                                              ; preds = %47
  %111 = load i32, ptr %10, align 4, !tbaa !10
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %10, align 4, !tbaa !10
  br label %41, !llvm.loop !24

113:                                              ; preds = %46
  br label %114

114:                                              ; preds = %113
  %115 = load i32, ptr %9, align 4, !tbaa !10
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %9, align 4, !tbaa !10
  br label %34, !llvm.loop !26

117:                                              ; preds = %39
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #4
  br label %240

118:                                              ; preds = %23
  %119 = getelementptr inbounds %struct.pnm, ptr %6, i32 0, i32 0
  %120 = load i32, ptr %119, align 8, !tbaa !14
  %121 = getelementptr inbounds %struct.pnm, ptr %6, i32 0, i32 1
  %122 = load i32, ptr %121, align 4, !tbaa !15
  %123 = call ptr @image_u8x4_create(i32 noundef %120, i32 noundef %122)
  store ptr %123, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #4
  %124 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 8 %124, i64 24, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !10
  br label %125

125:                                              ; preds = %236, %118
  %126 = load i32, ptr %13, align 4, !tbaa !10
  %127 = getelementptr inbounds %struct.image_u8x4, ptr %12, i32 0, i32 1
  %128 = load i32, ptr %127, align 4, !tbaa !17
  %129 = icmp slt i32 %126, %128
  br i1 %129, label %131, label %130

130:                                              ; preds = %125
  store i32 9, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %239

131:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !10
  br label %132

132:                                              ; preds = %232, %131
  %133 = load i32, ptr %14, align 4, !tbaa !10
  %134 = getelementptr inbounds %struct.image_u8x4, ptr %12, i32 0, i32 0
  %135 = load i32, ptr %134, align 8, !tbaa !19
  %136 = icmp slt i32 %133, %135
  br i1 %136, label %138, label %137

137:                                              ; preds = %132
  store i32 12, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %235

138:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #4
  %139 = getelementptr inbounds %struct.pnm, ptr %6, i32 0, i32 5
  %140 = load ptr, ptr %139, align 8, !tbaa !20
  %141 = load i32, ptr %13, align 4, !tbaa !10
  %142 = getelementptr inbounds %struct.pnm, ptr %6, i32 0, i32 0
  %143 = load i32, ptr %142, align 8, !tbaa !14
  %144 = mul nsw i32 %141, %143
  %145 = mul nsw i32 %144, 3
  %146 = load i32, ptr %14, align 4, !tbaa !10
  %147 = mul nsw i32 3, %146
  %148 = add nsw i32 %145, %147
  %149 = add nsw i32 %148, 0
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds i8, ptr %140, i64 %150
  %152 = load i8, ptr %151, align 1, !tbaa !21
  store i8 %152, ptr %15, align 1, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #4
  %153 = getelementptr inbounds %struct.pnm, ptr %6, i32 0, i32 5
  %154 = load ptr, ptr %153, align 8, !tbaa !20
  %155 = load i32, ptr %13, align 4, !tbaa !10
  %156 = getelementptr inbounds %struct.pnm, ptr %6, i32 0, i32 0
  %157 = load i32, ptr %156, align 8, !tbaa !14
  %158 = mul nsw i32 %155, %157
  %159 = mul nsw i32 %158, 3
  %160 = load i32, ptr %14, align 4, !tbaa !10
  %161 = mul nsw i32 3, %160
  %162 = add nsw i32 %159, %161
  %163 = add nsw i32 %162, 1
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds i8, ptr %154, i64 %164
  %166 = load i8, ptr %165, align 1, !tbaa !21
  store i8 %166, ptr %16, align 1, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #4
  %167 = getelementptr inbounds %struct.pnm, ptr %6, i32 0, i32 5
  %168 = load ptr, ptr %167, align 8, !tbaa !20
  %169 = load i32, ptr %13, align 4, !tbaa !10
  %170 = getelementptr inbounds %struct.pnm, ptr %6, i32 0, i32 0
  %171 = load i32, ptr %170, align 8, !tbaa !14
  %172 = mul nsw i32 %169, %171
  %173 = mul nsw i32 %172, 3
  %174 = load i32, ptr %14, align 4, !tbaa !10
  %175 = mul nsw i32 3, %174
  %176 = add nsw i32 %173, %175
  %177 = add nsw i32 %176, 2
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds i8, ptr %168, i64 %178
  %180 = load i8, ptr %179, align 1, !tbaa !21
  store i8 %180, ptr %17, align 1, !tbaa !21
  %181 = load i8, ptr %15, align 1, !tbaa !21
  %182 = getelementptr inbounds %struct.image_u8x4, ptr %12, i32 0, i32 3
  %183 = load ptr, ptr %182, align 8, !tbaa !22
  %184 = load i32, ptr %13, align 4, !tbaa !10
  %185 = getelementptr inbounds %struct.image_u8x4, ptr %12, i32 0, i32 2
  %186 = load i32, ptr %185, align 8, !tbaa !23
  %187 = mul nsw i32 %184, %186
  %188 = load i32, ptr %14, align 4, !tbaa !10
  %189 = mul nsw i32 4, %188
  %190 = add nsw i32 %187, %189
  %191 = add nsw i32 %190, 0
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds i8, ptr %183, i64 %192
  store i8 %181, ptr %193, align 1, !tbaa !21
  %194 = load i8, ptr %16, align 1, !tbaa !21
  %195 = getelementptr inbounds %struct.image_u8x4, ptr %12, i32 0, i32 3
  %196 = load ptr, ptr %195, align 8, !tbaa !22
  %197 = load i32, ptr %13, align 4, !tbaa !10
  %198 = getelementptr inbounds %struct.image_u8x4, ptr %12, i32 0, i32 2
  %199 = load i32, ptr %198, align 8, !tbaa !23
  %200 = mul nsw i32 %197, %199
  %201 = load i32, ptr %14, align 4, !tbaa !10
  %202 = mul nsw i32 4, %201
  %203 = add nsw i32 %200, %202
  %204 = add nsw i32 %203, 1
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds i8, ptr %196, i64 %205
  store i8 %194, ptr %206, align 1, !tbaa !21
  %207 = load i8, ptr %17, align 1, !tbaa !21
  %208 = getelementptr inbounds %struct.image_u8x4, ptr %12, i32 0, i32 3
  %209 = load ptr, ptr %208, align 8, !tbaa !22
  %210 = load i32, ptr %13, align 4, !tbaa !10
  %211 = getelementptr inbounds %struct.image_u8x4, ptr %12, i32 0, i32 2
  %212 = load i32, ptr %211, align 8, !tbaa !23
  %213 = mul nsw i32 %210, %212
  %214 = load i32, ptr %14, align 4, !tbaa !10
  %215 = mul nsw i32 4, %214
  %216 = add nsw i32 %213, %215
  %217 = add nsw i32 %216, 2
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds i8, ptr %209, i64 %218
  store i8 %207, ptr %219, align 1, !tbaa !21
  %220 = getelementptr inbounds %struct.image_u8x4, ptr %12, i32 0, i32 3
  %221 = load ptr, ptr %220, align 8, !tbaa !22
  %222 = load i32, ptr %13, align 4, !tbaa !10
  %223 = getelementptr inbounds %struct.image_u8x4, ptr %12, i32 0, i32 2
  %224 = load i32, ptr %223, align 8, !tbaa !23
  %225 = mul nsw i32 %222, %224
  %226 = load i32, ptr %14, align 4, !tbaa !10
  %227 = mul nsw i32 4, %226
  %228 = add nsw i32 %225, %227
  %229 = add nsw i32 %228, 3
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds i8, ptr %221, i64 %230
  store i8 -1, ptr %231, align 1, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #4
  br label %232

232:                                              ; preds = %138
  %233 = load i32, ptr %14, align 4, !tbaa !10
  %234 = add nsw i32 %233, 1
  store i32 %234, ptr %14, align 4, !tbaa !10
  br label %132, !llvm.loop !27

235:                                              ; preds = %137
  br label %236

236:                                              ; preds = %235
  %237 = load i32, ptr %13, align 4, !tbaa !10
  %238 = add nsw i32 %237, 1
  store i32 %238, ptr %13, align 4, !tbaa !10
  br label %125, !llvm.loop !28

239:                                              ; preds = %130
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #4
  br label %240

240:                                              ; preds = %239, %117, %23
  %241 = load ptr, ptr %4, align 8, !tbaa !5
  call void @pnm_destroy(ptr noundef %241)
  %242 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %242, ptr %2, align 8
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #4
  br label %243

243:                                              ; preds = %240, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  %244 = load ptr, ptr %2, align 8
  ret ptr %244
}

declare ptr @pnm_create_from_file(ptr noundef) #3

declare void @pnm_destroy(ptr noundef) #3

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!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 = !{i64 0, i64 4, !10, i64 4, i64 4, !10, i64 8, i64 4, !10, i64 12, i64 4, !10, i64 16, i64 4, !10, i64 24, i64 8, !5}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 8}
!13 = !{!"pnm", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !6, i64 24}
!14 = !{!13, !11, i64 0}
!15 = !{!13, !11, i64 4}
!16 = !{i64 0, i64 4, !10, i64 4, i64 4, !10, i64 8, i64 4, !10, i64 16, i64 8, !5}
!17 = !{!18, !11, i64 4}
!18 = !{!"image_u8x4", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16}
!19 = !{!18, !11, i64 0}
!20 = !{!13, !6, i64 24}
!21 = !{!7, !7, i64 0}
!22 = !{!18, !6, i64 16}
!23 = !{!18, !11, i64 8}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}
!27 = distinct !{!27, !25}
!28 = distinct !{!28, !25}


; 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"

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

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @image_u8x4_create_from_pnm(ptr noundef %0) local_unnamed_addr #0 {
  %2 = tail call ptr @pnm_create_from_file(ptr noundef %0) #2
  %3 = icmp eq ptr %2, null
  br i1 %3, label %80, label %4

4:                                                ; preds = %1
  %.sroa.058.0.copyload = load i32, ptr %2, align 8, !tbaa !5
  %.sroa.964.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 4
  %.sroa.964.0.copyload = load i32, ptr %.sroa.964.0..sroa_idx, align 4, !tbaa !5
  %.sroa.11.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  %.sroa.11.0.copyload = load i32, ptr %.sroa.11.0..sroa_idx, align 8, !tbaa !5
  %.sroa.1266.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 24
  %.sroa.1266.0.copyload = load ptr, ptr %.sroa.1266.0..sroa_idx, align 8, !tbaa !9
  switch i32 %.sroa.11.0.copyload, label %.loopexit [
    i32 5, label %5
    i32 6, label %29
  ]

5:                                                ; preds = %4
  %6 = tail call ptr @image_u8x4_create(i32 noundef %.sroa.058.0.copyload, i32 noundef %.sroa.964.0.copyload)
  %.sroa.045.0.copyload = load i32, ptr %6, align 8, !tbaa !5
  %.sroa.446.0..sroa_idx = getelementptr inbounds i8, ptr %6, i64 4
  %.sroa.446.0.copyload = load i32, ptr %.sroa.446.0..sroa_idx, align 4, !tbaa !5
  %.sroa.952.0..sroa_idx = getelementptr inbounds i8, ptr %6, i64 16
  %.sroa.952.0.copyload = load ptr, ptr %.sroa.952.0..sroa_idx, align 8, !tbaa !9
  %7 = icmp sgt i32 %.sroa.446.0.copyload, 0
  %8 = icmp sgt i32 %.sroa.045.0.copyload, 0
  %or.cond = select i1 %7, i1 %8, i1 false
  br i1 %or.cond, label %.preheader.us.preheader, label %.loopexit

.preheader.us.preheader:                          ; preds = %5
  %.sroa.547.0..sroa_idx = getelementptr inbounds i8, ptr %6, i64 8
  %.sroa.547.0.copyload = load i32, ptr %.sroa.547.0..sroa_idx, align 8, !tbaa !5
  %9 = sext i32 %.sroa.058.0.copyload to i64
  %10 = sext i32 %.sroa.547.0.copyload to i64
  %wide.trip.count105 = zext nneg i32 %.sroa.446.0.copyload to i64
  %wide.trip.count100 = zext nneg i32 %.sroa.045.0.copyload to i64
  %xtraiter116 = and i64 %wide.trip.count100, 1
  %11 = icmp eq i32 %.sroa.045.0.copyload, 1
  %unroll_iter118 = and i64 %wide.trip.count100, 2147483646
  %lcmp.mod117.not = icmp eq i64 %xtraiter116, 0
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge.us87
  %indvars.iv102 = phi i64 [ 0, %.preheader.us.preheader ], [ %indvars.iv.next103, %._crit_edge.us87 ]
  %12 = mul nsw i64 %indvars.iv102, %9
  %13 = mul nsw i64 %indvars.iv102, %10
  %invariant.gep108 = getelementptr i8, ptr %.sroa.1266.0.copyload, i64 %12
  %invariant.gep110 = getelementptr i8, ptr %.sroa.952.0.copyload, i64 %13
  br i1 %11, label %._crit_edge.us87.unr-lcssa, label %.preheader.us.new

.preheader.us.new:                                ; preds = %.preheader.us, %.preheader.us.new
  %indvars.iv97 = phi i64 [ %indvars.iv.next98.1, %.preheader.us.new ], [ 0, %.preheader.us ]
  %niter119 = phi i64 [ %niter119.next.1, %.preheader.us.new ], [ 0, %.preheader.us ]
  %gep109 = getelementptr i8, ptr %invariant.gep108, i64 %indvars.iv97
  %14 = load i8, ptr %gep109, align 1, !tbaa !11
  %15 = shl nsw i64 %indvars.iv97, 2
  %gep111 = getelementptr i8, ptr %invariant.gep110, i64 %15
  store i8 %14, ptr %gep111, align 1, !tbaa !11
  %16 = getelementptr i8, ptr %gep111, i64 1
  store i8 %14, ptr %16, align 1, !tbaa !11
  %17 = getelementptr i8, ptr %gep111, i64 2
  store i8 %14, ptr %17, align 1, !tbaa !11
  %18 = getelementptr i8, ptr %gep111, i64 3
  store i8 -1, ptr %18, align 1, !tbaa !11
  %indvars.iv.next98 = or disjoint i64 %indvars.iv97, 1
  %gep109.1 = getelementptr i8, ptr %invariant.gep108, i64 %indvars.iv.next98
  %19 = load i8, ptr %gep109.1, align 1, !tbaa !11
  %20 = shl nsw i64 %indvars.iv.next98, 2
  %gep111.1 = getelementptr i8, ptr %invariant.gep110, i64 %20
  store i8 %19, ptr %gep111.1, align 1, !tbaa !11
  %21 = getelementptr i8, ptr %gep111.1, i64 1
  store i8 %19, ptr %21, align 1, !tbaa !11
  %22 = getelementptr i8, ptr %gep111.1, i64 2
  store i8 %19, ptr %22, align 1, !tbaa !11
  %23 = getelementptr i8, ptr %gep111.1, i64 3
  store i8 -1, ptr %23, align 1, !tbaa !11
  %indvars.iv.next98.1 = add nuw nsw i64 %indvars.iv97, 2
  %niter119.next.1 = add i64 %niter119, 2
  %niter119.ncmp.1 = icmp eq i64 %niter119.next.1, %unroll_iter118
  br i1 %niter119.ncmp.1, label %._crit_edge.us87.unr-lcssa, label %.preheader.us.new, !llvm.loop !12

._crit_edge.us87.unr-lcssa:                       ; preds = %.preheader.us.new, %.preheader.us
  %indvars.iv97.unr = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next98.1, %.preheader.us.new ]
  br i1 %lcmp.mod117.not, label %._crit_edge.us87, label %._crit_edge.us87.epilog-lcssa

._crit_edge.us87.epilog-lcssa:                    ; preds = %._crit_edge.us87.unr-lcssa
  %gep109.epil = getelementptr i8, ptr %invariant.gep108, i64 %indvars.iv97.unr
  %24 = load i8, ptr %gep109.epil, align 1, !tbaa !11
  %25 = shl nsw i64 %indvars.iv97.unr, 2
  %gep111.epil = getelementptr i8, ptr %invariant.gep110, i64 %25
  store i8 %24, ptr %gep111.epil, align 1, !tbaa !11
  %26 = getelementptr i8, ptr %gep111.epil, i64 1
  store i8 %24, ptr %26, align 1, !tbaa !11
  %27 = getelementptr i8, ptr %gep111.epil, i64 2
  store i8 %24, ptr %27, align 1, !tbaa !11
  %28 = getelementptr i8, ptr %gep111.epil, i64 3
  store i8 -1, ptr %28, align 1, !tbaa !11
  br label %._crit_edge.us87

._crit_edge.us87:                                 ; preds = %._crit_edge.us87.unr-lcssa, %._crit_edge.us87.epilog-lcssa
  %indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
  %exitcond106.not = icmp eq i64 %indvars.iv.next103, %wide.trip.count105
  br i1 %exitcond106.not, label %.loopexit, label %.preheader.us, !llvm.loop !14

29:                                               ; preds = %4
  %30 = tail call ptr @image_u8x4_create(i32 noundef %.sroa.058.0.copyload, i32 noundef %.sroa.964.0.copyload)
  %.sroa.0.0.copyload = load i32, ptr %30, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %30, i64 4
  %.sroa.4.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %.sroa.924.0..sroa_idx = getelementptr inbounds i8, ptr %30, i64 16
  %.sroa.924.0.copyload = load ptr, ptr %.sroa.924.0..sroa_idx, align 8, !tbaa !9
  %31 = icmp sgt i32 %.sroa.4.0.copyload, 0
  %32 = icmp sgt i32 %.sroa.0.0.copyload, 0
  %or.cond112 = select i1 %31, i1 %32, i1 false
  br i1 %or.cond112, label %.preheader81.us.preheader, label %.loopexit

.preheader81.us.preheader:                        ; preds = %29
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %30, i64 8
  %.sroa.5.0.copyload = load i32, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !5
  %33 = sext i32 %.sroa.5.0.copyload to i64
  %wide.trip.count95 = zext nneg i32 %.sroa.4.0.copyload to i64
  %wide.trip.count = zext nneg i32 %.sroa.0.0.copyload to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %34 = icmp eq i32 %.sroa.0.0.copyload, 1
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader81.us

.preheader81.us:                                  ; preds = %.preheader81.us.preheader, %._crit_edge.us
  %indvars.iv92 = phi i64 [ 0, %.preheader81.us.preheader ], [ %indvars.iv.next93, %._crit_edge.us ]
  %35 = mul nsw i64 %indvars.iv92, %33
  %36 = trunc i64 %indvars.iv92 to i32
  %37 = mul i32 %.sroa.058.0.copyload, %36
  %invariant.gep = getelementptr i8, ptr %.sroa.924.0.copyload, i64 %35
  br i1 %34, label %._crit_edge.us.unr-lcssa, label %.preheader81.us.new

.preheader81.us.new:                              ; preds = %.preheader81.us, %.preheader81.us.new
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %.preheader81.us.new ], [ 0, %.preheader81.us ]
  %niter = phi i64 [ %niter.next.1, %.preheader81.us.new ], [ 0, %.preheader81.us ]
  %38 = trunc nuw nsw i64 %indvars.iv to i32
  %39 = add i32 %37, %38
  %40 = mul i32 %39, 3
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds i8, ptr %.sroa.1266.0.copyload, i64 %41
  %43 = load i8, ptr %42, align 1, !tbaa !11
  %44 = getelementptr i8, ptr %42, i64 1
  %45 = load i8, ptr %44, align 1, !tbaa !11
  %46 = getelementptr i8, ptr %42, i64 2
  %47 = load i8, ptr %46, align 1, !tbaa !11
  %48 = shl nsw i64 %indvars.iv, 2
  %gep = getelementptr i8, ptr %invariant.gep, i64 %48
  store i8 %43, ptr %gep, align 1, !tbaa !11
  %49 = getelementptr i8, ptr %gep, i64 1
  store i8 %45, ptr %49, align 1, !tbaa !11
  %50 = getelementptr i8, ptr %gep, i64 2
  store i8 %47, ptr %50, align 1, !tbaa !11
  %51 = getelementptr i8, ptr %gep, i64 3
  store i8 -1, ptr %51, align 1, !tbaa !11
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %52 = trunc nuw nsw i64 %indvars.iv.next to i32
  %53 = add i32 %37, %52
  %54 = mul i32 %53, 3
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i8, ptr %.sroa.1266.0.copyload, i64 %55
  %57 = load i8, ptr %56, align 1, !tbaa !11
  %58 = getelementptr i8, ptr %56, i64 1
  %59 = load i8, ptr %58, align 1, !tbaa !11
  %60 = getelementptr i8, ptr %56, i64 2
  %61 = load i8, ptr %60, align 1, !tbaa !11
  %62 = shl nsw i64 %indvars.iv.next, 2
  %gep.1 = getelementptr i8, ptr %invariant.gep, i64 %62
  store i8 %57, ptr %gep.1, align 1, !tbaa !11
  %63 = getelementptr i8, ptr %gep.1, i64 1
  store i8 %59, ptr %63, align 1, !tbaa !11
  %64 = getelementptr i8, ptr %gep.1, i64 2
  store i8 %61, ptr %64, align 1, !tbaa !11
  %65 = getelementptr i8, ptr %gep.1, i64 3
  store i8 -1, ptr %65, align 1, !tbaa !11
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.us.unr-lcssa, label %.preheader81.us.new, !llvm.loop !15

._crit_edge.us.unr-lcssa:                         ; preds = %.preheader81.us.new, %.preheader81.us
  %indvars.iv.unr = phi i64 [ 0, %.preheader81.us ], [ %indvars.iv.next.1, %.preheader81.us.new ]
  br i1 %lcmp.mod.not, label %._crit_edge.us, label %._crit_edge.us.epilog-lcssa

._crit_edge.us.epilog-lcssa:                      ; preds = %._crit_edge.us.unr-lcssa
  %66 = trunc nuw nsw i64 %indvars.iv.unr to i32
  %67 = add i32 %37, %66
  %68 = mul i32 %67, 3
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds i8, ptr %.sroa.1266.0.copyload, i64 %69
  %71 = load i8, ptr %70, align 1, !tbaa !11
  %72 = getelementptr i8, ptr %70, i64 1
  %73 = load i8, ptr %72, align 1, !tbaa !11
  %74 = getelementptr i8, ptr %70, i64 2
  %75 = load i8, ptr %74, align 1, !tbaa !11
  %76 = shl nsw i64 %indvars.iv.unr, 2
  %gep.epil = getelementptr i8, ptr %invariant.gep, i64 %76
  store i8 %71, ptr %gep.epil, align 1, !tbaa !11
  %77 = getelementptr i8, ptr %gep.epil, i64 1
  store i8 %73, ptr %77, align 1, !tbaa !11
  %78 = getelementptr i8, ptr %gep.epil, i64 2
  store i8 %75, ptr %78, align 1, !tbaa !11
  %79 = getelementptr i8, ptr %gep.epil, i64 3
  store i8 -1, ptr %79, align 1, !tbaa !11
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %._crit_edge.us.unr-lcssa, %._crit_edge.us.epilog-lcssa
  %indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
  %exitcond96.not = icmp eq i64 %indvars.iv.next93, %wide.trip.count95
  br i1 %exitcond96.not, label %.loopexit, label %.preheader81.us, !llvm.loop !16

.loopexit:                                        ; preds = %._crit_edge.us, %._crit_edge.us87, %29, %5, %4
  %.075 = phi ptr [ null, %4 ], [ %6, %5 ], [ %30, %29 ], [ %6, %._crit_edge.us87 ], [ %30, %._crit_edge.us ]
  tail call void @pnm_destroy(ptr noundef nonnull %2) #2
  br label %80

80:                                               ; preds = %1, %.loopexit
  %.0 = phi ptr [ %.075, %.loopexit ], [ null, %1 ]
  ret ptr %.0
}

declare ptr @pnm_create_from_file(ptr noundef) local_unnamed_addr #1

declare void @pnm_destroy(ptr noundef) local_unnamed_addr #1

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}


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