; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe (Ip6Nd)

; 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._IP6_NEIGHBOR_ENTRY = type { %struct._LIST_ENTRY, %struct._LIST_ENTRY, i64, i8, i8, i8, %struct.EFI_IPv6_ADDRESS, %struct.EFI_MAC_ADDRESS, i32, i32, i32, %struct._LIST_ENTRY, ptr, ptr }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }
%struct.EFI_MAC_ADDRESS = type { [32 x i8] }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct.IP6_LINK_TX_TOKEN = type { i32, %struct._LIST_ENTRY, ptr, ptr, ptr, ptr, %struct.EFI_MAC_ADDRESS, %struct.EFI_MAC_ADDRESS, %struct.EFI_MANAGED_NETWORK_COMPLETION_TOKEN, %struct.EFI_MANAGED_NETWORK_TRANSMIT_DATA }
%struct.EFI_MANAGED_NETWORK_COMPLETION_TOKEN = type { ptr, i64, %union.anon }
%union.anon = type { ptr }
%struct.EFI_MANAGED_NETWORK_TRANSMIT_DATA = type { ptr, ptr, i16, i32, i16, i16, [1 x %struct.EFI_MANAGED_NETWORK_FRAGMENT_DATA] }
%struct.EFI_MANAGED_NETWORK_FRAGMENT_DATA = type { i32, ptr }
%struct.NET_BUF = type { i32, i64, %struct._LIST_ENTRY, %union.NET_IP_HEAD, ptr, ptr, [64 x i8], ptr, i32, i32, [1 x %struct.NET_BLOCK_OP] }
%union.NET_IP_HEAD = type { ptr }
%struct.NET_BLOCK_OP = type { ptr, ptr, ptr, ptr, i32 }
%struct._EFI_IP6_HEADER = type { i16, i16, i16, i8, i8, %struct.EFI_IPv6_ADDRESS, %struct.EFI_IPv6_ADDRESS }

; 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 void @FreePool(ptr noundef) #1

declare ptr @RemoveEntryList(ptr noundef) #1

declare zeroext i8 @IsListEmpty(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i64 @Ip6FreeNeighborEntry(ptr noundef %0, ptr noundef %1, i8 noundef zeroext %2, i8 noundef zeroext %3, i64 noundef %4, ptr noundef %5, ptr noundef %6) #2 {
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i8, align 1
  %12 = alloca i8, align 1
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store i8 %2, ptr %11, align 1, !tbaa !9
  store i8 %3, ptr %12, align 1, !tbaa !9
  store i64 %4, ptr %13, align 8, !tbaa !10
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %21 = load i8, ptr %12, align 1, !tbaa !9
  %22 = zext i8 %21 to i32
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %24, label %28

24:                                               ; preds = %7
  %25 = load ptr, ptr %14, align 8, !tbaa !5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %27, label %28

27:                                               ; preds = %24
  store i64 -9223372036854775806, ptr %8, align 8
  store i32 1, ptr %20, align 4
  br label %146

28:                                               ; preds = %24, %7
  %29 = load ptr, ptr %10, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct._IP6_NEIGHBOR_ENTRY, ptr %29, i32 0, i32 11
  %31 = getelementptr inbounds %struct._LIST_ENTRY, ptr %30, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !12
  store ptr %32, ptr %17, align 8, !tbaa !5
  %33 = load ptr, ptr %17, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._LIST_ENTRY, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !17
  store ptr %35, ptr %18, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %98, %28
  %37 = load ptr, ptr %17, align 8, !tbaa !5
  %38 = load ptr, ptr %10, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct._IP6_NEIGHBOR_ENTRY, ptr %38, i32 0, i32 11
  %40 = icmp ne ptr %37, %39
  br i1 %40, label %41, label %103

41:                                               ; preds = %36
  %42 = load ptr, ptr %17, align 8, !tbaa !5
  %43 = ptrtoint ptr %42 to i64
  %44 = sub i64 %43, ptrtoint (ptr getelementptr inbounds (%struct.IP6_LINK_TX_TOKEN, ptr null, i32 0, i32 1) to i64)
  %45 = inttoptr i64 %44 to ptr
  store ptr %45, ptr %16, align 8, !tbaa !5
  %46 = load i8, ptr %11, align 1, !tbaa !9
  %47 = zext i8 %46 to i32
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %73

49:                                               ; preds = %41
  %50 = load ptr, ptr %16, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %50, i32 0, i32 4
  %52 = load ptr, ptr %51, align 8, !tbaa !18
  %53 = getelementptr inbounds %struct.NET_BUF, ptr %52, i32 0, i32 3
  %54 = load ptr, ptr %53, align 8, !tbaa !9
  %55 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %54, i32 0, i32 6
  %56 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %55, i32 0, i32 0
  %57 = getelementptr inbounds [16 x i8], ptr %56, i64 0, i64 0
  %58 = load i8, ptr %57, align 1, !tbaa !9
  %59 = zext i8 %58 to i32
  %60 = icmp eq i32 %59, 255
  br i1 %60, label %73, label %61

61:                                               ; preds = %49
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  %63 = load ptr, ptr %16, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %63, i32 0, i32 4
  %65 = load ptr, ptr %64, align 8, !tbaa !18
  %66 = load ptr, ptr %16, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %66, i32 0, i32 4
  %68 = load ptr, ptr %67, align 8, !tbaa !18
  %69 = getelementptr inbounds %struct.NET_BUF, ptr %68, i32 0, i32 3
  %70 = load ptr, ptr %69, align 8, !tbaa !9
  %71 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %70, i32 0, i32 5
  %72 = call i64 @Ip6SendIcmpError(ptr noundef %62, ptr noundef %65, ptr noundef null, ptr noundef %71, i8 noundef zeroext 1, i8 noundef zeroext 3, ptr noundef null)
  br label %73

73:                                               ; preds = %61, %49, %41
  %74 = load ptr, ptr %14, align 8, !tbaa !5
  %75 = icmp eq ptr %74, null
  br i1 %75, label %83, label %76

76:                                               ; preds = %73
  %77 = load ptr, ptr %14, align 8, !tbaa !5
  %78 = load ptr, ptr %16, align 8, !tbaa !5
  %79 = load ptr, ptr %15, align 8, !tbaa !5
  %80 = call zeroext i8 %77(ptr noundef %78, ptr noundef %79)
  %81 = zext i8 %80 to i32
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %83, label %97

83:                                               ; preds = %76, %73
  %84 = load ptr, ptr %17, align 8, !tbaa !5
  %85 = call ptr @RemoveEntryList(ptr noundef %84)
  %86 = load ptr, ptr %16, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %86, i32 0, i32 3
  %88 = load ptr, ptr %87, align 8, !tbaa !23
  %89 = load ptr, ptr %16, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %89, i32 0, i32 4
  %91 = load ptr, ptr %90, align 8, !tbaa !18
  %92 = load i64, ptr %13, align 8, !tbaa !10
  %93 = load ptr, ptr %16, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %93, i32 0, i32 5
  %95 = load ptr, ptr %94, align 8, !tbaa !24
  call void %88(ptr noundef %91, i64 noundef %92, i32 noundef 0, ptr noundef %95)
  %96 = load ptr, ptr %16, align 8, !tbaa !5
  call void @Ip6FreeLinkTxToken(ptr noundef %96)
  br label %97

97:                                               ; preds = %83, %76
  br label %98

98:                                               ; preds = %97
  %99 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %99, ptr %17, align 8, !tbaa !5
  %100 = load ptr, ptr %17, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct._LIST_ENTRY, ptr %100, i32 0, i32 0
  %102 = load ptr, ptr %101, align 8, !tbaa !17
  store ptr %102, ptr %18, align 8, !tbaa !5
  br label %36, !llvm.loop !25

103:                                              ; preds = %36
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct._IP6_NEIGHBOR_ENTRY, ptr %104, i32 0, i32 4
  %106 = load i8, ptr %105, align 1, !tbaa !27
  %107 = zext i8 %106 to i32
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %109, label %121

109:                                              ; preds = %103
  %110 = load ptr, ptr %10, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct._IP6_NEIGHBOR_ENTRY, ptr %110, i32 0, i32 11
  %112 = call zeroext i8 @IsListEmpty(ptr noundef %111)
  %113 = zext i8 %112 to i32
  %114 = icmp ne i32 %113, 0
  br i1 %114, label %115, label %121

115:                                              ; preds = %109
  %116 = load ptr, ptr %10, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct._IP6_NEIGHBOR_ENTRY, ptr %116, i32 0, i32 1
  %118 = call ptr @RemoveEntryList(ptr noundef %117)
  %119 = load ptr, ptr %10, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct._IP6_NEIGHBOR_ENTRY, ptr %119, i32 0, i32 4
  store i8 0, ptr %120, align 1, !tbaa !27
  br label %121

121:                                              ; preds = %115, %109, %103
  %122 = load i8, ptr %12, align 1, !tbaa !9
  %123 = icmp ne i8 %122, 0
  br i1 %123, label %124, label %145

124:                                              ; preds = %121
  %125 = load ptr, ptr %10, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct._IP6_NEIGHBOR_ENTRY, ptr %125, i32 0, i32 3
  %127 = load i8, ptr %126, align 8, !tbaa !28
  %128 = icmp ne i8 %127, 0
  br i1 %128, label %129, label %140

129:                                              ; preds = %124
  %130 = load ptr, ptr %9, align 8, !tbaa !5
  %131 = load ptr, ptr %10, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct._IP6_NEIGHBOR_ENTRY, ptr %131, i32 0, i32 6
  %133 = call ptr @Ip6FindDefaultRouter(ptr noundef %130, ptr noundef %132)
  store ptr %133, ptr %19, align 8, !tbaa !5
  %134 = load ptr, ptr %19, align 8, !tbaa !5
  %135 = icmp ne ptr %134, null
  br i1 %135, label %136, label %139

136:                                              ; preds = %129
  %137 = load ptr, ptr %9, align 8, !tbaa !5
  %138 = load ptr, ptr %19, align 8, !tbaa !5
  call void @Ip6DestroyDefaultRouter(ptr noundef %137, ptr noundef %138)
  br label %139

139:                                              ; preds = %136, %129
  br label %140

140:                                              ; preds = %139, %124
  %141 = load ptr, ptr %10, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct._IP6_NEIGHBOR_ENTRY, ptr %141, i32 0, i32 0
  %143 = call ptr @RemoveEntryList(ptr noundef %142)
  %144 = load ptr, ptr %10, align 8, !tbaa !5
  call void @FreePool(ptr noundef %144)
  br label %145

145:                                              ; preds = %140, %121
  store i64 0, ptr %8, align 8
  store i32 1, ptr %20, align 4
  br label %146

146:                                              ; preds = %145, %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  %147 = load i64, ptr %8, align 8
  ret i64 %147
}

declare void @Ip6FreeLinkTxToken(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @Ip6FindDefaultRouter(ptr noundef, ptr noundef) #2

declare i64 @Ip6SendIcmpError(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i8 noundef zeroext, i8 noundef zeroext, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @Ip6DestroyDefaultRouter(ptr noundef, ptr noundef) #2

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 }

!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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long long", !7, i64 0}
!12 = !{!13, !6, i64 104}
!13 = !{!"_IP6_NEIGHBOR_ENTRY", !14, i64 0, !14, i64 16, !11, i64 32, !7, i64 40, !7, i64 41, !7, i64 42, !15, i64 43, !15, i64 59, !16, i64 92, !16, i64 96, !16, i64 100, !14, i64 104, !6, i64 120, !6, i64 128}
!14 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!15 = !{!"", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!14, !6, i64 0}
!18 = !{!19, !6, i64 40}
!19 = !{!"", !16, i64 0, !14, i64 8, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !15, i64 56, !15, i64 88, !20, i64 120, !21, i64 144}
!20 = !{!"", !6, i64 0, !11, i64 8, !7, i64 16}
!21 = !{!"", !6, i64 0, !6, i64 8, !22, i64 16, !16, i64 20, !22, i64 24, !22, i64 26, !7, i64 32}
!22 = !{!"short", !7, i64 0}
!23 = !{!19, !6, i64 32}
!24 = !{!19, !6, i64 48}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!13, !7, i64 41}
!28 = !{!13, !7, i64 40}


; 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 void @FreePool(ptr noundef) local_unnamed_addr #0

declare ptr @RemoveEntryList(ptr noundef) local_unnamed_addr #0

declare zeroext i8 @IsListEmpty(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775806, 1) i64 @Ip6FreeNeighborEntry(ptr noundef %0, ptr noundef %1, i8 noundef zeroext %2, i8 noundef zeroext %3, i64 noundef %4, ptr noundef readonly %5, ptr noundef %6) local_unnamed_addr #1 {
  %8 = icmp ne i8 %3, 0
  %9 = icmp ne ptr %5, null
  %or.cond = and i1 %8, %9
  br i1 %or.cond, label %97, label %10

10:                                               ; preds = %7
  %11 = getelementptr inbounds i8, ptr %1, i64 104
  %12 = load ptr, ptr %11, align 8, !tbaa !5
  %.03850 = load ptr, ptr %12, align 8, !tbaa !14
  %.not51 = icmp eq ptr %12, %11
  br i1 %.not51, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %10
  %.not48 = icmp eq i8 %2, 0
  %13 = icmp eq ptr %5, null
  br i1 %.not48, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph
  br i1 %13, label %.lr.ph.split.us.split.us, label %.lr.ph.split.us.split

.lr.ph.split.us.split.us:                         ; preds = %.lr.ph.split.us, %.lr.ph.split.us.split.us
  %.03853.us.us = phi ptr [ %.038.us.us, %.lr.ph.split.us.split.us ], [ %.03850, %.lr.ph.split.us ]
  %.03952.us.us = phi ptr [ %.03853.us.us, %.lr.ph.split.us.split.us ], [ %12, %.lr.ph.split.us ]
  %14 = ptrtoint ptr %.03952.us.us to i64
  %15 = add i64 %14, -8
  %16 = inttoptr i64 %15 to ptr
  %17 = tail call ptr @RemoveEntryList(ptr noundef nonnull %.03952.us.us) #2
  %18 = getelementptr inbounds i8, ptr %16, i64 32
  %19 = load ptr, ptr %18, align 8, !tbaa !15
  %20 = getelementptr inbounds i8, ptr %16, i64 40
  %21 = load ptr, ptr %20, align 8, !tbaa !20
  %22 = getelementptr inbounds i8, ptr %16, i64 48
  %23 = load ptr, ptr %22, align 8, !tbaa !21
  tail call void %19(ptr noundef %21, i64 noundef %4, i32 noundef 0, ptr noundef %23) #2
  tail call void @Ip6FreeLinkTxToken(ptr noundef %16) #2
  %.038.us.us = load ptr, ptr %.03853.us.us, align 8, !tbaa !14
  %.not.us.us = icmp eq ptr %.03853.us.us, %11
  br i1 %.not.us.us, label %._crit_edge, label %.lr.ph.split.us.split.us, !llvm.loop !22

.lr.ph.split.us.split:                            ; preds = %.lr.ph.split.us, %36
  %.03853.us = phi ptr [ %.038.us, %36 ], [ %.03850, %.lr.ph.split.us ]
  %.03952.us = phi ptr [ %.03853.us, %36 ], [ %12, %.lr.ph.split.us ]
  %24 = ptrtoint ptr %.03952.us to i64
  %25 = add i64 %24, -8
  %26 = inttoptr i64 %25 to ptr
  %27 = tail call zeroext i8 %5(ptr noundef %26, ptr noundef %6) #2
  %.not49.us = icmp eq i8 %27, 0
  br i1 %.not49.us, label %36, label %28

28:                                               ; preds = %.lr.ph.split.us.split
  %29 = tail call ptr @RemoveEntryList(ptr noundef nonnull %.03952.us) #2
  %30 = getelementptr inbounds i8, ptr %26, i64 32
  %31 = load ptr, ptr %30, align 8, !tbaa !15
  %32 = getelementptr inbounds i8, ptr %26, i64 40
  %33 = load ptr, ptr %32, align 8, !tbaa !20
  %34 = getelementptr inbounds i8, ptr %26, i64 48
  %35 = load ptr, ptr %34, align 8, !tbaa !21
  tail call void %31(ptr noundef %33, i64 noundef %4, i32 noundef 0, ptr noundef %35) #2
  tail call void @Ip6FreeLinkTxToken(ptr noundef %26) #2
  br label %36

36:                                               ; preds = %28, %.lr.ph.split.us.split
  %.038.us = load ptr, ptr %.03853.us, align 8, !tbaa !14
  %.not.us = icmp eq ptr %.03853.us, %11
  br i1 %.not.us, label %._crit_edge, label %.lr.ph.split.us.split, !llvm.loop !22

.lr.ph.split:                                     ; preds = %.lr.ph
  br i1 %13, label %.lr.ph.split.split.us, label %.lr.ph.split.split

.lr.ph.split.split.us:                            ; preds = %.lr.ph.split, %50
  %.03853.us54 = phi ptr [ %.038.us56, %50 ], [ %.03850, %.lr.ph.split ]
  %.03952.us55 = phi ptr [ %.03853.us54, %50 ], [ %12, %.lr.ph.split ]
  %37 = ptrtoint ptr %.03952.us55 to i64
  %38 = add i64 %37, -8
  %39 = inttoptr i64 %38 to ptr
  %40 = getelementptr inbounds i8, ptr %39, i64 40
  %41 = load ptr, ptr %40, align 8, !tbaa !20
  %42 = getelementptr inbounds i8, ptr %41, i64 32
  %43 = load ptr, ptr %42, align 8, !tbaa !24
  %44 = getelementptr inbounds i8, ptr %43, i64 24
  %45 = load i8, ptr %44, align 1, !tbaa !24
  %46 = icmp eq i8 %45, -1
  br i1 %46, label %50, label %47

47:                                               ; preds = %.lr.ph.split.split.us
  %48 = getelementptr inbounds i8, ptr %43, i64 8
  %49 = tail call i64 @Ip6SendIcmpError(ptr noundef %0, ptr noundef nonnull %41, ptr noundef null, ptr noundef nonnull %48, i8 noundef zeroext 1, i8 noundef zeroext 3, ptr noundef null) #2
  br label %50

50:                                               ; preds = %47, %.lr.ph.split.split.us
  %51 = tail call ptr @RemoveEntryList(ptr noundef nonnull %.03952.us55) #2
  %52 = getelementptr inbounds i8, ptr %39, i64 32
  %53 = load ptr, ptr %52, align 8, !tbaa !15
  %54 = load ptr, ptr %40, align 8, !tbaa !20
  %55 = getelementptr inbounds i8, ptr %39, i64 48
  %56 = load ptr, ptr %55, align 8, !tbaa !21
  tail call void %53(ptr noundef %54, i64 noundef %4, i32 noundef 0, ptr noundef %56) #2
  tail call void @Ip6FreeLinkTxToken(ptr noundef nonnull %39) #2
  %.038.us56 = load ptr, ptr %.03853.us54, align 8, !tbaa !14
  %.not.us57 = icmp eq ptr %.03853.us54, %11
  br i1 %.not.us57, label %._crit_edge, label %.lr.ph.split.split.us, !llvm.loop !22

.lr.ph.split.split:                               ; preds = %.lr.ph.split, %79
  %.03853 = phi ptr [ %.038, %79 ], [ %.03850, %.lr.ph.split ]
  %.03952 = phi ptr [ %.03853, %79 ], [ %12, %.lr.ph.split ]
  %57 = ptrtoint ptr %.03952 to i64
  %58 = add i64 %57, -8
  %59 = inttoptr i64 %58 to ptr
  %60 = getelementptr inbounds i8, ptr %59, i64 40
  %61 = load ptr, ptr %60, align 8, !tbaa !20
  %62 = getelementptr inbounds i8, ptr %61, i64 32
  %63 = load ptr, ptr %62, align 8, !tbaa !24
  %64 = getelementptr inbounds i8, ptr %63, i64 24
  %65 = load i8, ptr %64, align 1, !tbaa !24
  %66 = icmp eq i8 %65, -1
  br i1 %66, label %70, label %67

67:                                               ; preds = %.lr.ph.split.split
  %68 = getelementptr inbounds i8, ptr %63, i64 8
  %69 = tail call i64 @Ip6SendIcmpError(ptr noundef %0, ptr noundef nonnull %61, ptr noundef null, ptr noundef nonnull %68, i8 noundef zeroext 1, i8 noundef zeroext 3, ptr noundef null) #2
  br label %70

70:                                               ; preds = %67, %.lr.ph.split.split
  %71 = tail call zeroext i8 %5(ptr noundef nonnull %59, ptr noundef %6) #2
  %.not49 = icmp eq i8 %71, 0
  br i1 %.not49, label %79, label %72

72:                                               ; preds = %70
  %73 = tail call ptr @RemoveEntryList(ptr noundef nonnull %.03952) #2
  %74 = getelementptr inbounds i8, ptr %59, i64 32
  %75 = load ptr, ptr %74, align 8, !tbaa !15
  %76 = load ptr, ptr %60, align 8, !tbaa !20
  %77 = getelementptr inbounds i8, ptr %59, i64 48
  %78 = load ptr, ptr %77, align 8, !tbaa !21
  tail call void %75(ptr noundef %76, i64 noundef %4, i32 noundef 0, ptr noundef %78) #2
  tail call void @Ip6FreeLinkTxToken(ptr noundef nonnull %59) #2
  br label %79

79:                                               ; preds = %70, %72
  %.038 = load ptr, ptr %.03853, align 8, !tbaa !14
  %.not = icmp eq ptr %.03853, %11
  br i1 %.not, label %._crit_edge, label %.lr.ph.split.split, !llvm.loop !22

._crit_edge:                                      ; preds = %79, %50, %36, %.lr.ph.split.us.split.us, %10
  %80 = getelementptr inbounds i8, ptr %1, i64 41
  %81 = load i8, ptr %80, align 1, !tbaa !25
  %.not43 = icmp eq i8 %81, 0
  br i1 %.not43, label %87, label %82

82:                                               ; preds = %._crit_edge
  %83 = tail call zeroext i8 @IsListEmpty(ptr noundef nonnull %11) #2
  %.not44 = icmp eq i8 %83, 0
  br i1 %.not44, label %87, label %84

84:                                               ; preds = %82
  %85 = getelementptr inbounds i8, ptr %1, i64 16
  %86 = tail call ptr @RemoveEntryList(ptr noundef nonnull %85) #2
  store i8 0, ptr %80, align 1, !tbaa !25
  br label %87

87:                                               ; preds = %84, %82, %._crit_edge
  %.not45 = icmp eq i8 %3, 0
  br i1 %.not45, label %97, label %88

88:                                               ; preds = %87
  %89 = getelementptr inbounds i8, ptr %1, i64 40
  %90 = load i8, ptr %89, align 8, !tbaa !26
  %.not46 = icmp eq i8 %90, 0
  br i1 %.not46, label %95, label %91

91:                                               ; preds = %88
  %92 = getelementptr inbounds i8, ptr %1, i64 43
  %93 = tail call ptr @Ip6FindDefaultRouter(ptr noundef %0, ptr noundef nonnull %92)
  %.not47 = icmp eq ptr %93, null
  br i1 %.not47, label %95, label %94

94:                                               ; preds = %91
  tail call void @Ip6DestroyDefaultRouter(ptr noundef %0, ptr noundef nonnull %93)
  br label %95

95:                                               ; preds = %91, %94, %88
  %96 = tail call ptr @RemoveEntryList(ptr noundef nonnull %1) #2
  tail call void @FreePool(ptr noundef nonnull %1) #2
  br label %97

97:                                               ; preds = %87, %95, %7
  %.0 = phi i64 [ -9223372036854775806, %7 ], [ 0, %95 ], [ 0, %87 ]
  ret i64 %.0
}

declare void @Ip6FreeLinkTxToken(ptr noundef) local_unnamed_addr #0

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

declare i64 @Ip6SendIcmpError(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i8 noundef zeroext, i8 noundef zeroext, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @Ip6DestroyDefaultRouter(ptr noundef, ptr noundef) local_unnamed_addr #1

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 = { 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, !8, i64 104}
!6 = !{!"_IP6_NEIGHBOR_ENTRY", !7, i64 0, !7, i64 16, !11, i64 32, !9, i64 40, !9, i64 41, !9, i64 42, !12, i64 43, !12, i64 59, !13, i64 92, !13, i64 96, !13, i64 100, !7, i64 104, !8, i64 120, !8, i64 128}
!7 = !{!"_LIST_ENTRY", !8, i64 0, !8, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"long long", !9, i64 0}
!12 = !{!"", !9, i64 0}
!13 = !{!"int", !9, i64 0}
!14 = !{!7, !8, i64 0}
!15 = !{!16, !8, i64 32}
!16 = !{!"", !13, i64 0, !7, i64 8, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !12, i64 56, !12, i64 88, !17, i64 120, !18, i64 144}
!17 = !{!"", !8, i64 0, !11, i64 8, !9, i64 16}
!18 = !{!"", !8, i64 0, !8, i64 8, !19, i64 16, !13, i64 20, !19, i64 24, !19, i64 26, !9, i64 32}
!19 = !{!"short", !9, i64 0}
!20 = !{!16, !8, i64 40}
!21 = !{!16, !8, i64 48}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!9, !9, i64 0}
!25 = !{!6, !9, i64 41}
!26 = !{!6, !9, i64 40}


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