; LLVM IR from Razakhel/RaZ :: src/RaZ/Data/ImageFormat.ll (ZN3Raz11ImageFormat4saveERKNS_8FilePathERKNS_5ImageEb)

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

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.Raz::FilePath" = type { %"class.std::__cxx11::basic_string" }

@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZTISt16invalid_argument = external constant ptr
@.str.17 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [26 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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @stbi_flip_vertically_on_write(i32 noundef) #1

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

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

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

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

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

declare void @_ZN3Raz6Logger5debugERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32)) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_PKS5_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZN3RazplB5cxx11EPKcRKNS_8FilePathE(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef, ptr noundef nonnull align 8 dereferenceable(32)) #4

declare i32 @__gxx_personality_v0(...)

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

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

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

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

declare ptr @__cxa_allocate_exception(i64)

declare void @_ZNSt16invalid_argumentC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZNSt16invalid_argumentD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #5

declare void @__cxa_throw(ptr, ptr, ptr)

declare void @__cxa_free_exception(ptr)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3Raz6Logger5debugEPKc(ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Raz11ImageFormat4saveERKNS_8FilePathERKNS_5ImageEb(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i1 noundef zeroext %2) #2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %"class.std::__cxx11::basic_string", align 8
  %12 = alloca %"class.std::__cxx11::basic_string", align 8
  %13 = alloca %"class.std::__cxx11::basic_string", align 8
  %14 = alloca %"class.Raz::FilePath", align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca %"class.std::__cxx11::basic_string", align 8
  %21 = alloca %"class.std::__cxx11::basic_string", align 8
  %22 = alloca i1, align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %23 = zext i1 %2 to i8
  store i8 %23, ptr %6, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #7
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN3RazplB5cxx11EPKcRKNS_8FilePathE(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %8, ptr noundef @.str.17, ptr noundef nonnull align 8 dereferenceable(32) %24)
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_PKS5_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %7, ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef @.str.10)
          to label %25 unwind label %48

25:                                               ; preds = %3
  invoke void @_ZN3Raz6Logger5debugERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %26 unwind label %52

26:                                               ; preds = %25
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #7
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK3Raz8FilePath6toUtf8B5cxx11Ev(ptr noundef nonnull align 8 dereferenceable(32) %27)
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull align 8 dereferenceable(32) %28)
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #7
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZNK3Raz8FilePath16recoverExtensionEv(ptr dead_on_unwind writable sret(%"class.Raz::FilePath") align 8 %14, ptr noundef nonnull align 8 dereferenceable(32) %29)
          to label %30 unwind label %57

30:                                               ; preds = %26
  %31 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNK3Raz8FilePath6toUtf8B5cxx11Ev(ptr noundef nonnull align 8 dereferenceable(32) %14)
          to label %32 unwind label %61

32:                                               ; preds = %30
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef nonnull align 8 dereferenceable(32) %31)
          to label %33 unwind label %61

33:                                               ; preds = %32
  invoke void @_ZN3Raz8StrUtils15toLowercaseCopyENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %12, ptr noundef %13)
          to label %34 unwind label %65

34:                                               ; preds = %33
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #7
  call void @_ZN3Raz8FilePathD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #7
  %35 = load i8, ptr %6, align 1, !tbaa !9, !range !11, !noundef !12
  %36 = trunc i8 %35 to i1
  %37 = zext i1 %36 to i32
  call void @stbi_flip_vertically_on_write(i32 noundef %37)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = call noundef i32 @_ZNK3Raz5Image8getWidthEv(ptr noundef nonnull align 8 dereferenceable(32) %38) #7
  store i32 %39, ptr %15, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = call noundef i32 @_ZNK3Raz5Image9getHeightEv(ptr noundef nonnull align 8 dereferenceable(32) %40) #7
  store i32 %41, ptr %16, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = call noundef zeroext i8 @_ZNK3Raz5Image15getChannelCountEv(ptr noundef nonnull align 8 dereferenceable(32) %42) #7
  %44 = zext i8 %43 to i32
  store i32 %44, ptr %17, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %45 = invoke noundef i32 @_ZN3Raz11ImageFormat12_GLOBAL__N_117recoverFileFormatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %46 unwind label %71

46:                                               ; preds = %34
  store i32 %45, ptr %18, align 4, !tbaa !15
  %47 = load i32, ptr %18, align 4, !tbaa !15
  switch i32 %47, label %100 [
    i32 1, label %75
    i32 3, label %75
    i32 2, label %75
    i32 4, label %75
    i32 5, label %87
    i32 0, label %99
  ]

48:                                               ; preds = %3
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %9, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %10, align 4
  br label %56

52:                                               ; preds = %25
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %9, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %10, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #7
  br label %56

56:                                               ; preds = %52, %48
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #7
  br label %193

57:                                               ; preds = %26
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %9, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %10, align 4
  br label %70

61:                                               ; preds = %32, %30
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %9, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %10, align 4
  br label %69

65:                                               ; preds = %33
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %9, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %10, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #7
  br label %69

69:                                               ; preds = %65, %61
  call void @_ZN3Raz8FilePathD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #7
  br label %70

70:                                               ; preds = %69, %57
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #7
  br label %192

71:                                               ; preds = %93, %81, %34
  %72 = landingpad { ptr, i32 }
          cleanup
  %73 = extractvalue { ptr, i32 } %72, 0
  store ptr %73, ptr %9, align 8
  %74 = extractvalue { ptr, i32 } %72, 1
  store i32 %74, ptr %10, align 4
  br label %191

75:                                               ; preds = %46, %46, %46, %46
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = call noundef i32 @_ZNK3Raz5Image11getDataTypeEv(ptr noundef nonnull align 8 dereferenceable(32) %76) #7
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %86

79:                                               ; preds = %75
  %80 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %80, ptr noundef @.str.18)
          to label %81 unwind label %82

81:                                               ; preds = %79
  invoke void @__cxa_throw(ptr %80, ptr @_ZTISt16invalid_argument, ptr @_ZNSt16invalid_argumentD1Ev) #8
          to label %198 unwind label %71

82:                                               ; preds = %79
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %9, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %10, align 4
  call void @__cxa_free_exception(ptr %80) #7
  br label %191

86:                                               ; preds = %75
  br label %101

87:                                               ; preds = %46
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = call noundef i32 @_ZNK3Raz5Image11getDataTypeEv(ptr noundef nonnull align 8 dereferenceable(32) %88) #7
  %90 = icmp ne i32 %89, 1
  br i1 %90, label %91, label %98

91:                                               ; preds = %87
  %92 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %92, ptr noundef @.str.19)
          to label %93 unwind label %94

93:                                               ; preds = %91
  invoke void @__cxa_throw(ptr %92, ptr @_ZTISt16invalid_argument, ptr @_ZNSt16invalid_argumentD1Ev) #8
          to label %198 unwind label %71

94:                                               ; preds = %91
  %95 = landingpad { ptr, i32 }
          cleanup
  %96 = extractvalue { ptr, i32 } %95, 0
  store ptr %96, ptr %9, align 8
  %97 = extractvalue { ptr, i32 } %95, 1
  store i32 %97, ptr %10, align 4
  call void @__cxa_free_exception(ptr %92) #7
  br label %191

98:                                               ; preds = %87
  br label %101

99:                                               ; preds = %46
  br label %100

100:                                              ; preds = %99, %46
  br label %101

101:                                              ; preds = %100, %98, %86
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !13
  %102 = load i32, ptr %18, align 4, !tbaa !15
  switch i32 %102, label %156 [
    i32 1, label %103
    i32 5, label %116
    i32 3, label %125
    i32 2, label %134
    i32 4, label %146
    i32 0, label %155
  ]

103:                                              ; preds = %101
  %104 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %11) #7
  %105 = load i32, ptr %15, align 4, !tbaa !13
  %106 = load i32, ptr %16, align 4, !tbaa !13
  %107 = load i32, ptr %17, align 4, !tbaa !13
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = call noundef ptr @_ZNK3Raz5Image10getDataPtrEv(ptr noundef nonnull align 8 dereferenceable(32) %108) #7
  %110 = invoke i32 @stbi_write_bmp(ptr noundef %104, i32 noundef %105, i32 noundef %106, i32 noundef %107, ptr noundef %109)
          to label %111 unwind label %112

111:                                              ; preds = %103
  store i32 %110, ptr %19, align 4, !tbaa !13
  br label %178

112:                                              ; preds = %188, %183, %146, %134, %125, %116, %103
  %113 = landingpad { ptr, i32 }
          cleanup
  %114 = extractvalue { ptr, i32 } %113, 0
  store ptr %114, ptr %9, align 8
  %115 = extractvalue { ptr, i32 } %113, 1
  store i32 %115, ptr %10, align 4
  br label %190

116:                                              ; preds = %101
  %117 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %11) #7
  %118 = load i32, ptr %15, align 4, !tbaa !13
  %119 = load i32, ptr %16, align 4, !tbaa !13
  %120 = load i32, ptr %17, align 4, !tbaa !13
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = call noundef ptr @_ZNK3Raz5Image10getDataPtrEv(ptr noundef nonnull align 8 dereferenceable(32) %121) #7
  %123 = invoke i32 @stbi_write_hdr(ptr noundef %117, i32 noundef %118, i32 noundef %119, i32 noundef %120, ptr noundef %122)
          to label %124 unwind label %112

124:                                              ; preds = %116
  store i32 %123, ptr %19, align 4, !tbaa !13
  br label %178

125:                                              ; preds = %101
  %126 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %11) #7
  %127 = load i32, ptr %15, align 4, !tbaa !13
  %128 = load i32, ptr %16, align 4, !tbaa !13
  %129 = load i32, ptr %17, align 4, !tbaa !13
  %130 = load ptr, ptr %5, align 8, !tbaa !5
  %131 = call noundef ptr @_ZNK3Raz5Image10getDataPtrEv(ptr noundef nonnull align 8 dereferenceable(32) %130) #7
  %132 = invoke i32 @stbi_write_jpg(ptr noundef %126, i32 noundef %127, i32 noundef %128, i32 noundef %129, ptr noundef %131, i32 noundef 90)
          to label %133 unwind label %112

133:                                              ; preds = %125
  store i32 %132, ptr %19, align 4, !tbaa !13
  br label %178

134:                                              ; preds = %101
  %135 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %11) #7
  %136 = load i32, ptr %15, align 4, !tbaa !13
  %137 = load i32, ptr %16, align 4, !tbaa !13
  %138 = load i32, ptr %17, align 4, !tbaa !13
  %139 = load ptr, ptr %5, align 8, !tbaa !5
  %140 = call noundef ptr @_ZNK3Raz5Image10getDataPtrEv(ptr noundef nonnull align 8 dereferenceable(32) %139) #7
  %141 = load i32, ptr %15, align 4, !tbaa !13
  %142 = load i32, ptr %17, align 4, !tbaa !13
  %143 = mul nsw i32 %141, %142
  %144 = invoke i32 @stbi_write_png(ptr noundef %135, i32 noundef %136, i32 noundef %137, i32 noundef %138, ptr noundef %140, i32 noundef %143)
          to label %145 unwind label %112

145:                                              ; preds = %134
  store i32 %144, ptr %19, align 4, !tbaa !13
  br label %178

146:                                              ; preds = %101
  %147 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %11) #7
  %148 = load i32, ptr %15, align 4, !tbaa !13
  %149 = load i32, ptr %16, align 4, !tbaa !13
  %150 = load i32, ptr %17, align 4, !tbaa !13
  %151 = load ptr, ptr %5, align 8, !tbaa !5
  %152 = call noundef ptr @_ZNK3Raz5Image10getDataPtrEv(ptr noundef nonnull align 8 dereferenceable(32) %151) #7
  %153 = invoke i32 @stbi_write_tga(ptr noundef %147, i32 noundef %148, i32 noundef %149, i32 noundef %150, ptr noundef %152)
          to label %154 unwind label %112

154:                                              ; preds = %146
  store i32 %153, ptr %19, align 4, !tbaa !13
  br label %178

155:                                              ; preds = %101
  br label %156

156:                                              ; preds = %155, %101
  store i1 true, ptr %22, align 1
  %157 = call ptr @__cxa_allocate_exception(i64 16) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %20) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %21) #7
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_RKS8_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %21, ptr noundef @.str.20, ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %158 unwind label %161

158:                                              ; preds = %156
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_PKS5_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %20, ptr noundef nonnull align 8 dereferenceable(32) %21, ptr noundef @.str.21)
          to label %159 unwind label %165

159:                                              ; preds = %158
  invoke void @_ZNSt16invalid_argumentC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %157, ptr noundef nonnull align 8 dereferenceable(32) %20)
          to label %160 unwind label %169

160:                                              ; preds = %159
  store i1 false, ptr %22, align 1
  invoke void @__cxa_throw(ptr %157, ptr @_ZTISt16invalid_argument, ptr @_ZNSt16invalid_argumentD1Ev) #8
          to label %198 unwind label %169

161:                                              ; preds = %156
  %162 = landingpad { ptr, i32 }
          cleanup
  %163 = extractvalue { ptr, i32 } %162, 0
  store ptr %163, ptr %9, align 8
  %164 = extractvalue { ptr, i32 } %162, 1
  store i32 %164, ptr %10, align 4
  br label %174

165:                                              ; preds = %158
  %166 = landingpad { ptr, i32 }
          cleanup
  %167 = extractvalue { ptr, i32 } %166, 0
  store ptr %167, ptr %9, align 8
  %168 = extractvalue { ptr, i32 } %166, 1
  store i32 %168, ptr %10, align 4
  br label %173

169:                                              ; preds = %160, %159
  %170 = landingpad { ptr, i32 }
          cleanup
  %171 = extractvalue { ptr, i32 } %170, 0
  store ptr %171, ptr %9, align 8
  %172 = extractvalue { ptr, i32 } %170, 1
  store i32 %172, ptr %10, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %20) #7
  br label %173

173:                                              ; preds = %169, %165
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %21) #7
  br label %174

174:                                              ; preds = %173, %161
  call void @llvm.lifetime.end.p0(i64 32, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %20) #7
  %175 = load i1, ptr %22, align 1
  br i1 %175, label %176, label %177

176:                                              ; preds = %174
  call void @__cxa_free_exception(ptr %157) #7
  br label %177

177:                                              ; preds = %176, %174
  br label %190

178:                                              ; preds = %154, %145, %133, %124, %111
  %179 = load i32, ptr %19, align 4, !tbaa !13
  %180 = icmp eq i32 %179, 0
  br i1 %180, label %181, label %188

181:                                              ; preds = %178
  %182 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %182, ptr noundef @.str.22)
          to label %183 unwind label %184

183:                                              ; preds = %181
  invoke void @__cxa_throw(ptr %182, ptr @_ZTISt16invalid_argument, ptr @_ZNSt16invalid_argumentD1Ev) #8
          to label %198 unwind label %112

184:                                              ; preds = %181
  %185 = landingpad { ptr, i32 }
          cleanup
  %186 = extractvalue { ptr, i32 } %185, 0
  store ptr %186, ptr %9, align 8
  %187 = extractvalue { ptr, i32 } %185, 1
  store i32 %187, ptr %10, align 4
  call void @__cxa_free_exception(ptr %182) #7
  br label %190

188:                                              ; preds = %178
  invoke void @_ZN3Raz6Logger5debugEPKc(ptr noundef @.str.23)
          to label %189 unwind label %112

189:                                              ; preds = %188
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #7
  ret void

190:                                              ; preds = %184, %177, %112
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %191

191:                                              ; preds = %190, %94, %82, %71
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #7
  br label %192

192:                                              ; preds = %191, %70
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #7
  br label %193

193:                                              ; preds = %192, %56
  %194 = load ptr, ptr %9, align 8
  %195 = load i32, ptr %10, align 4
  %196 = insertvalue { ptr, i32 } poison, ptr %194, 0
  %197 = insertvalue { ptr, i32 } %196, i32 %195, 1
  resume { ptr, i32 } %197

198:                                              ; preds = %183, %160, %93, %81
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3Raz8FilePath16recoverExtensionEv(ptr dead_on_unwind noalias writable sret(%"class.Raz::FilePath") align 8, ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i8 @_ZNK3Raz5Image15getChannelCountEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZN3Raz11ImageFormat12_GLOBAL__N_117recoverFileFormatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32)) #2

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

declare void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_RKS8_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef, ptr noundef nonnull align 8 dereferenceable(32)) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { "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 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 "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 = { nounwind }
attributes #8 = { noreturn }

!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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!7, !7, i64 0}


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

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.Raz::FilePath" = type { %"class.std::__cxx11::basic_string" }

@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZTISt16invalid_argument = external constant ptr
@.str.17 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [26 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

; 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 nounwind uwtable
declare dso_local void @stbi_flip_vertically_on_write(i32 noundef) local_unnamed_addr #1

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

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

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

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

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

declare void @_ZN3Raz6Logger5debugERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_PKS5_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZN3RazplB5cxx11EPKcRKNS_8FilePathE(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

declare i32 @__gxx_personality_v0(...)

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

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

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

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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @_ZNSt16invalid_argumentC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZNSt16invalid_argumentD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #5

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

declare void @__cxa_free_exception(ptr) local_unnamed_addr

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3Raz6Logger5debugEPKc(ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Raz11ImageFormat4saveERKNS_8FilePathERKNS_5ImageEb(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i1 noundef zeroext %2) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca %"class.Raz::FilePath", align 8
  %10 = alloca %"class.std::__cxx11::basic_string", align 8
  %11 = alloca %"class.std::__cxx11::basic_string", align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #7
  call void @_ZN3RazplB5cxx11EPKcRKNS_8FilePathE(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %5, ptr noundef nonnull @.str.17, ptr noundef nonnull align 8 dereferenceable(32) %0)
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_PKS5_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %4, ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull @.str.10)
          to label %12 unwind label %26

12:                                               ; preds = %3
  invoke void @_ZN3Raz6Logger5debugERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %13 unwind label %28

13:                                               ; preds = %12
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #7
  %14 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK3Raz8FilePath6toUtf8B5cxx11Ev(ptr noundef nonnull align 8 dereferenceable(32) %0)
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 8 dereferenceable(32) %14)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #7
  invoke void @_ZNK3Raz8FilePath16recoverExtensionEv(ptr dead_on_unwind nonnull writable sret(%"class.Raz::FilePath") align 8 %9, ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %15 unwind label %31

15:                                               ; preds = %13
  %16 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK3Raz8FilePath6toUtf8B5cxx11Ev(ptr noundef nonnull align 8 dereferenceable(32) %9)
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(32) %16)
          to label %17 unwind label %33

17:                                               ; preds = %15
  invoke void @_ZN3Raz8StrUtils15toLowercaseCopyENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %7, ptr noundef nonnull %8)
          to label %18 unwind label %35

18:                                               ; preds = %17
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #7
  call void @_ZN3Raz8FilePathD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #7
  %19 = zext i1 %2 to i32
  call void @stbi_flip_vertically_on_write(i32 noundef %19)
  %20 = call noundef i32 @_ZNK3Raz5Image8getWidthEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #7
  %21 = call noundef i32 @_ZNK3Raz5Image9getHeightEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #7
  %22 = call noundef zeroext i8 @_ZNK3Raz5Image15getChannelCountEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #7
  %23 = zext i8 %22 to i32
  %24 = invoke noundef i32 @_ZN3Raz11ImageFormat12_GLOBAL__N_117recoverFileFormatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %25 unwind label %39

25:                                               ; preds = %18
  switch i32 %24, label %71 [
    i32 1, label %41
    i32 3, label %41
    i32 2, label %41
    i32 4, label %41
    i32 5, label %47
  ]

26:                                               ; preds = %3
  %27 = landingpad { ptr, i32 }
          cleanup
  br label %30

28:                                               ; preds = %12
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  br label %30

30:                                               ; preds = %28, %26
  %.pn = phi { ptr, i32 } [ %29, %28 ], [ %27, %26 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #7
  br label %92

31:                                               ; preds = %13
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %38

33:                                               ; preds = %15
  %34 = landingpad { ptr, i32 }
          cleanup
  br label %37

35:                                               ; preds = %17
  %36 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #7
  br label %37

37:                                               ; preds = %35, %33
  %.pn50 = phi { ptr, i32 } [ %36, %35 ], [ %34, %33 ]
  call void @_ZN3Raz8FilePathD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #7
  br label %38

38:                                               ; preds = %37, %31
  %.pn50.pn = phi { ptr, i32 } [ %.pn50, %37 ], [ %32, %31 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #7
  br label %91

39:                                               ; preds = %.invoke, %18
  %40 = landingpad { ptr, i32 }
          cleanup
  br label %90

41:                                               ; preds = %25, %25, %25, %25
  %42 = call noundef i32 @_ZNK3Raz5Image11getDataTypeEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #7
  %.not53 = icmp eq i32 %42, 0
  br i1 %.not53, label %54, label %43

43:                                               ; preds = %41
  %44 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %44, ptr noundef nonnull @.str.18)
          to label %.invoke unwind label %45

45:                                               ; preds = %43
  %46 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %44) #7
  br label %90

47:                                               ; preds = %25
  %48 = call noundef i32 @_ZNK3Raz5Image11getDataTypeEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #7
  %.not = icmp eq i32 %48, 1
  br i1 %.not, label %.thread, label %49

49:                                               ; preds = %47
  %50 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %50, ptr noundef nonnull @.str.19)
          to label %.invoke unwind label %52

.invoke:                                          ; preds = %49, %43
  %51 = phi ptr [ %44, %43 ], [ %50, %49 ]
  invoke void @__cxa_throw(ptr nonnull %51, ptr nonnull @_ZTISt16invalid_argument, ptr nonnull @_ZNSt16invalid_argumentD1Ev) #8
          to label %.cont unwind label %39

.cont:                                            ; preds = %.invoke
  unreachable

52:                                               ; preds = %49
  %53 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %50) #7
  br label %90

54:                                               ; preds = %41
  %55 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  %56 = call noundef ptr @_ZNK3Raz5Image10getDataPtrEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #7
  switch i32 %24, label %default.unreachable [
    i32 1, label %57
    i32 4, label %69
    i32 3, label %64
    i32 2, label %66
  ]

57:                                               ; preds = %54
  %58 = invoke i32 @stbi_write_bmp(ptr noundef %55, i32 noundef %20, i32 noundef %21, i32 noundef %23, ptr noundef %56)
          to label %81 unwind label %59

59:                                               ; preds = %88, %85, %69, %66, %64, %.thread, %57
  %60 = landingpad { ptr, i32 }
          cleanup
  br label %90

.thread:                                          ; preds = %47
  %61 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  %62 = call noundef ptr @_ZNK3Raz5Image10getDataPtrEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #7
  %63 = invoke i32 @stbi_write_hdr(ptr noundef %61, i32 noundef %20, i32 noundef %21, i32 noundef %23, ptr noundef %62)
          to label %81 unwind label %59

64:                                               ; preds = %54
  %65 = invoke i32 @stbi_write_jpg(ptr noundef %55, i32 noundef %20, i32 noundef %21, i32 noundef %23, ptr noundef %56, i32 noundef 90)
          to label %81 unwind label %59

66:                                               ; preds = %54
  %67 = mul nsw i32 %20, %23
  %68 = invoke i32 @stbi_write_png(ptr noundef %55, i32 noundef %20, i32 noundef %21, i32 noundef %23, ptr noundef %56, i32 noundef %67)
          to label %81 unwind label %59

69:                                               ; preds = %54
  %70 = invoke i32 @stbi_write_tga(ptr noundef %55, i32 noundef %20, i32 noundef %21, i32 noundef %23, ptr noundef %56)
          to label %81 unwind label %59

default.unreachable:                              ; preds = %54
  unreachable

71:                                               ; preds = %25
  %72 = call ptr @__cxa_allocate_exception(i64 16) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %10) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %11) #7
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_RKS8_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %11, ptr noundef nonnull @.str.20, ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %73 unwind label %.thread61

73:                                               ; preds = %71
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_PKS5_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %10, ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull @.str.21)
          to label %74 unwind label %.thread65

74:                                               ; preds = %73
  invoke void @_ZNSt16invalid_argumentC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %72, ptr noundef nonnull align 8 dereferenceable(32) %10)
          to label %75 unwind label %78

75:                                               ; preds = %74
  invoke void @__cxa_throw(ptr nonnull %72, ptr nonnull @_ZTISt16invalid_argument, ptr nonnull @_ZNSt16invalid_argumentD1Ev) #8
          to label %93 unwind label %78

.thread61:                                        ; preds = %71
  %76 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #7
  br label %80

.thread65:                                        ; preds = %73
  %77 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #7
  br label %80

78:                                               ; preds = %74, %75
  %.0 = phi i1 [ false, %75 ], [ true, %74 ]
  %79 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #7
  br i1 %.0, label %80, label %90

80:                                               ; preds = %.thread65, %.thread61, %78
  %.pn54.pn64 = phi { ptr, i32 } [ %76, %.thread61 ], [ %79, %78 ], [ %77, %.thread65 ]
  call void @__cxa_free_exception(ptr %72) #7
  br label %90

81:                                               ; preds = %69, %66, %64, %.thread, %57
  %.036 = phi i32 [ %58, %57 ], [ %63, %.thread ], [ %65, %64 ], [ %68, %66 ], [ %70, %69 ]
  %82 = icmp eq i32 %.036, 0
  br i1 %82, label %83, label %88

83:                                               ; preds = %81
  %84 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %84, ptr noundef nonnull @.str.22)
          to label %85 unwind label %86

85:                                               ; preds = %83
  invoke void @__cxa_throw(ptr nonnull %84, ptr nonnull @_ZTISt16invalid_argument, ptr nonnull @_ZNSt16invalid_argumentD1Ev) #8
          to label %93 unwind label %59

86:                                               ; preds = %83
  %87 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %84) #7
  br label %90

88:                                               ; preds = %81
  invoke void @_ZN3Raz6Logger5debugEPKc(ptr noundef nonnull @.str.23)
          to label %89 unwind label %59

89:                                               ; preds = %88
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #7
  ret void

90:                                               ; preds = %59, %86, %80, %78, %52, %45, %39
  %.pn54.pn.pn.pn = phi { ptr, i32 } [ %40, %39 ], [ %53, %52 ], [ %46, %45 ], [ %.pn54.pn64, %80 ], [ %79, %78 ], [ %60, %59 ], [ %87, %86 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #7
  br label %91

91:                                               ; preds = %90, %38
  %.pn54.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn54.pn.pn.pn, %90 ], [ %.pn50.pn, %38 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #7
  br label %92

92:                                               ; preds = %91, %30
  %.pn54.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn54.pn.pn.pn.pn, %91 ], [ %.pn, %30 ]
  resume { ptr, i32 } %.pn54.pn.pn.pn.pn.pn

93:                                               ; preds = %85, %75
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3Raz8FilePath16recoverExtensionEv(ptr dead_on_unwind noalias writable sret(%"class.Raz::FilePath") align 8, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i8 @_ZNK3Raz5Image15getChannelCountEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

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

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

declare void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_RKS8_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { "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 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 "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 = { nounwind }
attributes #8 = { noreturn }

!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: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,ReassociatePass,SROAPass,SimplifyCFGPass