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

; 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_BOOT_SERVICES = type { %struct.EFI_TABLE_HEADER, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_TABLE_HEADER = type { i64, i32, i32, i32, i32 }

@gBS = external global ptr, align 8
@.str = external hidden unnamed_addr constant [129 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @EfiIp6Routes(ptr noundef %0, i8 noundef zeroext %1, ptr noundef %2, i8 noundef zeroext %3, ptr noundef %4) #0 {
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca ptr, align 8
  %10 = alloca i8, align 1
  %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 i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i8 %1, ptr %8, align 1, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i8 %3, ptr %10, align 1, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  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
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = icmp eq ptr %17, null
  br i1 %18, label %23, label %19

19:                                               ; preds = %5
  %20 = load i8, ptr %10, align 1, !tbaa !9
  %21 = zext i8 %20 to i32
  %22 = icmp sge i32 %21, 129
  br i1 %22, label %23, label %24

23:                                               ; preds = %19, %5
  store i64 -9223372036854775806, ptr %6, align 8
  store i32 1, ptr %16, align 4
  br label %132

24:                                               ; preds = %19
  %25 = call zeroext i8 @DebugAssertEnabled()
  %26 = zext i8 %25 to i32
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %28, label %38

28:                                               ; preds = %24
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = ptrtoint ptr %29 to i64
  %31 = sub i64 %30, ptrtoint (ptr getelementptr inbounds (%struct._IP6_PROTOCOL, ptr null, i32 0, i32 1) to i64)
  %32 = inttoptr i64 %31 to ptr
  %33 = getelementptr inbounds %struct._IP6_PROTOCOL, ptr %32, i32 0, i32 0
  %34 = load i32, ptr %33, align 8, !tbaa !10
  %35 = icmp ne i32 %34, 1345736777
  br i1 %35, label %36, label %38

36:                                               ; preds = %28
  call void @DebugAssert(ptr noundef @.str, i64 noundef 848, ptr noundef @.str.1)
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  br label %43

38:                                               ; preds = %28, %24
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = ptrtoint ptr %39 to i64
  %41 = sub i64 %40, ptrtoint (ptr getelementptr inbounds (%struct._IP6_PROTOCOL, ptr null, i32 0, i32 1) to i64)
  %42 = inttoptr i64 %41 to ptr
  br label %43

43:                                               ; preds = %38, %36
  %44 = phi ptr [ %37, %36 ], [ %42, %38 ]
  store ptr %44, ptr %12, align 8, !tbaa !5
  %45 = load ptr, ptr %12, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct._IP6_PROTOCOL, ptr %45, i32 0, i32 4
  %47 = load ptr, ptr %46, align 8, !tbaa !20
  store ptr %47, ptr %15, align 8, !tbaa !5
  %48 = load ptr, ptr %15, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct._IP6_SERVICE, ptr %48, i32 0, i32 13
  %50 = load i8, ptr %49, align 1, !tbaa !21
  %51 = icmp ne i8 %50, 0
  br i1 %51, label %52, label %53

52:                                               ; preds = %43
  store i64 -9223372036854775801, ptr %6, align 8
  store i32 1, ptr %16, align 4
  br label %132

53:                                               ; preds = %43
  %54 = load ptr, ptr %12, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct._IP6_PROTOCOL, ptr %54, i32 0, i32 3
  %56 = load i64, ptr %55, align 8, !tbaa !37
  %57 = icmp ne i64 %56, 1
  br i1 %57, label %58, label %59

58:                                               ; preds = %53
  store i64 -9223372036854775789, ptr %6, align 8
  store i32 1, ptr %16, align 4
  br label %132

59:                                               ; preds = %53
  %60 = load i8, ptr %8, align 1, !tbaa !9
  %61 = zext i8 %60 to i32
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %70

63:                                               ; preds = %59
  %64 = load ptr, ptr %9, align 8, !tbaa !5
  %65 = icmp eq ptr %64, null
  br i1 %65, label %66, label %70

66:                                               ; preds = %63
  %67 = load ptr, ptr %11, align 8, !tbaa !5
  %68 = icmp eq ptr %67, null
  br i1 %68, label %69, label %70

69:                                               ; preds = %66
  store i64 -9223372036854775806, ptr %6, align 8
  store i32 1, ptr %16, align 4
  br label %132

70:                                               ; preds = %66, %63, %59
  %71 = load i8, ptr %8, align 1, !tbaa !9
  %72 = icmp ne i8 %71, 0
  br i1 %72, label %80, label %73

73:                                               ; preds = %70
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  %75 = icmp eq ptr %74, null
  br i1 %75, label %79, label %76

76:                                               ; preds = %73
  %77 = load ptr, ptr %11, align 8, !tbaa !5
  %78 = icmp eq ptr %77, null
  br i1 %78, label %79, label %80

79:                                               ; preds = %76, %73
  store i64 -9223372036854775806, ptr %6, align 8
  store i32 1, ptr %16, align 4
  br label %132

80:                                               ; preds = %76, %70
  %81 = load ptr, ptr %11, align 8, !tbaa !5
  %82 = icmp ne ptr %81, null
  br i1 %82, label %83, label %103

83:                                               ; preds = %80
  %84 = load ptr, ptr %15, align 8, !tbaa !5
  %85 = load ptr, ptr %11, align 8, !tbaa !5
  %86 = call zeroext i8 @Ip6IsValidAddress(ptr noundef %84, ptr noundef %85, i8 noundef zeroext 0)
  %87 = icmp ne i8 %86, 0
  br i1 %87, label %89, label %88

88:                                               ; preds = %83
  store i64 -9223372036854775806, ptr %6, align 8
  store i32 1, ptr %16, align 4
  br label %132

89:                                               ; preds = %83
  %90 = load ptr, ptr %11, align 8, !tbaa !5
  %91 = call zeroext i8 @NetIp6IsUnspecifiedAddr(ptr noundef %90)
  %92 = icmp ne i8 %91, 0
  br i1 %92, label %102, label %93

93:                                               ; preds = %89
  %94 = load ptr, ptr %11, align 8, !tbaa !5
  %95 = load ptr, ptr %12, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct._IP6_PROTOCOL, ptr %95, i32 0, i32 16
  %97 = getelementptr inbounds %struct.EFI_IP6_CONFIG_DATA, ptr %96, i32 0, i32 5
  %98 = load i8, ptr %10, align 1, !tbaa !9
  %99 = call zeroext i8 @NetIp6IsNetEqual(ptr noundef %94, ptr noundef %97, i8 noundef zeroext %98)
  %100 = icmp ne i8 %99, 0
  br i1 %100, label %102, label %101

101:                                              ; preds = %93
  store i64 -9223372036854775806, ptr %6, align 8
  store i32 1, ptr %16, align 4
  br label %132

102:                                              ; preds = %93, %89
  br label %103

103:                                              ; preds = %102, %80
  %104 = load ptr, ptr @gBS, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %104, i32 0, i32 1
  %106 = load ptr, ptr %105, align 8, !tbaa !38
  %107 = call i64 %106(i64 noundef 8)
  store i64 %107, ptr %14, align 8, !tbaa !41
  %108 = load i8, ptr %8, align 1, !tbaa !9
  %109 = icmp ne i8 %108, 0
  br i1 %109, label %110, label %118

110:                                              ; preds = %103
  %111 = load ptr, ptr %15, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct._IP6_SERVICE, ptr %111, i32 0, i32 7
  %113 = load ptr, ptr %112, align 8, !tbaa !42
  %114 = load ptr, ptr %9, align 8, !tbaa !5
  %115 = load i8, ptr %10, align 1, !tbaa !9
  %116 = load ptr, ptr %11, align 8, !tbaa !5
  %117 = call i64 @Ip6DelRoute(ptr noundef %113, ptr noundef %114, i8 noundef zeroext %115, ptr noundef %116)
  store i64 %117, ptr %13, align 8, !tbaa !41
  br label %126

118:                                              ; preds = %103
  %119 = load ptr, ptr %15, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct._IP6_SERVICE, ptr %119, i32 0, i32 7
  %121 = load ptr, ptr %120, align 8, !tbaa !42
  %122 = load ptr, ptr %9, align 8, !tbaa !5
  %123 = load i8, ptr %10, align 1, !tbaa !9
  %124 = load ptr, ptr %11, align 8, !tbaa !5
  %125 = call i64 @Ip6AddRoute(ptr noundef %121, ptr noundef %122, i8 noundef zeroext %123, ptr noundef %124)
  store i64 %125, ptr %13, align 8, !tbaa !41
  br label %126

126:                                              ; preds = %118, %110
  %127 = load ptr, ptr @gBS, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %127, i32 0, i32 2
  %129 = load ptr, ptr %128, align 8, !tbaa !43
  %130 = load i64, ptr %14, align 8, !tbaa !41
  call void %129(i64 noundef %130)
  %131 = load i64, ptr %13, align 8, !tbaa !41
  store i64 %131, ptr %6, align 8
  store i32 1, ptr %16, align 4
  br label %132

132:                                              ; preds = %126, %101, %88, %79, %69, %58, %52, %23
  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
  %133 = load i64, ptr %6, align 8
  ret i64 %133
}

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

declare zeroext i8 @DebugAssertEnabled() #2

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

declare zeroext i8 @NetIp6IsUnspecifiedAddr(ptr noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @Ip6IsValidAddress(ptr noundef, ptr noundef, i8 noundef zeroext) #0

declare zeroext i8 @NetIp6IsNetEqual(ptr noundef, ptr noundef, i8 noundef zeroext) #2

declare i64 @Ip6DelRoute(ptr noundef, ptr noundef, i8 noundef zeroext, ptr noundef) #2

declare i64 @Ip6AddRoute(ptr noundef, ptr noundef, i8 noundef zeroext, ptr noundef) #2

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!7, !7, i64 0}
!10 = !{!11, !12, i64 0}
!11 = !{!"_IP6_PROTOCOL", !12, i64 0, !13, i64 8, !6, i64 80, !14, i64 88, !6, i64 96, !15, i64 104, !7, i64 120, !16, i64 128, !16, i64 168, !15, i64 208, !15, i64 224, !17, i64 240, !6, i64 264, !15, i64 272, !6, i64 288, !12, i64 296, !18, i64 300, !7, i64 352}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_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}
!14 = !{!"long long", !7, i64 0}
!15 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!16 = !{!"", !15, i64 0, !15, i64 16, !14, i64 32}
!17 = !{!"", !14, i64 0, !14, i64 8, !12, i64 16}
!18 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !19, i64 4, !19, i64 20, !7, i64 36, !7, i64 37, !12, i64 40, !12, i64 44, !12, i64 48}
!19 = !{!"", !7, i64 0}
!20 = !{!11, !6, i64 96}
!21 = !{!22, !7, i64 2209}
!22 = !{!"_IP6_SERVICE", !12, i64 0, !23, i64 8, !14, i64 24, !14, i64 32, !15, i64 40, !15, i64 56, !6, i64 72, !6, i64 80, !24, i64 88, !19, i64 136, !26, i64 2168, !19, i64 2192, !7, i64 2208, !7, i64 2209, !7, i64 2210, !7, i64 2211, !7, i64 2212, !12, i64 2216, !12, i64 2220, !12, i64 2224, !12, i64 2228, !15, i64 2232, !15, i64 2248, !15, i64 2264, !15, i64 2280, !12, i64 2296, !7, i64 2300, !6, i64 2304, !7, i64 2312, !7, i64 2313, !12, 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, !12, i64 4184, !12, i64 4188}
!23 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!24 = !{!"", !12, i64 0, !6, i64 8, !6, i64 16, !25, i64 24}
!25 = !{!"", !6, i64 0, !14, i64 8, !7, i64 16}
!26 = !{!"", !14, i64 0, !15, i64 8}
!27 = !{!"", !12, i64 0, !12, 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 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !7, i64 40, !19, i64 552, !19, i64 584, !19, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!30 = !{!"_IP6_CONFIG_INSTANCE", !12, i64 0, !7, i64 4, !15, i64 8, !28, i64 24, !31, i64 32, !19, i64 168, !12, i64 176, !32, i64 180, !7, i64 184, !16, i64 800, !16, i64 840, !33, i64 880, !6, i64 912, !6, i64 920, !6, i64 928, !6, i64 936, !7, i64 944, !12, i64 948, !6, i64 952, !12, i64 960, !6, i64 968, !12, i64 976, !34, i64 984, !36, i64 1040}
!31 = !{!"", !7, i64 0, !7, i64 64, !12, i64 68, !19, i64 72, !12, i64 104, !6, i64 112, !12, i64 120, !6, i64 128}
!32 = !{!"", !12, i64 0}
!33 = !{!"_EFI_IP6_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!34 = !{!"_IP6_FORM_CALLBACK_INFO", !12, 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 = !{!"", !12, i64 0, !32, i64 4, !19, i64 8, !15, i64 16, !12, i64 32, !15, i64 40, !12, i64 56, !15, i64 64, !12, i64 80}
!37 = !{!11, !14, i64 88}
!38 = !{!39, !6, i64 24}
!39 = !{!"", !40, i64 0, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368}
!40 = !{!"", !14, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20}
!41 = !{!14, !14, i64 0}
!42 = !{!22, !6, i64 80}
!43 = !{!39, !6, i64 32}


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

@gBS = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [129 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @EfiIp6Routes(ptr noundef %0, i8 noundef zeroext %1, ptr noundef %2, i8 noundef zeroext %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = icmp eq ptr %0, null
  %7 = icmp ugt i8 %3, -128
  %or.cond = or i1 %6, %7
  br i1 %or.cond, label %49, label %8

8:                                                ; preds = %5
  %9 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not = icmp eq i8 %9, 0
  %.pre = ptrtoint ptr %0 to i64
  %.pre52 = add i64 %.pre, -8
  %.pre54 = inttoptr i64 %.pre52 to ptr
  br i1 %.not, label %._crit_edge, label %10

10:                                               ; preds = %8
  %11 = load i32, ptr %.pre54, align 8, !tbaa !5
  %.not43 = icmp eq i32 %11, 1345736777
  br i1 %.not43, label %._crit_edge, label %12

12:                                               ; preds = %10
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 848, ptr noundef nonnull @.str.1) #2
  br label %._crit_edge

._crit_edge:                                      ; preds = %8, %10, %12
  %13 = phi ptr [ %0, %12 ], [ %.pre54, %10 ], [ %.pre54, %8 ]
  %14 = getelementptr inbounds i8, ptr %13, i64 96
  %15 = load ptr, ptr %14, align 8, !tbaa !18
  %16 = getelementptr inbounds i8, ptr %15, i64 2209
  %17 = load i8, ptr %16, align 1, !tbaa !19
  %.not44 = icmp eq i8 %17, 0
  br i1 %.not44, label %18, label %49

18:                                               ; preds = %._crit_edge
  %19 = getelementptr inbounds i8, ptr %13, i64 88
  %20 = load i64, ptr %19, align 8, !tbaa !35
  %.not45 = icmp eq i64 %20, 1
  br i1 %.not45, label %21, label %49

21:                                               ; preds = %18
  %22 = icmp ne i8 %1, 0
  %23 = icmp eq ptr %2, null
  %or.cond4 = and i1 %22, %23
  %24 = icmp eq ptr %4, null
  %or.cond6 = and i1 %or.cond4, %24
  br i1 %or.cond6, label %49, label %25

25:                                               ; preds = %21
  %.not46 = icmp eq i8 %1, 0
  %or.cond8 = or i1 %23, %24
  %or.cond51 = and i1 %.not46, %or.cond8
  br i1 %or.cond51, label %49, label %26

26:                                               ; preds = %25
  br i1 %24, label %34, label %27

27:                                               ; preds = %26
  %28 = tail call zeroext i8 @Ip6IsValidAddress(ptr noundef nonnull %15, ptr noundef nonnull %4, i8 noundef zeroext 0)
  %.not48 = icmp eq i8 %28, 0
  br i1 %.not48, label %49, label %29

29:                                               ; preds = %27
  %30 = tail call zeroext i8 @NetIp6IsUnspecifiedAddr(ptr noundef nonnull %4) #2
  %.not49 = icmp eq i8 %30, 0
  br i1 %.not49, label %31, label %34

31:                                               ; preds = %29
  %32 = getelementptr inbounds i8, ptr %13, i64 320
  %33 = tail call zeroext i8 @NetIp6IsNetEqual(ptr noundef nonnull %4, ptr noundef nonnull %32, i8 noundef zeroext %3) #2
  %.not50 = icmp eq i8 %33, 0
  br i1 %.not50, label %49, label %34

34:                                               ; preds = %29, %31, %26
  %35 = load ptr, ptr @gBS, align 8, !tbaa !36
  %36 = getelementptr inbounds i8, ptr %35, i64 24
  %37 = load ptr, ptr %36, align 8, !tbaa !37
  %38 = tail call i64 %37(i64 noundef 8) #2
  %39 = getelementptr inbounds i8, ptr %15, i64 80
  %40 = load ptr, ptr %39, align 8, !tbaa !40
  br i1 %.not46, label %43, label %41

41:                                               ; preds = %34
  %42 = tail call i64 @Ip6DelRoute(ptr noundef %40, ptr noundef %2, i8 noundef zeroext %3, ptr noundef %4) #2
  br label %45

43:                                               ; preds = %34
  %44 = tail call i64 @Ip6AddRoute(ptr noundef %40, ptr noundef %2, i8 noundef zeroext %3, ptr noundef %4) #2
  br label %45

45:                                               ; preds = %43, %41
  %.040 = phi i64 [ %42, %41 ], [ %44, %43 ]
  %46 = load ptr, ptr @gBS, align 8, !tbaa !36
  %47 = getelementptr inbounds i8, ptr %46, i64 32
  %48 = load ptr, ptr %47, align 8, !tbaa !41
  tail call void %48(i64 noundef %38) #2
  br label %49

49:                                               ; preds = %31, %27, %25, %21, %18, %._crit_edge, %5, %45
  %.0 = phi i64 [ %.040, %45 ], [ -9223372036854775806, %5 ], [ -9223372036854775801, %._crit_edge ], [ -9223372036854775789, %18 ], [ -9223372036854775806, %21 ], [ -9223372036854775806, %25 ], [ -9223372036854775806, %27 ], [ -9223372036854775806, %31 ]
  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 zeroext i8 @NetIp6IsUnspecifiedAddr(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @Ip6IsValidAddress(ptr noundef, ptr noundef, i8 noundef zeroext) local_unnamed_addr #0

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

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

declare i64 @Ip6AddRoute(ptr noundef, ptr noundef, i8 noundef zeroext, ptr 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 = !{!20, !8, i64 2209}
!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 = !{!6, !12, i64 88}
!36 = !{!11, !11, i64 0}
!37 = !{!38, !11, i64 24}
!38 = !{!"", !39, i64 0, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96, !11, i64 104, !11, i64 112, !11, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !11, i64 152, !11, i64 160, !11, i64 168, !11, i64 176, !11, i64 184, !11, i64 192, !11, i64 200, !11, i64 208, !11, i64 216, !11, i64 224, !11, i64 232, !11, i64 240, !11, i64 248, !11, i64 256, !11, i64 264, !11, i64 272, !11, i64 280, !11, i64 288, !11, i64 296, !11, i64 304, !11, i64 312, !11, i64 320, !11, i64 328, !11, i64 336, !11, i64 344, !11, i64 352, !11, i64 360, !11, i64 368}
!39 = !{!"", !12, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!40 = !{!20, !11, i64 80}
!41 = !{!38, !11, i64 32}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass