; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal (Ip4Groups)

; 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._IP4_PROTOCOL = type { i32, %struct._EFI_IP4_PROTOCOL, ptr, i64, ptr, %struct._LIST_ENTRY, %struct.NET_MAP, %struct.NET_MAP, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct.EFI_LOCK, ptr, %struct._LIST_ENTRY, ptr, ptr, i32, ptr, i32, %struct.EFI_IP4_CONFIG_DATA }
%struct._EFI_IP4_PROTOCOL = type { 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_IP4_CONFIG_DATA = type { i8, i8, i8, i8, i8, i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i8, i8, i8, i8, i32, i32 }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }

@.str = external hidden unnamed_addr constant [149 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [11 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

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

declare i32 @SwapBytes32(i32 noundef) #1

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

declare void @FreePool(ptr noundef) #1

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

14:                                               ; preds = %3
  br label %15

15:                                               ; preds = %14
  %16 = call zeroext i8 @DebugAssertEnabled()
  %17 = icmp ne i8 %16, 0
  br i1 %17, label %18, label %23

18:                                               ; preds = %15
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %22, label %21

21:                                               ; preds = %18
  call void @DebugAssert(ptr noundef @.str, i64 noundef 1355, ptr noundef @.str.4)
  br label %22

22:                                               ; preds = %21, %18
  br label %23

23:                                               ; preds = %22, %15
  br label %24

24:                                               ; preds = %23
  br label %25

25:                                               ; preds = %24
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = call ptr @CopyMem(ptr noundef %9, ptr noundef %26, i64 noundef 4)
  store i32 0, ptr %10, align 4, !tbaa !10
  br label %28

28:                                               ; preds = %46, %25
  %29 = load i32, ptr %10, align 4, !tbaa !10
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %30, i32 0, i32 17
  %32 = load i32, ptr %31, align 8, !tbaa !12
  %33 = icmp ult i32 %29, %32
  br i1 %33, label %34, label %49

34:                                               ; preds = %28
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %35, i32 0, i32 16
  %37 = load ptr, ptr %36, align 8, !tbaa !21
  %38 = load i32, ptr %10, align 4, !tbaa !10
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds i32, ptr %37, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !10
  %42 = load i32, ptr %9, align 4, !tbaa !10
  %43 = icmp eq i32 %41, %42
  br i1 %43, label %44, label %45

44:                                               ; preds = %34
  store i64 -9223372036854775788, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %163

45:                                               ; preds = %34
  br label %46

46:                                               ; preds = %45
  %47 = load i32, ptr %10, align 4, !tbaa !10
  %48 = add i32 %47, 1
  store i32 %48, ptr %10, align 4, !tbaa !10
  br label %28, !llvm.loop !22

49:                                               ; preds = %28
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %50, i32 0, i32 16
  %52 = load ptr, ptr %51, align 8, !tbaa !21
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %53, i32 0, i32 17
  %55 = load i32, ptr %54, align 8, !tbaa !12
  %56 = load i32, ptr %9, align 4, !tbaa !10
  %57 = call ptr @Ip4CombineGroups(ptr noundef %52, i32 noundef %55, i32 noundef %56)
  store ptr %57, ptr %8, align 8, !tbaa !5
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = icmp eq ptr %58, null
  br i1 %59, label %60, label %61

60:                                               ; preds = %49
  store i64 -9223372036854775799, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %163

61:                                               ; preds = %49
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = load i32, ptr %9, align 4, !tbaa !10
  %64 = call i32 @SwapBytes32(i32 noundef %63)
  %65 = call i64 @Ip4JoinGroup(ptr noundef %62, i32 noundef %64)
  %66 = icmp slt i64 %65, 0
  br i1 %66, label %67, label %69

67:                                               ; preds = %61
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  call void @FreePool(ptr noundef %68)
  store i64 -9223372036854775801, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %163

69:                                               ; preds = %61
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %70, i32 0, i32 16
  %72 = load ptr, ptr %71, align 8, !tbaa !21
  %73 = icmp ne ptr %72, null
  br i1 %73, label %74, label %78

74:                                               ; preds = %69
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %75, i32 0, i32 16
  %77 = load ptr, ptr %76, align 8, !tbaa !21
  call void @FreePool(ptr noundef %77)
  br label %78

78:                                               ; preds = %74, %69
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %80, i32 0, i32 16
  store ptr %79, ptr %81, align 8, !tbaa !21
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %82, i32 0, i32 17
  %84 = load i32, ptr %83, align 8, !tbaa !12
  %85 = add i32 %84, 1
  store i32 %85, ptr %83, align 8, !tbaa !12
  store i64 0, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %163

86:                                               ; preds = %3
  %87 = load ptr, ptr %5, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %87, i32 0, i32 17
  %89 = load i32, ptr %88, align 8, !tbaa !12
  store i32 %89, ptr %10, align 4, !tbaa !10
  br label %90

90:                                               ; preds = %155, %86
  %91 = load i32, ptr %10, align 4, !tbaa !10
  %92 = icmp ugt i32 %91, 0
  br i1 %92, label %93, label %158

93:                                               ; preds = %90
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %94, i32 0, i32 16
  %96 = load ptr, ptr %95, align 8, !tbaa !21
  %97 = load i32, ptr %10, align 4, !tbaa !10
  %98 = sub i32 %97, 1
  %99 = zext i32 %98 to i64
  %100 = getelementptr inbounds i32, ptr %96, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !10
  store i32 %101, ptr %9, align 4, !tbaa !10
  %102 = load ptr, ptr %7, align 8, !tbaa !5
  %103 = icmp eq ptr %102, null
  br i1 %103, label %108, label %104

104:                                              ; preds = %93
  %105 = load ptr, ptr %7, align 8, !tbaa !5
  %106 = call i64 @CompareMem(ptr noundef %9, ptr noundef %105, i64 noundef 4)
  %107 = icmp eq i64 %106, 0
  br i1 %107, label %108, label %154

108:                                              ; preds = %104, %93
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = load i32, ptr %9, align 4, !tbaa !10
  %111 = call i32 @SwapBytes32(i32 noundef %110)
  %112 = call i64 @Ip4LeaveGroup(ptr noundef %109, i32 noundef %111)
  %113 = icmp slt i64 %112, 0
  br i1 %113, label %114, label %115

114:                                              ; preds = %108
  store i64 -9223372036854775801, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %163

115:                                              ; preds = %108
  %116 = load ptr, ptr %5, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %116, i32 0, i32 16
  %118 = load ptr, ptr %117, align 8, !tbaa !21
  %119 = load ptr, ptr %5, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %119, i32 0, i32 17
  %121 = load i32, ptr %120, align 8, !tbaa !12
  %122 = load i32, ptr %9, align 4, !tbaa !10
  %123 = call i64 @Ip4RemoveGroupAddr(ptr noundef %118, i32 noundef %121, i32 noundef %122)
  %124 = load ptr, ptr %5, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %124, i32 0, i32 17
  %126 = load i32, ptr %125, align 8, !tbaa !12
  %127 = add i32 %126, -1
  store i32 %127, ptr %125, align 8, !tbaa !12
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %128, i32 0, i32 17
  %130 = load i32, ptr %129, align 8, !tbaa !12
  %131 = icmp eq i32 %130, 0
  br i1 %131, label %132, label %149

132:                                              ; preds = %115
  br label %133

133:                                              ; preds = %132
  %134 = call zeroext i8 @DebugAssertEnabled()
  %135 = icmp ne i8 %134, 0
  br i1 %135, label %136, label %141

136:                                              ; preds = %133
  %137 = load i32, ptr %10, align 4, !tbaa !10
  %138 = icmp eq i32 %137, 1
  br i1 %138, label %140, label %139

139:                                              ; preds = %136
  call void @DebugAssert(ptr noundef @.str, i64 noundef 1402, ptr noundef @.str.5)
  br label %140

140:                                              ; preds = %139, %136
  br label %141

141:                                              ; preds = %140, %133
  br label %142

142:                                              ; preds = %141
  br label %143

143:                                              ; preds = %142
  %144 = load ptr, ptr %5, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %144, i32 0, i32 16
  %146 = load ptr, ptr %145, align 8, !tbaa !21
  call void @FreePool(ptr noundef %146)
  %147 = load ptr, ptr %5, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %147, i32 0, i32 16
  store ptr null, ptr %148, align 8, !tbaa !21
  br label %149

149:                                              ; preds = %143, %115
  %150 = load ptr, ptr %7, align 8, !tbaa !5
  %151 = icmp ne ptr %150, null
  br i1 %151, label %152, label %153

152:                                              ; preds = %149
  store i64 0, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %163

153:                                              ; preds = %149
  br label %154

154:                                              ; preds = %153, %104
  br label %155

155:                                              ; preds = %154
  %156 = load i32, ptr %10, align 4, !tbaa !10
  %157 = add i32 %156, -1
  store i32 %157, ptr %10, align 4, !tbaa !10
  br label %90, !llvm.loop !24

158:                                              ; preds = %90
  %159 = load ptr, ptr %7, align 8, !tbaa !5
  %160 = icmp ne ptr %159, null
  %161 = zext i1 %160 to i64
  %162 = select i1 %160, i64 -9223372036854775794, i64 0
  store i64 %162, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %163

163:                                              ; preds = %158, %152, %114, %78, %67, %60, %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %164 = load i64, ptr %4, align 8
  ret i64 %164
}

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

declare ptr @Ip4CombineGroups(ptr noundef, i32 noundef, i32 noundef) #1

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

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

declare i64 @Ip4RemoveGroupAddr(ptr noundef, i32 noundef, i32 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, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 304}
!13 = !{!"_IP4_PROTOCOL", !11, i64 0, !14, i64 8, !6, i64 72, !15, i64 80, !6, i64 88, !16, i64 96, !17, i64 112, !17, i64 152, !16, i64 192, !16, i64 208, !18, i64 224, !6, i64 248, !16, i64 256, !6, i64 272, !6, i64 280, !11, i64 288, !6, i64 296, !11, i64 304, !19, i64 308}
!14 = !{!"_EFI_IP4_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}
!15 = !{!"long long", !7, i64 0}
!16 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!17 = !{!"", !16, i64 0, !16, i64 16, !15, i64 32}
!18 = !{!"", !15, i64 0, !15, i64 8, !11, i64 16}
!19 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !20, i64 6, !20, i64 10, !7, i64 14, !7, i64 15, !7, i64 16, !7, i64 17, !11, i64 20, !11, i64 24}
!20 = !{!"", !7, i64 0}
!21 = !{!13, !6, i64 296}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}


; 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 [149 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [11 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 zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

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

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

declare i32 @SwapBytes32(i32 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 void @FreePool(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775801, 1) i64 @Ip4Groups(ptr noundef %0, i8 noundef zeroext %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #3
  %.not = icmp eq i8 %1, 0
  br i1 %.not, label %34, label %5

5:                                                ; preds = %3
  %6 = tail call zeroext i8 @DebugAssertEnabled() #3
  %7 = icmp eq i8 %6, 0
  %8 = icmp ne ptr %2, null
  %or.cond = or i1 %8, %7
  br i1 %or.cond, label %10, label %9

9:                                                ; preds = %5
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 1355, ptr noundef nonnull @.str.4) #3
  br label %10

10:                                               ; preds = %9, %5
  %11 = call ptr @CopyMem(ptr noundef nonnull %4, ptr noundef %2, i64 noundef 4) #3
  %12 = getelementptr inbounds i8, ptr %0, i64 304
  %13 = load i32, ptr %12, align 8, !tbaa !5
  %.not57 = icmp eq i32 %13, 0
  %.phi.trans.insert = getelementptr inbounds i8, ptr %0, i64 296
  %.pre = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !18
  %.pre68 = load i32, ptr %4, align 4, !tbaa !19
  br i1 %.not57, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %10
  %wide.trip.count = zext i32 %13 to i64
  br label %15

14:                                               ; preds = %15
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %15, !llvm.loop !20

15:                                               ; preds = %.lr.ph, %14
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %14 ]
  %16 = getelementptr inbounds i32, ptr %.pre, i64 %indvars.iv
  %17 = load i32, ptr %16, align 4, !tbaa !19
  %18 = icmp eq i32 %17, %.pre68
  br i1 %18, label %.loopexit, label %14

._crit_edge:                                      ; preds = %14, %10
  %19 = getelementptr inbounds i8, ptr %0, i64 296
  %20 = call ptr @Ip4CombineGroups(ptr noundef %.pre, i32 noundef %13, i32 noundef %.pre68) #3
  %21 = icmp eq ptr %20, null
  br i1 %21, label %.loopexit, label %22

22:                                               ; preds = %._crit_edge
  %23 = load i32, ptr %4, align 4, !tbaa !19
  %24 = call i32 @SwapBytes32(i32 noundef %23) #3
  %25 = call i64 @Ip4JoinGroup(ptr noundef nonnull %0, i32 noundef %24) #3
  %26 = icmp slt i64 %25, 0
  br i1 %26, label %27, label %28

27:                                               ; preds = %22
  call void @FreePool(ptr noundef nonnull %20) #3
  br label %.loopexit

28:                                               ; preds = %22
  %29 = load ptr, ptr %19, align 8, !tbaa !18
  %.not46 = icmp eq ptr %29, null
  br i1 %.not46, label %31, label %30

30:                                               ; preds = %28
  call void @FreePool(ptr noundef nonnull %29) #3
  br label %31

31:                                               ; preds = %30, %28
  store ptr %20, ptr %19, align 8, !tbaa !18
  %32 = load i32, ptr %12, align 8, !tbaa !5
  %33 = add i32 %32, 1
  store i32 %33, ptr %12, align 8, !tbaa !5
  br label %.loopexit

34:                                               ; preds = %3
  %35 = getelementptr inbounds i8, ptr %0, i64 304
  %36 = load i32, ptr %35, align 8, !tbaa !5
  %.not4352 = icmp eq i32 %36, 0
  br i1 %.not4352, label %._crit_edge56, label %.lr.ph55

.lr.ph55:                                         ; preds = %34
  %37 = getelementptr inbounds i8, ptr %0, i64 296
  %38 = icmp eq ptr %2, null
  %39 = zext i32 %36 to i64
  br i1 %38, label %.lr.ph55.split.us, label %.lr.ph55.split

.lr.ph55.split.us:                                ; preds = %.lr.ph55, %62
  %indvars.iv65 = phi i64 [ %41, %62 ], [ %39, %.lr.ph55 ]
  %40 = load ptr, ptr %37, align 8, !tbaa !18
  %41 = add nsw i64 %indvars.iv65, -1
  %42 = getelementptr inbounds i32, ptr %40, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !19
  store i32 %43, ptr %4, align 4, !tbaa !19
  %44 = tail call i32 @SwapBytes32(i32 noundef %43) #3
  %45 = tail call i64 @Ip4LeaveGroup(ptr noundef nonnull %0, i32 noundef %44) #3
  %46 = icmp slt i64 %45, 0
  br i1 %46, label %.loopexit, label %47

47:                                               ; preds = %.lr.ph55.split.us
  %48 = load ptr, ptr %37, align 8, !tbaa !18
  %49 = load i32, ptr %35, align 8, !tbaa !5
  %50 = load i32, ptr %4, align 4, !tbaa !19
  %51 = tail call i64 @Ip4RemoveGroupAddr(ptr noundef %48, i32 noundef %49, i32 noundef %50) #3
  %52 = load i32, ptr %35, align 8, !tbaa !5
  %53 = add i32 %52, -1
  store i32 %53, ptr %35, align 8, !tbaa !5
  %54 = icmp eq i32 %53, 0
  br i1 %54, label %55, label %62

55:                                               ; preds = %47
  %56 = tail call zeroext i8 @DebugAssertEnabled() #3
  %57 = icmp eq i8 %56, 0
  %58 = icmp eq i64 %indvars.iv65, 1
  %or.cond3.us = or i1 %58, %57
  br i1 %or.cond3.us, label %60, label %59

59:                                               ; preds = %55
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 1402, ptr noundef nonnull @.str.5) #3
  br label %60

60:                                               ; preds = %59, %55
  %61 = load ptr, ptr %37, align 8, !tbaa !18
  tail call void @FreePool(ptr noundef %61) #3
  store ptr null, ptr %37, align 8, !tbaa !18
  br label %62

62:                                               ; preds = %60, %47
  %.not43.us.wide = icmp eq i64 %41, 0
  br i1 %.not43.us.wide, label %._crit_edge56, label %.lr.ph55.split.us, !llvm.loop !22

.lr.ph55.split:                                   ; preds = %.lr.ph55, %89
  %indvars.iv62 = phi i64 [ %64, %89 ], [ %39, %.lr.ph55 ]
  %63 = load ptr, ptr %37, align 8, !tbaa !18
  %64 = add nsw i64 %indvars.iv62, -1
  %65 = getelementptr inbounds i32, ptr %63, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !19
  store i32 %66, ptr %4, align 4, !tbaa !19
  %67 = call i64 @CompareMem(ptr noundef nonnull %4, ptr noundef nonnull %2, i64 noundef 4) #3
  %68 = icmp eq i64 %67, 0
  br i1 %68, label %69, label %89

69:                                               ; preds = %.lr.ph55.split
  %70 = load i32, ptr %4, align 4, !tbaa !19
  %71 = call i32 @SwapBytes32(i32 noundef %70) #3
  %72 = call i64 @Ip4LeaveGroup(ptr noundef nonnull %0, i32 noundef %71) #3
  %73 = icmp slt i64 %72, 0
  br i1 %73, label %.loopexit, label %74

74:                                               ; preds = %69
  %75 = load ptr, ptr %37, align 8, !tbaa !18
  %76 = load i32, ptr %35, align 8, !tbaa !5
  %77 = load i32, ptr %4, align 4, !tbaa !19
  %78 = call i64 @Ip4RemoveGroupAddr(ptr noundef %75, i32 noundef %76, i32 noundef %77) #3
  %79 = load i32, ptr %35, align 8, !tbaa !5
  %80 = add i32 %79, -1
  store i32 %80, ptr %35, align 8, !tbaa !5
  %81 = icmp eq i32 %80, 0
  br i1 %81, label %82, label %.loopexit

82:                                               ; preds = %74
  %83 = call zeroext i8 @DebugAssertEnabled() #3
  %84 = icmp eq i8 %83, 0
  %85 = icmp eq i64 %indvars.iv62, 1
  %or.cond3 = or i1 %85, %84
  br i1 %or.cond3, label %87, label %86

86:                                               ; preds = %82
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 1402, ptr noundef nonnull @.str.5) #3
  br label %87

87:                                               ; preds = %86, %82
  %88 = load ptr, ptr %37, align 8, !tbaa !18
  call void @FreePool(ptr noundef %88) #3
  store ptr null, ptr %37, align 8, !tbaa !18
  br label %.loopexit

89:                                               ; preds = %.lr.ph55.split
  %.not43.wide = icmp eq i64 %64, 0
  br i1 %.not43.wide, label %._crit_edge56, label %.lr.ph55.split, !llvm.loop !22

._crit_edge56:                                    ; preds = %89, %62, %34
  %.not44 = icmp eq ptr %2, null
  %90 = select i1 %.not44, i64 0, i64 -9223372036854775794
  br label %.loopexit

.loopexit:                                        ; preds = %15, %.lr.ph55.split.us, %74, %87, %69, %._crit_edge, %._crit_edge56, %31, %27
  %.038 = phi i64 [ -9223372036854775801, %27 ], [ 0, %31 ], [ %90, %._crit_edge56 ], [ -9223372036854775799, %._crit_edge ], [ -9223372036854775801, %69 ], [ 0, %87 ], [ 0, %74 ], [ -9223372036854775801, %.lr.ph55.split.us ], [ -9223372036854775788, %15 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #3
  ret i64 %.038
}

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

declare ptr @Ip4CombineGroups(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

declare i64 @Ip4JoinGroup(ptr noundef, i32 noundef) local_unnamed_addr #1

declare i64 @Ip4LeaveGroup(ptr noundef, i32 noundef) local_unnamed_addr #1

declare i64 @Ip4RemoveGroupAddr(ptr noundef, i32 noundef, i32 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, !7, i64 304}
!6 = !{!"_IP4_PROTOCOL", !7, i64 0, !10, i64 8, !11, i64 72, !12, i64 80, !11, i64 88, !13, i64 96, !14, i64 112, !14, i64 152, !13, i64 192, !13, i64 208, !15, i64 224, !11, i64 248, !13, i64 256, !11, i64 272, !11, i64 280, !7, i64 288, !11, i64 296, !7, i64 304, !16, i64 308}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_EFI_IP4_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 = !{!"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, !8, i64 4, !8, i64 5, !17, i64 6, !17, i64 10, !8, i64 14, !8, i64 15, !8, i64 16, !8, i64 17, !7, i64 20, !7, i64 24}
!17 = !{!"", !8, i64 0}
!18 = !{!6, !11, i64 296}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass