; LLVM IR from facebookresearch/habitat-sim :: src/deps/basis-universal/encoder/basisu_resampler.ll (ZN6basisu9Resampler10resample_yEPf)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.basisu::Resampler" = type <{ i32, i32, i32, i32, i32, i32, i32, [4 x i8], ptr, ptr, ptr, ptr, i8, i8, i8, [5 x i8], ptr, ptr, ptr, i32, i32, i32, float, float, [4 x i8] }>
%"struct.basisu::Resampler::Contrib_List" = type { i16, ptr }
%"struct.basisu::Resampler::Scan_Buf" = type { [16384 x i32], [16384 x ptr] }
%"struct.basisu::Resampler::Contrib" = type { float, i16 }

@.str.1 = external hidden unnamed_addr constant [116 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@__PRETTY_FUNCTION__._ZN6basisu9Resampler10resample_yEPf = external hidden unnamed_addr constant [45 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [13 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 nounwind uwtable
declare dso_local void @_ZN6basisu9Resampler10resample_xEPfPKf(ptr noundef nonnull align 8 dereferenceable(116), ptr noundef, ptr noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6basisu9Resampler11scale_y_movEPfPKffi(ptr noundef nonnull align 8 dereferenceable(116), ptr noundef, ptr noundef, float noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6basisu9Resampler11scale_y_addEPfPKffi(ptr noundef nonnull align 8 dereferenceable(116), ptr noundef, ptr noundef, float noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu9Resampler5clampEPfi(ptr noundef nonnull align 8 dereferenceable(116), ptr noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6basisu9Resampler10resample_yEPf(ptr noundef nonnull align 8 dereferenceable(116) %0, ptr noundef %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %10 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %11 = getelementptr inbounds %"class.basisu::Resampler", ptr %10, i32 0, i32 11
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = getelementptr inbounds %"class.basisu::Resampler", ptr %10, i32 0, i32 20
  %14 = load i32, ptr %13, align 4, !tbaa !16
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds %"struct.basisu::Resampler::Contrib_List", ptr %12, i64 %15
  store ptr %16, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %17 = getelementptr inbounds %"class.basisu::Resampler", ptr %10, i32 0, i32 14
  %18 = load i8, ptr %17, align 2, !tbaa !17, !range !18, !noundef !19
  %19 = trunc i8 %18 to i1
  br i1 %19, label %20, label %23

20:                                               ; preds = %2
  %21 = getelementptr inbounds %"class.basisu::Resampler", ptr %10, i32 0, i32 9
  %22 = load ptr, ptr %21, align 8, !tbaa !20
  br label %25

23:                                               ; preds = %2
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %23, %20
  %26 = phi ptr [ %22, %20 ], [ %24, %23 ]
  store ptr %26, ptr %9, align 8, !tbaa !5
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %30

29:                                               ; preds = %25
  br label %32

30:                                               ; preds = %25
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 413, ptr noundef @__PRETTY_FUNCTION__._ZN6basisu9Resampler10resample_yEPf) #6
  unreachable

31:                                               ; No predecessors!
  br label %32

32:                                               ; preds = %31, %29
  store i32 0, ptr %5, align 4, !tbaa !21
  br label %33

33:                                               ; preds = %153, %32
  %34 = load i32, ptr %5, align 4, !tbaa !21
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.basisu::Resampler::Contrib_List", ptr %35, i32 0, i32 0
  %37 = load i16, ptr %36, align 8, !tbaa !22
  %38 = zext i16 %37 to i32
  %39 = icmp slt i32 %34, %38
  br i1 %39, label %40, label %156

40:                                               ; preds = %33
  store i32 0, ptr %6, align 4, !tbaa !21
  br label %41

41:                                               ; preds = %64, %40
  %42 = load i32, ptr %6, align 4, !tbaa !21
  %43 = icmp slt i32 %42, 16384
  br i1 %43, label %44, label %67

44:                                               ; preds = %41
  %45 = getelementptr inbounds %"class.basisu::Resampler", ptr %10, i32 0, i32 18
  %46 = load ptr, ptr %45, align 8, !tbaa !25
  %47 = getelementptr inbounds %"struct.basisu::Resampler::Scan_Buf", ptr %46, i32 0, i32 0
  %48 = load i32, ptr %6, align 4, !tbaa !21
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [16384 x i32], ptr %47, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !21
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.basisu::Resampler::Contrib_List", ptr %52, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !26
  %55 = load i32, ptr %5, align 4, !tbaa !21
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds %"struct.basisu::Resampler::Contrib", ptr %54, i64 %56
  %58 = getelementptr inbounds %"struct.basisu::Resampler::Contrib", ptr %57, i32 0, i32 1
  %59 = load i16, ptr %58, align 4, !tbaa !27
  %60 = zext i16 %59 to i32
  %61 = icmp eq i32 %51, %60
  br i1 %61, label %62, label %63

62:                                               ; preds = %44
  br label %67

63:                                               ; preds = %44
  br label %64

64:                                               ; preds = %63
  %65 = load i32, ptr %6, align 4, !tbaa !21
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %6, align 4, !tbaa !21
  br label %41, !llvm.loop !29

67:                                               ; preds = %62, %41
  %68 = load i32, ptr %6, align 4, !tbaa !21
  %69 = icmp slt i32 %68, 16384
  br i1 %69, label %70, label %71

70:                                               ; preds = %67
  br label %73

71:                                               ; preds = %67
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 424, ptr noundef @__PRETTY_FUNCTION__._ZN6basisu9Resampler10resample_yEPf) #6
  unreachable

72:                                               ; No predecessors!
  br label %73

73:                                               ; preds = %72, %70
  %74 = getelementptr inbounds %"class.basisu::Resampler", ptr %10, i32 0, i32 18
  %75 = load ptr, ptr %74, align 8, !tbaa !25
  %76 = getelementptr inbounds %"struct.basisu::Resampler::Scan_Buf", ptr %75, i32 0, i32 1
  %77 = load i32, ptr %6, align 4, !tbaa !21
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [16384 x ptr], ptr %76, i64 0, i64 %78
  %80 = load ptr, ptr %79, align 8, !tbaa !5
  store ptr %80, ptr %7, align 8, !tbaa !5
  %81 = load i32, ptr %5, align 4, !tbaa !21
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %96, label %83

83:                                               ; preds = %73
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = load ptr, ptr %7, align 8, !tbaa !5
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = getelementptr inbounds %"struct.basisu::Resampler::Contrib_List", ptr %86, i32 0, i32 1
  %88 = load ptr, ptr %87, align 8, !tbaa !26
  %89 = load i32, ptr %5, align 4, !tbaa !21
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds %"struct.basisu::Resampler::Contrib", ptr %88, i64 %90
  %92 = getelementptr inbounds %"struct.basisu::Resampler::Contrib", ptr %91, i32 0, i32 0
  %93 = load float, ptr %92, align 4, !tbaa !31
  %94 = getelementptr inbounds %"class.basisu::Resampler", ptr %10, i32 0, i32 1
  %95 = load i32, ptr %94, align 4, !tbaa !32
  call void @_ZN6basisu9Resampler11scale_y_movEPfPKffi(ptr noundef nonnull align 8 dereferenceable(116) %10, ptr noundef %84, ptr noundef %85, float noundef %93, i32 noundef %95)
  br label %109

96:                                               ; preds = %73
  %97 = load ptr, ptr %9, align 8, !tbaa !5
  %98 = load ptr, ptr %7, align 8, !tbaa !5
  %99 = load ptr, ptr %8, align 8, !tbaa !5
  %100 = getelementptr inbounds %"struct.basisu::Resampler::Contrib_List", ptr %99, i32 0, i32 1
  %101 = load ptr, ptr %100, align 8, !tbaa !26
  %102 = load i32, ptr %5, align 4, !tbaa !21
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds %"struct.basisu::Resampler::Contrib", ptr %101, i64 %103
  %105 = getelementptr inbounds %"struct.basisu::Resampler::Contrib", ptr %104, i32 0, i32 0
  %106 = load float, ptr %105, align 4, !tbaa !31
  %107 = getelementptr inbounds %"class.basisu::Resampler", ptr %10, i32 0, i32 1
  %108 = load i32, ptr %107, align 4, !tbaa !32
  call void @_ZN6basisu9Resampler11scale_y_addEPfPKffi(ptr noundef nonnull align 8 dereferenceable(116) %10, ptr noundef %97, ptr noundef %98, float noundef %106, i32 noundef %108)
  br label %109

109:                                              ; preds = %96, %83
  %110 = getelementptr inbounds %"class.basisu::Resampler", ptr %10, i32 0, i32 16
  %111 = load ptr, ptr %110, align 8, !tbaa !33
  %112 = load ptr, ptr %8, align 8, !tbaa !5
  %113 = getelementptr inbounds %"struct.basisu::Resampler::Contrib_List", ptr %112, i32 0, i32 1
  %114 = load ptr, ptr %113, align 8, !tbaa !26
  %115 = load i32, ptr %5, align 4, !tbaa !21
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds %"struct.basisu::Resampler::Contrib", ptr %114, i64 %116
  %118 = getelementptr inbounds %"struct.basisu::Resampler::Contrib", ptr %117, i32 0, i32 1
  %119 = load i16, ptr %118, align 4, !tbaa !27
  %120 = zext i16 %119 to i32
  %121 = getelementptr inbounds %"class.basisu::Resampler", ptr %10, i32 0, i32 3
  %122 = load i32, ptr %121, align 4, !tbaa !34
  %123 = call noundef i32 @_ZN6basisuL21resampler_range_checkEii(i32 noundef %120, i32 noundef %122)
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds i32, ptr %111, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !21
  %127 = add nsw i32 %126, -1
  store i32 %127, ptr %125, align 4, !tbaa !21
  %128 = icmp eq i32 %127, 0
  br i1 %128, label %129, label %152

129:                                              ; preds = %109
  %130 = getelementptr inbounds %"class.basisu::Resampler", ptr %10, i32 0, i32 17
  %131 = load ptr, ptr %130, align 8, !tbaa !35
  %132 = load ptr, ptr %8, align 8, !tbaa !5
  %133 = getelementptr inbounds %"struct.basisu::Resampler::Contrib_List", ptr %132, i32 0, i32 1
  %134 = load ptr, ptr %133, align 8, !tbaa !26
  %135 = load i32, ptr %5, align 4, !tbaa !21
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds %"struct.basisu::Resampler::Contrib", ptr %134, i64 %136
  %138 = getelementptr inbounds %"struct.basisu::Resampler::Contrib", ptr %137, i32 0, i32 1
  %139 = load i16, ptr %138, align 4, !tbaa !27
  %140 = zext i16 %139 to i32
  %141 = getelementptr inbounds %"class.basisu::Resampler", ptr %10, i32 0, i32 3
  %142 = load i32, ptr %141, align 4, !tbaa !34
  %143 = call noundef i32 @_ZN6basisuL21resampler_range_checkEii(i32 noundef %140, i32 noundef %142)
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds i8, ptr %131, i64 %144
  store i8 0, ptr %145, align 1, !tbaa !36
  %146 = getelementptr inbounds %"class.basisu::Resampler", ptr %10, i32 0, i32 18
  %147 = load ptr, ptr %146, align 8, !tbaa !25
  %148 = getelementptr inbounds %"struct.basisu::Resampler::Scan_Buf", ptr %147, i32 0, i32 0
  %149 = load i32, ptr %6, align 4, !tbaa !21
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [16384 x i32], ptr %148, i64 0, i64 %150
  store i32 -1, ptr %151, align 4, !tbaa !21
  br label %152

152:                                              ; preds = %129, %109
  br label %153

153:                                              ; preds = %152
  %154 = load i32, ptr %5, align 4, !tbaa !21
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %5, align 4, !tbaa !21
  br label %33, !llvm.loop !37

156:                                              ; preds = %33
  %157 = getelementptr inbounds %"class.basisu::Resampler", ptr %10, i32 0, i32 14
  %158 = load i8, ptr %157, align 2, !tbaa !17, !range !18, !noundef !19
  %159 = trunc i8 %158 to i1
  br i1 %159, label %160, label %170

160:                                              ; preds = %156
  %161 = load ptr, ptr %4, align 8, !tbaa !5
  %162 = load ptr, ptr %9, align 8, !tbaa !5
  %163 = icmp ne ptr %161, %162
  br i1 %163, label %164, label %165

164:                                              ; preds = %160
  br label %167

165:                                              ; preds = %160
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 451, ptr noundef @__PRETTY_FUNCTION__._ZN6basisu9Resampler10resample_yEPf) #6
  unreachable

166:                                              ; No predecessors!
  br label %167

167:                                              ; preds = %166, %164
  %168 = load ptr, ptr %4, align 8, !tbaa !5
  %169 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN6basisu9Resampler10resample_xEPfPKf(ptr noundef nonnull align 8 dereferenceable(116) %10, ptr noundef %168, ptr noundef %169)
  br label %178

170:                                              ; preds = %156
  %171 = load ptr, ptr %4, align 8, !tbaa !5
  %172 = load ptr, ptr %9, align 8, !tbaa !5
  %173 = icmp eq ptr %171, %172
  br i1 %173, label %174, label %175

174:                                              ; preds = %170
  br label %177

175:                                              ; preds = %170
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 456, ptr noundef @__PRETTY_FUNCTION__._ZN6basisu9Resampler10resample_yEPf) #6
  unreachable

176:                                              ; No predecessors!
  br label %177

177:                                              ; preds = %176, %174
  br label %178

178:                                              ; preds = %177, %167
  %179 = getelementptr inbounds %"class.basisu::Resampler", ptr %10, i32 0, i32 22
  %180 = load float, ptr %179, align 4, !tbaa !38
  %181 = getelementptr inbounds %"class.basisu::Resampler", ptr %10, i32 0, i32 23
  %182 = load float, ptr %181, align 8, !tbaa !39
  %183 = fcmp olt float %180, %182
  br i1 %183, label %184, label %188

184:                                              ; preds = %178
  %185 = load ptr, ptr %4, align 8, !tbaa !5
  %186 = getelementptr inbounds %"class.basisu::Resampler", ptr %10, i32 0, i32 4
  %187 = load i32, ptr %186, align 8, !tbaa !40
  call void @_ZN6basisu9Resampler5clampEPfi(ptr noundef nonnull align 8 dereferenceable(116) %10, ptr noundef %185, i32 noundef %187)
  br label %188

188:                                              ; preds = %184, %178
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZN6basisuL21resampler_range_checkEii(i32 noundef, i32 noundef) #4

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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { 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, !6, i64 56}
!10 = !{!"_ZTSN6basisu9ResamplerE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !12, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !13, i64 64, !13, i64 65, !13, i64 66, !6, i64 72, !6, i64 80, !6, i64 88, !11, i64 96, !11, i64 100, !14, i64 104, !15, i64 108, !15, i64 112}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSN6basisu9Resampler11Boundary_OpE", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSN6basisu9Resampler6StatusE", !7, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{!10, !11, i64 100}
!17 = !{!10, !13, i64 66}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!10, !6, i64 40}
!21 = !{!11, !11, i64 0}
!22 = !{!23, !24, i64 0}
!23 = !{!"_ZTSN6basisu9Resampler12Contrib_ListE", !24, i64 0, !6, i64 8}
!24 = !{!"short", !7, i64 0}
!25 = !{!10, !6, i64 88}
!26 = !{!23, !6, i64 8}
!27 = !{!28, !24, i64 4}
!28 = !{!"_ZTSN6basisu9Resampler7ContribE", !15, i64 0, !24, i64 4}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!28, !15, i64 0}
!32 = !{!10, !11, i64 4}
!33 = !{!10, !6, i64 72}
!34 = !{!10, !11, i64 12}
!35 = !{!10, !6, i64 80}
!36 = !{!7, !7, i64 0}
!37 = distinct !{!37, !30}
!38 = !{!10, !15, i64 108}
!39 = !{!10, !15, i64 112}
!40 = !{!10, !11, i64 16}


; 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.basisu::Resampler::Contrib_List" = type { i16, ptr }
%"struct.basisu::Resampler::Contrib" = type { float, i16 }

@.str.1 = external hidden unnamed_addr constant [116 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@__PRETTY_FUNCTION__._ZN6basisu9Resampler10resample_yEPf = external hidden unnamed_addr constant [45 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [13 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 nounwind uwtable
declare dso_local void @_ZN6basisu9Resampler10resample_xEPfPKf(ptr noundef nonnull align 8 dereferenceable(116), ptr noundef, ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6basisu9Resampler11scale_y_movEPfPKffi(ptr noundef nonnull align 8 dereferenceable(116), ptr noundef, ptr noundef, float noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6basisu9Resampler11scale_y_addEPfPKffi(ptr noundef nonnull align 8 dereferenceable(116), ptr noundef, ptr noundef, float noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu9Resampler5clampEPfi(ptr noundef nonnull align 8 dereferenceable(116), ptr noundef, i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6basisu9Resampler10resample_yEPf(ptr noundef nonnull align 8 dereferenceable(116) %0, ptr noundef %1) local_unnamed_addr #2 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 56
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 100
  %6 = load i32, ptr %5, align 4, !tbaa !15
  %7 = sext i32 %6 to i64
  %8 = getelementptr inbounds %"struct.basisu::Resampler::Contrib_List", ptr %4, i64 %7
  %9 = getelementptr inbounds i8, ptr %0, i64 66
  %10 = load i8, ptr %9, align 2, !tbaa !16, !range !17, !noundef !18
  %11 = trunc nuw i8 %10 to i1
  %12 = getelementptr inbounds i8, ptr %0, i64 40
  %13 = load ptr, ptr %12, align 8
  %14 = select i1 %11, ptr %13, ptr %1
  %.not = icmp eq ptr %14, null
  br i1 %.not, label %22, label %.preheader38

.preheader38:                                     ; preds = %2
  %15 = load i16, ptr %8, align 8, !tbaa !19
  %.not46 = icmp eq i16 %15, 0
  br i1 %.not46, label %._crit_edge, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %.preheader38
  %16 = getelementptr inbounds i8, ptr %0, i64 88
  %17 = getelementptr inbounds i8, ptr %8, i64 8
  %18 = getelementptr inbounds i8, ptr %0, i64 4
  %19 = getelementptr inbounds i8, ptr %0, i64 72
  %20 = getelementptr inbounds i8, ptr %0, i64 12
  %21 = getelementptr inbounds i8, ptr %0, i64 80
  br label %.preheader

22:                                               ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 413, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6basisu9Resampler10resample_yEPf) #4
  unreachable

.preheader:                                       ; preds = %.preheader.lr.ph, %81
  %indvars.iv49 = phi i64 [ 0, %.preheader.lr.ph ], [ %indvars.iv.next50, %81 ]
  %23 = load ptr, ptr %16, align 8, !tbaa !22
  %24 = load ptr, ptr %17, align 8, !tbaa !23
  %25 = getelementptr inbounds %"struct.basisu::Resampler::Contrib", ptr %24, i64 %indvars.iv49, i32 1
  %26 = load i16, ptr %25, align 4, !tbaa !24
  %27 = zext i16 %26 to i32
  br label %41

28:                                               ; preds = %41
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %29 = getelementptr inbounds [16384 x i32], ptr %23, i64 0, i64 %indvars.iv.next
  %30 = load i32, ptr %29, align 4, !tbaa !26
  %31 = icmp eq i32 %30, %27
  br i1 %31, label %45, label %32

32:                                               ; preds = %28
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %33 = getelementptr inbounds [16384 x i32], ptr %23, i64 0, i64 %indvars.iv.next.1
  %34 = load i32, ptr %33, align 4, !tbaa !26
  %35 = icmp eq i32 %34, %27
  br i1 %35, label %45, label %36

36:                                               ; preds = %32
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %37 = getelementptr inbounds [16384 x i32], ptr %23, i64 0, i64 %indvars.iv.next.2
  %38 = load i32, ptr %37, align 4, !tbaa !26
  %39 = icmp eq i32 %38, %27
  br i1 %39, label %45, label %40

40:                                               ; preds = %36
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, 16384
  br i1 %exitcond.not.3, label %.critedge, label %41, !llvm.loop !27

41:                                               ; preds = %40, %.preheader
  %indvars.iv = phi i64 [ 0, %.preheader ], [ %indvars.iv.next.3, %40 ]
  %42 = getelementptr inbounds [16384 x i32], ptr %23, i64 0, i64 %indvars.iv
  %43 = load i32, ptr %42, align 4, !tbaa !26
  %44 = icmp eq i32 %43, %27
  br i1 %44, label %45, label %28

.critedge:                                        ; preds = %40
  tail call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 424, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6basisu9Resampler10resample_yEPf) #4
  unreachable

45:                                               ; preds = %36, %32, %28, %41
  %indvars.iv.lcssa = phi i64 [ %indvars.iv, %41 ], [ %indvars.iv.next, %28 ], [ %indvars.iv.next.1, %32 ], [ %indvars.iv.next.2, %36 ]
  %46 = getelementptr inbounds i8, ptr %23, i64 65536
  %47 = getelementptr inbounds [16384 x ptr], ptr %46, i64 0, i64 %indvars.iv.lcssa
  %48 = load ptr, ptr %47, align 8, !tbaa !29
  %.not37 = icmp eq i64 %indvars.iv49, 0
  br i1 %.not37, label %49, label %52

49:                                               ; preds = %45
  %50 = load float, ptr %24, align 4, !tbaa !30
  %51 = load i32, ptr %18, align 4, !tbaa !31
  tail call void @_ZN6basisu9Resampler11scale_y_movEPfPKffi(ptr noundef nonnull align 8 dereferenceable(116) %0, ptr noundef nonnull %14, ptr noundef %48, float noundef %50, i32 noundef %51)
  br label %56

52:                                               ; preds = %45
  %53 = getelementptr inbounds %"struct.basisu::Resampler::Contrib", ptr %24, i64 %indvars.iv49
  %54 = load float, ptr %53, align 4, !tbaa !30
  %55 = load i32, ptr %18, align 4, !tbaa !31
  tail call void @_ZN6basisu9Resampler11scale_y_addEPfPKffi(ptr noundef nonnull align 8 dereferenceable(116) %0, ptr noundef nonnull %14, ptr noundef %48, float noundef %54, i32 noundef %55)
  br label %56

56:                                               ; preds = %52, %49
  %57 = load ptr, ptr %19, align 8, !tbaa !32
  %58 = load ptr, ptr %17, align 8, !tbaa !23
  %59 = getelementptr inbounds %"struct.basisu::Resampler::Contrib", ptr %58, i64 %indvars.iv49, i32 1
  %60 = load i16, ptr %59, align 4, !tbaa !24
  %61 = zext i16 %60 to i32
  %62 = load i32, ptr %20, align 4, !tbaa !33
  %63 = tail call noundef i32 @_ZN6basisuL21resampler_range_checkEii(i32 noundef %61, i32 noundef %62)
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds i32, ptr %57, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !26
  %67 = add nsw i32 %66, -1
  store i32 %67, ptr %65, align 4, !tbaa !26
  %68 = icmp eq i32 %67, 0
  br i1 %68, label %69, label %81

69:                                               ; preds = %56
  %70 = load ptr, ptr %21, align 8, !tbaa !34
  %71 = load ptr, ptr %17, align 8, !tbaa !23
  %72 = getelementptr inbounds %"struct.basisu::Resampler::Contrib", ptr %71, i64 %indvars.iv49, i32 1
  %73 = load i16, ptr %72, align 4, !tbaa !24
  %74 = zext i16 %73 to i32
  %75 = load i32, ptr %20, align 4, !tbaa !33
  %76 = tail call noundef i32 @_ZN6basisuL21resampler_range_checkEii(i32 noundef %74, i32 noundef %75)
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds i8, ptr %70, i64 %77
  store i8 0, ptr %78, align 1, !tbaa !35
  %79 = load ptr, ptr %16, align 8, !tbaa !22
  %80 = getelementptr inbounds [16384 x i32], ptr %79, i64 0, i64 %indvars.iv.lcssa
  store i32 -1, ptr %80, align 4, !tbaa !26
  br label %81

81:                                               ; preds = %56, %69
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %82 = load i16, ptr %8, align 8, !tbaa !19
  %83 = zext i16 %82 to i64
  %84 = icmp ult i64 %indvars.iv.next50, %83
  br i1 %84, label %.preheader, label %._crit_edge.loopexit, !llvm.loop !36

._crit_edge.loopexit:                             ; preds = %81
  %.pre = load i8, ptr %9, align 2, !tbaa !16, !range !17
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader38
  %85 = phi i8 [ %.pre, %._crit_edge.loopexit ], [ %10, %.preheader38 ]
  %86 = trunc nuw i8 %85 to i1
  %.not36 = icmp eq ptr %14, %1
  br i1 %86, label %87, label %90

87:                                               ; preds = %._crit_edge
  br i1 %.not36, label %88, label %89

88:                                               ; preds = %87
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 451, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6basisu9Resampler10resample_yEPf) #4
  unreachable

89:                                               ; preds = %87
  tail call void @_ZN6basisu9Resampler10resample_xEPfPKf(ptr noundef nonnull align 8 dereferenceable(116) %0, ptr noundef %1, ptr noundef nonnull %14)
  br label %92

90:                                               ; preds = %._crit_edge
  br i1 %.not36, label %92, label %91

91:                                               ; preds = %90
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 456, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6basisu9Resampler10resample_yEPf) #4
  unreachable

92:                                               ; preds = %90, %89
  %93 = getelementptr inbounds i8, ptr %0, i64 108
  %94 = load float, ptr %93, align 4, !tbaa !37
  %95 = getelementptr inbounds i8, ptr %0, i64 112
  %96 = load float, ptr %95, align 8, !tbaa !38
  %97 = fcmp olt float %94, %96
  br i1 %97, label %98, label %101

98:                                               ; preds = %92
  %99 = getelementptr inbounds i8, ptr %0, i64 16
  %100 = load i32, ptr %99, align 8, !tbaa !39
  tail call void @_ZN6basisu9Resampler5clampEPfi(ptr noundef nonnull align 8 dereferenceable(116) %0, ptr noundef %1, i32 noundef %100)
  br label %101

101:                                              ; preds = %98, %92
  ret void
}

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

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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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, !11, i64 56}
!6 = !{!"_ZTSN6basisu9ResamplerE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !10, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !12, i64 64, !12, i64 65, !12, i64 66, !11, i64 72, !11, i64 80, !11, i64 88, !7, i64 96, !7, i64 100, !13, i64 104, !14, i64 108, !14, i64 112}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN6basisu9Resampler11Boundary_OpE", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"bool", !8, i64 0}
!13 = !{!"_ZTSN6basisu9Resampler6StatusE", !8, i64 0}
!14 = !{!"float", !8, i64 0}
!15 = !{!6, !7, i64 100}
!16 = !{!6, !12, i64 66}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!20, !21, i64 0}
!20 = !{!"_ZTSN6basisu9Resampler12Contrib_ListE", !21, i64 0, !11, i64 8}
!21 = !{!"short", !8, i64 0}
!22 = !{!6, !11, i64 88}
!23 = !{!20, !11, i64 8}
!24 = !{!25, !21, i64 4}
!25 = !{!"_ZTSN6basisu9Resampler7ContribE", !14, i64 0, !21, i64 4}
!26 = !{!7, !7, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!11, !11, i64 0}
!30 = !{!25, !14, i64 0}
!31 = !{!6, !7, i64 4}
!32 = !{!6, !11, i64 72}
!33 = !{!6, !7, i64 12}
!34 = !{!6, !11, i64 80}
!35 = !{!8, !8, i64 0}
!36 = distinct !{!36, !28}
!37 = !{!6, !14, i64 108}
!38 = !{!6, !14, i64 112}
!39 = !{!6, !7, i64 16}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass