; LLVM IR from floppyhammer/scanline-algorithm-demo :: src/simple_math.ll (Z21compute_intersectionsPKfS0_S0_Pf)

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

@__const._Z21compute_intersectionsPKfS0_S0_Pf.r = external hidden unnamed_addr constant [3 x float], align 4

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11cubic_rootsPKfPf(ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z13bezier_coeffsffffPf(float noundef, float noundef, float noundef, float noundef, ptr noundef) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z21compute_intersectionsPKfS0_S0_Pf(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca [4 x float], align 16
  %13 = alloca [4 x float], align 16
  %14 = alloca [4 x float], align 16
  %15 = alloca [3 x float], align 4
  %16 = alloca i32, align 4
  %17 = alloca float, align 4
  %18 = alloca [2 x float], align 4
  %19 = alloca float, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = getelementptr inbounds float, ptr %20, i64 1
  %22 = load float, ptr %21, align 4, !tbaa !9
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds float, ptr %23, i64 0
  %25 = load float, ptr %24, align 4, !tbaa !9
  %26 = fsub float %22, %25
  store float %26, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds float, ptr %27, i64 0
  %29 = load float, ptr %28, align 4, !tbaa !9
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = getelementptr inbounds float, ptr %30, i64 1
  %32 = load float, ptr %31, align 4, !tbaa !9
  %33 = fsub float %29, %32
  store float %33, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds float, ptr %34, i64 0
  %36 = load float, ptr %35, align 4, !tbaa !9
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = getelementptr inbounds float, ptr %37, i64 0
  %39 = load float, ptr %38, align 4, !tbaa !9
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = getelementptr inbounds float, ptr %40, i64 1
  %42 = load float, ptr %41, align 4, !tbaa !9
  %43 = fsub float %39, %42
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = getelementptr inbounds float, ptr %44, i64 0
  %46 = load float, ptr %45, align 4, !tbaa !9
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds float, ptr %47, i64 1
  %49 = load float, ptr %48, align 4, !tbaa !9
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds float, ptr %50, i64 0
  %52 = load float, ptr %51, align 4, !tbaa !9
  %53 = fsub float %49, %52
  %54 = fmul float %46, %53
  %55 = call float @llvm.fmuladd.f32(float %36, float %43, float %54)
  store float %55, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #7
  call void @llvm.memset.p0.i64(ptr align 16 %12, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #7
  call void @llvm.memset.p0.i64(ptr align 16 %13, i8 0, i64 16, i1 false)
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds float, ptr %56, i64 0
  %58 = load float, ptr %57, align 4, !tbaa !9
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds float, ptr %59, i64 2
  %61 = load float, ptr %60, align 4, !tbaa !9
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds float, ptr %62, i64 4
  %64 = load float, ptr %63, align 4, !tbaa !9
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds float, ptr %65, i64 6
  %67 = load float, ptr %66, align 4, !tbaa !9
  %68 = getelementptr inbounds [4 x float], ptr %12, i64 0, i64 0
  call void @_Z13bezier_coeffsffffPf(float noundef %58, float noundef %61, float noundef %64, float noundef %67, ptr noundef %68)
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds float, ptr %69, i64 1
  %71 = load float, ptr %70, align 4, !tbaa !9
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = getelementptr inbounds float, ptr %72, i64 3
  %74 = load float, ptr %73, align 4, !tbaa !9
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds float, ptr %75, i64 5
  %77 = load float, ptr %76, align 4, !tbaa !9
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = getelementptr inbounds float, ptr %78, i64 7
  %80 = load float, ptr %79, align 4, !tbaa !9
  %81 = getelementptr inbounds [4 x float], ptr %13, i64 0, i64 0
  call void @_Z13bezier_coeffsffffPf(float noundef %71, float noundef %74, float noundef %77, float noundef %80, ptr noundef %81)
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #7
  call void @llvm.memset.p0.i64(ptr align 16 %14, i8 0, i64 16, i1 false)
  %82 = load float, ptr %9, align 4, !tbaa !9
  %83 = getelementptr inbounds [4 x float], ptr %12, i64 0, i64 0
  %84 = load float, ptr %83, align 16, !tbaa !9
  %85 = load float, ptr %10, align 4, !tbaa !9
  %86 = getelementptr inbounds [4 x float], ptr %13, i64 0, i64 0
  %87 = load float, ptr %86, align 16, !tbaa !9
  %88 = fmul float %85, %87
  %89 = call float @llvm.fmuladd.f32(float %82, float %84, float %88)
  %90 = getelementptr inbounds [4 x float], ptr %14, i64 0, i64 0
  store float %89, ptr %90, align 16, !tbaa !9
  %91 = load float, ptr %9, align 4, !tbaa !9
  %92 = getelementptr inbounds [4 x float], ptr %12, i64 0, i64 1
  %93 = load float, ptr %92, align 4, !tbaa !9
  %94 = load float, ptr %10, align 4, !tbaa !9
  %95 = getelementptr inbounds [4 x float], ptr %13, i64 0, i64 1
  %96 = load float, ptr %95, align 4, !tbaa !9
  %97 = fmul float %94, %96
  %98 = call float @llvm.fmuladd.f32(float %91, float %93, float %97)
  %99 = getelementptr inbounds [4 x float], ptr %14, i64 0, i64 1
  store float %98, ptr %99, align 4, !tbaa !9
  %100 = load float, ptr %9, align 4, !tbaa !9
  %101 = getelementptr inbounds [4 x float], ptr %12, i64 0, i64 2
  %102 = load float, ptr %101, align 8, !tbaa !9
  %103 = load float, ptr %10, align 4, !tbaa !9
  %104 = getelementptr inbounds [4 x float], ptr %13, i64 0, i64 2
  %105 = load float, ptr %104, align 8, !tbaa !9
  %106 = fmul float %103, %105
  %107 = call float @llvm.fmuladd.f32(float %100, float %102, float %106)
  %108 = getelementptr inbounds [4 x float], ptr %14, i64 0, i64 2
  store float %107, ptr %108, align 8, !tbaa !9
  %109 = load float, ptr %9, align 4, !tbaa !9
  %110 = getelementptr inbounds [4 x float], ptr %12, i64 0, i64 3
  %111 = load float, ptr %110, align 4, !tbaa !9
  %112 = load float, ptr %10, align 4, !tbaa !9
  %113 = getelementptr inbounds [4 x float], ptr %13, i64 0, i64 3
  %114 = load float, ptr %113, align 4, !tbaa !9
  %115 = fmul float %112, %114
  %116 = call float @llvm.fmuladd.f32(float %109, float %111, float %115)
  %117 = load float, ptr %11, align 4, !tbaa !9
  %118 = fadd float %116, %117
  %119 = getelementptr inbounds [4 x float], ptr %14, i64 0, i64 3
  store float %118, ptr %119, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %15) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 @__const._Z21compute_intersectionsPKfS0_S0_Pf.r, i64 12, i1 false)
  %120 = getelementptr inbounds [4 x float], ptr %14, i64 0, i64 0
  %121 = getelementptr inbounds [3 x float], ptr %15, i64 0, i64 0
  call void @_Z11cubic_rootsPKfPf(ptr noundef %120, ptr noundef %121)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !11
  br label %122

122:                                              ; preds = %252, %4
  %123 = load i32, ptr %16, align 4, !tbaa !11
  %124 = icmp slt i32 %123, 3
  br i1 %124, label %126, label %125

125:                                              ; preds = %122
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %255

126:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %127 = load i32, ptr %16, align 4, !tbaa !11
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [3 x float], ptr %15, i64 0, i64 %128
  %130 = load float, ptr %129, align 4, !tbaa !9
  store float %130, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %131 = getelementptr inbounds [4 x float], ptr %12, i64 0, i64 0
  %132 = load float, ptr %131, align 16, !tbaa !9
  %133 = fpext float %132 to double
  %134 = load float, ptr %17, align 4, !tbaa !9
  %135 = fpext float %134 to double
  %136 = call double @pow(double noundef %135, double noundef 3.000000e+00) #7
  %137 = getelementptr inbounds [4 x float], ptr %12, i64 0, i64 1
  %138 = load float, ptr %137, align 4, !tbaa !9
  %139 = fpext float %138 to double
  %140 = load float, ptr %17, align 4, !tbaa !9
  %141 = fpext float %140 to double
  %142 = call double @pow(double noundef %141, double noundef 2.000000e+00) #7
  %143 = fmul double %139, %142
  %144 = call double @llvm.fmuladd.f64(double %133, double %136, double %143)
  %145 = getelementptr inbounds [4 x float], ptr %12, i64 0, i64 2
  %146 = load float, ptr %145, align 8, !tbaa !9
  %147 = load float, ptr %17, align 4, !tbaa !9
  %148 = fmul float %146, %147
  %149 = fpext float %148 to double
  %150 = fadd double %144, %149
  %151 = getelementptr inbounds [4 x float], ptr %12, i64 0, i64 3
  %152 = load float, ptr %151, align 4, !tbaa !9
  %153 = fpext float %152 to double
  %154 = fadd double %150, %153
  %155 = fptrunc double %154 to float
  %156 = getelementptr inbounds [2 x float], ptr %18, i64 0, i64 0
  store float %155, ptr %156, align 4, !tbaa !9
  %157 = getelementptr inbounds [4 x float], ptr %13, i64 0, i64 0
  %158 = load float, ptr %157, align 16, !tbaa !9
  %159 = fpext float %158 to double
  %160 = load float, ptr %17, align 4, !tbaa !9
  %161 = fpext float %160 to double
  %162 = call double @pow(double noundef %161, double noundef 3.000000e+00) #7
  %163 = getelementptr inbounds [4 x float], ptr %13, i64 0, i64 1
  %164 = load float, ptr %163, align 4, !tbaa !9
  %165 = fpext float %164 to double
  %166 = load float, ptr %17, align 4, !tbaa !9
  %167 = fpext float %166 to double
  %168 = call double @pow(double noundef %167, double noundef 2.000000e+00) #7
  %169 = fmul double %165, %168
  %170 = call double @llvm.fmuladd.f64(double %159, double %162, double %169)
  %171 = getelementptr inbounds [4 x float], ptr %13, i64 0, i64 2
  %172 = load float, ptr %171, align 8, !tbaa !9
  %173 = load float, ptr %17, align 4, !tbaa !9
  %174 = fmul float %172, %173
  %175 = fpext float %174 to double
  %176 = fadd double %170, %175
  %177 = getelementptr inbounds [4 x float], ptr %13, i64 0, i64 3
  %178 = load float, ptr %177, align 4, !tbaa !9
  %179 = fpext float %178 to double
  %180 = fadd double %176, %179
  %181 = fptrunc double %180 to float
  %182 = getelementptr inbounds [2 x float], ptr %18, i64 0, i64 1
  store float %181, ptr %182, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  %183 = load ptr, ptr %6, align 8, !tbaa !5
  %184 = getelementptr inbounds float, ptr %183, i64 1
  %185 = load float, ptr %184, align 4, !tbaa !9
  %186 = load ptr, ptr %6, align 8, !tbaa !5
  %187 = getelementptr inbounds float, ptr %186, i64 0
  %188 = load float, ptr %187, align 4, !tbaa !9
  %189 = fsub float %185, %188
  %190 = fcmp une float %189, 0.000000e+00
  br i1 %190, label %191, label %206

191:                                              ; preds = %126
  %192 = getelementptr inbounds [2 x float], ptr %18, i64 0, i64 0
  %193 = load float, ptr %192, align 4, !tbaa !9
  %194 = load ptr, ptr %6, align 8, !tbaa !5
  %195 = getelementptr inbounds float, ptr %194, i64 0
  %196 = load float, ptr %195, align 4, !tbaa !9
  %197 = fsub float %193, %196
  %198 = load ptr, ptr %6, align 8, !tbaa !5
  %199 = getelementptr inbounds float, ptr %198, i64 1
  %200 = load float, ptr %199, align 4, !tbaa !9
  %201 = load ptr, ptr %6, align 8, !tbaa !5
  %202 = getelementptr inbounds float, ptr %201, i64 0
  %203 = load float, ptr %202, align 4, !tbaa !9
  %204 = fsub float %200, %203
  %205 = fdiv float %197, %204
  store float %205, ptr %19, align 4, !tbaa !9
  br label %221

206:                                              ; preds = %126
  %207 = getelementptr inbounds [2 x float], ptr %18, i64 0, i64 1
  %208 = load float, ptr %207, align 4, !tbaa !9
  %209 = load ptr, ptr %7, align 8, !tbaa !5
  %210 = getelementptr inbounds float, ptr %209, i64 0
  %211 = load float, ptr %210, align 4, !tbaa !9
  %212 = fsub float %208, %211
  %213 = load ptr, ptr %7, align 8, !tbaa !5
  %214 = getelementptr inbounds float, ptr %213, i64 1
  %215 = load float, ptr %214, align 4, !tbaa !9
  %216 = load ptr, ptr %7, align 8, !tbaa !5
  %217 = getelementptr inbounds float, ptr %216, i64 0
  %218 = load float, ptr %217, align 4, !tbaa !9
  %219 = fsub float %215, %218
  %220 = fdiv float %212, %219
  store float %220, ptr %19, align 4, !tbaa !9
  br label %221

221:                                              ; preds = %206, %191
  %222 = load float, ptr %17, align 4, !tbaa !9
  %223 = fcmp olt float %222, 0.000000e+00
  br i1 %223, label %233, label %224

224:                                              ; preds = %221
  %225 = load float, ptr %17, align 4, !tbaa !9
  %226 = fcmp ogt float %225, 1.000000e+00
  br i1 %226, label %233, label %227

227:                                              ; preds = %224
  %228 = load float, ptr %19, align 4, !tbaa !9
  %229 = fcmp olt float %228, 0.000000e+00
  br i1 %229, label %233, label %230

230:                                              ; preds = %227
  %231 = load float, ptr %19, align 4, !tbaa !9
  %232 = fcmp ogt float %231, 1.000000e+00
  br i1 %232, label %233, label %236

233:                                              ; preds = %230, %227, %224, %221
  %234 = getelementptr inbounds [2 x float], ptr %18, i64 0, i64 0
  store float -1.000000e+04, ptr %234, align 4, !tbaa !9
  %235 = getelementptr inbounds [2 x float], ptr %18, i64 0, i64 1
  store float -1.000000e+04, ptr %235, align 4, !tbaa !9
  br label %236

236:                                              ; preds = %233, %230
  %237 = getelementptr inbounds [2 x float], ptr %18, i64 0, i64 0
  %238 = load float, ptr %237, align 4, !tbaa !9
  %239 = load ptr, ptr %8, align 8, !tbaa !5
  %240 = load i32, ptr %16, align 4, !tbaa !11
  %241 = mul nsw i32 %240, 2
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds float, ptr %239, i64 %242
  store float %238, ptr %243, align 4, !tbaa !9
  %244 = getelementptr inbounds [2 x float], ptr %18, i64 0, i64 1
  %245 = load float, ptr %244, align 4, !tbaa !9
  %246 = load ptr, ptr %8, align 8, !tbaa !5
  %247 = load i32, ptr %16, align 4, !tbaa !11
  %248 = mul nsw i32 %247, 2
  %249 = add nsw i32 %248, 1
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds float, ptr %246, i64 %250
  store float %245, ptr %251, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %252

252:                                              ; preds = %236
  %253 = load i32, ptr %16, align 4, !tbaa !11
  %254 = add nsw i32 %253, 1
  store i32 %254, ptr %16, align 4, !tbaa !11
  br label %122, !llvm.loop !13

255:                                              ; preds = %125
  call void @llvm.lifetime.end.p0(i64 12, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  ret void
}

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

; 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) #6

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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

@__const._Z21compute_intersectionsPKfS0_S0_Pf.r = external hidden unnamed_addr constant [3 x float], align 4

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11cubic_rootsPKfPf(ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z13bezier_coeffsffffPf(float noundef, float noundef, float noundef, float noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z21compute_intersectionsPKfS0_S0_Pf(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #0 {
  %5 = alloca [4 x float], align 16
  %6 = alloca [4 x float], align 16
  %7 = alloca [4 x float], align 16
  %8 = alloca [3 x float], align 4
  %9 = getelementptr inbounds i8, ptr %2, i64 4
  %10 = load float, ptr %9, align 4, !tbaa !5
  %11 = load float, ptr %2, align 4, !tbaa !5
  %12 = fsub float %10, %11
  %13 = load float, ptr %1, align 4, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %1, i64 4
  %15 = load float, ptr %14, align 4, !tbaa !5
  %16 = fsub float %13, %15
  %17 = fsub float %11, %10
  %18 = fsub float %15, %13
  %19 = fmul float %11, %18
  %20 = tail call float @llvm.fmuladd.f32(float %13, float %17, float %19)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %5, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %6, i8 0, i64 16, i1 false)
  %21 = load float, ptr %0, align 4, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  %23 = load float, ptr %22, align 4, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %0, i64 16
  %25 = load float, ptr %24, align 4, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %0, i64 24
  %27 = load float, ptr %26, align 4, !tbaa !5
  call void @_Z13bezier_coeffsffffPf(float noundef %21, float noundef %23, float noundef %25, float noundef %27, ptr noundef nonnull %5)
  %28 = getelementptr inbounds i8, ptr %0, i64 4
  %29 = load float, ptr %28, align 4, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %0, i64 12
  %31 = load float, ptr %30, align 4, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %0, i64 20
  %33 = load float, ptr %32, align 4, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %0, i64 28
  %35 = load float, ptr %34, align 4, !tbaa !5
  call void @_Z13bezier_coeffsffffPf(float noundef %29, float noundef %31, float noundef %33, float noundef %35, ptr noundef nonnull %6)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #8
  %36 = getelementptr inbounds i8, ptr %6, i64 4
  %37 = load <2 x float>, ptr %5, align 16, !tbaa !5
  %38 = load <2 x float>, ptr %6, align 16, !tbaa !5
  %39 = insertelement <2 x float> poison, float %16, i64 0
  %40 = shufflevector <2 x float> %39, <2 x float> poison, <2 x i32> zeroinitializer
  %41 = fmul <2 x float> %40, %38
  %42 = insertelement <2 x float> poison, float %12, i64 0
  %43 = shufflevector <2 x float> %42, <2 x float> poison, <2 x i32> zeroinitializer
  %44 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %43, <2 x float> %37, <2 x float> %41)
  store <2 x float> %44, ptr %7, align 16, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %5, i64 8
  %46 = load float, ptr %45, align 8, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %6, i64 8
  %48 = load float, ptr %47, align 8, !tbaa !5
  %49 = fmul float %16, %48
  %50 = call float @llvm.fmuladd.f32(float %12, float %46, float %49)
  %51 = getelementptr inbounds i8, ptr %7, i64 8
  store float %50, ptr %51, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %5, i64 12
  %53 = load float, ptr %52, align 4, !tbaa !5
  %54 = getelementptr inbounds i8, ptr %6, i64 12
  %55 = load float, ptr %54, align 4, !tbaa !5
  %56 = fmul float %16, %55
  %57 = call float @llvm.fmuladd.f32(float %12, float %53, float %56)
  %58 = fadd float %20, %57
  %59 = getelementptr inbounds i8, ptr %7, i64 12
  store float %58, ptr %59, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %8) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %8, ptr noundef nonnull align 4 dereferenceable(12) @__const._Z21compute_intersectionsPKfS0_S0_Pf.r, i64 12, i1 false)
  call void @_Z11cubic_rootsPKfPf(ptr noundef nonnull %7, ptr noundef nonnull %8)
  %60 = load float, ptr %8, align 4, !tbaa !5
  %61 = load <4 x float>, ptr %5, align 16
  %62 = shufflevector <4 x float> %61, <4 x float> poison, <2 x i32> <i32 0, i32 poison>
  %63 = fpext float %60 to double
  %64 = call double @pow(double noundef %63, double noundef 3.000000e+00) #8
  %65 = load <4 x float>, ptr %5, align 16
  %66 = shufflevector <4 x float> %65, <4 x float> poison, <2 x i32> <i32 1, i32 poison>
  %square = fmul double %63, %63
  %67 = shufflevector <4 x float> %65, <4 x float> poison, <2 x i32> <i32 2, i32 poison>
  %68 = shufflevector <4 x float> %65, <4 x float> poison, <2 x i32> <i32 3, i32 poison>
  %69 = load float, ptr %6, align 16, !tbaa !5
  %70 = call double @pow(double noundef %63, double noundef 3.000000e+00) #8
  %71 = load float, ptr %36, align 4, !tbaa !5
  %72 = load float, ptr %47, align 8, !tbaa !5
  %73 = load float, ptr %54, align 4, !tbaa !5
  %74 = insertelement <2 x float> %62, float %69, i64 1
  %75 = fpext <2 x float> %74 to <2 x double>
  %76 = insertelement <2 x float> %66, float %71, i64 1
  %77 = fpext <2 x float> %76 to <2 x double>
  %78 = insertelement <2 x double> poison, double %square, i64 0
  %79 = shufflevector <2 x double> %78, <2 x double> poison, <2 x i32> zeroinitializer
  %80 = fmul <2 x double> %79, %77
  %81 = insertelement <2 x double> poison, double %64, i64 0
  %82 = insertelement <2 x double> %81, double %70, i64 1
  %83 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %75, <2 x double> %82, <2 x double> %80)
  %84 = insertelement <2 x float> poison, float %60, i64 0
  %85 = shufflevector <2 x float> %84, <2 x float> poison, <2 x i32> zeroinitializer
  %86 = insertelement <2 x float> %67, float %72, i64 1
  %87 = fmul <2 x float> %85, %86
  %88 = fpext <2 x float> %87 to <2 x double>
  %89 = fadd <2 x double> %83, %88
  %90 = insertelement <2 x float> %68, float %73, i64 1
  %91 = fpext <2 x float> %90 to <2 x double>
  %92 = fadd <2 x double> %89, %91
  %93 = fptrunc <2 x double> %92 to <2 x float>
  %94 = load float, ptr %14, align 4, !tbaa !5
  %95 = load float, ptr %1, align 4, !tbaa !5
  %96 = fsub float %94, %95
  %97 = fcmp une float %96, 0.000000e+00
  br i1 %97, label %98, label %102

98:                                               ; preds = %4
  %99 = extractelement <2 x float> %93, i64 0
  %100 = fsub float %99, %95
  %101 = fdiv float %100, %96
  br label %109

102:                                              ; preds = %4
  %103 = load float, ptr %2, align 4, !tbaa !5
  %104 = extractelement <2 x float> %93, i64 1
  %105 = fsub float %104, %103
  %106 = load float, ptr %9, align 4, !tbaa !5
  %107 = fsub float %106, %103
  %108 = fdiv float %105, %107
  br label %109

109:                                              ; preds = %102, %98
  %.0 = phi float [ %101, %98 ], [ %108, %102 ]
  %110 = fcmp olt float %60, 0.000000e+00
  %111 = fcmp ogt float %60, 1.000000e+00
  %or.cond = or i1 %110, %111
  %112 = fcmp olt float %.0, 0.000000e+00
  %113 = fcmp ogt float %.0, 1.000000e+00
  %114 = or i1 %112, %113
  %or.cond5 = select i1 %or.cond, i1 true, i1 %114
  %115 = insertelement <2 x i1> poison, i1 %or.cond5, i64 0
  %116 = shufflevector <2 x i1> %115, <2 x i1> poison, <2 x i32> zeroinitializer
  %117 = select <2 x i1> %116, <2 x float> <float -1.000000e+04, float -1.000000e+04>, <2 x float> %93
  store <2 x float> %117, ptr %3, align 4, !tbaa !5
  %118 = getelementptr inbounds i8, ptr %8, i64 4
  %119 = load float, ptr %118, align 4, !tbaa !5
  %120 = load <4 x float>, ptr %5, align 16
  %121 = shufflevector <4 x float> %120, <4 x float> poison, <2 x i32> <i32 0, i32 poison>
  %122 = fpext float %119 to double
  %123 = call double @pow(double noundef %122, double noundef 3.000000e+00) #8
  %124 = load <4 x float>, ptr %5, align 16
  %125 = shufflevector <4 x float> %124, <4 x float> poison, <2 x i32> <i32 1, i32 poison>
  %square.1 = fmul double %122, %122
  %126 = shufflevector <4 x float> %124, <4 x float> poison, <2 x i32> <i32 2, i32 poison>
  %127 = shufflevector <4 x float> %124, <4 x float> poison, <2 x i32> <i32 3, i32 poison>
  %128 = load float, ptr %6, align 16, !tbaa !5
  %129 = call double @pow(double noundef %122, double noundef 3.000000e+00) #8
  %130 = load float, ptr %36, align 4, !tbaa !5
  %131 = load float, ptr %47, align 8, !tbaa !5
  %132 = load float, ptr %54, align 4, !tbaa !5
  %133 = insertelement <2 x float> %121, float %128, i64 1
  %134 = fpext <2 x float> %133 to <2 x double>
  %135 = insertelement <2 x float> %125, float %130, i64 1
  %136 = fpext <2 x float> %135 to <2 x double>
  %137 = insertelement <2 x double> poison, double %square.1, i64 0
  %138 = shufflevector <2 x double> %137, <2 x double> poison, <2 x i32> zeroinitializer
  %139 = fmul <2 x double> %138, %136
  %140 = insertelement <2 x double> poison, double %123, i64 0
  %141 = insertelement <2 x double> %140, double %129, i64 1
  %142 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %134, <2 x double> %141, <2 x double> %139)
  %143 = insertelement <2 x float> poison, float %119, i64 0
  %144 = shufflevector <2 x float> %143, <2 x float> poison, <2 x i32> zeroinitializer
  %145 = insertelement <2 x float> %126, float %131, i64 1
  %146 = fmul <2 x float> %144, %145
  %147 = fpext <2 x float> %146 to <2 x double>
  %148 = fadd <2 x double> %142, %147
  %149 = insertelement <2 x float> %127, float %132, i64 1
  %150 = fpext <2 x float> %149 to <2 x double>
  %151 = fadd <2 x double> %148, %150
  %152 = fptrunc <2 x double> %151 to <2 x float>
  %153 = load float, ptr %14, align 4, !tbaa !5
  %154 = load float, ptr %1, align 4, !tbaa !5
  %155 = fsub float %153, %154
  %156 = fcmp une float %155, 0.000000e+00
  br i1 %156, label %164, label %157

157:                                              ; preds = %109
  %158 = load float, ptr %2, align 4, !tbaa !5
  %159 = extractelement <2 x float> %152, i64 1
  %160 = fsub float %159, %158
  %161 = load float, ptr %9, align 4, !tbaa !5
  %162 = fsub float %161, %158
  %163 = fdiv float %160, %162
  br label %168

164:                                              ; preds = %109
  %165 = extractelement <2 x float> %152, i64 0
  %166 = fsub float %165, %154
  %167 = fdiv float %166, %155
  br label %168

168:                                              ; preds = %164, %157
  %.0.1 = phi float [ %167, %164 ], [ %163, %157 ]
  %169 = fcmp olt float %119, 0.000000e+00
  %170 = fcmp ogt float %119, 1.000000e+00
  %or.cond.1 = or i1 %169, %170
  %171 = fcmp olt float %.0.1, 0.000000e+00
  %172 = fcmp ogt float %.0.1, 1.000000e+00
  %173 = or i1 %171, %172
  %or.cond5.1 = select i1 %or.cond.1, i1 true, i1 %173
  %174 = getelementptr inbounds i8, ptr %3, i64 8
  %175 = insertelement <2 x i1> poison, i1 %or.cond5.1, i64 0
  %176 = shufflevector <2 x i1> %175, <2 x i1> poison, <2 x i32> zeroinitializer
  %177 = select <2 x i1> %176, <2 x float> <float -1.000000e+04, float -1.000000e+04>, <2 x float> %152
  store <2 x float> %177, ptr %174, align 4, !tbaa !5
  %178 = getelementptr inbounds i8, ptr %8, i64 8
  %179 = load float, ptr %178, align 4, !tbaa !5
  %180 = load <4 x float>, ptr %5, align 16
  %181 = shufflevector <4 x float> %180, <4 x float> poison, <2 x i32> <i32 0, i32 poison>
  %182 = fpext float %179 to double
  %183 = call double @pow(double noundef %182, double noundef 3.000000e+00) #8
  %184 = load <4 x float>, ptr %5, align 16
  %185 = shufflevector <4 x float> %184, <4 x float> poison, <2 x i32> <i32 1, i32 poison>
  %square.2 = fmul double %182, %182
  %186 = shufflevector <4 x float> %184, <4 x float> poison, <2 x i32> <i32 2, i32 poison>
  %187 = shufflevector <4 x float> %184, <4 x float> poison, <2 x i32> <i32 3, i32 poison>
  %188 = load float, ptr %6, align 16, !tbaa !5
  %189 = call double @pow(double noundef %182, double noundef 3.000000e+00) #8
  %190 = load float, ptr %36, align 4, !tbaa !5
  %191 = load float, ptr %47, align 8, !tbaa !5
  %192 = load float, ptr %54, align 4, !tbaa !5
  %193 = insertelement <2 x float> %181, float %188, i64 1
  %194 = fpext <2 x float> %193 to <2 x double>
  %195 = insertelement <2 x float> %185, float %190, i64 1
  %196 = fpext <2 x float> %195 to <2 x double>
  %197 = insertelement <2 x double> poison, double %square.2, i64 0
  %198 = shufflevector <2 x double> %197, <2 x double> poison, <2 x i32> zeroinitializer
  %199 = fmul <2 x double> %198, %196
  %200 = insertelement <2 x double> poison, double %183, i64 0
  %201 = insertelement <2 x double> %200, double %189, i64 1
  %202 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %194, <2 x double> %201, <2 x double> %199)
  %203 = insertelement <2 x float> poison, float %179, i64 0
  %204 = shufflevector <2 x float> %203, <2 x float> poison, <2 x i32> zeroinitializer
  %205 = insertelement <2 x float> %186, float %191, i64 1
  %206 = fmul <2 x float> %204, %205
  %207 = fpext <2 x float> %206 to <2 x double>
  %208 = fadd <2 x double> %202, %207
  %209 = insertelement <2 x float> %187, float %192, i64 1
  %210 = fpext <2 x float> %209 to <2 x double>
  %211 = fadd <2 x double> %208, %210
  %212 = fptrunc <2 x double> %211 to <2 x float>
  %213 = load float, ptr %14, align 4, !tbaa !5
  %214 = load float, ptr %1, align 4, !tbaa !5
  %215 = fsub float %213, %214
  %216 = fcmp une float %215, 0.000000e+00
  br i1 %216, label %224, label %217

217:                                              ; preds = %168
  %218 = load float, ptr %2, align 4, !tbaa !5
  %219 = extractelement <2 x float> %212, i64 1
  %220 = fsub float %219, %218
  %221 = load float, ptr %9, align 4, !tbaa !5
  %222 = fsub float %221, %218
  %223 = fdiv float %220, %222
  br label %228

224:                                              ; preds = %168
  %225 = extractelement <2 x float> %212, i64 0
  %226 = fsub float %225, %214
  %227 = fdiv float %226, %215
  br label %228

228:                                              ; preds = %224, %217
  %.0.2 = phi float [ %227, %224 ], [ %223, %217 ]
  %229 = fcmp olt float %179, 0.000000e+00
  %230 = fcmp ogt float %179, 1.000000e+00
  %or.cond.2 = or i1 %229, %230
  %231 = fcmp olt float %.0.2, 0.000000e+00
  %232 = fcmp ogt float %.0.2, 1.000000e+00
  %233 = or i1 %231, %232
  %or.cond5.2 = select i1 %or.cond.2, i1 true, i1 %233
  %234 = getelementptr inbounds i8, ptr %3, i64 16
  %235 = insertelement <2 x i1> poison, i1 %or.cond5.2, i64 0
  %236 = shufflevector <2 x i1> %235, <2 x i1> poison, <2 x i32> zeroinitializer
  %237 = select <2 x i1> %236, <2 x float> <float -1.000000e+04, float -1.000000e+04>, <2 x float> %212
  store <2 x float> %237, ptr %234, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #8
  ret void
}

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

; Function Attrs: mustprogress 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) #6

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #7

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x float> @llvm.fmuladd.v2f32(<2 x float>, <2 x float>, <2 x float>) #7

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


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass