; LLVM IR from mackorone/mms :: old/v2/src/lib/pugixml (pugixml)

; 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.pugi::impl::(anonymous namespace)::xpath_node_set_raw" = type { i32, ptr, ptr, ptr }
%"class.pugi::xpath_node" = type { %"class.pugi::xml_node", %"class.pugi::xml_attribute" }
%"class.pugi::xml_node" = type { ptr }
%"class.pugi::xml_attribute" = type { ptr }
%"struct.pugi::impl::(anonymous namespace)::xpath_context" = type { %"class.pugi::xpath_node", i64, i64 }
%"struct.pugi::impl::(anonymous namespace)::xpath_stack_data" = type { [2 x %"struct.pugi::impl::(anonymous namespace)::xpath_memory_block"], %"class.pugi::impl::(anonymous namespace)::xpath_allocator", %"class.pugi::impl::(anonymous namespace)::xpath_allocator", %"struct.pugi::impl::(anonymous namespace)::xpath_stack" }
%"struct.pugi::impl::(anonymous namespace)::xpath_memory_block" = type { ptr, i64, [4096 x i8] }
%"class.pugi::impl::(anonymous namespace)::xpath_allocator" = type { ptr, i64 }
%"struct.pugi::impl::(anonymous namespace)::xpath_stack" = type { ptr, ptr }
%"class.pugi::xpath_query" = type { ptr, %"struct.pugi::xpath_parse_result" }
%"struct.pugi::xpath_parse_result" = type { ptr, i64 }

; 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN4pugi4impl12_GLOBAL__N_113xpath_contextC2ERKNS_10xpath_nodeEmm(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i64 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4pugi4impl12_GLOBAL__N_116xpath_stack_dataC2Ev(ptr noundef nonnull align 8 dereferenceable(8272)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN4pugi4impl12_GLOBAL__N_116xpath_stack_dataD2Ev(ptr noundef nonnull align 8 dereferenceable(8272)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZN4pugi4impl12_GLOBAL__N_125evaluate_node_set_prepareEPNS1_16xpath_query_implE(ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4pugi4impl12_GLOBAL__N_114xpath_ast_node13eval_node_setERKNS1_13xpath_contextERKNS1_11xpath_stackENS1_14nodeset_eval_tE(ptr dead_on_unwind noalias writable sret(%"class.pugi::impl::(anonymous namespace)::xpath_node_set_raw") align 8, ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local { ptr, ptr } @_ZNK4pugi11xpath_query13evaluate_nodeERKNS_10xpath_nodeE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.pugi::xpath_node", align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %"struct.pugi::impl::(anonymous namespace)::xpath_context", align 8
  %9 = alloca %"struct.pugi::impl::(anonymous namespace)::xpath_stack_data", align 8
  %10 = alloca %"class.pugi::impl::(anonymous namespace)::xpath_node_set_raw", align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %13 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %14 = getelementptr inbounds %"class.pugi::xpath_query", ptr %13, i32 0, i32 0
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = call noundef ptr @_ZN4pugi4impl12_GLOBAL__N_125evaluate_node_set_prepareEPNS1_16xpath_query_implE(ptr noundef %15)
  store ptr %16, ptr %6, align 8, !tbaa !5
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %20, label %19

19:                                               ; preds = %2
  call void @_ZN4pugi10xpath_nodeC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %3)
  store i32 1, ptr %7, align 4
  br label %35

20:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #3
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN4pugi4impl12_GLOBAL__N_113xpath_contextC2ERKNS_10xpath_nodeEmm(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(16) %21, i64 noundef 1, i64 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8272, ptr %9) #3
  call void @_ZN4pugi4impl12_GLOBAL__N_116xpath_stack_dataC2Ev(ptr noundef nonnull align 8 dereferenceable(8272) %9)
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #3
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.pugi::impl::(anonymous namespace)::xpath_stack_data", ptr %9, i32 0, i32 3
  invoke void @_ZN4pugi4impl12_GLOBAL__N_114xpath_ast_node13eval_node_setERKNS1_13xpath_contextERKNS1_11xpath_stackENS1_14nodeset_eval_tE(ptr dead_on_unwind writable sret(%"class.pugi::impl::(anonymous namespace)::xpath_node_set_raw") align 8 %10, ptr noundef nonnull align 8 dereferenceable(40) %22, ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(16) %23, i32 noundef 2)
          to label %24 unwind label %31

24:                                               ; preds = %20
  %25 = invoke { ptr, ptr } @_ZNK4pugi4impl12_GLOBAL__N_118xpath_node_set_raw5firstEv(ptr noundef nonnull align 8 dereferenceable(32) %10)
          to label %26 unwind label %31

26:                                               ; preds = %24
  %27 = getelementptr inbounds { ptr, ptr }, ptr %3, i32 0, i32 0
  %28 = extractvalue { ptr, ptr } %25, 0
  store ptr %28, ptr %27, align 8
  %29 = getelementptr inbounds { ptr, ptr }, ptr %3, i32 0, i32 1
  %30 = extractvalue { ptr, ptr } %25, 1
  store ptr %30, ptr %29, align 8
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #3
  call void @_ZN4pugi4impl12_GLOBAL__N_116xpath_stack_dataD2Ev(ptr noundef nonnull align 8 dereferenceable(8272) %9) #3
  call void @llvm.lifetime.end.p0(i64 8272, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #3
  br label %35

31:                                               ; preds = %24, %20
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %11, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #3
  call void @_ZN4pugi4impl12_GLOBAL__N_116xpath_stack_dataD2Ev(ptr noundef nonnull align 8 dereferenceable(8272) %9) #3
  call void @llvm.lifetime.end.p0(i64 8272, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %37

35:                                               ; preds = %26, %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %36 = load { ptr, ptr }, ptr %3, align 8
  ret { ptr, ptr } %36

37:                                               ; preds = %31
  %38 = load ptr, ptr %11, align 8
  %39 = load i32, ptr %12, align 4
  %40 = insertvalue { ptr, i32 } poison, ptr %38, 0
  %41 = insertvalue { ptr, i32 } %40, i32 %39, 1
  resume { ptr, i32 } %41
}

; Function Attrs: mustprogress uwtable
declare hidden { ptr, ptr } @_ZNK4pugi4impl12_GLOBAL__N_118xpath_node_set_raw5firstEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

declare void @_ZN4pugi10xpath_nodeC1Ev(ptr)

attributes #0 = { nocallback nofree nosync 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" }
attributes #2 = { 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 #3 = { 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, !6, i64 0}
!10 = !{!"_ZTSN4pugi11xpath_queryE", !6, i64 0, !11, i64 8}
!11 = !{!"_ZTSN4pugi18xpath_parse_resultE", !6, i64 0, !12, i64 8}
!12 = !{!"long", !7, i64 0}


; 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.pugi::impl::(anonymous namespace)::xpath_node_set_raw" = type { i32, ptr, ptr, ptr }
%"class.pugi::xpath_node" = type { %"class.pugi::xml_node", %"class.pugi::xml_attribute" }
%"class.pugi::xml_node" = type { ptr }
%"class.pugi::xml_attribute" = type { ptr }
%"struct.pugi::impl::(anonymous namespace)::xpath_context" = type { %"class.pugi::xpath_node", i64, i64 }
%"struct.pugi::impl::(anonymous namespace)::xpath_stack_data" = type { [2 x %"struct.pugi::impl::(anonymous namespace)::xpath_memory_block"], %"class.pugi::impl::(anonymous namespace)::xpath_allocator", %"class.pugi::impl::(anonymous namespace)::xpath_allocator", %"struct.pugi::impl::(anonymous namespace)::xpath_stack" }
%"struct.pugi::impl::(anonymous namespace)::xpath_memory_block" = type { ptr, i64, [4096 x i8] }
%"class.pugi::impl::(anonymous namespace)::xpath_allocator" = type { ptr, i64 }
%"struct.pugi::impl::(anonymous namespace)::xpath_stack" = type { ptr, ptr }

; 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN4pugi4impl12_GLOBAL__N_113xpath_contextC2ERKNS_10xpath_nodeEmm(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i64 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4pugi4impl12_GLOBAL__N_116xpath_stack_dataC2Ev(ptr noundef nonnull align 8 dereferenceable(8272)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN4pugi4impl12_GLOBAL__N_116xpath_stack_dataD2Ev(ptr noundef nonnull align 8 dereferenceable(8272)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZN4pugi4impl12_GLOBAL__N_125evaluate_node_set_prepareEPNS1_16xpath_query_implE(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4pugi4impl12_GLOBAL__N_114xpath_ast_node13eval_node_setERKNS1_13xpath_contextERKNS1_11xpath_stackENS1_14nodeset_eval_tE(ptr dead_on_unwind noalias writable sret(%"class.pugi::impl::(anonymous namespace)::xpath_node_set_raw") align 8, ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local { ptr, ptr } @_ZNK4pugi11xpath_query13evaluate_nodeERKNS_10xpath_nodeE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.pugi::xpath_node", align 8
  %4 = alloca %"struct.pugi::impl::(anonymous namespace)::xpath_context", align 8
  %5 = alloca %"struct.pugi::impl::(anonymous namespace)::xpath_stack_data", align 8
  %6 = alloca %"class.pugi::impl::(anonymous namespace)::xpath_node_set_raw", align 8
  %7 = load ptr, ptr %0, align 8, !tbaa !5
  %8 = tail call noundef ptr @_ZN4pugi4impl12_GLOBAL__N_125evaluate_node_set_prepareEPNS1_16xpath_query_implE(ptr noundef %7)
  %.not = icmp eq ptr %8, null
  br i1 %.not, label %9, label %10

9:                                                ; preds = %2
  call void @_ZN4pugi10xpath_nodeC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %3)
  %.fca.0.load.pre = load ptr, ptr %3, align 8
  %.fca.1.gep.phi.trans.insert = getelementptr inbounds i8, ptr %3, i64 8
  %.fca.1.load.pre = load ptr, ptr %.fca.1.gep.phi.trans.insert, align 8
  br label %19

10:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #3
  call void @_ZN4pugi4impl12_GLOBAL__N_113xpath_contextC2ERKNS_10xpath_nodeEmm(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 8 dereferenceable(16) %1, i64 noundef 1, i64 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8272, ptr nonnull %5) #3
  call void @_ZN4pugi4impl12_GLOBAL__N_116xpath_stack_dataC2Ev(ptr noundef nonnull align 8 dereferenceable(8272) %5)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #3
  %11 = getelementptr inbounds i8, ptr %5, i64 8256
  invoke void @_ZN4pugi4impl12_GLOBAL__N_114xpath_ast_node13eval_node_setERKNS1_13xpath_contextERKNS1_11xpath_stackENS1_14nodeset_eval_tE(ptr dead_on_unwind nonnull writable sret(%"class.pugi::impl::(anonymous namespace)::xpath_node_set_raw") align 8 %6, ptr noundef nonnull align 8 dereferenceable(40) %8, ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 8 dereferenceable(16) %11, i32 noundef 2)
          to label %12 unwind label %17

12:                                               ; preds = %10
  %13 = invoke { ptr, ptr } @_ZNK4pugi4impl12_GLOBAL__N_118xpath_node_set_raw5firstEv(ptr noundef nonnull align 8 dereferenceable(32) %6)
          to label %14 unwind label %17

14:                                               ; preds = %12
  %15 = extractvalue { ptr, ptr } %13, 0
  %16 = extractvalue { ptr, ptr } %13, 1
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #3
  call void @_ZN4pugi4impl12_GLOBAL__N_116xpath_stack_dataD2Ev(ptr noundef nonnull align 8 dereferenceable(8272) %5) #3
  call void @llvm.lifetime.end.p0(i64 8272, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #3
  br label %19

17:                                               ; preds = %12, %10
  %18 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #3
  call void @_ZN4pugi4impl12_GLOBAL__N_116xpath_stack_dataD2Ev(ptr noundef nonnull align 8 dereferenceable(8272) %5) #3
  call void @llvm.lifetime.end.p0(i64 8272, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #3
  resume { ptr, i32 } %18

19:                                               ; preds = %14, %9
  %.fca.1.load = phi ptr [ %16, %14 ], [ %.fca.1.load.pre, %9 ]
  %.fca.0.load = phi ptr [ %15, %14 ], [ %.fca.0.load.pre, %9 ]
  %.fca.0.insert = insertvalue { ptr, ptr } poison, ptr %.fca.0.load, 0
  %.fca.1.insert = insertvalue { ptr, ptr } %.fca.0.insert, ptr %.fca.1.load, 1
  ret { ptr, ptr } %.fca.1.insert
}

; Function Attrs: mustprogress uwtable
declare hidden { ptr, ptr } @_ZNK4pugi4impl12_GLOBAL__N_118xpath_node_set_raw5firstEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

declare void @_ZN4pugi10xpath_nodeC1Ev(ptr) local_unnamed_addr

attributes #0 = { mustprogress nocallback nofree nosync 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" }
attributes #2 = { 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 #3 = { 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, !7, i64 0}
!6 = !{!"_ZTSN4pugi11xpath_queryE", !7, i64 0, !10, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN4pugi18xpath_parse_resultE", !7, i64 0, !11, i64 8}
!11 = !{!"long", !8, i64 0}


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