; LLVM IR from JayXon/Leanify :: formats/jpeg.ll (ZN4Jpeg7LeanifyEm)

; 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.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%struct.jpeg_decompress_struct = type { ptr, ptr, ptr, ptr, i32, i32, ptr, i32, i32, i32, i32, i32, i32, i32, double, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, i32, i32, i32, i32, i32, ptr, [4 x ptr], [4 x ptr], [4 x ptr], i32, ptr, i32, i32, [16 x i8], [16 x i8], [16 x i8], i32, i32, i8, i8, i8, i16, i16, i32, i8, i32, ptr, i32, i32, i32, i32, ptr, i32, [4 x ptr], i32, i32, i32, [10 x i32], i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.jpeg_error_mgr = type { ptr, ptr, ptr, ptr, ptr, i32, %union.anon, i32, i64, ptr, i32, ptr, i32, i32 }
%union.anon = type { [8 x i32], [48 x i8] }
%class.Format = type { ptr, ptr, i64 }
%struct.jpeg_marker_struct = type { ptr, i8, i32, i32, ptr }

@_ZN4Jpeg10keep_exif_E = external dso_local global i8, align 1
@_ZN4Jpeg17keep_icc_profile_E = external dso_local global i8, align 1
@_ZN4Jpeg18keep_all_metadata_E = external dso_local global i8, align 1
@_ZN4Jpeg24force_arithmetic_coding_E = external dso_local global i8, align 1
@_ZN12_GLOBAL__N_113setjmp_bufferE = external hidden global [1 x %struct.__jmp_buf_tag], align 16
@__const._ZN4Jpeg7LeanifyEm.kExifOrientation = external hidden unnamed_addr constant [8 x i8], align 1
@__const._ZN4Jpeg7LeanifyEm.kExifOrientationMotorola = external hidden unnamed_addr constant [8 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [132 x i8], align 1
@is_fast = external global i8, align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN4Jpeg7LeanifyEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %1) unnamed_addr #0 align 2 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca %struct.jpeg_decompress_struct, align 8
  %7 = alloca %struct.jpeg_error_mgr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca [8 x i8], align 1
  %12 = alloca [8 x i8], align 1
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i8, align 1
  %17 = alloca i16, align 2
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i64, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  %23 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 632, ptr %6) #9
  %24 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %6, i32 0, i32 3
  store ptr null, ptr %24, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 168, ptr %7) #9
  %25 = call ptr @jpeg_std_error(ptr noundef %7)
  %26 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %6, i32 0, i32 0
  store ptr %25, ptr %26, align 8, !tbaa !19
  %27 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %7, i32 0, i32 0
  store ptr @_ZN12_GLOBAL__N_121mozjpeg_error_handlerEP18jpeg_common_struct, ptr %27, align 8, !tbaa !20
  %28 = call i32 @_setjmp(ptr noundef @_ZN12_GLOBAL__N_113setjmp_bufferE) #10
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %33

30:                                               ; preds = %2
  call void @jpeg_destroy_decompress(ptr noundef %6)
  %31 = load i64, ptr %5, align 8, !tbaa !9
  %32 = call noundef i64 @_ZN6Format7LeanifyEm(ptr noundef nonnull align 8 dereferenceable(24) %23, i64 noundef %31)
  store i64 %32, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %229

33:                                               ; preds = %2
  call void @jpeg_CreateDecompress(ptr noundef %6, i32 noundef 62, i64 noundef 632)
  %34 = getelementptr inbounds %class.Format, ptr %23, i32 0, i32 1
  %35 = load ptr, ptr %34, align 8, !tbaa !22
  %36 = getelementptr inbounds %class.Format, ptr %23, i32 0, i32 2
  %37 = load i64, ptr %36, align 8, !tbaa !24
  call void @jpeg_mem_src(ptr noundef %6, ptr noundef %35, i64 noundef %37)
  call void @jpeg_save_markers(ptr noundef %6, i32 noundef 225, i32 noundef 65535)
  %38 = load i8, ptr @_ZN4Jpeg17keep_icc_profile_E, align 1, !tbaa !25, !range !27, !noundef !28
  %39 = trunc i8 %38 to i1
  br i1 %39, label %43, label %40

40:                                               ; preds = %33
  %41 = load i8, ptr @_ZN4Jpeg18keep_all_metadata_E, align 1, !tbaa !25, !range !27, !noundef !28
  %42 = trunc i8 %41 to i1
  br i1 %42, label %43, label %44

43:                                               ; preds = %40, %33
  call void @jpeg_save_markers(ptr noundef %6, i32 noundef 226, i32 noundef 65535)
  br label %44

44:                                               ; preds = %43, %40
  %45 = load i8, ptr @_ZN4Jpeg18keep_all_metadata_E, align 1, !tbaa !25, !range !27, !noundef !28
  %46 = trunc i8 %45 to i1
  br i1 %46, label %47, label %59

47:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  store i32 3, ptr %9, align 4, !tbaa !29
  br label %48

48:                                               ; preds = %55, %47
  %49 = load i32, ptr %9, align 4, !tbaa !29
  %50 = icmp slt i32 %49, 16
  br i1 %50, label %52, label %51

51:                                               ; preds = %48
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  br label %58

52:                                               ; preds = %48
  %53 = load i32, ptr %9, align 4, !tbaa !29
  %54 = add nsw i32 224, %53
  call void @jpeg_save_markers(ptr noundef %6, i32 noundef %54, i32 noundef 65535)
  br label %55

55:                                               ; preds = %52
  %56 = load i32, ptr %9, align 4, !tbaa !29
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %9, align 4, !tbaa !29
  br label %48, !llvm.loop !30

58:                                               ; preds = %51
  call void @jpeg_save_markers(ptr noundef %6, i32 noundef 254, i32 noundef 65535)
  br label %59

59:                                               ; preds = %58, %44
  %60 = call i32 @jpeg_read_header(ptr noundef %6, i32 noundef 1)
  %61 = load i8, ptr @_ZN4Jpeg10keep_exif_E, align 1, !tbaa !25, !range !27, !noundef !28
  %62 = trunc i8 %61 to i1
  br i1 %62, label %143, label %63

63:                                               ; preds = %59
  %64 = load i8, ptr @_ZN4Jpeg18keep_all_metadata_E, align 1, !tbaa !25, !range !27, !noundef !28
  %65 = trunc i8 %64 to i1
  br i1 %65, label %143, label %66

66:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  %67 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %6, i32 0, i32 60
  %68 = load ptr, ptr %67, align 8, !tbaa !32
  store ptr %68, ptr %10, align 8, !tbaa !5
  br label %69

69:                                               ; preds = %137, %66
  %70 = load ptr, ptr %10, align 8, !tbaa !5
  %71 = icmp ne ptr %70, null
  br i1 %71, label %73, label %72

72:                                               ; preds = %69
  store i32 5, ptr %8, align 4
  br label %141

73:                                               ; preds = %69
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.jpeg_marker_struct, ptr %74, i32 0, i32 1
  %76 = load i8, ptr %75, align 8, !tbaa !33
  %77 = zext i8 %76 to i32
  %78 = icmp eq i32 %77, 225
  br i1 %78, label %79, label %136

79:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %11, ptr align 1 @__const._ZN4Jpeg7LeanifyEm.kExifOrientation, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %12, ptr align 1 @__const._ZN4Jpeg7LeanifyEm.kExifOrientationMotorola, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #9
  %80 = load ptr, ptr %10, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.jpeg_marker_struct, ptr %80, i32 0, i32 4
  %82 = load ptr, ptr %81, align 8, !tbaa !35
  store ptr %82, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  %83 = load ptr, ptr %13, align 8, !tbaa !5
  %84 = load ptr, ptr %10, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.jpeg_marker_struct, ptr %84, i32 0, i32 3
  %86 = load i32, ptr %85, align 8, !tbaa !36
  %87 = zext i32 %86 to i64
  %88 = getelementptr inbounds i8, ptr %83, i64 %87
  store ptr %88, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #9
  %89 = load ptr, ptr %13, align 8, !tbaa !5
  %90 = load ptr, ptr %14, align 8, !tbaa !5
  %91 = getelementptr inbounds [8 x i8], ptr %11, i64 0, i64 0
  %92 = call noundef ptr @_ZSt3endIKhLm8EEPT_RAT0__S1_(ptr noundef nonnull align 1 dereferenceable(8) %11) #9
  %93 = call noundef ptr @_ZSt6searchIPhPKhET_S3_S3_T0_S4_(ptr noundef %89, ptr noundef %90, ptr noundef %91, ptr noundef %92)
  store ptr %93, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #9
  store i8 0, ptr %16, align 1, !tbaa !25
  %94 = load ptr, ptr %15, align 8, !tbaa !5
  %95 = load ptr, ptr %14, align 8, !tbaa !5
  %96 = icmp eq ptr %94, %95
  br i1 %96, label %97, label %107

97:                                               ; preds = %79
  %98 = load ptr, ptr %13, align 8, !tbaa !5
  %99 = load ptr, ptr %14, align 8, !tbaa !5
  %100 = getelementptr inbounds [8 x i8], ptr %12, i64 0, i64 0
  %101 = call noundef ptr @_ZSt3endIKhLm8EEPT_RAT0__S1_(ptr noundef nonnull align 1 dereferenceable(8) %12) #9
  %102 = call noundef ptr @_ZSt6searchIPhPKhET_S3_S3_T0_S4_(ptr noundef %98, ptr noundef %99, ptr noundef %100, ptr noundef %101)
  store ptr %102, ptr %15, align 8, !tbaa !5
  %103 = load ptr, ptr %15, align 8, !tbaa !5
  %104 = load ptr, ptr %14, align 8, !tbaa !5
  %105 = icmp ne ptr %103, %104
  %106 = zext i1 %105 to i8
  store i8 %106, ptr %16, align 1, !tbaa !25
  br label %107

107:                                              ; preds = %97, %79
  %108 = load ptr, ptr %15, align 8, !tbaa !5
  %109 = load ptr, ptr %14, align 8, !tbaa !5
  %110 = icmp ne ptr %108, %109
  br i1 %110, label %111, label %135

111:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 2, ptr %17) #9
  %112 = load ptr, ptr %15, align 8, !tbaa !5
  %113 = getelementptr inbounds i8, ptr %112, i64 8
  %114 = load i16, ptr %113, align 2, !tbaa !37
  store i16 %114, ptr %17, align 2, !tbaa !37
  %115 = load i8, ptr %16, align 1, !tbaa !25, !range !27, !noundef !28
  %116 = trunc i8 %115 to i1
  br i1 %116, label %117, label %127

117:                                              ; preds = %111
  %118 = load i16, ptr %17, align 2, !tbaa !37
  %119 = zext i16 %118 to i32
  %120 = ashr i32 %119, 8
  %121 = load i16, ptr %17, align 2, !tbaa !37
  %122 = zext i16 %121 to i32
  %123 = shl i32 %122, 8
  %124 = or i32 %120, %123
  %125 = and i32 %124, 65535
  %126 = trunc i32 %125 to i16
  store i16 %126, ptr %17, align 2, !tbaa !37
  br label %127

127:                                              ; preds = %117, %111
  %128 = load i16, ptr %17, align 2, !tbaa !37
  %129 = zext i16 %128 to i32
  %130 = icmp ne i32 %129, 1
  br i1 %130, label %131, label %134

131:                                              ; preds = %127
  %132 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %133 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %132, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %134

134:                                              ; preds = %131, %127
  call void @llvm.lifetime.end.p0(i64 2, ptr %17) #9
  br label %135

135:                                              ; preds = %134, %107
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  br label %141

136:                                              ; preds = %73
  br label %137

137:                                              ; preds = %136
  %138 = load ptr, ptr %10, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.jpeg_marker_struct, ptr %138, i32 0, i32 0
  %140 = load ptr, ptr %139, align 8, !tbaa !38
  store ptr %140, ptr %10, align 8, !tbaa !5
  br label %69, !llvm.loop !39

141:                                              ; preds = %135, %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  br label %142

142:                                              ; preds = %141
  br label %143

143:                                              ; preds = %142, %63, %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  %144 = call ptr @jpeg_read_coefficients(ptr noundef %6)
  store ptr %144, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #9
  store ptr null, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #9
  store i64 0, ptr %20, align 8, !tbaa !9
  %145 = load i8, ptr @is_fast, align 1, !tbaa !25, !range !27, !noundef !28
  %146 = trunc i8 %145 to i1
  br i1 %146, label %164, label %147

147:                                              ; preds = %143
  %148 = load ptr, ptr %18, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %6, i32 0, i32 46
  %150 = load i32, ptr %149, align 4, !tbaa !40
  %151 = icmp ne i32 %150, 0
  br i1 %151, label %155, label %152

152:                                              ; preds = %147
  %153 = load i8, ptr @_ZN4Jpeg24force_arithmetic_coding_E, align 1, !tbaa !25, !range !27, !noundef !28
  %154 = trunc i8 %153 to i1
  br label %155

155:                                              ; preds = %152, %147
  %156 = phi i1 [ true, %147 ], [ %154, %152 ]
  %157 = load i8, ptr @_ZN4Jpeg18keep_all_metadata_E, align 1, !tbaa !25, !range !27, !noundef !28
  %158 = trunc i8 %157 to i1
  br i1 %158, label %162, label %159

159:                                              ; preds = %155
  %160 = load i8, ptr @_ZN4Jpeg10keep_exif_E, align 1, !tbaa !25, !range !27, !noundef !28
  %161 = trunc i8 %160 to i1
  br label %162

162:                                              ; preds = %159, %155
  %163 = phi i1 [ true, %155 ], [ %161, %159 ]
  call void @_ZN12_GLOBAL__N_112CompressJpegEP22jpeg_decompress_structPP20jvirt_barray_controlbbbPPhPm(ptr noundef %6, ptr noundef %148, i1 noundef zeroext false, i1 noundef zeroext %156, i1 noundef zeroext %163, ptr noundef %19, ptr noundef %20)
  br label %164

164:                                              ; preds = %162, %143
  %165 = load i8, ptr @is_fast, align 1, !tbaa !25, !range !27, !noundef !28
  %166 = trunc i8 %165 to i1
  br i1 %166, label %171, label %167

167:                                              ; preds = %164
  %168 = getelementptr inbounds %class.Format, ptr %23, i32 0, i32 2
  %169 = load i64, ptr %168, align 8, !tbaa !24
  %170 = icmp ult i64 %169, 32768
  br i1 %170, label %171, label %198

171:                                              ; preds = %167, %164
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #9
  store ptr null, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #9
  store i64 0, ptr %22, align 8, !tbaa !9
  %172 = load ptr, ptr %18, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %6, i32 0, i32 46
  %174 = load i32, ptr %173, align 4, !tbaa !40
  %175 = icmp ne i32 %174, 0
  br i1 %175, label %179, label %176

176:                                              ; preds = %171
  %177 = load i8, ptr @_ZN4Jpeg24force_arithmetic_coding_E, align 1, !tbaa !25, !range !27, !noundef !28
  %178 = trunc i8 %177 to i1
  br label %179

179:                                              ; preds = %176, %171
  %180 = phi i1 [ true, %171 ], [ %178, %176 ]
  %181 = load i8, ptr @_ZN4Jpeg18keep_all_metadata_E, align 1, !tbaa !25, !range !27, !noundef !28
  %182 = trunc i8 %181 to i1
  br i1 %182, label %186, label %183

183:                                              ; preds = %179
  %184 = load i8, ptr @_ZN4Jpeg10keep_exif_E, align 1, !tbaa !25, !range !27, !noundef !28
  %185 = trunc i8 %184 to i1
  br label %186

186:                                              ; preds = %183, %179
  %187 = phi i1 [ true, %179 ], [ %185, %183 ]
  call void @_ZN12_GLOBAL__N_112CompressJpegEP22jpeg_decompress_structPP20jvirt_barray_controlbbbPPhPm(ptr noundef %6, ptr noundef %172, i1 noundef zeroext true, i1 noundef zeroext %180, i1 noundef zeroext %187, ptr noundef %21, ptr noundef %22)
  %188 = load i64, ptr %22, align 8, !tbaa !9
  %189 = load i64, ptr %20, align 8, !tbaa !9
  %190 = icmp ult i64 %188, %189
  br i1 %190, label %191, label %195

191:                                              ; preds = %186
  %192 = load ptr, ptr %19, align 8, !tbaa !5
  call void @free(ptr noundef %192) #9
  %193 = load ptr, ptr %21, align 8, !tbaa !5
  store ptr %193, ptr %19, align 8, !tbaa !5
  %194 = load i64, ptr %22, align 8, !tbaa !9
  store i64 %194, ptr %20, align 8, !tbaa !9
  br label %197

195:                                              ; preds = %186
  %196 = load ptr, ptr %21, align 8, !tbaa !5
  call void @free(ptr noundef %196) #9
  br label %197

197:                                              ; preds = %195, %191
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #9
  br label %198

198:                                              ; preds = %197, %167
  %199 = call i32 @jpeg_finish_decompress(ptr noundef %6)
  call void @jpeg_destroy_decompress(ptr noundef %6)
  %200 = load i64, ptr %5, align 8, !tbaa !9
  %201 = getelementptr inbounds %class.Format, ptr %23, i32 0, i32 1
  %202 = load ptr, ptr %201, align 8, !tbaa !22
  %203 = sub i64 0, %200
  %204 = getelementptr inbounds i8, ptr %202, i64 %203
  store ptr %204, ptr %201, align 8, !tbaa !22
  %205 = load i64, ptr %20, align 8, !tbaa !9
  %206 = getelementptr inbounds %class.Format, ptr %23, i32 0, i32 2
  %207 = load i64, ptr %206, align 8, !tbaa !24
  %208 = icmp ult i64 %205, %207
  br i1 %208, label %209, label %216

209:                                              ; preds = %198
  %210 = getelementptr inbounds %class.Format, ptr %23, i32 0, i32 1
  %211 = load ptr, ptr %210, align 8, !tbaa !22
  %212 = load ptr, ptr %19, align 8, !tbaa !5
  %213 = load i64, ptr %20, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %211, ptr align 1 %212, i64 %213, i1 false)
  %214 = load i64, ptr %20, align 8, !tbaa !9
  %215 = getelementptr inbounds %class.Format, ptr %23, i32 0, i32 2
  store i64 %214, ptr %215, align 8, !tbaa !24
  br label %225

216:                                              ; preds = %198
  %217 = getelementptr inbounds %class.Format, ptr %23, i32 0, i32 1
  %218 = load ptr, ptr %217, align 8, !tbaa !22
  %219 = getelementptr inbounds %class.Format, ptr %23, i32 0, i32 1
  %220 = load ptr, ptr %219, align 8, !tbaa !22
  %221 = load i64, ptr %5, align 8, !tbaa !9
  %222 = getelementptr inbounds i8, ptr %220, i64 %221
  %223 = getelementptr inbounds %class.Format, ptr %23, i32 0, i32 2
  %224 = load i64, ptr %223, align 8, !tbaa !24
  call void @llvm.memmove.p0.p0.i64(ptr align 1 %218, ptr align 1 %222, i64 %224, i1 false)
  br label %225

225:                                              ; preds = %216, %209
  %226 = load ptr, ptr %19, align 8, !tbaa !5
  call void @free(ptr noundef %226) #9
  %227 = getelementptr inbounds %class.Format, ptr %23, i32 0, i32 2
  %228 = load i64, ptr %227, align 8, !tbaa !24
  store i64 %228, ptr %3, align 8
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  br label %229

229:                                              ; preds = %225, %30
  call void @llvm.lifetime.end.p0(i64 168, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 632, ptr %6) #9
  %230 = load i64, ptr %3, align 8
  ret i64 %230
}

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

declare ptr @jpeg_std_error(ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN12_GLOBAL__N_121mozjpeg_error_handlerEP18jpeg_common_struct(ptr noundef) #0

; Function Attrs: nounwind returns_twice
declare i32 @_setjmp(ptr noundef) #3

declare void @jpeg_destroy_decompress(ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN6Format7LeanifyEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) unnamed_addr #4 align 2

declare void @jpeg_CreateDecompress(ptr noundef, i32 noundef, i64 noundef) #2

declare void @jpeg_mem_src(ptr noundef, ptr noundef, i64 noundef) #2

declare void @jpeg_save_markers(ptr noundef, i32 noundef, i32 noundef) #2

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

declare i32 @jpeg_read_header(ptr noundef, i32 noundef) #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6searchIPhPKhET_S3_S3_T0_S4_(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZSt3endIKhLm8EEPT_RAT0__S1_(ptr noundef nonnull align 1 dereferenceable(8)) #7

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #6

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #6

declare ptr @jpeg_read_coefficients(ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN12_GLOBAL__N_112CompressJpegEP22jpeg_decompress_structPP20jvirt_barray_controlbbbPPhPm(ptr noundef, ptr noundef, i1 noundef zeroext, i1 noundef zeroext, i1 noundef zeroext, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind
declare void @free(ptr noundef) #8

declare i32 @jpeg_finish_decompress(ptr noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #5

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 = { "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 returns_twice "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { 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 #8 = { 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 #9 = { nounwind }
attributes #10 = { nounwind returns_twice }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 24}
!12 = !{!"_ZTS22jpeg_decompress_struct", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !13, i64 36, !6, i64 40, !13, i64 48, !13, i64 52, !13, i64 56, !14, i64 60, !14, i64 64, !13, i64 68, !13, i64 72, !15, i64 80, !13, i64 88, !13, i64 92, !16, i64 96, !13, i64 100, !13, i64 104, !13, i64 108, !17, i64 112, !13, i64 116, !13, i64 120, !13, i64 124, !13, i64 128, !13, i64 132, !13, i64 136, !13, i64 140, !13, i64 144, !13, i64 148, !13, i64 152, !13, i64 156, !6, i64 160, !13, i64 168, !13, i64 172, !13, i64 176, !13, i64 180, !13, i64 184, !6, i64 192, !7, i64 200, !7, i64 232, !7, i64 264, !13, i64 296, !6, i64 304, !13, i64 312, !13, i64 316, !7, i64 320, !7, i64 336, !7, i64 352, !13, i64 368, !13, i64 372, !7, i64 376, !7, i64 377, !7, i64 378, !18, i64 380, !18, i64 382, !13, i64 384, !7, i64 388, !13, i64 392, !6, i64 400, !13, i64 408, !13, i64 412, !13, i64 416, !13, i64 420, !6, i64 424, !13, i64 432, !7, i64 440, !13, i64 472, !13, i64 476, !13, i64 480, !7, i64 484, !13, i64 524, !13, i64 528, !13, i64 532, !13, i64 536, !13, i64 540, !6, i64 544, !6, i64 552, !6, i64 560, !6, i64 568, !6, i64 576, !6, i64 584, !6, i64 592, !6, i64 600, !6, i64 608, !6, i64 616, !6, i64 624}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTS13J_COLOR_SPACE", !7, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = !{!"_ZTS12J_DCT_METHOD", !7, i64 0}
!17 = !{!"_ZTS13J_DITHER_MODE", !7, i64 0}
!18 = !{!"short", !7, i64 0}
!19 = !{!12, !6, i64 0}
!20 = !{!21, !6, i64 0}
!21 = !{!"_ZTS14jpeg_error_mgr", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !7, i64 44, !13, i64 124, !10, i64 128, !6, i64 136, !13, i64 144, !6, i64 152, !13, i64 160, !13, i64 164}
!22 = !{!23, !6, i64 8}
!23 = !{!"_ZTS6Format", !6, i64 8, !10, i64 16}
!24 = !{!23, !10, i64 16}
!25 = !{!26, !26, i64 0}
!26 = !{!"bool", !7, i64 0}
!27 = !{i8 0, i8 2}
!28 = !{}
!29 = !{!13, !13, i64 0}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{!12, !6, i64 400}
!33 = !{!34, !7, i64 8}
!34 = !{!"_ZTS18jpeg_marker_struct", !6, i64 0, !7, i64 8, !13, i64 12, !13, i64 16, !6, i64 24}
!35 = !{!34, !6, i64 24}
!36 = !{!34, !13, i64 16}
!37 = !{!18, !18, i64 0}
!38 = !{!34, !6, i64 0}
!39 = distinct !{!39, !31}
!40 = !{!12, !13, i64 316}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%struct.jpeg_decompress_struct = type { ptr, ptr, ptr, ptr, i32, i32, ptr, i32, i32, i32, i32, i32, i32, i32, double, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, i32, i32, i32, i32, i32, ptr, [4 x ptr], [4 x ptr], [4 x ptr], i32, ptr, i32, i32, [16 x i8], [16 x i8], [16 x i8], i32, i32, i8, i8, i8, i16, i16, i32, i8, i32, ptr, i32, i32, i32, i32, ptr, i32, [4 x ptr], i32, i32, i32, [10 x i32], i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.jpeg_error_mgr = type { ptr, ptr, ptr, ptr, ptr, i32, %union.anon, i32, i64, ptr, i32, ptr, i32, i32 }
%union.anon = type { [8 x i32], [48 x i8] }

@_ZN4Jpeg10keep_exif_E = external dso_local local_unnamed_addr global i8, align 1
@_ZN4Jpeg17keep_icc_profile_E = external dso_local local_unnamed_addr global i8, align 1
@_ZN4Jpeg18keep_all_metadata_E = external dso_local local_unnamed_addr global i8, align 1
@_ZN4Jpeg24force_arithmetic_coding_E = external dso_local local_unnamed_addr global i8, align 1
@_ZN12_GLOBAL__N_113setjmp_bufferE = external hidden global [1 x %struct.__jmp_buf_tag], align 16
@__const._ZN4Jpeg7LeanifyEm.kExifOrientation = external hidden unnamed_addr constant [8 x i8], align 1
@__const._ZN4Jpeg7LeanifyEm.kExifOrientationMotorola = external hidden unnamed_addr constant [8 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [132 x i8], align 1
@is_fast = external local_unnamed_addr global i8, align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN4Jpeg7LeanifyEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %1) unnamed_addr #0 align 2 {
  %3 = alloca %struct.jpeg_decompress_struct, align 8
  %4 = alloca %struct.jpeg_error_mgr, align 8
  %5 = alloca [8 x i8], align 8
  %6 = alloca [8 x i8], align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 632, ptr nonnull %3) #10
  %11 = getelementptr inbounds i8, ptr %3, i64 24
  store ptr null, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 168, ptr nonnull %4) #10
  %12 = call ptr @jpeg_std_error(ptr noundef nonnull %4)
  store ptr %12, ptr %3, align 8, !tbaa !16
  store ptr @_ZN12_GLOBAL__N_121mozjpeg_error_handlerEP18jpeg_common_struct, ptr %4, align 8, !tbaa !17
  %13 = call i32 @_setjmp(ptr noundef nonnull @_ZN12_GLOBAL__N_113setjmp_bufferE) #11
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %16, label %14

14:                                               ; preds = %2
  call void @jpeg_destroy_decompress(ptr noundef nonnull %3)
  %15 = call noundef i64 @_ZN6Format7LeanifyEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %1)
  br label %121

16:                                               ; preds = %2
  call void @jpeg_CreateDecompress(ptr noundef nonnull %3, i32 noundef 62, i64 noundef 632)
  %17 = getelementptr inbounds i8, ptr %0, i64 8
  %18 = load ptr, ptr %17, align 8, !tbaa !20
  %19 = getelementptr inbounds i8, ptr %0, i64 16
  %20 = load i64, ptr %19, align 8, !tbaa !22
  call void @jpeg_mem_src(ptr noundef nonnull %3, ptr noundef %18, i64 noundef %20)
  call void @jpeg_save_markers(ptr noundef nonnull %3, i32 noundef 225, i32 noundef 65535)
  %21 = load i8, ptr @_ZN4Jpeg17keep_icc_profile_E, align 1, !tbaa !23, !range !25, !noundef !26
  %22 = trunc nuw i8 %21 to i1
  br i1 %22, label %26, label %23

23:                                               ; preds = %16
  %24 = load i8, ptr @_ZN4Jpeg18keep_all_metadata_E, align 1, !tbaa !23, !range !25, !noundef !26
  %25 = trunc nuw i8 %24 to i1
  br i1 %25, label %26, label %27

26:                                               ; preds = %23, %16
  call void @jpeg_save_markers(ptr noundef nonnull %3, i32 noundef 226, i32 noundef 65535)
  %.pre = load i8, ptr @_ZN4Jpeg18keep_all_metadata_E, align 1, !tbaa !23, !range !25
  br label %27

27:                                               ; preds = %26, %23
  %28 = phi i8 [ %.pre, %26 ], [ %24, %23 ]
  %29 = trunc nuw i8 %28 to i1
  br i1 %29, label %.preheader.preheader, label %30

.preheader.preheader:                             ; preds = %27
  call void @jpeg_save_markers(ptr noundef nonnull %3, i32 noundef 227, i32 noundef 65535)
  call void @jpeg_save_markers(ptr noundef nonnull %3, i32 noundef 228, i32 noundef 65535)
  call void @jpeg_save_markers(ptr noundef nonnull %3, i32 noundef 229, i32 noundef 65535)
  call void @jpeg_save_markers(ptr noundef nonnull %3, i32 noundef 230, i32 noundef 65535)
  call void @jpeg_save_markers(ptr noundef nonnull %3, i32 noundef 231, i32 noundef 65535)
  call void @jpeg_save_markers(ptr noundef nonnull %3, i32 noundef 232, i32 noundef 65535)
  call void @jpeg_save_markers(ptr noundef nonnull %3, i32 noundef 233, i32 noundef 65535)
  call void @jpeg_save_markers(ptr noundef nonnull %3, i32 noundef 234, i32 noundef 65535)
  call void @jpeg_save_markers(ptr noundef nonnull %3, i32 noundef 235, i32 noundef 65535)
  call void @jpeg_save_markers(ptr noundef nonnull %3, i32 noundef 236, i32 noundef 65535)
  call void @jpeg_save_markers(ptr noundef nonnull %3, i32 noundef 237, i32 noundef 65535)
  call void @jpeg_save_markers(ptr noundef nonnull %3, i32 noundef 238, i32 noundef 65535)
  call void @jpeg_save_markers(ptr noundef nonnull %3, i32 noundef 239, i32 noundef 65535)
  call void @jpeg_save_markers(ptr noundef nonnull %3, i32 noundef 254, i32 noundef 65535)
  br label %30

30:                                               ; preds = %.preheader.preheader, %27
  %31 = call i32 @jpeg_read_header(ptr noundef nonnull %3, i32 noundef 1)
  %32 = load i8, ptr @_ZN4Jpeg10keep_exif_E, align 1, !tbaa !23, !range !25, !noundef !26
  %33 = trunc nuw i8 %32 to i1
  br i1 %33, label %.loopexit, label %34

34:                                               ; preds = %30
  %35 = load i8, ptr @_ZN4Jpeg18keep_all_metadata_E, align 1, !tbaa !23, !range !25, !noundef !26
  %36 = trunc nuw i8 %35 to i1
  %37 = getelementptr inbounds i8, ptr %3, i64 400
  %38 = load ptr, ptr %37, align 8
  %.not3945 = icmp eq ptr %38, null
  %or.cond48 = select i1 %36, i1 true, i1 %.not3945
  br i1 %or.cond48, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %34, %66
  %.03446 = phi ptr [ %67, %66 ], [ %38, %34 ]
  %39 = getelementptr inbounds i8, ptr %.03446, i64 8
  %40 = load i8, ptr %39, align 8, !tbaa !27
  %41 = icmp eq i8 %40, -31
  br i1 %41, label %42, label %66

42:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #10
  %43 = load i64, ptr @__const._ZN4Jpeg7LeanifyEm.kExifOrientation, align 1
  store i64 %43, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #10
  %44 = load i64, ptr @__const._ZN4Jpeg7LeanifyEm.kExifOrientationMotorola, align 1
  store i64 %44, ptr %6, align 8
  %45 = getelementptr inbounds i8, ptr %.03446, i64 24
  %46 = load ptr, ptr %45, align 8, !tbaa !29
  %47 = getelementptr inbounds i8, ptr %.03446, i64 16
  %48 = load i32, ptr %47, align 8, !tbaa !30
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds i8, ptr %46, i64 %49
  %51 = call noundef ptr @_ZSt3endIKhLm8EEPT_RAT0__S1_(ptr noundef nonnull align 1 dereferenceable(8) %5) #10
  %52 = call noundef ptr @_ZSt6searchIPhPKhET_S3_S3_T0_S4_(ptr noundef %46, ptr noundef %50, ptr noundef nonnull %5, ptr noundef %51)
  %53 = icmp eq ptr %52, %50
  br i1 %53, label %54, label %58

54:                                               ; preds = %42
  %55 = call noundef ptr @_ZSt3endIKhLm8EEPT_RAT0__S1_(ptr noundef nonnull align 1 dereferenceable(8) %6) #10
  %56 = call noundef ptr @_ZSt6searchIPhPKhET_S3_S3_T0_S4_(ptr noundef %46, ptr noundef %50, ptr noundef nonnull %6, ptr noundef %55)
  %57 = icmp ne ptr %56, %50
  br label %58

58:                                               ; preds = %54, %42
  %.032 = phi ptr [ %56, %54 ], [ %52, %42 ]
  %.031 = phi i1 [ %57, %54 ], [ false, %42 ]
  %.not40 = icmp eq ptr %.032, %50
  br i1 %.not40, label %65, label %59

59:                                               ; preds = %58
  %60 = getelementptr inbounds i8, ptr %.032, i64 8
  %61 = load i16, ptr %60, align 2, !tbaa !31
  %rev = call i16 @llvm.bswap.i16(i16 %61)
  %spec.select = select i1 %.031, i16 %rev, i16 %61
  %.not41 = icmp eq i16 %spec.select, 1
  br i1 %.not41, label %65, label %62

62:                                               ; preds = %59
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %63, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %65

65:                                               ; preds = %59, %62, %58
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #10
  br label %.loopexit

66:                                               ; preds = %.lr.ph
  %67 = load ptr, ptr %.03446, align 8, !tbaa !32
  %.not39 = icmp eq ptr %67, null
  br i1 %.not39, label %.loopexit, label %.lr.ph, !llvm.loop !33

.loopexit:                                        ; preds = %66, %65, %34, %30
  %68 = call ptr @jpeg_read_coefficients(ptr noundef nonnull %3)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #10
  store ptr null, ptr %7, align 8, !tbaa !35
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #10
  store i64 0, ptr %8, align 8, !tbaa !36
  %69 = load i8, ptr @is_fast, align 1, !tbaa !23, !range !25, !noundef !26
  %70 = trunc nuw i8 %69 to i1
  br i1 %70, label %.thread, label %71

71:                                               ; preds = %.loopexit
  %72 = getelementptr inbounds i8, ptr %3, i64 316
  %73 = load i32, ptr %72, align 4, !tbaa !37
  %74 = icmp ne i32 %73, 0
  %75 = load i8, ptr @_ZN4Jpeg24force_arithmetic_coding_E, align 1, !range !25
  %76 = trunc nuw i8 %75 to i1
  %77 = select i1 %74, i1 true, i1 %76
  %78 = load i8, ptr @_ZN4Jpeg18keep_all_metadata_E, align 1, !tbaa !23, !range !25, !noundef !26
  %79 = trunc nuw i8 %78 to i1
  %80 = load i8, ptr @_ZN4Jpeg10keep_exif_E, align 1, !range !25
  %81 = trunc nuw i8 %80 to i1
  %82 = select i1 %79, i1 true, i1 %81
  call void @_ZN12_GLOBAL__N_112CompressJpegEP22jpeg_decompress_structPP20jvirt_barray_controlbbbPPhPm(ptr noundef nonnull %3, ptr noundef %68, i1 noundef zeroext false, i1 noundef zeroext %77, i1 noundef zeroext %82, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %.pre50 = load i8, ptr @is_fast, align 1, !tbaa !23, !range !25
  %.pre51 = trunc nuw i8 %.pre50 to i1
  %83 = load i64, ptr %19, align 8
  %84 = icmp ult i64 %83, 32768
  %or.cond = select i1 %.pre51, i1 true, i1 %84
  br i1 %or.cond, label %.thread, label %106

.thread:                                          ; preds = %.loopexit, %71
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #10
  store ptr null, ptr %9, align 8, !tbaa !35
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #10
  store i64 0, ptr %10, align 8, !tbaa !36
  %85 = getelementptr inbounds i8, ptr %3, i64 316
  %86 = load i32, ptr %85, align 4, !tbaa !37
  %87 = icmp ne i32 %86, 0
  %88 = load i8, ptr @_ZN4Jpeg24force_arithmetic_coding_E, align 1, !range !25
  %89 = trunc nuw i8 %88 to i1
  %90 = select i1 %87, i1 true, i1 %89
  %91 = load i8, ptr @_ZN4Jpeg18keep_all_metadata_E, align 1, !tbaa !23, !range !25, !noundef !26
  %92 = trunc nuw i8 %91 to i1
  %93 = load i8, ptr @_ZN4Jpeg10keep_exif_E, align 1, !range !25
  %94 = trunc nuw i8 %93 to i1
  %95 = select i1 %92, i1 true, i1 %94
  call void @_ZN12_GLOBAL__N_112CompressJpegEP22jpeg_decompress_structPP20jvirt_barray_controlbbbPPhPm(ptr noundef nonnull %3, ptr noundef %68, i1 noundef zeroext true, i1 noundef zeroext %90, i1 noundef zeroext %95, ptr noundef nonnull %9, ptr noundef nonnull %10)
  %96 = load i64, ptr %10, align 8, !tbaa !36
  %97 = load i64, ptr %8, align 8, !tbaa !36
  %98 = icmp ult i64 %96, %97
  br i1 %98, label %99, label %103

99:                                               ; preds = %.thread
  %100 = load ptr, ptr %7, align 8, !tbaa !35
  call void @free(ptr noundef %100) #10
  %101 = load ptr, ptr %9, align 8, !tbaa !35
  store ptr %101, ptr %7, align 8, !tbaa !35
  %102 = load i64, ptr %10, align 8, !tbaa !36
  store i64 %102, ptr %8, align 8, !tbaa !36
  br label %105

103:                                              ; preds = %.thread
  %104 = load ptr, ptr %9, align 8, !tbaa !35
  call void @free(ptr noundef %104) #10
  br label %105

105:                                              ; preds = %103, %99
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #10
  br label %106

106:                                              ; preds = %71, %105
  %107 = call i32 @jpeg_finish_decompress(ptr noundef nonnull %3)
  call void @jpeg_destroy_decompress(ptr noundef nonnull %3)
  %108 = load ptr, ptr %17, align 8, !tbaa !20
  %109 = sub i64 0, %1
  %110 = getelementptr inbounds i8, ptr %108, i64 %109
  store ptr %110, ptr %17, align 8, !tbaa !20
  %111 = load i64, ptr %8, align 8, !tbaa !36
  %112 = load i64, ptr %19, align 8, !tbaa !22
  %113 = icmp ult i64 %111, %112
  br i1 %113, label %114, label %117

114:                                              ; preds = %106
  %115 = load ptr, ptr %7, align 8, !tbaa !35
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %110, ptr align 1 %115, i64 %111, i1 false)
  %116 = load i64, ptr %8, align 8, !tbaa !36
  store i64 %116, ptr %19, align 8, !tbaa !22
  br label %118

117:                                              ; preds = %106
  call void @llvm.memmove.p0.p0.i64(ptr align 1 %110, ptr align 1 %108, i64 %112, i1 false)
  br label %118

118:                                              ; preds = %117, %114
  %119 = load ptr, ptr %7, align 8, !tbaa !35
  call void @free(ptr noundef %119) #10
  %120 = load i64, ptr %19, align 8, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #10
  br label %121

121:                                              ; preds = %118, %14
  %.0 = phi i64 [ %15, %14 ], [ %120, %118 ]
  call void @llvm.lifetime.end.p0(i64 168, ptr nonnull %4) #10
  call void @llvm.lifetime.end.p0(i64 632, ptr nonnull %3) #10
  ret i64 %.0
}

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

declare ptr @jpeg_std_error(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN12_GLOBAL__N_121mozjpeg_error_handlerEP18jpeg_common_struct(ptr noundef) #0

; Function Attrs: nounwind returns_twice
declare i32 @_setjmp(ptr noundef) local_unnamed_addr #3

declare void @jpeg_destroy_decompress(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN6Format7LeanifyEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) unnamed_addr #4 align 2

declare void @jpeg_CreateDecompress(ptr noundef, i32 noundef, i64 noundef) local_unnamed_addr #2

declare void @jpeg_mem_src(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare void @jpeg_save_markers(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

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

declare i32 @jpeg_read_header(ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6searchIPhPKhET_S3_S3_T0_S4_(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZSt3endIKhLm8EEPT_RAT0__S1_(ptr noundef nonnull align 1 dereferenceable(8)) local_unnamed_addr #7

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #6

declare ptr @jpeg_read_coefficients(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN12_GLOBAL__N_112CompressJpegEP22jpeg_decompress_structPP20jvirt_barray_controlbbbPPhPm(ptr noundef, ptr noundef, i1 noundef zeroext, i1 noundef zeroext, i1 noundef zeroext, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #8

declare i32 @jpeg_finish_decompress(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i16 @llvm.bswap.i16(i16) #9

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 returns_twice "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { 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 #8 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { nounwind }
attributes #11 = { nounwind returns_twice }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 24}
!6 = !{!"_ZTS22jpeg_decompress_struct", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !10, i64 36, !7, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !11, i64 60, !11, i64 64, !10, i64 68, !10, i64 72, !12, i64 80, !10, i64 88, !10, i64 92, !13, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !14, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !10, i64 132, !10, i64 136, !10, i64 140, !10, i64 144, !10, i64 148, !10, i64 152, !10, i64 156, !7, i64 160, !10, i64 168, !10, i64 172, !10, i64 176, !10, i64 180, !10, i64 184, !7, i64 192, !8, i64 200, !8, i64 232, !8, i64 264, !10, i64 296, !7, i64 304, !10, i64 312, !10, i64 316, !8, i64 320, !8, i64 336, !8, i64 352, !10, i64 368, !10, i64 372, !8, i64 376, !8, i64 377, !8, i64 378, !15, i64 380, !15, i64 382, !10, i64 384, !8, i64 388, !10, i64 392, !7, i64 400, !10, i64 408, !10, i64 412, !10, i64 416, !10, i64 420, !7, i64 424, !10, i64 432, !8, i64 440, !10, i64 472, !10, i64 476, !10, i64 480, !8, i64 484, !10, i64 524, !10, i64 528, !10, i64 532, !10, i64 536, !10, i64 540, !7, i64 544, !7, i64 552, !7, i64 560, !7, i64 568, !7, i64 576, !7, i64 584, !7, i64 592, !7, i64 600, !7, i64 608, !7, i64 616, !7, i64 624}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTS13J_COLOR_SPACE", !8, i64 0}
!12 = !{!"double", !8, i64 0}
!13 = !{!"_ZTS12J_DCT_METHOD", !8, i64 0}
!14 = !{!"_ZTS13J_DITHER_MODE", !8, i64 0}
!15 = !{!"short", !8, i64 0}
!16 = !{!6, !7, i64 0}
!17 = !{!18, !7, i64 0}
!18 = !{!"_ZTS14jpeg_error_mgr", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40, !8, i64 44, !10, i64 124, !19, i64 128, !7, i64 136, !10, i64 144, !7, i64 152, !10, i64 160, !10, i64 164}
!19 = !{!"long", !8, i64 0}
!20 = !{!21, !7, i64 8}
!21 = !{!"_ZTS6Format", !7, i64 8, !19, i64 16}
!22 = !{!21, !19, i64 16}
!23 = !{!24, !24, i64 0}
!24 = !{!"bool", !8, i64 0}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = !{!28, !8, i64 8}
!28 = !{!"_ZTS18jpeg_marker_struct", !7, i64 0, !8, i64 8, !10, i64 12, !10, i64 16, !7, i64 24}
!29 = !{!28, !7, i64 24}
!30 = !{!28, !10, i64 16}
!31 = !{!15, !15, i64 0}
!32 = !{!28, !7, i64 0}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = !{!7, !7, i64 0}
!36 = !{!19, !19, i64 0}
!37 = !{!6, !10, i64 316}


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