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

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

%union.IP_IO_OVERRIDE = type { %struct._EFI_IP6_OVERRIDE_DATA, [4 x i8] }
%struct._EFI_IP6_OVERRIDE_DATA = type { i8, i8, i32 }
%struct._EFI_NET_SESSION_DATA = type { %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, %union.IP_IO_IP_HEADER, i32, i8 }
%union.EFI_IP_ADDRESS = type { [4 x i32] }
%union.IP_IO_IP_HEADER = type { ptr }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }
%struct._IP_IO = type { %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, ptr, ptr, %union.IP_IO_IP_PROTOCOL, i8, i8, %union.IP_IO_IP_COMPLETION_TOKEN, %struct._LIST_ENTRY, ptr, ptr, ptr, ptr, i8 }
%union.IP_IO_IP_PROTOCOL = type { ptr }
%union.IP_IO_IP_COMPLETION_TOKEN = type { %struct.EFI_IP4_COMPLETION_TOKEN }
%struct.EFI_IP4_COMPLETION_TOKEN = type { ptr, i64, %union.anon.0 }
%union.anon.0 = type { ptr }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct._IP_IO_IP_INFO = type { %union.EFI_IP_ADDRESS, %union.IP_IO_IP_MASK, %struct._LIST_ENTRY, ptr, %union.IP_IO_IP_PROTOCOL, %union.IP_IO_IP_COMPLETION_TOKEN, i64, i8 }
%union.IP_IO_IP_MASK = type { i32 }
%struct._EFI_IP6_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_UDP_HEADER = type { i16, i16, i16, i16 }
%struct.EFI_IP6_MODE_DATA = type { i8, i32, %struct.EFI_IP6_CONFIG_DATA, i8, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, 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_ICMP_ERROR_HEAD = type { %struct.IP6_ICMP_HEAD, i32, %struct._EFI_IP6_HEADER }
%struct.IP6_ICMP_HEAD = type { i8, i8, i16 }
%struct._EFI_IP6_HEADER = type { i16, i16, i16, i8, i8, %struct.EFI_IPv6_ADDRESS, %struct.EFI_IPv6_ADDRESS }

@.str = external hidden unnamed_addr constant [131 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [27 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

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 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 @DebugAssertEnabled() #1

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

declare zeroext i8 @NetIp6IsUnspecifiedAddr(ptr noundef) #1

declare zeroext i16 @SwapBytes16(i16 noundef zeroext) #1

declare void @FreePool(ptr noundef) #1

declare void @NetbufFree(ptr noundef) #1

declare ptr @AllocateZeroPool(i64 noundef) #1

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

21:                                               ; preds = %3
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %22, i32 0, i32 1
  %24 = call zeroext i8 @NetIp6IsUnspecifiedAddr(ptr noundef %23)
  %25 = zext i8 %24 to i32
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %35, label %27

27:                                               ; preds = %21
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %28, i32 0, i32 1
  %30 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %29, i32 0, i32 0
  %31 = getelementptr inbounds [16 x i8], ptr %30, i64 0, i64 0
  %32 = load i8, ptr %31, align 8, !tbaa !12
  %33 = zext i8 %32 to i32
  %34 = icmp eq i32 %33, 255
  br i1 %34, label %35, label %36

35:                                               ; preds = %27, %21
  br label %175

36:                                               ; preds = %27
  br label %37

37:                                               ; preds = %36, %3
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %38, i32 0, i32 4
  %40 = load i8, ptr %39, align 4, !tbaa !9
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %41, i32 0, i32 1
  %43 = call ptr @IpIoFindSender(ptr noundef %4, i8 noundef zeroext %40, ptr noundef %42)
  store ptr %43, ptr %12, align 8, !tbaa !5
  %44 = call ptr @AllocateZeroPool(i64 noundef 160)
  store ptr %44, ptr %13, align 8, !tbaa !5
  br label %45

45:                                               ; preds = %37
  %46 = call zeroext i8 @DebugAssertEnabled()
  %47 = icmp ne i8 %46, 0
  br i1 %47, label %48, label %53

48:                                               ; preds = %45
  %49 = load ptr, ptr %13, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %52, label %51

51:                                               ; preds = %48
  call void @DebugAssert(ptr noundef @.str, i64 noundef 1714, ptr noundef @.str.6)
  br label %52

52:                                               ; preds = %51, %48
  br label %53

53:                                               ; preds = %52, %45
  br label %54

54:                                               ; preds = %53
  br label %55

55:                                               ; preds = %54
  %56 = load ptr, ptr %12, align 8, !tbaa !5
  %57 = icmp eq ptr %56, null
  br i1 %57, label %58, label %62

58:                                               ; preds = %55
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct._IP_IO, ptr %59, i32 0, i32 5
  %61 = load ptr, ptr %60, align 8, !tbaa !12
  store ptr %61, ptr %15, align 8, !tbaa !5
  br label %66

62:                                               ; preds = %55
  %63 = load ptr, ptr %12, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct._IP_IO_IP_INFO, ptr %63, i32 0, i32 4
  %65 = load ptr, ptr %64, align 8, !tbaa !12
  store ptr %65, ptr %15, align 8, !tbaa !5
  br label %66

66:                                               ; preds = %62, %58
  %67 = load ptr, ptr %15, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct._EFI_IP6_PROTOCOL, ptr %67, i32 0, i32 0
  %69 = load ptr, ptr %68, align 8, !tbaa !13
  %70 = load ptr, ptr %15, align 8, !tbaa !5
  %71 = load ptr, ptr %13, align 8, !tbaa !5
  %72 = call i64 %69(ptr noundef %70, ptr noundef %71, ptr noundef null, ptr noundef null)
  store i64 %72, ptr %14, align 8, !tbaa !15
  %73 = load i64, ptr %14, align 8, !tbaa !15
  %74 = icmp slt i64 %73, 0
  br i1 %74, label %75, label %76

75:                                               ; preds = %66
  br label %175

76:                                               ; preds = %66
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %77, i32 0, i32 3
  %79 = load i32, ptr %78, align 8, !tbaa !17
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.EFI_UDP_HEADER, ptr %80, i32 0, i32 2
  %82 = load i16, ptr %81, align 1, !tbaa !18
  %83 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %82)
  %84 = zext i16 %83 to i32
  %85 = add i32 %79, %84
  %86 = zext i32 %85 to i64
  %87 = add i64 %86, 48
  %88 = trunc i64 %87 to i32
  store i32 %88, ptr %8, align 4, !tbaa !21
  %89 = load ptr, ptr %13, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %89, i32 0, i32 1
  %91 = load i32, ptr %90, align 4, !tbaa !22
  %92 = load i32, ptr %8, align 4, !tbaa !21
  %93 = icmp ult i32 %91, %92
  br i1 %93, label %94, label %98

94:                                               ; preds = %76
  %95 = load ptr, ptr %13, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %95, i32 0, i32 1
  %97 = load i32, ptr %96, align 4, !tbaa !22
  store i32 %97, ptr %8, align 4, !tbaa !21
  br label %98

98:                                               ; preds = %94, %76
  %99 = load i32, ptr %8, align 4, !tbaa !21
  %100 = call ptr @NetbufAlloc(i32 noundef %99)
  store ptr %100, ptr %7, align 8, !tbaa !5
  %101 = load ptr, ptr %7, align 8, !tbaa !5
  %102 = icmp eq ptr %101, null
  br i1 %102, label %103, label %104

103:                                              ; preds = %98
  br label %175

104:                                              ; preds = %98
  %105 = load ptr, ptr %7, align 8, !tbaa !5
  %106 = load i32, ptr %8, align 4, !tbaa !21
  %107 = call ptr @NetbufAllocSpace(ptr noundef %105, i32 noundef %106, i8 noundef zeroext 0)
  store ptr %107, ptr %9, align 8, !tbaa !5
  br label %108

108:                                              ; preds = %104
  %109 = call zeroext i8 @DebugAssertEnabled()
  %110 = icmp ne i8 %109, 0
  br i1 %110, label %111, label %116

111:                                              ; preds = %108
  %112 = load ptr, ptr %9, align 8, !tbaa !5
  %113 = icmp ne ptr %112, null
  br i1 %113, label %115, label %114

114:                                              ; preds = %111
  call void @DebugAssert(ptr noundef @.str, i64 noundef 1762, ptr noundef @.str.7)
  br label %115

115:                                              ; preds = %114, %111
  br label %116

116:                                              ; preds = %115, %108
  br label %117

117:                                              ; preds = %116
  br label %118

118:                                              ; preds = %117
  %119 = load ptr, ptr %9, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.IP6_ICMP_ERROR_HEAD, ptr %119, i32 0, i32 0
  %121 = getelementptr inbounds %struct.IP6_ICMP_HEAD, ptr %120, i32 0, i32 0
  store i8 1, ptr %121, align 1, !tbaa !26
  %122 = load ptr, ptr %9, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.IP6_ICMP_ERROR_HEAD, ptr %122, i32 0, i32 0
  %124 = getelementptr inbounds %struct.IP6_ICMP_HEAD, ptr %123, i32 0, i32 1
  store i8 4, ptr %124, align 1, !tbaa !30
  %125 = load ptr, ptr %9, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.IP6_ICMP_ERROR_HEAD, ptr %125, i32 0, i32 0
  %127 = getelementptr inbounds %struct.IP6_ICMP_HEAD, ptr %126, i32 0, i32 2
  store i16 0, ptr %127, align 1, !tbaa !31
  %128 = load ptr, ptr %9, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.IP6_ICMP_ERROR_HEAD, ptr %128, i32 0, i32 1
  store i32 0, ptr %129, align 1, !tbaa !32
  %130 = load ptr, ptr %9, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.IP6_ICMP_ERROR_HEAD, ptr %130, i32 0, i32 0
  store ptr %131, ptr %10, align 8, !tbaa !5
  %132 = load ptr, ptr %10, align 8, !tbaa !5
  %133 = ptrtoint ptr %132 to i64
  %134 = add i64 %133, 48
  %135 = sub i64 %134, 40
  %136 = inttoptr i64 %135 to ptr
  store ptr %136, ptr %10, align 8, !tbaa !5
  %137 = load ptr, ptr %10, align 8, !tbaa !5
  %138 = load ptr, ptr %5, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %138, i32 0, i32 2
  %140 = load ptr, ptr %139, align 8, !tbaa !12
  %141 = load ptr, ptr %5, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %141, i32 0, i32 3
  %143 = load i32, ptr %142, align 8, !tbaa !17
  %144 = zext i32 %143 to i64
  %145 = call ptr @CopyMem(ptr noundef %137, ptr noundef %140, i64 noundef %144)
  %146 = load ptr, ptr %10, align 8, !tbaa !5
  %147 = load ptr, ptr %5, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %147, i32 0, i32 3
  %149 = load i32, ptr %148, align 8, !tbaa !17
  %150 = zext i32 %149 to i64
  %151 = getelementptr inbounds i8, ptr %146, i64 %150
  %152 = load ptr, ptr %6, align 8, !tbaa !5
  %153 = load i32, ptr %8, align 4, !tbaa !21
  %154 = load ptr, ptr %5, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %154, i32 0, i32 3
  %156 = load i32, ptr %155, align 8, !tbaa !17
  %157 = sub i32 %153, %156
  %158 = zext i32 %157 to i64
  %159 = sub i64 %158, 48
  %160 = add i64 %159, 40
  %161 = call ptr @CopyMem(ptr noundef %151, ptr noundef %152, i64 noundef %160)
  %162 = load ptr, ptr %9, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.IP6_ICMP_ERROR_HEAD, ptr %162, i32 0, i32 0
  %164 = getelementptr inbounds %struct.IP6_ICMP_HEAD, ptr %163, i32 0, i32 2
  store i16 0, ptr %164, align 1, !tbaa !31
  %165 = getelementptr inbounds %struct._EFI_IP6_OVERRIDE_DATA, ptr %11, i32 0, i32 2
  store i32 0, ptr %165, align 4, !tbaa !12
  %166 = getelementptr inbounds %struct._EFI_IP6_OVERRIDE_DATA, ptr %11, i32 0, i32 1
  store i8 -1, ptr %166, align 1, !tbaa !12
  %167 = getelementptr inbounds %struct._EFI_IP6_OVERRIDE_DATA, ptr %11, i32 0, i32 0
  store i8 58, ptr %167, align 4, !tbaa !12
  %168 = load ptr, ptr %4, align 8, !tbaa !5
  %169 = load ptr, ptr %7, align 8, !tbaa !5
  %170 = load ptr, ptr %12, align 8, !tbaa !5
  %171 = load ptr, ptr %5, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %171, i32 0, i32 0
  %173 = call i64 @IpIoSend(ptr noundef %168, ptr noundef %169, ptr noundef %170, ptr noundef null, ptr noundef null, ptr noundef %172, ptr noundef %11)
  %174 = load ptr, ptr %7, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %174)
  br label %175

175:                                              ; preds = %118, %103, %75, %35
  %176 = load ptr, ptr %13, align 8, !tbaa !5
  %177 = icmp ne ptr %176, null
  br i1 %177, label %178, label %180

178:                                              ; preds = %175
  %179 = load ptr, ptr %13, align 8, !tbaa !5
  call void @FreePool(ptr noundef %179)
  br label %180

180:                                              ; preds = %178, %175
  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 12, 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 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret void
}

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

declare ptr @NetbufAlloc(i32 noundef) #1

declare ptr @NetbufAllocSpace(ptr noundef, i32 noundef, i8 noundef zeroext) #1

declare i64 @IpIoSend(ptr noundef, ptr noundef, ptr noundef, ptr noundef, 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, !7, i64 44}
!10 = !{!"_EFI_NET_SESSION_DATA", !7, i64 0, !7, i64 16, !7, i64 32, !11, i64 40, !7, i64 44}
!11 = !{!"int", !7, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"_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}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !7, i64 0}
!17 = !{!10, !11, i64 40}
!18 = !{!19, !20, i64 4}
!19 = !{!"", !20, i64 0, !20, i64 2, !20, i64 4, !20, i64 6}
!20 = !{!"short", !7, i64 0}
!21 = !{!11, !11, i64 0}
!22 = !{!23, !11, i64 4}
!23 = !{!"", !7, i64 0, !11, i64 4, !24, i64 8, !7, i64 60, !11, i64 64, !6, i64 72, !11, i64 80, !6, i64 88, !11, i64 96, !6, i64 104, !11, i64 112, !6, i64 120, !11, i64 128, !6, i64 136, !11, i64 144, !6, i64 152}
!24 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !25, i64 4, !25, i64 20, !7, i64 36, !7, i64 37, !11, i64 40, !11, i64 44, !11, i64 48}
!25 = !{!"", !7, i64 0}
!26 = !{!27, !7, i64 0}
!27 = !{!"", !28, i64 0, !11, i64 4, !29, i64 8}
!28 = !{!"", !7, i64 0, !7, i64 1, !20, i64 2}
!29 = !{!"_EFI_IP6_HEADER", !7, i64 0, !7, i64 0, !7, i64 1, !7, i64 1, !20, i64 2, !20, i64 4, !7, i64 6, !7, i64 7, !25, i64 8, !25, i64 24}
!30 = !{!27, !7, i64 1}
!31 = !{!27, !20, i64 2}
!32 = !{!27, !11, i64 4}


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

%union.IP_IO_OVERRIDE = type { %struct._EFI_IP6_OVERRIDE_DATA, [4 x i8] }
%struct._EFI_IP6_OVERRIDE_DATA = type { i8, i8, i32 }

@.str = external hidden unnamed_addr constant [131 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [27 x i8], align 1

; 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

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

declare zeroext i16 @SwapBytes16(i16 noundef zeroext) local_unnamed_addr #1

declare void @FreePool(ptr noundef) local_unnamed_addr #1

declare void @NetbufFree(ptr noundef) local_unnamed_addr #1

declare ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @Udp6SendPortUnreach(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca ptr, align 8
  %5 = alloca %union.IP_IO_OVERRIDE, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #4
  %6 = getelementptr inbounds i8, ptr %1, i64 44
  %7 = load i8, ptr %6, align 4, !tbaa !9
  %8 = icmp eq i8 %7, 6
  br i1 %8, label %9, label %15

9:                                                ; preds = %3
  %10 = getelementptr inbounds i8, ptr %1, i64 16
  %11 = tail call zeroext i8 @NetIp6IsUnspecifiedAddr(ptr noundef nonnull %10) #4
  %.not = icmp eq i8 %11, 0
  br i1 %.not, label %12, label %.thread

12:                                               ; preds = %9
  %13 = load i8, ptr %10, align 8, !tbaa !12
  %14 = icmp eq i8 %13, -1
  br i1 %14, label %.thread, label %._crit_edge

._crit_edge:                                      ; preds = %12
  %.pre = load i8, ptr %6, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %._crit_edge, %3
  %16 = phi i8 [ %.pre, %._crit_edge ], [ %7, %3 ]
  %17 = getelementptr inbounds i8, ptr %1, i64 16
  %18 = call ptr @IpIoFindSender(ptr noundef nonnull %4, i8 noundef zeroext %16, ptr noundef nonnull %17) #4
  %19 = call ptr @AllocateZeroPool(i64 noundef 160) #4
  %20 = call zeroext i8 @DebugAssertEnabled() #4
  %21 = icmp eq i8 %20, 0
  %22 = icmp ne ptr %19, null
  %or.cond = select i1 %21, i1 true, i1 %22
  br i1 %or.cond, label %24, label %23

23:                                               ; preds = %15
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 1714, ptr noundef nonnull @.str.6) #4
  br label %24

24:                                               ; preds = %23, %15
  %25 = icmp eq ptr %18, null
  %26 = load ptr, ptr %4, align 8
  %27 = getelementptr inbounds i8, ptr %26, i64 56
  %28 = getelementptr inbounds i8, ptr %18, i64 48
  %.0.in = select i1 %25, ptr %27, ptr %28
  %.0 = load ptr, ptr %.0.in, align 8, !tbaa !12
  %29 = load ptr, ptr %.0, align 8, !tbaa !13
  %30 = call i64 %29(ptr noundef nonnull %.0, ptr noundef %19, ptr noundef null, ptr noundef null) #4
  %31 = icmp slt i64 %30, 0
  br i1 %31, label %74, label %32

32:                                               ; preds = %24
  %33 = getelementptr inbounds i8, ptr %1, i64 40
  %34 = load i32, ptr %33, align 8, !tbaa !15
  %35 = getelementptr inbounds i8, ptr %2, i64 4
  %36 = load i16, ptr %35, align 1, !tbaa !16
  %37 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %36) #4
  %38 = zext i16 %37 to i32
  %39 = add i32 %34, 48
  %40 = add i32 %39, %38
  %41 = getelementptr inbounds i8, ptr %19, i64 4
  %42 = load i32, ptr %41, align 4, !tbaa !19
  %spec.select = call i32 @llvm.umin.i32(i32 %42, i32 %40)
  %43 = call ptr @NetbufAlloc(i32 noundef %spec.select) #4
  %44 = icmp eq ptr %43, null
  br i1 %44, label %.thread55, label %45

45:                                               ; preds = %32
  %46 = call ptr @NetbufAllocSpace(ptr noundef nonnull %43, i32 noundef %spec.select, i8 noundef zeroext 0) #4
  %47 = call zeroext i8 @DebugAssertEnabled() #4
  %48 = icmp eq i8 %47, 0
  %49 = icmp ne ptr %46, null
  %or.cond3 = select i1 %48, i1 true, i1 %49
  br i1 %or.cond3, label %51, label %50

50:                                               ; preds = %45
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 1762, ptr noundef nonnull @.str.7) #4
  br label %51

51:                                               ; preds = %50, %45
  store i8 1, ptr %46, align 1, !tbaa !23
  %52 = getelementptr inbounds i8, ptr %46, i64 1
  store i8 4, ptr %52, align 1, !tbaa !27
  %53 = getelementptr inbounds i8, ptr %46, i64 2
  store i16 0, ptr %53, align 1, !tbaa !28
  %54 = getelementptr inbounds i8, ptr %46, i64 4
  store i32 0, ptr %54, align 1, !tbaa !29
  %55 = ptrtoint ptr %46 to i64
  %56 = add i64 %55, 8
  %57 = inttoptr i64 %56 to ptr
  %58 = getelementptr inbounds i8, ptr %1, i64 32
  %59 = load ptr, ptr %58, align 8, !tbaa !12
  %60 = load i32, ptr %33, align 8, !tbaa !15
  %61 = zext i32 %60 to i64
  %62 = call ptr @CopyMem(ptr noundef %57, ptr noundef %59, i64 noundef %61) #4
  %63 = load i32, ptr %33, align 8, !tbaa !15
  %64 = zext i32 %63 to i64
  %65 = getelementptr inbounds i8, ptr %57, i64 %64
  %66 = sub i32 %spec.select, %63
  %67 = zext i32 %66 to i64
  %68 = add nsw i64 %67, -8
  %69 = call ptr @CopyMem(ptr noundef %65, ptr noundef nonnull %2, i64 noundef %68) #4
  store i16 0, ptr %53, align 1, !tbaa !28
  %70 = getelementptr inbounds i8, ptr %5, i64 4
  store i32 0, ptr %70, align 4, !tbaa !12
  %71 = getelementptr inbounds i8, ptr %5, i64 1
  store i8 -1, ptr %71, align 1, !tbaa !12
  store i8 58, ptr %5, align 4, !tbaa !12
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = call i64 @IpIoSend(ptr noundef %72, ptr noundef nonnull %43, ptr noundef %18, ptr noundef null, ptr noundef null, ptr noundef nonnull %1, ptr noundef nonnull %5) #4
  call void @NetbufFree(ptr noundef nonnull %43) #4
  br label %.thread55

74:                                               ; preds = %24
  %.not51 = icmp eq ptr %19, null
  br i1 %.not51, label %.thread, label %.thread55

.thread55:                                        ; preds = %51, %32, %74
  call void @FreePool(ptr noundef nonnull %19) #4
  br label %.thread

.thread:                                          ; preds = %12, %9, %.thread55, %74
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #4
  ret void
}

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

declare ptr @NetbufAlloc(i32 noundef) local_unnamed_addr #1

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #3

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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, !7, i64 44}
!10 = !{!"_EFI_NET_SESSION_DATA", !7, i64 0, !7, i64 16, !7, i64 32, !11, i64 40, !7, i64 44}
!11 = !{!"int", !7, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"_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}
!15 = !{!10, !11, i64 40}
!16 = !{!17, !18, i64 4}
!17 = !{!"", !18, i64 0, !18, i64 2, !18, i64 4, !18, i64 6}
!18 = !{!"short", !7, i64 0}
!19 = !{!20, !11, i64 4}
!20 = !{!"", !7, i64 0, !11, i64 4, !21, i64 8, !7, i64 60, !11, i64 64, !6, i64 72, !11, i64 80, !6, i64 88, !11, i64 96, !6, i64 104, !11, i64 112, !6, i64 120, !11, i64 128, !6, i64 136, !11, i64 144, !6, i64 152}
!21 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !22, i64 4, !22, i64 20, !7, i64 36, !7, i64 37, !11, i64 40, !11, i64 44, !11, i64 48}
!22 = !{!"", !7, i64 0}
!23 = !{!24, !7, i64 0}
!24 = !{!"", !25, i64 0, !11, i64 4, !26, i64 8}
!25 = !{!"", !7, i64 0, !7, i64 1, !18, i64 2}
!26 = !{!"_EFI_IP6_HEADER", !7, i64 0, !7, i64 0, !7, i64 1, !7, i64 1, !18, i64 2, !18, i64 4, !7, i64 6, !7, i64 7, !22, i64 8, !22, i64 24}
!27 = !{!24, !7, i64 1}
!28 = !{!24, !18, i64 2}
!29 = !{!24, !11, i64 4}


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