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

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

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

declare zeroext i16 @ixmlNode_getNodeType(ptr noundef) #1

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

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

16:                                               ; preds = %13, %2
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %17, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %67

18:                                               ; preds = %13
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = call zeroext i16 @ixmlNode_getNodeType(ptr noundef %19)
  %21 = zext i16 %20 to i32
  %22 = icmp eq i32 %21, 1
  br i1 %22, label %23, label %52

23:                                               ; preds = %18
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = call ptr @ixmlNode_getNodeName(ptr noundef %24)
  store ptr %25, ptr %8, align 8, !tbaa !5
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %30

28:                                               ; preds = %23
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %29, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %67

30:                                               ; preds = %23
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = call i32 @strcmp(ptr noundef %31, ptr noundef %32) #5
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %35, label %38

35:                                               ; preds = %30
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %36, ptr %6, align 8, !tbaa !5
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %37, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %67

38:                                               ; preds = %30
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = call ptr @ixmlNode_getFirstChild(ptr noundef %39)
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = call ptr @ixmlDocument_getElementById(ptr noundef %40, ptr noundef %41)
  store ptr %42, ptr %6, align 8, !tbaa !5
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = icmp eq ptr %43, null
  br i1 %44, label %45, label %50

45:                                               ; preds = %38
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = call ptr @ixmlNode_getNextSibling(ptr noundef %46)
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = call ptr @ixmlDocument_getElementById(ptr noundef %47, ptr noundef %48)
  store ptr %49, ptr %6, align 8, !tbaa !5
  br label %50

50:                                               ; preds = %45, %38
  br label %51

51:                                               ; preds = %50
  br label %65

52:                                               ; preds = %18
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = call ptr @ixmlNode_getFirstChild(ptr noundef %53)
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = call ptr @ixmlDocument_getElementById(ptr noundef %54, ptr noundef %55)
  store ptr %56, ptr %6, align 8, !tbaa !5
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = icmp eq ptr %57, null
  br i1 %58, label %59, label %64

59:                                               ; preds = %52
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = call ptr @ixmlNode_getNextSibling(ptr noundef %60)
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = call ptr @ixmlDocument_getElementById(ptr noundef %61, ptr noundef %62)
  store ptr %63, ptr %6, align 8, !tbaa !5
  br label %64

64:                                               ; preds = %59, %52
  br label %65

65:                                               ; preds = %64, %51
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %66, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %67

67:                                               ; preds = %65, %35, %28, %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %68 = load ptr, ptr %3, align 8
  ret ptr %68
}

declare ptr @ixmlNode_getNodeName(ptr noundef) #1

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #3

declare ptr @ixmlNode_getFirstChild(ptr noundef) #1

declare ptr @ixmlNode_getNextSibling(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 willreturn memory(read) "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 }
attributes #5 = { nounwind willreturn memory(read) }

!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"}


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

declare zeroext i16 @ixmlNode_getNodeType(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local ptr @ixmlDocument_getElementById(ptr noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = icmp eq ptr %1, null
  %4 = icmp eq ptr %0, null
  %or.cond32 = or i1 %3, %4
  br i1 %or.cond32, label %._crit_edge, label %.lr.ph.split

.lr.ph.split:                                     ; preds = %2, %tailrecurse.backedge
  %.tr33 = phi ptr [ %17, %tailrecurse.backedge ], [ %0, %2 ]
  %5 = tail call zeroext i16 @ixmlNode_getNodeType(ptr noundef nonnull %.tr33) #3
  %6 = icmp eq i16 %5, 1
  br i1 %6, label %7, label %19

7:                                                ; preds = %.lr.ph.split
  %8 = tail call ptr @ixmlNode_getNodeName(ptr noundef nonnull %.tr33) #3
  %9 = icmp eq ptr %8, null
  br i1 %9, label %._crit_edge, label %10

10:                                               ; preds = %7
  %11 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %8) #4
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %._crit_edge, label %13

13:                                               ; preds = %10
  %14 = tail call ptr @ixmlNode_getFirstChild(ptr noundef nonnull %.tr33) #3
  %15 = tail call ptr @ixmlDocument_getElementById(ptr noundef %14, ptr noundef nonnull %1)
  %16 = icmp eq ptr %15, null
  br i1 %16, label %tailrecurse.backedge, label %._crit_edge

tailrecurse.backedge:                             ; preds = %13, %19
  %17 = tail call ptr @ixmlNode_getNextSibling(ptr noundef nonnull %.tr33) #3
  %18 = icmp eq ptr %17, null
  br i1 %18, label %._crit_edge, label %.lr.ph.split

19:                                               ; preds = %.lr.ph.split
  %20 = tail call ptr @ixmlNode_getFirstChild(ptr noundef nonnull %.tr33) #3
  %21 = tail call ptr @ixmlDocument_getElementById(ptr noundef %20, ptr noundef nonnull %1)
  %22 = icmp eq ptr %21, null
  br i1 %22, label %tailrecurse.backedge, label %._crit_edge

._crit_edge:                                      ; preds = %tailrecurse.backedge, %7, %10, %19, %13, %2
  %.0 = phi ptr [ null, %2 ], [ %15, %13 ], [ %21, %19 ], [ %.tr33, %10 ], [ null, %7 ], [ null, %tailrecurse.backedge ]
  ret ptr %.0
}

declare ptr @ixmlNode_getNodeName(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #2

declare ptr @ixmlNode_getFirstChild(ptr noundef) local_unnamed_addr #0

declare ptr @ixmlNode_getNextSibling(ptr noundef) local_unnamed_addr #0

attributes #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 = { 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 nofree nounwind willreturn memory(argmem: read) "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 }
attributes #4 = { nounwind willreturn memory(read) }

!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)"}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass