; LLVM IR from tyoma/agge :: src/agge/figures.ll (ZN4agge17rounded_rectangle6vertexEPfS1_)

; 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::rounded_rectangle" = type { float, float, float, float, float, float, float, float, float, float, float, float, [2 x %"struct.agge::point"], i32 }
%"struct.agge::point" = type { float, float }

; 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 @_ZN4agge17rounded_rectangle6vertexEPfS1_(ptr noundef nonnull align 4 dereferenceable(68) %0, ptr noundef %1, ptr noundef %2) #1 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, 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
  %10 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 2, ptr %8, align 4, !tbaa !9
  %11 = getelementptr inbounds %"class.agge::rounded_rectangle", ptr %10, i32 0, i32 13
  %12 = load i32, ptr %11, align 4, !tbaa !11
  switch i32 %12, label %18 [
    i32 8, label %13
    i32 16, label %15
    i32 1, label %16
  ]

13:                                               ; preds = %3
  %14 = getelementptr inbounds %"class.agge::rounded_rectangle", ptr %10, i32 0, i32 13
  store i32 16, ptr %14, align 4, !tbaa !11
  store i32 48, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %63

15:                                               ; preds = %3
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %63

16:                                               ; preds = %3
  %17 = getelementptr inbounds %"class.agge::rounded_rectangle", ptr %10, i32 0, i32 13
  store i32 0, ptr %17, align 4, !tbaa !11
  call void @_ZN4agge17rounded_rectangle12setup_bezierEj(ptr noundef nonnull align 4 dereferenceable(68) %10, i32 noundef 0)
  store i32 1, ptr %8, align 4, !tbaa !9
  br label %18

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

47:                                               ; preds = %18
  %48 = getelementptr inbounds %"class.agge::rounded_rectangle", ptr %10, i32 0, i32 13
  %49 = load i32, ptr %48, align 4, !tbaa !11
  switch i32 %49, label %58 [
    i32 0, label %50
    i32 2, label %52
    i32 6, label %54
    i32 4, label %56
  ]

50:                                               ; preds = %47
  %51 = getelementptr inbounds %"class.agge::rounded_rectangle", ptr %10, i32 0, i32 13
  store i32 2, ptr %51, align 4, !tbaa !11
  br label %58

52:                                               ; preds = %47
  %53 = getelementptr inbounds %"class.agge::rounded_rectangle", ptr %10, i32 0, i32 13
  store i32 6, ptr %53, align 4, !tbaa !11
  br label %58

54:                                               ; preds = %47
  %55 = getelementptr inbounds %"class.agge::rounded_rectangle", ptr %10, i32 0, i32 13
  store i32 4, ptr %55, align 4, !tbaa !11
  br label %58

56:                                               ; preds = %47
  %57 = getelementptr inbounds %"class.agge::rounded_rectangle", ptr %10, i32 0, i32 13
  store i32 8, ptr %57, align 4, !tbaa !11
  br label %58

58:                                               ; preds = %56, %54, %52, %50, %47
  %59 = getelementptr inbounds %"class.agge::rounded_rectangle", ptr %10, i32 0, i32 13
  %60 = load i32, ptr %59, align 4, !tbaa !11
  call void @_ZN4agge17rounded_rectangle12setup_bezierEj(ptr noundef nonnull align 4 dereferenceable(68) %10, i32 noundef %60)
  br label %61

61:                                               ; preds = %58, %18
  %62 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %62, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %63

63:                                               ; preds = %61, %15, %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  %64 = load i32, ptr %4, align 4
  ret i32 %64
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4agge17rounded_rectangle12setup_bezierEj(ptr noundef nonnull align 4 dereferenceable(68), i32 noundef) #2 align 2

declare 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) #3

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 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 64}
!12 = !{!"_ZTSN4agge17rounded_rectangleE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !7, i64 48, !10, i64 64}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = !{!12, !13, i64 12}
!16 = !{!12, !13, i64 16}
!17 = !{!12, !13, i64 20}
!18 = !{!12, !13, i64 24}
!19 = !{!12, !13, i64 28}
!20 = !{!12, !13, i64 32}
!21 = !{!12, !13, i64 36}
!22 = !{!12, !13, i64 0}
!23 = !{!12, !13, i64 4}


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

@switch.table._ZN4agge17rounded_rectangle6vertexEPfS1_ = private unnamed_addr constant [7 x i32] [i32 2, i32 2, i32 6, i32 2, i32 8, i32 2, i32 4], align 4

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 49) i32 @_ZN4agge17rounded_rectangle6vertexEPfS1_(ptr noundef nonnull align 4 dereferenceable(68) %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 64
  %5 = load i32, ptr %4, align 4, !tbaa !5
  switch i32 %5, label %8 [
    i32 8, label %6
    i32 16, label %37
    i32 1, label %7
  ]

6:                                                ; preds = %3
  store i32 16, ptr %4, align 4, !tbaa !5
  br label %37

7:                                                ; preds = %3
  store i32 0, ptr %4, align 4, !tbaa !5
  tail call void @_ZN4agge17rounded_rectangle12setup_bezierEj(ptr noundef nonnull align 4 dereferenceable(68) %0, i32 noundef 0)
  br label %8

8:                                                ; preds = %7, %3
  %.0 = phi i32 [ 2, %3 ], [ 1, %7 ]
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load float, ptr %9, align 4, !tbaa !11
  %11 = getelementptr inbounds i8, ptr %0, i64 12
  %12 = load float, ptr %11, align 4, !tbaa !12
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %14 = load float, ptr %13, align 4, !tbaa !13
  %15 = getelementptr inbounds i8, ptr %0, i64 20
  %16 = load float, ptr %15, align 4, !tbaa !14
  %17 = getelementptr inbounds i8, ptr %0, i64 24
  %18 = load float, ptr %17, align 4, !tbaa !15
  %19 = getelementptr inbounds i8, ptr %0, i64 28
  %20 = load float, ptr %19, align 4, !tbaa !16
  %21 = getelementptr inbounds i8, ptr %0, i64 32
  %22 = load float, ptr %21, align 4, !tbaa !17
  %23 = getelementptr inbounds i8, ptr %0, i64 36
  %24 = load float, ptr %23, align 4, !tbaa !18
  %25 = load float, ptr %0, align 4, !tbaa !19
  tail call void @_ZN4agge7cbezier9calculateEPfS1_fffffffff(ptr noundef %1, ptr noundef %2, float noundef %10, float noundef %12, float noundef %14, float noundef %16, float noundef %18, float noundef %20, float noundef %22, float noundef %24, float noundef %25)
  %26 = getelementptr inbounds i8, ptr %0, i64 4
  %27 = load float, ptr %26, align 4, !tbaa !20
  %28 = load float, ptr %0, align 4, !tbaa !19
  %29 = fadd float %27, %28
  store float %29, ptr %0, align 4, !tbaa !19
  %30 = fcmp ogt float %29, 1.000000e+00
  br i1 %30, label %31, label %37

31:                                               ; preds = %8
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = icmp ult i32 %32, 7
  br i1 %33, label %switch.hole_check, label %35

switch.hole_check:                                ; preds = %31
  %switch.maskindex = trunc nuw i32 %32 to i8
  %switch.shifted = lshr i8 85, %switch.maskindex
  %switch.lobit = trunc i8 %switch.shifted to i1
  br i1 %switch.lobit, label %switch.lookup, label %35

switch.lookup:                                    ; preds = %switch.hole_check
  %34 = zext nneg i32 %32 to i64
  %switch.gep = getelementptr inbounds [7 x i32], ptr @switch.table._ZN4agge17rounded_rectangle6vertexEPfS1_, i64 0, i64 %34
  %switch.load = load i32, ptr %switch.gep, align 4
  store i32 %switch.load, ptr %4, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %switch.hole_check, %31, %switch.lookup
  %36 = phi i32 [ %32, %31 ], [ %switch.load, %switch.lookup ], [ %32, %switch.hole_check ]
  tail call void @_ZN4agge17rounded_rectangle12setup_bezierEj(ptr noundef nonnull align 4 dereferenceable(68) %0, i32 noundef %36)
  br label %37

37:                                               ; preds = %8, %35, %3, %6
  %.04 = phi i32 [ 48, %6 ], [ 0, %3 ], [ %.0, %35 ], [ %.0, %8 ]
  ret i32 %.04
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4agge17rounded_rectangle12setup_bezierEj(ptr noundef nonnull align 4 dereferenceable(68), i32 noundef) local_unnamed_addr #1 align 2

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


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