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

; 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.GUID = type { i32, i16, i16, [8 x i8] }
%struct.EFI_DHCP6_RETRANSMISSION = type { i32, i32, i32, i32 }
%struct._ISCSI_ATTEMPT_CONFIG_NVDATA = type <{ %struct._LIST_ENTRY, i8, i8, i8, i8, i8, i8, i16, i16, [96 x i8], [96 x i8], %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, %struct._ISCSI_SESSION_CONFIG_NVDATA, i8, %union.anon }>
%struct._LIST_ENTRY = type { ptr, ptr }
%union.EFI_IP_ADDRESS = type { [4 x i32] }
%struct._ISCSI_SESSION_CONFIG_NVDATA = type <{ i16, i8, i8, %union.EFI_IP_ADDRESS, %struct.EFI_IPv4_ADDRESS, %union.EFI_IP_ADDRESS, i8, i8, [224 x i8], %union.EFI_IP_ADDRESS, i8, [8 x i8], i16, i8, [6 x i8] }>
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%union.anon = type { %struct._ISCSI_CHAP_AUTH_CONFIG_NVDATA }
%struct._ISCSI_CHAP_AUTH_CONFIG_NVDATA = type { i8, [127 x i8], [17 x i8], [127 x i8], [17 x i8] }
%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 }
%struct.EFI_DHCP6_PACKET_OPTION = type <{ i16, i16, [1 x i8] }>
%struct._EFI_DHCP6_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@gEfiDhcp6ServiceBindingProtocolGuid = external global %struct.GUID, align 4
@gBS = external global ptr, align 8
@gEfiDhcp6ProtocolGuid = external global %struct.GUID, align 4

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

declare void @FreePool(ptr noundef) #1

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

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

declare ptr @AllocateZeroPool(i64 noundef) #1

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

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

21:                                               ; preds = %3
  store i64 -9223372036854775796, ptr %4, align 8
  store i32 1, ptr %16, align 4
  br label %153

22:                                               ; preds = %3
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct._ISCSI_ATTEMPT_CONFIG_NVDATA, ptr %23, i32 0, i32 14
  %25 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %24, i32 0, i32 7
  %26 = load i8, ptr %25, align 1, !tbaa !10
  %27 = icmp ne i8 %26, 0
  br i1 %27, label %29, label %28

28:                                               ; preds = %22
  store i64 0, ptr %4, align 8
  store i32 1, ptr %16, align 4
  br label %153

29:                                               ; preds = %22
  store ptr null, ptr %8, align 8, !tbaa !5
  store ptr null, ptr %9, align 8, !tbaa !5
  store ptr null, ptr %12, align 8, !tbaa !5
  store ptr null, ptr %14, align 8, !tbaa !5
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = call i64 @NetLibCreateServiceChild(ptr noundef %30, ptr noundef %31, ptr noundef @gEfiDhcp6ServiceBindingProtocolGuid, ptr noundef %8)
  store i64 %32, ptr %10, align 8, !tbaa !16
  %33 = load i64, ptr %10, align 8, !tbaa !16
  %34 = icmp slt i64 %33, 0
  br i1 %34, label %35, label %37

35:                                               ; preds = %29
  %36 = load i64, ptr %10, align 8, !tbaa !16
  store i64 %36, ptr %4, align 8
  store i32 1, ptr %16, align 4
  br label %153

37:                                               ; preds = %29
  %38 = load ptr, ptr @gBS, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %38, i32 0, i32 33
  %40 = load ptr, ptr %39, align 8, !tbaa !18
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = call i64 %40(ptr noundef %41, ptr noundef @gEfiDhcp6ProtocolGuid, ptr noundef %9, ptr noundef %42, ptr noundef %43, i32 noundef 16)
  store i64 %44, ptr %10, align 8, !tbaa !16
  %45 = load i64, ptr %10, align 8, !tbaa !16
  %46 = icmp slt i64 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %37
  br label %122

48:                                               ; preds = %37
  %49 = call ptr @AllocateZeroPool(i64 noundef 10)
  store ptr %49, ptr %12, align 8, !tbaa !5
  %50 = load ptr, ptr %12, align 8, !tbaa !5
  %51 = icmp eq ptr %50, null
  br i1 %51, label %52, label %53

52:                                               ; preds = %48
  store i64 -9223372036854775799, ptr %10, align 8, !tbaa !16
  br label %122

53:                                               ; preds = %48
  %54 = call zeroext i16 @SwapBytes16(i16 noundef zeroext 6)
  %55 = load ptr, ptr %12, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.EFI_DHCP6_PACKET_OPTION, ptr %55, i32 0, i32 0
  store i16 %54, ptr %56, align 1, !tbaa !22
  %57 = call zeroext i16 @SwapBytes16(i16 noundef zeroext 6)
  %58 = load ptr, ptr %12, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.EFI_DHCP6_PACKET_OPTION, ptr %58, i32 0, i32 1
  store i16 %57, ptr %59, align 1, !tbaa !24
  %60 = load ptr, ptr %12, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.EFI_DHCP6_PACKET_OPTION, ptr %60, i32 0, i32 2
  %62 = getelementptr inbounds [1 x i8], ptr %61, i64 0, i64 1
  store i8 23, ptr %62, align 1, !tbaa !9
  %63 = load ptr, ptr %12, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.EFI_DHCP6_PACKET_OPTION, ptr %63, i32 0, i32 2
  %65 = getelementptr inbounds [1 x i8], ptr %64, i64 0, i64 3
  store i8 59, ptr %65, align 1, !tbaa !9
  %66 = load ptr, ptr %12, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.EFI_DHCP6_PACKET_OPTION, ptr %66, i32 0, i32 2
  %68 = getelementptr inbounds [1 x i8], ptr %67, i64 0, i64 5
  store i8 60, ptr %68, align 1, !tbaa !9
  %69 = getelementptr inbounds %struct.EFI_DHCP6_RETRANSMISSION, ptr %13, i32 0, i32 0
  store i32 4, ptr %69, align 4, !tbaa !25
  %70 = getelementptr inbounds %struct.EFI_DHCP6_RETRANSMISSION, ptr %13, i32 0, i32 1
  store i32 1, ptr %70, align 4, !tbaa !27
  %71 = getelementptr inbounds %struct.EFI_DHCP6_RETRANSMISSION, ptr %13, i32 0, i32 2
  store i32 10, ptr %71, align 4, !tbaa !28
  %72 = getelementptr inbounds %struct.EFI_DHCP6_RETRANSMISSION, ptr %13, i32 0, i32 3
  store i32 30, ptr %72, align 4, !tbaa !29
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct._EFI_DHCP6_PROTOCOL, ptr %73, i32 0, i32 3
  %75 = load ptr, ptr %74, align 8, !tbaa !30
  %76 = load ptr, ptr %9, align 8, !tbaa !5
  %77 = load ptr, ptr %12, align 8, !tbaa !5
  %78 = load ptr, ptr %7, align 8, !tbaa !5
  %79 = call i64 %75(ptr noundef %76, i8 noundef zeroext 1, ptr noundef %77, i32 noundef 0, ptr noundef null, ptr noundef %13, ptr noundef null, ptr noundef @IScsiDhcp6ParseReply, ptr noundef %78)
  store i64 %79, ptr %10, align 8, !tbaa !16
  %80 = load i64, ptr %10, align 8, !tbaa !16
  %81 = icmp eq i64 %80, -9223372036854775791
  br i1 %81, label %82, label %121

82:                                               ; preds = %53
  %83 = load ptr, ptr @gBS, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %83, i32 0, i32 8
  %85 = load ptr, ptr %84, align 8, !tbaa !32
  %86 = call i64 %85(i32 noundef -2147483648, i64 noundef 8, ptr noundef null, ptr noundef null, ptr noundef %14)
  store i64 %86, ptr %10, align 8, !tbaa !16
  %87 = load i64, ptr %10, align 8, !tbaa !16
  %88 = icmp slt i64 %87, 0
  br i1 %88, label %89, label %90

89:                                               ; preds = %82
  br label %122

90:                                               ; preds = %82
  %91 = load ptr, ptr @gBS, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %91, i32 0, i32 9
  %93 = load ptr, ptr %92, align 8, !tbaa !33
  %94 = load ptr, ptr %14, align 8, !tbaa !5
  %95 = call i64 %93(ptr noundef %94, i32 noundef 2, i64 noundef 100000000)
  store i64 %95, ptr %10, align 8, !tbaa !16
  %96 = load i64, ptr %10, align 8, !tbaa !16
  %97 = icmp slt i64 %96, 0
  br i1 %97, label %98, label %99

98:                                               ; preds = %90
  br label %122

99:                                               ; preds = %90
  br label %100

100:                                              ; preds = %117, %99
  %101 = load ptr, ptr @gBS, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %101, i32 0, i32 13
  %103 = load ptr, ptr %102, align 8, !tbaa !34
  %104 = load ptr, ptr %14, align 8, !tbaa !5
  %105 = call i64 %103(ptr noundef %104)
  store i64 %105, ptr %11, align 8, !tbaa !16
  %106 = load i64, ptr %11, align 8, !tbaa !16
  %107 = icmp slt i64 %106, 0
  br i1 %107, label %116, label %108

108:                                              ; preds = %100
  %109 = load ptr, ptr %9, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct._EFI_DHCP6_PROTOCOL, ptr %109, i32 0, i32 3
  %111 = load ptr, ptr %110, align 8, !tbaa !30
  %112 = load ptr, ptr %9, align 8, !tbaa !5
  %113 = load ptr, ptr %12, align 8, !tbaa !5
  %114 = load ptr, ptr %7, align 8, !tbaa !5
  %115 = call i64 %111(ptr noundef %112, i8 noundef zeroext 1, ptr noundef %113, i32 noundef 0, ptr noundef null, ptr noundef %13, ptr noundef null, ptr noundef @IScsiDhcp6ParseReply, ptr noundef %114)
  store i64 %115, ptr %10, align 8, !tbaa !16
  br label %116

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

117:                                              ; preds = %116
  %118 = load i64, ptr %11, align 8, !tbaa !16
  %119 = icmp eq i64 %118, -9223372036854775802
  br i1 %119, label %100, label %120, !llvm.loop !35

120:                                              ; preds = %117
  br label %121

121:                                              ; preds = %120, %53
  br label %122

122:                                              ; preds = %121, %98, %89, %52, %47
  %123 = load ptr, ptr %12, align 8, !tbaa !5
  %124 = icmp ne ptr %123, null
  br i1 %124, label %125, label %127

125:                                              ; preds = %122
  %126 = load ptr, ptr %12, align 8, !tbaa !5
  call void @FreePool(ptr noundef %126)
  br label %127

127:                                              ; preds = %125, %122
  %128 = load ptr, ptr %14, align 8, !tbaa !5
  %129 = icmp ne ptr %128, null
  br i1 %129, label %130, label %136

130:                                              ; preds = %127
  %131 = load ptr, ptr @gBS, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %131, i32 0, i32 12
  %133 = load ptr, ptr %132, align 8, !tbaa !37
  %134 = load ptr, ptr %14, align 8, !tbaa !5
  %135 = call i64 %133(ptr noundef %134)
  br label %136

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

139:                                              ; preds = %136
  %140 = load ptr, ptr @gBS, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %140, i32 0, i32 34
  %142 = load ptr, ptr %141, align 8, !tbaa !38
  %143 = load ptr, ptr %8, align 8, !tbaa !5
  %144 = load ptr, ptr %5, align 8, !tbaa !5
  %145 = load ptr, ptr %6, align 8, !tbaa !5
  %146 = call i64 %142(ptr noundef %143, ptr noundef @gEfiDhcp6ProtocolGuid, ptr noundef %144, ptr noundef %145)
  br label %147

147:                                              ; preds = %139, %136
  %148 = load ptr, ptr %6, align 8, !tbaa !5
  %149 = load ptr, ptr %5, align 8, !tbaa !5
  %150 = load ptr, ptr %8, align 8, !tbaa !5
  %151 = call i64 @NetLibDestroyServiceChild(ptr noundef %148, ptr noundef %149, ptr noundef @gEfiDhcp6ServiceBindingProtocolGuid, ptr noundef %150)
  %152 = load i64, ptr %10, align 8, !tbaa !16
  store i64 %152, ptr %4, align 8
  store i32 1, ptr %16, align 4
  br label %153

153:                                              ; preds = %147, %35, %28, %21
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 16, 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
  %154 = load i64, ptr %4, align 8
  ret i64 %154
}

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

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

declare i64 @NetLibDestroyServiceChild(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 = !{!7, !7, i64 0}
!10 = !{!11, !7, i64 307}
!11 = !{!"_ISCSI_ATTEMPT_CONFIG_NVDATA", !12, i64 0, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19, !7, i64 20, !7, i64 21, !13, i64 22, !13, i64 24, !7, i64 26, !7, i64 122, !7, i64 218, !7, i64 234, !7, i64 250, !14, i64 266, !7, i64 566, !7, i64 567}
!12 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!13 = !{!"short", !7, i64 0}
!14 = !{!"_ISCSI_SESSION_CONFIG_NVDATA", !13, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !15, i64 20, !7, i64 24, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 266, !7, i64 282, !7, i64 283, !13, i64 291, !7, i64 293, !7, i64 294}
!15 = !{!"", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"long long", !7, i64 0}
!18 = !{!19, !6, i64 280}
!19 = !{!"", !20, 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}
!20 = !{!"", !17, i64 0, !21, i64 8, !21, i64 12, !21, i64 16, !21, i64 20}
!21 = !{!"int", !7, i64 0}
!22 = !{!23, !13, i64 0}
!23 = !{!"", !13, i64 0, !13, i64 2, !7, i64 4}
!24 = !{!23, !13, i64 2}
!25 = !{!26, !21, i64 0}
!26 = !{!"", !21, i64 0, !21, i64 4, !21, i64 8, !21, i64 12}
!27 = !{!26, !21, i64 4}
!28 = !{!26, !21, i64 8}
!29 = !{!26, !21, i64 12}
!30 = !{!31, !6, i64 24}
!31 = !{!"_EFI_DHCP6_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}
!32 = !{!19, !6, i64 80}
!33 = !{!19, !6, i64 88}
!34 = !{!19, !6, i64 120}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}
!37 = !{!19, !6, i64 112}
!38 = !{!19, !6, i64 288}


; 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.GUID = type { i32, i16, i16, [8 x i8] }
%struct.EFI_DHCP6_RETRANSMISSION = type { i32, i32, i32, i32 }

@gEfiDhcp6ServiceBindingProtocolGuid = external global %struct.GUID, align 4
@gBS = external local_unnamed_addr global ptr, align 8
@gEfiDhcp6ProtocolGuid = external global %struct.GUID, align 4

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

declare void @FreePool(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

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

declare ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local i64 @IScsiDoDhcp6(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.EFI_DHCP6_RETRANSMISSION, align 16
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %8) #3
  store i8 1, ptr %8, align 1, !tbaa !5
  %9 = call i64 @NetLibDetectMedia(ptr noundef %1, ptr noundef nonnull %8) #3
  %10 = load i8, ptr %8, align 1, !tbaa !5
  %.not = icmp eq i8 %10, 0
  br i1 %.not, label %79, label %11

11:                                               ; preds = %3
  %12 = getelementptr inbounds i8, ptr %2, i64 307
  %13 = load i8, ptr %12, align 1, !tbaa !8
  %.not42 = icmp eq i8 %13, 0
  br i1 %.not42, label %79, label %14

14:                                               ; preds = %11
  store ptr null, ptr %4, align 8, !tbaa !15
  store ptr null, ptr %5, align 8, !tbaa !15
  store ptr null, ptr %7, align 8, !tbaa !15
  %15 = call i64 @NetLibCreateServiceChild(ptr noundef %1, ptr noundef %0, ptr noundef nonnull @gEfiDhcp6ServiceBindingProtocolGuid, ptr noundef nonnull %4) #3
  %16 = icmp slt i64 %15, 0
  br i1 %16, label %79, label %17

17:                                               ; preds = %14
  %18 = load ptr, ptr @gBS, align 8, !tbaa !15
  %19 = getelementptr inbounds i8, ptr %18, i64 280
  %20 = load ptr, ptr %19, align 8, !tbaa !16
  %21 = load ptr, ptr %4, align 8, !tbaa !15
  %22 = call i64 %20(ptr noundef %21, ptr noundef nonnull @gEfiDhcp6ProtocolGuid, ptr noundef nonnull %5, ptr noundef %0, ptr noundef %1, i32 noundef 16) #3
  %23 = icmp slt i64 %22, 0
  br i1 %23, label %.thread56.thread, label %24

24:                                               ; preds = %17
  %25 = call ptr @AllocateZeroPool(i64 noundef 10) #3
  %26 = icmp eq ptr %25, null
  br i1 %26, label %.thread56.thread, label %27

27:                                               ; preds = %24
  %28 = call zeroext i16 @SwapBytes16(i16 noundef zeroext 6) #3
  store i16 %28, ptr %25, align 1, !tbaa !21
  %29 = call zeroext i16 @SwapBytes16(i16 noundef zeroext 6) #3
  %30 = getelementptr inbounds i8, ptr %25, i64 2
  store i16 %29, ptr %30, align 1, !tbaa !23
  %31 = getelementptr inbounds i8, ptr %25, i64 5
  store i8 23, ptr %31, align 1, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %25, i64 7
  store i8 59, ptr %32, align 1, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %25, i64 9
  store i8 60, ptr %33, align 1, !tbaa !5
  store <4 x i32> <i32 4, i32 1, i32 10, i32 30>, ptr %6, align 16, !tbaa !24
  %34 = load ptr, ptr %5, align 8, !tbaa !15
  %35 = getelementptr inbounds i8, ptr %34, i64 24
  %36 = load ptr, ptr %35, align 8, !tbaa !25
  %37 = call i64 %36(ptr noundef %34, i8 noundef zeroext 1, ptr noundef nonnull %25, i32 noundef 0, ptr noundef null, ptr noundef nonnull %6, ptr noundef null, ptr noundef nonnull @IScsiDhcp6ParseReply, ptr noundef nonnull %2) #3
  %38 = icmp eq i64 %37, -9223372036854775791
  br i1 %38, label %39, label %.thread56

39:                                               ; preds = %27
  %40 = load ptr, ptr @gBS, align 8, !tbaa !15
  %41 = getelementptr inbounds i8, ptr %40, i64 80
  %42 = load ptr, ptr %41, align 8, !tbaa !27
  %43 = call i64 %42(i32 noundef -2147483648, i64 noundef 8, ptr noundef null, ptr noundef null, ptr noundef nonnull %7) #3
  %44 = icmp slt i64 %43, 0
  br i1 %44, label %.thread56, label %45

45:                                               ; preds = %39
  %46 = load ptr, ptr @gBS, align 8, !tbaa !15
  %47 = getelementptr inbounds i8, ptr %46, i64 88
  %48 = load ptr, ptr %47, align 8, !tbaa !28
  %49 = load ptr, ptr %7, align 8, !tbaa !15
  %50 = call i64 %48(ptr noundef %49, i32 noundef 2, i64 noundef 100000000) #3
  %51 = icmp slt i64 %50, 0
  br i1 %51, label %.thread56, label %.preheader

.preheader:                                       ; preds = %45, %62
  %52 = load ptr, ptr @gBS, align 8, !tbaa !15
  %53 = getelementptr inbounds i8, ptr %52, i64 120
  %54 = load ptr, ptr %53, align 8, !tbaa !29
  %55 = load ptr, ptr %7, align 8, !tbaa !15
  %56 = call i64 %54(ptr noundef %55) #3
  %57 = icmp slt i64 %56, 0
  br i1 %57, label %62, label %.thread

.thread:                                          ; preds = %.preheader
  %58 = load ptr, ptr %5, align 8, !tbaa !15
  %59 = getelementptr inbounds i8, ptr %58, i64 24
  %60 = load ptr, ptr %59, align 8, !tbaa !25
  %61 = call i64 %60(ptr noundef %58, i8 noundef zeroext 1, ptr noundef nonnull %25, i32 noundef 0, ptr noundef null, ptr noundef nonnull %6, ptr noundef null, ptr noundef nonnull @IScsiDhcp6ParseReply, ptr noundef %2) #3
  br label %.thread56

62:                                               ; preds = %.preheader
  %63 = icmp eq i64 %56, -9223372036854775802
  br i1 %63, label %.preheader, label %.thread56, !llvm.loop !30

.thread56:                                        ; preds = %62, %39, %45, %27, %.thread
  %.251 = phi i64 [ %37, %27 ], [ %50, %45 ], [ %43, %39 ], [ %61, %.thread ], [ %50, %62 ]
  call void @FreePool(ptr noundef nonnull %25) #3
  %.pre = load ptr, ptr %7, align 8, !tbaa !15
  %.not44 = icmp eq ptr %.pre, null
  br i1 %.not44, label %.thread56.thread, label %64

64:                                               ; preds = %.thread56
  %65 = load ptr, ptr @gBS, align 8, !tbaa !15
  %66 = getelementptr inbounds i8, ptr %65, i64 112
  %67 = load ptr, ptr %66, align 8, !tbaa !32
  %68 = call i64 %67(ptr noundef nonnull %.pre) #3
  br label %.thread56.thread

.thread56.thread:                                 ; preds = %17, %24, %64, %.thread56
  %.25262 = phi i64 [ %.251, %64 ], [ %.251, %.thread56 ], [ %22, %17 ], [ -9223372036854775799, %24 ]
  %69 = load ptr, ptr %5, align 8, !tbaa !15
  %.not45 = icmp eq ptr %69, null
  br i1 %.not45, label %76, label %70

70:                                               ; preds = %.thread56.thread
  %71 = load ptr, ptr @gBS, align 8, !tbaa !15
  %72 = getelementptr inbounds i8, ptr %71, i64 288
  %73 = load ptr, ptr %72, align 8, !tbaa !33
  %74 = load ptr, ptr %4, align 8, !tbaa !15
  %75 = call i64 %73(ptr noundef %74, ptr noundef nonnull @gEfiDhcp6ProtocolGuid, ptr noundef %0, ptr noundef %1) #3
  br label %76

76:                                               ; preds = %70, %.thread56.thread
  %77 = load ptr, ptr %4, align 8, !tbaa !15
  %78 = call i64 @NetLibDestroyServiceChild(ptr noundef %1, ptr noundef %0, ptr noundef nonnull @gEfiDhcp6ServiceBindingProtocolGuid, ptr noundef %77) #3
  br label %79

79:                                               ; preds = %14, %11, %3, %76
  %.031 = phi i64 [ %.25262, %76 ], [ -9223372036854775796, %3 ], [ 0, %11 ], [ %15, %14 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  ret i64 %.031
}

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

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

declare i64 @NetLibDestroyServiceChild(ptr noundef, 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, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !6, i64 307}
!9 = !{!"_ISCSI_ATTEMPT_CONFIG_NVDATA", !10, i64 0, !6, i64 16, !6, i64 17, !6, i64 18, !6, i64 19, !6, i64 20, !6, i64 21, !12, i64 22, !12, i64 24, !6, i64 26, !6, i64 122, !6, i64 218, !6, i64 234, !6, i64 250, !13, i64 266, !6, i64 566, !6, i64 567}
!10 = !{!"_LIST_ENTRY", !11, i64 0, !11, i64 8}
!11 = !{!"any pointer", !6, i64 0}
!12 = !{!"short", !6, i64 0}
!13 = !{!"_ISCSI_SESSION_CONFIG_NVDATA", !12, i64 0, !6, i64 2, !6, i64 3, !6, i64 4, !14, i64 20, !6, i64 24, !6, i64 40, !6, i64 41, !6, i64 42, !6, i64 266, !6, i64 282, !6, i64 283, !12, i64 291, !6, i64 293, !6, i64 294}
!14 = !{!"", !6, i64 0}
!15 = !{!11, !11, i64 0}
!16 = !{!17, !11, i64 280}
!17 = !{!"", !18, 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}
!18 = !{!"", !19, i64 0, !20, i64 8, !20, i64 12, !20, i64 16, !20, i64 20}
!19 = !{!"long long", !6, i64 0}
!20 = !{!"int", !6, i64 0}
!21 = !{!22, !12, i64 0}
!22 = !{!"", !12, i64 0, !12, i64 2, !6, i64 4}
!23 = !{!22, !12, i64 2}
!24 = !{!20, !20, i64 0}
!25 = !{!26, !11, i64 24}
!26 = !{!"_EFI_DHCP6_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}
!27 = !{!17, !11, i64 80}
!28 = !{!17, !11, i64 88}
!29 = !{!17, !11, i64 120}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{!17, !11, i64 112}
!33 = !{!17, !11, i64 288}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopSimplifyPass,LoopUnrollPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass