; LLVM IR from ImperialCollegeLondon/pnflow :: src/pnm/pnflow/ElementThroat.ll (ZN6ThroatC2ERK10CommonDatai4var3IdEdddddddi)

; 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.var3 = type { double, double, double }
%class.Throat = type { %class.Elem, i32, [2 x ptr], %"struct.std::array", double }
%class.Elem = type { %class.Apex, [5 x %class.SlvrElm], i8, i32, ptr, double, double, i32, %"class.std::vector", ptr, double, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, %"struct.std::pair", %"struct.std::pair", %"struct.std::pair", i32, i32, i32, i32, %class.var3 }
%class.Apex = type { ptr, i8, double, double, ptr, i32, double, double, double, double, i8, i8, i8, i8, %"struct.std::pair" }
%class.SlvrElm = type { i8, i8, i8, double, double }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Elem *, std::allocator<Elem *>>::_Vector_impl" }
%"struct.std::_Vector_base<Elem *, std::allocator<Elem *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Elem *, std::allocator<Elem *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Elem *, std::allocator<Elem *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, double }
%"struct.std::array" = type { [2 x double] }

@_ZTV6Throat = external dso_local unnamed_addr constant { [16 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6ThroatC2ERK10CommonDatai4var3IdEdddddddi(ptr noundef nonnull align 8 dereferenceable(456) %0, ptr noundef nonnull align 8 dereferenceable(1972) %1, i32 noundef %2, ptr noundef byval(%class.var3) align 8 %3, double noundef %4, double noundef %5, double noundef %6, double noundef %7, double noundef %8, double noundef %9, double noundef %10, i32 noundef %11) unnamed_addr #0 align 2 {
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %21 = alloca double, align 8
  %22 = alloca double, align 8
  %23 = alloca i32, align 4
  %24 = alloca %class.var3, align 8
  store ptr %0, ptr %13, align 8, !tbaa !5
  store ptr %1, ptr %14, align 8, !tbaa !5
  store i32 %2, ptr %15, align 4, !tbaa !9
  store double %4, ptr %16, align 8, !tbaa !11
  store double %5, ptr %17, align 8, !tbaa !11
  store double %6, ptr %18, align 8, !tbaa !11
  store double %7, ptr %19, align 8, !tbaa !11
  store double %8, ptr %20, align 8, !tbaa !11
  store double %9, ptr %21, align 8, !tbaa !11
  store double %10, ptr %22, align 8, !tbaa !11
  store i32 %11, ptr %23, align 4, !tbaa !9
  %25 = load ptr, ptr %13, align 8
  %26 = load ptr, ptr %14, align 8, !tbaa !5
  %27 = load i32, ptr %15, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %24, ptr align 8 %3, i64 24, i1 false), !tbaa.struct !13
  %28 = load double, ptr %16, align 8, !tbaa !11
  %29 = load double, ptr %17, align 8, !tbaa !11
  %30 = load double, ptr %18, align 8, !tbaa !11
  %31 = load double, ptr %19, align 8, !tbaa !11
  %32 = load i32, ptr %23, align 4, !tbaa !9
  call void @_ZN4ElemC2ERK10CommonDatai4var3IdEddddibi(ptr noundef nonnull align 8 dereferenceable(408) %25, ptr noundef nonnull align 8 dereferenceable(1972) %26, i32 noundef %27, ptr noundef byval(%class.var3) align 8 %24, double noundef %28, double noundef %29, double noundef %30, double noundef %31, i32 noundef 2, i1 noundef zeroext false, i32 noundef %32)
  store ptr getelementptr inbounds inrange(-16, 112) ({ [16 x ptr] }, ptr @_ZTV6Throat, i32 0, i32 0, i32 2), ptr %25, align 8, !tbaa !14
  %33 = getelementptr inbounds %class.Throat, ptr %25, i32 0, i32 1
  %34 = load i32, ptr %15, align 4, !tbaa !9
  store i32 %34, ptr %33, align 8, !tbaa !16
  %35 = getelementptr inbounds %class.Throat, ptr %25, i32 0, i32 3
  %36 = getelementptr inbounds %"struct.std::array", ptr %35, i32 0, i32 0
  %37 = load double, ptr %21, align 8, !tbaa !11
  store double %37, ptr %36, align 8, !tbaa !11
  %38 = getelementptr inbounds double, ptr %36, i64 1
  %39 = load double, ptr %22, align 8, !tbaa !11
  store double %39, ptr %38, align 8, !tbaa !11
  %40 = getelementptr inbounds %class.Throat, ptr %25, i32 0, i32 4
  %41 = load double, ptr %20, align 8, !tbaa !11
  store double %41, ptr %40, align 8, !tbaa !28
  ret void
}

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

declare void @_ZN4ElemC2ERK10CommonDatai4var3IdEddddibi(ptr noundef nonnull align 8 dereferenceable(408), ptr noundef nonnull align 8 dereferenceable(1972), i32 noundef, ptr noundef byval(%class.var3) align 8, double noundef, double noundef, double noundef, double noundef, i32 noundef, i1 noundef zeroext, i32 noundef) 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !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, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{i64 0, i64 8, !11, i64 8, i64 8, !11, i64 16, i64 8, !11}
!14 = !{!15, !15, i64 0}
!15 = !{!"vtable pointer", !8, i64 0}
!16 = !{!17, !10, i64 408}
!17 = !{!"_ZTS6Throat", !18, i64 0, !10, i64 408, !7, i64 416, !27, i64 432, !12, i64 448}
!18 = !{!"_ZTS4Elem", !19, i64 0, !7, i64 104, !20, i64 224, !10, i64 228, !6, i64 232, !12, i64 240, !12, i64 248, !10, i64 256, !22, i64 264, !6, i64 288, !12, i64 296, !20, i64 304, !20, i64 305, !20, i64 306, !20, i64 307, !20, i64 308, !20, i64 309, !20, i64 310, !20, i64 311, !20, i64 312, !20, i64 313, !21, i64 320, !21, i64 336, !21, i64 352, !10, i64 368, !10, i64 372, !10, i64 376, !10, i64 380, !26, i64 384}
!19 = !{!"_ZTS4Apex", !20, i64 8, !12, i64 16, !12, i64 24, !6, i64 32, !10, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !20, i64 80, !20, i64 81, !20, i64 82, !20, i64 83, !21, i64 88}
!20 = !{!"bool", !7, i64 0}
!21 = !{!"_ZTSSt4pairIidE", !10, i64 0, !12, i64 8}
!22 = !{!"_ZTSSt6vectorIP4ElemSaIS1_EE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseIP4ElemSaIS1_EE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIP4ElemSaIS1_EE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIP4ElemSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!26 = !{!"_ZTS4var3IdE", !12, i64 0, !12, i64 8, !12, i64 16}
!27 = !{!"_ZTSSt5arrayIdLm2EE", !7, i64 0}
!28 = !{!17, !12, i64 448}


; 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.var3 = type { double, double, double }

@_ZTV6Throat = external dso_local unnamed_addr constant { [16 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6ThroatC2ERK10CommonDatai4var3IdEdddddddi(ptr noundef nonnull align 8 dereferenceable(456) %0, ptr noundef nonnull align 8 dereferenceable(1972) %1, i32 noundef %2, ptr nocapture noundef readonly byval(%class.var3) align 8 %3, double noundef %4, double noundef %5, double noundef %6, double noundef %7, double noundef %8, double noundef %9, double noundef %10, i32 noundef %11) unnamed_addr #0 align 2 {
  tail call void @_ZN4ElemC2ERK10CommonDatai4var3IdEddddibi(ptr noundef nonnull align 8 dereferenceable(408) %0, ptr noundef nonnull align 8 dereferenceable(1972) %1, i32 noundef %2, ptr noundef nonnull byval(%class.var3) align 8 %3, double noundef %4, double noundef %5, double noundef %6, double noundef %7, i32 noundef 2, i1 noundef zeroext false, i32 noundef %11)
  store ptr getelementptr inbounds inrange(-16, 112) (i8, ptr @_ZTV6Throat, i64 16), ptr %0, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %0, i64 408
  store i32 %2, ptr %13, align 8, !tbaa !8
  %14 = getelementptr inbounds i8, ptr %0, i64 432
  store double %9, ptr %14, align 8, !tbaa !24
  %15 = getelementptr inbounds i8, ptr %0, i64 440
  store double %10, ptr %15, align 8, !tbaa !24
  %16 = getelementptr inbounds i8, ptr %0, i64 448
  store double %8, ptr %16, align 8, !tbaa !25
  ret void
}

declare void @_ZN4ElemC2ERK10CommonDatai4var3IdEddddibi(ptr noundef nonnull align 8 dereferenceable(408), ptr noundef nonnull align 8 dereferenceable(1972), i32 noundef, ptr noundef byval(%class.var3) align 8, double noundef, double noundef, double noundef, double noundef, i32 noundef, i1 noundef zeroext, i32 noundef) unnamed_addr #1

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 = { "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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !16, i64 408}
!9 = !{!"_ZTS6Throat", !10, i64 0, !16, i64 408, !13, i64 416, !23, i64 432, !14, i64 448}
!10 = !{!"_ZTS4Elem", !11, i64 0, !13, i64 104, !12, i64 224, !16, i64 228, !15, i64 232, !14, i64 240, !14, i64 248, !16, i64 256, !18, i64 264, !15, i64 288, !14, i64 296, !12, i64 304, !12, i64 305, !12, i64 306, !12, i64 307, !12, i64 308, !12, i64 309, !12, i64 310, !12, i64 311, !12, i64 312, !12, i64 313, !17, i64 320, !17, i64 336, !17, i64 352, !16, i64 368, !16, i64 372, !16, i64 376, !16, i64 380, !22, i64 384}
!11 = !{!"_ZTS4Apex", !12, i64 8, !14, i64 16, !14, i64 24, !15, i64 32, !16, i64 40, !14, i64 48, !14, i64 56, !14, i64 64, !14, i64 72, !12, i64 80, !12, i64 81, !12, i64 82, !12, i64 83, !17, i64 88}
!12 = !{!"bool", !13, i64 0}
!13 = !{!"omnipotent char", !7, i64 0}
!14 = !{!"double", !13, i64 0}
!15 = !{!"any pointer", !13, i64 0}
!16 = !{!"int", !13, i64 0}
!17 = !{!"_ZTSSt4pairIidE", !16, i64 0, !14, i64 8}
!18 = !{!"_ZTSSt6vectorIP4ElemSaIS1_EE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIP4ElemSaIS1_EE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIP4ElemSaIS1_EE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIP4ElemSaIS1_EE17_Vector_impl_dataE", !15, i64 0, !15, i64 8, !15, i64 16}
!22 = !{!"_ZTS4var3IdE", !14, i64 0, !14, i64 8, !14, i64 16}
!23 = !{!"_ZTSSt5arrayIdLm2EE", !13, i64 0}
!24 = !{!14, !14, i64 0}
!25 = !{!9, !14, i64 448}


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