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

; 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.EFI_IPv6_ADDRESS = type { [16 x i8] }
%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._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._IP6_INTERFACE = type { i32, %struct._LIST_ENTRY, i64, %struct._LIST_ENTRY, i32, i8, ptr, ptr, ptr, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i8 }
%struct._IP6_ADDRESS_INFO = type { i32, %struct._LIST_ENTRY, %struct.EFI_IPv6_ADDRESS, i8, i8, i32, i32 }

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

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

declare zeroext i8 @NetIp6IsUnspecifiedAddr(ptr noundef) #1

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

declare zeroext i8 @Ip6IsOneOfSetAddress(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

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

25:                                               ; preds = %2
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = call i64 @Ip6Cancel(ptr noundef %26, ptr noundef null)
  store i64 %27, ptr %8, align 8, !tbaa !20
  %28 = load i64, ptr %8, align 8, !tbaa !20
  %29 = icmp slt i64 %28, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %25
  store i64 -9223372036854775801, ptr %3, align 8
  store i32 1, ptr %15, align 4
  br label %134

31:                                               ; preds = %25
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = call ptr @CopyMem(ptr noundef %32, ptr noundef %33, i64 noundef 52)
  store i64 0, ptr %3, align 8
  store i32 1, ptr %15, align 4
  br label %134

35:                                               ; preds = %2
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.EFI_IP6_CONFIG_DATA, ptr %36, i32 0, i32 5
  %38 = call zeroext i8 @NetIp6IsUnspecifiedAddr(ptr noundef %37)
  store i8 %38, ptr %11, align 1, !tbaa !21
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.EFI_IP6_CONFIG_DATA, ptr %39, i32 0, i32 4
  %41 = call zeroext i8 @NetIp6IsUnspecifiedAddr(ptr noundef %40)
  store i8 %41, ptr %12, align 1, !tbaa !21
  %42 = load i8, ptr %11, align 1, !tbaa !21
  %43 = zext i8 %42 to i32
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %73

45:                                               ; preds = %35
  %46 = load i8, ptr %12, align 1, !tbaa !21
  %47 = zext i8 %46 to i32
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %73

49:                                               ; preds = %45
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._IP6_SERVICE, ptr %50, i32 0, i32 6
  %52 = load ptr, ptr %51, align 8, !tbaa !22
  %53 = getelementptr inbounds %struct._IP6_INTERFACE, ptr %52, i32 0, i32 2
  %54 = load i64, ptr %53, align 8, !tbaa !38
  %55 = add nsw i64 %54, 1
  store i64 %55, ptr %53, align 8, !tbaa !38
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._IP6_SERVICE, ptr %56, i32 0, i32 6
  %58 = load ptr, ptr %57, align 8, !tbaa !22
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct._IP6_PROTOCOL, ptr %59, i32 0, i32 12
  store ptr %58, ptr %60, align 8, !tbaa !40
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct._IP6_SERVICE, ptr %61, i32 0, i32 6
  %63 = load ptr, ptr %62, align 8, !tbaa !22
  %64 = getelementptr inbounds %struct._IP6_INTERFACE, ptr %63, i32 0, i32 14
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct._IP6_PROTOCOL, ptr %65, i32 0, i32 13
  %67 = call ptr @InsertTailList(ptr noundef %64, ptr noundef %66)
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = call ptr @CopyMem(ptr noundef %68, ptr noundef %69, i64 noundef 52)
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct._IP6_PROTOCOL, ptr %71, i32 0, i32 3
  store i64 1, ptr %72, align 8, !tbaa !19
  store i64 0, ptr %3, align 8
  store i32 1, ptr %15, align 4
  br label %134

73:                                               ; preds = %45, %35
  %74 = load i8, ptr %11, align 1, !tbaa !21
  %75 = zext i8 %74 to i32
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %77, label %90

77:                                               ; preds = %73
  %78 = load i8, ptr %12, align 1, !tbaa !21
  %79 = icmp ne i8 %78, 0
  br i1 %79, label %90, label %80

80:                                               ; preds = %77
  %81 = load ptr, ptr %6, align 8, !tbaa !5
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.EFI_IP6_CONFIG_DATA, ptr %82, i32 0, i32 4
  %84 = call i64 @Ip6SelectSourceAddress(ptr noundef %81, ptr noundef %83, ptr noundef %13)
  store i64 %84, ptr %8, align 8, !tbaa !20
  %85 = load i64, ptr %8, align 8, !tbaa !20
  %86 = icmp slt i64 %85, 0
  br i1 %86, label %87, label %89

87:                                               ; preds = %80
  %88 = load i64, ptr %8, align 8, !tbaa !20
  store i64 %88, ptr %3, align 8
  store i32 1, ptr %15, align 4
  br label %134

89:                                               ; preds = %80
  br label %94

90:                                               ; preds = %77, %73
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.EFI_IP6_CONFIG_DATA, ptr %91, i32 0, i32 5
  %93 = call ptr @CopyMem(ptr noundef %13, ptr noundef %92, i64 noundef 16)
  br label %94

94:                                               ; preds = %90, %89
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = call zeroext i8 @Ip6IsOneOfSetAddress(ptr noundef %95, ptr noundef %13, ptr noundef %7, ptr noundef %10)
  store i8 %96, ptr %14, align 1, !tbaa !21
  %97 = load i8, ptr %14, align 1, !tbaa !21
  %98 = icmp ne i8 %97, 0
  br i1 %98, label %99, label %112

99:                                               ; preds = %94
  %100 = load ptr, ptr %10, align 8, !tbaa !5
  %101 = icmp ne ptr %100, null
  br i1 %101, label %102, label %108

102:                                              ; preds = %99
  %103 = load ptr, ptr %10, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct._IP6_ADDRESS_INFO, ptr %103, i32 0, i32 4
  %105 = load i8, ptr %104, align 1, !tbaa !41
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct._IP6_PROTOCOL, ptr %106, i32 0, i32 6
  store i8 %105, ptr %107, align 8, !tbaa !43
  br label %111

108:                                              ; preds = %99
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct._IP6_PROTOCOL, ptr %109, i32 0, i32 6
  store i8 64, ptr %110, align 8, !tbaa !43
  br label %111

111:                                              ; preds = %108, %102
  br label %113

112:                                              ; preds = %94
  store i64 -9223372036854775806, ptr %3, align 8
  store i32 1, ptr %15, align 4
  br label %134

113:                                              ; preds = %111
  %114 = load ptr, ptr %7, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct._IP6_INTERFACE, ptr %114, i32 0, i32 2
  %116 = load i64, ptr %115, align 8, !tbaa !38
  %117 = add nsw i64 %116, 1
  store i64 %117, ptr %115, align 8, !tbaa !38
  %118 = load ptr, ptr %7, align 8, !tbaa !5
  %119 = load ptr, ptr %4, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct._IP6_PROTOCOL, ptr %119, i32 0, i32 12
  store ptr %118, ptr %120, align 8, !tbaa !40
  %121 = load ptr, ptr %7, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct._IP6_INTERFACE, ptr %121, i32 0, i32 14
  %123 = load ptr, ptr %4, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct._IP6_PROTOCOL, ptr %123, i32 0, i32 13
  %125 = call ptr @InsertTailList(ptr noundef %122, ptr noundef %124)
  %126 = load ptr, ptr %9, align 8, !tbaa !5
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = call ptr @CopyMem(ptr noundef %126, ptr noundef %127, i64 noundef 52)
  %129 = load ptr, ptr %9, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.EFI_IP6_CONFIG_DATA, ptr %129, i32 0, i32 5
  %131 = call ptr @CopyMem(ptr noundef %130, ptr noundef %13, i64 noundef 16)
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct._IP6_PROTOCOL, ptr %132, i32 0, i32 3
  store i64 1, ptr %133, align 8, !tbaa !19
  store i64 0, ptr %3, align 8
  store i32 1, ptr %15, align 4
  br label %134

134:                                              ; preds = %113, %112, %87, %49, %31, %30
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 1, 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
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %135 = load i64, ptr %3, align 8
  ret i64 %135
}

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

declare ptr @InsertTailList(ptr noundef, ptr noundef) #1

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!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, !6, i64 96}
!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, !13, i64 88}
!20 = !{!13, !13, i64 0}
!21 = !{!7, !7, i64 0}
!22 = !{!23, !6, i64 72}
!23 = !{!"_IP6_SERVICE", !11, i64 0, !24, i64 8, !13, i64 24, !13, i64 32, !14, i64 40, !14, i64 56, !6, i64 72, !6, i64 80, !25, i64 88, !18, i64 136, !27, 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, !28, i64 2352, !30, i64 2372, !6, i64 3032, !6, i64 3040, !31, i64 3048, !6, i64 4176, !11, i64 4184, !11, i64 4188}
!24 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!25 = !{!"", !11, i64 0, !6, i64 8, !6, i64 16, !26, i64 24}
!26 = !{!"", !6, i64 0, !13, i64 8, !7, i64 16}
!27 = !{!"", !13, i64 0, !14, i64 8}
!28 = !{!"", !11, i64 0, !11, i64 4, !29, i64 8, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15, !7, i64 16}
!29 = !{!"short", !7, i64 0}
!30 = !{!"", !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}
!31 = !{!"_IP6_CONFIG_INSTANCE", !11, i64 0, !7, i64 4, !14, i64 8, !29, i64 24, !32, i64 32, !18, i64 168, !11, i64 176, !33, i64 180, !7, i64 184, !15, i64 800, !15, i64 840, !34, 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, !35, i64 984, !37, i64 1040}
!32 = !{!"", !7, i64 0, !7, i64 64, !11, i64 68, !18, i64 72, !11, i64 104, !6, i64 112, !11, i64 120, !6, i64 128}
!33 = !{!"", !11, i64 0}
!34 = !{!"_EFI_IP6_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!35 = !{!"_IP6_FORM_CALLBACK_INFO", !11, i64 0, !6, i64 8, !36, i64 16, !6, i64 40, !6, i64 48}
!36 = !{!"_EFI_HII_CONFIG_ACCESS_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!37 = !{!"", !11, i64 0, !33, i64 4, !18, i64 8, !14, i64 16, !11, i64 32, !14, i64 40, !11, i64 56, !14, i64 64, !11, i64 80}
!38 = !{!39, !13, i64 24}
!39 = !{!"_IP6_INTERFACE", !11, i64 0, !14, i64 8, !13, i64 24, !14, i64 32, !11, i64 48, !7, i64 52, !6, i64 56, !6, i64 64, !6, i64 72, !14, i64 80, !14, i64 96, !11, i64 112, !14, i64 120, !14, i64 136, !14, i64 152, !7, i64 168}
!40 = !{!10, !6, i64 264}
!41 = !{!42, !7, i64 41}
!42 = !{!"_IP6_ADDRESS_INFO", !11, i64 0, !14, i64 8, !18, i64 24, !7, i64 40, !7, i64 41, !11, i64 44, !11, i64 48}
!43 = !{!10, !7, i64 120}


; 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] }

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

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

declare zeroext i8 @NetIp6IsUnspecifiedAddr(ptr noundef) local_unnamed_addr #1

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

declare zeroext i8 @Ip6IsOneOfSetAddress(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775808, 1) i64 @Ip6ConfigProtocol(ptr noundef %0, ptr noundef %1) local_unnamed_addr #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.EFI_IPv6_ADDRESS, align 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #3
  %6 = getelementptr inbounds i8, ptr %0, i64 96
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 300
  %9 = getelementptr inbounds i8, ptr %0, i64 88
  %10 = load i64, ptr %9, align 8, !tbaa !18
  %11 = icmp eq i64 %10, 1
  br i1 %11, label %12, label %17

12:                                               ; preds = %2
  %13 = tail call i64 @Ip6Cancel(ptr noundef nonnull %0, ptr noundef null)
  %14 = icmp slt i64 %13, 0
  br i1 %14, label %62, label %15

15:                                               ; preds = %12
  %16 = tail call ptr @CopyMem(ptr noundef nonnull %8, ptr noundef %1, i64 noundef 52) #3
  br label %62

17:                                               ; preds = %2
  %18 = getelementptr inbounds i8, ptr %1, i64 20
  %19 = tail call zeroext i8 @NetIp6IsUnspecifiedAddr(ptr noundef nonnull %18) #3
  %20 = getelementptr inbounds i8, ptr %1, i64 4
  %21 = tail call zeroext i8 @NetIp6IsUnspecifiedAddr(ptr noundef nonnull %20) #3
  %22 = icmp ne i8 %19, 0
  %23 = icmp ne i8 %21, 0
  %or.cond = select i1 %22, i1 %23, i1 false
  br i1 %or.cond, label %24, label %35

24:                                               ; preds = %17
  %25 = getelementptr inbounds i8, ptr %7, i64 72
  %26 = load ptr, ptr %25, align 8, !tbaa !19
  %27 = getelementptr inbounds i8, ptr %26, i64 24
  %28 = load i64, ptr %27, align 8, !tbaa !35
  %29 = add nsw i64 %28, 1
  store i64 %29, ptr %27, align 8, !tbaa !35
  %30 = getelementptr inbounds i8, ptr %0, i64 264
  store ptr %26, ptr %30, align 8, !tbaa !37
  %31 = getelementptr inbounds i8, ptr %26, i64 152
  %32 = getelementptr inbounds i8, ptr %0, i64 272
  %33 = tail call ptr @InsertTailList(ptr noundef nonnull %31, ptr noundef nonnull %32) #3
  %34 = tail call ptr @CopyMem(ptr noundef nonnull %8, ptr noundef %1, i64 noundef 52) #3
  store i64 1, ptr %9, align 8, !tbaa !18
  br label %62

35:                                               ; preds = %17
  %36 = icmp eq i8 %19, 0
  %or.cond4 = select i1 %36, i1 true, i1 %23
  br i1 %or.cond4, label %40, label %37

37:                                               ; preds = %35
  %38 = call i64 @Ip6SelectSourceAddress(ptr noundef %7, ptr noundef nonnull %20, ptr noundef nonnull %5) #3
  %39 = icmp slt i64 %38, 0
  br i1 %39, label %62, label %42

40:                                               ; preds = %35
  %41 = call ptr @CopyMem(ptr noundef nonnull %5, ptr noundef nonnull %18, i64 noundef 16) #3
  br label %42

42:                                               ; preds = %37, %40
  %43 = call zeroext i8 @Ip6IsOneOfSetAddress(ptr noundef %7, ptr noundef nonnull %5, ptr noundef nonnull %3, ptr noundef nonnull %4) #3
  %.not = icmp eq i8 %43, 0
  br i1 %.not, label %62, label %44

44:                                               ; preds = %42
  %45 = load ptr, ptr %4, align 8, !tbaa !38
  %.not42 = icmp eq ptr %45, null
  br i1 %.not42, label %49, label %46

46:                                               ; preds = %44
  %47 = getelementptr inbounds i8, ptr %45, i64 41
  %48 = load i8, ptr %47, align 1, !tbaa !39
  br label %49

49:                                               ; preds = %44, %46
  %.sink = phi i8 [ %48, %46 ], [ 64, %44 ]
  %50 = getelementptr inbounds i8, ptr %0, i64 120
  store i8 %.sink, ptr %50, align 8
  %51 = load ptr, ptr %3, align 8, !tbaa !38
  %52 = getelementptr inbounds i8, ptr %51, i64 24
  %53 = load i64, ptr %52, align 8, !tbaa !35
  %54 = add nsw i64 %53, 1
  store i64 %54, ptr %52, align 8, !tbaa !35
  %55 = getelementptr inbounds i8, ptr %0, i64 264
  store ptr %51, ptr %55, align 8, !tbaa !37
  %56 = getelementptr inbounds i8, ptr %51, i64 152
  %57 = getelementptr inbounds i8, ptr %0, i64 272
  %58 = call ptr @InsertTailList(ptr noundef nonnull %56, ptr noundef nonnull %57) #3
  %59 = call ptr @CopyMem(ptr noundef nonnull %8, ptr noundef %1, i64 noundef 52) #3
  %60 = getelementptr inbounds i8, ptr %0, i64 320
  %61 = call ptr @CopyMem(ptr noundef nonnull %60, ptr noundef nonnull %5, i64 noundef 16) #3
  store i64 1, ptr %9, align 8, !tbaa !18
  br label %62

62:                                               ; preds = %42, %37, %12, %49, %24, %15
  %.0 = phi i64 [ 0, %15 ], [ 0, %24 ], [ 0, %49 ], [ -9223372036854775801, %12 ], [ %38, %37 ], [ -9223372036854775806, %42 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  ret i64 %.0
}

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

declare ptr @InsertTailList(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i64 @Ip6SelectSourceAddress(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress 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, !11, i64 96}
!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, !12, i64 88}
!19 = !{!20, !11, i64 72}
!20 = !{!"_IP6_SERVICE", !7, i64 0, !21, i64 8, !12, i64 24, !12, i64 32, !13, i64 40, !13, i64 56, !11, i64 72, !11, i64 80, !22, i64 88, !17, i64 136, !24, i64 2168, !17, i64 2192, !8, i64 2208, !8, i64 2209, !8, i64 2210, !8, i64 2211, !8, i64 2212, !7, i64 2216, !7, i64 2220, !7, i64 2224, !7, i64 2228, !13, i64 2232, !13, i64 2248, !13, i64 2264, !13, i64 2280, !7, i64 2296, !8, i64 2300, !11, i64 2304, !8, i64 2312, !8, i64 2313, !7, i64 2316, !11, i64 2320, !11, i64 2328, !11, i64 2336, !11, i64 2344, !25, i64 2352, !27, i64 2372, !11, i64 3032, !11, i64 3040, !28, i64 3048, !11, i64 4176, !7, i64 4184, !7, i64 4188}
!21 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !11, i64 0, !11, i64 8}
!22 = !{!"", !7, i64 0, !11, i64 8, !11, i64 16, !23, i64 24}
!23 = !{!"", !11, i64 0, !12, i64 8, !8, i64 16}
!24 = !{!"", !12, i64 0, !13, i64 8}
!25 = !{!"", !7, i64 0, !7, i64 4, !26, i64 8, !8, i64 10, !8, i64 11, !8, i64 12, !8, i64 13, !8, i64 14, !8, i64 15, !8, i64 16}
!26 = !{!"short", !8, i64 0}
!27 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !8, i64 40, !17, i64 552, !17, i64 584, !17, i64 616, !8, i64 648, !8, i64 649, !8, i64 650, !8, i64 651, !8, i64 652}
!28 = !{!"_IP6_CONFIG_INSTANCE", !7, i64 0, !8, i64 4, !13, i64 8, !26, i64 24, !29, i64 32, !17, i64 168, !7, i64 176, !30, i64 180, !8, i64 184, !14, i64 800, !14, i64 840, !31, 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, !32, i64 984, !34, i64 1040}
!29 = !{!"", !8, i64 0, !8, i64 64, !7, i64 68, !17, i64 72, !7, i64 104, !11, i64 112, !7, i64 120, !11, i64 128}
!30 = !{!"", !7, i64 0}
!31 = !{!"_EFI_IP6_CONFIG_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!32 = !{!"_IP6_FORM_CALLBACK_INFO", !7, i64 0, !11, i64 8, !33, i64 16, !11, i64 40, !11, i64 48}
!33 = !{!"_EFI_HII_CONFIG_ACCESS_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16}
!34 = !{!"", !7, i64 0, !30, i64 4, !17, i64 8, !13, i64 16, !7, i64 32, !13, i64 40, !7, i64 56, !13, i64 64, !7, i64 80}
!35 = !{!36, !12, i64 24}
!36 = !{!"_IP6_INTERFACE", !7, i64 0, !13, i64 8, !12, i64 24, !13, i64 32, !7, i64 48, !8, i64 52, !11, i64 56, !11, i64 64, !11, i64 72, !13, i64 80, !13, i64 96, !7, i64 112, !13, i64 120, !13, i64 136, !13, i64 152, !8, i64 168}
!37 = !{!6, !11, i64 264}
!38 = !{!11, !11, i64 0}
!39 = !{!40, !8, i64 41}
!40 = !{!"_IP6_ADDRESS_INFO", !7, i64 0, !13, i64 8, !17, i64 24, !8, i64 40, !8, i64 41, !7, i64 44, !7, i64 48}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,SROAPass,SimplifyCFGPass,TailCallElimPass