; LLVM IR from tyoma/agge :: src/agge/curves.ll (ZN4agge7cbezier6vertexEPfS1_)

; 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.agge::cbezier" = type { float, float, float, float, float, float, float, float, float, float, i32 }

; 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: mustprogress uwtable
define dso_local noundef i32 @_ZN4agge7cbezier6vertexEPfS1_(ptr noundef nonnull align 4 dereferenceable(44) %0, ptr noundef %1, ptr noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %9 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 10
  %10 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %10, ptr %7, align 4, !tbaa !13
  %11 = load i32, ptr %7, align 4, !tbaa !13
  switch i32 %11, label %62 [
    i32 1, label %12
    i32 2, label %23
  ]

12:                                               ; preds = %3
  %13 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 0
  %14 = load float, ptr %13, align 4, !tbaa !14
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  store float %14, ptr %15, align 4, !tbaa !15
  %16 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 1
  %17 = load float, ptr %16, align 4, !tbaa !16
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  store float %17, ptr %18, align 4, !tbaa !15
  %19 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 10
  store i32 2, ptr %19, align 4, !tbaa !9
  %20 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 9
  %21 = load float, ptr %20, align 4, !tbaa !17
  %22 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 8
  store float %21, ptr %22, align 4, !tbaa !18
  br label %62

23:                                               ; preds = %3
  %24 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 8
  %25 = load float, ptr %24, align 4, !tbaa !18
  %26 = fcmp olt float %25, 1.000000e+00
  br i1 %26, label %27, label %53

27:                                               ; preds = %23
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 0
  %31 = load float, ptr %30, align 4, !tbaa !14
  %32 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 1
  %33 = load float, ptr %32, align 4, !tbaa !16
  %34 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 2
  %35 = load float, ptr %34, align 4, !tbaa !19
  %36 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 3
  %37 = load float, ptr %36, align 4, !tbaa !20
  %38 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 4
  %39 = load float, ptr %38, align 4, !tbaa !21
  %40 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 5
  %41 = load float, ptr %40, align 4, !tbaa !22
  %42 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 6
  %43 = load float, ptr %42, align 4, !tbaa !23
  %44 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 7
  %45 = load float, ptr %44, align 4, !tbaa !24
  %46 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 8
  %47 = load float, ptr %46, align 4, !tbaa !18
  call void @_ZN4agge7cbezier9calculateEPfS1_fffffffff(ptr noundef %28, ptr noundef %29, float noundef %31, float noundef %33, float noundef %35, float noundef %37, float noundef %39, float noundef %41, float noundef %43, float noundef %45, float noundef %47)
  %48 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 9
  %49 = load float, ptr %48, align 4, !tbaa !17
  %50 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 8
  %51 = load float, ptr %50, align 4, !tbaa !18
  %52 = fadd float %51, %49
  store float %52, ptr %50, align 4, !tbaa !18
  br label %61

53:                                               ; preds = %23
  %54 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 6
  %55 = load float, ptr %54, align 4, !tbaa !23
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  store float %55, ptr %56, align 4, !tbaa !15
  %57 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 7
  %58 = load float, ptr %57, align 4, !tbaa !24
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  store float %58, ptr %59, align 4, !tbaa !15
  %60 = getelementptr inbounds %"class.agge::cbezier", ptr %8, i32 0, i32 10
  store i32 0, ptr %60, align 4, !tbaa !9
  br label %61

61:                                               ; preds = %53, %27
  br label %62

62:                                               ; preds = %61, %12, %3
  %63 = load i32, ptr %7, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret i32 %63
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4agge7cbezier9calculateEPfS1_fffffffff(ptr noundef, ptr noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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, !12, i64 40}
!10 = !{!"_ZTSN4agge7cbezierE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !12, i64 40}
!11 = !{!"float", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!10, !11, i64 0}
!15 = !{!11, !11, i64 0}
!16 = !{!10, !11, i64 4}
!17 = !{!10, !11, i64 36}
!18 = !{!10, !11, i64 32}
!19 = !{!10, !11, i64 8}
!20 = !{!10, !11, i64 12}
!21 = !{!10, !11, i64 16}
!22 = !{!10, !11, i64 20}
!23 = !{!10, !11, i64 24}
!24 = !{!10, !11, i64 28}


; 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 nounwind uwtable
define dso_local noundef i32 @_ZN4agge7cbezier6vertexEPfS1_(ptr nocapture noundef nonnull align 4 dereferenceable(44) %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  %5 = load i32, ptr %4, align 4, !tbaa !5
  switch i32 %5, label %42 [
    i32 1, label %6
    i32 2, label %13
  ]

6:                                                ; preds = %3
  %7 = load float, ptr %0, align 4, !tbaa !11
  store float %7, ptr %1, align 4, !tbaa !12
  %8 = getelementptr inbounds i8, ptr %0, i64 4
  %9 = load float, ptr %8, align 4, !tbaa !13
  store float %9, ptr %2, align 4, !tbaa !12
  store i32 2, ptr %4, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 36
  %11 = load float, ptr %10, align 4, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %0, i64 32
  store float %11, ptr %12, align 4, !tbaa !15
  br label %42

13:                                               ; preds = %3
  %14 = getelementptr inbounds i8, ptr %0, i64 32
  %15 = load float, ptr %14, align 4, !tbaa !15
  %16 = fcmp olt float %15, 1.000000e+00
  br i1 %16, label %17, label %37

17:                                               ; preds = %13
  %18 = load float, ptr %0, align 4, !tbaa !11
  %19 = getelementptr inbounds i8, ptr %0, i64 4
  %20 = load float, ptr %19, align 4, !tbaa !13
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  %22 = load float, ptr %21, align 4, !tbaa !16
  %23 = getelementptr inbounds i8, ptr %0, i64 12
  %24 = load float, ptr %23, align 4, !tbaa !17
  %25 = getelementptr inbounds i8, ptr %0, i64 16
  %26 = load float, ptr %25, align 4, !tbaa !18
  %27 = getelementptr inbounds i8, ptr %0, i64 20
  %28 = load float, ptr %27, align 4, !tbaa !19
  %29 = getelementptr inbounds i8, ptr %0, i64 24
  %30 = load float, ptr %29, align 4, !tbaa !20
  %31 = getelementptr inbounds i8, ptr %0, i64 28
  %32 = load float, ptr %31, align 4, !tbaa !21
  tail call void @_ZN4agge7cbezier9calculateEPfS1_fffffffff(ptr noundef %1, ptr noundef %2, float noundef %18, float noundef %20, float noundef %22, float noundef %24, float noundef %26, float noundef %28, float noundef %30, float noundef %32, float noundef %15)
  %33 = getelementptr inbounds i8, ptr %0, i64 36
  %34 = load float, ptr %33, align 4, !tbaa !14
  %35 = load float, ptr %14, align 4, !tbaa !15
  %36 = fadd float %34, %35
  store float %36, ptr %14, align 4, !tbaa !15
  br label %42

37:                                               ; preds = %13
  %38 = getelementptr inbounds i8, ptr %0, i64 24
  %39 = load float, ptr %38, align 4, !tbaa !20
  store float %39, ptr %1, align 4, !tbaa !12
  %40 = getelementptr inbounds i8, ptr %0, i64 28
  %41 = load float, ptr %40, align 4, !tbaa !21
  store float %41, ptr %2, align 4, !tbaa !12
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %17, %37, %6, %3
  ret i32 %5
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4agge7cbezier9calculateEPfS1_fffffffff(ptr noundef, ptr noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef) local_unnamed_addr #0 align 2

attributes #0 = { 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 = !{!6, !10, i64 40}
!6 = !{!"_ZTSN4agge7cbezierE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !10, i64 40}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!6, !7, i64 4}
!14 = !{!6, !7, i64 36}
!15 = !{!6, !7, i64 32}
!16 = !{!6, !7, i64 8}
!17 = !{!6, !7, i64 12}
!18 = !{!6, !7, i64 16}
!19 = !{!6, !7, i64 20}
!20 = !{!6, !7, i64 24}
!21 = !{!6, !7, i64 28}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass