; LLVM IR from pupnp/pupnp :: ixml/src (node)

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

%struct._IXML_Node = type { ptr, ptr, i32, ptr, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr }

; Function Attrs: nounwind uwtable
define dso_local void @ixmlNode_free(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = icmp ne ptr %8, null
  br i1 %9, label %10, label %88

10:                                               ; preds = %1
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %11, ptr %4, align 8, !tbaa !5
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct._IXML_Node, ptr %12, i32 0, i32 8
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  store ptr %14, ptr %5, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %83, %10
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %16, ptr %3, align 8, !tbaa !5
  br label %17

17:                                               ; preds = %41, %15
  br label %18

18:                                               ; preds = %21, %17
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %26

21:                                               ; preds = %18
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %22, ptr %4, align 8, !tbaa !5
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct._IXML_Node, ptr %23, i32 0, i32 8
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  store ptr %25, ptr %3, align 8, !tbaa !5
  br label %18, !llvm.loop !12

26:                                               ; preds = %18
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %27, ptr %3, align 8, !tbaa !5
  br label %28

28:                                               ; preds = %31, %26
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = icmp ne ptr %29, null
  br i1 %30, label %31, label %36

31:                                               ; preds = %28
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %32, ptr %4, align 8, !tbaa !5
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._IXML_Node, ptr %33, i32 0, i32 10
  %35 = load ptr, ptr %34, align 8, !tbaa !14
  store ptr %35, ptr %3, align 8, !tbaa !5
  br label %28, !llvm.loop !15

36:                                               ; preds = %28
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %37, ptr %3, align 8, !tbaa !5
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct._IXML_Node, ptr %38, i32 0, i32 8
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  store ptr %40, ptr %5, align 8, !tbaa !5
  br label %41

41:                                               ; preds = %36
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = icmp ne ptr %42, null
  br i1 %43, label %17, label %44, !llvm.loop !16

44:                                               ; preds = %41
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct._IXML_Node, ptr %45, i32 0, i32 11
  %47 = load ptr, ptr %46, align 8, !tbaa !17
  store ptr %47, ptr %6, align 8, !tbaa !5
  br label %48

48:                                               ; preds = %51, %44
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %57

51:                                               ; preds = %48
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct._IXML_Node, ptr %52, i32 0, i32 10
  %54 = load ptr, ptr %53, align 8, !tbaa !14
  store ptr %54, ptr %7, align 8, !tbaa !5
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  call void @ixmlNode_freeSingleNode(ptr noundef %55)
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %56, ptr %6, align 8, !tbaa !5
  br label %48, !llvm.loop !18

57:                                               ; preds = %48
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct._IXML_Node, ptr %58, i32 0, i32 11
  store ptr null, ptr %59, align 8, !tbaa !17
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = load ptr, ptr %2, align 8, !tbaa !5
  %62 = icmp ne ptr %60, %61
  br i1 %62, label %63, label %81

63:                                               ; preds = %57
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct._IXML_Node, ptr %64, i32 0, i32 9
  %66 = load ptr, ptr %65, align 8, !tbaa !19
  %67 = icmp ne ptr %66, null
  br i1 %67, label %68, label %74

68:                                               ; preds = %63
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct._IXML_Node, ptr %69, i32 0, i32 9
  %71 = load ptr, ptr %70, align 8, !tbaa !19
  store ptr %71, ptr %5, align 8, !tbaa !5
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct._IXML_Node, ptr %72, i32 0, i32 10
  store ptr null, ptr %73, align 8, !tbaa !14
  br label %80

74:                                               ; preds = %63
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct._IXML_Node, ptr %75, i32 0, i32 7
  %77 = load ptr, ptr %76, align 8, !tbaa !20
  store ptr %77, ptr %5, align 8, !tbaa !5
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct._IXML_Node, ptr %78, i32 0, i32 8
  store ptr null, ptr %79, align 8, !tbaa !9
  br label %80

80:                                               ; preds = %74, %68
  br label %81

81:                                               ; preds = %80, %57
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  call void @ixmlNode_freeSingleNode(ptr noundef %82)
  br label %83

83:                                               ; preds = %81
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = load ptr, ptr %2, align 8, !tbaa !5
  %86 = icmp ne ptr %84, %85
  br i1 %86, label %15, label %87, !llvm.loop !21

87:                                               ; preds = %83
  br label %88

88:                                               ; preds = %87, %1
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #2
  ret void
}

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

; Function Attrs: nounwind uwtable
declare hidden void @ixmlNode_freeSingleNode(ptr noundef) #0

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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/C++ TBAA"}
!9 = !{!10, !6, i64 64}
!10 = !{!"_IXML_Node", !6, i64 0, !6, i64 8, !11, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 80}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = !{!10, !6, i64 88}
!18 = distinct !{!18, !13}
!19 = !{!10, !6, i64 72}
!20 = !{!10, !6, i64 56}
!21 = distinct !{!21, !13}


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

; Function Attrs: nounwind uwtable
define dso_local void @ixmlNode_free(ptr noundef %0) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %27, label %2

2:                                                ; preds = %1
  %3 = getelementptr inbounds i8, ptr %0, i64 64
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  br label %5

5:                                                ; preds = %.backedge, %2
  %.134 = phi ptr [ %0, %2 ], [ %.249, %.backedge ]
  %.0 = phi ptr [ %4, %2 ], [ %.0.be, %.backedge ]
  %.not3946 = icmp eq ptr %.0, null
  br i1 %.not3946, label %.lr.ph50.preheader, label %.lr.ph

.lr.ph:                                           ; preds = %5, %.lr.ph
  %.147 = phi ptr [ %7, %.lr.ph ], [ %.0, %5 ]
  %6 = getelementptr inbounds i8, ptr %.147, i64 64
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %.not39 = icmp eq ptr %7, null
  br i1 %.not39, label %.lr.ph50.preheader, label %.lr.ph, !llvm.loop !11

.lr.ph50.preheader:                               ; preds = %.lr.ph, %5
  %.249.ph = phi ptr [ %.134, %5 ], [ %.147, %.lr.ph ]
  br label %.lr.ph50

.lr.ph50:                                         ; preds = %.lr.ph50.preheader, %.lr.ph50
  %.249 = phi ptr [ %9, %.lr.ph50 ], [ %.249.ph, %.lr.ph50.preheader ]
  %8 = getelementptr inbounds i8, ptr %.249, i64 80
  %9 = load ptr, ptr %8, align 8, !tbaa !13
  %.not40 = icmp eq ptr %9, null
  br i1 %.not40, label %._crit_edge, label %.lr.ph50, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph50
  %10 = getelementptr inbounds i8, ptr %.249, i64 64
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %.not41 = icmp eq ptr %11, null
  br i1 %.not41, label %12, label %.backedge

.backedge:                                        ; preds = %._crit_edge, %26
  %.0.be = phi ptr [ %.249, %._crit_edge ], [ %.132, %26 ]
  br label %5, !llvm.loop !15

12:                                               ; preds = %._crit_edge
  %13 = getelementptr inbounds i8, ptr %.249, i64 88
  %14 = load ptr, ptr %13, align 8, !tbaa !16
  %.not4252 = icmp eq ptr %14, null
  br i1 %.not4252, label %._crit_edge56, label %.lr.ph55

.lr.ph55:                                         ; preds = %12, %.lr.ph55
  %.03053 = phi ptr [ %16, %.lr.ph55 ], [ %14, %12 ]
  %15 = getelementptr inbounds i8, ptr %.03053, i64 80
  %16 = load ptr, ptr %15, align 8, !tbaa !13
  tail call void @ixmlNode_freeSingleNode(ptr noundef nonnull %.03053)
  %.not42 = icmp eq ptr %16, null
  br i1 %.not42, label %._crit_edge56, label %.lr.ph55, !llvm.loop !17

._crit_edge56:                                    ; preds = %.lr.ph55, %12
  store ptr null, ptr %13, align 8, !tbaa !16
  %.not43 = icmp eq ptr %.249, %0
  br i1 %.not43, label %.thread, label %17

.thread:                                          ; preds = %._crit_edge56
  tail call void @ixmlNode_freeSingleNode(ptr noundef nonnull %.249)
  br label %27

17:                                               ; preds = %._crit_edge56
  %18 = getelementptr inbounds i8, ptr %.249, i64 72
  %19 = load ptr, ptr %18, align 8, !tbaa !18
  %.not44 = icmp eq ptr %19, null
  br i1 %.not44, label %22, label %20

20:                                               ; preds = %17
  %21 = getelementptr inbounds i8, ptr %19, i64 80
  br label %26

22:                                               ; preds = %17
  %23 = getelementptr inbounds i8, ptr %.249, i64 56
  %24 = load ptr, ptr %23, align 8, !tbaa !19
  %25 = getelementptr inbounds i8, ptr %24, i64 64
  br label %26

26:                                               ; preds = %20, %22
  %.sink = phi ptr [ %21, %20 ], [ %25, %22 ]
  %.132 = phi ptr [ %19, %20 ], [ %24, %22 ]
  store ptr null, ptr %.sink, align 8, !tbaa !20
  tail call void @ixmlNode_freeSingleNode(ptr noundef nonnull %.249)
  br label %.backedge

27:                                               ; preds = %.thread, %1
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden void @ixmlNode_freeSingleNode(ptr noundef) local_unnamed_addr #0

attributes #0 = { 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" }

!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 64}
!6 = !{!"_IXML_Node", !7, i64 0, !7, i64 8, !10, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !10, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!6, !7, i64 80}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = !{!6, !7, i64 88}
!17 = distinct !{!17, !12}
!18 = !{!6, !7, i64 72}
!19 = !{!6, !7, i64 56}
!20 = !{!7, !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass