; LLVM IR from aap/librw :: src/image.ll (ZN2rw10ColorQuant10reduceNodeEPNS0_4NodeE)

; 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.rw::ColorQuant::Node" = type { i32, i32, i32, i32, i32, ptr, [16 x ptr], %"struct.rw::LLLink" }
%"struct.rw::LLLink" = type { ptr, ptr }
%"struct.rw::ColorQuant" = type { ptr, %"struct.rw::LinkList" }
%"struct.rw::LinkList" = type { %"struct.rw::LLLink" }

@.str.2 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [21 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw10ColorQuant10reduceNodeEPNS0_4NodeE = external hidden unnamed_addr constant [40 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [23 x i8], align 1

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2rw8LinkList6appendEPNS_6LLLinkE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2rw10ColorQuant10reduceNodeEPNS0_4NodeE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %7, i32 0, i32 4
  %9 = load i32, ptr %8, align 8, !tbaa !9
  %10 = icmp eq i32 %9, 0
  br i1 %10, label %11, label %12

11:                                               ; preds = %2
  br label %14

12:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.22, ptr noundef @.str.2, i32 noundef 1166, ptr noundef @__PRETTY_FUNCTION__._ZN2rw10ColorQuant10reduceNodeEPNS0_4NodeE) #5
  unreachable

13:                                               ; No predecessors!
  br label %14

14:                                               ; preds = %13, %11
  store i32 0, ptr %5, align 4, !tbaa !13
  br label %15

15:                                               ; preds = %99, %14
  %16 = load i32, ptr %5, align 4, !tbaa !13
  %17 = icmp slt i32 %16, 16
  br i1 %17, label %18, label %102

18:                                               ; preds = %15
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %19, i32 0, i32 6
  %21 = load i32, ptr %5, align 4, !tbaa !13
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [16 x ptr], ptr %20, i64 0, i64 %22
  %24 = load ptr, ptr %23, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %26, label %98

26:                                               ; preds = %18
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %27, i32 0, i32 6
  %29 = load i32, ptr %5, align 4, !tbaa !13
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [16 x ptr], ptr %28, i64 0, i64 %30
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %32, i32 0, i32 0
  %34 = load i32, ptr %33, align 8, !tbaa !14
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %35, i32 0, i32 0
  %37 = load i32, ptr %36, align 8, !tbaa !14
  %38 = add i32 %37, %34
  store i32 %38, ptr %36, align 8, !tbaa !14
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %39, i32 0, i32 6
  %41 = load i32, ptr %5, align 4, !tbaa !13
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [16 x ptr], ptr %40, i64 0, i64 %42
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %44, i32 0, i32 1
  %46 = load i32, ptr %45, align 4, !tbaa !15
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %47, i32 0, i32 1
  %49 = load i32, ptr %48, align 4, !tbaa !15
  %50 = add i32 %49, %46
  store i32 %50, ptr %48, align 4, !tbaa !15
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %51, i32 0, i32 6
  %53 = load i32, ptr %5, align 4, !tbaa !13
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [16 x ptr], ptr %52, i64 0, i64 %54
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  %57 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %56, i32 0, i32 2
  %58 = load i32, ptr %57, align 8, !tbaa !16
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %59, i32 0, i32 2
  %61 = load i32, ptr %60, align 8, !tbaa !16
  %62 = add i32 %61, %58
  store i32 %62, ptr %60, align 8, !tbaa !16
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %63, i32 0, i32 6
  %65 = load i32, ptr %5, align 4, !tbaa !13
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [16 x ptr], ptr %64, i64 0, i64 %66
  %68 = load ptr, ptr %67, align 8, !tbaa !5
  %69 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %68, i32 0, i32 3
  %70 = load i32, ptr %69, align 4, !tbaa !17
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %71, i32 0, i32 3
  %73 = load i32, ptr %72, align 4, !tbaa !17
  %74 = add i32 %73, %70
  store i32 %74, ptr %72, align 4, !tbaa !17
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %75, i32 0, i32 6
  %77 = load i32, ptr %5, align 4, !tbaa !13
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [16 x ptr], ptr %76, i64 0, i64 %78
  %80 = load ptr, ptr %79, align 8, !tbaa !5
  %81 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %80, i32 0, i32 4
  %82 = load i32, ptr %81, align 8, !tbaa !9
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %83, i32 0, i32 4
  %85 = load i32, ptr %84, align 8, !tbaa !9
  %86 = add nsw i32 %85, %82
  store i32 %86, ptr %84, align 8, !tbaa !9
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %87, i32 0, i32 6
  %89 = load i32, ptr %5, align 4, !tbaa !13
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [16 x ptr], ptr %88, i64 0, i64 %90
  %92 = load ptr, ptr %91, align 8, !tbaa !5
  call void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176) %92)
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %93, i32 0, i32 6
  %95 = load i32, ptr %5, align 4, !tbaa !13
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [16 x ptr], ptr %94, i64 0, i64 %96
  store ptr null, ptr %97, align 8, !tbaa !5
  br label %98

98:                                               ; preds = %26, %18
  br label %99

99:                                               ; preds = %98
  %100 = load i32, ptr %5, align 4, !tbaa !13
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %5, align 4, !tbaa !13
  br label %15, !llvm.loop !18

102:                                              ; preds = %15
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %103, i32 0, i32 7
  %105 = getelementptr inbounds %"struct.rw::LLLink", ptr %104, i32 0, i32 0
  %106 = load ptr, ptr %105, align 8, !tbaa !20
  %107 = icmp eq ptr %106, null
  br i1 %107, label %108, label %109

108:                                              ; preds = %102
  br label %111

109:                                              ; preds = %102
  call void @__assert_fail(ptr noundef @.str.23, ptr noundef @.str.2, i32 noundef 1177, ptr noundef @__PRETTY_FUNCTION__._ZN2rw10ColorQuant10reduceNodeEPNS0_4NodeE) #5
  unreachable

110:                                              ; No predecessors!
  br label %111

111:                                              ; preds = %110, %108
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %112, i32 0, i32 7
  %114 = getelementptr inbounds %"struct.rw::LLLink", ptr %113, i32 0, i32 1
  %115 = load ptr, ptr %114, align 8, !tbaa !21
  %116 = icmp eq ptr %115, null
  br i1 %116, label %117, label %118

117:                                              ; preds = %111
  br label %120

118:                                              ; preds = %111
  call void @__assert_fail(ptr noundef @.str.24, ptr noundef @.str.2, i32 noundef 1178, ptr noundef @__PRETTY_FUNCTION__._ZN2rw10ColorQuant10reduceNodeEPNS0_4NodeE) #5
  unreachable

119:                                              ; No predecessors!
  br label %120

120:                                              ; preds = %119, %117
  %121 = getelementptr inbounds %"struct.rw::ColorQuant", ptr %6, i32 0, i32 1
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds %"struct.rw::ColorQuant::Node", ptr %122, i32 0, i32 7
  call void @_ZN2rw8LinkList6appendEPNS_6LLLinkE(ptr noundef nonnull align 8 dereferenceable(16) %121, ptr noundef %123)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { 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 }
attributes #5 = { noreturn 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, !11, i64 16}
!10 = !{!"_ZTSN2rw10ColorQuant4NodeE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !6, i64 24, !7, i64 32, !12, i64 160}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSN2rw6LLLinkE", !6, i64 0, !6, i64 8}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !11, i64 0}
!15 = !{!10, !11, i64 4}
!16 = !{!10, !11, i64 8}
!17 = !{!10, !11, i64 12}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!10, !6, i64 160}
!21 = !{!10, !6, i64 168}


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

@.str.2 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [21 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw10ColorQuant10reduceNodeEPNS0_4NodeE = external hidden unnamed_addr constant [40 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2rw10ColorQuant10reduceNodeEPNS0_4NodeE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1) local_unnamed_addr #1 align 2 {
  %3 = getelementptr inbounds i8, ptr %1, i64 16
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = icmp eq i32 %4, 0
  br i1 %5, label %.preheader, label %8

.preheader:                                       ; preds = %2
  %6 = getelementptr inbounds i8, ptr %1, i64 32
  %7 = load ptr, ptr %6, align 8, !tbaa !12
  %.not = icmp eq ptr %7, null
  br i1 %.not, label %17, label %9

8:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.22, ptr noundef nonnull @.str.2, i32 noundef 1166, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw10ColorQuant10reduceNodeEPNS0_4NodeE) #3
  unreachable

9:                                                ; preds = %.preheader
  %10 = load <4 x i32>, ptr %7, align 8, !tbaa !13
  %11 = load <4 x i32>, ptr %1, align 8, !tbaa !13
  %12 = add <4 x i32> %11, %10
  store <4 x i32> %12, ptr %1, align 8, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %7, i64 16
  %14 = load i32, ptr %13, align 8, !tbaa !5
  %15 = load i32, ptr %3, align 8, !tbaa !5
  %16 = add nsw i32 %15, %14
  store i32 %16, ptr %3, align 8, !tbaa !5
  tail call void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176) %7)
  store ptr null, ptr %6, align 8, !tbaa !12
  br label %17

17:                                               ; preds = %.preheader, %9
  %18 = getelementptr inbounds i8, ptr %1, i64 40
  %19 = load ptr, ptr %18, align 8, !tbaa !12
  %.not.1 = icmp eq ptr %19, null
  br i1 %.not.1, label %28, label %20

20:                                               ; preds = %17
  %21 = load <4 x i32>, ptr %19, align 8, !tbaa !13
  %22 = load <4 x i32>, ptr %1, align 8, !tbaa !13
  %23 = add <4 x i32> %22, %21
  store <4 x i32> %23, ptr %1, align 8, !tbaa !13
  %24 = getelementptr inbounds i8, ptr %19, i64 16
  %25 = load i32, ptr %24, align 8, !tbaa !5
  %26 = load i32, ptr %3, align 8, !tbaa !5
  %27 = add nsw i32 %26, %25
  store i32 %27, ptr %3, align 8, !tbaa !5
  tail call void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176) %19)
  store ptr null, ptr %18, align 8, !tbaa !12
  br label %28

28:                                               ; preds = %20, %17
  %29 = getelementptr inbounds i8, ptr %1, i64 48
  %30 = load ptr, ptr %29, align 8, !tbaa !12
  %.not.2 = icmp eq ptr %30, null
  br i1 %.not.2, label %39, label %31

31:                                               ; preds = %28
  %32 = load <4 x i32>, ptr %30, align 8, !tbaa !13
  %33 = load <4 x i32>, ptr %1, align 8, !tbaa !13
  %34 = add <4 x i32> %33, %32
  store <4 x i32> %34, ptr %1, align 8, !tbaa !13
  %35 = getelementptr inbounds i8, ptr %30, i64 16
  %36 = load i32, ptr %35, align 8, !tbaa !5
  %37 = load i32, ptr %3, align 8, !tbaa !5
  %38 = add nsw i32 %37, %36
  store i32 %38, ptr %3, align 8, !tbaa !5
  tail call void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176) %30)
  store ptr null, ptr %29, align 8, !tbaa !12
  br label %39

39:                                               ; preds = %31, %28
  %40 = getelementptr inbounds i8, ptr %1, i64 56
  %41 = load ptr, ptr %40, align 8, !tbaa !12
  %.not.3 = icmp eq ptr %41, null
  br i1 %.not.3, label %50, label %42

42:                                               ; preds = %39
  %43 = load <4 x i32>, ptr %41, align 8, !tbaa !13
  %44 = load <4 x i32>, ptr %1, align 8, !tbaa !13
  %45 = add <4 x i32> %44, %43
  store <4 x i32> %45, ptr %1, align 8, !tbaa !13
  %46 = getelementptr inbounds i8, ptr %41, i64 16
  %47 = load i32, ptr %46, align 8, !tbaa !5
  %48 = load i32, ptr %3, align 8, !tbaa !5
  %49 = add nsw i32 %48, %47
  store i32 %49, ptr %3, align 8, !tbaa !5
  tail call void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176) %41)
  store ptr null, ptr %40, align 8, !tbaa !12
  br label %50

50:                                               ; preds = %42, %39
  %51 = getelementptr inbounds i8, ptr %1, i64 64
  %52 = load ptr, ptr %51, align 8, !tbaa !12
  %.not.4 = icmp eq ptr %52, null
  br i1 %.not.4, label %61, label %53

53:                                               ; preds = %50
  %54 = load <4 x i32>, ptr %52, align 8, !tbaa !13
  %55 = load <4 x i32>, ptr %1, align 8, !tbaa !13
  %56 = add <4 x i32> %55, %54
  store <4 x i32> %56, ptr %1, align 8, !tbaa !13
  %57 = getelementptr inbounds i8, ptr %52, i64 16
  %58 = load i32, ptr %57, align 8, !tbaa !5
  %59 = load i32, ptr %3, align 8, !tbaa !5
  %60 = add nsw i32 %59, %58
  store i32 %60, ptr %3, align 8, !tbaa !5
  tail call void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176) %52)
  store ptr null, ptr %51, align 8, !tbaa !12
  br label %61

61:                                               ; preds = %53, %50
  %62 = getelementptr inbounds i8, ptr %1, i64 72
  %63 = load ptr, ptr %62, align 8, !tbaa !12
  %.not.5 = icmp eq ptr %63, null
  br i1 %.not.5, label %72, label %64

64:                                               ; preds = %61
  %65 = load <4 x i32>, ptr %63, align 8, !tbaa !13
  %66 = load <4 x i32>, ptr %1, align 8, !tbaa !13
  %67 = add <4 x i32> %66, %65
  store <4 x i32> %67, ptr %1, align 8, !tbaa !13
  %68 = getelementptr inbounds i8, ptr %63, i64 16
  %69 = load i32, ptr %68, align 8, !tbaa !5
  %70 = load i32, ptr %3, align 8, !tbaa !5
  %71 = add nsw i32 %70, %69
  store i32 %71, ptr %3, align 8, !tbaa !5
  tail call void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176) %63)
  store ptr null, ptr %62, align 8, !tbaa !12
  br label %72

72:                                               ; preds = %64, %61
  %73 = getelementptr inbounds i8, ptr %1, i64 80
  %74 = load ptr, ptr %73, align 8, !tbaa !12
  %.not.6 = icmp eq ptr %74, null
  br i1 %.not.6, label %83, label %75

75:                                               ; preds = %72
  %76 = load <4 x i32>, ptr %74, align 8, !tbaa !13
  %77 = load <4 x i32>, ptr %1, align 8, !tbaa !13
  %78 = add <4 x i32> %77, %76
  store <4 x i32> %78, ptr %1, align 8, !tbaa !13
  %79 = getelementptr inbounds i8, ptr %74, i64 16
  %80 = load i32, ptr %79, align 8, !tbaa !5
  %81 = load i32, ptr %3, align 8, !tbaa !5
  %82 = add nsw i32 %81, %80
  store i32 %82, ptr %3, align 8, !tbaa !5
  tail call void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176) %74)
  store ptr null, ptr %73, align 8, !tbaa !12
  br label %83

83:                                               ; preds = %75, %72
  %84 = getelementptr inbounds i8, ptr %1, i64 88
  %85 = load ptr, ptr %84, align 8, !tbaa !12
  %.not.7 = icmp eq ptr %85, null
  br i1 %.not.7, label %94, label %86

86:                                               ; preds = %83
  %87 = load <4 x i32>, ptr %85, align 8, !tbaa !13
  %88 = load <4 x i32>, ptr %1, align 8, !tbaa !13
  %89 = add <4 x i32> %88, %87
  store <4 x i32> %89, ptr %1, align 8, !tbaa !13
  %90 = getelementptr inbounds i8, ptr %85, i64 16
  %91 = load i32, ptr %90, align 8, !tbaa !5
  %92 = load i32, ptr %3, align 8, !tbaa !5
  %93 = add nsw i32 %92, %91
  store i32 %93, ptr %3, align 8, !tbaa !5
  tail call void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176) %85)
  store ptr null, ptr %84, align 8, !tbaa !12
  br label %94

94:                                               ; preds = %86, %83
  %95 = getelementptr inbounds i8, ptr %1, i64 96
  %96 = load ptr, ptr %95, align 8, !tbaa !12
  %.not.8 = icmp eq ptr %96, null
  br i1 %.not.8, label %105, label %97

97:                                               ; preds = %94
  %98 = load <4 x i32>, ptr %96, align 8, !tbaa !13
  %99 = load <4 x i32>, ptr %1, align 8, !tbaa !13
  %100 = add <4 x i32> %99, %98
  store <4 x i32> %100, ptr %1, align 8, !tbaa !13
  %101 = getelementptr inbounds i8, ptr %96, i64 16
  %102 = load i32, ptr %101, align 8, !tbaa !5
  %103 = load i32, ptr %3, align 8, !tbaa !5
  %104 = add nsw i32 %103, %102
  store i32 %104, ptr %3, align 8, !tbaa !5
  tail call void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176) %96)
  store ptr null, ptr %95, align 8, !tbaa !12
  br label %105

105:                                              ; preds = %97, %94
  %106 = getelementptr inbounds i8, ptr %1, i64 104
  %107 = load ptr, ptr %106, align 8, !tbaa !12
  %.not.9 = icmp eq ptr %107, null
  br i1 %.not.9, label %116, label %108

108:                                              ; preds = %105
  %109 = load <4 x i32>, ptr %107, align 8, !tbaa !13
  %110 = load <4 x i32>, ptr %1, align 8, !tbaa !13
  %111 = add <4 x i32> %110, %109
  store <4 x i32> %111, ptr %1, align 8, !tbaa !13
  %112 = getelementptr inbounds i8, ptr %107, i64 16
  %113 = load i32, ptr %112, align 8, !tbaa !5
  %114 = load i32, ptr %3, align 8, !tbaa !5
  %115 = add nsw i32 %114, %113
  store i32 %115, ptr %3, align 8, !tbaa !5
  tail call void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176) %107)
  store ptr null, ptr %106, align 8, !tbaa !12
  br label %116

116:                                              ; preds = %108, %105
  %117 = getelementptr inbounds i8, ptr %1, i64 112
  %118 = load ptr, ptr %117, align 8, !tbaa !12
  %.not.10 = icmp eq ptr %118, null
  br i1 %.not.10, label %127, label %119

119:                                              ; preds = %116
  %120 = load <4 x i32>, ptr %118, align 8, !tbaa !13
  %121 = load <4 x i32>, ptr %1, align 8, !tbaa !13
  %122 = add <4 x i32> %121, %120
  store <4 x i32> %122, ptr %1, align 8, !tbaa !13
  %123 = getelementptr inbounds i8, ptr %118, i64 16
  %124 = load i32, ptr %123, align 8, !tbaa !5
  %125 = load i32, ptr %3, align 8, !tbaa !5
  %126 = add nsw i32 %125, %124
  store i32 %126, ptr %3, align 8, !tbaa !5
  tail call void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176) %118)
  store ptr null, ptr %117, align 8, !tbaa !12
  br label %127

127:                                              ; preds = %119, %116
  %128 = getelementptr inbounds i8, ptr %1, i64 120
  %129 = load ptr, ptr %128, align 8, !tbaa !12
  %.not.11 = icmp eq ptr %129, null
  br i1 %.not.11, label %138, label %130

130:                                              ; preds = %127
  %131 = load <4 x i32>, ptr %129, align 8, !tbaa !13
  %132 = load <4 x i32>, ptr %1, align 8, !tbaa !13
  %133 = add <4 x i32> %132, %131
  store <4 x i32> %133, ptr %1, align 8, !tbaa !13
  %134 = getelementptr inbounds i8, ptr %129, i64 16
  %135 = load i32, ptr %134, align 8, !tbaa !5
  %136 = load i32, ptr %3, align 8, !tbaa !5
  %137 = add nsw i32 %136, %135
  store i32 %137, ptr %3, align 8, !tbaa !5
  tail call void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176) %129)
  store ptr null, ptr %128, align 8, !tbaa !12
  br label %138

138:                                              ; preds = %130, %127
  %139 = getelementptr inbounds i8, ptr %1, i64 128
  %140 = load ptr, ptr %139, align 8, !tbaa !12
  %.not.12 = icmp eq ptr %140, null
  br i1 %.not.12, label %149, label %141

141:                                              ; preds = %138
  %142 = load <4 x i32>, ptr %140, align 8, !tbaa !13
  %143 = load <4 x i32>, ptr %1, align 8, !tbaa !13
  %144 = add <4 x i32> %143, %142
  store <4 x i32> %144, ptr %1, align 8, !tbaa !13
  %145 = getelementptr inbounds i8, ptr %140, i64 16
  %146 = load i32, ptr %145, align 8, !tbaa !5
  %147 = load i32, ptr %3, align 8, !tbaa !5
  %148 = add nsw i32 %147, %146
  store i32 %148, ptr %3, align 8, !tbaa !5
  tail call void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176) %140)
  store ptr null, ptr %139, align 8, !tbaa !12
  br label %149

149:                                              ; preds = %141, %138
  %150 = getelementptr inbounds i8, ptr %1, i64 136
  %151 = load ptr, ptr %150, align 8, !tbaa !12
  %.not.13 = icmp eq ptr %151, null
  br i1 %.not.13, label %160, label %152

152:                                              ; preds = %149
  %153 = load <4 x i32>, ptr %151, align 8, !tbaa !13
  %154 = load <4 x i32>, ptr %1, align 8, !tbaa !13
  %155 = add <4 x i32> %154, %153
  store <4 x i32> %155, ptr %1, align 8, !tbaa !13
  %156 = getelementptr inbounds i8, ptr %151, i64 16
  %157 = load i32, ptr %156, align 8, !tbaa !5
  %158 = load i32, ptr %3, align 8, !tbaa !5
  %159 = add nsw i32 %158, %157
  store i32 %159, ptr %3, align 8, !tbaa !5
  tail call void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176) %151)
  store ptr null, ptr %150, align 8, !tbaa !12
  br label %160

160:                                              ; preds = %152, %149
  %161 = getelementptr inbounds i8, ptr %1, i64 144
  %162 = load ptr, ptr %161, align 8, !tbaa !12
  %.not.14 = icmp eq ptr %162, null
  br i1 %.not.14, label %171, label %163

163:                                              ; preds = %160
  %164 = load <4 x i32>, ptr %162, align 8, !tbaa !13
  %165 = load <4 x i32>, ptr %1, align 8, !tbaa !13
  %166 = add <4 x i32> %165, %164
  store <4 x i32> %166, ptr %1, align 8, !tbaa !13
  %167 = getelementptr inbounds i8, ptr %162, i64 16
  %168 = load i32, ptr %167, align 8, !tbaa !5
  %169 = load i32, ptr %3, align 8, !tbaa !5
  %170 = add nsw i32 %169, %168
  store i32 %170, ptr %3, align 8, !tbaa !5
  tail call void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176) %162)
  store ptr null, ptr %161, align 8, !tbaa !12
  br label %171

171:                                              ; preds = %163, %160
  %172 = getelementptr inbounds i8, ptr %1, i64 152
  %173 = load ptr, ptr %172, align 8, !tbaa !12
  %.not.15 = icmp eq ptr %173, null
  br i1 %.not.15, label %182, label %174

174:                                              ; preds = %171
  %175 = load <4 x i32>, ptr %173, align 8, !tbaa !13
  %176 = load <4 x i32>, ptr %1, align 8, !tbaa !13
  %177 = add <4 x i32> %176, %175
  store <4 x i32> %177, ptr %1, align 8, !tbaa !13
  %178 = getelementptr inbounds i8, ptr %173, i64 16
  %179 = load i32, ptr %178, align 8, !tbaa !5
  %180 = load i32, ptr %3, align 8, !tbaa !5
  %181 = add nsw i32 %180, %179
  store i32 %181, ptr %3, align 8, !tbaa !5
  tail call void @_ZN2rw10ColorQuant4Node7destroyEv(ptr noundef nonnull align 8 dereferenceable(176) %173)
  store ptr null, ptr %172, align 8, !tbaa !12
  br label %182

182:                                              ; preds = %174, %171
  %183 = getelementptr inbounds i8, ptr %1, i64 160
  %184 = load ptr, ptr %183, align 8, !tbaa !14
  %185 = icmp eq ptr %184, null
  br i1 %185, label %187, label %186

186:                                              ; preds = %182
  tail call void @__assert_fail(ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.2, i32 noundef 1177, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw10ColorQuant10reduceNodeEPNS0_4NodeE) #3
  unreachable

187:                                              ; preds = %182
  %188 = getelementptr inbounds i8, ptr %1, i64 168
  %189 = load ptr, ptr %188, align 8, !tbaa !15
  %190 = icmp eq ptr %189, null
  br i1 %190, label %192, label %191

191:                                              ; preds = %187
  tail call void @__assert_fail(ptr noundef nonnull @.str.24, ptr noundef nonnull @.str.2, i32 noundef 1178, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw10ColorQuant10reduceNodeEPNS0_4NodeE) #3
  unreachable

192:                                              ; preds = %187
  %193 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @_ZN2rw8LinkList6appendEPNS_6LLLinkE(ptr noundef nonnull align 8 dereferenceable(16) %193, ptr noundef nonnull %183)
  ret void
}

attributes #0 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { noreturn 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, !7, i64 16}
!6 = !{!"_ZTSN2rw10ColorQuant4NodeE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !10, i64 24, !8, i64 32, !11, i64 160}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_ZTSN2rw6LLLinkE", !10, i64 0, !10, i64 8}
!12 = !{!10, !10, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!6, !10, i64 160}
!15 = !{!6, !10, i64 168}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass