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

; 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_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_DRIVER_BINDING_PROTOCOL = type { ptr, ptr, ptr, i32, ptr, ptr }
%struct._IP4_CONFIG_INSTANCE = type { i32, ptr, ptr, ptr, %struct._EFI_IP4_CONFIG_PROTOCOL, %struct._EFI_HII_CONFIG_ACCESS_PROTOCOL, ptr, ptr, ptr, %struct._IP4CONFIG_CALLBACK_INFO, i64, ptr, ptr, ptr, ptr, i64, %struct.NIC_ADDR, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8 }
%struct._EFI_IP4_CONFIG_PROTOCOL = type { ptr, ptr, ptr }
%struct._EFI_HII_CONFIG_ACCESS_PROTOCOL = type { ptr, ptr, ptr }
%struct._IP4CONFIG_CALLBACK_INFO = type { i8, i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%struct.NIC_ADDR = type { i16, i8, %struct.EFI_MAC_ADDRESS }
%struct.EFI_MAC_ADDRESS = type { [32 x i8] }

@gBS = external global ptr, align 8
@gEfiManagedNetworkServiceBindingProtocolGuid = external global %struct.GUID, align 4
@gEfiIp4ConfigProtocolGuid = external global %struct.GUID, align 4
@gEfiManagedNetworkProtocolGuid = external global %struct.GUID, align 4
@gEfiDhcp4ProtocolGuid = external global %struct.GUID, align 4
@.str = external hidden unnamed_addr constant [163 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @Ip4ConfigDriverBindingStop(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) #0 {
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i64 %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  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 8, ptr %13) #3
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = call ptr @NetLibGetNicHandle(ptr noundef %15, ptr noundef @gEfiDhcp4ProtocolGuid)
  store ptr %16, ptr %12, align 8, !tbaa !5
  %17 = load ptr, ptr %12, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %86

19:                                               ; preds = %4
  %20 = load ptr, ptr @gBS, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %20, i32 0, i32 33
  %22 = load ptr, ptr %21, align 8, !tbaa !11
  %23 = load ptr, ptr %12, align 8, !tbaa !5
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._EFI_DRIVER_BINDING_PROTOCOL, ptr %24, i32 0, i32 5
  %26 = load ptr, ptr %25, align 8, !tbaa !15
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = call i64 %22(ptr noundef %23, ptr noundef @gEfiIp4ConfigProtocolGuid, ptr noundef %11, ptr noundef %26, ptr noundef %27, i32 noundef 2)
  store i64 %28, ptr %13, align 8, !tbaa !9
  %29 = load i64, ptr %13, align 8, !tbaa !9
  %30 = icmp slt i64 %29, 0
  br i1 %30, label %31, label %33

31:                                               ; preds = %19
  %32 = load i64, ptr %13, align 8, !tbaa !9
  store i64 %32, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %203

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

37:                                               ; preds = %33
  %38 = load ptr, ptr %11, align 8, !tbaa !5
  %39 = ptrtoint ptr %38 to i64
  %40 = sub i64 %39, ptrtoint (ptr getelementptr inbounds (%struct._IP4_CONFIG_INSTANCE, ptr null, i32 0, i32 4) to i64)
  %41 = inttoptr i64 %40 to ptr
  %42 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %41, i32 0, i32 0
  %43 = load i32, ptr %42, align 8, !tbaa !17
  %44 = icmp ne i32 %43, 1127501897
  br i1 %44, label %45, label %47

45:                                               ; preds = %37
  call void @DebugAssert(ptr noundef @.str, i64 noundef 411, ptr noundef @.str.1)
  %46 = load ptr, ptr %11, align 8, !tbaa !5
  br label %52

47:                                               ; preds = %37, %33
  %48 = load ptr, ptr %11, align 8, !tbaa !5
  %49 = ptrtoint ptr %48 to i64
  %50 = sub i64 %49, ptrtoint (ptr getelementptr inbounds (%struct._IP4_CONFIG_INSTANCE, ptr null, i32 0, i32 4) to i64)
  %51 = inttoptr i64 %50 to ptr
  br label %52

52:                                               ; preds = %47, %45
  %53 = phi ptr [ %46, %45 ], [ %51, %47 ]
  store ptr %53, ptr %10, align 8, !tbaa !5
  br label %54

54:                                               ; preds = %52
  %55 = call zeroext i8 @DebugAssertEnabled()
  %56 = icmp ne i8 %55, 0
  br i1 %56, label %57, label %65

57:                                               ; preds = %54
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %59, i32 0, i32 20
  %61 = load ptr, ptr %60, align 8, !tbaa !25
  %62 = icmp eq ptr %58, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %57
  call void @DebugAssert(ptr noundef @.str, i64 noundef 412, ptr noundef @.str.2)
  br label %64

64:                                               ; preds = %63, %57
  br label %65

65:                                               ; preds = %64, %54
  br label %66

66:                                               ; preds = %65
  br label %67

67:                                               ; preds = %66
  %68 = load ptr, ptr %10, align 8, !tbaa !5
  call void @Ip4ConfigCleanDhcp4(ptr noundef %68)
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %69, i32 0, i32 10
  store i64 2, ptr %70, align 8, !tbaa !26
  %71 = load ptr, ptr %10, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %71, i32 0, i32 15
  store i64 -9223372036854775801, ptr %72, align 8, !tbaa !27
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %73, i32 0, i32 13
  %75 = load ptr, ptr %74, align 8, !tbaa !28
  %76 = icmp ne ptr %75, null
  br i1 %76, label %77, label %85

77:                                               ; preds = %67
  %78 = load ptr, ptr @gBS, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %78, i32 0, i32 11
  %80 = load ptr, ptr %79, align 8, !tbaa !29
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %81, i32 0, i32 13
  %83 = load ptr, ptr %82, align 8, !tbaa !28
  %84 = call i64 %80(ptr noundef %83)
  br label %85

85:                                               ; preds = %77, %67
  store i64 0, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %203

86:                                               ; preds = %4
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = call ptr @NetLibGetNicHandle(ptr noundef %87, ptr noundef @gEfiManagedNetworkProtocolGuid)
  store ptr %88, ptr %12, align 8, !tbaa !5
  %89 = load ptr, ptr %12, align 8, !tbaa !5
  %90 = icmp eq ptr %89, null
  br i1 %90, label %91, label %92

91:                                               ; preds = %86
  store i64 0, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %203

92:                                               ; preds = %86
  %93 = load ptr, ptr @gBS, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %93, i32 0, i32 33
  %95 = load ptr, ptr %94, align 8, !tbaa !11
  %96 = load ptr, ptr %12, align 8, !tbaa !5
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct._EFI_DRIVER_BINDING_PROTOCOL, ptr %97, i32 0, i32 5
  %99 = load ptr, ptr %98, align 8, !tbaa !15
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = call i64 %95(ptr noundef %96, ptr noundef @gEfiIp4ConfigProtocolGuid, ptr noundef %11, ptr noundef %99, ptr noundef %100, i32 noundef 2)
  store i64 %101, ptr %13, align 8, !tbaa !9
  %102 = load i64, ptr %13, align 8, !tbaa !9
  %103 = icmp slt i64 %102, 0
  br i1 %103, label %104, label %106

104:                                              ; preds = %92
  %105 = load i64, ptr %13, align 8, !tbaa !9
  store i64 %105, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %203

106:                                              ; preds = %92
  %107 = call zeroext i8 @DebugAssertEnabled()
  %108 = zext i8 %107 to i32
  %109 = icmp ne i32 %108, 0
  br i1 %109, label %110, label %120

110:                                              ; preds = %106
  %111 = load ptr, ptr %11, align 8, !tbaa !5
  %112 = ptrtoint ptr %111 to i64
  %113 = sub i64 %112, ptrtoint (ptr getelementptr inbounds (%struct._IP4_CONFIG_INSTANCE, ptr null, i32 0, i32 4) to i64)
  %114 = inttoptr i64 %113 to ptr
  %115 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %114, i32 0, i32 0
  %116 = load i32, ptr %115, align 8, !tbaa !17
  %117 = icmp ne i32 %116, 1127501897
  br i1 %117, label %118, label %120

118:                                              ; preds = %110
  call void @DebugAssert(ptr noundef @.str, i64 noundef 451, ptr noundef @.str.1)
  %119 = load ptr, ptr %11, align 8, !tbaa !5
  br label %125

120:                                              ; preds = %110, %106
  %121 = load ptr, ptr %11, align 8, !tbaa !5
  %122 = ptrtoint ptr %121 to i64
  %123 = sub i64 %122, ptrtoint (ptr getelementptr inbounds (%struct._IP4_CONFIG_INSTANCE, ptr null, i32 0, i32 4) to i64)
  %124 = inttoptr i64 %123 to ptr
  br label %125

125:                                              ; preds = %120, %118
  %126 = phi ptr [ %119, %118 ], [ %124, %120 ]
  store ptr %126, ptr %10, align 8, !tbaa !5
  %127 = load ptr, ptr %10, align 8, !tbaa !5
  %128 = call i64 @Ip4ConfigDeviceUnload(ptr noundef %127)
  %129 = load ptr, ptr @gBS, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %129, i32 0, i32 40
  %131 = load ptr, ptr %130, align 8, !tbaa !30
  %132 = load ptr, ptr %12, align 8, !tbaa !5
  %133 = load ptr, ptr %10, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %133, i32 0, i32 4
  %135 = call i64 (ptr, ...) %131(ptr noundef %132, ptr noundef @gEfiIp4ConfigProtocolGuid, ptr noundef %134, ptr noundef null)
  store i64 %135, ptr %13, align 8, !tbaa !9
  %136 = load i64, ptr %13, align 8, !tbaa !9
  %137 = icmp slt i64 %136, 0
  br i1 %137, label %138, label %140

138:                                              ; preds = %125
  %139 = load i64, ptr %13, align 8, !tbaa !9
  store i64 %139, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %203

140:                                              ; preds = %125
  %141 = load ptr, ptr %10, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %141, i32 0, i32 12
  %143 = load ptr, ptr %142, align 8, !tbaa !31
  %144 = icmp ne ptr %143, null
  br i1 %144, label %145, label %169

145:                                              ; preds = %140
  %146 = load ptr, ptr @gBS, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %146, i32 0, i32 34
  %148 = load ptr, ptr %147, align 8, !tbaa !32
  %149 = load ptr, ptr %10, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %149, i32 0, i32 12
  %151 = load ptr, ptr %150, align 8, !tbaa !31
  %152 = load ptr, ptr %6, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct._EFI_DRIVER_BINDING_PROTOCOL, ptr %152, i32 0, i32 5
  %154 = load ptr, ptr %153, align 8, !tbaa !15
  %155 = load ptr, ptr %12, align 8, !tbaa !5
  %156 = call i64 %148(ptr noundef %151, ptr noundef @gEfiManagedNetworkProtocolGuid, ptr noundef %154, ptr noundef %155)
  %157 = load ptr, ptr %12, align 8, !tbaa !5
  %158 = load ptr, ptr %10, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %158, i32 0, i32 2
  %160 = load ptr, ptr %159, align 8, !tbaa !33
  %161 = load ptr, ptr %10, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %161, i32 0, i32 12
  %163 = load ptr, ptr %162, align 8, !tbaa !31
  %164 = call i64 @NetLibDestroyServiceChild(ptr noundef %157, ptr noundef %160, ptr noundef @gEfiManagedNetworkServiceBindingProtocolGuid, ptr noundef %163)
  %165 = load ptr, ptr %10, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %165, i32 0, i32 11
  store ptr null, ptr %166, align 8, !tbaa !34
  %167 = load ptr, ptr %10, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %167, i32 0, i32 12
  store ptr null, ptr %168, align 8, !tbaa !31
  br label %169

169:                                              ; preds = %145, %140
  %170 = load ptr, ptr %10, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %170, i32 0, i32 17
  %172 = load ptr, ptr %171, align 8, !tbaa !35
  %173 = icmp ne ptr %172, null
  br i1 %173, label %174, label %178

174:                                              ; preds = %169
  %175 = load ptr, ptr %10, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %175, i32 0, i32 17
  %177 = load ptr, ptr %176, align 8, !tbaa !35
  call void @FreePool(ptr noundef %177)
  br label %178

178:                                              ; preds = %174, %169
  %179 = load ptr, ptr %10, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %179, i32 0, i32 22
  %181 = load ptr, ptr %180, align 8, !tbaa !36
  %182 = icmp ne ptr %181, null
  br i1 %182, label %183, label %200

183:                                              ; preds = %178
  %184 = load ptr, ptr @gBS, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %184, i32 0, i32 9
  %186 = load ptr, ptr %185, align 8, !tbaa !37
  %187 = load ptr, ptr %10, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %187, i32 0, i32 22
  %189 = load ptr, ptr %188, align 8, !tbaa !36
  %190 = call i64 %186(ptr noundef %189, i32 noundef 0, i64 noundef 0)
  %191 = load ptr, ptr @gBS, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %191, i32 0, i32 12
  %193 = load ptr, ptr %192, align 8, !tbaa !38
  %194 = load ptr, ptr %10, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %194, i32 0, i32 22
  %196 = load ptr, ptr %195, align 8, !tbaa !36
  %197 = call i64 %193(ptr noundef %196)
  %198 = load ptr, ptr %10, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct._IP4_CONFIG_INSTANCE, ptr %198, i32 0, i32 22
  store ptr null, ptr %199, align 8, !tbaa !36
  br label %200

200:                                              ; preds = %183, %178
  %201 = load ptr, ptr %10, align 8, !tbaa !5
  call void @Ip4ConfigCleanConfig(ptr noundef %201)
  %202 = load ptr, ptr %10, align 8, !tbaa !5
  call void @FreePool(ptr noundef %202)
  store i64 0, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %203

203:                                              ; preds = %200, %138, %104, %91, %85, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %204 = load i64, ptr %5, align 8
  ret i64 %204
}

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

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

declare void @FreePool(ptr noundef) #2

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

declare ptr @NetLibGetNicHandle(ptr noundef, ptr noundef) #2

declare zeroext i8 @DebugAssertEnabled() #2

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

declare void @Ip4ConfigCleanDhcp4(ptr noundef) #2

declare i64 @Ip4ConfigDeviceUnload(ptr noundef) #2

declare void @Ip4ConfigCleanConfig(ptr 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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !6, i64 280}
!12 = !{!"", !13, 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}
!13 = !{!"", !10, i64 0, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !6, i64 40}
!16 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !6, i64 32, !6, i64 40}
!17 = !{!18, !14, i64 0}
!18 = !{!"_IP4_CONFIG_INSTANCE", !14, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !19, i64 32, !20, i64 56, !6, i64 80, !6, i64 88, !6, i64 96, !21, i64 104, !10, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !10, i64 160, !23, i64 168, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !7, i64 256, !7, i64 257}
!19 = !{!"_EFI_IP4_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!"_EFI_HII_CONFIG_ACCESS_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = !{!"_IP4CONFIG_CALLBACK_INFO", !7, i64 0, !7, i64 1, !22, i64 2, !22, i64 6, !22, i64 10}
!22 = !{!"", !7, i64 0}
!23 = !{!"", !24, i64 0, !7, i64 2, !22, i64 3}
!24 = !{!"short", !7, i64 0}
!25 = !{!18, !6, i64 232}
!26 = !{!18, !10, i64 120}
!27 = !{!18, !10, i64 160}
!28 = !{!18, !6, i64 144}
!29 = !{!12, !6, i64 104}
!30 = !{!12, !6, i64 336}
!31 = !{!18, !6, i64 136}
!32 = !{!12, !6, i64 288}
!33 = !{!18, !6, i64 16}
!34 = !{!18, !6, i64 128}
!35 = !{!18, !6, i64 208}
!36 = !{!18, !6, i64 248}
!37 = !{!12, !6, i64 88}
!38 = !{!12, !6, i64 112}


; 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] }

@gBS = external local_unnamed_addr global ptr, align 8
@gEfiManagedNetworkServiceBindingProtocolGuid = external global %struct.GUID, align 4
@gEfiIp4ConfigProtocolGuid = external global %struct.GUID, align 4
@gEfiManagedNetworkProtocolGuid = external global %struct.GUID, align 4
@gEfiDhcp4ProtocolGuid = external global %struct.GUID, align 4
@.str = external hidden unnamed_addr constant [163 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775808, 1) i64 @Ip4ConfigDriverBindingStop(ptr nocapture noundef readonly %0, ptr noundef %1, i64 noundef %2, ptr nocapture noundef readnone %3) local_unnamed_addr #0 {
  %5 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %6 = tail call ptr @NetLibGetNicHandle(ptr noundef %1, ptr noundef nonnull @gEfiDhcp4ProtocolGuid) #4
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %38, label %7

7:                                                ; preds = %4
  %8 = load ptr, ptr @gBS, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %8, i64 280
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = load ptr, ptr %11, align 8, !tbaa !14
  %13 = call i64 %10(ptr noundef nonnull %6, ptr noundef nonnull @gEfiIp4ConfigProtocolGuid, ptr noundef nonnull %5, ptr noundef %12, ptr noundef %1, i32 noundef 2) #4
  %14 = icmp slt i64 %13, 0
  br i1 %14, label %95, label %15

15:                                               ; preds = %7
  %16 = call zeroext i8 @DebugAssertEnabled() #4
  %.not57 = icmp eq i8 %16, 0
  %.pre = load ptr, ptr %5, align 8, !tbaa !5
  %.pre68 = ptrtoint ptr %.pre to i64
  %.pre70 = add i64 %.pre68, -32
  %.pre72 = inttoptr i64 %.pre70 to ptr
  br i1 %.not57, label %._crit_edge, label %17

17:                                               ; preds = %15
  %18 = load i32, ptr %.pre72, align 8, !tbaa !16
  %.not58 = icmp eq i32 %18, 1127501897
  br i1 %.not58, label %._crit_edge, label %19

19:                                               ; preds = %17
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 411, ptr noundef nonnull @.str.1) #4
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %15, %17, %19
  %21 = phi ptr [ %20, %19 ], [ %.pre72, %17 ], [ %.pre72, %15 ]
  %22 = call zeroext i8 @DebugAssertEnabled() #4
  %.not59 = icmp eq i8 %22, 0
  br i1 %.not59, label %28, label %23

23:                                               ; preds = %._crit_edge
  %24 = getelementptr inbounds i8, ptr %21, i64 232
  %25 = load ptr, ptr %24, align 8, !tbaa !24
  %26 = icmp eq ptr %25, %1
  br i1 %26, label %28, label %27

27:                                               ; preds = %23
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 412, ptr noundef nonnull @.str.2) #4
  br label %28

28:                                               ; preds = %23, %27, %._crit_edge
  call void @Ip4ConfigCleanDhcp4(ptr noundef %21) #4
  %29 = getelementptr inbounds i8, ptr %21, i64 120
  store i64 2, ptr %29, align 8, !tbaa !25
  %30 = getelementptr inbounds i8, ptr %21, i64 160
  store i64 -9223372036854775801, ptr %30, align 8, !tbaa !26
  %31 = getelementptr inbounds i8, ptr %21, i64 144
  %32 = load ptr, ptr %31, align 8, !tbaa !27
  %.not60 = icmp eq ptr %32, null
  br i1 %.not60, label %95, label %33

33:                                               ; preds = %28
  %34 = load ptr, ptr @gBS, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %34, i64 104
  %36 = load ptr, ptr %35, align 8, !tbaa !28
  %37 = call i64 %36(ptr noundef nonnull %32) #4
  br label %95

38:                                               ; preds = %4
  %39 = tail call ptr @NetLibGetNicHandle(ptr noundef %1, ptr noundef nonnull @gEfiManagedNetworkProtocolGuid) #4
  %40 = icmp eq ptr %39, null
  br i1 %40, label %95, label %41

41:                                               ; preds = %38
  %42 = load ptr, ptr @gBS, align 8, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %42, i64 280
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  %45 = getelementptr inbounds i8, ptr %0, i64 40
  %46 = load ptr, ptr %45, align 8, !tbaa !14
  %47 = call i64 %44(ptr noundef nonnull %39, ptr noundef nonnull @gEfiIp4ConfigProtocolGuid, ptr noundef nonnull %5, ptr noundef %46, ptr noundef %1, i32 noundef 2) #4
  %48 = icmp slt i64 %47, 0
  br i1 %48, label %95, label %49

49:                                               ; preds = %41
  %50 = call zeroext i8 @DebugAssertEnabled() #4
  %.not52 = icmp eq i8 %50, 0
  %.pre61 = load ptr, ptr %5, align 8, !tbaa !5
  %.pre63 = ptrtoint ptr %.pre61 to i64
  %.pre64 = add i64 %.pre63, -32
  %.pre66 = inttoptr i64 %.pre64 to ptr
  br i1 %.not52, label %._crit_edge62, label %51

51:                                               ; preds = %49
  %52 = load i32, ptr %.pre66, align 8, !tbaa !16
  %.not53 = icmp eq i32 %52, 1127501897
  br i1 %.not53, label %._crit_edge62, label %53

53:                                               ; preds = %51
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 451, ptr noundef nonnull @.str.1) #4
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  br label %._crit_edge62

._crit_edge62:                                    ; preds = %49, %51, %53
  %55 = phi ptr [ %54, %53 ], [ %.pre66, %51 ], [ %.pre66, %49 ]
  %56 = call i64 @Ip4ConfigDeviceUnload(ptr noundef %55) #4
  %57 = load ptr, ptr @gBS, align 8, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %57, i64 336
  %59 = load ptr, ptr %58, align 8, !tbaa !29
  %60 = getelementptr inbounds i8, ptr %55, i64 32
  %61 = call i64 (ptr, ...) %59(ptr noundef nonnull %39, ptr noundef nonnull @gEfiIp4ConfigProtocolGuid, ptr noundef nonnull %60, ptr noundef null) #4
  %62 = icmp slt i64 %61, 0
  br i1 %62, label %95, label %63

63:                                               ; preds = %._crit_edge62
  %64 = getelementptr inbounds i8, ptr %55, i64 136
  %65 = load ptr, ptr %64, align 8, !tbaa !30
  %.not54 = icmp eq ptr %65, null
  br i1 %.not54, label %77, label %66

66:                                               ; preds = %63
  %67 = load ptr, ptr @gBS, align 8, !tbaa !5
  %68 = getelementptr inbounds i8, ptr %67, i64 288
  %69 = load ptr, ptr %68, align 8, !tbaa !31
  %70 = load ptr, ptr %45, align 8, !tbaa !14
  %71 = call i64 %69(ptr noundef nonnull %65, ptr noundef nonnull @gEfiManagedNetworkProtocolGuid, ptr noundef %70, ptr noundef nonnull %39) #4
  %72 = getelementptr inbounds i8, ptr %55, i64 16
  %73 = load ptr, ptr %72, align 8, !tbaa !32
  %74 = load ptr, ptr %64, align 8, !tbaa !30
  %75 = call i64 @NetLibDestroyServiceChild(ptr noundef nonnull %39, ptr noundef %73, ptr noundef nonnull @gEfiManagedNetworkServiceBindingProtocolGuid, ptr noundef %74) #4
  %76 = getelementptr inbounds i8, ptr %55, i64 128
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %76, i8 0, i64 16, i1 false)
  br label %77

77:                                               ; preds = %66, %63
  %78 = getelementptr inbounds i8, ptr %55, i64 208
  %79 = load ptr, ptr %78, align 8, !tbaa !33
  %.not55 = icmp eq ptr %79, null
  br i1 %.not55, label %81, label %80

80:                                               ; preds = %77
  call void @FreePool(ptr noundef nonnull %79) #4
  br label %81

81:                                               ; preds = %80, %77
  %82 = getelementptr inbounds i8, ptr %55, i64 248
  %83 = load ptr, ptr %82, align 8, !tbaa !34
  %.not56 = icmp eq ptr %83, null
  br i1 %.not56, label %94, label %84

84:                                               ; preds = %81
  %85 = load ptr, ptr @gBS, align 8, !tbaa !5
  %86 = getelementptr inbounds i8, ptr %85, i64 88
  %87 = load ptr, ptr %86, align 8, !tbaa !35
  %88 = call i64 %87(ptr noundef nonnull %83, i32 noundef 0, i64 noundef 0) #4
  %89 = load ptr, ptr @gBS, align 8, !tbaa !5
  %90 = getelementptr inbounds i8, ptr %89, i64 112
  %91 = load ptr, ptr %90, align 8, !tbaa !36
  %92 = load ptr, ptr %82, align 8, !tbaa !34
  %93 = call i64 %91(ptr noundef %92) #4
  store ptr null, ptr %82, align 8, !tbaa !34
  br label %94

94:                                               ; preds = %84, %81
  call void @Ip4ConfigCleanConfig(ptr noundef nonnull %55) #4
  call void @FreePool(ptr noundef nonnull %55) #4
  br label %95

95:                                               ; preds = %._crit_edge62, %41, %38, %28, %33, %7, %94
  %.0 = phi i64 [ 0, %94 ], [ %13, %7 ], [ 0, %33 ], [ 0, %28 ], [ 0, %38 ], [ %47, %41 ], [ %61, %._crit_edge62 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  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

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

declare void @FreePool(ptr noundef) local_unnamed_addr #2

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

declare ptr @NetLibGetNicHandle(ptr noundef, ptr noundef) local_unnamed_addr #2

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #2

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

declare void @Ip4ConfigCleanDhcp4(ptr noundef) local_unnamed_addr #2

declare i64 @Ip4ConfigDeviceUnload(ptr noundef) local_unnamed_addr #2

declare void @Ip4ConfigCleanConfig(ptr noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 280}
!10 = !{!"", !11, 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}
!11 = !{!"", !12, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 40}
!15 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !6, i64 32, !6, i64 40}
!16 = !{!17, !13, i64 0}
!17 = !{!"_IP4_CONFIG_INSTANCE", !13, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !18, i64 32, !19, i64 56, !6, i64 80, !6, i64 88, !6, i64 96, !20, i64 104, !12, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !12, i64 160, !22, i64 168, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !7, i64 256, !7, i64 257}
!18 = !{!"_EFI_IP4_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"_EFI_HII_CONFIG_ACCESS_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!"_IP4CONFIG_CALLBACK_INFO", !7, i64 0, !7, i64 1, !21, i64 2, !21, i64 6, !21, i64 10}
!21 = !{!"", !7, i64 0}
!22 = !{!"", !23, i64 0, !7, i64 2, !21, i64 3}
!23 = !{!"short", !7, i64 0}
!24 = !{!17, !6, i64 232}
!25 = !{!17, !12, i64 120}
!26 = !{!17, !12, i64 160}
!27 = !{!17, !6, i64 144}
!28 = !{!10, !6, i64 104}
!29 = !{!10, !6, i64 336}
!30 = !{!17, !6, i64 136}
!31 = !{!10, !6, i64 288}
!32 = !{!17, !6, i64 16}
!33 = !{!17, !6, i64 208}
!34 = !{!17, !6, i64 248}
!35 = !{!10, !6, i64 88}
!36 = !{!10, !6, i64 112}


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