; LLVM IR from indjev99/Evolving-Snakes :: sources/draw.ll (Z15drawPartEllipseffffdd)

; 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: mustprogress uwtable
define dso_local void @_Z15drawPartEllipseffffdd(float noundef %0, float noundef %1, float noundef %2, float noundef %3, double noundef %4, double noundef %5) #0 {
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca i32, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  store float %0, ptr %7, align 4, !tbaa !5
  store float %1, ptr %8, align 4, !tbaa !5
  store float %2, ptr %9, align 4, !tbaa !5
  store float %3, ptr %10, align 4, !tbaa !5
  store double %4, ptr %11, align 8, !tbaa !9
  store double %5, ptr %12, align 8, !tbaa !9
  %16 = load double, ptr %11, align 8, !tbaa !9
  %17 = fmul double %16, 2.000000e+00
  %18 = call double @llvm.round.f64(double %17)
  store double %18, ptr %11, align 8, !tbaa !9
  %19 = load double, ptr %12, align 8, !tbaa !9
  %20 = fmul double %19, 2.000000e+00
  %21 = call double @llvm.round.f64(double %20)
  store double %21, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %22 = load double, ptr %11, align 8, !tbaa !9
  %23 = fptosi double %22 to i32
  store i32 %23, ptr %13, align 4, !tbaa !11
  br label %24

24:                                               ; preds = %74, %6
  %25 = load i32, ptr %13, align 4, !tbaa !11
  %26 = sitofp i32 %25 to double
  %27 = load double, ptr %12, align 8, !tbaa !9
  %28 = fcmp olt double %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %77

30:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %31 = load i32, ptr %13, align 4, !tbaa !11
  %32 = sitofp i32 %31 to double
  %33 = fmul double %32, 5.000000e-01
  %34 = fmul double %33, 0x3F91DF45A50DE270
  %35 = fptrunc double %34 to float
  store float %35, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %36 = load i32, ptr %13, align 4, !tbaa !11
  %37 = add nsw i32 %36, 1
  %38 = sitofp i32 %37 to double
  %39 = fmul double %38, 5.000000e-01
  %40 = fptrunc double %39 to float
  store float %40, ptr %15, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %44, %30
  %42 = load float, ptr %15, align 4, !tbaa !5
  %43 = fcmp oge float %42, 3.600000e+02
  br i1 %43, label %44, label %47

44:                                               ; preds = %41
  %45 = load float, ptr %15, align 4, !tbaa !5
  %46 = fsub float %45, 3.600000e+02
  store float %46, ptr %15, align 4, !tbaa !5
  br label %41, !llvm.loop !13

47:                                               ; preds = %41
  %48 = load float, ptr %15, align 4, !tbaa !5
  %49 = fpext float %48 to double
  %50 = fmul double %49, 0x3F91DF45A50DE270
  %51 = fptrunc double %50 to float
  store float %51, ptr %15, align 4, !tbaa !5
  %52 = load float, ptr %14, align 4, !tbaa !5
  %53 = call noundef float @_ZSt3cosf(float noundef %52)
  %54 = load float, ptr %9, align 4, !tbaa !5
  %55 = load float, ptr %7, align 4, !tbaa !5
  %56 = call float @llvm.fmuladd.f32(float %53, float %54, float %55)
  %57 = load float, ptr %14, align 4, !tbaa !5
  %58 = call noundef float @_ZSt3sinf(float noundef %57)
  %59 = load float, ptr %10, align 4, !tbaa !5
  %60 = load float, ptr %8, align 4, !tbaa !5
  %61 = call float @llvm.fmuladd.f32(float %58, float %59, float %60)
  call void @glVertex2f(float noundef %56, float noundef %61)
  %62 = load float, ptr %15, align 4, !tbaa !5
  %63 = call noundef float @_ZSt3cosf(float noundef %62)
  %64 = load float, ptr %9, align 4, !tbaa !5
  %65 = load float, ptr %7, align 4, !tbaa !5
  %66 = call float @llvm.fmuladd.f32(float %63, float %64, float %65)
  %67 = load float, ptr %15, align 4, !tbaa !5
  %68 = call noundef float @_ZSt3sinf(float noundef %67)
  %69 = load float, ptr %10, align 4, !tbaa !5
  %70 = load float, ptr %8, align 4, !tbaa !5
  %71 = call float @llvm.fmuladd.f32(float %68, float %69, float %70)
  call void @glVertex2f(float noundef %66, float noundef %71)
  %72 = load float, ptr %7, align 4, !tbaa !5
  %73 = load float, ptr %8, align 4, !tbaa !5
  call void @glVertex2f(float noundef %72, float noundef %73)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %74

74:                                               ; preds = %47
  %75 = load i32, ptr %13, align 4, !tbaa !11
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %13, align 4, !tbaa !11
  br label %24, !llvm.loop !15

77:                                               ; preds = %29
  ret void
}

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

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

declare void @glVertex2f(float noundef, float noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3cosf(float noundef) #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3sinf(float noundef) #4

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

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 speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 }

!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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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 uwtable
define dso_local void @_Z15drawPartEllipseffffdd(float noundef %0, float noundef %1, float noundef %2, float noundef %3, double noundef %4, double noundef %5) local_unnamed_addr #0 {
  %7 = fmul double %4, 2.000000e+00
  %8 = tail call double @llvm.round.f64(double %7)
  %9 = fmul double %5, 2.000000e+00
  %10 = tail call double @llvm.round.f64(double %9)
  %11 = fptosi double %8 to i32
  %12 = sitofp i32 %11 to double
  %13 = fcmp ogt double %10, %12
  br i1 %13, label %.lr.ph29, label %._crit_edge30

._crit_edge30:                                    ; preds = %._crit_edge, %6
  ret void

.lr.ph29:                                         ; preds = %6, %._crit_edge
  %14 = phi double [ %19, %._crit_edge ], [ %12, %6 ]
  %.02427 = phi i32 [ %18, %._crit_edge ], [ %11, %6 ]
  %15 = fmul double %14, 5.000000e-01
  %16 = fmul double %15, 0x3F91DF45A50DE270
  %17 = fptrunc double %16 to float
  %18 = add nsw i32 %.02427, 1
  %19 = sitofp i32 %18 to double
  %20 = fmul double %19, 5.000000e-01
  %21 = fptrunc double %20 to float
  %22 = fcmp ult float %21, 3.600000e+02
  br i1 %22, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph29, %.lr.ph
  %.026 = phi float [ %23, %.lr.ph ], [ %21, %.lr.ph29 ]
  %23 = fadd float %.026, -3.600000e+02
  %24 = fcmp ult float %23, 3.600000e+02
  br i1 %24, label %._crit_edge, label %.lr.ph, !llvm.loop !5

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph29
  %.0.lcssa = phi float [ %21, %.lr.ph29 ], [ %23, %.lr.ph ]
  %25 = fpext float %.0.lcssa to double
  %26 = fmul double %25, 0x3F91DF45A50DE270
  %27 = fptrunc double %26 to float
  %28 = tail call noundef float @_ZSt3cosf(float noundef %17)
  %29 = tail call float @llvm.fmuladd.f32(float %28, float %2, float %0)
  %30 = tail call noundef float @_ZSt3sinf(float noundef %17)
  %31 = tail call float @llvm.fmuladd.f32(float %30, float %3, float %1)
  tail call void @glVertex2f(float noundef %29, float noundef %31)
  %32 = tail call noundef float @_ZSt3cosf(float noundef %27)
  %33 = tail call float @llvm.fmuladd.f32(float %32, float %2, float %0)
  %34 = tail call noundef float @_ZSt3sinf(float noundef %27)
  %35 = tail call float @llvm.fmuladd.f32(float %34, float %3, float %1)
  tail call void @glVertex2f(float noundef %33, float noundef %35)
  tail call void @glVertex2f(float noundef %0, float noundef %1)
  %36 = fcmp ogt double %10, %19
  br i1 %36, label %.lr.ph29, label %._crit_edge30, !llvm.loop !7
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.round.f64(double) #1

declare void @glVertex2f(float noundef, float noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3cosf(float noundef) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3sinf(float noundef) local_unnamed_addr #3

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 speculatable willreturn memory(none) }
attributes #2 = { "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" }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass