; LLVM IR from aap/librw :: src/base.ll (ZN2rw6Matrix9transposeEPS0_PKS0_)

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

%"struct.rw::Matrix" = type { %"struct.rw::V3d", i32, %"struct.rw::V3d", i32, %"struct.rw::V3d", i32, %"struct.rw::V3d", i32 }
%"struct.rw::V3d" = type { float, float, float }

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef ptr @_ZN2rw6Matrix9transposeEPS0_PKS0_(ptr noundef %0, ptr noundef %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds %"struct.rw::Matrix", ptr %5, i32 0, i32 1
  %7 = load i32, ptr %6, align 4, !tbaa !9
  %8 = and i32 %7, 131072
  %9 = icmp ne i32 %8, 0
  br i1 %9, label %10, label %13

10:                                               ; preds = %2
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %11, i64 64, i1 false), !tbaa.struct !14
  br label %13

13:                                               ; preds = %10, %2
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %"struct.rw::Matrix", ptr %14, i32 0, i32 0
  %16 = getelementptr inbounds %"struct.rw::V3d", ptr %15, i32 0, i32 0
  %17 = load float, ptr %16, align 4, !tbaa !17
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %"struct.rw::Matrix", ptr %18, i32 0, i32 0
  %20 = getelementptr inbounds %"struct.rw::V3d", ptr %19, i32 0, i32 0
  store float %17, ptr %20, align 4, !tbaa !17
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %"struct.rw::Matrix", ptr %21, i32 0, i32 0
  %23 = getelementptr inbounds %"struct.rw::V3d", ptr %22, i32 0, i32 1
  %24 = load float, ptr %23, align 4, !tbaa !18
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %"struct.rw::Matrix", ptr %25, i32 0, i32 2
  %27 = getelementptr inbounds %"struct.rw::V3d", ptr %26, i32 0, i32 0
  store float %24, ptr %27, align 4, !tbaa !19
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %"struct.rw::Matrix", ptr %28, i32 0, i32 0
  %30 = getelementptr inbounds %"struct.rw::V3d", ptr %29, i32 0, i32 2
  %31 = load float, ptr %30, align 4, !tbaa !20
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.rw::Matrix", ptr %32, i32 0, i32 4
  %34 = getelementptr inbounds %"struct.rw::V3d", ptr %33, i32 0, i32 0
  store float %31, ptr %34, align 4, !tbaa !21
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.rw::Matrix", ptr %35, i32 0, i32 2
  %37 = getelementptr inbounds %"struct.rw::V3d", ptr %36, i32 0, i32 0
  %38 = load float, ptr %37, align 4, !tbaa !19
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.rw::Matrix", ptr %39, i32 0, i32 0
  %41 = getelementptr inbounds %"struct.rw::V3d", ptr %40, i32 0, i32 1
  store float %38, ptr %41, align 4, !tbaa !18
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %"struct.rw::Matrix", ptr %42, i32 0, i32 2
  %44 = getelementptr inbounds %"struct.rw::V3d", ptr %43, i32 0, i32 1
  %45 = load float, ptr %44, align 4, !tbaa !22
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %"struct.rw::Matrix", ptr %46, i32 0, i32 2
  %48 = getelementptr inbounds %"struct.rw::V3d", ptr %47, i32 0, i32 1
  store float %45, ptr %48, align 4, !tbaa !22
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %"struct.rw::Matrix", ptr %49, i32 0, i32 2
  %51 = getelementptr inbounds %"struct.rw::V3d", ptr %50, i32 0, i32 2
  %52 = load float, ptr %51, align 4, !tbaa !23
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %"struct.rw::Matrix", ptr %53, i32 0, i32 4
  %55 = getelementptr inbounds %"struct.rw::V3d", ptr %54, i32 0, i32 1
  store float %52, ptr %55, align 4, !tbaa !24
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %"struct.rw::Matrix", ptr %56, i32 0, i32 4
  %58 = getelementptr inbounds %"struct.rw::V3d", ptr %57, i32 0, i32 0
  %59 = load float, ptr %58, align 4, !tbaa !21
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %"struct.rw::Matrix", ptr %60, i32 0, i32 0
  %62 = getelementptr inbounds %"struct.rw::V3d", ptr %61, i32 0, i32 2
  store float %59, ptr %62, align 4, !tbaa !20
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.rw::Matrix", ptr %63, i32 0, i32 4
  %65 = getelementptr inbounds %"struct.rw::V3d", ptr %64, i32 0, i32 1
  %66 = load float, ptr %65, align 4, !tbaa !24
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds %"struct.rw::Matrix", ptr %67, i32 0, i32 2
  %69 = getelementptr inbounds %"struct.rw::V3d", ptr %68, i32 0, i32 2
  store float %66, ptr %69, align 4, !tbaa !23
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = getelementptr inbounds %"struct.rw::Matrix", ptr %70, i32 0, i32 4
  %72 = getelementptr inbounds %"struct.rw::V3d", ptr %71, i32 0, i32 2
  %73 = load float, ptr %72, align 4, !tbaa !25
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds %"struct.rw::Matrix", ptr %74, i32 0, i32 4
  %76 = getelementptr inbounds %"struct.rw::V3d", ptr %75, i32 0, i32 2
  store float %73, ptr %76, align 4, !tbaa !25
  %77 = load ptr, ptr %3, align 8, !tbaa !5
  %78 = getelementptr inbounds %"struct.rw::Matrix", ptr %77, i32 0, i32 6
  %79 = getelementptr inbounds %"struct.rw::V3d", ptr %78, i32 0, i32 0
  store float 0.000000e+00, ptr %79, align 4, !tbaa !26
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %"struct.rw::Matrix", ptr %80, i32 0, i32 6
  %82 = getelementptr inbounds %"struct.rw::V3d", ptr %81, i32 0, i32 1
  store float 0.000000e+00, ptr %82, align 4, !tbaa !27
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = getelementptr inbounds %"struct.rw::Matrix", ptr %83, i32 0, i32 6
  %85 = getelementptr inbounds %"struct.rw::V3d", ptr %84, i32 0, i32 2
  store float 0.000000e+00, ptr %85, align 4, !tbaa !28
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  ret ptr %86
}

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

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


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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local noundef ptr @_ZN2rw6Matrix9transposeEPS0_PKS0_(ptr noundef returned writeonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #1 align 2 {
  %3 = getelementptr inbounds i8, ptr %1, i64 12
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = and i32 %4, 131072
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %7, label %6

6:                                                ; preds = %2
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(64) %0, ptr noundef nonnull align 4 dereferenceable(64) %1, i64 64, i1 false), !tbaa.struct !12
  br label %7

7:                                                ; preds = %6, %2
  %8 = load float, ptr %1, align 4, !tbaa !15
  store float %8, ptr %0, align 4, !tbaa !15
  %9 = getelementptr inbounds i8, ptr %1, i64 4
  %10 = load float, ptr %9, align 4, !tbaa !16
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  store float %10, ptr %11, align 4, !tbaa !17
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = load float, ptr %12, align 4, !tbaa !18
  %14 = getelementptr inbounds i8, ptr %0, i64 32
  store float %13, ptr %14, align 4, !tbaa !19
  %15 = getelementptr inbounds i8, ptr %1, i64 16
  %16 = load float, ptr %15, align 4, !tbaa !17
  %17 = getelementptr inbounds i8, ptr %0, i64 4
  store float %16, ptr %17, align 4, !tbaa !16
  %18 = getelementptr inbounds i8, ptr %1, i64 20
  %19 = load float, ptr %18, align 4, !tbaa !20
  %20 = getelementptr inbounds i8, ptr %0, i64 20
  store float %19, ptr %20, align 4, !tbaa !20
  %21 = getelementptr inbounds i8, ptr %1, i64 24
  %22 = load float, ptr %21, align 4, !tbaa !21
  %23 = getelementptr inbounds i8, ptr %0, i64 36
  store float %22, ptr %23, align 4, !tbaa !22
  %24 = getelementptr inbounds i8, ptr %1, i64 32
  %25 = load float, ptr %24, align 4, !tbaa !19
  %26 = getelementptr inbounds i8, ptr %0, i64 8
  store float %25, ptr %26, align 4, !tbaa !18
  %27 = getelementptr inbounds i8, ptr %1, i64 36
  %28 = load float, ptr %27, align 4, !tbaa !22
  %29 = getelementptr inbounds i8, ptr %0, i64 24
  store float %28, ptr %29, align 4, !tbaa !21
  %30 = getelementptr inbounds i8, ptr %1, i64 40
  %31 = load float, ptr %30, align 4, !tbaa !23
  %32 = getelementptr inbounds i8, ptr %0, i64 40
  store float %31, ptr %32, align 4, !tbaa !23
  %33 = getelementptr inbounds i8, ptr %0, i64 48
  store <2 x float> zeroinitializer, ptr %33, align 4, !tbaa !13
  %34 = getelementptr inbounds i8, ptr %0, i64 56
  store float 0.000000e+00, ptr %34, align 4, !tbaa !24
  ret ptr %0
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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, !11, i64 12}
!6 = !{!"_ZTSN2rw6MatrixE", !7, i64 0, !11, i64 12, !7, i64 16, !11, i64 28, !7, i64 32, !11, i64 44, !7, i64 48, !11, i64 60}
!7 = !{!"_ZTSN2rw3V3dE", !8, i64 0, !8, i64 4, !8, i64 8}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{i64 0, i64 4, !13, i64 4, i64 4, !13, i64 8, i64 4, !13, i64 12, i64 4, !14, i64 16, i64 4, !13, i64 20, i64 4, !13, i64 24, i64 4, !13, i64 28, i64 4, !14, i64 32, i64 4, !13, i64 36, i64 4, !13, i64 40, i64 4, !13, i64 44, i64 4, !14, i64 48, i64 4, !13, i64 52, i64 4, !13, i64 56, i64 4, !13, i64 60, i64 4, !14}
!13 = !{!8, !8, i64 0}
!14 = !{!11, !11, i64 0}
!15 = !{!6, !8, i64 0}
!16 = !{!6, !8, i64 4}
!17 = !{!6, !8, i64 16}
!18 = !{!6, !8, i64 8}
!19 = !{!6, !8, i64 32}
!20 = !{!6, !8, i64 20}
!21 = !{!6, !8, i64 24}
!22 = !{!6, !8, i64 36}
!23 = !{!6, !8, i64 40}
!24 = !{!6, !8, i64 56}


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