; LLVM IR from godofecht/GANN-Object-Avoidance :: Box2D/Testbed/Framework/RenderGL3.ll (Z11sRenderLineffffffj)

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

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11sRenderLineffffffj(float noundef %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, i32 noundef %6) #2 {
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca i32, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = alloca [8 x float], align 16
  store float %0, ptr %8, align 4, !tbaa !5
  store float %1, ptr %9, align 4, !tbaa !5
  store float %2, ptr %10, align 4, !tbaa !5
  store float %3, ptr %11, align 4, !tbaa !5
  store float %4, ptr %12, align 4, !tbaa !5
  store float %5, ptr %13, align 4, !tbaa !5
  store i32 %6, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %21 = load float, ptr %10, align 4, !tbaa !5
  %22 = load float, ptr %8, align 4, !tbaa !5
  %23 = fsub float %21, %22
  store float %23, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %24 = load float, ptr %11, align 4, !tbaa !5
  %25 = load float, ptr %9, align 4, !tbaa !5
  %26 = fsub float %24, %25
  store float %26, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %27 = load float, ptr %15, align 4, !tbaa !5
  %28 = load float, ptr %15, align 4, !tbaa !5
  %29 = load float, ptr %16, align 4, !tbaa !5
  %30 = load float, ptr %16, align 4, !tbaa !5
  %31 = fmul float %29, %30
  %32 = call float @llvm.fmuladd.f32(float %27, float %28, float %31)
  %33 = call float @sqrtf(float noundef %32) #4
  store float %33, ptr %17, align 4, !tbaa !5
  %34 = load float, ptr %17, align 4, !tbaa !5
  %35 = fcmp ogt float %34, 0x3F1A36E2E0000000
  br i1 %35, label %36, label %45

36:                                               ; preds = %7
  %37 = load float, ptr %17, align 4, !tbaa !5
  %38 = fdiv float 1.000000e+00, %37
  store float %38, ptr %17, align 4, !tbaa !5
  %39 = load float, ptr %17, align 4, !tbaa !5
  %40 = load float, ptr %15, align 4, !tbaa !5
  %41 = fmul float %40, %39
  store float %41, ptr %15, align 4, !tbaa !5
  %42 = load float, ptr %17, align 4, !tbaa !5
  %43 = load float, ptr %16, align 4, !tbaa !5
  %44 = fmul float %43, %42
  store float %44, ptr %16, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %36, %7
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %46 = load float, ptr %16, align 4, !tbaa !5
  store float %46, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %47 = load float, ptr %15, align 4, !tbaa !5
  %48 = fneg float %47
  store float %48, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %20) #4
  %49 = load float, ptr %13, align 4, !tbaa !5
  %50 = load float, ptr %12, align 4, !tbaa !5
  %51 = fsub float %50, %49
  store float %51, ptr %12, align 4, !tbaa !5
  %52 = load float, ptr %12, align 4, !tbaa !5
  %53 = fmul float %52, 5.000000e-01
  store float %53, ptr %12, align 4, !tbaa !5
  %54 = load float, ptr %12, align 4, !tbaa !5
  %55 = fcmp olt float %54, 0x3F847AE140000000
  br i1 %55, label %56, label %57

56:                                               ; preds = %45
  store float 0x3F847AE140000000, ptr %12, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %56, %45
  %58 = load float, ptr %12, align 4, !tbaa !5
  %59 = load float, ptr %15, align 4, !tbaa !5
  %60 = fmul float %59, %58
  store float %60, ptr %15, align 4, !tbaa !5
  %61 = load float, ptr %12, align 4, !tbaa !5
  %62 = load float, ptr %16, align 4, !tbaa !5
  %63 = fmul float %62, %61
  store float %63, ptr %16, align 4, !tbaa !5
  %64 = load float, ptr %12, align 4, !tbaa !5
  %65 = load float, ptr %18, align 4, !tbaa !5
  %66 = fmul float %65, %64
  store float %66, ptr %18, align 4, !tbaa !5
  %67 = load float, ptr %12, align 4, !tbaa !5
  %68 = load float, ptr %19, align 4, !tbaa !5
  %69 = fmul float %68, %67
  store float %69, ptr %19, align 4, !tbaa !5
  %70 = load float, ptr %8, align 4, !tbaa !5
  %71 = load float, ptr %15, align 4, !tbaa !5
  %72 = fsub float %70, %71
  %73 = load float, ptr %18, align 4, !tbaa !5
  %74 = fsub float %72, %73
  %75 = getelementptr inbounds [8 x float], ptr %20, i64 0, i64 0
  store float %74, ptr %75, align 16, !tbaa !5
  %76 = load float, ptr %9, align 4, !tbaa !5
  %77 = load float, ptr %16, align 4, !tbaa !5
  %78 = fsub float %76, %77
  %79 = load float, ptr %19, align 4, !tbaa !5
  %80 = fsub float %78, %79
  %81 = getelementptr inbounds [8 x float], ptr %20, i64 0, i64 1
  store float %80, ptr %81, align 4, !tbaa !5
  %82 = load float, ptr %8, align 4, !tbaa !5
  %83 = load float, ptr %15, align 4, !tbaa !5
  %84 = fsub float %82, %83
  %85 = load float, ptr %18, align 4, !tbaa !5
  %86 = fadd float %84, %85
  %87 = getelementptr inbounds [8 x float], ptr %20, i64 0, i64 2
  store float %86, ptr %87, align 8, !tbaa !5
  %88 = load float, ptr %9, align 4, !tbaa !5
  %89 = load float, ptr %16, align 4, !tbaa !5
  %90 = fsub float %88, %89
  %91 = load float, ptr %19, align 4, !tbaa !5
  %92 = fadd float %90, %91
  %93 = getelementptr inbounds [8 x float], ptr %20, i64 0, i64 3
  store float %92, ptr %93, align 4, !tbaa !5
  %94 = load float, ptr %10, align 4, !tbaa !5
  %95 = load float, ptr %15, align 4, !tbaa !5
  %96 = fadd float %94, %95
  %97 = load float, ptr %18, align 4, !tbaa !5
  %98 = fadd float %96, %97
  %99 = getelementptr inbounds [8 x float], ptr %20, i64 0, i64 4
  store float %98, ptr %99, align 16, !tbaa !5
  %100 = load float, ptr %11, align 4, !tbaa !5
  %101 = load float, ptr %16, align 4, !tbaa !5
  %102 = fadd float %100, %101
  %103 = load float, ptr %19, align 4, !tbaa !5
  %104 = fadd float %102, %103
  %105 = getelementptr inbounds [8 x float], ptr %20, i64 0, i64 5
  store float %104, ptr %105, align 4, !tbaa !5
  %106 = load float, ptr %10, align 4, !tbaa !5
  %107 = load float, ptr %15, align 4, !tbaa !5
  %108 = fadd float %106, %107
  %109 = load float, ptr %18, align 4, !tbaa !5
  %110 = fsub float %108, %109
  %111 = getelementptr inbounds [8 x float], ptr %20, i64 0, i64 6
  store float %110, ptr %111, align 8, !tbaa !5
  %112 = load float, ptr %11, align 4, !tbaa !5
  %113 = load float, ptr %16, align 4, !tbaa !5
  %114 = fadd float %112, %113
  %115 = load float, ptr %19, align 4, !tbaa !5
  %116 = fsub float %114, %115
  %117 = getelementptr inbounds [8 x float], ptr %20, i64 0, i64 7
  store float %116, ptr %117, align 4, !tbaa !5
  %118 = getelementptr inbounds [8 x float], ptr %20, i64 0, i64 0
  %119 = load float, ptr %13, align 4, !tbaa !5
  %120 = load i32, ptr %14, align 4, !tbaa !9
  call void @_ZL12sDrawPolygonPKfjfj(ptr noundef %118, i32 noundef 4, float noundef %119, i32 noundef %120)
  call void @llvm.lifetime.end.p0(i64 32, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  ret void
}

; Function Attrs: nounwind
declare float @sqrtf(float noundef) #3

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL12sDrawPolygonPKfjfj(ptr noundef, i32 noundef, float noundef, i32 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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 #4 = { 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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11sRenderLineffffffj(float noundef %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, i32 noundef %6) local_unnamed_addr #2 {
  %8 = alloca [8 x float], align 16
  %9 = fsub float %2, %0
  %10 = fsub float %3, %1
  %11 = fmul float %10, %10
  %12 = tail call float @llvm.fmuladd.f32(float %9, float %9, float %11)
  %sqrt = tail call float @llvm.sqrt.f32(float %12)
  %13 = fcmp ogt float %sqrt, 0x3F1A36E2E0000000
  %14 = fdiv float 1.000000e+00, %sqrt
  %15 = fmul float %9, %14
  %16 = fmul float %10, %14
  %.053 = select i1 %13, float %15, float %9
  %.0 = select i1 %13, float %16, float %10
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #4
  %17 = fsub float %4, %5
  %18 = fmul float %17, 5.000000e-01
  %19 = fcmp olt float %18, 0x3F847AE140000000
  %.054 = select i1 %19, float 0x3F847AE140000000, float %18
  %20 = fneg float %.053
  %21 = fmul float %.054, %.053
  %22 = getelementptr inbounds i8, ptr %8, i64 16
  %23 = insertelement <2 x float> poison, float %.054, i64 0
  %24 = shufflevector <2 x float> %23, <2 x float> poison, <2 x i32> zeroinitializer
  %25 = insertelement <2 x float> poison, float %.0, i64 0
  %26 = insertelement <2 x float> %25, float %20, i64 1
  %27 = fmul <2 x float> %24, %26
  %28 = extractelement <2 x float> %27, i64 0
  %29 = insertelement <2 x float> poison, float %0, i64 0
  %30 = insertelement <2 x float> %29, float %1, i64 1
  %31 = shufflevector <2 x float> %27, <2 x float> poison, <2 x i32> <i32 poison, i32 0>
  %32 = insertelement <2 x float> %31, float %21, i64 0
  %33 = fsub <2 x float> %30, %32
  %34 = shufflevector <2 x float> %27, <2 x float> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
  %35 = shufflevector <2 x float> %33, <2 x float> %27, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
  %36 = shufflevector <2 x float> %33, <2 x float> %27, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  %37 = fsub <4 x float> %35, %36
  %38 = fadd <4 x float> %35, %36
  %39 = shufflevector <4 x float> %37, <4 x float> %38, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
  store <4 x float> %39, ptr %8, align 16, !tbaa !5
  %40 = fadd float %21, %2
  %41 = fadd float %28, %3
  %42 = insertelement <4 x float> %34, float %40, i64 2
  %43 = insertelement <4 x float> %42, float %41, i64 3
  %44 = shufflevector <4 x float> %43, <4 x float> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  %45 = fadd <4 x float> %43, %44
  %46 = fsub <4 x float> %43, %44
  %47 = shufflevector <4 x float> %45, <4 x float> %46, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
  store <4 x float> %47, ptr %22, align 16, !tbaa !5
  call void @_ZL12sDrawPolygonPKfjfj(ptr noundef nonnull %8, i32 noundef 4, float noundef %5, i32 noundef %6)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #4
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL12sDrawPolygonPKfjfj(ptr noundef, i32 noundef, float noundef, i32 noundef) local_unnamed_addr #2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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: AggressiveInstCombinePass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass