; LLVM IR from cornell-zhang/rosetta :: optical-flow/imageLib/ImageIO.ll (Z9ReadImageR6CImagePKc)

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

@_ZTI6CError = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.18 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZTIf = external constant ptr
@.str.34 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZTIh = external constant ptr
@.str.38 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [39 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11ReadFileTGAR8CImageOfIhEPKc(ptr noundef nonnull align 8 dereferenceable(76), 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 ptr @__cxa_allocate_exception(i64)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032), ptr noundef, ptr noundef) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr)

; Function Attrs: nounwind
declare void @_ZNSt9exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3

declare void @__cxa_throw(ptr, ptr, ptr)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6CErrorC2EPKc(ptr noundef nonnull align 8 dereferenceable(1032), ptr noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11ReadFilePGMR8CImageOfIhEPKc(ptr noundef nonnull align 8 dereferenceable(76), ptr noundef) #0

; Function Attrs: nounwind willreturn memory(read)
declare noundef ptr @strrchr(ptr noundef, i32 noundef) #5

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZN6CImage7PixTypeEv(ptr noundef nonnull align 8 dereferenceable(76)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt9type_infoeqERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #6 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9ReadImageR6CImagePKc(ptr noundef nonnull align 8 dereferenceable(76) %0, ptr noundef %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca %struct.CShape, align 4
  %9 = alloca { i64, i32 }, align 4
  %10 = alloca %struct.CShape, align 4
  %11 = alloca { i64, i32 }, align 4
  %12 = alloca %struct.CShape, align 4
  %13 = alloca { i64, i32 }, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = icmp eq ptr %14, null
  br i1 %15, label %16, label %23

16:                                               ; preds = %2
  %17 = call ptr @__cxa_allocate_exception(i64 1032) #8
  invoke void @_ZN6CErrorC2EPKc(ptr noundef nonnull align 8 dereferenceable(1032) %17, ptr noundef @.str.34)
          to label %18 unwind label %19

18:                                               ; preds = %16
  call void @__cxa_throw(ptr %17, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #9
  unreachable

19:                                               ; preds = %16
  %20 = landingpad { ptr, i32 }
          cleanup
  %21 = extractvalue { ptr, i32 } %20, 0
  store ptr %21, ptr %5, align 8
  %22 = extractvalue { ptr, i32 } %20, 1
  store i32 %22, ptr %6, align 4
  call void @__cxa_free_exception(ptr %17) #8
  br label %134

23:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = call noundef ptr @strrchr(ptr noundef %24, i32 noundef 46) #10
  store ptr %25, ptr %7, align 8, !tbaa !5
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %36

28:                                               ; preds = %23
  %29 = call ptr @__cxa_allocate_exception(i64 1032) #8
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %29, ptr noundef @.str.35, ptr noundef %30)
          to label %31 unwind label %32

31:                                               ; preds = %28
  call void @__cxa_throw(ptr %29, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #9
  unreachable

32:                                               ; preds = %28
  %33 = landingpad { ptr, i32 }
          cleanup
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %5, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %6, align 4
  call void @__cxa_free_exception(ptr %29) #8
  br label %133

36:                                               ; preds = %23
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = call i32 @strcmp(ptr noundef %37, ptr noundef @.str.36) #10
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %44, label %40

40:                                               ; preds = %36
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = call i32 @strcmp(ptr noundef %41, ptr noundef @.str.37) #10
  %43 = icmp eq i32 %42, 0
  br i1 %43, label %44, label %70

44:                                               ; preds = %40, %36
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN6CImage7PixTypeEv(ptr noundef nonnull align 8 dereferenceable(76) %45)
  %47 = icmp eq ptr %46, null
  br i1 %47, label %48, label %54

48:                                               ; preds = %44
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN6CShapeC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %8)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %8, i64 12, i1 false)
  %50 = getelementptr inbounds { i64, i32 }, ptr %9, i32 0, i32 0
  %51 = load i64, ptr %50, align 4
  %52 = getelementptr inbounds { i64, i32 }, ptr %9, i32 0, i32 1
  %53 = load i32, ptr %52, align 4
  call void @_ZN6CImage10ReAllocateE6CShapeRKSt9type_infoib(ptr noundef nonnull align 8 dereferenceable(76) %49, i64 %51, i32 %53, ptr noundef nonnull align 8 dereferenceable(16) @_ZTIh, i32 noundef 1, i1 noundef zeroext true)
  br label %54

54:                                               ; preds = %48, %44
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN6CImage7PixTypeEv(ptr noundef nonnull align 8 dereferenceable(76) %55)
  %57 = call noundef zeroext i1 @_ZNKSt9type_infoeqERKS_(ptr noundef nonnull align 8 dereferenceable(16) %56, ptr noundef nonnull align 8 dereferenceable(16) @_ZTIh) #8
  br i1 %57, label %58, label %61

58:                                               ; preds = %54
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_Z11ReadFileTGAR8CImageOfIhEPKc(ptr noundef nonnull align 8 dereferenceable(76) %59, ptr noundef %60)
  br label %69

61:                                               ; preds = %54
  %62 = call ptr @__cxa_allocate_exception(i64 1032) #8
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %62, ptr noundef @.str.38, ptr noundef %63)
          to label %64 unwind label %65

64:                                               ; preds = %61
  call void @__cxa_throw(ptr %62, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #9
  unreachable

65:                                               ; preds = %61
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %5, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %6, align 4
  call void @__cxa_free_exception(ptr %62) #8
  br label %133

69:                                               ; preds = %58
  br label %132

70:                                               ; preds = %40
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = call i32 @strcmp(ptr noundef %71, ptr noundef @.str.18) #10
  %73 = icmp eq i32 %72, 0
  br i1 %73, label %82, label %74

74:                                               ; preds = %70
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  %76 = call i32 @strcmp(ptr noundef %75, ptr noundef @.str.20) #10
  %77 = icmp eq i32 %76, 0
  br i1 %77, label %82, label %78

78:                                               ; preds = %74
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = call i32 @strcmp(ptr noundef %79, ptr noundef @.str.21) #10
  %81 = icmp eq i32 %80, 0
  br i1 %81, label %82, label %123

82:                                               ; preds = %78, %74, %70
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN6CImage7PixTypeEv(ptr noundef nonnull align 8 dereferenceable(76) %83)
  %85 = icmp eq ptr %84, null
  br i1 %85, label %86, label %103

86:                                               ; preds = %82
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = call i32 @strcmp(ptr noundef %87, ptr noundef @.str.21) #10
  %89 = icmp eq i32 %88, 0
  br i1 %89, label %90, label %96

90:                                               ; preds = %86
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN6CShapeC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %10)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %10, i64 12, i1 false)
  %92 = getelementptr inbounds { i64, i32 }, ptr %11, i32 0, i32 0
  %93 = load i64, ptr %92, align 4
  %94 = getelementptr inbounds { i64, i32 }, ptr %11, i32 0, i32 1
  %95 = load i32, ptr %94, align 4
  call void @_ZN6CImage10ReAllocateE6CShapeRKSt9type_infoib(ptr noundef nonnull align 8 dereferenceable(76) %91, i64 %93, i32 %95, ptr noundef nonnull align 8 dereferenceable(16) @_ZTIf, i32 noundef 4, i1 noundef zeroext true)
  br label %102

96:                                               ; preds = %86
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN6CShapeC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %12)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %12, i64 12, i1 false)
  %98 = getelementptr inbounds { i64, i32 }, ptr %13, i32 0, i32 0
  %99 = load i64, ptr %98, align 4
  %100 = getelementptr inbounds { i64, i32 }, ptr %13, i32 0, i32 1
  %101 = load i32, ptr %100, align 4
  call void @_ZN6CImage10ReAllocateE6CShapeRKSt9type_infoib(ptr noundef nonnull align 8 dereferenceable(76) %97, i64 %99, i32 %101, ptr noundef nonnull align 8 dereferenceable(16) @_ZTIh, i32 noundef 1, i1 noundef zeroext true)
  br label %102

102:                                              ; preds = %96, %90
  br label %103

103:                                              ; preds = %102, %82
  %104 = load ptr, ptr %3, align 8, !tbaa !5
  %105 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN6CImage7PixTypeEv(ptr noundef nonnull align 8 dereferenceable(76) %104)
  %106 = call noundef zeroext i1 @_ZNKSt9type_infoeqERKS_(ptr noundef nonnull align 8 dereferenceable(16) %105, ptr noundef nonnull align 8 dereferenceable(16) @_ZTIh) #8
  br i1 %106, label %111, label %107

107:                                              ; preds = %103
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN6CImage7PixTypeEv(ptr noundef nonnull align 8 dereferenceable(76) %108)
  %110 = call noundef zeroext i1 @_ZNKSt9type_infoeqERKS_(ptr noundef nonnull align 8 dereferenceable(16) %109, ptr noundef nonnull align 8 dereferenceable(16) @_ZTIf) #8
  br i1 %110, label %111, label %114

111:                                              ; preds = %107, %103
  %112 = load ptr, ptr %3, align 8, !tbaa !5
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_Z11ReadFilePGMR8CImageOfIhEPKc(ptr noundef nonnull align 8 dereferenceable(76) %112, ptr noundef %113)
  br label %122

114:                                              ; preds = %107
  %115 = call ptr @__cxa_allocate_exception(i64 1032) #8
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %115, ptr noundef @.str.39, ptr noundef %116)
          to label %117 unwind label %118

117:                                              ; preds = %114
  call void @__cxa_throw(ptr %115, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #9
  unreachable

118:                                              ; preds = %114
  %119 = landingpad { ptr, i32 }
          cleanup
  %120 = extractvalue { ptr, i32 } %119, 0
  store ptr %120, ptr %5, align 8
  %121 = extractvalue { ptr, i32 } %119, 1
  store i32 %121, ptr %6, align 4
  call void @__cxa_free_exception(ptr %115) #8
  br label %133

122:                                              ; preds = %111
  br label %131

123:                                              ; preds = %78
  %124 = call ptr @__cxa_allocate_exception(i64 1032) #8
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %124, ptr noundef @.str.40, ptr noundef %125)
          to label %126 unwind label %127

126:                                              ; preds = %123
  call void @__cxa_throw(ptr %124, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #9
  unreachable

127:                                              ; preds = %123
  %128 = landingpad { ptr, i32 }
          cleanup
  %129 = extractvalue { ptr, i32 } %128, 0
  store ptr %129, ptr %5, align 8
  %130 = extractvalue { ptr, i32 } %128, 1
  store i32 %130, ptr %6, align 4
  call void @__cxa_free_exception(ptr %124) #8
  br label %133

131:                                              ; preds = %122
  br label %132

132:                                              ; preds = %131, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  ret void

133:                                              ; preds = %127, %118, %65, %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  br label %134

134:                                              ; preds = %133, %19
  %135 = load ptr, ptr %5, align 8
  %136 = load i32, ptr %6, align 4
  %137 = insertvalue { ptr, i32 } poison, ptr %135, 0
  %138 = insertvalue { ptr, i32 } %137, i32 %136, 1
  resume { ptr, i32 } %138
}

declare void @_ZN6CImage10ReAllocateE6CShapeRKSt9type_infoib(ptr noundef nonnull align 8 dereferenceable(76), i64, i32, ptr noundef nonnull align 8 dereferenceable(16), i32 noundef, i1 noundef zeroext) #7

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6CShapeC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2 align 2

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

!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"}


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

@_ZTI6CError = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.18 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZTIf = external constant ptr
@.str.34 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZTIh = external constant ptr
@.str.38 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [39 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11ReadFileTGAR8CImageOfIhEPKc(ptr noundef nonnull align 8 dereferenceable(76), ptr noundef) local_unnamed_addr #0

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032), ptr noundef, ptr noundef) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZNSt9exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6CErrorC2EPKc(ptr noundef nonnull align 8 dereferenceable(1032), ptr noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11ReadFilePGMR8CImageOfIhEPKc(ptr noundef nonnull align 8 dereferenceable(76), ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare noundef ptr @strrchr(ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZN6CImage7PixTypeEv(ptr noundef nonnull align 8 dereferenceable(76)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt9type_infoeqERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9ReadImageR6CImagePKc(ptr noundef nonnull align 8 dereferenceable(76) %0, ptr noundef %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = icmp eq ptr %1, null
  br i1 %3, label %4, label %6

4:                                                ; preds = %2
  %5 = tail call ptr @__cxa_allocate_exception(i64 1032) #5
  tail call void @_ZN6CErrorC2EPKc(ptr noundef nonnull align 8 dereferenceable(1032) %5, ptr noundef nonnull @.str.34)
  tail call void @__cxa_throw(ptr nonnull %5, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #6
  unreachable

6:                                                ; preds = %2
  %7 = tail call noundef ptr @strrchr(ptr noundef nonnull dereferenceable(1) %1, i32 noundef 46) #7
  %8 = icmp eq ptr %7, null
  br i1 %8, label %9, label %11

9:                                                ; preds = %6
  %10 = tail call ptr @__cxa_allocate_exception(i64 1032) #5
  tail call void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %10, ptr noundef nonnull @.str.35, ptr noundef nonnull %1)
  tail call void @__cxa_throw(ptr nonnull %10, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #6
  unreachable

11:                                               ; preds = %6
  %12 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.36) #7
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %17, label %14

14:                                               ; preds = %11
  %15 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.37) #7
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %24

17:                                               ; preds = %14, %11
  %18 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN6CImage7PixTypeEv(ptr noundef nonnull align 8 dereferenceable(76) %0)
  %19 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN6CImage7PixTypeEv(ptr noundef nonnull align 8 dereferenceable(76) %0)
  %20 = tail call noundef zeroext i1 @_ZNKSt9type_infoeqERKS_(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(16) @_ZTIh) #5
  br i1 %20, label %21, label %22

21:                                               ; preds = %17
  tail call void @_Z11ReadFileTGAR8CImageOfIhEPKc(ptr noundef nonnull align 8 dereferenceable(76) %0, ptr noundef nonnull %1)
  br label %45

22:                                               ; preds = %17
  %23 = tail call ptr @__cxa_allocate_exception(i64 1032) #5
  tail call void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %23, ptr noundef nonnull @.str.38, ptr noundef nonnull %1)
  tail call void @__cxa_throw(ptr nonnull %23, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #6
  unreachable

24:                                               ; preds = %14
  %25 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.18) #7
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %33, label %27

27:                                               ; preds = %24
  %28 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.20) #7
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %33, label %30

30:                                               ; preds = %27
  %31 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.21) #7
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %33, label %43

33:                                               ; preds = %30, %27, %24
  %34 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN6CImage7PixTypeEv(ptr noundef nonnull align 8 dereferenceable(76) %0)
  %35 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN6CImage7PixTypeEv(ptr noundef nonnull align 8 dereferenceable(76) %0)
  %36 = tail call noundef zeroext i1 @_ZNKSt9type_infoeqERKS_(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 8 dereferenceable(16) @_ZTIh) #5
  br i1 %36, label %40, label %37

37:                                               ; preds = %33
  %38 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN6CImage7PixTypeEv(ptr noundef nonnull align 8 dereferenceable(76) %0)
  %39 = tail call noundef zeroext i1 @_ZNKSt9type_infoeqERKS_(ptr noundef nonnull align 8 dereferenceable(16) %38, ptr noundef nonnull align 8 dereferenceable(16) @_ZTIf) #5
  br i1 %39, label %40, label %41

40:                                               ; preds = %37, %33
  tail call void @_Z11ReadFilePGMR8CImageOfIhEPKc(ptr noundef nonnull align 8 dereferenceable(76) %0, ptr noundef nonnull %1)
  br label %45

41:                                               ; preds = %37
  %42 = tail call ptr @__cxa_allocate_exception(i64 1032) #5
  tail call void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %42, ptr noundef nonnull @.str.39, ptr noundef nonnull %1)
  tail call void @__cxa_throw(ptr nonnull %42, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #6
  unreachable

43:                                               ; preds = %30
  %44 = tail call ptr @__cxa_allocate_exception(i64 1032) #5
  tail call void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %44, ptr noundef nonnull @.str.40, ptr noundef nonnull %1)
  tail call void @__cxa_throw(ptr nonnull %44, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #6
  unreachable

45:                                               ; preds = %40, %21
  ret void
}

attributes #0 = { 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 #1 = { 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 #2 = { 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 #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { 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 #5 = { nounwind }
attributes #6 = { noreturn }
attributes #7 = { nounwind willreturn memory(read) }

!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)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PromotePass,SROAPass,SimplifyCFGPass,TailCallElimPass