; 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: 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: nounwind uwtable
define dso_local i32 @ixmlNode_insertBefore(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #2
  store i32 0, ptr %8, align 4, !tbaa !9
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = icmp eq ptr %10, null
  br i1 %11, label %15, label %12

12:                                               ; preds = %3
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %16

15:                                               ; preds = %12, %3
  store i32 105, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %100

16:                                               ; preds = %12
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = call i32 @ixmlNode_allowChildren(ptr noundef %17, ptr noundef %18)
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %21, label %22

21:                                               ; preds = %16
  store i32 3, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %100

22:                                               ; preds = %16
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = call i32 @ixmlNode_isAncestor(ptr noundef %23, ptr noundef %24)
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %27, label %28

27:                                               ; preds = %22
  store i32 3, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %100

28:                                               ; preds = %22
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct._IXML_Node, ptr %29, i32 0, i32 12
  %31 = load ptr, ptr %30, align 8, !tbaa !11
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct._IXML_Node, ptr %32, i32 0, i32 12
  %34 = load ptr, ptr %33, align 8, !tbaa !11
  %35 = icmp ne ptr %31, %34
  br i1 %35, label %36, label %37

36:                                               ; preds = %28
  store i32 4, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %100

37:                                               ; preds = %28
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = call i32 @ixmlNode_isParent(ptr noundef %38, ptr noundef %39)
  %41 = icmp eq i32 %40, 0
  br i1 %41, label %42, label %43

42:                                               ; preds = %37
  store i32 8, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %100

43:                                               ; preds = %37
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %94

46:                                               ; preds = %43
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = call i32 @ixmlNode_isParent(ptr noundef %47, ptr noundef %48)
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %51, label %59

51:                                               ; preds = %46
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = call i32 @ixmlNode_removeChild(ptr noundef %52, ptr noundef %53, ptr noundef %6)
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct._IXML_Node, ptr %55, i32 0, i32 10
  store ptr null, ptr %56, align 8, !tbaa !13
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct._IXML_Node, ptr %57, i32 0, i32 9
  store ptr null, ptr %58, align 8, !tbaa !14
  br label %59

59:                                               ; preds = %51, %46
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct._IXML_Node, ptr %61, i32 0, i32 10
  store ptr %60, ptr %62, align 8, !tbaa !13
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct._IXML_Node, ptr %63, i32 0, i32 9
  %65 = load ptr, ptr %64, align 8, !tbaa !14
  %66 = icmp ne ptr %65, null
  br i1 %66, label %67, label %78

67:                                               ; preds = %59
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct._IXML_Node, ptr %69, i32 0, i32 9
  %71 = load ptr, ptr %70, align 8, !tbaa !14
  %72 = getelementptr inbounds %struct._IXML_Node, ptr %71, i32 0, i32 10
  store ptr %68, ptr %72, align 8, !tbaa !13
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct._IXML_Node, ptr %73, i32 0, i32 9
  %75 = load ptr, ptr %74, align 8, !tbaa !14
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct._IXML_Node, ptr %76, i32 0, i32 9
  store ptr %75, ptr %77, align 8, !tbaa !14
  br label %78

78:                                               ; preds = %67, %59
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct._IXML_Node, ptr %80, i32 0, i32 9
  store ptr %79, ptr %81, align 8, !tbaa !14
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct._IXML_Node, ptr %82, i32 0, i32 9
  %84 = load ptr, ptr %83, align 8, !tbaa !14
  %85 = icmp eq ptr %84, null
  br i1 %85, label %86, label %90

86:                                               ; preds = %78
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct._IXML_Node, ptr %88, i32 0, i32 8
  store ptr %87, ptr %89, align 8, !tbaa !15
  br label %90

90:                                               ; preds = %86, %78
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct._IXML_Node, ptr %92, i32 0, i32 7
  store ptr %91, ptr %93, align 8, !tbaa !16
  br label %98

94:                                               ; preds = %43
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = call i32 @ixmlNode_appendChild(ptr noundef %95, ptr noundef %96)
  store i32 %97, ptr %8, align 4, !tbaa !9
  br label %98

98:                                               ; preds = %94, %90
  %99 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %99, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %100

100:                                              ; preds = %98, %42, %36, %27, %21, %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #2
  %101 = load i32, ptr %4, align 4
  ret i32 %101
}

; Function Attrs: nounwind uwtable
declare hidden i32 @ixmlNode_allowChildren(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @ixmlNode_isAncestor(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @ixmlNode_isParent(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @ixmlNode_removeChild(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @ixmlNode_appendChild(ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 96}
!12 = !{!"_IXML_Node", !6, i64 0, !6, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !10, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}
!13 = !{!12, !6, i64 80}
!14 = !{!12, !6, i64 72}
!15 = !{!12, !6, i64 64}
!16 = !{!12, !6, i64 56}


; 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 i32 @ixmlNode_insertBefore(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = alloca ptr, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = icmp eq ptr %0, null
  %6 = icmp eq ptr %1, null
  %or.cond = or i1 %5, %6
  br i1 %or.cond, label %45, label %7

7:                                                ; preds = %3
  %8 = tail call i32 @ixmlNode_allowChildren(ptr noundef nonnull %0, ptr noundef nonnull %1)
  %9 = icmp eq i32 %8, 0
  br i1 %9, label %45, label %10

10:                                               ; preds = %7
  %11 = tail call i32 @ixmlNode_isAncestor(ptr noundef nonnull %1, ptr noundef nonnull %0)
  %.not = icmp eq i32 %11, 0
  br i1 %.not, label %12, label %45

12:                                               ; preds = %10
  %13 = getelementptr inbounds i8, ptr %0, i64 96
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  %15 = getelementptr inbounds i8, ptr %1, i64 96
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %.not24 = icmp eq ptr %14, %16
  br i1 %.not24, label %17, label %45

17:                                               ; preds = %12
  %18 = tail call i32 @ixmlNode_isParent(ptr noundef nonnull %0, ptr noundef %2)
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %45, label %20

20:                                               ; preds = %17
  %.not25 = icmp eq ptr %2, null
  br i1 %.not25, label %43, label %21

21:                                               ; preds = %20
  %22 = tail call i32 @ixmlNode_isParent(ptr noundef nonnull %0, ptr noundef nonnull %1)
  %.not26 = icmp eq i32 %22, 0
  br i1 %.not26, label %27, label %23

23:                                               ; preds = %21
  %24 = call i32 @ixmlNode_removeChild(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %4)
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %25, i64 72
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %26, i8 0, i64 16, i1 false)
  br label %27

27:                                               ; preds = %23, %21
  %28 = phi ptr [ %25, %23 ], [ %1, %21 ]
  %29 = getelementptr inbounds i8, ptr %28, i64 80
  store ptr %2, ptr %29, align 8, !tbaa !12
  %30 = getelementptr inbounds i8, ptr %2, i64 72
  %31 = load ptr, ptr %30, align 8, !tbaa !13
  %.not27 = icmp eq ptr %31, null
  br i1 %.not27, label %35, label %32

32:                                               ; preds = %27
  %33 = getelementptr inbounds i8, ptr %31, i64 80
  store ptr %28, ptr %33, align 8, !tbaa !12
  %34 = getelementptr inbounds i8, ptr %28, i64 72
  store ptr %31, ptr %34, align 8, !tbaa !13
  br label %35

35:                                               ; preds = %32, %27
  store ptr %28, ptr %30, align 8, !tbaa !13
  %36 = getelementptr inbounds i8, ptr %28, i64 72
  %37 = load ptr, ptr %36, align 8, !tbaa !13
  %38 = icmp eq ptr %37, null
  br i1 %38, label %39, label %41

39:                                               ; preds = %35
  %40 = getelementptr inbounds i8, ptr %0, i64 64
  store ptr %28, ptr %40, align 8, !tbaa !14
  br label %41

41:                                               ; preds = %39, %35
  %42 = getelementptr inbounds i8, ptr %28, i64 56
  store ptr %0, ptr %42, align 8, !tbaa !15
  br label %45

43:                                               ; preds = %20
  %44 = tail call i32 @ixmlNode_appendChild(ptr noundef nonnull %0, ptr noundef nonnull %1)
  br label %45

45:                                               ; preds = %41, %43, %17, %12, %10, %7, %3
  %.019 = phi i32 [ 105, %3 ], [ 3, %7 ], [ 3, %10 ], [ 4, %12 ], [ 8, %17 ], [ 0, %41 ], [ %44, %43 ]
  ret i32 %.019
}

; Function Attrs: nounwind uwtable
declare hidden i32 @ixmlNode_allowChildren(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @ixmlNode_isAncestor(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @ixmlNode_isParent(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @ixmlNode_removeChild(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @ixmlNode_appendChild(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 nounwind willreturn memory(argmem: write) }

!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 96}
!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 = !{!10, !6, i64 80}
!13 = !{!10, !6, i64 72}
!14 = !{!10, !6, i64 64}
!15 = !{!10, !6, i64 56}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass