; LLVM IR from ImperialCollegeLondon/pnflow :: src/pnm/pnextract (writers_vtk)

; 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.poreNE = type { i32, i32, %"class.std::map", ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%class.medialBall = type { ptr, float, float, float, i16, float, i16, i16, i16, i16, i16, ptr, ptr, ptr }

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4var3IdEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24), double noundef, double noundef, double noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z16addSphereSegmentR4var3IdES1_dRmRSt6vectorIS0_SaIS0_EERS3_IiSaIiEES9_i(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), double noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z17addPoreSphereMeshRKSt6vectorIP6poreNESaIS1_EEmRKS_IP8throatNESaIS7_EERS_I4var3IdESaISD_EERS_IiSaIiEESJ_dj(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %5, double noundef %6, i32 noundef %7) #3 {
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca double, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca %class.var3, align 8
  %19 = alloca %class.var3, align 8
  %20 = alloca double, align 8
  store ptr %0, ptr %9, align 8, !tbaa !5
  store i64 %1, ptr %10, align 8, !tbaa !9
  store ptr %2, ptr %11, align 8, !tbaa !5
  store ptr %3, ptr %12, align 8, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store double %6, ptr %15, align 8, !tbaa !11
  store i32 %7, ptr %16, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = load i64, ptr %10, align 8, !tbaa !9
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIP6poreNESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %21, i64 noundef %22) #4
  %24 = load ptr, ptr %23, align 8, !tbaa !5
  store ptr %24, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %18) #4
  %25 = load ptr, ptr %17, align 8, !tbaa !5
  %26 = getelementptr inbounds %class.poreNE, ptr %25, i32 0, i32 3
  %27 = load ptr, ptr %26, align 8, !tbaa !15
  %28 = getelementptr inbounds %class.medialBall, ptr %27, i32 0, i32 1
  %29 = load float, ptr %28, align 8, !tbaa !25
  %30 = fpext float %29 to double
  %31 = load ptr, ptr %17, align 8, !tbaa !5
  %32 = getelementptr inbounds %class.poreNE, ptr %31, i32 0, i32 3
  %33 = load ptr, ptr %32, align 8, !tbaa !15
  %34 = getelementptr inbounds %class.medialBall, ptr %33, i32 0, i32 2
  %35 = load float, ptr %34, align 4, !tbaa !29
  %36 = fpext float %35 to double
  %37 = load ptr, ptr %17, align 8, !tbaa !5
  %38 = getelementptr inbounds %class.poreNE, ptr %37, i32 0, i32 3
  %39 = load ptr, ptr %38, align 8, !tbaa !15
  %40 = getelementptr inbounds %class.medialBall, ptr %39, i32 0, i32 3
  %41 = load float, ptr %40, align 8, !tbaa !30
  %42 = fpext float %41 to double
  call void @_ZN4var3IdEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %18, double noundef %30, double noundef %36, double noundef %42)
  call void @llvm.lifetime.start.p0(i64 24, ptr %19) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 %18, i64 24, i1 false), !tbaa.struct !31
  %43 = getelementptr inbounds %class.var3, ptr %19, i32 0, i32 1
  %44 = load double, ptr %43, align 8, !tbaa !32
  %45 = fadd double %44, 0x3D719799812DEA11
  store double %45, ptr %43, align 8, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %46 = load ptr, ptr %17, align 8, !tbaa !5
  %47 = getelementptr inbounds %class.poreNE, ptr %46, i32 0, i32 3
  %48 = load ptr, ptr %47, align 8, !tbaa !15
  %49 = getelementptr inbounds %class.medialBall, ptr %48, i32 0, i32 5
  %50 = load float, ptr %49, align 8, !tbaa !34
  %51 = fpext float %50 to double
  %52 = load double, ptr %15, align 8, !tbaa !11
  %53 = fmul double %51, %52
  store double %53, ptr %20, align 8, !tbaa !11
  %54 = load double, ptr %20, align 8, !tbaa !11
  %55 = load ptr, ptr %12, align 8, !tbaa !5
  %56 = load ptr, ptr %13, align 8, !tbaa !5
  %57 = load ptr, ptr %14, align 8, !tbaa !5
  %58 = load i32, ptr %16, align 4, !tbaa !13
  call void @_Z16addSphereSegmentR4var3IdES1_dRmRSt6vectorIS0_SaIS0_EERS3_IiSaIiEES9_i(ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull align 8 dereferenceable(24) %19, double noundef %54, ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(24) %55, ptr noundef nonnull align 8 dereferenceable(24) %56, ptr noundef nonnull align 8 dereferenceable(24) %57, i32 noundef %58)
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !6, i64 56}
!16 = !{!"_ZTS6poreNE", !14, i64 0, !14, i64 4, !17, i64 8, !6, i64 56}
!17 = !{!"_ZTSSt3mapIiiSt4lessIiESaISt4pairIKiiEEE", !18, i64 0}
!18 = !{!"_ZTSSt8_Rb_treeIiSt4pairIKiiESt10_Select1stIS2_ESt4lessIiESaIS2_EE", !19, i64 0}
!19 = !{!"_ZTSNSt8_Rb_treeIiSt4pairIKiiESt10_Select1stIS2_ESt4lessIiESaIS2_EE13_Rb_tree_implIS6_Lb1EEE", !20, i64 0, !22, i64 8}
!20 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIiEE", !21, i64 0}
!21 = !{!"_ZTSSt4lessIiE"}
!22 = !{!"_ZTSSt15_Rb_tree_header", !23, i64 0, !10, i64 32}
!23 = !{!"_ZTSSt18_Rb_tree_node_base", !24, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!24 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!25 = !{!26, !27, i64 8}
!26 = !{!"_ZTS10medialBall", !6, i64 0, !27, i64 8, !27, i64 12, !27, i64 16, !28, i64 20, !27, i64 24, !28, i64 28, !28, i64 30, !28, i64 32, !28, i64 34, !28, i64 36, !6, i64 40, !6, i64 48, !6, i64 56}
!27 = !{!"float", !7, i64 0}
!28 = !{!"short", !7, i64 0}
!29 = !{!26, !27, i64 12}
!30 = !{!26, !27, i64 16}
!31 = !{i64 0, i64 8, !11, i64 8, i64 8, !11, i64 16, i64 8, !11}
!32 = !{!33, !12, i64 8}
!33 = !{!"_ZTS4var3IdE", !12, i64 0, !12, i64 8, !12, i64 16}
!34 = !{!26, !27, i64 24}


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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4var3IdEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24), double noundef, double noundef, double noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z16addSphereSegmentR4var3IdES1_dRmRSt6vectorIS0_SaIS0_EERS3_IiSaIiEES9_i(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), double noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z17addPoreSphereMeshRKSt6vectorIP6poreNESaIS1_EEmRKS_IP8throatNESaIS7_EERS_I4var3IdESaISD_EERS_IiSaIiEESJ_dj(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %1, ptr nocapture noundef nonnull readnone align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %5, double noundef %6, i32 noundef %7) local_unnamed_addr #3 {
  %9 = alloca i64, align 8
  %10 = alloca %class.var3, align 8
  %11 = alloca %class.var3, align 8
  store i64 %1, ptr %9, align 8, !tbaa !5
  %12 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIP6poreNESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %1) #4
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #4
  %14 = getelementptr inbounds i8, ptr %13, i64 56
  %15 = load ptr, ptr %14, align 8, !tbaa !11
  %16 = getelementptr inbounds i8, ptr %15, i64 8
  %17 = load float, ptr %16, align 8, !tbaa !22
  %18 = fpext float %17 to double
  %19 = getelementptr inbounds i8, ptr %15, i64 12
  %20 = load float, ptr %19, align 4, !tbaa !26
  %21 = fpext float %20 to double
  %22 = getelementptr inbounds i8, ptr %15, i64 16
  %23 = load float, ptr %22, align 8, !tbaa !27
  %24 = fpext float %23 to double
  call void @_ZN4var3IdEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %10, double noundef %18, double noundef %21, double noundef %24)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull align 8 dereferenceable(24) %10, i64 24, i1 false), !tbaa.struct !28
  %25 = getelementptr inbounds i8, ptr %11, i64 8
  %26 = load double, ptr %25, align 8, !tbaa !31
  %27 = fadd double %26, 0x3D719799812DEA11
  store double %27, ptr %25, align 8, !tbaa !31
  %28 = load ptr, ptr %14, align 8, !tbaa !11
  %29 = getelementptr inbounds i8, ptr %28, i64 24
  %30 = load float, ptr %29, align 8, !tbaa !33
  %31 = fpext float %30 to double
  %32 = fmul double %31, %6
  call void @_Z16addSphereSegmentR4var3IdES1_dRmRSt6vectorIS0_SaIS0_EERS3_IiSaIiEES9_i(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %11, double noundef %32, ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef %7)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #4
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 56}
!12 = !{!"_ZTS6poreNE", !13, i64 0, !13, i64 4, !14, i64 8, !10, i64 56}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSSt3mapIiiSt4lessIiESaISt4pairIKiiEEE", !15, i64 0}
!15 = !{!"_ZTSSt8_Rb_treeIiSt4pairIKiiESt10_Select1stIS2_ESt4lessIiESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSNSt8_Rb_treeIiSt4pairIKiiESt10_Select1stIS2_ESt4lessIiESaIS2_EE13_Rb_tree_implIS6_Lb1EEE", !17, i64 0, !19, i64 8}
!17 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIiEE", !18, i64 0}
!18 = !{!"_ZTSSt4lessIiE"}
!19 = !{!"_ZTSSt15_Rb_tree_header", !20, i64 0, !6, i64 32}
!20 = !{!"_ZTSSt18_Rb_tree_node_base", !21, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!21 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!22 = !{!23, !24, i64 8}
!23 = !{!"_ZTS10medialBall", !10, i64 0, !24, i64 8, !24, i64 12, !24, i64 16, !25, i64 20, !24, i64 24, !25, i64 28, !25, i64 30, !25, i64 32, !25, i64 34, !25, i64 36, !10, i64 40, !10, i64 48, !10, i64 56}
!24 = !{!"float", !7, i64 0}
!25 = !{!"short", !7, i64 0}
!26 = !{!23, !24, i64 12}
!27 = !{!23, !24, i64 16}
!28 = !{i64 0, i64 8, !29, i64 8, i64 8, !29, i64 16, i64 8, !29}
!29 = !{!30, !30, i64 0}
!30 = !{!"double", !7, i64 0}
!31 = !{!32, !30, i64 8}
!32 = !{!"_ZTS4var3IdE", !30, i64 0, !30, i64 8, !30, i64 16}
!33 = !{!23, !24, i64 24}


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