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

; 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.1" = type { float, float, float, float }
%"struct.vcl::mat" = type { float, float, float, float, float, float, float, 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__._ZNK3vcl3matILm4ELm4EE3colEm = external hidden unnamed_addr constant [44 x i8], align 1

declare void @_ZN3vcl12buffer_stackIfLm4EEC1Effff(ptr noundef nonnull align 4 dereferenceable(16), float noundef, 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: mustprogress uwtable
define dso_local { <2 x float>, <2 x float> } @_ZNK3vcl3matILm4ELm4EE3colEm(ptr noundef nonnull align 4 dereferenceable(64) %0, i64 noundef %1) #2 align 2 {
  %3 = alloca %"struct.vcl::buffer_stack.1", align 4
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  %6 = load ptr, ptr %4, align 8
  %7 = load i64, ptr %5, align 8, !tbaa !9
  switch i64 %7, label %44 [
    i64 0, label %8
    i64 1, label %17
    i64 2, label %26
    i64 3, label %35
  ]

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

17:                                               ; preds = %2
  %18 = getelementptr inbounds %"struct.vcl::mat", ptr %6, i32 0, i32 1
  %19 = load float, ptr %18, align 4, !tbaa !17
  %20 = getelementptr inbounds %"struct.vcl::mat", ptr %6, i32 0, i32 5
  %21 = load float, ptr %20, align 4, !tbaa !18
  %22 = getelementptr inbounds %"struct.vcl::mat", ptr %6, i32 0, i32 9
  %23 = load float, ptr %22, align 4, !tbaa !19
  %24 = getelementptr inbounds %"struct.vcl::mat", ptr %6, i32 0, i32 13
  %25 = load float, ptr %24, align 4, !tbaa !20
  call void @_ZN3vcl12buffer_stackIfLm4EEC1Effff(ptr noundef nonnull align 4 dereferenceable(16) %3, float noundef %19, float noundef %21, float noundef %23, float noundef %25)
  br label %50

26:                                               ; preds = %2
  %27 = getelementptr inbounds %"struct.vcl::mat", ptr %6, i32 0, i32 2
  %28 = load float, ptr %27, align 4, !tbaa !21
  %29 = getelementptr inbounds %"struct.vcl::mat", ptr %6, i32 0, i32 6
  %30 = load float, ptr %29, align 4, !tbaa !22
  %31 = getelementptr inbounds %"struct.vcl::mat", ptr %6, i32 0, i32 10
  %32 = load float, ptr %31, align 4, !tbaa !23
  %33 = getelementptr inbounds %"struct.vcl::mat", ptr %6, i32 0, i32 14
  %34 = load float, ptr %33, align 4, !tbaa !24
  call void @_ZN3vcl12buffer_stackIfLm4EEC1Effff(ptr noundef nonnull align 4 dereferenceable(16) %3, float noundef %28, float noundef %30, float noundef %32, float noundef %34)
  br label %50

35:                                               ; preds = %2
  %36 = getelementptr inbounds %"struct.vcl::mat", ptr %6, i32 0, i32 3
  %37 = load float, ptr %36, align 4, !tbaa !25
  %38 = getelementptr inbounds %"struct.vcl::mat", ptr %6, i32 0, i32 7
  %39 = load float, ptr %38, align 4, !tbaa !26
  %40 = getelementptr inbounds %"struct.vcl::mat", ptr %6, i32 0, i32 11
  %41 = load float, ptr %40, align 4, !tbaa !27
  %42 = getelementptr inbounds %"struct.vcl::mat", ptr %6, i32 0, i32 15
  %43 = load float, ptr %42, align 4, !tbaa !28
  call void @_ZN3vcl12buffer_stackIfLm4EEC1Effff(ptr noundef nonnull align 4 dereferenceable(16) %3, float noundef %37, float noundef %39, float noundef %41, float noundef %43)
  br label %50

44:                                               ; preds = %2
  %45 = 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)
  %46 = load i64, ptr %5, align 8, !tbaa !9
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) %45, i64 noundef %46)
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %47, ptr noundef @.str.1)
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %48, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 139, ptr noundef @__PRETTY_FUNCTION__._ZNK3vcl3matILm4ELm4EE3colEm) #4
  unreachable

50:                                               ; preds = %35, %26, %17, %8
  %51 = load { <2 x float>, <2 x float> }, ptr %3, align 4
  ret { <2 x float>, <2 x float> } %51
}

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 = !{!"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 = !{!"_ZTSN3vcl3matILm4ELm4EEE", !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, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !13, i64 16}
!15 = !{!12, !13, i64 32}
!16 = !{!12, !13, i64 48}
!17 = !{!12, !13, i64 4}
!18 = !{!12, !13, i64 20}
!19 = !{!12, !13, i64 36}
!20 = !{!12, !13, i64 52}
!21 = !{!12, !13, i64 8}
!22 = !{!12, !13, i64 24}
!23 = !{!12, !13, i64 40}
!24 = !{!12, !13, i64 56}
!25 = !{!12, !13, i64 12}
!26 = !{!12, !13, i64 28}
!27 = !{!12, !13, i64 44}
!28 = !{!12, !13, i64 60}


; 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.1" = type { 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__._ZNK3vcl3matILm4ELm4EE3colEm = external hidden unnamed_addr constant [44 x i8], align 1

declare void @_ZN3vcl12buffer_stackIfLm4EEC1Effff(ptr noundef nonnull align 4 dereferenceable(16), float noundef, 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>, <2 x float> } @_ZNK3vcl3matILm4ELm4EE3colEm(ptr nocapture noundef nonnull readonly align 4 dereferenceable(64) %0, i64 noundef %1) local_unnamed_addr #2 align 2 {
  %3 = alloca %"struct.vcl::buffer_stack.1", align 8
  switch i64 %1, label %10 [
    i64 0, label %15
    i64 1, label %4
    i64 2, label %6
    i64 3, label %8
  ]

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

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

8:                                                ; preds = %2
  %9 = getelementptr inbounds i8, ptr %0, i64 12
  br label %15

10:                                               ; preds = %2
  %11 = 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)
  %12 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) %11, i64 noundef %1)
  %13 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull @.str.1)
  %14 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %13, 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 139, ptr noundef nonnull @__PRETTY_FUNCTION__._ZNK3vcl3matILm4ELm4EE3colEm) #4
  unreachable

15:                                               ; preds = %2, %8, %6, %4
  %.sink11 = phi ptr [ %9, %8 ], [ %7, %6 ], [ %5, %4 ], [ %0, %2 ]
  %.sink10 = phi i64 [ 28, %8 ], [ 24, %6 ], [ 20, %4 ], [ 16, %2 ]
  %.sink8 = phi i64 [ 44, %8 ], [ 40, %6 ], [ 36, %4 ], [ 32, %2 ]
  %.sink6 = phi i64 [ 60, %8 ], [ 56, %6 ], [ 52, %4 ], [ 48, %2 ]
  %16 = load float, ptr %.sink11, align 4, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %0, i64 %.sink10
  %18 = load float, ptr %17, align 4, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %0, i64 %.sink8
  %20 = load float, ptr %19, align 4, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %0, i64 %.sink6
  %22 = load float, ptr %21, align 4, !tbaa !5
  call void @_ZN3vcl12buffer_stackIfLm4EEC1Effff(ptr noundef nonnull align 4 dereferenceable(16) %3, float noundef %16, float noundef %18, float noundef %20, float noundef %22)
  %.fca.0.load = load <2 x float>, ptr %3, align 8
  %.fca.0.insert = insertvalue { <2 x float>, <2 x float> } poison, <2 x float> %.fca.0.load, 0
  %.fca.1.gep = getelementptr inbounds i8, ptr %3, i64 8
  %.fca.1.load = load <2 x float>, ptr %.fca.1.gep, align 8
  %.fca.1.insert = insertvalue { <2 x float>, <2 x float> } %.fca.0.insert, <2 x float> %.fca.1.load, 1
  ret { <2 x float>, <2 x 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,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass