; 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_ADDRESS_INFO = type { %struct.EFI_IPv6_ADDRESS, i8 }
%struct._IP6_PREFIX_LIST_ENTRY = type { %struct._LIST_ENTRY, i64, i32, i32, i8, %struct.EFI_IPv6_ADDRESS }

@.str = external hidden unnamed_addr constant [127 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [119 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [22 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

declare zeroext i8 @DebugAssertEnabled() #1

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

declare ptr @AllocatePool(i64 noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local i64 @Ip6BuildPrefixTable(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %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 i32, align 4
  %11 = alloca ptr, align 8
  %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 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, 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 130, 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 131, ptr noundef @.str.4)
  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 %9, align 8, !tbaa !5
  store i32 0, ptr %10, align 4, !tbaa !20
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct._IP6_SERVICE, ptr %48, i32 0, i32 22
  %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 %8, align 8, !tbaa !5
  br label %52

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

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

60:                                               ; preds = %57
  %61 = load ptr, ptr %8, 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 %8, align 8, !tbaa !5
  br label %52, !llvm.loop !38

64:                                               ; preds = %52
  %65 = load i32, ptr %10, 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 %129

68:                                               ; preds = %64
  %69 = load i32, ptr %10, align 4, !tbaa !20
  %70 = zext i32 %69 to i64
  %71 = mul i64 %70, 17
  %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 %129

76:                                               ; preds = %68
  %77 = load i32, ptr %10, 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 %10, align 4, !tbaa !20
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct._IP6_SERVICE, ptr %79, i32 0, i32 22
  %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 %8, align 8, !tbaa !5
  br label %83

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

88:                                               ; preds = %83
  %89 = load ptr, ptr %8, 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 %11, align 8, !tbaa !5
  %93 = load ptr, ptr %13, align 8, !tbaa !5
  %94 = load i32, ptr %10, align 4, !tbaa !20
  %95 = zext i32 %94 to i64
  %96 = getelementptr inbounds %struct.EFI_IP6_ADDRESS_INFO, ptr %93, i64 %95
  store ptr %96, ptr %12, align 8, !tbaa !5
  %97 = load ptr, ptr %12, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.EFI_IP6_ADDRESS_INFO, ptr %97, i32 0, i32 0
  %99 = load ptr, ptr %11, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct._IP6_PREFIX_LIST_ENTRY, ptr %99, i32 0, i32 5
  %101 = call ptr @CopyMem(ptr noundef %98, ptr noundef %100, i64 noundef 16)
  %102 = load ptr, ptr %11, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._IP6_PREFIX_LIST_ENTRY, ptr %102, i32 0, i32 4
  %104 = load i8, ptr %103, align 8, !tbaa !40
  %105 = load ptr, ptr %12, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.EFI_IP6_ADDRESS_INFO, ptr %105, i32 0, i32 1
  store i8 %104, ptr %106, align 1, !tbaa !42
  %107 = load i32, ptr %10, align 4, !tbaa !20
  %108 = add i32 %107, 1
  store i32 %108, ptr %10, align 4, !tbaa !20
  br label %109

109:                                              ; preds = %88
  %110 = load ptr, ptr %8, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct._LIST_ENTRY, ptr %110, i32 0, i32 0
  %112 = load ptr, ptr %111, align 8, !tbaa !37
  store ptr %112, ptr %8, align 8, !tbaa !5
  br label %83, !llvm.loop !44

113:                                              ; preds = %83
  br label %114

114:                                              ; preds = %113
  %115 = call zeroext i8 @DebugAssertEnabled()
  %116 = icmp ne i8 %115, 0
  br i1 %116, label %117, label %124

117:                                              ; preds = %114
  %118 = load ptr, ptr %6, align 8, !tbaa !5
  %119 = load i32, ptr %118, align 4, !tbaa !20
  %120 = load i32, ptr %10, align 4, !tbaa !20
  %121 = icmp eq i32 %119, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %117
  call void @DebugAssert(ptr noundef @.str, i64 noundef 161, ptr noundef @.str.5)
  br label %123

123:                                              ; preds = %122, %117
  br label %124

124:                                              ; preds = %123, %114
  br label %125

125:                                              ; preds = %124
  br label %126

126:                                              ; preds = %125
  %127 = load ptr, ptr %13, align 8, !tbaa !5
  %128 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %127, ptr %128, align 8, !tbaa !5
  store i64 0, ptr %4, align 8
  store i32 1, ptr %14, align 4
  br label %129

129:                                              ; preds = %126, %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 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, 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
  %130 = load i64, ptr %4, align 8
  ret i64 %130
}

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 = !{!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 2248}
!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, !7, i64 32}
!41 = !{!"_IP6_PREFIX_LIST_ENTRY", !14, i64 0, !13, i64 16, !11, i64 24, !11, i64 28, !7, i64 32, !18, i64 33}
!42 = !{!43, !7, i64 16}
!43 = !{!"", !18, i64 0, !7, i64 16}
!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_ADDRESS_INFO = type { %struct.EFI_IPv6_ADDRESS, i8 }
%struct.EFI_IPv6_ADDRESS = type { [16 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.4 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [22 x i8], align 1

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #0

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

declare ptr @AllocatePool(i64 noundef) local_unnamed_addr #0

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

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

5:                                                ; preds = %3
  %.not38 = icmp eq ptr %0, null
  br i1 %.not38, 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 130, ptr noundef nonnull @.str.1) #2
  br label %10

10:                                               ; preds = %3, %9, %6
  %11 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not39 = icmp eq i8 %11, 0
  br i1 %.not39, 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 131, ptr noundef nonnull @.str.4) #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 2248
  br label %20

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

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

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

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

.lr.ph:                                           ; preds = %29, %.lr.ph
  %.146 = phi ptr [ %.1, %.lr.ph ], [ %.143, %29 ]
  %.13445 = phi i32 [ %37, %.lr.ph ], [ 0, %29 ]
  %30 = zext i32 %.13445 to i64
  %31 = getelementptr inbounds %struct.EFI_IP6_ADDRESS_INFO, ptr %27, i64 %30
  %32 = getelementptr inbounds i8, ptr %.146, i64 33
  %33 = tail call ptr @CopyMem(ptr noundef nonnull %31, ptr noundef nonnull %32, i64 noundef 16) #2
  %34 = getelementptr inbounds i8, ptr %.146, i64 32
  %35 = load i8, ptr %34, align 8, !tbaa !23
  %36 = getelementptr inbounds i8, ptr %31, i64 16
  store i8 %35, ptr %36, align 1, !tbaa !25
  %37 = add i32 %.13445, 1
  %.1 = load ptr, ptr %.146, align 8, !tbaa !19
  %.not41 = icmp eq ptr %.1, %19
  br i1 %.not41, label %._crit_edge, label %.lr.ph, !llvm.loop !27

._crit_edge:                                      ; preds = %.lr.ph, %29
  %.134.lcssa = phi i32 [ 0, %29 ], [ %37, %.lr.ph ]
  %38 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not42 = icmp eq i8 %38, 0
  br i1 %.not42, label %43, label %39

39:                                               ; preds = %._crit_edge
  %40 = load i32, ptr %1, align 4, !tbaa !22
  %41 = icmp eq i32 %40, %.134.lcssa
  br i1 %41, label %43, label %42

42:                                               ; preds = %39
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 161, ptr noundef nonnull @.str.5) #2
  br label %43

43:                                               ; preds = %39, %42, %._crit_edge
  store ptr %27, ptr %2, align 8, !tbaa !28
  br label %44

44:                                               ; preds = %24, %22, %43
  %.0 = phi i64 [ 0, %43 ], [ 0, %22 ], [ -9223372036854775799, %24 ]
  ret i64 %.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 = { 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, !8, i64 32}
!24 = !{!"_IP6_PREFIX_LIST_ENTRY", !13, i64 0, !12, i64 16, !7, i64 24, !7, i64 28, !8, i64 32, !17, i64 33}
!25 = !{!26, !8, i64 16}
!26 = !{!"", !17, i64 0, !8, i64 16}
!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