; LLVM IR from drohmer/cgp :: library/third_party/src/jpeg/jpge.ll (ZN4jpge12jpeg_encoder8jpg_openEiii)

; 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.jpge::jpeg_encoder" = type <{ ptr, %"struct.jpge::params", i8, [3 x i8], [3 x i8], i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [16 x ptr], i8, [3 x i8], [64 x i32], [64 x i16], [2 x [64 x i32]], [4 x [256 x i32]], [4 x [256 x i8]], [4 x [17 x i8]], [4 x [256 x i8]], [4 x [256 x i32]], [3 x i32], [2048 x i8], [4 x i8], ptr, i32, i32, i32, i8, i8, [2 x i8] }>
%"struct.jpge::params" = type <{ i32, i32, i8, i8, [2 x i8] }>

@_ZN4jpgeL15s_std_lum_quantE = external hidden global [64 x i16], align 16
@_ZN4jpgeL17s_std_croma_quantE = external hidden global [64 x i16], align 16
@_ZN4jpgeL13s_dc_lum_bitsE = external hidden global [17 x i8], align 16
@_ZN4jpgeL12s_dc_lum_valE = external hidden global [12 x i8], align 1
@_ZN4jpgeL13s_ac_lum_bitsE = external hidden global [17 x i8], align 16
@_ZN4jpgeL16s_dc_chroma_bitsE = external hidden global [17 x i8], align 16
@_ZN4jpgeL15s_dc_chroma_valE = external hidden global [12 x i8], align 1
@_ZN4jpgeL16s_ac_chroma_bitsE = external hidden global [17 x i8], align 16
@_ZN4jpgeL12s_ac_lum_valE = external hidden global <{ [162 x i8], [94 x i8] }>, align 16
@_ZN4jpgeL15s_ac_chroma_valE = external hidden global <{ [162 x i8], [94 x i8] }>, align 16

; 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 @_ZN4jpge12jpeg_encoder19compute_quant_tableEPiPs(ptr noundef nonnull align 8 dereferenceable(13494), ptr noundef, ptr noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4jpge12jpeg_encoder16second_pass_initEv(ptr noundef nonnull align 8 dereferenceable(13494)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4jpge12jpeg_encoder8jpg_openEiii(ptr noundef nonnull align 8 dereferenceable(13494) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #2 align 2 {
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  %11 = load ptr, ptr %6, align 8
  %12 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 2
  store i8 3, ptr %12, align 4, !tbaa !11
  %13 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 1
  %14 = getelementptr inbounds %"struct.jpge::params", ptr %13, i32 0, i32 1
  %15 = load i32, ptr %14, align 4, !tbaa !16
  switch i32 %15, label %69 [
    i32 0, label %16
    i32 1, label %24
    i32 2, label %39
    i32 3, label %54
  ]

16:                                               ; preds = %4
  %17 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 2
  store i8 1, ptr %17, align 4, !tbaa !11
  %18 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 3
  %19 = getelementptr inbounds [3 x i8], ptr %18, i64 0, i64 0
  store i8 1, ptr %19, align 1, !tbaa !17
  %20 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 4
  %21 = getelementptr inbounds [3 x i8], ptr %20, i64 0, i64 0
  store i8 1, ptr %21, align 8, !tbaa !17
  %22 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 15
  store i32 8, ptr %22, align 8, !tbaa !18
  %23 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 16
  store i32 8, ptr %23, align 4, !tbaa !19
  br label %69

24:                                               ; preds = %4
  %25 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 3
  %26 = getelementptr inbounds [3 x i8], ptr %25, i64 0, i64 0
  store i8 1, ptr %26, align 1, !tbaa !17
  %27 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 4
  %28 = getelementptr inbounds [3 x i8], ptr %27, i64 0, i64 0
  store i8 1, ptr %28, align 8, !tbaa !17
  %29 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 3
  %30 = getelementptr inbounds [3 x i8], ptr %29, i64 0, i64 1
  store i8 1, ptr %30, align 1, !tbaa !17
  %31 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 4
  %32 = getelementptr inbounds [3 x i8], ptr %31, i64 0, i64 1
  store i8 1, ptr %32, align 1, !tbaa !17
  %33 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 3
  %34 = getelementptr inbounds [3 x i8], ptr %33, i64 0, i64 2
  store i8 1, ptr %34, align 1, !tbaa !17
  %35 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 4
  %36 = getelementptr inbounds [3 x i8], ptr %35, i64 0, i64 2
  store i8 1, ptr %36, align 2, !tbaa !17
  %37 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 15
  store i32 8, ptr %37, align 8, !tbaa !18
  %38 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 16
  store i32 8, ptr %38, align 4, !tbaa !19
  br label %69

39:                                               ; preds = %4
  %40 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 3
  %41 = getelementptr inbounds [3 x i8], ptr %40, i64 0, i64 0
  store i8 2, ptr %41, align 1, !tbaa !17
  %42 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 4
  %43 = getelementptr inbounds [3 x i8], ptr %42, i64 0, i64 0
  store i8 1, ptr %43, align 8, !tbaa !17
  %44 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 3
  %45 = getelementptr inbounds [3 x i8], ptr %44, i64 0, i64 1
  store i8 1, ptr %45, align 1, !tbaa !17
  %46 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 4
  %47 = getelementptr inbounds [3 x i8], ptr %46, i64 0, i64 1
  store i8 1, ptr %47, align 1, !tbaa !17
  %48 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 3
  %49 = getelementptr inbounds [3 x i8], ptr %48, i64 0, i64 2
  store i8 1, ptr %49, align 1, !tbaa !17
  %50 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 4
  %51 = getelementptr inbounds [3 x i8], ptr %50, i64 0, i64 2
  store i8 1, ptr %51, align 2, !tbaa !17
  %52 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 15
  store i32 16, ptr %52, align 8, !tbaa !18
  %53 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 16
  store i32 8, ptr %53, align 4, !tbaa !19
  br label %69

54:                                               ; preds = %4
  %55 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 3
  %56 = getelementptr inbounds [3 x i8], ptr %55, i64 0, i64 0
  store i8 2, ptr %56, align 1, !tbaa !17
  %57 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 4
  %58 = getelementptr inbounds [3 x i8], ptr %57, i64 0, i64 0
  store i8 2, ptr %58, align 8, !tbaa !17
  %59 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 3
  %60 = getelementptr inbounds [3 x i8], ptr %59, i64 0, i64 1
  store i8 1, ptr %60, align 1, !tbaa !17
  %61 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 4
  %62 = getelementptr inbounds [3 x i8], ptr %61, i64 0, i64 1
  store i8 1, ptr %62, align 1, !tbaa !17
  %63 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 3
  %64 = getelementptr inbounds [3 x i8], ptr %63, i64 0, i64 2
  store i8 1, ptr %64, align 1, !tbaa !17
  %65 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 4
  %66 = getelementptr inbounds [3 x i8], ptr %65, i64 0, i64 2
  store i8 1, ptr %66, align 2, !tbaa !17
  %67 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 15
  store i32 16, ptr %67, align 8, !tbaa !18
  %68 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 16
  store i32 16, ptr %68, align 4, !tbaa !19
  br label %69

69:                                               ; preds = %54, %39, %24, %16, %4
  %70 = load i32, ptr %7, align 4, !tbaa !9
  %71 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 6
  store i32 %70, ptr %71, align 4, !tbaa !20
  %72 = load i32, ptr %8, align 4, !tbaa !9
  %73 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 7
  store i32 %72, ptr %73, align 8, !tbaa !21
  %74 = load i32, ptr %9, align 4, !tbaa !9
  %75 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 8
  store i32 %74, ptr %75, align 4, !tbaa !22
  %76 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 6
  %77 = load i32, ptr %76, align 4, !tbaa !20
  %78 = load i32, ptr %9, align 4, !tbaa !9
  %79 = mul nsw i32 %77, %78
  %80 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 9
  store i32 %79, ptr %80, align 8, !tbaa !23
  %81 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 6
  %82 = load i32, ptr %81, align 4, !tbaa !20
  %83 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 15
  %84 = load i32, ptr %83, align 8, !tbaa !18
  %85 = add nsw i32 %82, %84
  %86 = sub nsw i32 %85, 1
  %87 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 15
  %88 = load i32, ptr %87, align 8, !tbaa !18
  %89 = sub nsw i32 %88, 1
  %90 = xor i32 %89, -1
  %91 = and i32 %86, %90
  %92 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 10
  store i32 %91, ptr %92, align 4, !tbaa !24
  %93 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 7
  %94 = load i32, ptr %93, align 8, !tbaa !21
  %95 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 16
  %96 = load i32, ptr %95, align 4, !tbaa !19
  %97 = add nsw i32 %94, %96
  %98 = sub nsw i32 %97, 1
  %99 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 16
  %100 = load i32, ptr %99, align 4, !tbaa !19
  %101 = sub nsw i32 %100, 1
  %102 = xor i32 %101, -1
  %103 = and i32 %98, %102
  %104 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 11
  store i32 %103, ptr %104, align 8, !tbaa !25
  %105 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 6
  %106 = load i32, ptr %105, align 4, !tbaa !20
  %107 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 2
  %108 = load i8, ptr %107, align 4, !tbaa !11
  %109 = zext i8 %108 to i32
  %110 = mul nsw i32 %106, %109
  %111 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 12
  store i32 %110, ptr %111, align 4, !tbaa !26
  %112 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 10
  %113 = load i32, ptr %112, align 4, !tbaa !24
  %114 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 2
  %115 = load i8, ptr %114, align 4, !tbaa !11
  %116 = zext i8 %115 to i32
  %117 = mul nsw i32 %113, %116
  %118 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 13
  store i32 %117, ptr %118, align 8, !tbaa !27
  %119 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 10
  %120 = load i32, ptr %119, align 4, !tbaa !24
  %121 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 15
  %122 = load i32, ptr %121, align 8, !tbaa !18
  %123 = sdiv i32 %120, %122
  %124 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 14
  store i32 %123, ptr %124, align 4, !tbaa !28
  %125 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 13
  %126 = load i32, ptr %125, align 8, !tbaa !27
  %127 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 16
  %128 = load i32, ptr %127, align 4, !tbaa !19
  %129 = mul nsw i32 %126, %128
  %130 = sext i32 %129 to i64
  %131 = call noundef ptr @_ZN4jpgeL11jpge_mallocEm(i64 noundef %130)
  %132 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 17
  %133 = getelementptr inbounds [16 x ptr], ptr %132, i64 0, i64 0
  store ptr %131, ptr %133, align 8, !tbaa !5
  %134 = icmp eq ptr %131, null
  br i1 %134, label %135, label %136

135:                                              ; preds = %69
  store i1 false, ptr %5, align 1
  br label %219

136:                                              ; preds = %69
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %137

137:                                              ; preds = %158, %136
  %138 = load i32, ptr %10, align 4, !tbaa !9
  %139 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 16
  %140 = load i32, ptr %139, align 4, !tbaa !19
  %141 = icmp slt i32 %138, %140
  br i1 %141, label %143, label %142

142:                                              ; preds = %137
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %161

143:                                              ; preds = %137
  %144 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 17
  %145 = load i32, ptr %10, align 4, !tbaa !9
  %146 = sub nsw i32 %145, 1
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [16 x ptr], ptr %144, i64 0, i64 %147
  %149 = load ptr, ptr %148, align 8, !tbaa !5
  %150 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 13
  %151 = load i32, ptr %150, align 8, !tbaa !27
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds i8, ptr %149, i64 %152
  %154 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 17
  %155 = load i32, ptr %10, align 4, !tbaa !9
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [16 x ptr], ptr %154, i64 0, i64 %156
  store ptr %153, ptr %157, align 8, !tbaa !5
  br label %158

158:                                              ; preds = %143
  %159 = load i32, ptr %10, align 4, !tbaa !9
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %10, align 4, !tbaa !9
  br label %137, !llvm.loop !29

161:                                              ; preds = %142
  %162 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 22
  %163 = getelementptr inbounds [2 x [64 x i32]], ptr %162, i64 0, i64 0
  %164 = getelementptr inbounds [64 x i32], ptr %163, i64 0, i64 0
  call void @_ZN4jpge12jpeg_encoder19compute_quant_tableEPiPs(ptr noundef nonnull align 8 dereferenceable(13494) %11, ptr noundef %164, ptr noundef @_ZN4jpgeL15s_std_lum_quantE)
  %165 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 22
  %166 = getelementptr inbounds [2 x [64 x i32]], ptr %165, i64 0, i64 1
  %167 = getelementptr inbounds [64 x i32], ptr %166, i64 0, i64 0
  %168 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 1
  %169 = getelementptr inbounds %"struct.jpge::params", ptr %168, i32 0, i32 2
  %170 = load i8, ptr %169, align 8, !tbaa !31, !range !32, !noundef !33
  %171 = trunc i8 %170 to i1
  br i1 %171, label %172, label %173

172:                                              ; preds = %161
  br label %174

173:                                              ; preds = %161
  br label %174

174:                                              ; preds = %173, %172
  %175 = phi ptr [ @_ZN4jpgeL15s_std_lum_quantE, %172 ], [ @_ZN4jpgeL17s_std_croma_quantE, %173 ]
  %176 = getelementptr inbounds [64 x i16], ptr %175, i64 0, i64 0
  call void @_ZN4jpge12jpeg_encoder19compute_quant_tableEPiPs(ptr noundef nonnull align 8 dereferenceable(13494) %11, ptr noundef %167, ptr noundef %176)
  %177 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 32
  store i32 2048, ptr %177, align 8, !tbaa !34
  %178 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 29
  %179 = getelementptr inbounds [2048 x i8], ptr %178, i64 0, i64 0
  %180 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 31
  store ptr %179, ptr %180, align 8, !tbaa !35
  %181 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 1
  %182 = getelementptr inbounds %"struct.jpge::params", ptr %181, i32 0, i32 3
  %183 = load i8, ptr %182, align 1, !tbaa !36, !range !32, !noundef !33
  %184 = trunc i8 %183 to i1
  br i1 %184, label %185, label %187

185:                                              ; preds = %174
  %186 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 27
  call void @_ZN4jpge9clear_objIA4_A256_jEEvRT_(ptr noundef nonnull align 4 dereferenceable(4096) %186)
  call void @_ZN4jpge12jpeg_encoder15first_pass_initEv(ptr noundef nonnull align 8 dereferenceable(13494) %11)
  br label %215

187:                                              ; preds = %174
  %188 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 25
  %189 = getelementptr inbounds [4 x [17 x i8]], ptr %188, i64 0, i64 0
  %190 = getelementptr inbounds [17 x i8], ptr %189, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %190, ptr align 16 @_ZN4jpgeL13s_dc_lum_bitsE, i64 17, i1 false)
  %191 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 26
  %192 = getelementptr inbounds [4 x [256 x i8]], ptr %191, i64 0, i64 0
  %193 = getelementptr inbounds [256 x i8], ptr %192, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %193, ptr align 1 @_ZN4jpgeL12s_dc_lum_valE, i64 12, i1 false)
  %194 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 25
  %195 = getelementptr inbounds [4 x [17 x i8]], ptr %194, i64 0, i64 2
  %196 = getelementptr inbounds [17 x i8], ptr %195, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %196, ptr align 16 @_ZN4jpgeL13s_ac_lum_bitsE, i64 17, i1 false)
  %197 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 26
  %198 = getelementptr inbounds [4 x [256 x i8]], ptr %197, i64 0, i64 2
  %199 = getelementptr inbounds [256 x i8], ptr %198, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %199, ptr align 16 @_ZN4jpgeL12s_ac_lum_valE, i64 256, i1 false)
  %200 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 25
  %201 = getelementptr inbounds [4 x [17 x i8]], ptr %200, i64 0, i64 1
  %202 = getelementptr inbounds [17 x i8], ptr %201, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %202, ptr align 16 @_ZN4jpgeL16s_dc_chroma_bitsE, i64 17, i1 false)
  %203 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 26
  %204 = getelementptr inbounds [4 x [256 x i8]], ptr %203, i64 0, i64 1
  %205 = getelementptr inbounds [256 x i8], ptr %204, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %205, ptr align 1 @_ZN4jpgeL15s_dc_chroma_valE, i64 12, i1 false)
  %206 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 25
  %207 = getelementptr inbounds [4 x [17 x i8]], ptr %206, i64 0, i64 3
  %208 = getelementptr inbounds [17 x i8], ptr %207, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %208, ptr align 16 @_ZN4jpgeL16s_ac_chroma_bitsE, i64 17, i1 false)
  %209 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 26
  %210 = getelementptr inbounds [4 x [256 x i8]], ptr %209, i64 0, i64 3
  %211 = getelementptr inbounds [256 x i8], ptr %210, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %211, ptr align 16 @_ZN4jpgeL15s_ac_chroma_valE, i64 256, i1 false)
  %212 = call noundef zeroext i1 @_ZN4jpge12jpeg_encoder16second_pass_initEv(ptr noundef nonnull align 8 dereferenceable(13494) %11)
  br i1 %212, label %214, label %213

213:                                              ; preds = %187
  store i1 false, ptr %5, align 1
  br label %219

214:                                              ; preds = %187
  br label %215

215:                                              ; preds = %214, %185
  %216 = getelementptr inbounds %"class.jpge::jpeg_encoder", ptr %11, i32 0, i32 36
  %217 = load i8, ptr %216, align 1, !tbaa !37, !range !32, !noundef !33
  %218 = trunc i8 %217 to i1
  store i1 %218, ptr %5, align 1
  br label %219

219:                                              ; preds = %215, %213, %135
  %220 = load i1, ptr %5, align 1
  ret i1 %220
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef ptr @_ZN4jpgeL11jpge_mallocEm(i64 noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4jpge9clear_objIA4_A256_jEEvRT_(ptr noundef nonnull align 4 dereferenceable(4096)) #3

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !7, i64 20}
!12 = !{!"_ZTSN4jpge12jpeg_encoderE", !6, i64 0, !13, i64 8, !7, i64 20, !7, i64 21, !7, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !7, i64 72, !7, i64 200, !7, i64 204, !7, i64 460, !7, i64 588, !7, i64 1100, !7, i64 5196, !7, i64 6220, !7, i64 6288, !7, i64 7312, !7, i64 11408, !7, i64 11420, !6, i64 13472, !10, i64 13480, !10, i64 13484, !10, i64 13488, !7, i64 13492, !15, i64 13493}
!13 = !{!"_ZTSN4jpge6paramsE", !10, i64 0, !14, i64 4, !15, i64 8, !15, i64 9}
!14 = !{!"_ZTSN4jpge13subsampling_tE", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!12, !14, i64 12}
!17 = !{!7, !7, i64 0}
!18 = !{!12, !10, i64 64}
!19 = !{!12, !10, i64 68}
!20 = !{!12, !10, i64 28}
!21 = !{!12, !10, i64 32}
!22 = !{!12, !10, i64 36}
!23 = !{!12, !10, i64 40}
!24 = !{!12, !10, i64 44}
!25 = !{!12, !10, i64 48}
!26 = !{!12, !10, i64 52}
!27 = !{!12, !10, i64 56}
!28 = !{!12, !10, i64 60}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!12, !15, i64 16}
!32 = !{i8 0, i8 2}
!33 = !{}
!34 = !{!12, !10, i64 13480}
!35 = !{!12, !6, i64 13472}
!36 = !{!12, !15, i64 17}
!37 = !{!12, !15, i64 13493}


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

@_ZN4jpgeL15s_std_lum_quantE = external hidden global [64 x i16], align 16
@_ZN4jpgeL17s_std_croma_quantE = external hidden global [64 x i16], align 16
@_ZN4jpgeL13s_dc_lum_bitsE = external hidden local_unnamed_addr global [17 x i8], align 16
@_ZN4jpgeL12s_dc_lum_valE = external hidden local_unnamed_addr global [12 x i8], align 1
@_ZN4jpgeL13s_ac_lum_bitsE = external hidden local_unnamed_addr global [17 x i8], align 16
@_ZN4jpgeL16s_dc_chroma_bitsE = external hidden local_unnamed_addr global [17 x i8], align 16
@_ZN4jpgeL15s_dc_chroma_valE = external hidden local_unnamed_addr global [12 x i8], align 1
@_ZN4jpgeL16s_ac_chroma_bitsE = external hidden local_unnamed_addr global [17 x i8], align 16
@_ZN4jpgeL12s_ac_lum_valE = external hidden local_unnamed_addr global <{ [162 x i8], [94 x i8] }>, align 16
@_ZN4jpgeL15s_ac_chroma_valE = external hidden local_unnamed_addr global <{ [162 x i8], [94 x i8] }>, align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4jpge12jpeg_encoder19compute_quant_tableEPiPs(ptr noundef nonnull align 8 dereferenceable(13494), ptr noundef, ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4jpge12jpeg_encoder15first_pass_initEv(ptr noundef nonnull align 8 dereferenceable(13494)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4jpge12jpeg_encoder16second_pass_initEv(ptr noundef nonnull align 8 dereferenceable(13494)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4jpge12jpeg_encoder8jpg_openEiii(ptr noundef nonnull align 8 dereferenceable(13494) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #1 align 2 {
  %5 = getelementptr inbounds i8, ptr %0, i64 20
  store i8 3, ptr %5, align 4, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 12
  %7 = load i32, ptr %6, align 4, !tbaa !14
  switch i32 %7, label %._crit_edge12 [
    i32 0, label %8
    i32 1, label %13
    i32 2, label %17
    i32 3, label %22
  ]

._crit_edge12:                                    ; preds = %4
  %.phi.trans.insert = getelementptr inbounds i8, ptr %0, i64 64
  %.pre = load i32, ptr %.phi.trans.insert, align 8, !tbaa !15
  %.phi.trans.insert13 = getelementptr inbounds i8, ptr %0, i64 68
  %.pre14 = load i32, ptr %.phi.trans.insert13, align 4, !tbaa !16
  br label %28

8:                                                ; preds = %4
  store i8 1, ptr %5, align 4, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 21
  store i8 1, ptr %9, align 1, !tbaa !17
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  store i8 1, ptr %10, align 8, !tbaa !17
  %11 = getelementptr inbounds i8, ptr %0, i64 64
  store i32 8, ptr %11, align 8, !tbaa !15
  %12 = getelementptr inbounds i8, ptr %0, i64 68
  store i32 8, ptr %12, align 4, !tbaa !16
  br label %28

13:                                               ; preds = %4
  %14 = getelementptr inbounds i8, ptr %0, i64 21
  %15 = getelementptr inbounds i8, ptr %0, i64 64
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(6) %14, i8 1, i64 6, i1 false)
  store i32 8, ptr %15, align 8, !tbaa !15
  %16 = getelementptr inbounds i8, ptr %0, i64 68
  store i32 8, ptr %16, align 4, !tbaa !16
  br label %28

17:                                               ; preds = %4
  %18 = getelementptr inbounds i8, ptr %0, i64 21
  store i8 2, ptr %18, align 1, !tbaa !17
  %19 = getelementptr inbounds i8, ptr %0, i64 22
  %20 = getelementptr inbounds i8, ptr %0, i64 64
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(5) %19, i8 1, i64 5, i1 false)
  store i32 16, ptr %20, align 8, !tbaa !15
  %21 = getelementptr inbounds i8, ptr %0, i64 68
  store i32 8, ptr %21, align 4, !tbaa !16
  br label %28

22:                                               ; preds = %4
  %23 = getelementptr inbounds i8, ptr %0, i64 21
  %24 = getelementptr inbounds i8, ptr %0, i64 25
  store i8 1, ptr %24, align 1, !tbaa !17
  store <4 x i8> <i8 2, i8 1, i8 1, i8 2>, ptr %23, align 1, !tbaa !17
  %25 = getelementptr inbounds i8, ptr %0, i64 26
  store i8 1, ptr %25, align 2, !tbaa !17
  %26 = getelementptr inbounds i8, ptr %0, i64 64
  store i32 16, ptr %26, align 8, !tbaa !15
  %27 = getelementptr inbounds i8, ptr %0, i64 68
  store i32 16, ptr %27, align 4, !tbaa !16
  br label %28

28:                                               ; preds = %._crit_edge12, %22, %17, %13, %8
  %29 = phi i32 [ 3, %._crit_edge12 ], [ 3, %22 ], [ 3, %17 ], [ 3, %13 ], [ 1, %8 ]
  %30 = phi i32 [ %.pre14, %._crit_edge12 ], [ 16, %22 ], [ 8, %17 ], [ 8, %13 ], [ 8, %8 ]
  %31 = phi i32 [ %.pre, %._crit_edge12 ], [ 16, %22 ], [ 16, %17 ], [ 8, %13 ], [ 8, %8 ]
  %32 = getelementptr inbounds i8, ptr %0, i64 28
  store i32 %1, ptr %32, align 4, !tbaa !18
  %33 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %2, ptr %33, align 8, !tbaa !19
  %34 = getelementptr inbounds i8, ptr %0, i64 36
  store i32 %3, ptr %34, align 4, !tbaa !20
  %35 = mul nsw i32 %3, %1
  %36 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 %35, ptr %36, align 8, !tbaa !21
  %37 = add i32 %1, -1
  %38 = add i32 %37, %31
  %39 = sub i32 0, %31
  %40 = and i32 %38, %39
  %41 = getelementptr inbounds i8, ptr %0, i64 44
  store i32 %40, ptr %41, align 4, !tbaa !22
  %42 = add i32 %2, -1
  %43 = add i32 %42, %30
  %44 = sub i32 0, %30
  %45 = and i32 %43, %44
  %46 = getelementptr inbounds i8, ptr %0, i64 48
  store i32 %45, ptr %46, align 8, !tbaa !23
  %47 = mul nsw i32 %29, %1
  %48 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 %47, ptr %48, align 4, !tbaa !24
  %49 = mul nsw i32 %40, %29
  %50 = getelementptr inbounds i8, ptr %0, i64 56
  store i32 %49, ptr %50, align 8, !tbaa !25
  %51 = sdiv i32 %40, %31
  %52 = getelementptr inbounds i8, ptr %0, i64 60
  store i32 %51, ptr %52, align 4, !tbaa !26
  %53 = mul nsw i32 %49, %30
  %54 = sext i32 %53 to i64
  %55 = tail call noundef ptr @_ZN4jpgeL11jpge_mallocEm(i64 noundef %54)
  %56 = getelementptr inbounds i8, ptr %0, i64 72
  store ptr %55, ptr %56, align 8, !tbaa !27
  %57 = icmp eq ptr %55, null
  br i1 %57, label %115, label %.preheader

.preheader:                                       ; preds = %28
  %58 = getelementptr inbounds i8, ptr %0, i64 68
  %59 = load i32, ptr %58, align 4, !tbaa !16
  %60 = icmp sgt i32 %59, 1
  br i1 %60, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader
  %61 = load i32, ptr %50, align 8, !tbaa !25
  %62 = sext i32 %61 to i64
  %wide.trip.count = zext nneg i32 %59 to i64
  %63 = add nsw i64 %wide.trip.count, -1
  %64 = add nsw i64 %wide.trip.count, -2
  %xtraiter = and i64 %63, 7
  %65 = icmp ult i64 %64, 7
  br i1 %65, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %63, -8
  br label %81

._crit_edge.loopexit.unr-lcssa:                   ; preds = %81, %.lr.ph
  %.unr = phi ptr [ %55, %.lr.ph ], [ %97, %81 ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next.7, %81 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader
  %66 = phi ptr [ %67, %.epil.preheader ], [ %.unr, %._crit_edge.loopexit.unr-lcssa ]
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.epil.preheader ], [ %indvars.iv.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %67 = getelementptr inbounds i8, ptr %66, i64 %62
  %68 = getelementptr inbounds [16 x ptr], ptr %56, i64 0, i64 %indvars.iv.epil
  store ptr %67, ptr %68, align 8, !tbaa !27
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.epil.preheader, !llvm.loop !28

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader, %.preheader
  %69 = getelementptr inbounds i8, ptr %0, i64 588
  tail call void @_ZN4jpge12jpeg_encoder19compute_quant_tableEPiPs(ptr noundef nonnull align 8 dereferenceable(13494) %0, ptr noundef nonnull %69, ptr noundef nonnull @_ZN4jpgeL15s_std_lum_quantE)
  %70 = getelementptr inbounds i8, ptr %0, i64 844
  %71 = getelementptr inbounds i8, ptr %0, i64 16
  %72 = load i8, ptr %71, align 8, !tbaa !30, !range !31, !noundef !32
  %73 = trunc nuw i8 %72 to i1
  %74 = select i1 %73, ptr @_ZN4jpgeL15s_std_lum_quantE, ptr @_ZN4jpgeL17s_std_croma_quantE
  tail call void @_ZN4jpge12jpeg_encoder19compute_quant_tableEPiPs(ptr noundef nonnull align 8 dereferenceable(13494) %0, ptr noundef nonnull %70, ptr noundef nonnull %74)
  %75 = getelementptr inbounds i8, ptr %0, i64 13480
  store i32 2048, ptr %75, align 8, !tbaa !33
  %76 = getelementptr inbounds i8, ptr %0, i64 11420
  %77 = getelementptr inbounds i8, ptr %0, i64 13472
  store ptr %76, ptr %77, align 8, !tbaa !34
  %78 = getelementptr inbounds i8, ptr %0, i64 17
  %79 = load i8, ptr %78, align 1, !tbaa !35, !range !31, !noundef !32
  %80 = trunc nuw i8 %79 to i1
  br i1 %80, label %99, label %101

81:                                               ; preds = %81, %.lr.ph.new
  %82 = phi ptr [ %55, %.lr.ph.new ], [ %97, %81 ]
  %indvars.iv = phi i64 [ 1, %.lr.ph.new ], [ %indvars.iv.next.7, %81 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.7, %81 ]
  %83 = getelementptr inbounds i8, ptr %82, i64 %62
  %84 = getelementptr inbounds [16 x ptr], ptr %56, i64 0, i64 %indvars.iv
  store ptr %83, ptr %84, align 8, !tbaa !27
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %85 = getelementptr inbounds i8, ptr %83, i64 %62
  %86 = getelementptr inbounds [16 x ptr], ptr %56, i64 0, i64 %indvars.iv.next
  store ptr %85, ptr %86, align 8, !tbaa !27
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %87 = getelementptr inbounds i8, ptr %85, i64 %62
  %88 = getelementptr inbounds [16 x ptr], ptr %56, i64 0, i64 %indvars.iv.next.1
  store ptr %87, ptr %88, align 8, !tbaa !27
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %89 = getelementptr inbounds i8, ptr %87, i64 %62
  %90 = getelementptr inbounds [16 x ptr], ptr %56, i64 0, i64 %indvars.iv.next.2
  store ptr %89, ptr %90, align 8, !tbaa !27
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %91 = getelementptr inbounds i8, ptr %89, i64 %62
  %92 = getelementptr inbounds [16 x ptr], ptr %56, i64 0, i64 %indvars.iv.next.3
  store ptr %91, ptr %92, align 8, !tbaa !27
  %indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
  %93 = getelementptr inbounds i8, ptr %91, i64 %62
  %94 = getelementptr inbounds [16 x ptr], ptr %56, i64 0, i64 %indvars.iv.next.4
  store ptr %93, ptr %94, align 8, !tbaa !27
  %indvars.iv.next.5 = add nuw nsw i64 %indvars.iv, 6
  %95 = getelementptr inbounds i8, ptr %93, i64 %62
  %96 = getelementptr inbounds [16 x ptr], ptr %56, i64 0, i64 %indvars.iv.next.5
  store ptr %95, ptr %96, align 8, !tbaa !27
  %indvars.iv.next.6 = add nuw nsw i64 %indvars.iv, 7
  %97 = getelementptr inbounds i8, ptr %95, i64 %62
  %98 = getelementptr inbounds [16 x ptr], ptr %56, i64 0, i64 %indvars.iv.next.6
  store ptr %97, ptr %98, align 8, !tbaa !27
  %indvars.iv.next.7 = add nuw nsw i64 %indvars.iv, 8
  %niter.next.7 = add i64 %niter, 8
  %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %._crit_edge.loopexit.unr-lcssa, label %81, !llvm.loop !36

99:                                               ; preds = %._crit_edge
  %100 = getelementptr inbounds i8, ptr %0, i64 7312
  tail call void @_ZN4jpge9clear_objIA4_A256_jEEvRT_(ptr noundef nonnull align 4 dereferenceable(4096) %100)
  tail call void @_ZN4jpge12jpeg_encoder15first_pass_initEv(ptr noundef nonnull align 8 dereferenceable(13494) %0)
  br label %111

101:                                              ; preds = %._crit_edge
  %102 = getelementptr inbounds i8, ptr %0, i64 6220
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(17) %102, ptr noundef nonnull align 16 dereferenceable(17) @_ZN4jpgeL13s_dc_lum_bitsE, i64 17, i1 false)
  %103 = getelementptr inbounds i8, ptr %0, i64 6288
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %103, ptr noundef nonnull align 1 dereferenceable(12) @_ZN4jpgeL12s_dc_lum_valE, i64 12, i1 false)
  %104 = getelementptr inbounds i8, ptr %0, i64 6254
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(17) %104, ptr noundef nonnull align 16 dereferenceable(17) @_ZN4jpgeL13s_ac_lum_bitsE, i64 17, i1 false)
  %105 = getelementptr inbounds i8, ptr %0, i64 6800
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(256) %105, ptr noundef nonnull align 16 dereferenceable(256) @_ZN4jpgeL12s_ac_lum_valE, i64 256, i1 false)
  %106 = getelementptr inbounds i8, ptr %0, i64 6237
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(17) %106, ptr noundef nonnull align 16 dereferenceable(17) @_ZN4jpgeL16s_dc_chroma_bitsE, i64 17, i1 false)
  %107 = getelementptr inbounds i8, ptr %0, i64 6544
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %107, ptr noundef nonnull align 1 dereferenceable(12) @_ZN4jpgeL15s_dc_chroma_valE, i64 12, i1 false)
  %108 = getelementptr inbounds i8, ptr %0, i64 6271
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(17) %108, ptr noundef nonnull align 16 dereferenceable(17) @_ZN4jpgeL16s_ac_chroma_bitsE, i64 17, i1 false)
  %109 = getelementptr inbounds i8, ptr %0, i64 7056
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(256) %109, ptr noundef nonnull align 16 dereferenceable(256) @_ZN4jpgeL15s_ac_chroma_valE, i64 256, i1 false)
  %110 = tail call noundef zeroext i1 @_ZN4jpge12jpeg_encoder16second_pass_initEv(ptr noundef nonnull align 8 dereferenceable(13494) %0)
  br i1 %110, label %111, label %115

111:                                              ; preds = %101, %99
  %112 = getelementptr inbounds i8, ptr %0, i64 13493
  %113 = load i8, ptr %112, align 1, !tbaa !38, !range !31, !noundef !32
  %114 = trunc nuw i8 %113 to i1
  br label %115

115:                                              ; preds = %101, %28, %111
  %.09 = phi i1 [ %114, %111 ], [ false, %28 ], [ false, %101 ]
  ret i1 %.09
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef ptr @_ZN4jpgeL11jpge_mallocEm(i64 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4jpge9clear_objIA4_A256_jEEvRT_(ptr noundef nonnull align 4 dereferenceable(4096)) 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) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

attributes #0 = { 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 #1 = { 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 #2 = { 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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, !8, i64 20}
!6 = !{!"_ZTSN4jpge12jpeg_encoderE", !7, i64 0, !10, i64 8, !8, i64 20, !8, i64 21, !8, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !8, i64 72, !8, i64 200, !8, i64 204, !8, i64 460, !8, i64 588, !8, i64 1100, !8, i64 5196, !8, i64 6220, !8, i64 6288, !8, i64 7312, !8, i64 11408, !8, i64 11420, !7, i64 13472, !11, i64 13480, !11, i64 13484, !11, i64 13488, !8, i64 13492, !13, i64 13493}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN4jpge6paramsE", !11, i64 0, !12, i64 4, !13, i64 8, !13, i64 9}
!11 = !{!"int", !8, i64 0}
!12 = !{!"_ZTSN4jpge13subsampling_tE", !8, i64 0}
!13 = !{!"bool", !8, i64 0}
!14 = !{!6, !12, i64 12}
!15 = !{!6, !11, i64 64}
!16 = !{!6, !11, i64 68}
!17 = !{!8, !8, i64 0}
!18 = !{!6, !11, i64 28}
!19 = !{!6, !11, i64 32}
!20 = !{!6, !11, i64 36}
!21 = !{!6, !11, i64 40}
!22 = !{!6, !11, i64 44}
!23 = !{!6, !11, i64 48}
!24 = !{!6, !11, i64 52}
!25 = !{!6, !11, i64 56}
!26 = !{!6, !11, i64 60}
!27 = !{!7, !7, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.unroll.disable"}
!30 = !{!6, !13, i64 16}
!31 = !{i8 0, i8 2}
!32 = !{}
!33 = !{!6, !11, i64 13480}
!34 = !{!6, !7, i64 13472}
!35 = !{!6, !13, i64 17}
!36 = distinct !{!36, !37}
!37 = !{!"llvm.loop.mustprogress"}
!38 = !{!6, !13, i64 13493}


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