; LLVM IR from goldest-star/seawave-animation :: src/vcl/math/mat/mat3/mat3.ll (ZNK3vcl3matILm3ELm3EE3colEm)

; 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.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"struct.vcl::buffer_stack" = type { float, float, float }
%"struct.vcl::mat" = type { float, float, float, float, float, float, float, float, float }

@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [31 x i8], align 1
@__PRETTY_FUNCTION__._ZNK3vcl3matILm3ELm3EE3colEm = external hidden unnamed_addr constant [44 x i8], align 1

declare void @_ZN3vcl12buffer_stackIfLm3EEC1Efff(ptr noundef nonnull align 4 dereferenceable(12), float noundef, float noundef, float noundef) unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

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

; Function Attrs: mustprogress uwtable
define dso_local { <2 x float>, float } @_ZNK3vcl3matILm3ELm3EE3colEm(ptr noundef nonnull align 4 dereferenceable(36) %0, i64 noundef %1) #2 align 2 {
  %3 = alloca %"struct.vcl::buffer_stack", align 4
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca { <2 x float>, float }, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  %7 = load ptr, ptr %4, align 8
  %8 = load i64, ptr %5, align 8, !tbaa !9
  switch i64 %8, label %30 [
    i64 0, label %9
    i64 1, label %16
    i64 2, label %23
  ]

9:                                                ; preds = %2
  %10 = getelementptr inbounds %"struct.vcl::mat", ptr %7, i32 0, i32 0
  %11 = load float, ptr %10, align 4, !tbaa !11
  %12 = getelementptr inbounds %"struct.vcl::mat", ptr %7, i32 0, i32 3
  %13 = load float, ptr %12, align 4, !tbaa !14
  %14 = getelementptr inbounds %"struct.vcl::mat", ptr %7, i32 0, i32 6
  %15 = load float, ptr %14, align 4, !tbaa !15
  call void @_ZN3vcl12buffer_stackIfLm3EEC1Efff(ptr noundef nonnull align 4 dereferenceable(12) %3, float noundef %11, float noundef %13, float noundef %15)
  br label %36

16:                                               ; preds = %2
  %17 = getelementptr inbounds %"struct.vcl::mat", ptr %7, i32 0, i32 1
  %18 = load float, ptr %17, align 4, !tbaa !16
  %19 = getelementptr inbounds %"struct.vcl::mat", ptr %7, i32 0, i32 4
  %20 = load float, ptr %19, align 4, !tbaa !17
  %21 = getelementptr inbounds %"struct.vcl::mat", ptr %7, i32 0, i32 7
  %22 = load float, ptr %21, align 4, !tbaa !18
  call void @_ZN3vcl12buffer_stackIfLm3EEC1Efff(ptr noundef nonnull align 4 dereferenceable(12) %3, float noundef %18, float noundef %20, float noundef %22)
  br label %36

23:                                               ; preds = %2
  %24 = getelementptr inbounds %"struct.vcl::mat", ptr %7, i32 0, i32 2
  %25 = load float, ptr %24, align 4, !tbaa !19
  %26 = getelementptr inbounds %"struct.vcl::mat", ptr %7, i32 0, i32 5
  %27 = load float, ptr %26, align 4, !tbaa !20
  %28 = getelementptr inbounds %"struct.vcl::mat", ptr %7, i32 0, i32 8
  %29 = load float, ptr %28, align 4, !tbaa !21
  call void @_ZN3vcl12buffer_stackIfLm3EEC1Efff(ptr noundef nonnull align 4 dereferenceable(12) %3, float noundef %25, float noundef %27, float noundef %29)
  br label %36

30:                                               ; preds = %2
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef @.str.4)
  %32 = load i64, ptr %5, align 8, !tbaa !9
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) %31, i64 noundef %32)
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %33, ptr noundef @.str.1)
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %34, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 81, ptr noundef @__PRETTY_FUNCTION__._ZNK3vcl3matILm3ELm3EE3colEm) #5
  unreachable

36:                                               ; preds = %23, %16, %9
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 4 %3, i64 12, i1 false)
  %37 = load { <2 x float>, float }, ptr %6, align 8
  ret { <2 x float>, float } %37
}

attributes #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 = { inlinehint 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 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 = { noreturn 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { noreturn 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 = !{!"long", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN3vcl3matILm3ELm3EEE", !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 = !{!"float", !7, i64 0}
!14 = !{!12, !13, i64 12}
!15 = !{!12, !13, i64 24}
!16 = !{!12, !13, i64 4}
!17 = !{!12, !13, i64 16}
!18 = !{!12, !13, i64 28}
!19 = !{!12, !13, i64 8}
!20 = !{!12, !13, i64 20}
!21 = !{!12, !13, i64 32}


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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"struct.vcl::buffer_stack" = type { float, float, float }

@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [31 x i8], align 1
@__PRETTY_FUNCTION__._ZNK3vcl3matILm3ELm3EE3colEm = external hidden unnamed_addr constant [44 x i8], align 1

declare void @_ZN3vcl12buffer_stackIfLm3EEC1Efff(ptr noundef nonnull align 4 dereferenceable(12), float noundef, float noundef, float noundef) unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local { <2 x float>, float } @_ZNK3vcl3matILm3ELm3EE3colEm(ptr nocapture noundef nonnull readonly align 4 dereferenceable(36) %0, i64 noundef %1) local_unnamed_addr #2 align 2 {
  %3 = alloca %"struct.vcl::buffer_stack", align 8
  switch i64 %1, label %8 [
    i64 0, label %13
    i64 1, label %4
    i64 2, label %6
  ]

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  br label %13

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  br label %13

8:                                                ; preds = %2
  %9 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef nonnull @.str.4)
  %10 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) %9, i64 noundef %1)
  %11 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull @.str.1)
  %12 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 81, ptr noundef nonnull @__PRETTY_FUNCTION__._ZNK3vcl3matILm3ELm3EE3colEm) #4
  unreachable

13:                                               ; preds = %2, %6, %4
  %.sink8 = phi ptr [ %7, %6 ], [ %5, %4 ], [ %0, %2 ]
  %.sink7 = phi i64 [ 20, %6 ], [ 16, %4 ], [ 12, %2 ]
  %.sink5 = phi i64 [ 32, %6 ], [ 28, %4 ], [ 24, %2 ]
  %14 = load float, ptr %.sink8, align 4, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %0, i64 %.sink7
  %16 = load float, ptr %15, align 4, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %0, i64 %.sink5
  %18 = load float, ptr %17, align 4, !tbaa !5
  call void @_ZN3vcl12buffer_stackIfLm3EEC1Efff(ptr noundef nonnull align 4 dereferenceable(12) %3, float noundef %14, float noundef %16, float noundef %18)
  %.sroa.0.0.copyload = load <2 x float>, ptr %3, align 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  %.sroa.2.0.copyload = load float, ptr %.sroa.2.0..sroa_idx, align 8
  %.fca.0.insert = insertvalue { <2 x float>, float } poison, <2 x float> %.sroa.0.0.copyload, 0
  %.fca.1.insert = insertvalue { <2 x float>, float } %.fca.0.insert, float %.sroa.2.0.copyload, 1
  ret { <2 x float>, float } %.fca.1.insert
}

attributes #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 = { inlinehint 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 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 = { noreturn 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 = { noreturn 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: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass