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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4PoreC2ERK10CommonDatai4var3IdEddddbbdRSt6vectorIP4ElemSaIS7_EEi(ptr noundef nonnull align 8 dereferenceable(408) %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, i1 noundef zeroext %8, i1 noundef zeroext %9, double noundef %10, ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef %12) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %21 = alloca i8, align 1
  %22 = alloca i8, align 1
  %23 = alloca double, align 8
  %24 = alloca ptr, align 8
  %25 = alloca i32, align 4
  %26 = alloca %class.var3, align 8
  %27 = alloca ptr, align 8
  %28 = alloca i32, align 4
  store ptr %0, ptr %14, align 8, !tbaa !5
  store ptr %1, ptr %15, align 8, !tbaa !5
  store i32 %2, ptr %16, align 4, !tbaa !9
  store double %4, ptr %17, align 8, !tbaa !11
  store double %5, ptr %18, align 8, !tbaa !11
  store double %6, ptr %19, align 8, !tbaa !11
  store double %7, ptr %20, align 8, !tbaa !11
  %29 = zext i1 %8 to i8
  store i8 %29, ptr %21, align 1, !tbaa !13
  %30 = zext i1 %9 to i8
  store i8 %30, ptr %22, align 1, !tbaa !13
  store double %10, ptr %23, align 8, !tbaa !11
  store ptr %11, ptr %24, align 8, !tbaa !5
  store i32 %12, ptr %25, align 4, !tbaa !9
  %31 = load ptr, ptr %14, align 8
  %32 = load ptr, ptr %15, align 8, !tbaa !5
  %33 = load i32, ptr %16, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %26, ptr align 8 %3, i64 24, i1 false), !tbaa.struct !15
  %34 = load double, ptr %17, align 8, !tbaa !11
  %35 = load double, ptr %18, align 8, !tbaa !11
  %36 = load double, ptr %19, align 8, !tbaa !11
  %37 = load double, ptr %20, align 8, !tbaa !11
  %38 = load ptr, ptr %24, align 8, !tbaa !5
  %39 = call noundef i64 @_ZNKSt6vectorIP4ElemSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %38) #5
  %40 = trunc i64 %39 to i32
  %41 = load i32, ptr %25, align 4, !tbaa !9
  call void @_ZN4ElemC2ERK10CommonDatai4var3IdEddddibi(ptr noundef nonnull align 8 dereferenceable(408) %31, ptr noundef nonnull align 8 dereferenceable(1972) %32, i32 noundef %33, ptr noundef byval(%class.var3) align 8 %26, double noundef %34, double noundef %35, double noundef %36, double noundef %37, i32 noundef %40, i1 noundef zeroext true, i32 noundef %41)
  store ptr getelementptr inbounds inrange(-16, 112) ({ [16 x ptr] }, ptr @_ZTV4Pore, i32 0, i32 0, i32 2), ptr %31, align 8, !tbaa !16
  %42 = load i8, ptr %22, align 1, !tbaa !13, !range !18, !noundef !19
  %43 = trunc i8 %42 to i1
  %44 = getelementptr inbounds %class.Elem, ptr %31, i32 0, i32 12
  %45 = zext i1 %43 to i8
  store i8 %45, ptr %44, align 1, !tbaa !20
  %46 = load i8, ptr %21, align 1, !tbaa !13, !range !18, !noundef !19
  %47 = trunc i8 %46 to i1
  %48 = getelementptr inbounds %class.Elem, ptr %31, i32 0, i32 11
  %49 = zext i1 %47 to i8
  store i8 %49, ptr %48, align 8, !tbaa !29
  %50 = load ptr, ptr %24, align 8, !tbaa !5
  %51 = getelementptr inbounds %class.Elem, ptr %31, i32 0, i32 8
  %52 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIP4ElemSaIS1_EEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(24) %51, ptr noundef nonnull align 8 dereferenceable(24) %50)
          to label %53 unwind label %56

53:                                               ; preds = %13
  %54 = getelementptr inbounds %class.Elem, ptr %31, i32 0, i32 28
  invoke void @_ZN4Elem20setGravityCorrectionERK4var3IdE(ptr noundef nonnull align 8 dereferenceable(408) %31, ptr noundef nonnull align 8 dereferenceable(24) %54)
          to label %55 unwind label %56

55:                                               ; preds = %53
  ret void

56:                                               ; preds = %53, %13
  %57 = landingpad { ptr, i32 }
          cleanup
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %27, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %28, align 4
  call void @_ZN4ElemD2Ev(ptr noundef nonnull align 8 dereferenceable(408) %31) #5
  br label %60

60:                                               ; preds = %56
  %61 = load ptr, ptr %27, align 8
  %62 = load i32, ptr %28, align 4
  %63 = insertvalue { ptr, i32 } poison, ptr %61, 0
  %64 = insertvalue { ptr, i32 } %63, i32 %62, 1
  resume { ptr, i32 } %64
}

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

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 #3

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

declare i32 @__gxx_personality_v0(...)

declare void @_ZN4Elem20setGravityCorrectionERK4var3IdE(ptr noundef nonnull align 8 dereferenceable(408), ptr noundef nonnull align 8 dereferenceable(24)) #3

; Function Attrs: nounwind
declare void @_ZN4ElemD2Ev(ptr noundef nonnull align 8 dereferenceable(408)) unnamed_addr #4

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 = { 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 = { "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 "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 #5 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i64 0, i64 8, !11, i64 8, i64 8, !11, i64 16, i64 8, !11}
!16 = !{!17, !17, i64 0}
!17 = !{!"vtable pointer", !8, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!21, !14, i64 305}
!21 = !{!"_ZTS4Elem", !22, i64 0, !7, i64 104, !14, i64 224, !10, i64 228, !6, i64 232, !12, i64 240, !12, i64 248, !10, i64 256, !24, i64 264, !6, i64 288, !12, i64 296, !14, i64 304, !14, i64 305, !14, i64 306, !14, i64 307, !14, i64 308, !14, i64 309, !14, i64 310, !14, i64 311, !14, i64 312, !14, i64 313, !23, i64 320, !23, i64 336, !23, i64 352, !10, i64 368, !10, i64 372, !10, i64 376, !10, i64 380, !28, i64 384}
!22 = !{!"_ZTS4Apex", !14, 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, !14, i64 80, !14, i64 81, !14, i64 82, !14, i64 83, !23, i64 88}
!23 = !{!"_ZTSSt4pairIidE", !10, i64 0, !12, i64 8}
!24 = !{!"_ZTSSt6vectorIP4ElemSaIS1_EE", !25, i64 0}
!25 = !{!"_ZTSSt12_Vector_baseIP4ElemSaIS1_EE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIP4ElemSaIS1_EE12_Vector_implE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIP4ElemSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!28 = !{!"_ZTS4var3IdE", !12, i64 0, !12, i64 8, !12, i64 16}
!29 = !{!21, !14, i64 304}


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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4PoreC2ERK10CommonDatai4var3IdEddddbbdRSt6vectorIP4ElemSaIS7_EEi(ptr noundef nonnull align 8 dereferenceable(408) %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, i1 noundef zeroext %8, i1 noundef zeroext %9, double noundef %10, ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef %12) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %14 = zext i1 %8 to i8
  %15 = zext i1 %9 to i8
  %16 = tail call noundef i64 @_ZNKSt6vectorIP4ElemSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11) #4
  %17 = trunc i64 %16 to i32
  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 %17, i1 noundef zeroext true, i32 noundef %12)
  store ptr getelementptr inbounds inrange(-16, 112) (i8, ptr @_ZTV4Pore, i64 16), ptr %0, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %0, i64 305
  store i8 %15, ptr %18, align 1, !tbaa !8
  %19 = getelementptr inbounds i8, ptr %0, i64 304
  store i8 %14, ptr %19, align 8, !tbaa !22
  %20 = getelementptr inbounds i8, ptr %0, i64 264
  %21 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIP4ElemSaIS1_EEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(24) %20, ptr noundef nonnull align 8 dereferenceable(24) %11)
          to label %22 unwind label %25

22:                                               ; preds = %13
  %23 = getelementptr inbounds i8, ptr %0, i64 384
  invoke void @_ZN4Elem20setGravityCorrectionERK4var3IdE(ptr noundef nonnull align 8 dereferenceable(408) %0, ptr noundef nonnull align 8 dereferenceable(24) %23)
          to label %24 unwind label %25

24:                                               ; preds = %22
  ret void

25:                                               ; preds = %22, %13
  %26 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN4ElemD2Ev(ptr noundef nonnull align 8 dereferenceable(408) %0) #4
  resume { ptr, i32 } %26
}

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

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

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

declare i32 @__gxx_personality_v0(...)

declare void @_ZN4Elem20setGravityCorrectionERK4var3IdE(ptr noundef nonnull align 8 dereferenceable(408), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

; Function Attrs: nounwind
declare void @_ZN4ElemD2Ev(ptr noundef nonnull align 8 dereferenceable(408)) unnamed_addr #3

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


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