; 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.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 @_ZNKSt6vectorIP8throatNESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK8throatNE4mb22Ev(ptr noundef nonnull align 8 dereferenceable(96)) #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 @_Z19addThroatSphereMeshRKSt6vectorIP8throatNESaIS1_EEmRKS_IP6poreNESaIS7_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 @_ZNKSt6vectorIP8throatNESaIS1_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 = call noundef ptr @_ZNK8throatNE4mb22Ev(ptr noundef nonnull align 8 dereferenceable(96) %25)
  %27 = getelementptr inbounds %class.medialBall, ptr %26, i32 0, i32 1
  %28 = load float, ptr %27, align 8, !tbaa !15
  %29 = fpext float %28 to double
  %30 = load ptr, ptr %17, align 8, !tbaa !5
  %31 = call noundef ptr @_ZNK8throatNE4mb22Ev(ptr noundef nonnull align 8 dereferenceable(96) %30)
  %32 = getelementptr inbounds %class.medialBall, ptr %31, i32 0, i32 2
  %33 = load float, ptr %32, align 4, !tbaa !19
  %34 = fpext float %33 to double
  %35 = load ptr, ptr %17, align 8, !tbaa !5
  %36 = call noundef ptr @_ZNK8throatNE4mb22Ev(ptr noundef nonnull align 8 dereferenceable(96) %35)
  %37 = getelementptr inbounds %class.medialBall, ptr %36, i32 0, i32 3
  %38 = load float, ptr %37, align 8, !tbaa !20
  %39 = fpext float %38 to double
  call void @_ZN4var3IdEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %18, double noundef %29, double noundef %34, double noundef %39)
  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 !21
  %40 = getelementptr inbounds %class.var3, ptr %18, i32 0, i32 1
  %41 = load double, ptr %40, align 8, !tbaa !22
  %42 = fadd double %41, 0x3DA5FD7FE1796495
  store double %42, ptr %40, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %43 = load ptr, ptr %17, align 8, !tbaa !5
  %44 = call noundef ptr @_ZNK8throatNE4mb22Ev(ptr noundef nonnull align 8 dereferenceable(96) %43)
  %45 = getelementptr inbounds %class.medialBall, ptr %44, i32 0, i32 5
  %46 = load float, ptr %45, align 8, !tbaa !24
  %47 = fpext float %46 to double
  %48 = load double, ptr %15, align 8, !tbaa !11
  %49 = fmul double %47, %48
  store double %49, ptr %20, align 8, !tbaa !11
  %50 = load double, ptr %20, align 8, !tbaa !11
  %51 = load ptr, ptr %12, align 8, !tbaa !5
  %52 = load ptr, ptr %13, align 8, !tbaa !5
  %53 = load ptr, ptr %14, align 8, !tbaa !5
  %54 = load i32, ptr %16, align 4, !tbaa !13
  call void @_Z16addSphereSegmentR4var3IdES1_dRmRSt6vectorIS0_SaIS0_EERS3_IiSaIiEES9_i(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 8 dereferenceable(24) %18, double noundef %50, ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(24) %51, ptr noundef nonnull align 8 dereferenceable(24) %52, ptr noundef nonnull align 8 dereferenceable(24) %53, i32 noundef %54)
  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, !17, i64 8}
!16 = !{!"_ZTS10medialBall", !6, i64 0, !17, i64 8, !17, i64 12, !17, i64 16, !18, i64 20, !17, i64 24, !18, i64 28, !18, i64 30, !18, i64 32, !18, i64 34, !18, i64 36, !6, i64 40, !6, i64 48, !6, i64 56}
!17 = !{!"float", !7, i64 0}
!18 = !{!"short", !7, i64 0}
!19 = !{!16, !17, i64 12}
!20 = !{!16, !17, i64 16}
!21 = !{i64 0, i64 8, !11, i64 8, i64 8, !11, i64 16, i64 8, !11}
!22 = !{!23, !12, i64 8}
!23 = !{!"_ZTS4var3IdE", !12, i64 0, !12, i64 8, !12, i64 16}
!24 = !{!16, !17, 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 @_ZNKSt6vectorIP8throatNESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK8throatNE4mb22Ev(ptr noundef nonnull align 8 dereferenceable(96)) 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 @_Z19addThroatSphereMeshRKSt6vectorIP8throatNESaIS1_EEmRKS_IP6poreNESaIS7_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 @_ZNKSt6vectorIP8throatNESaIS1_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 = tail call noundef ptr @_ZNK8throatNE4mb22Ev(ptr noundef nonnull align 8 dereferenceable(96) %13)
  %15 = getelementptr inbounds i8, ptr %14, i64 8
  %16 = load float, ptr %15, align 8, !tbaa !11
  %17 = fpext float %16 to double
  %18 = tail call noundef ptr @_ZNK8throatNE4mb22Ev(ptr noundef nonnull align 8 dereferenceable(96) %13)
  %19 = getelementptr inbounds i8, ptr %18, i64 12
  %20 = load float, ptr %19, align 4, !tbaa !15
  %21 = fpext float %20 to double
  %22 = tail call noundef ptr @_ZNK8throatNE4mb22Ev(ptr noundef nonnull align 8 dereferenceable(96) %13)
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  %24 = load float, ptr %23, align 8, !tbaa !16
  %25 = fpext float %24 to double
  call void @_ZN4var3IdEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %10, double noundef %17, double noundef %21, double noundef %25)
  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 !17
  %26 = getelementptr inbounds i8, ptr %10, i64 8
  %27 = load double, ptr %26, align 8, !tbaa !20
  %28 = fadd double %27, 0x3DA5FD7FE1796495
  store double %28, ptr %26, align 8, !tbaa !20
  %29 = call noundef ptr @_ZNK8throatNE4mb22Ev(ptr noundef nonnull align 8 dereferenceable(96) %13)
  %30 = getelementptr inbounds i8, ptr %29, i64 24
  %31 = load float, ptr %30, align 8, !tbaa !22
  %32 = fpext float %31 to double
  %33 = fmul double %32, %6
  call void @_Z16addSphereSegmentR4var3IdES1_dRmRSt6vectorIS0_SaIS0_EERS3_IiSaIiEES9_i(ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull align 8 dereferenceable(24) %10, double noundef %33, 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, !13, i64 8}
!12 = !{!"_ZTS10medialBall", !10, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !14, i64 20, !13, i64 24, !14, i64 28, !14, i64 30, !14, i64 32, !14, i64 34, !14, i64 36, !10, i64 40, !10, i64 48, !10, i64 56}
!13 = !{!"float", !7, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!12, !13, i64 12}
!16 = !{!12, !13, i64 16}
!17 = !{i64 0, i64 8, !18, i64 8, i64 8, !18, i64 16, i64 8, !18}
!18 = !{!19, !19, i64 0}
!19 = !{!"double", !7, i64 0}
!20 = !{!21, !19, i64 8}
!21 = !{!"_ZTS4var3IdE", !19, i64 0, !19, i64 8, !19, i64 16}
!22 = !{!12, !13, i64 24}


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