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

; 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._MTFTP4_PROTOCOL = type { i32, %struct._LIST_ENTRY, %struct._EFI_MTFTP4_PROTOCOL, i64, i8, ptr, ptr, %struct.EFI_MTFTP4_CONFIG_DATA, ptr, %struct.MTFTP4_OPTION, i16, i16, i16, %struct._LIST_ENTRY, i32, i16, i16, i32, ptr, ptr, i32, i32, i32, i32, i32, i16, i8, ptr }
%struct._EFI_MTFTP4_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_MTFTP4_CONFIG_DATA = type { i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16, i16, i16 }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%struct.MTFTP4_OPTION = type { i16, i8, i32, i32, i16, i8, i32 }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct.UDP_END_POINT = type { %union.EFI_IP_ADDRESS, i16, %union.EFI_IP_ADDRESS, i16 }
%union.EFI_IP_ADDRESS = type { [4 x i32] }
%struct.NET_BUF = type { i32, i64, %struct._LIST_ENTRY, %union.NET_IP_HEAD, ptr, ptr, [64 x i8], ptr, i32, i32, [1 x %struct.NET_BLOCK_OP] }
%union.NET_IP_HEAD = type { ptr }
%struct.NET_BLOCK_OP = type { ptr, ptr, ptr, ptr, i32 }
%struct._EFI_MTFTP4_TOKEN = type { i64, ptr, ptr, ptr, ptr, i32, ptr, i64, ptr, ptr, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [154 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [115 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [26 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 i64 @UdpIoRecvDatagram(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @Mtftp4RrqInput(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i8, align 1
  %12 = alloca i8, align 1
  %13 = alloca i64, align 8
  %14 = alloca i16, align 2
  %15 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %16, ptr %9, align 8, !tbaa !5
  br label %17

17:                                               ; preds = %4
  %18 = call zeroext i8 @DebugAssertEnabled()
  %19 = icmp ne i8 %18, 0
  br i1 %19, label %20, label %30

20:                                               ; preds = %17
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %28

23:                                               ; preds = %20
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %24, i32 0, i32 0
  %26 = load i32, ptr %25, align 8, !tbaa !11
  %27 = icmp eq i32 %26, 1886676596
  br i1 %27, label %29, label %28

28:                                               ; preds = %23, %20
  call void @DebugAssert(ptr noundef @.str, i64 noundef 653, ptr noundef @.str.9)
  br label %29

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

30:                                               ; preds = %29, %17
  br label %31

31:                                               ; preds = %30
  br label %32

32:                                               ; preds = %31
  store i64 0, ptr %13, align 8, !tbaa !9
  store ptr null, ptr %10, align 8, !tbaa !5
  store i8 0, ptr %11, align 1, !tbaa !20
  store i8 0, ptr %12, align 1, !tbaa !20
  %33 = load i64, ptr %7, align 8, !tbaa !9
  %34 = icmp slt i64 %33, 0
  br i1 %34, label %35, label %37

35:                                               ; preds = %32
  %36 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %36, ptr %13, align 8, !tbaa !9
  br label %204

37:                                               ; preds = %32
  br label %38

38:                                               ; preds = %37
  %39 = call zeroext i8 @DebugAssertEnabled()
  %40 = icmp ne i8 %39, 0
  br i1 %40, label %41, label %46

41:                                               ; preds = %38
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = icmp ne ptr %42, null
  br i1 %43, label %45, label %44

44:                                               ; preds = %41
  call void @DebugAssert(ptr noundef @.str, i64 noundef 665, ptr noundef @.str.10)
  br label %45

45:                                               ; preds = %44, %41
  br label %46

46:                                               ; preds = %45, %38
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.UDP_END_POINT, ptr %49, i32 0, i32 0
  %51 = getelementptr inbounds [4 x i32], ptr %50, i64 0, i64 0
  %52 = load i32, ptr %51, align 4, !tbaa !20
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %53, i32 0, i32 24
  %55 = load i32, ptr %54, align 8, !tbaa !21
  %56 = icmp eq i32 %52, %55
  %57 = zext i1 %56 to i32
  %58 = trunc i32 %57 to i8
  store i8 %58, ptr %12, align 1, !tbaa !20
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.NET_BUF, ptr %59, i32 0, i32 9
  %61 = load i32, ptr %60, align 4, !tbaa !22
  %62 = icmp ult i32 %61, 2
  br i1 %62, label %63, label %64

63:                                               ; preds = %48
  br label %204

64:                                               ; preds = %48
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.UDP_END_POINT, ptr %65, i32 0, i32 3
  %67 = load i16, ptr %66, align 4, !tbaa !24
  %68 = zext i16 %67 to i32
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %69, i32 0, i32 16
  %71 = load i16, ptr %70, align 2, !tbaa !26
  %72 = zext i16 %71 to i32
  %73 = icmp ne i32 %68, %72
  br i1 %73, label %74, label %88

74:                                               ; preds = %64
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %75, i32 0, i32 16
  %77 = load i16, ptr %76, align 2, !tbaa !26
  %78 = zext i16 %77 to i32
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %81

80:                                               ; preds = %74
  br label %204

81:                                               ; preds = %74
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.UDP_END_POINT, ptr %82, i32 0, i32 3
  %84 = load i16, ptr %83, align 4, !tbaa !24
  %85 = load ptr, ptr %9, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %85, i32 0, i32 16
  store i16 %84, ptr %86, align 2, !tbaa !26
  br label %87

87:                                               ; preds = %81
  br label %88

88:                                               ; preds = %87, %64
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.NET_BUF, ptr %89, i32 0, i32 9
  %91 = load i32, ptr %90, align 4, !tbaa !22
  store i32 %91, ptr %15, align 4, !tbaa !27
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.NET_BUF, ptr %92, i32 0, i32 8
  %94 = load i32, ptr %93, align 8, !tbaa !28
  %95 = icmp ugt i32 %94, 1
  br i1 %95, label %96, label %108

96:                                               ; preds = %88
  %97 = load i32, ptr %15, align 4, !tbaa !27
  %98 = zext i32 %97 to i64
  %99 = call ptr @AllocatePool(i64 noundef %98)
  store ptr %99, ptr %10, align 8, !tbaa !5
  %100 = load ptr, ptr %10, align 8, !tbaa !5
  %101 = icmp eq ptr %100, null
  br i1 %101, label %102, label %103

102:                                              ; preds = %96
  store i64 -9223372036854775799, ptr %13, align 8, !tbaa !9
  br label %204

103:                                              ; preds = %96
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = load i32, ptr %15, align 4, !tbaa !27
  %106 = load ptr, ptr %10, align 8, !tbaa !5
  %107 = call i32 @NetbufCopy(ptr noundef %104, i32 noundef 0, i32 noundef %105, ptr noundef %106)
  br label %122

108:                                              ; preds = %88
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = call ptr @NetbufGetByte(ptr noundef %109, i32 noundef 0, ptr noundef null)
  store ptr %110, ptr %10, align 8, !tbaa !5
  br label %111

111:                                              ; preds = %108
  %112 = call zeroext i8 @DebugAssertEnabled()
  %113 = icmp ne i8 %112, 0
  br i1 %113, label %114, label %119

114:                                              ; preds = %111
  %115 = load ptr, ptr %10, align 8, !tbaa !5
  %116 = icmp ne ptr %115, null
  br i1 %116, label %118, label %117

117:                                              ; preds = %114
  call void @DebugAssert(ptr noundef @.str, i64 noundef 707, ptr noundef @.str.11)
  br label %118

118:                                              ; preds = %117, %114
  br label %119

119:                                              ; preds = %118, %111
  br label %120

120:                                              ; preds = %119
  br label %121

121:                                              ; preds = %120
  br label %122

122:                                              ; preds = %121, %103
  %123 = load ptr, ptr %10, align 8, !tbaa !5
  %124 = load i16, ptr %123, align 1, !tbaa !20
  %125 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %124)
  store i16 %125, ptr %14, align 2, !tbaa !29
  %126 = load ptr, ptr %9, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %126, i32 0, i32 8
  %128 = load ptr, ptr %127, align 8, !tbaa !30
  %129 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %128, i32 0, i32 10
  %130 = load ptr, ptr %129, align 8, !tbaa !31
  %131 = icmp ne ptr %130, null
  br i1 %131, label %132, label %166

132:                                              ; preds = %122
  %133 = load i16, ptr %14, align 2, !tbaa !29
  %134 = zext i16 %133 to i32
  %135 = icmp eq i32 %134, 6
  br i1 %135, label %140, label %136

136:                                              ; preds = %132
  %137 = load i16, ptr %14, align 2, !tbaa !29
  %138 = zext i16 %137 to i32
  %139 = icmp eq i32 %138, 5
  br i1 %139, label %140, label %166

140:                                              ; preds = %136, %132
  %141 = load ptr, ptr %9, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %141, i32 0, i32 8
  %143 = load ptr, ptr %142, align 8, !tbaa !30
  %144 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %143, i32 0, i32 10
  %145 = load ptr, ptr %144, align 8, !tbaa !31
  %146 = load ptr, ptr %9, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %146, i32 0, i32 2
  %148 = load ptr, ptr %9, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %148, i32 0, i32 8
  %150 = load ptr, ptr %149, align 8, !tbaa !30
  %151 = load i32, ptr %15, align 4, !tbaa !27
  %152 = trunc i32 %151 to i16
  %153 = load ptr, ptr %10, align 8, !tbaa !5
  %154 = call i64 %145(ptr noundef %147, ptr noundef %150, i16 noundef zeroext %152, ptr noundef %153)
  store i64 %154, ptr %13, align 8, !tbaa !9
  %155 = load i64, ptr %13, align 8, !tbaa !9
  %156 = icmp slt i64 %155, 0
  br i1 %156, label %157, label %165

157:                                              ; preds = %140
  %158 = load i16, ptr %14, align 2, !tbaa !29
  %159 = zext i16 %158 to i32
  %160 = icmp ne i32 %159, 5
  br i1 %160, label %161, label %164

161:                                              ; preds = %157
  %162 = load ptr, ptr %9, align 8, !tbaa !5
  %163 = call i64 @Mtftp4SendError(ptr noundef %162, i16 noundef zeroext 8, ptr noundef @.str.12)
  br label %164

164:                                              ; preds = %161, %157
  store i64 -9223372036854775787, ptr %13, align 8, !tbaa !9
  br label %204

165:                                              ; preds = %140
  br label %166

166:                                              ; preds = %165, %136, %122
  %167 = load i16, ptr %14, align 2, !tbaa !29
  %168 = zext i16 %167 to i32
  switch i32 %168, label %202 [
    i32 3, label %169
    i32 6, label %187
    i32 5, label %201
  ]

169:                                              ; preds = %166
  %170 = load i32, ptr %15, align 4, !tbaa !27
  %171 = load ptr, ptr %9, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %171, i32 0, i32 11
  %173 = load i16, ptr %172, align 2, !tbaa !33
  %174 = zext i16 %173 to i32
  %175 = add nsw i32 4, %174
  %176 = icmp ugt i32 %170, %175
  br i1 %176, label %180, label %177

177:                                              ; preds = %169
  %178 = load i32, ptr %15, align 4, !tbaa !27
  %179 = icmp ult i32 %178, 4
  br i1 %179, label %180, label %181

180:                                              ; preds = %177, %169
  br label %204

181:                                              ; preds = %177
  %182 = load ptr, ptr %9, align 8, !tbaa !5
  %183 = load ptr, ptr %10, align 8, !tbaa !5
  %184 = load i32, ptr %15, align 4, !tbaa !27
  %185 = load i8, ptr %12, align 1, !tbaa !20
  %186 = call i64 @Mtftp4RrqHandleData(ptr noundef %182, ptr noundef %183, i32 noundef %184, i8 noundef zeroext %185, ptr noundef %11)
  store i64 %186, ptr %13, align 8, !tbaa !9
  br label %203

187:                                              ; preds = %166
  %188 = load i8, ptr %12, align 1, !tbaa !20
  %189 = zext i8 %188 to i32
  %190 = icmp ne i32 %189, 0
  br i1 %190, label %194, label %191

191:                                              ; preds = %187
  %192 = load i32, ptr %15, align 4, !tbaa !27
  %193 = icmp ule i32 %192, 2
  br i1 %193, label %194, label %195

194:                                              ; preds = %191, %187
  br label %204

195:                                              ; preds = %191
  %196 = load ptr, ptr %9, align 8, !tbaa !5
  %197 = load ptr, ptr %10, align 8, !tbaa !5
  %198 = load i32, ptr %15, align 4, !tbaa !27
  %199 = load i8, ptr %12, align 1, !tbaa !20
  %200 = call i64 @Mtftp4RrqHandleOack(ptr noundef %196, ptr noundef %197, i32 noundef %198, i8 noundef zeroext %199, ptr noundef %11)
  store i64 %200, ptr %13, align 8, !tbaa !9
  br label %203

201:                                              ; preds = %166
  store i64 -9223372036854775785, ptr %13, align 8, !tbaa !9
  br label %203

202:                                              ; preds = %166
  br label %203

203:                                              ; preds = %202, %201, %195, %181
  br label %204

204:                                              ; preds = %203, %194, %180, %164, %102, %80, %63, %35
  %205 = load ptr, ptr %10, align 8, !tbaa !5
  %206 = icmp ne ptr %205, null
  br i1 %206, label %207, label %214

207:                                              ; preds = %204
  %208 = load ptr, ptr %5, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.NET_BUF, ptr %208, i32 0, i32 8
  %210 = load i32, ptr %209, align 8, !tbaa !28
  %211 = icmp ugt i32 %210, 1
  br i1 %211, label %212, label %214

212:                                              ; preds = %207
  %213 = load ptr, ptr %10, align 8, !tbaa !5
  call void @FreePool(ptr noundef %213)
  br label %214

214:                                              ; preds = %212, %207, %204
  %215 = load ptr, ptr %5, align 8, !tbaa !5
  %216 = icmp ne ptr %215, null
  br i1 %216, label %217, label %219

217:                                              ; preds = %214
  %218 = load ptr, ptr %5, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %218)
  br label %219

219:                                              ; preds = %217, %214
  %220 = load i64, ptr %13, align 8, !tbaa !9
  %221 = icmp slt i64 %220, 0
  br i1 %221, label %241, label %222

222:                                              ; preds = %219
  %223 = load i8, ptr %11, align 1, !tbaa !20
  %224 = icmp ne i8 %223, 0
  br i1 %224, label %241, label %225

225:                                              ; preds = %222
  %226 = load i8, ptr %12, align 1, !tbaa !20
  %227 = icmp ne i8 %226, 0
  br i1 %227, label %228, label %234

228:                                              ; preds = %225
  %229 = load ptr, ptr %9, align 8, !tbaa !5
  %230 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %229, i32 0, i32 27
  %231 = load ptr, ptr %230, align 8, !tbaa !34
  %232 = load ptr, ptr %9, align 8, !tbaa !5
  %233 = call i64 @UdpIoRecvDatagram(ptr noundef %231, ptr noundef @Mtftp4RrqInput, ptr noundef %232, i32 noundef 0)
  store i64 %233, ptr %13, align 8, !tbaa !9
  br label %240

234:                                              ; preds = %225
  %235 = load ptr, ptr %9, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %235, i32 0, i32 18
  %237 = load ptr, ptr %236, align 8, !tbaa !35
  %238 = load ptr, ptr %9, align 8, !tbaa !5
  %239 = call i64 @UdpIoRecvDatagram(ptr noundef %237, ptr noundef @Mtftp4RrqInput, ptr noundef %238, i32 noundef 0)
  store i64 %239, ptr %13, align 8, !tbaa !9
  br label %240

240:                                              ; preds = %234, %228
  br label %241

241:                                              ; preds = %240, %222, %219
  %242 = load i64, ptr %13, align 8, !tbaa !9
  %243 = icmp slt i64 %242, 0
  br i1 %243, label %248, label %244

244:                                              ; preds = %241
  %245 = load i8, ptr %11, align 1, !tbaa !20
  %246 = zext i8 %245 to i32
  %247 = icmp ne i32 %246, 0
  br i1 %247, label %248, label %251

248:                                              ; preds = %244, %241
  %249 = load ptr, ptr %9, align 8, !tbaa !5
  %250 = load i64, ptr %13, align 8, !tbaa !9
  call void @Mtftp4CleanOperation(ptr noundef %249, i64 noundef %250)
  br label %251

251:                                              ; preds = %248, %244
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  ret void
}

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

declare zeroext i8 @DebugAssertEnabled() #1

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

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

declare i64 @Mtftp4SendError(ptr noundef, i16 noundef zeroext, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @Mtftp4RrqHandleData(ptr noundef, ptr noundef, i32 noundef, i8 noundef zeroext, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @Mtftp4RrqHandleOack(ptr noundef, ptr noundef, i32 noundef, i8 noundef zeroext, ptr noundef) #2

declare ptr @AllocatePool(i64 noundef) #1

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

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

declare void @FreePool(ptr noundef) #1

declare void @NetbufFree(ptr noundef) #1

declare void @Mtftp4CleanOperation(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, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_MTFTP4_PROTOCOL", !13, i64 0, !14, i64 8, !15, i64 24, !10, i64 88, !7, i64 96, !6, i64 104, !6, i64 112, !16, i64 120, !6, i64 152, !19, i64 160, !18, i64 180, !18, i64 182, !18, i64 184, !14, i64 192, !13, i64 208, !18, i64 212, !18, i64 214, !13, i64 216, !6, i64 224, !6, i64 232, !13, i64 240, !13, i64 244, !13, i64 248, !13, i64 252, !13, i64 256, !18, i64 260, !7, i64 262, !6, i64 264}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!15 = !{!"_EFI_MTFTP4_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}
!16 = !{!"", !7, i64 0, !17, i64 1, !17, i64 5, !18, i64 10, !17, i64 12, !17, i64 16, !18, i64 20, !18, i64 22, !18, i64 24}
!17 = !{!"", !7, i64 0}
!18 = !{!"short", !7, i64 0}
!19 = !{!"", !18, i64 0, !7, i64 2, !13, i64 4, !13, i64 8, !18, i64 12, !7, i64 14, !13, i64 16}
!20 = !{!7, !7, i64 0}
!21 = !{!12, !13, i64 256}
!22 = !{!23, !13, i64 132}
!23 = !{!"", !13, i64 0, !10, i64 8, !14, i64 16, !7, i64 32, !6, i64 40, !6, i64 48, !7, i64 56, !6, i64 120, !13, i64 128, !13, i64 132, !7, i64 136}
!24 = !{!25, !18, i64 36}
!25 = !{!"", !7, i64 0, !18, i64 16, !7, i64 20, !18, i64 36}
!26 = !{!12, !18, i64 214}
!27 = !{!13, !13, i64 0}
!28 = !{!23, !13, i64 128}
!29 = !{!18, !18, i64 0}
!30 = !{!12, !6, i64 152}
!31 = !{!32, !6, i64 80}
!32 = !{!"_EFI_MTFTP4_TOKEN", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !6, i64 48, !10, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}
!33 = !{!12, !18, i64 182}
!34 = !{!12, !6, i64 264}
!35 = !{!12, !6, i64 224}


; 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 [154 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [115 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [26 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 i64 @UdpIoRecvDatagram(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @Mtftp4RrqInput(ptr noundef %0, ptr nocapture noundef readonly %1, i64 noundef %2, ptr noundef %3) #2 {
  %5 = alloca i8, align 1
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #3
  %6 = tail call zeroext i8 @DebugAssertEnabled() #3
  %.not = icmp eq i8 %6, 0
  br i1 %.not, label %12, label %7

7:                                                ; preds = %4
  %.not91 = icmp eq ptr %3, null
  br i1 %.not91, label %11, label %8

8:                                                ; preds = %7
  %9 = load i32, ptr %3, align 8, !tbaa !5
  %10 = icmp eq i32 %9, 1886676596
  br i1 %10, label %12, label %11

11:                                               ; preds = %8, %7
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 653, ptr noundef nonnull @.str.9) #3
  br label %12

12:                                               ; preds = %8, %11, %4
  store i8 0, ptr %5, align 1, !tbaa !18
  %13 = icmp slt i64 %2, 0
  br i1 %13, label %86, label %14

14:                                               ; preds = %12
  %15 = tail call zeroext i8 @DebugAssertEnabled() #3
  %16 = icmp eq i8 %15, 0
  %17 = icmp ne ptr %0, null
  %or.cond13 = or i1 %17, %16
  br i1 %or.cond13, label %19, label %18

18:                                               ; preds = %14
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 665, ptr noundef nonnull @.str.10) #3
  br label %19

19:                                               ; preds = %18, %14
  %20 = load i32, ptr %1, align 4, !tbaa !18
  %21 = getelementptr inbounds i8, ptr %3, i64 256
  %22 = load i32, ptr %21, align 8, !tbaa !19
  %23 = icmp eq i32 %20, %22
  %24 = zext i1 %23 to i8
  %25 = getelementptr inbounds i8, ptr %0, i64 132
  %26 = load i32, ptr %25, align 4, !tbaa !20
  %27 = icmp ult i32 %26, 2
  br i1 %27, label %.thread110, label %28

28:                                               ; preds = %19
  %29 = getelementptr inbounds i8, ptr %1, i64 36
  %30 = load i16, ptr %29, align 4, !tbaa !22
  %31 = getelementptr inbounds i8, ptr %3, i64 214
  %32 = load i16, ptr %31, align 2, !tbaa !24
  %.not92 = icmp eq i16 %30, %32
  br i1 %.not92, label %35, label %33

33:                                               ; preds = %28
  %.not93 = icmp eq i16 %32, 0
  br i1 %.not93, label %34, label %.thread110

34:                                               ; preds = %33
  store i16 %30, ptr %31, align 2, !tbaa !24
  br label %35

35:                                               ; preds = %34, %28
  %36 = getelementptr inbounds i8, ptr %0, i64 128
  %37 = load i32, ptr %36, align 8, !tbaa !25
  %38 = icmp ugt i32 %37, 1
  br i1 %38, label %39, label %45

39:                                               ; preds = %35
  %40 = zext i32 %26 to i64
  %41 = tail call ptr @AllocatePool(i64 noundef %40) #3
  %42 = icmp eq ptr %41, null
  br i1 %42, label %.thread110, label %43

43:                                               ; preds = %39
  %44 = tail call i32 @NetbufCopy(ptr noundef nonnull %0, i32 noundef 0, i32 noundef %26, ptr noundef nonnull %41) #3
  br label %51

45:                                               ; preds = %35
  %46 = tail call ptr @NetbufGetByte(ptr noundef nonnull %0, i32 noundef 0, ptr noundef null) #3
  %47 = tail call zeroext i8 @DebugAssertEnabled() #3
  %48 = icmp eq i8 %47, 0
  %49 = icmp ne ptr %46, null
  %or.cond15 = select i1 %48, i1 true, i1 %49
  br i1 %or.cond15, label %51, label %50

50:                                               ; preds = %45
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 707, ptr noundef nonnull @.str.11) #3
  br label %51

51:                                               ; preds = %45, %50, %43
  %.0 = phi ptr [ %41, %43 ], [ %46, %45 ], [ null, %50 ]
  %52 = load i16, ptr %.0, align 1, !tbaa !18
  %53 = tail call zeroext i16 @SwapBytes16(i16 noundef zeroext %52) #3
  %54 = getelementptr inbounds i8, ptr %3, i64 152
  %55 = load ptr, ptr %54, align 8, !tbaa !26
  %56 = getelementptr inbounds i8, ptr %55, i64 80
  %57 = load ptr, ptr %56, align 8, !tbaa !27
  %.not94 = icmp ne ptr %57, null
  %58 = add i16 %53, -5
  %or.cond = icmp ult i16 %58, 2
  %or.cond99 = select i1 %.not94, i1 %or.cond, i1 false
  br i1 %or.cond99, label %59, label %67

59:                                               ; preds = %51
  %60 = getelementptr inbounds i8, ptr %3, i64 24
  %61 = trunc i32 %26 to i16
  %62 = tail call i64 %57(ptr noundef nonnull %60, ptr noundef nonnull %55, i16 noundef zeroext %61, ptr noundef nonnull %.0) #3
  %63 = icmp slt i64 %62, 0
  br i1 %63, label %64, label %67

64:                                               ; preds = %59
  %.not95 = icmp eq i16 %53, 5
  br i1 %.not95, label %82, label %65

65:                                               ; preds = %64
  %66 = tail call i64 @Mtftp4SendError(ptr noundef nonnull %3, i16 noundef zeroext 8, ptr noundef nonnull @.str.12) #3
  br label %82

67:                                               ; preds = %59, %51
  %.078 = phi i64 [ %62, %59 ], [ 0, %51 ]
  switch i16 %53, label %82 [
    i16 3, label %68
    i16 6, label %77
    i16 5, label %81
  ]

68:                                               ; preds = %67
  %69 = getelementptr inbounds i8, ptr %3, i64 182
  %70 = load i16, ptr %69, align 2, !tbaa !29
  %71 = zext i16 %70 to i32
  %72 = add nuw nsw i32 %71, 4
  %73 = icmp ugt i32 %26, %72
  %74 = icmp ult i32 %26, 4
  %or.cond4 = or i1 %74, %73
  br i1 %or.cond4, label %82, label %75

75:                                               ; preds = %68
  %76 = call i64 @Mtftp4RrqHandleData(ptr noundef nonnull %3, ptr noundef nonnull %.0, i32 noundef %26, i8 noundef zeroext %24, ptr noundef nonnull %5)
  br label %82

77:                                               ; preds = %67
  %78 = icmp eq i32 %26, 2
  %or.cond6 = or i1 %23, %78
  br i1 %or.cond6, label %82, label %79

79:                                               ; preds = %77
  %80 = call i64 @Mtftp4RrqHandleOack(ptr noundef nonnull %3, ptr noundef nonnull %.0, i32 noundef %26, i8 noundef zeroext %24, ptr noundef nonnull %5)
  br label %82

81:                                               ; preds = %67
  br label %82

82:                                               ; preds = %67, %81, %77, %79, %68, %75, %65, %64
  %.179.ph = phi i64 [ -9223372036854775787, %64 ], [ -9223372036854775787, %65 ], [ %76, %75 ], [ %.078, %68 ], [ %80, %79 ], [ %.078, %77 ], [ -9223372036854775785, %81 ], [ %.078, %67 ]
  %83 = load i32, ptr %36, align 8, !tbaa !25
  %84 = icmp ugt i32 %83, 1
  br i1 %84, label %85, label %.thread110

85:                                               ; preds = %82
  call void @FreePool(ptr noundef nonnull %.0) #3
  br label %.thread110

86:                                               ; preds = %12
  %.not97 = icmp eq ptr %0, null
  br i1 %.not97, label %.thread122, label %.thread110

.thread110:                                       ; preds = %82, %85, %39, %33, %19, %86
  %.179105116 = phi i64 [ %2, %86 ], [ -9223372036854775799, %39 ], [ 0, %33 ], [ 0, %19 ], [ %.179.ph, %82 ], [ %.179.ph, %85 ]
  %.077107114 = phi i8 [ 0, %86 ], [ %24, %39 ], [ %24, %33 ], [ %24, %19 ], [ %24, %82 ], [ %24, %85 ]
  call void @NetbufFree(ptr noundef nonnull %0) #3
  %87 = icmp slt i64 %.179105116, 0
  %88 = load i8, ptr %5, align 1
  %89 = icmp ne i8 %88, 0
  %or.cond8 = select i1 %87, i1 true, i1 %89
  br i1 %or.cond8, label %93, label %.sink.split

.sink.split:                                      ; preds = %.thread110
  %.not98 = icmp eq i8 %.077107114, 0
  %. = select i1 %.not98, i64 224, i64 264
  %90 = getelementptr inbounds i8, ptr %3, i64 %.
  %91 = load ptr, ptr %90, align 8, !tbaa !30
  %92 = call i64 @UdpIoRecvDatagram(ptr noundef %91, ptr noundef nonnull @Mtftp4RrqInput, ptr noundef %3, i32 noundef 0) #3
  br label %93

93:                                               ; preds = %.sink.split, %.thread110
  %.2 = phi i64 [ %.179105116, %.thread110 ], [ %92, %.sink.split ]
  %94 = icmp slt i64 %.2, 0
  %95 = load i8, ptr %5, align 1
  %96 = icmp ne i8 %95, 0
  %or.cond11 = select i1 %94, i1 true, i1 %96
  br i1 %or.cond11, label %.thread122, label %97

.thread122:                                       ; preds = %86, %93
  %.2125 = phi i64 [ %.2, %93 ], [ %2, %86 ]
  call void @Mtftp4CleanOperation(ptr noundef %3, i64 noundef %.2125) #3
  br label %97

97:                                               ; preds = %93, %.thread122
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #3
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.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 zeroext i16 @SwapBytes16(i16 noundef zeroext) local_unnamed_addr #1

declare i64 @Mtftp4SendError(ptr noundef, i16 noundef zeroext, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @Mtftp4RrqHandleData(ptr noundef, ptr noundef, i32 noundef, i8 noundef zeroext, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @Mtftp4RrqHandleOack(ptr noundef, ptr noundef, i32 noundef, i8 noundef zeroext, ptr noundef) local_unnamed_addr #2

declare ptr @AllocatePool(i64 noundef) local_unnamed_addr #1

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

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

declare void @FreePool(ptr noundef) local_unnamed_addr #1

declare void @NetbufFree(ptr noundef) local_unnamed_addr #1

declare void @Mtftp4CleanOperation(ptr noundef, i64 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 0}
!6 = !{!"_MTFTP4_PROTOCOL", !7, i64 0, !10, i64 8, !12, i64 24, !13, i64 88, !8, i64 96, !11, i64 104, !11, i64 112, !14, i64 120, !11, i64 152, !17, i64 160, !16, i64 180, !16, i64 182, !16, i64 184, !10, i64 192, !7, i64 208, !16, i64 212, !16, i64 214, !7, i64 216, !11, i64 224, !11, i64 232, !7, i64 240, !7, i64 244, !7, i64 248, !7, i64 252, !7, i64 256, !16, i64 260, !8, i64 262, !11, i64 264}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_LIST_ENTRY", !11, i64 0, !11, i64 8}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"_EFI_MTFTP4_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}
!13 = !{!"long long", !8, i64 0}
!14 = !{!"", !8, i64 0, !15, i64 1, !15, i64 5, !16, i64 10, !15, i64 12, !15, i64 16, !16, i64 20, !16, i64 22, !16, i64 24}
!15 = !{!"", !8, i64 0}
!16 = !{!"short", !8, i64 0}
!17 = !{!"", !16, i64 0, !8, i64 2, !7, i64 4, !7, i64 8, !16, i64 12, !8, i64 14, !7, i64 16}
!18 = !{!8, !8, i64 0}
!19 = !{!6, !7, i64 256}
!20 = !{!21, !7, i64 132}
!21 = !{!"", !7, i64 0, !13, i64 8, !10, i64 16, !8, i64 32, !11, i64 40, !11, i64 48, !8, i64 56, !11, i64 120, !7, i64 128, !7, i64 132, !8, i64 136}
!22 = !{!23, !16, i64 36}
!23 = !{!"", !8, i64 0, !16, i64 16, !8, i64 20, !16, i64 36}
!24 = !{!6, !16, i64 214}
!25 = !{!21, !7, i64 128}
!26 = !{!6, !11, i64 152}
!27 = !{!28, !11, i64 80}
!28 = !{!"_EFI_MTFTP4_TOKEN", !13, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !7, i64 40, !11, i64 48, !13, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96}
!29 = !{!6, !16, i64 182}
!30 = !{!11, !11, i64 0}


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