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

; 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._DHCP6_INSTANCE = type { i32, ptr, ptr, %struct._LIST_ENTRY, %struct._EFI_DHCP6_PROTOCOL, ptr, ptr, ptr, %struct._DHCP6_IA_CB, %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, i8, ptr, i64, i8, i8, i64 }
%struct._EFI_DHCP6_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct._DHCP6_IA_CB = type { ptr, i32, i32, i32, i32 }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct._DHCP6_SERVICE = type { i32, ptr, ptr, %struct._EFI_SERVICE_BINDING_PROTOCOL, ptr, ptr, ptr, ptr, i32, %struct._LIST_ENTRY, i64 }
%struct._EFI_SERVICE_BINDING_PROTOCOL = type { ptr, ptr }
%struct.EFI_DHCP6_PACKET = type <{ i32, i32, %struct.anon }>
%struct.anon = type <{ %struct.EFI_DHCP6_HEADER, [1 x i8] }>
%struct.EFI_DHCP6_HEADER = type { i32 }
%struct.EFI_DHCP6_DUID = type { i16, [1 x i8] }
%struct.EFI_DHCP6_IA = type { %struct.EFI_DHCP6_IA_DESCRIPTOR, i32, ptr, i32, [1 x %struct.EFI_DHCP6_IA_ADDRESS] }
%struct.EFI_DHCP6_IA_DESCRIPTOR = type { i16, i32 }
%struct.EFI_DHCP6_IA_ADDRESS = type { %struct.EFI_IPv6_ADDRESS, i32, i32 }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }

@.str = external hidden unnamed_addr constant [131 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [9 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 zeroext i8 @DebugAssertEnabled() #1

declare void @DebugAssert(ptr noundef, i64 noundef, 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 void @Dhcp6CleanupSession(ptr noundef, i64 noundef) #2

declare ptr @Dhcp6SeekOption(ptr noundef, i32 noundef, i16 noundef zeroext) #1

declare i64 @UdpIoRecvDatagram(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1

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

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

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

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

19:                                               ; preds = %2
  br label %132

20:                                               ; preds = %2
  br label %21

21:                                               ; preds = %20
  %22 = call zeroext i8 @DebugAssertEnabled()
  %23 = icmp ne i8 %22, 0
  br i1 %23, label %24, label %29

24:                                               ; preds = %21
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %28, label %27

27:                                               ; preds = %24
  call void @DebugAssert(ptr noundef @.str, i64 noundef 2599, ptr noundef @.str.14)
  br label %28

28:                                               ; preds = %27, %24
  br label %29

29:                                               ; preds = %28, %21
  br label %30

30:                                               ; preds = %29
  br label %31

31:                                               ; preds = %30
  br label %32

32:                                               ; preds = %31
  %33 = call zeroext i8 @DebugAssertEnabled()
  %34 = icmp ne i8 %33, 0
  br i1 %34, label %35, label %42

35:                                               ; preds = %32
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._DHCP6_INSTANCE, ptr %36, i32 0, i32 6
  %38 = load ptr, ptr %37, align 8, !tbaa !20
  %39 = icmp ne ptr %38, null
  br i1 %39, label %41, label %40

40:                                               ; preds = %35
  call void @DebugAssert(ptr noundef @.str, i64 noundef 2600, ptr noundef @.str.3)
  br label %41

41:                                               ; preds = %40, %35
  br label %42

42:                                               ; preds = %41, %32
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  br label %45

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

48:                                               ; preds = %45
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct._DHCP6_INSTANCE, ptr %49, i32 0, i32 8
  %51 = getelementptr inbounds %struct._DHCP6_IA_CB, ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !21
  %53 = icmp ne ptr %52, null
  br i1 %53, label %55, label %54

54:                                               ; preds = %48
  call void @DebugAssert(ptr noundef @.str, i64 noundef 2601, ptr noundef @.str.4)
  br label %55

55:                                               ; preds = %54, %48
  br label %56

56:                                               ; preds = %55, %45
  br label %57

57:                                               ; preds = %56
  br label %58

58:                                               ; preds = %57
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.EFI_DHCP6_PACKET, ptr %59, i32 0, i32 2
  %61 = getelementptr inbounds %struct.anon, ptr %60, i32 0, i32 0
  %62 = load i32, ptr %61, align 1
  %63 = and i32 %62, 255
  %64 = icmp ne i32 %63, 2
  br i1 %64, label %65, label %73

65:                                               ; preds = %58
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.EFI_DHCP6_PACKET, ptr %66, i32 0, i32 2
  %68 = getelementptr inbounds %struct.anon, ptr %67, i32 0, i32 0
  %69 = load i32, ptr %68, align 1
  %70 = and i32 %69, 255
  %71 = icmp ne i32 %70, 7
  br i1 %71, label %72, label %73

72:                                               ; preds = %65
  br label %132

73:                                               ; preds = %65, %58
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.EFI_DHCP6_PACKET, ptr %74, i32 0, i32 2
  %76 = getelementptr inbounds %struct.anon, ptr %75, i32 0, i32 1
  %77 = getelementptr inbounds [1 x i8], ptr %76, i64 0, i64 0
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.EFI_DHCP6_PACKET, ptr %78, i32 0, i32 1
  %80 = load i32, ptr %79, align 1, !tbaa !22
  %81 = sub i32 %80, 4
  %82 = call ptr @Dhcp6SeekOption(ptr noundef %77, i32 noundef %81, i16 noundef zeroext 1)
  store ptr %82, ptr %8, align 8, !tbaa !5
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = icmp eq ptr %83, null
  br i1 %84, label %97, label %85

85:                                               ; preds = %73
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = getelementptr inbounds i8, ptr %86, i64 4
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.EFI_DHCP6_DUID, ptr %88, i32 0, i32 1
  %90 = getelementptr inbounds [1 x i8], ptr %89, i64 0, i64 0
  %91 = load ptr, ptr %6, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.EFI_DHCP6_DUID, ptr %91, i32 0, i32 0
  %93 = load i16, ptr %92, align 2, !tbaa !26
  %94 = zext i16 %93 to i64
  %95 = call i64 @CompareMem(ptr noundef %87, ptr noundef %90, i64 noundef %94)
  %96 = icmp ne i64 %95, 0
  br i1 %96, label %97, label %98

97:                                               ; preds = %85, %73
  br label %132

98:                                               ; preds = %85
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.EFI_DHCP6_PACKET, ptr %99, i32 0, i32 2
  %101 = getelementptr inbounds %struct.anon, ptr %100, i32 0, i32 1
  %102 = getelementptr inbounds [1 x i8], ptr %101, i64 0, i64 0
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.EFI_DHCP6_PACKET, ptr %103, i32 0, i32 1
  %105 = load i32, ptr %104, align 1, !tbaa !22
  %106 = sub i32 %105, 4
  %107 = call ptr @Dhcp6SeekOption(ptr noundef %102, i32 noundef %106, i16 noundef zeroext 2)
  store ptr %107, ptr %8, align 8, !tbaa !5
  %108 = load ptr, ptr %8, align 8, !tbaa !5
  %109 = icmp eq ptr %108, null
  br i1 %109, label %110, label %111

110:                                              ; preds = %98
  br label %132

111:                                              ; preds = %98
  %112 = load ptr, ptr %3, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct._DHCP6_INSTANCE, ptr %112, i32 0, i32 8
  %114 = getelementptr inbounds %struct._DHCP6_IA_CB, ptr %113, i32 0, i32 0
  %115 = load ptr, ptr %114, align 8, !tbaa !21
  %116 = getelementptr inbounds %struct.EFI_DHCP6_IA, ptr %115, i32 0, i32 1
  %117 = load i32, ptr %116, align 8, !tbaa !29
  switch i32 %117, label %130 [
    i32 1, label %118
    i32 2, label %122
    i32 4, label %122
    i32 7, label %122
    i32 8, label %122
    i32 5, label %122
    i32 3, label %122
  ]

118:                                              ; preds = %111
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = call i64 @Dhcp6HandleAdvertiseMsg(ptr noundef %119, ptr noundef %120)
  br label %131

122:                                              ; preds = %111, %111, %111, %111, %111, %111
  %123 = load ptr, ptr %3, align 8, !tbaa !5
  %124 = load ptr, ptr %4, align 8, !tbaa !5
  %125 = call i64 @Dhcp6HandleReplyMsg(ptr noundef %123, ptr noundef %124)
  store i64 %125, ptr %5, align 8, !tbaa !19
  %126 = load i64, ptr %5, align 8, !tbaa !19
  %127 = icmp slt i64 %126, 0
  br i1 %127, label %128, label %129

128:                                              ; preds = %122
  br label %138

129:                                              ; preds = %122
  br label %131

130:                                              ; preds = %111
  br label %131

131:                                              ; preds = %130, %129, %118
  br label %132

132:                                              ; preds = %131, %110, %97, %72, %19
  %133 = load ptr, ptr %7, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct._DHCP6_SERVICE, ptr %133, i32 0, i32 7
  %135 = load ptr, ptr %134, align 8, !tbaa !32
  %136 = load ptr, ptr %7, align 8, !tbaa !5
  %137 = call i64 @UdpIoRecvDatagram(ptr noundef %135, ptr noundef @Dhcp6ReceivePacket, ptr noundef %136, i32 noundef 0)
  store i64 %137, ptr %5, align 8, !tbaa !19
  br label %138

138:                                              ; preds = %132, %128
  %139 = load i64, ptr %5, align 8, !tbaa !19
  %140 = icmp slt i64 %139, 0
  br i1 %140, label %141, label %144

141:                                              ; preds = %138
  %142 = load ptr, ptr %3, align 8, !tbaa !5
  %143 = load i64, ptr %5, align 8, !tbaa !19
  call void @Dhcp6CleanupSession(ptr noundef %142, i64 noundef %143)
  br label %144

144:                                              ; preds = %141, %138
  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
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret void
}

declare i64 @CompareMem(ptr noundef, ptr noundef, i64 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 16}
!10 = !{!"_DHCP6_INSTANCE", !11, i64 0, !6, i64 8, !6, i64 16, !12, i64 24, !13, i64 40, !6, i64 112, !6, i64 120, !6, i64 128, !14, i64 136, !12, i64 160, !12, i64 176, !6, i64 192, !7, i64 200, !6, i64 208, !15, i64 216, !7, i64 224, !7, i64 225, !15, i64 232}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!13 = !{!"_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}
!14 = !{!"_DHCP6_IA_CB", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!15 = !{!"long long", !7, i64 0}
!16 = !{!17, !6, i64 56}
!17 = !{!"_DHCP6_SERVICE", !11, i64 0, !6, i64 8, !6, i64 16, !18, i64 24, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !11, i64 72, !12, i64 80, !15, i64 96}
!18 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!19 = !{!15, !15, i64 0}
!20 = !{!10, !6, i64 120}
!21 = !{!10, !6, i64 136}
!22 = !{!23, !11, i64 4}
!23 = !{!"", !11, i64 0, !11, i64 4, !24, i64 8}
!24 = !{!"", !25, i64 0, !7, i64 4}
!25 = !{!"", !11, i64 0, !11, i64 1}
!26 = !{!27, !28, i64 0}
!27 = !{!"", !28, i64 0, !7, i64 2}
!28 = !{!"short", !7, i64 0}
!29 = !{!30, !11, i64 8}
!30 = !{!"", !31, i64 0, !11, i64 8, !6, i64 16, !11, i64 24, !7, i64 28}
!31 = !{!"", !28, i64 0, !11, i64 4}
!32 = !{!17, !6, i64 64}


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

@.str = external hidden unnamed_addr constant [131 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [9 x i8], align 1

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #0

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @Dhcp6CleanupSession(ptr noundef, i64 noundef) local_unnamed_addr #1

declare ptr @Dhcp6SeekOption(ptr noundef, i32 noundef, i16 noundef zeroext) local_unnamed_addr #0

declare i64 @UdpIoRecvDatagram(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @Dhcp6ReceivePacket(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #1

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

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

; Function Attrs: nounwind uwtable
define dso_local void @Dhcp6HandleStateful(ptr noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 56
  %6 = load ptr, ptr %5, align 8, !tbaa !15
  %7 = getelementptr inbounds i8, ptr %0, i64 120
  %8 = load ptr, ptr %7, align 8, !tbaa !18
  %9 = icmp eq ptr %8, null
  br i1 %9, label %57, label %10

10:                                               ; preds = %2
  %11 = tail call zeroext i8 @DebugAssertEnabled() #2
  %12 = icmp eq i8 %11, 0
  %13 = icmp ne ptr %6, null
  %or.cond = select i1 %12, i1 true, i1 %13
  br i1 %or.cond, label %15, label %14

14:                                               ; preds = %10
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 2599, ptr noundef nonnull @.str.14) #2
  br label %15

15:                                               ; preds = %10, %14
  %16 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not = icmp eq i8 %16, 0
  br i1 %.not, label %20, label %17

17:                                               ; preds = %15
  %18 = load ptr, ptr %7, align 8, !tbaa !18
  %.not31 = icmp eq ptr %18, null
  br i1 %.not31, label %19, label %20

19:                                               ; preds = %17
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 2600, ptr noundef nonnull @.str.3) #2
  br label %20

20:                                               ; preds = %15, %19, %17
  %21 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not32 = icmp eq i8 %21, 0
  br i1 %.not32, label %26, label %22

22:                                               ; preds = %20
  %23 = getelementptr inbounds i8, ptr %0, i64 136
  %24 = load ptr, ptr %23, align 8, !tbaa !19
  %.not33 = icmp eq ptr %24, null
  br i1 %.not33, label %25, label %26

25:                                               ; preds = %22
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 2601, ptr noundef nonnull @.str.4) #2
  br label %26

26:                                               ; preds = %22, %25, %20
  %27 = getelementptr inbounds i8, ptr %1, i64 8
  %28 = load i32, ptr %27, align 1
  %trunc = trunc i32 %28 to i8
  switch i8 %trunc, label %57 [
    i8 2, label %29
    i8 7, label %29
  ]

29:                                               ; preds = %26, %26
  %30 = getelementptr inbounds i8, ptr %1, i64 12
  %31 = getelementptr inbounds i8, ptr %1, i64 4
  %32 = load i32, ptr %31, align 1, !tbaa !20
  %33 = add i32 %32, -4
  %34 = tail call ptr @Dhcp6SeekOption(ptr noundef nonnull %30, i32 noundef %33, i16 noundef zeroext 1) #2
  %35 = icmp eq ptr %34, null
  br i1 %35, label %57, label %36

36:                                               ; preds = %29
  %37 = getelementptr inbounds i8, ptr %34, i64 4
  %38 = getelementptr inbounds i8, ptr %6, i64 2
  %39 = load i16, ptr %6, align 2, !tbaa !24
  %40 = zext i16 %39 to i64
  %41 = tail call i64 @CompareMem(ptr noundef nonnull %37, ptr noundef nonnull %38, i64 noundef %40) #2
  %.not36 = icmp eq i64 %41, 0
  br i1 %.not36, label %42, label %57

42:                                               ; preds = %36
  %43 = load i32, ptr %31, align 1, !tbaa !20
  %44 = add i32 %43, -4
  %45 = tail call ptr @Dhcp6SeekOption(ptr noundef nonnull %30, i32 noundef %44, i16 noundef zeroext 2) #2
  %46 = icmp eq ptr %45, null
  br i1 %46, label %57, label %47

47:                                               ; preds = %42
  %48 = getelementptr inbounds i8, ptr %0, i64 136
  %49 = load ptr, ptr %48, align 8, !tbaa !19
  %50 = getelementptr inbounds i8, ptr %49, i64 8
  %51 = load i32, ptr %50, align 8, !tbaa !27
  switch i32 %51, label %57 [
    i32 1, label %52
    i32 2, label %54
    i32 4, label %54
    i32 7, label %54
    i32 8, label %54
    i32 5, label %54
    i32 3, label %54
  ]

52:                                               ; preds = %47
  %53 = tail call i64 @Dhcp6HandleAdvertiseMsg(ptr noundef nonnull %0, ptr noundef nonnull %1)
  br label %57

54:                                               ; preds = %47, %47, %47, %47, %47, %47
  %55 = tail call i64 @Dhcp6HandleReplyMsg(ptr noundef nonnull %0, ptr noundef nonnull %1)
  %56 = icmp slt i64 %55, 0
  br i1 %56, label %.thread, label %57

57:                                               ; preds = %2, %36, %29, %42, %47, %54, %52, %26
  %58 = getelementptr inbounds i8, ptr %4, i64 64
  %59 = load ptr, ptr %58, align 8, !tbaa !30
  %60 = tail call i64 @UdpIoRecvDatagram(ptr noundef %59, ptr noundef nonnull @Dhcp6ReceivePacket, ptr noundef nonnull %4, i32 noundef 0) #2
  %61 = icmp slt i64 %60, 0
  br i1 %61, label %.thread, label %62

.thread:                                          ; preds = %54, %57
  %.038 = phi i64 [ %60, %57 ], [ %55, %54 ]
  tail call void @Dhcp6CleanupSession(ptr noundef nonnull %0, i64 noundef %.038)
  br label %62

62:                                               ; preds = %.thread, %57
  ret void
}

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

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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, !10, i64 16}
!6 = !{!"_DHCP6_INSTANCE", !7, i64 0, !10, i64 8, !10, i64 16, !11, i64 24, !12, i64 40, !10, i64 112, !10, i64 120, !10, i64 128, !13, i64 136, !11, i64 160, !11, i64 176, !10, i64 192, !8, i64 200, !10, i64 208, !14, i64 216, !8, i64 224, !8, i64 225, !14, i64 232}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_LIST_ENTRY", !10, i64 0, !10, i64 8}
!12 = !{!"_EFI_DHCP6_PROTOCOL", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64}
!13 = !{!"_DHCP6_IA_CB", !10, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!14 = !{!"long long", !8, i64 0}
!15 = !{!16, !10, i64 56}
!16 = !{!"_DHCP6_SERVICE", !7, i64 0, !10, i64 8, !10, i64 16, !17, i64 24, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !7, i64 72, !11, i64 80, !14, i64 96}
!17 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !10, i64 0, !10, i64 8}
!18 = !{!6, !10, i64 120}
!19 = !{!6, !10, i64 136}
!20 = !{!21, !7, i64 4}
!21 = !{!"", !7, i64 0, !7, i64 4, !22, i64 8}
!22 = !{!"", !23, i64 0, !8, i64 4}
!23 = !{!"", !7, i64 0, !7, i64 1}
!24 = !{!25, !26, i64 0}
!25 = !{!"", !26, i64 0, !8, i64 2}
!26 = !{!"short", !8, i64 0}
!27 = !{!28, !7, i64 8}
!28 = !{!"", !29, i64 0, !7, i64 8, !10, i64 16, !7, i64 24, !8, i64 28}
!29 = !{!"", !26, i64 0, !7, i64 4}
!30 = !{!16, !10, i64 64}


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