; LLVM IR from lesialin/ImageSignalProcessing_C :: src/isp_bcc.ll (Z7isp_bccPh)

; 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.isp_config_t = type <{ i32, i32, i16, [6 x i8], %"class.std::__cxx11::basic_string", %struct.blc_cfg_t, i16, [6 x i8], %"class.std::__cxx11::basic_string", %struct.awb_gain_t, [12 x float], %"class.std::__cxx11::basic_string", float, [12 x float], %struct.nlm_cfg_t, i8, %struct.bnf_cfg_t, [15 x i16], %struct.eeh_cfg_t, %struct.fcs_cfg_t, %struct.hsc_cfg_t, %struct.bcc_cfg_t, [4 x i8] }>
%struct.blc_cfg_t = type { i16, i16, i16, i16, float, float }
%struct.awb_gain_t = type { float, float, float, float }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%struct.nlm_cfg_t = type { i8, i8, i8 }
%struct.bnf_cfg_t = type { [25 x i16], [4 x i16], [3 x i16] }
%struct.eeh_cfg_t = type { i16, i16, i16, i16, i16, i16 }
%struct.fcs_cfg_t = type { i8, i8 }
%struct.hsc_cfg_t = type { i8, float }
%struct.bcc_cfg_t = type { i8, float }

@g_isp_config = external global %struct.isp_config_t, align 8

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z7isp_bccPh(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i8, align 1
  %4 = alloca i8, align 1
  %5 = alloca i8, align 1
  %6 = alloca i16, align 2
  %7 = alloca i16, align 2
  %8 = alloca i16, align 2
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #2
  %12 = load float, ptr getelementptr inbounds (%struct.bcc_cfg_t, ptr getelementptr inbounds (%struct.isp_config_t, ptr @g_isp_config, i32 0, i32 21), i32 0, i32 1), align 4, !tbaa !9
  %13 = fmul float %12, 6.400000e+01
  %14 = fptoui float %13 to i8
  store i8 %14, ptr %3, align 1, !tbaa !25
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #2
  %15 = load i8, ptr getelementptr inbounds (%struct.isp_config_t, ptr @g_isp_config, i32 0, i32 21), align 4, !tbaa !26
  store i8 %15, ptr %4, align 1, !tbaa !25
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #2
  store i8 127, ptr %5, align 1, !tbaa !25
  call void @llvm.lifetime.start.p0(i64 2, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 2, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 2, ptr %8) #2
  %16 = load i32, ptr @g_isp_config, align 8, !tbaa !27
  %17 = trunc i32 %16 to i16
  store i16 %17, ptr %7, align 2, !tbaa !28
  %18 = load i32, ptr getelementptr inbounds (%struct.isp_config_t, ptr @g_isp_config, i32 0, i32 1), align 4, !tbaa !29
  %19 = trunc i32 %18 to i16
  store i16 %19, ptr %8, align 2, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #2
  store i32 0, ptr %9, align 4, !tbaa !30
  br label %20

20:                                               ; preds = %142, %1
  %21 = load i32, ptr %9, align 4, !tbaa !30
  %22 = load i16, ptr %8, align 2, !tbaa !28
  %23 = zext i16 %22 to i32
  %24 = icmp slt i32 %21, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %20
  store i32 2, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #2
  br label %145

26:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #2
  store i32 0, ptr %11, align 4, !tbaa !30
  br label %27

27:                                               ; preds = %138, %26
  %28 = load i32, ptr %11, align 4, !tbaa !30
  %29 = load i16, ptr %7, align 2, !tbaa !28
  %30 = zext i16 %29 to i32
  %31 = icmp slt i32 %28, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %27
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #2
  br label %141

33:                                               ; preds = %27
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = load i32, ptr %9, align 4, !tbaa !30
  %36 = load i16, ptr %7, align 2, !tbaa !28
  %37 = zext i16 %36 to i32
  %38 = mul nsw i32 %35, %37
  %39 = load i32, ptr %11, align 4, !tbaa !30
  %40 = add nsw i32 %38, %39
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds i8, ptr %34, i64 %41
  %43 = load i8, ptr %42, align 1, !tbaa !25
  %44 = zext i8 %43 to i32
  %45 = load i8, ptr %4, align 1, !tbaa !25
  %46 = zext i8 %45 to i32
  %47 = add nsw i32 %44, %46
  %48 = trunc i32 %47 to i16
  store i16 %48, ptr %6, align 2, !tbaa !28
  %49 = load i16, ptr %6, align 2, !tbaa !28
  %50 = zext i16 %49 to i32
  %51 = icmp sgt i32 %50, 255
  br i1 %51, label %52, label %53

52:                                               ; preds = %33
  br label %56

53:                                               ; preds = %33
  %54 = load i16, ptr %6, align 2, !tbaa !28
  %55 = zext i16 %54 to i32
  br label %56

56:                                               ; preds = %53, %52
  %57 = phi i32 [ 255, %52 ], [ %55, %53 ]
  %58 = trunc i32 %57 to i16
  store i16 %58, ptr %6, align 2, !tbaa !28
  %59 = load i16, ptr %6, align 2, !tbaa !28
  %60 = zext i16 %59 to i32
  %61 = icmp slt i32 %60, 0
  br i1 %61, label %62, label %63

62:                                               ; preds = %56
  br label %66

63:                                               ; preds = %56
  %64 = load i16, ptr %6, align 2, !tbaa !28
  %65 = zext i16 %64 to i32
  br label %66

66:                                               ; preds = %63, %62
  %67 = phi i32 [ 0, %62 ], [ %65, %63 ]
  %68 = trunc i32 %67 to i16
  store i16 %68, ptr %6, align 2, !tbaa !28
  %69 = load i16, ptr %6, align 2, !tbaa !28
  %70 = zext i16 %69 to i32
  %71 = load i8, ptr %5, align 1, !tbaa !25
  %72 = zext i8 %71 to i32
  %73 = icmp sgt i32 %70, %72
  br i1 %73, label %74, label %90

74:                                               ; preds = %66
  %75 = load i8, ptr %5, align 1, !tbaa !25
  %76 = zext i8 %75 to i32
  %77 = load i8, ptr %3, align 1, !tbaa !25
  %78 = zext i8 %77 to i32
  %79 = load i16, ptr %6, align 2, !tbaa !28
  %80 = zext i16 %79 to i32
  %81 = load i8, ptr %5, align 1, !tbaa !25
  %82 = zext i8 %81 to i32
  %83 = sub nsw i32 %80, %82
  %84 = mul nsw i32 %78, %83
  %85 = ashr i32 %84, 6
  %86 = trunc i32 %85 to i8
  %87 = zext i8 %86 to i32
  %88 = add nsw i32 %76, %87
  %89 = trunc i32 %88 to i16
  store i16 %89, ptr %6, align 2, !tbaa !28
  br label %106

90:                                               ; preds = %66
  %91 = load i8, ptr %5, align 1, !tbaa !25
  %92 = zext i8 %91 to i32
  %93 = load i8, ptr %3, align 1, !tbaa !25
  %94 = zext i8 %93 to i32
  %95 = load i8, ptr %5, align 1, !tbaa !25
  %96 = zext i8 %95 to i32
  %97 = load i16, ptr %6, align 2, !tbaa !28
  %98 = zext i16 %97 to i32
  %99 = sub nsw i32 %96, %98
  %100 = mul nsw i32 %94, %99
  %101 = ashr i32 %100, 6
  %102 = trunc i32 %101 to i8
  %103 = zext i8 %102 to i32
  %104 = sub nsw i32 %92, %103
  %105 = trunc i32 %104 to i16
  store i16 %105, ptr %6, align 2, !tbaa !28
  br label %106

106:                                              ; preds = %90, %74
  %107 = load i16, ptr %6, align 2, !tbaa !28
  %108 = zext i16 %107 to i32
  %109 = icmp sgt i32 %108, 255
  br i1 %109, label %110, label %111

110:                                              ; preds = %106
  br label %114

111:                                              ; preds = %106
  %112 = load i16, ptr %6, align 2, !tbaa !28
  %113 = zext i16 %112 to i32
  br label %114

114:                                              ; preds = %111, %110
  %115 = phi i32 [ 255, %110 ], [ %113, %111 ]
  %116 = trunc i32 %115 to i16
  store i16 %116, ptr %6, align 2, !tbaa !28
  %117 = load i16, ptr %6, align 2, !tbaa !28
  %118 = zext i16 %117 to i32
  %119 = icmp slt i32 %118, 0
  br i1 %119, label %120, label %121

120:                                              ; preds = %114
  br label %124

121:                                              ; preds = %114
  %122 = load i16, ptr %6, align 2, !tbaa !28
  %123 = zext i16 %122 to i32
  br label %124

124:                                              ; preds = %121, %120
  %125 = phi i32 [ 0, %120 ], [ %123, %121 ]
  %126 = trunc i32 %125 to i16
  store i16 %126, ptr %6, align 2, !tbaa !28
  %127 = load i16, ptr %6, align 2, !tbaa !28
  %128 = trunc i16 %127 to i8
  %129 = load ptr, ptr %2, align 8, !tbaa !5
  %130 = load i32, ptr %9, align 4, !tbaa !30
  %131 = load i16, ptr %7, align 2, !tbaa !28
  %132 = zext i16 %131 to i32
  %133 = mul nsw i32 %130, %132
  %134 = load i32, ptr %11, align 4, !tbaa !30
  %135 = add nsw i32 %133, %134
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds i8, ptr %129, i64 %136
  store i8 %128, ptr %137, align 1, !tbaa !25
  br label %138

138:                                              ; preds = %124
  %139 = load i32, ptr %11, align 4, !tbaa !30
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %11, align 4, !tbaa !30
  br label %27, !llvm.loop !31

141:                                              ; preds = %32
  br label %142

142:                                              ; preds = %141
  %143 = load i32, ptr %9, align 4, !tbaa !30
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %9, align 4, !tbaa !30
  br label %20, !llvm.loop !33

145:                                              ; preds = %25
  call void @llvm.lifetime.end.p0(i64 2, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 2, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 2, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #2
  ret void
}

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

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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, !17, i64 376}
!10 = !{!"_ZTS12isp_config_t", !11, i64 0, !11, i64 4, !12, i64 8, !13, i64 16, !16, i64 48, !12, i64 64, !13, i64 72, !18, i64 104, !7, i64 120, !13, i64 168, !17, i64 200, !7, i64 204, !19, i64 252, !20, i64 256, !7, i64 320, !21, i64 350, !22, i64 362, !23, i64 364, !24, i64 372}
!11 = !{!"int", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !14, i64 0, !15, i64 8, !7, i64 16}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!"_ZTS9blc_cfg_t", !12, i64 0, !12, i64 2, !12, i64 4, !12, i64 6, !17, i64 8, !17, i64 12}
!17 = !{!"float", !7, i64 0}
!18 = !{!"_ZTS10awb_gain_t", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12}
!19 = !{!"_ZTS9nlm_cfg_t", !7, i64 0, !7, i64 1, !7, i64 2}
!20 = !{!"_ZTS9bnf_cfg_t", !7, i64 0, !7, i64 50, !7, i64 58}
!21 = !{!"_ZTS9eeh_cfg_t", !12, i64 0, !12, i64 2, !12, i64 4, !12, i64 6, !12, i64 8, !12, i64 10}
!22 = !{!"_ZTS9fcs_cfg_t", !7, i64 0, !7, i64 1}
!23 = !{!"_ZTS9hsc_cfg_t", !7, i64 0, !17, i64 4}
!24 = !{!"_ZTS9bcc_cfg_t", !7, i64 0, !17, i64 4}
!25 = !{!7, !7, i64 0}
!26 = !{!10, !7, i64 372}
!27 = !{!10, !11, i64 0}
!28 = !{!12, !12, i64 0}
!29 = !{!10, !11, i64 4}
!30 = !{!11, !11, i64 0}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = distinct !{!33, !32}


; 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.isp_config_t = type <{ i32, i32, i16, [6 x i8], %"class.std::__cxx11::basic_string", %struct.blc_cfg_t, i16, [6 x i8], %"class.std::__cxx11::basic_string", %struct.awb_gain_t, [12 x float], %"class.std::__cxx11::basic_string", float, [12 x float], %struct.nlm_cfg_t, i8, %struct.bnf_cfg_t, [15 x i16], %struct.eeh_cfg_t, %struct.fcs_cfg_t, %struct.hsc_cfg_t, %struct.bcc_cfg_t, [4 x i8] }>
%struct.blc_cfg_t = type { i16, i16, i16, i16, float, float }
%struct.awb_gain_t = type { float, float, float, float }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%struct.nlm_cfg_t = type { i8, i8, i8 }
%struct.bnf_cfg_t = type { [25 x i16], [4 x i16], [3 x i16] }
%struct.eeh_cfg_t = type { i16, i16, i16, i16, i16, i16 }
%struct.fcs_cfg_t = type { i8, i8 }
%struct.hsc_cfg_t = type { i8, float }
%struct.bcc_cfg_t = type { i8, float }

@g_isp_config = external local_unnamed_addr global %struct.isp_config_t, align 8

; Function Attrs: mustprogress nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @_Z7isp_bccPh(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = load i32, ptr getelementptr inbounds (i8, ptr @g_isp_config, i64 4), align 4, !tbaa !5
  %3 = and i32 %2, 65535
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %._crit_edge39, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %1
  %4 = load i32, ptr @g_isp_config, align 8, !tbaa !24
  %5 = load i8, ptr getelementptr inbounds (i8, ptr @g_isp_config, i64 372), align 4, !tbaa !25
  %6 = load float, ptr getelementptr inbounds (i8, ptr @g_isp_config, i64 376), align 8, !tbaa !26
  %7 = fmul float %6, 6.400000e+01
  %8 = fptoui float %7 to i8
  %9 = and i32 %4, 65535
  %.not40 = icmp eq i32 %9, 0
  %10 = zext i8 %5 to i32
  %11 = zext i8 %8 to i32
  br i1 %.not40, label %._crit_edge39, label %.preheader.us.preheader

.preheader.us.preheader:                          ; preds = %.preheader.lr.ph
  %12 = zext nneg i32 %9 to i64
  %wide.trip.count46 = zext nneg i32 %3 to i64
  %min.iters.check = icmp ult i32 %9, 8
  %min.iters.check48 = icmp ult i32 %9, 16
  %n.vec = and i64 %12, 65520
  %broadcast.splatinsert = insertelement <16 x i32> poison, i32 %10, i64 0
  %broadcast.splat = shufflevector <16 x i32> %broadcast.splatinsert, <16 x i32> poison, <16 x i32> zeroinitializer
  %broadcast.splatinsert49 = insertelement <16 x i32> poison, i32 %11, i64 0
  %broadcast.splat50 = shufflevector <16 x i32> %broadcast.splatinsert49, <16 x i32> poison, <16 x i32> zeroinitializer
  %cmp.n = icmp eq i64 %n.vec, %12
  %n.vec.remaining = and i64 %12, 8
  %min.epilog.iters.check.not.not = icmp eq i64 %n.vec.remaining, 0
  %n.vec52 = and i64 %12, 65528
  %broadcast.splatinsert55 = insertelement <8 x i32> poison, i32 %10, i64 0
  %broadcast.splat56 = shufflevector <8 x i32> %broadcast.splatinsert55, <8 x i32> poison, <8 x i32> zeroinitializer
  %broadcast.splatinsert57 = insertelement <8 x i32> poison, i32 %11, i64 0
  %broadcast.splat58 = shufflevector <8 x i32> %broadcast.splatinsert57, <8 x i32> poison, <8 x i32> zeroinitializer
  %cmp.n61 = icmp eq i64 %n.vec52, %12
  br label %iter.check

iter.check:                                       ; preds = %.preheader.us.preheader, %._crit_edge.us
  %indvars.iv43 = phi i64 [ 0, %.preheader.us.preheader ], [ %indvars.iv.next44, %._crit_edge.us ]
  %13 = mul nuw nsw i64 %indvars.iv43, %12
  %invariant.gep = getelementptr inbounds i8, ptr %0, i64 %13
  br i1 %min.iters.check, label %vec.epilog.scalar.ph.preheader, label %vector.main.loop.iter.check

vector.main.loop.iter.check:                      ; preds = %iter.check
  br i1 %min.iters.check48, label %vec.epilog.ph, label %vector.body

vector.body:                                      ; preds = %vector.main.loop.iter.check, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.main.loop.iter.check ]
  %14 = getelementptr inbounds i8, ptr %invariant.gep, i64 %index
  %wide.load = load <16 x i8>, ptr %14, align 1, !tbaa !27
  %15 = zext <16 x i8> %wide.load to <16 x i32>
  %16 = add nuw nsw <16 x i32> %broadcast.splat, %15
  %17 = tail call <16 x i32> @llvm.umin.v16i32(<16 x i32> %16, <16 x i32> <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>)
  %18 = icmp ult <16 x i32> %16, <i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128>
  %19 = sub nuw nsw <16 x i32> <i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127>, %17
  %20 = mul nuw nsw <16 x i32> %19, %broadcast.splat50
  %21 = lshr <16 x i32> %20, <i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6>
  %22 = and <16 x i32> %21, <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>
  %23 = add nuw nsw <16 x i32> %17, <i32 16257, i32 16257, i32 16257, i32 16257, i32 16257, i32 16257, i32 16257, i32 16257, i32 16257, i32 16257, i32 16257, i32 16257, i32 16257, i32 16257, i32 16257, i32 16257>
  %24 = mul nuw nsw <16 x i32> %23, %broadcast.splat50
  %25 = lshr <16 x i32> %24, <i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6>
  %26 = and <16 x i32> %25, <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>
  %27 = sub nsw <16 x i32> zeroinitializer, %22
  %predphi.p = select <16 x i1> %18, <16 x i32> %27, <16 x i32> %26
  %predphi = add nsw <16 x i32> %predphi.p, <i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127>
  %28 = and <16 x i32> %predphi, <i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535>
  %29 = tail call <16 x i32> @llvm.umin.v16i32(<16 x i32> %28, <16 x i32> <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>)
  %30 = trunc nuw <16 x i32> %29 to <16 x i8>
  store <16 x i8> %30, ptr %14, align 1, !tbaa !27
  %index.next = add nuw i64 %index, 16
  %31 = icmp eq i64 %index.next, %n.vec
  br i1 %31, label %middle.block, label %vector.body, !llvm.loop !28

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge.us, label %vec.epilog.iter.check

vec.epilog.iter.check:                            ; preds = %middle.block
  br i1 %min.epilog.iters.check.not.not, label %vec.epilog.scalar.ph.preheader, label %vec.epilog.ph

vec.epilog.ph:                                    ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
  %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
  br label %vec.epilog.vector.body

vec.epilog.vector.body:                           ; preds = %vec.epilog.vector.body, %vec.epilog.ph
  %index53 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next60, %vec.epilog.vector.body ]
  %32 = getelementptr inbounds i8, ptr %invariant.gep, i64 %index53
  %wide.load54 = load <8 x i8>, ptr %32, align 1, !tbaa !27
  %33 = zext <8 x i8> %wide.load54 to <8 x i32>
  %34 = add nuw nsw <8 x i32> %broadcast.splat56, %33
  %35 = tail call <8 x i32> @llvm.umin.v8i32(<8 x i32> %34, <8 x i32> <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>)
  %36 = icmp ult <8 x i32> %34, <i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128>
  %37 = sub nuw nsw <8 x i32> <i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127>, %35
  %38 = mul nuw nsw <8 x i32> %37, %broadcast.splat58
  %39 = lshr <8 x i32> %38, <i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6>
  %40 = and <8 x i32> %39, <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>
  %41 = add nuw nsw <8 x i32> %35, <i32 16257, i32 16257, i32 16257, i32 16257, i32 16257, i32 16257, i32 16257, i32 16257>
  %42 = mul nuw nsw <8 x i32> %41, %broadcast.splat58
  %43 = lshr <8 x i32> %42, <i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6>
  %44 = and <8 x i32> %43, <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>
  %45 = sub nsw <8 x i32> zeroinitializer, %40
  %predphi59.p = select <8 x i1> %36, <8 x i32> %45, <8 x i32> %44
  %predphi59 = add nsw <8 x i32> %predphi59.p, <i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127, i32 127>
  %46 = and <8 x i32> %predphi59, <i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535>
  %47 = tail call <8 x i32> @llvm.umin.v8i32(<8 x i32> %46, <8 x i32> <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>)
  %48 = trunc nuw <8 x i32> %47 to <8 x i8>
  store <8 x i8> %48, ptr %32, align 1, !tbaa !27
  %index.next60 = add nuw i64 %index53, 8
  %49 = icmp eq i64 %index.next60, %n.vec52
  br i1 %49, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !32

vec.epilog.middle.block:                          ; preds = %vec.epilog.vector.body
  br i1 %cmp.n61, label %._crit_edge.us, label %vec.epilog.scalar.ph.preheader

vec.epilog.scalar.ph.preheader:                   ; preds = %vec.epilog.middle.block, %iter.check, %vec.epilog.iter.check
  %indvars.iv.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec52, %vec.epilog.middle.block ]
  br label %vec.epilog.scalar.ph

vec.epilog.scalar.ph:                             ; preds = %vec.epilog.scalar.ph.preheader, %67
  %indvars.iv = phi i64 [ %indvars.iv.next, %67 ], [ %indvars.iv.ph, %vec.epilog.scalar.ph.preheader ]
  %gep = getelementptr inbounds i8, ptr %invariant.gep, i64 %indvars.iv
  %50 = load i8, ptr %gep, align 1, !tbaa !27
  %51 = zext i8 %50 to i32
  %52 = add nuw nsw i32 %51, %10
  %53 = tail call i32 @llvm.umin.i32(i32 %52, i32 255)
  %54 = icmp ugt i32 %52, 127
  br i1 %54, label %61, label %55

55:                                               ; preds = %vec.epilog.scalar.ph
  %56 = sub nuw nsw i32 127, %53
  %57 = mul nuw nsw i32 %56, %11
  %58 = lshr i32 %57, 6
  %59 = and i32 %58, 255
  %60 = sub nsw i32 127, %59
  br label %67

61:                                               ; preds = %vec.epilog.scalar.ph
  %62 = add nuw nsw i32 %53, 16257
  %63 = mul nuw nsw i32 %62, %11
  %64 = lshr i32 %63, 6
  %65 = and i32 %64, 255
  %66 = add nuw nsw i32 %65, 127
  br label %67

67:                                               ; preds = %61, %55
  %.034.us = phi i32 [ %66, %61 ], [ %60, %55 ]
  %68 = and i32 %.034.us, 65535
  %69 = tail call i32 @llvm.umin.i32(i32 %68, i32 255)
  %70 = trunc nuw i32 %69 to i8
  store i8 %70, ptr %gep, align 1, !tbaa !27
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %12
  br i1 %exitcond.not, label %._crit_edge.us, label %vec.epilog.scalar.ph, !llvm.loop !33

._crit_edge.us:                                   ; preds = %67, %vec.epilog.middle.block, %middle.block
  %indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
  %exitcond47.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count46
  br i1 %exitcond47.not, label %._crit_edge39, label %iter.check, !llvm.loop !34

._crit_edge39:                                    ; preds = %._crit_edge.us, %.preheader.lr.ph, %1
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <16 x i32> @llvm.umin.v16i32(<16 x i32>, <16 x i32>) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <8 x i32> @llvm.umin.v8i32(<8 x i32>, <8 x i32>) #1

attributes #0 = { mustprogress nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) 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 speculatable willreturn memory(none) }

!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 4}
!6 = !{!"_ZTS12isp_config_t", !7, i64 0, !7, i64 4, !10, i64 8, !11, i64 16, !15, i64 48, !10, i64 64, !11, i64 72, !17, i64 104, !8, i64 120, !11, i64 168, !16, i64 200, !8, i64 204, !18, i64 252, !19, i64 256, !8, i64 320, !20, i64 350, !21, i64 362, !22, i64 364, !23, i64 372}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"short", !8, i64 0}
!11 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !12, i64 0, !14, i64 8, !8, i64 16}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !13, i64 0}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!"long", !8, i64 0}
!15 = !{!"_ZTS9blc_cfg_t", !10, i64 0, !10, i64 2, !10, i64 4, !10, i64 6, !16, i64 8, !16, i64 12}
!16 = !{!"float", !8, i64 0}
!17 = !{!"_ZTS10awb_gain_t", !16, i64 0, !16, i64 4, !16, i64 8, !16, i64 12}
!18 = !{!"_ZTS9nlm_cfg_t", !8, i64 0, !8, i64 1, !8, i64 2}
!19 = !{!"_ZTS9bnf_cfg_t", !8, i64 0, !8, i64 50, !8, i64 58}
!20 = !{!"_ZTS9eeh_cfg_t", !10, i64 0, !10, i64 2, !10, i64 4, !10, i64 6, !10, i64 8, !10, i64 10}
!21 = !{!"_ZTS9fcs_cfg_t", !8, i64 0, !8, i64 1}
!22 = !{!"_ZTS9hsc_cfg_t", !8, i64 0, !16, i64 4}
!23 = !{!"_ZTS9bcc_cfg_t", !8, i64 0, !16, i64 4}
!24 = !{!6, !7, i64 0}
!25 = !{!6, !8, i64 372}
!26 = !{!6, !16, i64 376}
!27 = !{!8, !8, i64 0}
!28 = distinct !{!28, !29, !30, !31}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!"llvm.loop.isvectorized", i32 1}
!31 = !{!"llvm.loop.unroll.runtime.disable"}
!32 = distinct !{!32, !29, !30, !31}
!33 = distinct !{!33, !29, !31, !30}
!34 = distinct !{!34, !29}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass