; 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_PROTOCOL = type { i32, %struct._EFI_IP6_PROTOCOL, ptr, i64, ptr, %struct._LIST_ENTRY, i8, %struct.NET_MAP, %struct.NET_MAP, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct.EFI_LOCK, ptr, %struct._LIST_ENTRY, ptr, i32, %struct.EFI_IP6_CONFIG_DATA, i8 }
%struct._EFI_IP6_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.NET_MAP = type { %struct._LIST_ENTRY, %struct._LIST_ENTRY, i64 }
%struct.EFI_LOCK = type { i64, i64, i32 }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct.EFI_IP6_CONFIG_DATA = type { i8, i8, i8, i8, %struct.EFI_IPv6_ADDRESS, %struct.EFI_IPv6_ADDRESS, i8, i8, i32, i32, i32 }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }
%struct._IP6_SERVICE = type { i32, %struct._EFI_SERVICE_BINDING_PROTOCOL, i64, i64, %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, ptr, %struct.IP6_LINK_RX_TOKEN, %struct.IP6_ASSEMBLE_TABLE, %struct.IP6_MLD_SERVICE_DATA, %struct.EFI_IPv6_ADDRESS, i8, i8, i8, i8, i8, i32, i32, i32, i32, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, i8, ptr, i8, i8, i32, ptr, ptr, ptr, ptr, %struct.EFI_MANAGED_NETWORK_CONFIG_DATA, %struct.EFI_SIMPLE_NETWORK_MODE, ptr, ptr, %struct._IP6_CONFIG_INSTANCE, ptr, i32, i32 }
%struct._EFI_SERVICE_BINDING_PROTOCOL = type { ptr, ptr }
%struct.IP6_LINK_RX_TOKEN = type { i32, ptr, ptr, %struct.EFI_MANAGED_NETWORK_COMPLETION_TOKEN }
%struct.EFI_MANAGED_NETWORK_COMPLETION_TOKEN = type { ptr, i64, %union.anon }
%union.anon = type { ptr }
%struct.IP6_ASSEMBLE_TABLE = type { [127 x %struct._LIST_ENTRY] }
%struct.IP6_MLD_SERVICE_DATA = type { i64, %struct._LIST_ENTRY }
%struct.EFI_MANAGED_NETWORK_CONFIG_DATA = type { i32, i32, i16, i8, i8, i8, i8, i8, i8, i8 }
%struct.EFI_SIMPLE_NETWORK_MODE = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [16 x %struct.EFI_MAC_ADDRESS], %struct.EFI_MAC_ADDRESS, %struct.EFI_MAC_ADDRESS, %struct.EFI_MAC_ADDRESS, i8, i8, i8, i8, i8 }
%struct.EFI_MAC_ADDRESS = type { [32 x i8] }
%struct._IP6_CONFIG_INSTANCE = type { i32, i8, %struct._LIST_ENTRY, i16, %struct.EFI_IP6_CONFIG_INTERFACE_INFO, %struct.EFI_IP6_CONFIG_INTERFACE_ID, i32, %struct.EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS, [7 x %struct.IP6_CONFIG_DATA_ITEM], %struct.NET_MAP, %struct.NET_MAP, %struct._EFI_IP6_CONFIG_PROTOCOL, ptr, ptr, ptr, ptr, i8, i32, ptr, i32, ptr, i32, %struct._IP6_FORM_CALLBACK_INFO, %struct.IP6_CONFIG_NVDATA }
%struct.EFI_IP6_CONFIG_INTERFACE_INFO = type { [32 x i16], i8, i32, %struct.EFI_MAC_ADDRESS, i32, ptr, i32, ptr }
%struct.EFI_IP6_CONFIG_INTERFACE_ID = type { [8 x i8] }
%struct.EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS = type { i32 }
%struct.IP6_CONFIG_DATA_ITEM = type { ptr, ptr, i64, i8, %struct.NET_MAP, %union.IP6_CONFIG_DATA, i64 }
%union.IP6_CONFIG_DATA = type { ptr }
%struct._EFI_IP6_CONFIG_PROTOCOL = type { ptr, ptr, ptr, ptr }
%struct._IP6_FORM_CALLBACK_INFO = type { i32, ptr, %struct._EFI_HII_CONFIG_ACCESS_PROTOCOL, ptr, ptr }
%struct._EFI_HII_CONFIG_ACCESS_PROTOCOL = type { ptr, ptr, ptr }
%struct.IP6_CONFIG_NVDATA = type { i32, %struct.EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS, %struct.EFI_IP6_CONFIG_INTERFACE_ID, %struct._LIST_ENTRY, i32, %struct._LIST_ENTRY, i32, %struct._LIST_ENTRY, i32 }
%struct.EFI_IP6_NEIGHBOR_CACHE = type { %struct.EFI_IPv6_ADDRESS, %struct.EFI_MAC_ADDRESS, i32 }
%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 }

@.str = external hidden unnamed_addr constant [127 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [119 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1

; 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 i64 @Ip6BuildEfiNeighborCache(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = 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 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  br label %15

15:                                               ; preds = %3
  %16 = call zeroext i8 @DebugAssertEnabled()
  %17 = icmp ne i8 %16, 0
  br i1 %17, label %18, label %28

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

21:                                               ; preds = %18
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct._IP6_PROTOCOL, ptr %22, i32 0, i32 0
  %24 = load i32, ptr %23, align 8, !tbaa !9
  %25 = icmp eq i32 %24, 1345736777
  br i1 %25, label %27, label %26

26:                                               ; preds = %21, %18
  call void @DebugAssert(ptr noundef @.str, i64 noundef 64, ptr noundef @.str.1)
  br label %27

27:                                               ; preds = %26, %21
  br label %28

28:                                               ; preds = %27, %15
  br label %29

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %29
  br label %31

31:                                               ; preds = %30
  %32 = call zeroext i8 @DebugAssertEnabled()
  %33 = icmp ne i8 %32, 0
  br i1 %33, label %34, label %42

34:                                               ; preds = %31
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %40

37:                                               ; preds = %34
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = icmp ne ptr %38, null
  br i1 %39, label %41, label %40

40:                                               ; preds = %37, %34
  call void @DebugAssert(ptr noundef @.str, i64 noundef 65, ptr noundef @.str.2)
  br label %41

41:                                               ; preds = %40, %37
  br label %42

42:                                               ; preds = %41, %31
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct._IP6_PROTOCOL, ptr %45, i32 0, i32 4
  %47 = load ptr, ptr %46, align 8, !tbaa !19
  store ptr %47, ptr %10, align 8, !tbaa !5
  store i32 0, ptr %11, align 4, !tbaa !20
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct._IP6_SERVICE, ptr %48, i32 0, i32 21
  %50 = getelementptr inbounds %struct._LIST_ENTRY, ptr %49, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !21
  store ptr %51, ptr %9, align 8, !tbaa !5
  br label %52

52:                                               ; preds = %60, %44
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = load ptr, ptr %10, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct._IP6_SERVICE, ptr %54, i32 0, i32 21
  %56 = icmp ne ptr %53, %55
  br i1 %56, label %57, label %64

57:                                               ; preds = %52
  %58 = load i32, ptr %11, align 4, !tbaa !20
  %59 = add i32 %58, 1
  store i32 %59, ptr %11, align 4, !tbaa !20
  br label %60

60:                                               ; preds = %57
  %61 = load ptr, ptr %9, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct._LIST_ENTRY, ptr %61, i32 0, i32 0
  %63 = load ptr, ptr %62, align 8, !tbaa !37
  store ptr %63, ptr %9, align 8, !tbaa !5
  br label %52, !llvm.loop !38

64:                                               ; preds = %52
  %65 = load i32, ptr %11, align 4, !tbaa !20
  %66 = icmp eq i32 %65, 0
  br i1 %66, label %67, label %68

67:                                               ; preds = %64
  store i64 0, ptr %4, align 8
  store i32 1, ptr %14, align 4
  br label %134

68:                                               ; preds = %64
  %69 = load i32, ptr %11, align 4, !tbaa !20
  %70 = zext i32 %69 to i64
  %71 = mul i64 %70, 52
  %72 = call ptr @AllocatePool(i64 noundef %71)
  store ptr %72, ptr %13, align 8, !tbaa !5
  %73 = load ptr, ptr %13, align 8, !tbaa !5
  %74 = icmp eq ptr %73, null
  br i1 %74, label %75, label %76

75:                                               ; preds = %68
  store i64 -9223372036854775799, ptr %4, align 8
  store i32 1, ptr %14, align 4
  br label %134

76:                                               ; preds = %68
  %77 = load i32, ptr %11, align 4, !tbaa !20
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 %77, ptr %78, align 4, !tbaa !20
  store i32 0, ptr %11, align 4, !tbaa !20
  %79 = load ptr, ptr %10, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct._IP6_SERVICE, ptr %79, i32 0, i32 21
  %81 = getelementptr inbounds %struct._LIST_ENTRY, ptr %80, i32 0, i32 0
  %82 = load ptr, ptr %81, align 8, !tbaa !21
  store ptr %82, ptr %9, align 8, !tbaa !5
  br label %83

83:                                               ; preds = %114, %76
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = load ptr, ptr %10, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct._IP6_SERVICE, ptr %85, i32 0, i32 21
  %87 = icmp ne ptr %84, %86
  br i1 %87, label %88, label %118

88:                                               ; preds = %83
  %89 = load ptr, ptr %9, align 8, !tbaa !5
  %90 = ptrtoint ptr %89 to i64
  %91 = sub i64 %90, 0
  %92 = inttoptr i64 %91 to ptr
  store ptr %92, ptr %8, align 8, !tbaa !5
  %93 = load ptr, ptr %13, align 8, !tbaa !5
  %94 = load i32, ptr %11, align 4, !tbaa !20
  %95 = zext i32 %94 to i64
  %96 = getelementptr inbounds %struct.EFI_IP6_NEIGHBOR_CACHE, ptr %93, i64 %95
  store ptr %96, ptr %12, align 8, !tbaa !5
  %97 = load ptr, ptr %8, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct._IP6_NEIGHBOR_ENTRY, ptr %97, i32 0, i32 8
  %99 = load i32, ptr %98, align 4, !tbaa !40
  %100 = load ptr, ptr %12, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.EFI_IP6_NEIGHBOR_CACHE, ptr %100, i32 0, i32 2
  store i32 %99, ptr %101, align 4, !tbaa !42
  %102 = load ptr, ptr %12, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.EFI_IP6_NEIGHBOR_CACHE, ptr %102, i32 0, i32 0
  %104 = load ptr, ptr %8, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct._IP6_NEIGHBOR_ENTRY, ptr %104, i32 0, i32 6
  %106 = call ptr @CopyMem(ptr noundef %103, ptr noundef %105, i64 noundef 16)
  %107 = load ptr, ptr %12, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.EFI_IP6_NEIGHBOR_CACHE, ptr %107, i32 0, i32 1
  %109 = load ptr, ptr %8, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct._IP6_NEIGHBOR_ENTRY, ptr %109, i32 0, i32 7
  %111 = call ptr @CopyMem(ptr noundef %108, ptr noundef %110, i64 noundef 32)
  %112 = load i32, ptr %11, align 4, !tbaa !20
  %113 = add i32 %112, 1
  store i32 %113, ptr %11, align 4, !tbaa !20
  br label %114

114:                                              ; preds = %88
  %115 = load ptr, ptr %9, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct._LIST_ENTRY, ptr %115, i32 0, i32 0
  %117 = load ptr, ptr %116, align 8, !tbaa !37
  store ptr %117, ptr %9, align 8, !tbaa !5
  br label %83, !llvm.loop !44

118:                                              ; preds = %83
  br label %119

119:                                              ; preds = %118
  %120 = call zeroext i8 @DebugAssertEnabled()
  %121 = icmp ne i8 %120, 0
  br i1 %121, label %122, label %129

122:                                              ; preds = %119
  %123 = load ptr, ptr %6, align 8, !tbaa !5
  %124 = load i32, ptr %123, align 4, !tbaa !20
  %125 = load i32, ptr %11, align 4, !tbaa !20
  %126 = icmp eq i32 %124, %125
  br i1 %126, label %128, label %127

127:                                              ; preds = %122
  call void @DebugAssert(ptr noundef @.str, i64 noundef 98, ptr noundef @.str.3)
  br label %128

128:                                              ; preds = %127, %122
  br label %129

129:                                              ; preds = %128, %119
  br label %130

130:                                              ; preds = %129
  br label %131

131:                                              ; preds = %130
  %132 = load ptr, ptr %13, align 8, !tbaa !5
  %133 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %132, ptr %133, align 8, !tbaa !5
  store i64 0, ptr %4, align 8
  store i32 1, ptr %14, align 4
  br label %134

134:                                              ; preds = %131, %75, %67
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %135 = load i64, ptr %4, align 8
  ret i64 %135
}

declare zeroext i8 @DebugAssertEnabled() #2

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) #2

declare ptr @AllocatePool(i64 noundef) #2

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) #2

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 = { "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 = !{!10, !11, i64 0}
!10 = !{!"_IP6_PROTOCOL", !11, i64 0, !12, i64 8, !6, i64 80, !13, i64 88, !6, i64 96, !14, i64 104, !7, i64 120, !15, i64 128, !15, i64 168, !14, i64 208, !14, i64 224, !16, i64 240, !6, i64 264, !14, i64 272, !6, i64 288, !11, i64 296, !17, i64 300, !7, i64 352}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_EFI_IP6_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64}
!13 = !{!"long long", !7, i64 0}
!14 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!15 = !{!"", !14, i64 0, !14, i64 16, !13, i64 32}
!16 = !{!"", !13, i64 0, !13, i64 8, !11, i64 16}
!17 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !18, i64 4, !18, i64 20, !7, i64 36, !7, i64 37, !11, i64 40, !11, i64 44, !11, i64 48}
!18 = !{!"", !7, i64 0}
!19 = !{!10, !6, i64 96}
!20 = !{!11, !11, i64 0}
!21 = !{!22, !6, i64 2232}
!22 = !{!"_IP6_SERVICE", !11, i64 0, !23, i64 8, !13, i64 24, !13, i64 32, !14, i64 40, !14, i64 56, !6, i64 72, !6, i64 80, !24, i64 88, !18, i64 136, !26, i64 2168, !18, i64 2192, !7, i64 2208, !7, i64 2209, !7, i64 2210, !7, i64 2211, !7, i64 2212, !11, i64 2216, !11, i64 2220, !11, i64 2224, !11, i64 2228, !14, i64 2232, !14, i64 2248, !14, i64 2264, !14, i64 2280, !11, i64 2296, !7, i64 2300, !6, i64 2304, !7, i64 2312, !7, i64 2313, !11, i64 2316, !6, i64 2320, !6, i64 2328, !6, i64 2336, !6, i64 2344, !27, i64 2352, !29, i64 2372, !6, i64 3032, !6, i64 3040, !30, i64 3048, !6, i64 4176, !11, i64 4184, !11, i64 4188}
!23 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!24 = !{!"", !11, i64 0, !6, i64 8, !6, i64 16, !25, i64 24}
!25 = !{!"", !6, i64 0, !13, i64 8, !7, i64 16}
!26 = !{!"", !13, i64 0, !14, i64 8}
!27 = !{!"", !11, i64 0, !11, i64 4, !28, i64 8, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15, !7, i64 16}
!28 = !{!"short", !7, i64 0}
!29 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !7, i64 40, !18, i64 552, !18, i64 584, !18, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!30 = !{!"_IP6_CONFIG_INSTANCE", !11, i64 0, !7, i64 4, !14, i64 8, !28, i64 24, !31, i64 32, !18, i64 168, !11, i64 176, !32, i64 180, !7, i64 184, !15, i64 800, !15, i64 840, !33, i64 880, !6, i64 912, !6, i64 920, !6, i64 928, !6, i64 936, !7, i64 944, !11, i64 948, !6, i64 952, !11, i64 960, !6, i64 968, !11, i64 976, !34, i64 984, !36, i64 1040}
!31 = !{!"", !7, i64 0, !7, i64 64, !11, i64 68, !18, i64 72, !11, i64 104, !6, i64 112, !11, i64 120, !6, i64 128}
!32 = !{!"", !11, i64 0}
!33 = !{!"_EFI_IP6_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!34 = !{!"_IP6_FORM_CALLBACK_INFO", !11, i64 0, !6, i64 8, !35, i64 16, !6, i64 40, !6, i64 48}
!35 = !{!"_EFI_HII_CONFIG_ACCESS_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!36 = !{!"", !11, i64 0, !32, i64 4, !18, i64 8, !14, i64 16, !11, i64 32, !14, i64 40, !11, i64 56, !14, i64 64, !11, i64 80}
!37 = !{!14, !6, i64 0}
!38 = distinct !{!38, !39}
!39 = !{!"llvm.loop.mustprogress"}
!40 = !{!41, !11, i64 92}
!41 = !{!"_IP6_NEIGHBOR_ENTRY", !14, i64 0, !14, i64 16, !13, i64 32, !7, i64 40, !7, i64 41, !7, i64 42, !18, i64 43, !18, i64 59, !11, i64 92, !11, i64 96, !11, i64 100, !14, i64 104, !6, i64 120, !6, i64 128}
!42 = !{!43, !11, i64 48}
!43 = !{!"", !18, i64 0, !18, i64 16, !11, i64 48}
!44 = distinct !{!44, !39}


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

%struct.EFI_IP6_NEIGHBOR_CACHE = type { %struct.EFI_IPv6_ADDRESS, %struct.EFI_MAC_ADDRESS, i32 }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }
%struct.EFI_MAC_ADDRESS = type { [32 x i8] }

@.str = external hidden unnamed_addr constant [127 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [119 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775799, 1) i64 @Ip6BuildEfiNeighborCache(ptr noundef readonly %0, ptr noundef %1, ptr noundef writeonly %2) local_unnamed_addr #0 {
  %4 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not = icmp eq i8 %4, 0
  br i1 %.not, label %10, label %5

5:                                                ; preds = %3
  %.not40 = icmp eq ptr %0, null
  br i1 %.not40, label %9, label %6

6:                                                ; preds = %5
  %7 = load i32, ptr %0, align 8, !tbaa !5
  %8 = icmp eq i32 %7, 1345736777
  br i1 %8, label %10, label %9

9:                                                ; preds = %6, %5
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 64, ptr noundef nonnull @.str.1) #2
  br label %10

10:                                               ; preds = %3, %9, %6
  %11 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not41 = icmp eq i8 %11, 0
  br i1 %.not41, label %16, label %12

12:                                               ; preds = %10
  %13 = icmp ne ptr %1, null
  %14 = icmp ne ptr %2, null
  %or.cond = and i1 %13, %14
  br i1 %or.cond, label %16, label %15

15:                                               ; preds = %12
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 65, ptr noundef nonnull @.str.2) #2
  br label %16

16:                                               ; preds = %15, %12, %10
  %17 = getelementptr inbounds i8, ptr %0, i64 96
  %18 = load ptr, ptr %17, align 8, !tbaa !18
  %19 = getelementptr inbounds i8, ptr %18, i64 2232
  br label %20

20:                                               ; preds = %20, %16
  %.035 = phi i32 [ 0, %16 ], [ %21, %20 ]
  %.034.in = phi ptr [ %19, %16 ], [ %.034, %20 ]
  %.034 = load ptr, ptr %.034.in, align 8, !tbaa !19
  %.not42 = icmp eq ptr %.034, %19
  %21 = add i32 %.035, 1
  br i1 %.not42, label %22, label %20, !llvm.loop !20

22:                                               ; preds = %20
  %23 = icmp eq i32 %.035, 0
  br i1 %23, label %47, label %24

24:                                               ; preds = %22
  %25 = zext i32 %.035 to i64
  %26 = mul nuw nsw i64 %25, 52
  %27 = tail call ptr @AllocatePool(i64 noundef %26) #2
  %28 = icmp eq ptr %27, null
  br i1 %28, label %47, label %29

29:                                               ; preds = %24
  store i32 %.035, ptr %1, align 4, !tbaa !22
  %.145 = load ptr, ptr %19, align 8, !tbaa !19
  %.not4346 = icmp eq ptr %.145, %19
  br i1 %.not4346, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %29, %.lr.ph
  %.148 = phi ptr [ %.1, %.lr.ph ], [ %.145, %29 ]
  %.13647 = phi i32 [ %40, %.lr.ph ], [ 0, %29 ]
  %30 = zext i32 %.13647 to i64
  %31 = getelementptr inbounds %struct.EFI_IP6_NEIGHBOR_CACHE, ptr %27, i64 %30
  %32 = getelementptr inbounds i8, ptr %.148, i64 92
  %33 = load i32, ptr %32, align 4, !tbaa !23
  %34 = getelementptr inbounds i8, ptr %31, i64 48
  store i32 %33, ptr %34, align 4, !tbaa !25
  %35 = getelementptr inbounds i8, ptr %.148, i64 43
  %36 = tail call ptr @CopyMem(ptr noundef nonnull %31, ptr noundef nonnull %35, i64 noundef 16) #2
  %37 = getelementptr inbounds i8, ptr %31, i64 16
  %38 = getelementptr inbounds i8, ptr %.148, i64 59
  %39 = tail call ptr @CopyMem(ptr noundef nonnull %37, ptr noundef nonnull %38, i64 noundef 32) #2
  %40 = add i32 %.13647, 1
  %.1 = load ptr, ptr %.148, align 8, !tbaa !19
  %.not43 = icmp eq ptr %.1, %19
  br i1 %.not43, label %._crit_edge, label %.lr.ph, !llvm.loop !27

._crit_edge:                                      ; preds = %.lr.ph, %29
  %.136.lcssa = phi i32 [ 0, %29 ], [ %40, %.lr.ph ]
  %41 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not44 = icmp eq i8 %41, 0
  br i1 %.not44, label %46, label %42

42:                                               ; preds = %._crit_edge
  %43 = load i32, ptr %1, align 4, !tbaa !22
  %44 = icmp eq i32 %43, %.136.lcssa
  br i1 %44, label %46, label %45

45:                                               ; preds = %42
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 98, ptr noundef nonnull @.str.3) #2
  br label %46

46:                                               ; preds = %42, %45, %._crit_edge
  store ptr %27, ptr %2, align 8, !tbaa !28
  br label %47

47:                                               ; preds = %24, %22, %46
  %.0 = phi i64 [ 0, %46 ], [ 0, %22 ], [ -9223372036854775799, %24 ]
  ret i64 %.0
}

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

declare ptr @AllocatePool(i64 noundef) local_unnamed_addr #1

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #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 = { "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, !7, i64 0}
!6 = !{!"_IP6_PROTOCOL", !7, i64 0, !10, i64 8, !11, i64 80, !12, i64 88, !11, i64 96, !13, i64 104, !8, i64 120, !14, i64 128, !14, i64 168, !13, i64 208, !13, i64 224, !15, i64 240, !11, i64 264, !13, i64 272, !11, i64 288, !7, i64 296, !16, i64 300, !8, i64 352}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_EFI_IP6_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"long long", !8, i64 0}
!13 = !{!"_LIST_ENTRY", !11, i64 0, !11, i64 8}
!14 = !{!"", !13, i64 0, !13, i64 16, !12, i64 32}
!15 = !{!"", !12, i64 0, !12, i64 8, !7, i64 16}
!16 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !17, i64 4, !17, i64 20, !8, i64 36, !8, i64 37, !7, i64 40, !7, i64 44, !7, i64 48}
!17 = !{!"", !8, i64 0}
!18 = !{!6, !11, i64 96}
!19 = !{!13, !11, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!7, !7, i64 0}
!23 = !{!24, !7, i64 92}
!24 = !{!"_IP6_NEIGHBOR_ENTRY", !13, i64 0, !13, i64 16, !12, i64 32, !8, i64 40, !8, i64 41, !8, i64 42, !17, i64 43, !17, i64 59, !7, i64 92, !7, i64 96, !7, i64 100, !13, i64 104, !11, i64 120, !11, i64 128}
!25 = !{!26, !7, i64 48}
!26 = !{!"", !17, i64 0, !17, i64 16, !7, i64 48}
!27 = distinct !{!27, !21}
!28 = !{!11, !11, i64 0}


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