; LLVM IR from zeux/meshoptimizer :: src (rasterizer)

; 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.meshopt_OverdrawStatistics = type { i32, i32, float }
%class.meshopt_Allocator = type { [24 x ptr], i64 }
%"struct.meshopt::OverdrawBuffer" = type { [256 x [256 x [2 x float]]], [256 x [256 x [2 x i32]]] }

@.str = external hidden unnamed_addr constant [21 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@__PRETTY_FUNCTION__.meshopt_analyzeOverdraw = external hidden unnamed_addr constant [112 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [45 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local { i64, float } @meshopt_analyzeOverdraw(ptr noundef %0, i64 noundef %1, ptr noundef %2, i64 noundef %3, i64 noundef %4) #0 personality ptr @__gxx_personality_v0 {
  %6 = alloca %struct.meshopt_OverdrawStatistics, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca %class.meshopt_Allocator, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca { i64, float }, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i64 %1, ptr %8, align 8, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i64 %3, ptr %10, align 8, !tbaa !9
  store i64 %4, ptr %11, align 8, !tbaa !9
  %24 = load i64, ptr %8, align 8, !tbaa !9
  %25 = urem i64 %24, 3
  %26 = icmp eq i64 %25, 0
  br i1 %26, label %27, label %28

27:                                               ; preds = %5
  br label %30

28:                                               ; preds = %5
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 221, ptr noundef @__PRETTY_FUNCTION__.meshopt_analyzeOverdraw) #6
  unreachable

29:                                               ; No predecessors!
  br label %30

30:                                               ; preds = %29, %27
  %31 = load i64, ptr %11, align 8, !tbaa !9
  %32 = icmp uge i64 %31, 12
  br i1 %32, label %33, label %36

33:                                               ; preds = %30
  %34 = load i64, ptr %11, align 8, !tbaa !9
  %35 = icmp ule i64 %34, 256
  br label %36

36:                                               ; preds = %33, %30
  %37 = phi i1 [ false, %30 ], [ %35, %33 ]
  br i1 %37, label %38, label %39

38:                                               ; preds = %36
  br label %41

39:                                               ; preds = %36
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 222, ptr noundef @__PRETTY_FUNCTION__.meshopt_analyzeOverdraw) #6
  unreachable

40:                                               ; No predecessors!
  br label %41

41:                                               ; preds = %40, %38
  %42 = load i64, ptr %11, align 8, !tbaa !9
  %43 = urem i64 %42, 4
  %44 = icmp eq i64 %43, 0
  br i1 %44, label %45, label %46

45:                                               ; preds = %41
  br label %48

46:                                               ; preds = %41
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 223, ptr noundef @__PRETTY_FUNCTION__.meshopt_analyzeOverdraw) #6
  unreachable

47:                                               ; No predecessors!
  br label %48

48:                                               ; preds = %47, %45
  call void @llvm.lifetime.start.p0(i64 200, ptr %12) #7
  call void @_ZN17meshopt_AllocatorC2Ev(ptr noundef nonnull align 8 dereferenceable(200) %12)
  call void @llvm.memset.p0.i64(ptr align 4 %6, i8 0, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %49 = load i64, ptr %8, align 8, !tbaa !9
  %50 = mul i64 %49, 3
  %51 = invoke noundef ptr @_ZN17meshopt_Allocator8allocateIfEEPT_m(ptr noundef nonnull align 8 dereferenceable(200) %12, i64 noundef %50)
          to label %52 unwind label %67

52:                                               ; preds = %48
  store ptr %51, ptr %13, align 8, !tbaa !5
  %53 = load ptr, ptr %13, align 8, !tbaa !5
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = load i64, ptr %8, align 8, !tbaa !9
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = load i64, ptr %10, align 8, !tbaa !9
  %58 = load i64, ptr %11, align 8, !tbaa !9
  %59 = invoke noundef float @_ZN7meshoptL18transformTrianglesEPfPKjmPKfmm(ptr noundef %53, ptr noundef %54, i64 noundef %55, ptr noundef %56, i64 noundef %57, i64 noundef %58)
          to label %60 unwind label %67

60:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %61 = invoke noundef ptr @_ZN17meshopt_Allocator8allocateIN7meshopt14OverdrawBufferEEEPT_m(ptr noundef nonnull align 8 dereferenceable(200) %12, i64 noundef 1)
          to label %62 unwind label %71

62:                                               ; preds = %60
  store ptr %61, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !11
  br label %63

63:                                               ; preds = %135, %62
  %64 = load i32, ptr %17, align 4, !tbaa !11
  %65 = icmp slt i32 %64, 3
  br i1 %65, label %75, label %66

66:                                               ; preds = %63
  store i32 2, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %138

67:                                               ; preds = %52, %48
  %68 = landingpad { ptr, i32 }
          cleanup
  %69 = extractvalue { ptr, i32 } %68, 0
  store ptr %69, ptr %14, align 8
  %70 = extractvalue { ptr, i32 } %68, 1
  store i32 %70, ptr %15, align 4
  br label %156

71:                                               ; preds = %60
  %72 = landingpad { ptr, i32 }
          cleanup
  %73 = extractvalue { ptr, i32 } %72, 0
  store ptr %73, ptr %14, align 8
  %74 = extractvalue { ptr, i32 } %72, 1
  store i32 %74, ptr %15, align 4
  br label %155

75:                                               ; preds = %63
  %76 = load ptr, ptr %16, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 4 %76, i8 0, i64 1048576, i1 false)
  %77 = load ptr, ptr %16, align 8, !tbaa !5
  %78 = load ptr, ptr %13, align 8, !tbaa !5
  %79 = load i64, ptr %8, align 8, !tbaa !9
  %80 = load i32, ptr %17, align 4, !tbaa !11
  invoke void @_ZN7meshoptL18rasterizeTrianglesEPNS_14OverdrawBufferEPKfmi(ptr noundef %77, ptr noundef %78, i64 noundef %79, i32 noundef %80)
          to label %81 unwind label %86

81:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !11
  br label %82

82:                                               ; preds = %131, %81
  %83 = load i32, ptr %19, align 4, !tbaa !11
  %84 = icmp slt i32 %83, 256
  br i1 %84, label %90, label %85

85:                                               ; preds = %82
  store i32 5, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %134

86:                                               ; preds = %75
  %87 = landingpad { ptr, i32 }
          cleanup
  %88 = extractvalue { ptr, i32 } %87, 0
  store ptr %88, ptr %14, align 8
  %89 = extractvalue { ptr, i32 } %87, 1
  store i32 %89, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %155

90:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  store i32 0, ptr %20, align 4, !tbaa !11
  br label %91

91:                                               ; preds = %127, %90
  %92 = load i32, ptr %20, align 4, !tbaa !11
  %93 = icmp slt i32 %92, 256
  br i1 %93, label %95, label %94

94:                                               ; preds = %91
  store i32 8, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %130

95:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 0, ptr %21, align 4, !tbaa !11
  br label %96

96:                                               ; preds = %123, %95
  %97 = load i32, ptr %21, align 4, !tbaa !11
  %98 = icmp slt i32 %97, 2
  br i1 %98, label %100, label %99

99:                                               ; preds = %96
  store i32 11, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %126

100:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  %101 = load ptr, ptr %16, align 8, !tbaa !5
  %102 = getelementptr inbounds %"struct.meshopt::OverdrawBuffer", ptr %101, i32 0, i32 1
  %103 = load i32, ptr %19, align 4, !tbaa !11
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [256 x [256 x [2 x i32]]], ptr %102, i64 0, i64 %104
  %106 = load i32, ptr %20, align 4, !tbaa !11
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [256 x [2 x i32]], ptr %105, i64 0, i64 %107
  %109 = load i32, ptr %21, align 4, !tbaa !11
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [2 x i32], ptr %108, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !11
  store i32 %112, ptr %22, align 4, !tbaa !11
  %113 = load i32, ptr %22, align 4, !tbaa !11
  %114 = icmp ugt i32 %113, 0
  %115 = zext i1 %114 to i32
  %116 = getelementptr inbounds %struct.meshopt_OverdrawStatistics, ptr %6, i32 0, i32 0
  %117 = load i32, ptr %116, align 4, !tbaa !13
  %118 = add i32 %117, %115
  store i32 %118, ptr %116, align 4, !tbaa !13
  %119 = load i32, ptr %22, align 4, !tbaa !11
  %120 = getelementptr inbounds %struct.meshopt_OverdrawStatistics, ptr %6, i32 0, i32 1
  %121 = load i32, ptr %120, align 4, !tbaa !16
  %122 = add i32 %121, %119
  store i32 %122, ptr %120, align 4, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %123

123:                                              ; preds = %100
  %124 = load i32, ptr %21, align 4, !tbaa !11
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %21, align 4, !tbaa !11
  br label %96, !llvm.loop !17

126:                                              ; preds = %99
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %20, align 4, !tbaa !11
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %20, align 4, !tbaa !11
  br label %91, !llvm.loop !19

130:                                              ; preds = %94
  br label %131

131:                                              ; preds = %130
  %132 = load i32, ptr %19, align 4, !tbaa !11
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %19, align 4, !tbaa !11
  br label %82, !llvm.loop !20

134:                                              ; preds = %85
  br label %135

135:                                              ; preds = %134
  %136 = load i32, ptr %17, align 4, !tbaa !11
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %17, align 4, !tbaa !11
  br label %63, !llvm.loop !21

138:                                              ; preds = %66
  %139 = getelementptr inbounds %struct.meshopt_OverdrawStatistics, ptr %6, i32 0, i32 0
  %140 = load i32, ptr %139, align 4, !tbaa !13
  %141 = icmp ne i32 %140, 0
  br i1 %141, label %142, label %150

142:                                              ; preds = %138
  %143 = getelementptr inbounds %struct.meshopt_OverdrawStatistics, ptr %6, i32 0, i32 1
  %144 = load i32, ptr %143, align 4, !tbaa !16
  %145 = uitofp i32 %144 to float
  %146 = getelementptr inbounds %struct.meshopt_OverdrawStatistics, ptr %6, i32 0, i32 0
  %147 = load i32, ptr %146, align 4, !tbaa !13
  %148 = uitofp i32 %147 to float
  %149 = fdiv float %145, %148
  br label %151

150:                                              ; preds = %138
  br label %151

151:                                              ; preds = %150, %142
  %152 = phi float [ %149, %142 ], [ 0.000000e+00, %150 ]
  %153 = getelementptr inbounds %struct.meshopt_OverdrawStatistics, ptr %6, i32 0, i32 2
  store float %152, ptr %153, align 4, !tbaa !22
  store i32 1, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @_ZN17meshopt_AllocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(200) %12) #7
  call void @llvm.lifetime.end.p0(i64 200, ptr %12) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %23, ptr align 4 %6, i64 12, i1 false)
  %154 = load { i64, float }, ptr %23, align 8
  ret { i64, float } %154

155:                                              ; preds = %86, %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %156

156:                                              ; preds = %155, %67
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @_ZN17meshopt_AllocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(200) %12) #7
  call void @llvm.lifetime.end.p0(i64 200, ptr %12) #7
  br label %157

157:                                              ; preds = %156
  %158 = load ptr, ptr %14, align 8
  %159 = load i32, ptr %15, align 4
  %160 = insertvalue { ptr, i32 } poison, ptr %158, 0
  %161 = insertvalue { ptr, i32 } %160, i32 %159, 1
  resume { ptr, i32 } %161
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN17meshopt_AllocatorC2Ev(ptr noundef nonnull align 8 dereferenceable(200)) unnamed_addr #3 align 2

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef float @_ZN7meshoptL18transformTrianglesEPfPKjmPKfmm(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, i64 noundef) #3

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN7meshoptL18rasterizeTrianglesEPNS_14OverdrawBufferEPKfmi(ptr noundef, ptr noundef, i64 noundef, i32 noundef) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN17meshopt_AllocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(200)) unnamed_addr #3 align 2

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

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


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

%class.meshopt_Allocator = type { [24 x ptr], i64 }

@.str = external hidden unnamed_addr constant [21 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@__PRETTY_FUNCTION__.meshopt_analyzeOverdraw = external hidden unnamed_addr constant [112 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [45 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local { i64, float } @meshopt_analyzeOverdraw(ptr noundef %0, i64 noundef %1, ptr noundef %2, i64 noundef %3, i64 noundef %4) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %6 = alloca %class.meshopt_Allocator, align 8
  %7 = urem i64 %1, 3
  %8 = icmp eq i64 %7, 0
  br i1 %8, label %10, label %9

9:                                                ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 221, ptr noundef nonnull @__PRETTY_FUNCTION__.meshopt_analyzeOverdraw) #6
  unreachable

10:                                               ; preds = %5
  %11 = add i64 %4, -12
  %12 = icmp ult i64 %11, 245
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 222, ptr noundef nonnull @__PRETTY_FUNCTION__.meshopt_analyzeOverdraw) #6
  unreachable

14:                                               ; preds = %10
  %15 = and i64 %4, 3
  %16 = icmp eq i64 %15, 0
  br i1 %16, label %18, label %17

17:                                               ; preds = %14
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 223, ptr noundef nonnull @__PRETTY_FUNCTION__.meshopt_analyzeOverdraw) #6
  unreachable

18:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %6) #7
  call void @_ZN17meshopt_AllocatorC2Ev(ptr noundef nonnull align 8 dereferenceable(200) %6)
  %19 = mul i64 %1, 3
  %20 = invoke noundef ptr @_ZN17meshopt_Allocator8allocateIfEEPT_m(ptr noundef nonnull align 8 dereferenceable(200) %6, i64 noundef %19)
          to label %21 unwind label %25

21:                                               ; preds = %18
  %22 = call noundef float @_ZN7meshoptL18transformTrianglesEPfPKjmPKfmm(ptr noundef %20, ptr noundef %0, i64 noundef %1, ptr noundef %2, i64 noundef %3, i64 noundef %4)
  %23 = invoke noundef ptr @_ZN17meshopt_Allocator8allocateIN7meshopt14OverdrawBufferEEEPT_m(ptr noundef nonnull align 8 dereferenceable(200) %6, i64 noundef 1)
          to label %.preheader53 unwind label %27

.preheader53:                                     ; preds = %21
  %24 = getelementptr inbounds i8, ptr %23, i64 524288
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1048576) %23, i8 0, i64 1048576, i1 false)
  invoke void @_ZN7meshoptL18rasterizeTrianglesEPNS_14OverdrawBufferEPKfmi(ptr noundef nonnull %23, ptr noundef %20, i64 noundef %1, i32 noundef 0)
          to label %vector.ph unwind label %108

25:                                               ; preds = %18
  %26 = landingpad { ptr, i32 }
          cleanup
  br label %110

27:                                               ; preds = %21
  %28 = landingpad { ptr, i32 }
          cleanup
  br label %110

vector.ph:                                        ; preds = %.preheader53, %middle.block
  %indvars.iv71 = phi i64 [ %indvars.iv.next72, %middle.block ], [ 0, %.preheader53 ]
  %.sroa.031.sroa.0.164 = phi i32 [ %51, %middle.block ], [ 0, %.preheader53 ]
  %.sroa.031.sroa.6.163 = phi i32 [ %52, %middle.block ], [ 0, %.preheader53 ]
  %29 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %.sroa.031.sroa.0.164, i64 0
  %30 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %.sroa.031.sroa.6.163, i64 0
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ %29, %vector.ph ], [ %46, %vector.body ]
  %vec.phi86 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %47, %vector.body ]
  %vec.phi87 = phi <4 x i32> [ %30, %vector.ph ], [ %48, %vector.body ]
  %vec.phi88 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %49, %vector.body ]
  %31 = or disjoint i64 %index, 4
  %32 = getelementptr inbounds [256 x [256 x [2 x i32]]], ptr %24, i64 0, i64 %indvars.iv71, i64 %index, i64 0
  %33 = getelementptr inbounds [256 x [256 x [2 x i32]]], ptr %24, i64 0, i64 %indvars.iv71, i64 %31, i64 0
  %wide.vec = load <8 x i32>, ptr %32, align 4, !tbaa !5
  %wide.vec89 = load <8 x i32>, ptr %33, align 4, !tbaa !5
  %strided.vec = shufflevector <8 x i32> %wide.vec, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
  %strided.vec90 = shufflevector <8 x i32> %wide.vec89, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
  %strided.vec91 = shufflevector <8 x i32> %wide.vec, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %strided.vec92 = shufflevector <8 x i32> %wide.vec89, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %34 = icmp ne <4 x i32> %strided.vec, zeroinitializer
  %35 = icmp ne <4 x i32> %strided.vec90, zeroinitializer
  %36 = zext <4 x i1> %34 to <4 x i32>
  %37 = zext <4 x i1> %35 to <4 x i32>
  %38 = add <4 x i32> %vec.phi, %36
  %39 = add <4 x i32> %vec.phi86, %37
  %40 = add <4 x i32> %strided.vec, %vec.phi87
  %41 = add <4 x i32> %strided.vec90, %vec.phi88
  %42 = icmp ne <4 x i32> %strided.vec91, zeroinitializer
  %43 = icmp ne <4 x i32> %strided.vec92, zeroinitializer
  %44 = zext <4 x i1> %42 to <4 x i32>
  %45 = zext <4 x i1> %43 to <4 x i32>
  %46 = add <4 x i32> %38, %44
  %47 = add <4 x i32> %39, %45
  %48 = add <4 x i32> %strided.vec91, %40
  %49 = add <4 x i32> %strided.vec92, %41
  %index.next = add nuw i64 %index, 8
  %50 = icmp eq i64 %index.next, 256
  br i1 %50, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %47, %46
  %51 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %bin.rdx93 = add <4 x i32> %49, %48
  %52 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx93)
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %exitcond74.not = icmp eq i64 %indvars.iv.next72, 256
  br i1 %exitcond74.not, label %53, label %vector.ph, !llvm.loop !13

53:                                               ; preds = %middle.block
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1048576) %23, i8 0, i64 1048576, i1 false)
  invoke void @_ZN7meshoptL18rasterizeTrianglesEPNS_14OverdrawBufferEPKfmi(ptr noundef nonnull %23, ptr noundef %20, i64 noundef %1, i32 noundef 1)
          to label %vector.ph97 unwind label %108

vector.ph97:                                      ; preds = %53, %middle.block95
  %indvars.iv71.1 = phi i64 [ %indvars.iv.next72.1, %middle.block95 ], [ 0, %53 ]
  %.sroa.031.sroa.0.164.1 = phi i32 [ %76, %middle.block95 ], [ %51, %53 ]
  %.sroa.031.sroa.6.163.1 = phi i32 [ %77, %middle.block95 ], [ %52, %53 ]
  %54 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %.sroa.031.sroa.0.164.1, i64 0
  %55 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %.sroa.031.sroa.6.163.1, i64 0
  br label %vector.body99

vector.body99:                                    ; preds = %vector.body99, %vector.ph97
  %index100 = phi i64 [ 0, %vector.ph97 ], [ %index.next111, %vector.body99 ]
  %vec.phi101 = phi <4 x i32> [ %54, %vector.ph97 ], [ %71, %vector.body99 ]
  %vec.phi102 = phi <4 x i32> [ zeroinitializer, %vector.ph97 ], [ %72, %vector.body99 ]
  %vec.phi103 = phi <4 x i32> [ %55, %vector.ph97 ], [ %73, %vector.body99 ]
  %vec.phi104 = phi <4 x i32> [ zeroinitializer, %vector.ph97 ], [ %74, %vector.body99 ]
  %56 = or disjoint i64 %index100, 4
  %57 = getelementptr inbounds [256 x [256 x [2 x i32]]], ptr %24, i64 0, i64 %indvars.iv71.1, i64 %index100, i64 0
  %58 = getelementptr inbounds [256 x [256 x [2 x i32]]], ptr %24, i64 0, i64 %indvars.iv71.1, i64 %56, i64 0
  %wide.vec105 = load <8 x i32>, ptr %57, align 4, !tbaa !5
  %wide.vec106 = load <8 x i32>, ptr %58, align 4, !tbaa !5
  %strided.vec107 = shufflevector <8 x i32> %wide.vec105, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
  %strided.vec108 = shufflevector <8 x i32> %wide.vec106, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
  %strided.vec109 = shufflevector <8 x i32> %wide.vec105, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %strided.vec110 = shufflevector <8 x i32> %wide.vec106, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %59 = icmp ne <4 x i32> %strided.vec107, zeroinitializer
  %60 = icmp ne <4 x i32> %strided.vec108, zeroinitializer
  %61 = zext <4 x i1> %59 to <4 x i32>
  %62 = zext <4 x i1> %60 to <4 x i32>
  %63 = add <4 x i32> %vec.phi101, %61
  %64 = add <4 x i32> %vec.phi102, %62
  %65 = add <4 x i32> %strided.vec107, %vec.phi103
  %66 = add <4 x i32> %strided.vec108, %vec.phi104
  %67 = icmp ne <4 x i32> %strided.vec109, zeroinitializer
  %68 = icmp ne <4 x i32> %strided.vec110, zeroinitializer
  %69 = zext <4 x i1> %67 to <4 x i32>
  %70 = zext <4 x i1> %68 to <4 x i32>
  %71 = add <4 x i32> %63, %69
  %72 = add <4 x i32> %64, %70
  %73 = add <4 x i32> %strided.vec109, %65
  %74 = add <4 x i32> %strided.vec110, %66
  %index.next111 = add nuw i64 %index100, 8
  %75 = icmp eq i64 %index.next111, 256
  br i1 %75, label %middle.block95, label %vector.body99, !llvm.loop !14

middle.block95:                                   ; preds = %vector.body99
  %bin.rdx112 = add <4 x i32> %72, %71
  %76 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx112)
  %bin.rdx113 = add <4 x i32> %74, %73
  %77 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx113)
  %indvars.iv.next72.1 = add nuw nsw i64 %indvars.iv71.1, 1
  %exitcond74.1.not = icmp eq i64 %indvars.iv.next72.1, 256
  br i1 %exitcond74.1.not, label %78, label %vector.ph97, !llvm.loop !13

78:                                               ; preds = %middle.block95
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1048576) %23, i8 0, i64 1048576, i1 false)
  invoke void @_ZN7meshoptL18rasterizeTrianglesEPNS_14OverdrawBufferEPKfmi(ptr noundef nonnull %23, ptr noundef %20, i64 noundef %1, i32 noundef 2)
          to label %vector.ph118 unwind label %108

vector.ph118:                                     ; preds = %78, %middle.block116
  %indvars.iv71.2 = phi i64 [ %indvars.iv.next72.2, %middle.block116 ], [ 0, %78 ]
  %.sroa.031.sroa.0.164.2 = phi i32 [ %101, %middle.block116 ], [ %76, %78 ]
  %.sroa.031.sroa.6.163.2 = phi i32 [ %102, %middle.block116 ], [ %77, %78 ]
  %79 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %.sroa.031.sroa.0.164.2, i64 0
  %80 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %.sroa.031.sroa.6.163.2, i64 0
  br label %vector.body120

vector.body120:                                   ; preds = %vector.body120, %vector.ph118
  %index121 = phi i64 [ 0, %vector.ph118 ], [ %index.next132, %vector.body120 ]
  %vec.phi122 = phi <4 x i32> [ %79, %vector.ph118 ], [ %96, %vector.body120 ]
  %vec.phi123 = phi <4 x i32> [ zeroinitializer, %vector.ph118 ], [ %97, %vector.body120 ]
  %vec.phi124 = phi <4 x i32> [ %80, %vector.ph118 ], [ %98, %vector.body120 ]
  %vec.phi125 = phi <4 x i32> [ zeroinitializer, %vector.ph118 ], [ %99, %vector.body120 ]
  %81 = or disjoint i64 %index121, 4
  %82 = getelementptr inbounds [256 x [256 x [2 x i32]]], ptr %24, i64 0, i64 %indvars.iv71.2, i64 %index121, i64 0
  %83 = getelementptr inbounds [256 x [256 x [2 x i32]]], ptr %24, i64 0, i64 %indvars.iv71.2, i64 %81, i64 0
  %wide.vec126 = load <8 x i32>, ptr %82, align 4, !tbaa !5
  %wide.vec127 = load <8 x i32>, ptr %83, align 4, !tbaa !5
  %strided.vec128 = shufflevector <8 x i32> %wide.vec126, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
  %strided.vec129 = shufflevector <8 x i32> %wide.vec127, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
  %strided.vec130 = shufflevector <8 x i32> %wide.vec126, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %strided.vec131 = shufflevector <8 x i32> %wide.vec127, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %84 = icmp ne <4 x i32> %strided.vec128, zeroinitializer
  %85 = icmp ne <4 x i32> %strided.vec129, zeroinitializer
  %86 = zext <4 x i1> %84 to <4 x i32>
  %87 = zext <4 x i1> %85 to <4 x i32>
  %88 = add <4 x i32> %vec.phi122, %86
  %89 = add <4 x i32> %vec.phi123, %87
  %90 = add <4 x i32> %strided.vec128, %vec.phi124
  %91 = add <4 x i32> %strided.vec129, %vec.phi125
  %92 = icmp ne <4 x i32> %strided.vec130, zeroinitializer
  %93 = icmp ne <4 x i32> %strided.vec131, zeroinitializer
  %94 = zext <4 x i1> %92 to <4 x i32>
  %95 = zext <4 x i1> %93 to <4 x i32>
  %96 = add <4 x i32> %88, %94
  %97 = add <4 x i32> %89, %95
  %98 = add <4 x i32> %strided.vec130, %90
  %99 = add <4 x i32> %strided.vec131, %91
  %index.next132 = add nuw i64 %index121, 8
  %100 = icmp eq i64 %index.next132, 256
  br i1 %100, label %middle.block116, label %vector.body120, !llvm.loop !15

middle.block116:                                  ; preds = %vector.body120
  %bin.rdx133 = add <4 x i32> %97, %96
  %101 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx133)
  %bin.rdx134 = add <4 x i32> %99, %98
  %102 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx134)
  %indvars.iv.next72.2 = add nuw nsw i64 %indvars.iv71.2, 1
  %exitcond74.2.not = icmp eq i64 %indvars.iv.next72.2, 256
  br i1 %exitcond74.2.not, label %103, label %vector.ph118, !llvm.loop !13

103:                                              ; preds = %middle.block116
  %.not = icmp eq i32 %101, 0
  %104 = uitofp i32 %102 to float
  %105 = uitofp i32 %101 to float
  %106 = fdiv float %104, %105
  %107 = select i1 %.not, float 0.000000e+00, float %106
  call void @_ZN17meshopt_AllocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(200) %6) #7
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %6) #7
  %.sroa.031.sroa.6.0.insert.ext = zext i32 %102 to i64
  %.sroa.031.sroa.6.0.insert.shift = shl nuw i64 %.sroa.031.sroa.6.0.insert.ext, 32
  %.sroa.031.sroa.0.0.insert.ext = zext i32 %101 to i64
  %.sroa.031.sroa.0.0.insert.insert = or disjoint i64 %.sroa.031.sroa.6.0.insert.shift, %.sroa.031.sroa.0.0.insert.ext
  %.fca.0.insert = insertvalue { i64, float } poison, i64 %.sroa.031.sroa.0.0.insert.insert, 0
  %.fca.1.insert = insertvalue { i64, float } %.fca.0.insert, float %107, 1
  ret { i64, float } %.fca.1.insert

108:                                              ; preds = %78, %53, %.preheader53
  %109 = landingpad { ptr, i32 }
          cleanup
  br label %110

110:                                              ; preds = %27, %108, %25
  %.pn.pn = phi { ptr, i32 } [ %26, %25 ], [ %109, %108 ], [ %28, %27 ]
  call void @_ZN17meshopt_AllocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(200) %6) #7
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %6) #7
  resume { ptr, i32 } %.pn.pn
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN17meshopt_AllocatorC2Ev(ptr noundef nonnull align 8 dereferenceable(200)) unnamed_addr #3 align 2

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef float @_ZN7meshoptL18transformTrianglesEPfPKjmPKfmm(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN7meshoptL18rasterizeTrianglesEPNS_14OverdrawBufferEPKfmi(ptr noundef, ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN17meshopt_AllocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(200)) unnamed_addr #3 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { noreturn nounwind }
attributes #7 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !11, !12}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass