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

; 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_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._LIST_ENTRY = type { ptr, ptr }
%struct.EFI_IP6_CONFIG_INTERFACE_INFO = type { [32 x i16], i8, i32, %struct.EFI_MAC_ADDRESS, i32, ptr, i32, ptr }
%struct.EFI_MAC_ADDRESS = type { [32 x i8] }
%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.NET_MAP = type { %struct._LIST_ENTRY, %struct._LIST_ENTRY, i64 }
%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_IPv6_ADDRESS = type { [16 x i8] }

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

declare void @FreePool(ptr noundef) #1

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

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

declare zeroext i8 @NetIp6IsValidUnicast(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i64 @Ip6ConfigSetDnsServer(ptr noundef %0, i64 noundef %1, ptr noundef %2) #2 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i8, align 1
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  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 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %19 = load i64, ptr %6, align 8, !tbaa !9
  %20 = urem i64 %19, 16
  %21 = icmp ne i64 %20, 0
  br i1 %21, label %25, label %22

22:                                               ; preds = %3
  %23 = load i64, ptr %6, align 8, !tbaa !9
  %24 = icmp eq i64 %23, 0
  br i1 %24, label %25, label %26

25:                                               ; preds = %22, %3
  store i64 -9223372036854775804, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %164

26:                                               ; preds = %22
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct._IP6_CONFIG_INSTANCE, ptr %27, i32 0, i32 6
  %29 = load i32, ptr %28, align 8, !tbaa !11
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %32

31:                                               ; preds = %26
  store i64 -9223372036854775800, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %164

32:                                               ; preds = %26
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._IP6_CONFIG_INSTANCE, ptr %33, i32 0, i32 8
  %35 = getelementptr inbounds [7 x %struct.IP6_CONFIG_DATA_ITEM], ptr %34, i64 0, i64 6
  store ptr %35, ptr %15, align 8, !tbaa !5
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %36, ptr %12, align 8, !tbaa !5
  %37 = load ptr, ptr %15, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %37, i32 0, i32 5
  %39 = load ptr, ptr %38, align 8, !tbaa !24
  store ptr %39, ptr %11, align 8, !tbaa !5
  %40 = load i64, ptr %6, align 8, !tbaa !9
  %41 = udiv i64 %40, 16
  store i64 %41, ptr %14, align 8, !tbaa !9
  %42 = load ptr, ptr %15, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %42, i32 0, i32 6
  %44 = load i64, ptr %43, align 8, !tbaa !25
  %45 = udiv i64 %44, 16
  store i64 %45, ptr %13, align 8, !tbaa !9
  store i8 0, ptr %16, align 1, !tbaa !24
  %46 = load i64, ptr %14, align 8, !tbaa !9
  %47 = load i64, ptr %13, align 8, !tbaa !9
  %48 = icmp ne i64 %46, %47
  br i1 %48, label %49, label %56

49:                                               ; preds = %32
  %50 = load i64, ptr %6, align 8, !tbaa !9
  %51 = call ptr @AllocatePool(i64 noundef %50)
  store ptr %51, ptr %17, align 8, !tbaa !5
  %52 = load ptr, ptr %17, align 8, !tbaa !5
  %53 = icmp eq ptr %52, null
  br i1 %53, label %54, label %55

54:                                               ; preds = %49
  store i64 -9223372036854775799, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %164

55:                                               ; preds = %49
  br label %57

56:                                               ; preds = %32
  store ptr null, ptr %17, align 8, !tbaa !5
  br label %57

57:                                               ; preds = %56, %55
  store i64 0, ptr %9, align 8, !tbaa !9
  br label %58

58:                                               ; preds = %121, %57
  %59 = load i64, ptr %9, align 8, !tbaa !9
  %60 = load i64, ptr %14, align 8, !tbaa !9
  %61 = icmp ult i64 %59, %60
  br i1 %61, label %62, label %124

62:                                               ; preds = %58
  %63 = load ptr, ptr %12, align 8, !tbaa !5
  %64 = load i64, ptr %9, align 8, !tbaa !9
  %65 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %63, i64 %64
  %66 = call zeroext i8 @NetIp6IsValidUnicast(ptr noundef %65)
  %67 = icmp ne i8 %66, 0
  br i1 %67, label %70, label %68

68:                                               ; preds = %62
  %69 = load ptr, ptr %17, align 8, !tbaa !5
  call void @FreePool(ptr noundef %69)
  store i64 -9223372036854775806, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %164

70:                                               ; preds = %62
  %71 = load i64, ptr %9, align 8, !tbaa !9
  %72 = add i64 %71, 1
  store i64 %72, ptr %10, align 8, !tbaa !9
  br label %73

73:                                               ; preds = %89, %70
  %74 = load i64, ptr %10, align 8, !tbaa !9
  %75 = load i64, ptr %14, align 8, !tbaa !9
  %76 = icmp ult i64 %74, %75
  br i1 %76, label %77, label %92

77:                                               ; preds = %73
  %78 = load ptr, ptr %12, align 8, !tbaa !5
  %79 = load i64, ptr %9, align 8, !tbaa !9
  %80 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %78, i64 %79
  %81 = load ptr, ptr %12, align 8, !tbaa !5
  %82 = load i64, ptr %10, align 8, !tbaa !9
  %83 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %81, i64 %82
  %84 = call i64 @CompareMem(ptr noundef %80, ptr noundef %83, i64 noundef 16)
  %85 = icmp eq i64 %84, 0
  br i1 %85, label %86, label %88

86:                                               ; preds = %77
  %87 = load ptr, ptr %17, align 8, !tbaa !5
  call void @FreePool(ptr noundef %87)
  store i64 -9223372036854775806, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %164

88:                                               ; preds = %77
  br label %89

89:                                               ; preds = %88
  %90 = load i64, ptr %10, align 8, !tbaa !9
  %91 = add i64 %90, 1
  store i64 %91, ptr %10, align 8, !tbaa !9
  br label %73, !llvm.loop !27

92:                                               ; preds = %73
  %93 = load i8, ptr %16, align 1, !tbaa !24
  %94 = icmp ne i8 %93, 0
  br i1 %94, label %95, label %96

95:                                               ; preds = %92
  br label %121

96:                                               ; preds = %92
  store i64 0, ptr %8, align 8, !tbaa !9
  br label %97

97:                                               ; preds = %112, %96
  %98 = load i64, ptr %8, align 8, !tbaa !9
  %99 = load i64, ptr %13, align 8, !tbaa !9
  %100 = icmp ult i64 %98, %99
  br i1 %100, label %101, label %115

101:                                              ; preds = %97
  %102 = load ptr, ptr %12, align 8, !tbaa !5
  %103 = load i64, ptr %9, align 8, !tbaa !9
  %104 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %102, i64 %103
  %105 = load ptr, ptr %11, align 8, !tbaa !5
  %106 = load i64, ptr %8, align 8, !tbaa !9
  %107 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %105, i64 %106
  %108 = call i64 @CompareMem(ptr noundef %104, ptr noundef %107, i64 noundef 16)
  %109 = icmp eq i64 %108, 0
  br i1 %109, label %110, label %111

110:                                              ; preds = %101
  br label %115

111:                                              ; preds = %101
  br label %112

112:                                              ; preds = %111
  %113 = load i64, ptr %8, align 8, !tbaa !9
  %114 = add i64 %113, 1
  store i64 %114, ptr %8, align 8, !tbaa !9
  br label %97, !llvm.loop !29

115:                                              ; preds = %110, %97
  %116 = load i64, ptr %8, align 8, !tbaa !9
  %117 = load i64, ptr %13, align 8, !tbaa !9
  %118 = icmp eq i64 %116, %117
  br i1 %118, label %119, label %120

119:                                              ; preds = %115
  store i8 1, ptr %16, align 1, !tbaa !24
  br label %120

120:                                              ; preds = %119, %115
  br label %121

121:                                              ; preds = %120, %95
  %122 = load i64, ptr %9, align 8, !tbaa !9
  %123 = add i64 %122, 1
  store i64 %123, ptr %9, align 8, !tbaa !9
  br label %58, !llvm.loop !30

124:                                              ; preds = %58
  %125 = load i8, ptr %16, align 1, !tbaa !24
  %126 = icmp ne i8 %125, 0
  br i1 %126, label %136, label %127

127:                                              ; preds = %124
  %128 = load i64, ptr %6, align 8, !tbaa !9
  %129 = load ptr, ptr %15, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %129, i32 0, i32 6
  %131 = load i64, ptr %130, align 8, !tbaa !25
  %132 = icmp eq i64 %128, %131
  br i1 %132, label %133, label %136

133:                                              ; preds = %127
  %134 = load ptr, ptr %15, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %134, i32 0, i32 2
  store i64 0, ptr %135, align 8, !tbaa !31
  store i64 -9223372036854775787, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %164

136:                                              ; preds = %127, %124
  %137 = load ptr, ptr %17, align 8, !tbaa !5
  %138 = icmp ne ptr %137, null
  br i1 %138, label %139, label %152

139:                                              ; preds = %136
  %140 = load ptr, ptr %15, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %140, i32 0, i32 5
  %142 = load ptr, ptr %141, align 8, !tbaa !24
  %143 = icmp ne ptr %142, null
  br i1 %143, label %144, label %148

144:                                              ; preds = %139
  %145 = load ptr, ptr %15, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %145, i32 0, i32 5
  %147 = load ptr, ptr %146, align 8, !tbaa !24
  call void @FreePool(ptr noundef %147)
  br label %148

148:                                              ; preds = %144, %139
  %149 = load ptr, ptr %17, align 8, !tbaa !5
  %150 = load ptr, ptr %15, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %150, i32 0, i32 5
  store ptr %149, ptr %151, align 8, !tbaa !24
  br label %152

152:                                              ; preds = %148, %136
  %153 = load ptr, ptr %15, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %153, i32 0, i32 5
  %155 = load ptr, ptr %154, align 8, !tbaa !24
  %156 = load ptr, ptr %7, align 8, !tbaa !5
  %157 = load i64, ptr %6, align 8, !tbaa !9
  %158 = call ptr @CopyMem(ptr noundef %155, ptr noundef %156, i64 noundef %157)
  %159 = load i64, ptr %6, align 8, !tbaa !9
  %160 = load ptr, ptr %15, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %160, i32 0, i32 6
  store i64 %159, ptr %161, align 8, !tbaa !25
  %162 = load ptr, ptr %15, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %162, i32 0, i32 2
  store i64 0, ptr %163, align 8, !tbaa !31
  store i64 0, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %164

164:                                              ; preds = %152, %133, %86, %68, %54, %31, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  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 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
  %165 = load i64, ptr %4, align 8
  ret i64 %165
}

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, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !13, i64 176}
!12 = !{!"_IP6_CONFIG_INSTANCE", !13, i64 0, !7, i64 4, !14, i64 8, !15, i64 24, !16, i64 32, !17, i64 168, !13, i64 176, !18, i64 180, !7, i64 184, !19, i64 800, !19, i64 840, !20, i64 880, !6, i64 912, !6, i64 920, !6, i64 928, !6, i64 936, !7, i64 944, !13, i64 948, !6, i64 952, !13, i64 960, !6, i64 968, !13, i64 976, !21, i64 984, !23, i64 1040}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!15 = !{!"short", !7, i64 0}
!16 = !{!"", !7, i64 0, !7, i64 64, !13, i64 68, !17, i64 72, !13, i64 104, !6, i64 112, !13, i64 120, !6, i64 128}
!17 = !{!"", !7, i64 0}
!18 = !{!"", !13, i64 0}
!19 = !{!"", !14, i64 0, !14, i64 16, !10, i64 32}
!20 = !{!"_EFI_IP6_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!21 = !{!"_IP6_FORM_CALLBACK_INFO", !13, i64 0, !6, i64 8, !22, i64 16, !6, i64 40, !6, i64 48}
!22 = !{!"_EFI_HII_CONFIG_ACCESS_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!"", !13, i64 0, !18, i64 4, !17, i64 8, !14, i64 16, !13, i64 32, !14, i64 40, !13, i64 56, !14, i64 64, !13, i64 80}
!24 = !{!7, !7, i64 0}
!25 = !{!26, !10, i64 80}
!26 = !{!"", !6, i64 0, !6, i64 8, !10, i64 16, !7, i64 24, !19, i64 32, !7, i64 72, !10, i64 80}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = distinct !{!29, !28}
!30 = distinct !{!30, !28}
!31 = !{!26, !10, i64 16}


; 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_IPv6_ADDRESS = type { [16 x i8] }

declare ptr @AllocatePool(i64 noundef) local_unnamed_addr #0

declare void @FreePool(ptr noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775806, 1) i64 @Ip6ConfigSetDnsServer(ptr nocapture noundef %0, i64 noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = and i64 %1, 15
  %5 = icmp ne i64 %4, 0
  %6 = icmp eq i64 %1, 0
  %or.cond = or i1 %6, %5
  br i1 %or.cond, label %63, label %7

7:                                                ; preds = %3
  %8 = getelementptr inbounds i8, ptr %0, i64 176
  %9 = load i32, ptr %8, align 8, !tbaa !5
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %10, label %63

10:                                               ; preds = %7
  %11 = getelementptr inbounds i8, ptr %0, i64 784
  %12 = load ptr, ptr %11, align 8, !tbaa !22
  %13 = lshr exact i64 %1, 4
  %14 = getelementptr inbounds i8, ptr %0, i64 792
  %15 = load i64, ptr %14, align 8, !tbaa !23
  %.fr86 = freeze i64 %15
  %16 = lshr i64 %.fr86, 4
  %.not62 = icmp eq i64 %13, %16
  br i1 %.not62, label %.lr.ph79, label %17

17:                                               ; preds = %10
  %18 = tail call ptr @AllocatePool(i64 noundef %1) #3
  %19 = icmp eq ptr %18, null
  br i1 %19, label %63, label %.lr.ph79

.lr.ph79:                                         ; preds = %17, %10
  %.0 = phi ptr [ %18, %17 ], [ null, %10 ]
  %20 = icmp ugt i64 %.fr86, 15
  %umax91 = tail call i64 @llvm.umax.i64(i64 %13, i64 1)
  br i1 %20, label %.lr.ph79.split.us.preheader, label %.lr.ph79.split

.lr.ph79.split.us.preheader:                      ; preds = %.lr.ph79
  %21 = tail call zeroext i8 @NetIp6IsValidUnicast(ptr noundef %2) #3
  %.not66.us105 = icmp eq i8 %21, 0
  br i1 %.not66.us105, label %.split.us, label %.lr.ph108

.lr.ph108:                                        ; preds = %.lr.ph79.split.us.preheader, %.lr.ph79.split.us.backedge
  %.05676.us107 = phi i64 [ %23, %.lr.ph79.split.us.backedge ], [ 0, %.lr.ph79.split.us.preheader ]
  %.05377.us106 = phi i8 [ %.05377.us.be, %.lr.ph79.split.us.backedge ], [ 0, %.lr.ph79.split.us.preheader ]
  %22 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %2, i64 %.05676.us107
  %23 = add nuw nsw i64 %.05676.us107, 1
  %24 = icmp ult i64 %23, %13
  br i1 %24, label %.lr.ph.us, label %._crit_edge.us

25:                                               ; preds = %.lr.ph.us
  %26 = add nuw nsw i64 %.05770.us, 1
  %27 = icmp ult i64 %26, %13
  br i1 %27, label %.lr.ph.us, label %._crit_edge.us, !llvm.loop !25

._crit_edge.us:                                   ; preds = %25, %.lr.ph108
  %.not67.us = icmp eq i8 %.05377.us106, 0
  br i1 %.not67.us, label %.preheader.us, label %.thread

.preheader.us:                                    ; preds = %._crit_edge.us, %31
  %.05571.us = phi i64 [ %32, %31 ], [ 0, %._crit_edge.us ]
  %28 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %12, i64 %.05571.us
  %29 = tail call i64 @CompareMem(ptr noundef %22, ptr noundef %28, i64 noundef 16) #3
  %30 = icmp eq i64 %29, 0
  br i1 %30, label %33, label %31

31:                                               ; preds = %.preheader.us
  %32 = add nuw nsw i64 %.05571.us, 1
  %exitcond90.not = icmp eq i64 %32, %16
  br i1 %exitcond90.not, label %33, label %.preheader.us, !llvm.loop !27

33:                                               ; preds = %.preheader.us, %31
  %.055.lcssa.us = phi i64 [ %.05571.us, %.preheader.us ], [ %16, %31 ]
  %34 = icmp eq i64 %.055.lcssa.us, %16
  %spec.select.us = zext i1 %34 to i8
  %exitcond92.not = icmp eq i64 %23, %umax91
  br i1 %exitcond92.not, label %._crit_edge80, label %.lr.ph79.split.us.backedge

.lr.ph79.split.us.backedge:                       ; preds = %33, %.thread
  %.05377.us.be = phi i8 [ %spec.select.us, %33 ], [ 1, %.thread ]
  %35 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %2, i64 %23
  %36 = tail call zeroext i8 @NetIp6IsValidUnicast(ptr noundef nonnull %35) #3
  %.not66.us = icmp eq i8 %36, 0
  br i1 %.not66.us, label %.split.us, label %.lr.ph108, !llvm.loop !28

.thread:                                          ; preds = %._crit_edge.us
  %exitcond92.not95 = icmp eq i64 %23, %umax91
  br i1 %exitcond92.not95, label %._crit_edge80.thread97, label %.lr.ph79.split.us.backedge

.lr.ph.us:                                        ; preds = %.lr.ph108, %25
  %.05770.us = phi i64 [ %26, %25 ], [ %23, %.lr.ph108 ]
  %37 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %2, i64 %.05770.us
  %38 = tail call i64 @CompareMem(ptr noundef %22, ptr noundef nonnull %37, i64 noundef 16) #3
  %39 = icmp eq i64 %38, 0
  br i1 %39, label %.split83.us, label %25

.lr.ph79.split:                                   ; preds = %.lr.ph79, %._crit_edge
  %.05676 = phi i64 [ %43, %._crit_edge ], [ 0, %.lr.ph79 ]
  %40 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %2, i64 %.05676
  %41 = tail call zeroext i8 @NetIp6IsValidUnicast(ptr noundef %40) #3
  %.not66 = icmp eq i8 %41, 0
  br i1 %.not66, label %.split.us, label %42

.split.us:                                        ; preds = %.lr.ph79.split, %.lr.ph79.split.us.backedge, %.lr.ph79.split.us.preheader
  tail call void @FreePool(ptr noundef %.0) #3
  br label %63

42:                                               ; preds = %.lr.ph79.split
  %43 = add nuw nsw i64 %.05676, 1
  %44 = icmp ult i64 %43, %13
  br i1 %44, label %.lr.ph, label %._crit_edge

45:                                               ; preds = %.lr.ph
  %46 = add nuw nsw i64 %.05770, 1
  %47 = icmp ult i64 %46, %13
  br i1 %47, label %.lr.ph, label %._crit_edge, !llvm.loop !25

.lr.ph:                                           ; preds = %42, %45
  %.05770 = phi i64 [ %46, %45 ], [ %43, %42 ]
  %48 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %2, i64 %.05770
  %49 = tail call i64 @CompareMem(ptr noundef %40, ptr noundef nonnull %48, i64 noundef 16) #3
  %50 = icmp eq i64 %49, 0
  br i1 %50, label %.split83.us, label %45

.split83.us:                                      ; preds = %.lr.ph, %.lr.ph.us
  tail call void @FreePool(ptr noundef %.0) #3
  br label %63

._crit_edge:                                      ; preds = %45, %42
  %exitcond.not = icmp eq i64 %43, %umax91
  br i1 %exitcond.not, label %._crit_edge80.thread97, label %.lr.ph79.split, !llvm.loop !28

._crit_edge80:                                    ; preds = %33
  br i1 %34, label %._crit_edge80.thread97, label %51

51:                                               ; preds = %._crit_edge80
  %52 = load i64, ptr %14, align 8, !tbaa !23
  %53 = icmp eq i64 %52, %1
  br i1 %53, label %54, label %._crit_edge80.thread97

54:                                               ; preds = %51
  %55 = getelementptr inbounds i8, ptr %0, i64 728
  store i64 0, ptr %55, align 8, !tbaa !29
  br label %63

._crit_edge80.thread97:                           ; preds = %._crit_edge, %.thread, %51, %._crit_edge80
  %.not64 = icmp eq ptr %.0, null
  %.pre = load ptr, ptr %11, align 8, !tbaa !22
  br i1 %.not64, label %59, label %56

56:                                               ; preds = %._crit_edge80.thread97
  %.not65 = icmp eq ptr %.pre, null
  br i1 %.not65, label %58, label %57

57:                                               ; preds = %56
  tail call void @FreePool(ptr noundef nonnull %.pre) #3
  br label %58

58:                                               ; preds = %57, %56
  store ptr %.0, ptr %11, align 8, !tbaa !22
  br label %59

59:                                               ; preds = %58, %._crit_edge80.thread97
  %60 = phi ptr [ %.0, %58 ], [ %.pre, %._crit_edge80.thread97 ]
  %61 = tail call ptr @CopyMem(ptr noundef %60, ptr noundef %2, i64 noundef %1) #3
  store i64 %1, ptr %14, align 8, !tbaa !23
  %62 = getelementptr inbounds i8, ptr %0, i64 728
  store i64 0, ptr %62, align 8, !tbaa !29
  br label %63

63:                                               ; preds = %17, %7, %3, %59, %54, %.split83.us, %.split.us
  %.054 = phi i64 [ -9223372036854775806, %.split83.us ], [ -9223372036854775806, %.split.us ], [ 0, %59 ], [ -9223372036854775787, %54 ], [ -9223372036854775804, %3 ], [ -9223372036854775800, %7 ], [ -9223372036854775799, %17 ]
  ret i64 %.054
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #2

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !7, i64 176}
!6 = !{!"_IP6_CONFIG_INSTANCE", !7, i64 0, !8, i64 4, !10, i64 8, !12, i64 24, !13, i64 32, !14, i64 168, !7, i64 176, !15, i64 180, !8, i64 184, !16, i64 800, !16, i64 840, !18, i64 880, !11, i64 912, !11, i64 920, !11, i64 928, !11, i64 936, !8, i64 944, !7, i64 948, !11, i64 952, !7, i64 960, !11, i64 968, !7, i64 976, !19, i64 984, !21, i64 1040}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_LIST_ENTRY", !11, i64 0, !11, i64 8}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!"", !8, i64 0, !8, i64 64, !7, i64 68, !14, i64 72, !7, i64 104, !11, i64 112, !7, i64 120, !11, i64 128}
!14 = !{!"", !8, i64 0}
!15 = !{!"", !7, i64 0}
!16 = !{!"", !10, i64 0, !10, i64 16, !17, i64 32}
!17 = !{!"long long", !8, i64 0}
!18 = !{!"_EFI_IP6_CONFIG_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!19 = !{!"_IP6_FORM_CALLBACK_INFO", !7, i64 0, !11, i64 8, !20, i64 16, !11, i64 40, !11, i64 48}
!20 = !{!"_EFI_HII_CONFIG_ACCESS_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16}
!21 = !{!"", !7, i64 0, !15, i64 4, !14, i64 8, !10, i64 16, !7, i64 32, !10, i64 40, !7, i64 56, !10, i64 64, !7, i64 80}
!22 = !{!8, !8, i64 0}
!23 = !{!24, !17, i64 80}
!24 = !{!"", !11, i64 0, !11, i64 8, !17, i64 16, !8, i64 24, !16, i64 32, !8, i64 72, !17, i64 80}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = distinct !{!27, !26}
!28 = distinct !{!28, !26}
!29 = !{!24, !17, i64 16}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass