; LLVM IR from venumb/ZSPACE :: cpp/depends/lodePNG/pngdetail.ll (Z11RGBtoLetterhhhhjjbb)

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

; 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 uwtable
declare dso_local void @_Z8RGBtoHSLhhhPhS_S_(i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8RGBtoHCThhhPhS_S_(i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i8 @_Z11HueToLetteri(i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i8 @_Z17lightnessToLetteri(i32 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef signext i8 @_Z11RGBtoLetterhhhhjjbb(i8 noundef zeroext %0, i8 noundef zeroext %1, i8 noundef zeroext %2, i8 noundef zeroext %3, i32 noundef %4, i32 noundef %5, i1 noundef zeroext %6, i1 noundef zeroext %7) #1 {
  %9 = alloca i8, align 1
  %10 = alloca i8, align 1
  %11 = alloca i8, align 1
  %12 = alloca i8, align 1
  %13 = alloca i8, align 1
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i8, align 1
  %17 = alloca i8, align 1
  %18 = alloca i8, align 1
  %19 = alloca i8, align 1
  %20 = alloca i8, align 1
  %21 = alloca i32, align 4
  %22 = alloca i8, align 1
  %23 = alloca i8, align 1
  %24 = alloca i32, align 4
  %25 = alloca i8, align 1
  %26 = alloca i8, align 1
  %27 = alloca i8, align 1
  %28 = alloca i8, align 1
  %29 = alloca i8, align 1
  store i8 %0, ptr %10, align 1, !tbaa !5
  store i8 %1, ptr %11, align 1, !tbaa !5
  store i8 %2, ptr %12, align 1, !tbaa !5
  store i8 %3, ptr %13, align 1, !tbaa !5
  store i32 %4, ptr %14, align 4, !tbaa !8
  store i32 %5, ptr %15, align 4, !tbaa !8
  %30 = zext i1 %6 to i8
  store i8 %30, ptr %16, align 1, !tbaa !10
  %31 = zext i1 %7 to i8
  store i8 %31, ptr %17, align 1, !tbaa !10
  %32 = load i8, ptr %13, align 1, !tbaa !5
  %33 = zext i8 %32 to i32
  %34 = icmp slt i32 %33, 255
  br i1 %34, label %35, label %57

35:                                               ; preds = %8
  %36 = load i8, ptr %13, align 1, !tbaa !5
  %37 = zext i8 %36 to i32
  %38 = load i8, ptr %10, align 1, !tbaa !5
  %39 = zext i8 %38 to i32
  %40 = mul nsw i32 %37, %39
  %41 = sdiv i32 %40, 255
  %42 = trunc i32 %41 to i8
  store i8 %42, ptr %10, align 1, !tbaa !5
  %43 = load i8, ptr %13, align 1, !tbaa !5
  %44 = zext i8 %43 to i32
  %45 = load i8, ptr %11, align 1, !tbaa !5
  %46 = zext i8 %45 to i32
  %47 = mul nsw i32 %44, %46
  %48 = sdiv i32 %47, 255
  %49 = trunc i32 %48 to i8
  store i8 %49, ptr %11, align 1, !tbaa !5
  %50 = load i8, ptr %13, align 1, !tbaa !5
  %51 = zext i8 %50 to i32
  %52 = load i8, ptr %12, align 1, !tbaa !5
  %53 = zext i8 %52 to i32
  %54 = mul nsw i32 %51, %53
  %55 = sdiv i32 %54, 255
  %56 = trunc i32 %55 to i8
  store i8 %56, ptr %12, align 1, !tbaa !5
  br label %57

57:                                               ; preds = %35, %8
  %58 = load i8, ptr %16, align 1, !tbaa !10, !range !12, !noundef !13
  %59 = trunc i8 %58 to i1
  br i1 %59, label %60, label %120

60:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #4
  %61 = load i8, ptr %10, align 1, !tbaa !5
  %62 = load i8, ptr %11, align 1, !tbaa !5
  %63 = load i8, ptr %12, align 1, !tbaa !5
  call void @_Z8RGBtoHCThhhPhS_S_(i8 noundef zeroext %61, i8 noundef zeroext %62, i8 noundef zeroext %63, ptr noundef %18, ptr noundef %19, ptr noundef %20)
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %64 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZSt3maxIhERKT_S2_S2_(ptr noundef nonnull align 1 dereferenceable(1) %10, ptr noundef nonnull align 1 dereferenceable(1) %11)
  %65 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZSt3maxIhERKT_S2_S2_(ptr noundef nonnull align 1 dereferenceable(1) %64, ptr noundef nonnull align 1 dereferenceable(1) %12)
  %66 = load i8, ptr %65, align 1, !tbaa !5
  %67 = zext i8 %66 to i32
  %68 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZSt3minIhERKT_S2_S2_(ptr noundef nonnull align 1 dereferenceable(1) %10, ptr noundef nonnull align 1 dereferenceable(1) %11)
  %69 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZSt3minIhERKT_S2_S2_(ptr noundef nonnull align 1 dereferenceable(1) %68, ptr noundef nonnull align 1 dereferenceable(1) %12)
  %70 = load i8, ptr %69, align 1, !tbaa !5
  %71 = zext i8 %70 to i32
  %72 = add nsw i32 %67, %71
  %73 = sdiv i32 %72, 2
  store i32 %73, ptr %21, align 4, !tbaa !8
  %74 = load i8, ptr %17, align 1, !tbaa !10, !range !12, !noundef !13
  %75 = trunc i8 %74 to i1
  br i1 %75, label %76, label %83

76:                                               ; preds = %60
  %77 = load i32, ptr %21, align 4, !tbaa !8
  %78 = sub nsw i32 255, %77
  store i32 %78, ptr %21, align 4, !tbaa !8
  %79 = load i8, ptr %20, align 1, !tbaa !5
  %80 = zext i8 %79 to i32
  %81 = sub nsw i32 255, %80
  %82 = trunc i32 %81 to i8
  store i8 %82, ptr %20, align 1, !tbaa !5
  br label %83

83:                                               ; preds = %76, %60
  %84 = load i8, ptr %19, align 1, !tbaa !5
  %85 = zext i8 %84 to i32
  %86 = load i32, ptr %14, align 4, !tbaa !8
  %87 = load i32, ptr %15, align 4, !tbaa !8
  %88 = call noundef i32 @_ZL11applyDitheriiiib(i32 noundef %85, i32 noundef 254, i32 noundef %86, i32 noundef %87, i1 noundef zeroext false)
  %89 = icmp sge i32 %88, 128
  br i1 %89, label %90, label %113

90:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 1, ptr %22) #4
  %91 = load i8, ptr %18, align 1, !tbaa !5
  %92 = zext i8 %91 to i32
  %93 = load i32, ptr %14, align 4, !tbaa !8
  %94 = load i32, ptr %15, align 4, !tbaa !8
  %95 = call noundef i32 @_ZL11applyDitheriiiib(i32 noundef %92, i32 noundef 21, i32 noundef %93, i32 noundef %94, i1 noundef zeroext true)
  %96 = call noundef signext i8 @_Z11HueToLetteri(i32 noundef %95)
  store i8 %96, ptr %22, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %23) #4
  %97 = load i32, ptr %21, align 4, !tbaa !8
  %98 = load i32, ptr %14, align 4, !tbaa !8
  %99 = add i32 %98, 2
  %100 = load i32, ptr %15, align 4, !tbaa !8
  %101 = add i32 %100, 2
  %102 = call noundef i32 @_ZL11applyDitheriiiib(i32 noundef %97, i32 noundef 64, i32 noundef %99, i32 noundef %101, i1 noundef zeroext false)
  %103 = icmp slt i32 %102, 80
  %104 = zext i1 %103 to i8
  store i8 %104, ptr %23, align 1, !tbaa !10
  %105 = load i8, ptr %22, align 1, !tbaa !5
  %106 = sext i8 %105 to i32
  %107 = load i8, ptr %23, align 1, !tbaa !10, !range !12, !noundef !13
  %108 = trunc i8 %107 to i1
  %109 = zext i1 %108 to i64
  %110 = select i1 %108, i32 32, i32 0
  %111 = add nsw i32 %106, %110
  %112 = trunc i32 %111 to i8
  store i8 %112, ptr %9, align 1
  store i32 1, ptr %24, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %22) #4
  br label %119

113:                                              ; preds = %83
  %114 = load i32, ptr %21, align 4, !tbaa !8
  %115 = load i32, ptr %14, align 4, !tbaa !8
  %116 = load i32, ptr %15, align 4, !tbaa !8
  %117 = call noundef i32 @_ZL11applyDitheriiiib(i32 noundef %114, i32 noundef 31, i32 noundef %115, i32 noundef %116, i1 noundef zeroext false)
  %118 = call noundef signext i8 @_Z17lightnessToLetteri(i32 noundef %117)
  store i8 %118, ptr %9, align 1
  store i32 1, ptr %24, align 4
  br label %119

119:                                              ; preds = %113, %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #4
  br label %164

120:                                              ; preds = %57
  call void @llvm.lifetime.start.p0(i64 1, ptr %25) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %26) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %27) #4
  %121 = load i8, ptr %10, align 1, !tbaa !5
  %122 = load i8, ptr %11, align 1, !tbaa !5
  %123 = load i8, ptr %12, align 1, !tbaa !5
  call void @_Z8RGBtoHSLhhhPhS_S_(i8 noundef zeroext %121, i8 noundef zeroext %122, i8 noundef zeroext %123, ptr noundef %25, ptr noundef %26, ptr noundef %27)
  %124 = load i8, ptr %17, align 1, !tbaa !10, !range !12, !noundef !13
  %125 = trunc i8 %124 to i1
  br i1 %125, label %126, label %131

126:                                              ; preds = %120
  %127 = load i8, ptr %27, align 1, !tbaa !5
  %128 = zext i8 %127 to i32
  %129 = sub nsw i32 255, %128
  %130 = trunc i32 %129 to i8
  store i8 %130, ptr %27, align 1, !tbaa !5
  br label %131

131:                                              ; preds = %126, %120
  call void @llvm.lifetime.start.p0(i64 1, ptr %28) #4
  %132 = load i8, ptr %25, align 1, !tbaa !5
  %133 = zext i8 %132 to i32
  %134 = call noundef signext i8 @_Z11HueToLetteri(i32 noundef %133)
  store i8 %134, ptr %28, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %29) #4
  store i8 32, ptr %29, align 1, !tbaa !5
  %135 = load i8, ptr %27, align 1, !tbaa !5
  %136 = zext i8 %135 to i32
  %137 = icmp slt i32 %136, 24
  br i1 %137, label %146, label %138

138:                                              ; preds = %131
  %139 = load i8, ptr %27, align 1, !tbaa !5
  %140 = zext i8 %139 to i32
  %141 = icmp sgt i32 %140, 232
  br i1 %141, label %146, label %142

142:                                              ; preds = %138
  %143 = load i8, ptr %26, align 1, !tbaa !5
  %144 = zext i8 %143 to i32
  %145 = icmp slt i32 %144, 64
  br i1 %145, label %146, label %150

146:                                              ; preds = %142, %138, %131
  %147 = load i8, ptr %27, align 1, !tbaa !5
  %148 = zext i8 %147 to i32
  %149 = call noundef signext i8 @_Z17lightnessToLetteri(i32 noundef %148)
  store i8 %149, ptr %29, align 1, !tbaa !5
  br label %162

150:                                              ; preds = %142
  %151 = load i8, ptr %27, align 1, !tbaa !5
  %152 = zext i8 %151 to i32
  %153 = icmp slt i32 %152, 128
  br i1 %153, label %154, label %159

154:                                              ; preds = %150
  %155 = load i8, ptr %28, align 1, !tbaa !5
  %156 = sext i8 %155 to i32
  %157 = add nsw i32 %156, 32
  %158 = trunc i32 %157 to i8
  store i8 %158, ptr %29, align 1, !tbaa !5
  br label %161

159:                                              ; preds = %150
  %160 = load i8, ptr %28, align 1, !tbaa !5
  store i8 %160, ptr %29, align 1, !tbaa !5
  br label %161

161:                                              ; preds = %159, %154
  br label %162

162:                                              ; preds = %161, %146
  %163 = load i8, ptr %29, align 1, !tbaa !5
  store i8 %163, ptr %9, align 1
  store i32 1, ptr %24, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %29) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %28) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %25) #4
  br label %164

164:                                              ; preds = %162, %119
  %165 = load i8, ptr %9, align 1
  ret i8 %165
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZSt3maxIhERKT_S2_S2_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZSt3minIhERKT_S2_S2_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL11applyDitheriiiib(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"bool", !6, i64 0}
!12 = !{i8 0, i8 2}
!13 = !{}


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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8RGBtoHSLhhhPhS_S_(i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8RGBtoHCThhhPhS_S_(i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i8 @_Z11HueToLetteri(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i8 @_Z17lightnessToLetteri(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef signext i8 @_Z11RGBtoLetterhhhhjjbb(i8 noundef zeroext %0, i8 noundef zeroext %1, i8 noundef zeroext %2, i8 noundef zeroext %3, i32 noundef %4, i32 noundef %5, i1 noundef zeroext %6, i1 noundef zeroext %7) local_unnamed_addr #1 {
  %9 = alloca i8, align 1
  %10 = alloca i8, align 1
  %11 = alloca i8, align 1
  %12 = alloca i8, align 1
  %13 = alloca i8, align 1
  %14 = alloca i8, align 1
  %15 = alloca i8, align 1
  %16 = alloca i8, align 1
  %17 = alloca i8, align 1
  store i8 %0, ptr %9, align 1, !tbaa !5
  store i8 %1, ptr %10, align 1, !tbaa !5
  store i8 %2, ptr %11, align 1, !tbaa !5
  %.not = icmp eq i8 %3, -1
  br i1 %.not, label %32, label %18

18:                                               ; preds = %8
  %19 = zext i8 %3 to i32
  %20 = zext i8 %0 to i32
  %21 = mul nuw nsw i32 %19, %20
  %.lhs.trunc = trunc nuw i32 %21 to i16
  %22 = udiv i16 %.lhs.trunc, 255
  %23 = trunc nuw i16 %22 to i8
  store i8 %23, ptr %9, align 1, !tbaa !5
  %24 = zext i8 %1 to i32
  %25 = mul nuw nsw i32 %19, %24
  %.lhs.trunc33 = trunc nuw i32 %25 to i16
  %26 = udiv i16 %.lhs.trunc33, 255
  %27 = trunc nuw i16 %26 to i8
  store i8 %27, ptr %10, align 1, !tbaa !5
  %28 = zext i8 %2 to i32
  %29 = mul nuw nsw i32 %19, %28
  %.lhs.trunc35 = trunc nuw i32 %29 to i16
  %30 = udiv i16 %.lhs.trunc35, 255
  %31 = trunc nuw i16 %30 to i8
  store i8 %31, ptr %11, align 1, !tbaa !5
  br label %32

32:                                               ; preds = %18, %8
  %33 = phi i8 [ %31, %18 ], [ %2, %8 ]
  %34 = phi i8 [ %27, %18 ], [ %1, %8 ]
  %35 = phi i8 [ %23, %18 ], [ %0, %8 ]
  br i1 %6, label %36, label %71

36:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %12) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %13) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %14) #4
  call void @_Z8RGBtoHCThhhPhS_S_(i8 noundef zeroext %35, i8 noundef zeroext %34, i8 noundef zeroext %33, ptr noundef nonnull %12, ptr noundef nonnull %13, ptr noundef nonnull %14)
  %37 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZSt3maxIhERKT_S2_S2_(ptr noundef nonnull align 1 dereferenceable(1) %9, ptr noundef nonnull align 1 dereferenceable(1) %10)
  %38 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZSt3maxIhERKT_S2_S2_(ptr noundef nonnull align 1 dereferenceable(1) %37, ptr noundef nonnull align 1 dereferenceable(1) %11)
  %39 = load i8, ptr %38, align 1, !tbaa !5
  %40 = zext i8 %39 to i32
  %41 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZSt3minIhERKT_S2_S2_(ptr noundef nonnull align 1 dereferenceable(1) %9, ptr noundef nonnull align 1 dereferenceable(1) %10)
  %42 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZSt3minIhERKT_S2_S2_(ptr noundef nonnull align 1 dereferenceable(1) %41, ptr noundef nonnull align 1 dereferenceable(1) %11)
  %43 = load i8, ptr %42, align 1, !tbaa !5
  %44 = zext i8 %43 to i32
  %45 = add nuw nsw i32 %44, %40
  %46 = lshr i32 %45, 1
  br i1 %7, label %47, label %51

47:                                               ; preds = %36
  %48 = xor i32 %46, 255
  %49 = load i8, ptr %14, align 1, !tbaa !5
  %50 = xor i8 %49, -1
  store i8 %50, ptr %14, align 1, !tbaa !5
  br label %51

51:                                               ; preds = %47, %36
  %.030 = phi i32 [ %48, %47 ], [ %46, %36 ]
  %52 = load i8, ptr %13, align 1, !tbaa !5
  %53 = zext i8 %52 to i32
  %54 = call noundef i32 @_ZL11applyDitheriiiib(i32 noundef %53, i32 noundef 254, i32 noundef %4, i32 noundef %5, i1 noundef zeroext false)
  %55 = icmp sgt i32 %54, 127
  br i1 %55, label %56, label %67

56:                                               ; preds = %51
  %57 = load i8, ptr %12, align 1, !tbaa !5
  %58 = zext i8 %57 to i32
  %59 = call noundef i32 @_ZL11applyDitheriiiib(i32 noundef %58, i32 noundef 21, i32 noundef %4, i32 noundef %5, i1 noundef zeroext true)
  %60 = call noundef signext i8 @_Z11HueToLetteri(i32 noundef %59)
  %61 = add i32 %4, 2
  %62 = add i32 %5, 2
  %63 = call noundef i32 @_ZL11applyDitheriiiib(i32 noundef %.030, i32 noundef 64, i32 noundef %61, i32 noundef %62, i1 noundef zeroext false)
  %64 = icmp slt i32 %63, 80
  %65 = select i1 %64, i8 32, i8 0
  %66 = add i8 %65, %60
  br label %70

67:                                               ; preds = %51
  %68 = call noundef i32 @_ZL11applyDitheriiiib(i32 noundef %.030, i32 noundef 31, i32 noundef %4, i32 noundef %5, i1 noundef zeroext false)
  %69 = call noundef signext i8 @_Z17lightnessToLetteri(i32 noundef %68)
  br label %70

70:                                               ; preds = %67, %56
  %.029 = phi i8 [ %66, %56 ], [ %69, %67 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %14) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %13) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %12) #4
  br label %90

71:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %15) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %16) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %17) #4
  call void @_Z8RGBtoHSLhhhPhS_S_(i8 noundef zeroext %35, i8 noundef zeroext %34, i8 noundef zeroext %33, ptr noundef nonnull %15, ptr noundef nonnull %16, ptr noundef nonnull %17)
  br i1 %7, label %72, label %75

72:                                               ; preds = %71
  %73 = load i8, ptr %17, align 1, !tbaa !5
  %74 = xor i8 %73, -1
  store i8 %74, ptr %17, align 1, !tbaa !5
  br label %75

75:                                               ; preds = %72, %71
  %76 = load i8, ptr %15, align 1, !tbaa !5
  %77 = zext i8 %76 to i32
  %78 = call noundef signext i8 @_Z11HueToLetteri(i32 noundef %77)
  %79 = load i8, ptr %17, align 1
  %80 = add i8 %79, 23
  %or.cond = icmp ult i8 %80, 47
  %81 = load i8, ptr %16, align 1
  %82 = icmp ult i8 %81, 64
  %or.cond5 = select i1 %or.cond, i1 true, i1 %82
  br i1 %or.cond5, label %83, label %86

83:                                               ; preds = %75
  %84 = zext i8 %79 to i32
  %85 = call noundef signext i8 @_Z17lightnessToLetteri(i32 noundef %84)
  br label %89

86:                                               ; preds = %75
  %87 = add i8 %78, 32
  %88 = icmp slt i8 %79, 0
  %spec.select = select i1 %88, i8 %78, i8 %87
  br label %89

89:                                               ; preds = %86, %83
  %.0 = phi i8 [ %85, %83 ], [ %spec.select, %86 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %17) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %16) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %15) #4
  br label %90

90:                                               ; preds = %89, %70
  %.1 = phi i8 [ %.029, %70 ], [ %.0, %89 ]
  ret i8 %.1
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZSt3maxIhERKT_S2_S2_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZSt3minIhERKT_S2_S2_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL11applyDitheriiiib(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass