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

; 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] }
%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._IP4_INTERFACE = type { i32, %struct._LIST_ENTRY, i64, i32, i32, i32, i32, i8, ptr, ptr, ptr, ptr, ptr, %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, %struct.EFI_MAC_ADDRESS, %struct.EFI_MAC_ADDRESS, i32, %struct._LIST_ENTRY, i8 }
%struct.EFI_MAC_ADDRESS = type { [32 x i8] }

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

; Function Attrs: nounwind uwtable
define dso_local i64 @EfiIp4Routes(ptr noundef %0, i8 noundef zeroext %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #0 {
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i8 %1, ptr %8, align 1, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = icmp eq ptr %20, null
  br i1 %21, label %31, label %22

22:                                               ; preds = %5
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  %24 = icmp eq ptr %23, null
  br i1 %24, label %31, label %25

25:                                               ; preds = %22
  %26 = load ptr, ptr %10, align 8, !tbaa !5
  %27 = icmp eq ptr %26, null
  br i1 %27, label %31, label %28

28:                                               ; preds = %25
  %29 = load ptr, ptr %11, align 8, !tbaa !5
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %32

31:                                               ; preds = %28, %25, %22, %5
  store i64 -9223372036854775806, ptr %6, align 8
  store i32 1, ptr %19, align 4
  br label %146

32:                                               ; preds = %28
  %33 = call zeroext i8 @DebugAssertEnabled()
  %34 = zext i8 %33 to i32
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %36, label %46

36:                                               ; preds = %32
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = ptrtoint ptr %37 to i64
  %39 = sub i64 %38, ptrtoint (ptr getelementptr inbounds (%struct._IP4_PROTOCOL, ptr null, i32 0, i32 1) to i64)
  %40 = inttoptr i64 %39 to ptr
  %41 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 8, !tbaa !10
  %43 = icmp ne i32 %42, 1345605705
  br i1 %43, label %44, label %46

44:                                               ; preds = %36
  call void @DebugAssert(ptr noundef @.str, i64 noundef 1570, ptr noundef @.str.1)
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  br label %51

46:                                               ; preds = %36, %32
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = ptrtoint ptr %47 to i64
  %49 = sub i64 %48, ptrtoint (ptr getelementptr inbounds (%struct._IP4_PROTOCOL, ptr null, i32 0, i32 1) to i64)
  %50 = inttoptr i64 %49 to ptr
  br label %51

51:                                               ; preds = %46, %44
  %52 = phi ptr [ %45, %44 ], [ %50, %46 ]
  store ptr %52, ptr %12, align 8, !tbaa !5
  %53 = load ptr, ptr @gBS, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %53, i32 0, i32 1
  %55 = load ptr, ptr %54, align 8, !tbaa !20
  %56 = call i64 %55(i64 noundef 8)
  store i64 %56, ptr %18, align 8, !tbaa !23
  %57 = load ptr, ptr %12, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %57, i32 0, i32 3
  %59 = load i64, ptr %58, align 8, !tbaa !24
  %60 = icmp ne i64 %59, 1
  br i1 %60, label %61, label %62

61:                                               ; preds = %51
  store i64 -9223372036854775789, ptr %17, align 8, !tbaa !23
  br label %140

62:                                               ; preds = %51
  %63 = load ptr, ptr %12, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %63, i32 0, i32 18
  %65 = getelementptr inbounds %struct.EFI_IP4_CONFIG_DATA, ptr %64, i32 0, i32 5
  %66 = load i8, ptr %65, align 1, !tbaa !25
  %67 = zext i8 %66 to i32
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %77

69:                                               ; preds = %62
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %70, i32 0, i32 11
  %72 = load ptr, ptr %71, align 8, !tbaa !26
  %73 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %72, i32 0, i32 7
  %74 = load i8, ptr %73, align 8, !tbaa !27
  %75 = icmp ne i8 %74, 0
  br i1 %75, label %77, label %76

76:                                               ; preds = %69
  store i64 -9223372036854775791, ptr %17, align 8, !tbaa !23
  br label %140

77:                                               ; preds = %69, %62
  %78 = load ptr, ptr %9, align 8, !tbaa !5
  %79 = call ptr @CopyMem(ptr noundef %14, ptr noundef %78, i64 noundef 4)
  %80 = load ptr, ptr %10, align 8, !tbaa !5
  %81 = call ptr @CopyMem(ptr noundef %15, ptr noundef %80, i64 noundef 4)
  %82 = load ptr, ptr %11, align 8, !tbaa !5
  %83 = call ptr @CopyMem(ptr noundef %16, ptr noundef %82, i64 noundef 4)
  %84 = load i32, ptr %14, align 4, !tbaa !29
  %85 = call i32 @SwapBytes32(i32 noundef %84)
  store i32 %85, ptr %14, align 4, !tbaa !29
  %86 = load i32, ptr %15, align 4, !tbaa !29
  %87 = call i32 @SwapBytes32(i32 noundef %86)
  store i32 %87, ptr %15, align 4, !tbaa !29
  %88 = load i32, ptr %16, align 4, !tbaa !29
  %89 = call i32 @SwapBytes32(i32 noundef %88)
  store i32 %89, ptr %16, align 4, !tbaa !29
  %90 = load ptr, ptr %12, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %90, i32 0, i32 11
  %92 = load ptr, ptr %91, align 8, !tbaa !26
  store ptr %92, ptr %13, align 8, !tbaa !5
  %93 = load i32, ptr %15, align 4, !tbaa !29
  %94 = call i64 @NetGetMaskLength(i32 noundef %93)
  %95 = icmp ne i64 %94, 33
  br i1 %95, label %97, label %96

96:                                               ; preds = %77
  store i64 -9223372036854775806, ptr %17, align 8, !tbaa !23
  br label %140

97:                                               ; preds = %77
  %98 = load i32, ptr %16, align 4, !tbaa !29
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %100, label %120

100:                                              ; preds = %97
  %101 = load i32, ptr %16, align 4, !tbaa !29
  %102 = load ptr, ptr %13, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %102, i32 0, i32 4
  %104 = load i32, ptr %103, align 4, !tbaa !30
  %105 = and i32 %101, %104
  %106 = load ptr, ptr %13, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %106, i32 0, i32 3
  %108 = load i32, ptr %107, align 8, !tbaa !31
  %109 = load ptr, ptr %13, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %109, i32 0, i32 4
  %111 = load i32, ptr %110, align 4, !tbaa !30
  %112 = and i32 %108, %111
  %113 = icmp eq i32 %105, %112
  br i1 %113, label %114, label %119

114:                                              ; preds = %100
  %115 = load i32, ptr %16, align 4, !tbaa !29
  %116 = load ptr, ptr %13, align 8, !tbaa !5
  %117 = call i64 @Ip4GetNetCast(i32 noundef %115, ptr noundef %116)
  %118 = icmp sge i64 %117, 4
  br i1 %118, label %119, label %120

119:                                              ; preds = %114, %100
  store i64 -9223372036854775806, ptr %17, align 8, !tbaa !23
  br label %140

120:                                              ; preds = %114, %97
  %121 = load i8, ptr %8, align 1, !tbaa !9
  %122 = icmp ne i8 %121, 0
  br i1 %122, label %123, label %131

123:                                              ; preds = %120
  %124 = load ptr, ptr %12, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %124, i32 0, i32 13
  %126 = load ptr, ptr %125, align 8, !tbaa !32
  %127 = load i32, ptr %14, align 4, !tbaa !29
  %128 = load i32, ptr %15, align 4, !tbaa !29
  %129 = load i32, ptr %16, align 4, !tbaa !29
  %130 = call i64 @Ip4DelRoute(ptr noundef %126, i32 noundef %127, i32 noundef %128, i32 noundef %129)
  store i64 %130, ptr %17, align 8, !tbaa !23
  br label %139

131:                                              ; preds = %120
  %132 = load ptr, ptr %12, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %132, i32 0, i32 13
  %134 = load ptr, ptr %133, align 8, !tbaa !32
  %135 = load i32, ptr %14, align 4, !tbaa !29
  %136 = load i32, ptr %15, align 4, !tbaa !29
  %137 = load i32, ptr %16, align 4, !tbaa !29
  %138 = call i64 @Ip4AddRoute(ptr noundef %134, i32 noundef %135, i32 noundef %136, i32 noundef %137)
  store i64 %138, ptr %17, align 8, !tbaa !23
  br label %139

139:                                              ; preds = %131, %123
  br label %140

140:                                              ; preds = %139, %119, %96, %76, %61
  %141 = load ptr, ptr @gBS, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %141, i32 0, i32 2
  %143 = load ptr, ptr %142, align 8, !tbaa !33
  %144 = load i64, ptr %18, align 8, !tbaa !23
  call void %143(i64 noundef %144)
  %145 = load i64, ptr %17, align 8, !tbaa !23
  store i64 %145, ptr %6, align 8
  store i32 1, ptr %19, align 4
  br label %146

146:                                              ; preds = %140, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, 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
  %147 = load i64, ptr %6, align 8
  ret i64 %147
}

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

declare zeroext i8 @DebugAssertEnabled() #2

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

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

declare i32 @SwapBytes32(i32 noundef) #2

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

declare i64 @Ip4AddRoute(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #2

declare i64 @NetGetMaskLength(i32 noundef) #2

declare i64 @Ip4GetNetCast(i32 noundef, ptr noundef) #2

declare i64 @Ip4DelRoute(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !12, i64 0}
!11 = !{!"_IP4_PROTOCOL", !12, i64 0, !13, i64 8, !6, i64 72, !14, i64 80, !6, i64 88, !15, i64 96, !16, i64 112, !16, i64 152, !15, i64 192, !15, i64 208, !17, i64 224, !6, i64 248, !15, i64 256, !6, i64 272, !6, i64 280, !12, i64 288, !6, i64 296, !12, i64 304, !18, i64 308}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_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}
!14 = !{!"long long", !7, i64 0}
!15 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!16 = !{!"", !15, i64 0, !15, i64 16, !14, i64 32}
!17 = !{!"", !14, i64 0, !14, i64 8, !12, i64 16}
!18 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !19, i64 6, !19, i64 10, !7, i64 14, !7, i64 15, !7, i64 16, !7, i64 17, !12, i64 20, !12, i64 24}
!19 = !{!"", !7, i64 0}
!20 = !{!21, !6, i64 24}
!21 = !{!"", !22, 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}
!22 = !{!"", !14, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20}
!23 = !{!14, !14, i64 0}
!24 = !{!11, !14, i64 80}
!25 = !{!11, !7, i64 313}
!26 = !{!11, !6, i64 248}
!27 = !{!28, !7, i64 48}
!28 = !{!"_IP4_INTERFACE", !12, i64 0, !15, i64 8, !14, i64 24, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !7, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !15, i64 96, !15, i64 112, !6, i64 128, !19, i64 136, !19, i64 168, !12, i64 200, !15, i64 208, !7, i64 224}
!29 = !{!12, !12, i64 0}
!30 = !{!28, !12, i64 36}
!31 = !{!28, !12, i64 32}
!32 = !{!11, !6, i64 272}
!33 = !{!21, !6, i64 32}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

; Function Attrs: nounwind uwtable
define dso_local i64 @EfiIp4Routes(ptr noundef %0, i8 noundef zeroext %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #3
  %9 = insertelement <4 x ptr> poison, ptr %0, i64 0
  %10 = insertelement <4 x ptr> %9, ptr %2, i64 1
  %11 = insertelement <4 x ptr> %10, ptr %3, i64 2
  %12 = insertelement <4 x ptr> %11, ptr %4, i64 3
  %13 = icmp eq <4 x ptr> %12, zeroinitializer
  %14 = bitcast <4 x i1> %13 to i4
  %.not45 = icmp eq i4 %14, 0
  br i1 %.not45, label %15, label %76

15:                                               ; preds = %5
  %16 = tail call zeroext i8 @DebugAssertEnabled() #3
  %.not = icmp eq i8 %16, 0
  %.pre = ptrtoint ptr %0 to i64
  %.pre41 = add i64 %.pre, -8
  %.pre43 = inttoptr i64 %.pre41 to ptr
  br i1 %.not, label %._crit_edge, label %17

17:                                               ; preds = %15
  %18 = load i32, ptr %.pre43, align 8, !tbaa !5
  %.not34 = icmp eq i32 %18, 1345605705
  br i1 %.not34, label %._crit_edge, label %19

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

._crit_edge:                                      ; preds = %15, %17, %19
  %20 = phi ptr [ %0, %19 ], [ %.pre43, %17 ], [ %.pre43, %15 ]
  %21 = load ptr, ptr @gBS, align 8, !tbaa !18
  %22 = getelementptr inbounds i8, ptr %21, i64 24
  %23 = load ptr, ptr %22, align 8, !tbaa !19
  %24 = tail call i64 %23(i64 noundef 8) #3
  %25 = getelementptr inbounds i8, ptr %20, i64 80
  %26 = load i64, ptr %25, align 8, !tbaa !22
  %.not35 = icmp eq i64 %26, 1
  br i1 %.not35, label %27, label %72

27:                                               ; preds = %._crit_edge
  %28 = getelementptr inbounds i8, ptr %20, i64 313
  %29 = load i8, ptr %28, align 1, !tbaa !23
  %.not36 = icmp eq i8 %29, 0
  br i1 %.not36, label %35, label %30

30:                                               ; preds = %27
  %31 = getelementptr inbounds i8, ptr %20, i64 248
  %32 = load ptr, ptr %31, align 8, !tbaa !24
  %33 = getelementptr inbounds i8, ptr %32, i64 48
  %34 = load i8, ptr %33, align 8, !tbaa !25
  %.not37 = icmp eq i8 %34, 0
  br i1 %.not37, label %72, label %35

35:                                               ; preds = %30, %27
  %36 = call ptr @CopyMem(ptr noundef nonnull %6, ptr noundef nonnull %2, i64 noundef 4) #3
  %37 = call ptr @CopyMem(ptr noundef nonnull %7, ptr noundef nonnull %3, i64 noundef 4) #3
  %38 = call ptr @CopyMem(ptr noundef nonnull %8, ptr noundef nonnull %4, i64 noundef 4) #3
  %39 = load i32, ptr %6, align 4, !tbaa !27
  %40 = call i32 @SwapBytes32(i32 noundef %39) #3
  store i32 %40, ptr %6, align 4, !tbaa !27
  %41 = load i32, ptr %7, align 4, !tbaa !27
  %42 = call i32 @SwapBytes32(i32 noundef %41) #3
  store i32 %42, ptr %7, align 4, !tbaa !27
  %43 = load i32, ptr %8, align 4, !tbaa !27
  %44 = call i32 @SwapBytes32(i32 noundef %43) #3
  store i32 %44, ptr %8, align 4, !tbaa !27
  %45 = getelementptr inbounds i8, ptr %20, i64 248
  %46 = load ptr, ptr %45, align 8, !tbaa !24
  %47 = load i32, ptr %7, align 4, !tbaa !27
  %48 = call i64 @NetGetMaskLength(i32 noundef %47) #3
  %.not38 = icmp eq i64 %48, 33
  br i1 %.not38, label %72, label %49

49:                                               ; preds = %35
  %50 = load i32, ptr %8, align 4, !tbaa !27
  %.not39 = icmp eq i32 %50, 0
  br i1 %.not39, label %62, label %51

51:                                               ; preds = %49
  %52 = getelementptr inbounds i8, ptr %46, i64 36
  %53 = load i32, ptr %52, align 4, !tbaa !28
  %54 = getelementptr inbounds i8, ptr %46, i64 32
  %55 = load i32, ptr %54, align 8, !tbaa !29
  %56 = xor i32 %55, %50
  %57 = and i32 %56, %53
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %72

59:                                               ; preds = %51
  %60 = call i64 @Ip4GetNetCast(i32 noundef %50, ptr noundef nonnull %46) #3
  %61 = icmp sgt i64 %60, 3
  br i1 %61, label %72, label %62

62:                                               ; preds = %59, %49
  %.not40 = icmp eq i8 %1, 0
  %63 = getelementptr inbounds i8, ptr %20, i64 272
  %64 = load ptr, ptr %63, align 8, !tbaa !30
  %65 = load i32, ptr %6, align 4, !tbaa !27
  %66 = load i32, ptr %7, align 4, !tbaa !27
  %67 = load i32, ptr %8, align 4, !tbaa !27
  br i1 %.not40, label %70, label %68

68:                                               ; preds = %62
  %69 = call i64 @Ip4DelRoute(ptr noundef %64, i32 noundef %65, i32 noundef %66, i32 noundef %67) #3
  br label %72

70:                                               ; preds = %62
  %71 = call i64 @Ip4AddRoute(ptr noundef %64, i32 noundef %65, i32 noundef %66, i32 noundef %67) #3
  br label %72

72:                                               ; preds = %51, %59, %35, %30, %._crit_edge, %68, %70
  %.028 = phi i64 [ %69, %68 ], [ %71, %70 ], [ -9223372036854775789, %._crit_edge ], [ -9223372036854775791, %30 ], [ -9223372036854775806, %35 ], [ -9223372036854775806, %59 ], [ -9223372036854775806, %51 ]
  %73 = load ptr, ptr @gBS, align 8, !tbaa !18
  %74 = getelementptr inbounds i8, ptr %73, i64 32
  %75 = load ptr, ptr %74, align 8, !tbaa !31
  call void %75(i64 noundef %24) #3
  br label %76

76:                                               ; preds = %5, %72
  %.0 = phi i64 [ %.028, %72 ], [ -9223372036854775806, %5 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #3
  ret i64 %.0
}

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #2

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

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

declare i32 @SwapBytes32(i32 noundef) local_unnamed_addr #2

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

declare i64 @Ip4AddRoute(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

declare i64 @NetGetMaskLength(i32 noundef) local_unnamed_addr #2

declare i64 @Ip4GetNetCast(i32 noundef, ptr noundef) local_unnamed_addr #2

declare i64 @Ip4DelRoute(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!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 = !{!11, !11, i64 0}
!19 = !{!20, !11, i64 24}
!20 = !{!"", !21, 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}
!21 = !{!"", !12, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!22 = !{!6, !12, i64 80}
!23 = !{!6, !8, i64 313}
!24 = !{!6, !11, i64 248}
!25 = !{!26, !8, i64 48}
!26 = !{!"_IP4_INTERFACE", !7, i64 0, !13, i64 8, !12, i64 24, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !8, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !13, i64 96, !13, i64 112, !11, i64 128, !17, i64 136, !17, i64 168, !7, i64 200, !13, i64 208, !8, i64 224}
!27 = !{!7, !7, i64 0}
!28 = !{!26, !7, i64 36}
!29 = !{!26, !7, i64 32}
!30 = !{!6, !11, i64 272}
!31 = !{!20, !11, i64 32}


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