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

; 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._MTFTP6_INSTANCE = type { i32, ptr, %struct._LIST_ENTRY, %struct._EFI_MTFTP6_PROTOCOL, ptr, ptr, ptr, %struct.MTFTP6_EXT_OPTION_INFO, i16, i16, %struct._LIST_ENTRY, %struct.EFI_IPv6_ADDRESS, i16, i16, ptr, %struct.EFI_IPv6_ADDRESS, i16, ptr, ptr, i32, i32, i32, i32, i64, i8, i8, i8 }
%struct._EFI_MTFTP6_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.MTFTP6_EXT_OPTION_INFO = type { i16, i8, i32, %struct.EFI_IPv6_ADDRESS, i16, i8, i32 }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }
%struct.EFI_MTFTP6_DATA_HEADER = type <{ i16, i16, [1 x i8] }>
%struct._EFI_MTFTP6_TOKEN = type { i64, ptr, ptr, ptr, ptr, i32, ptr, i64, ptr, ptr, ptr, ptr, ptr }

@.str.2 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [40 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @Mtftp6RrqSaveBlock(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3) #2 {
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i16, align 2
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca i8, align 1
  %17 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !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 2, 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 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #3
  store i8 0, ptr %16, align 1, !tbaa !11
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %18, i32 0, i32 6
  %20 = load ptr, ptr %19, align 8, !tbaa !12
  store ptr %20, ptr %10, align 8, !tbaa !5
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.EFI_MTFTP6_DATA_HEADER, ptr %21, i32 0, i32 1
  %23 = load i16, ptr %22, align 1, !tbaa !11
  %24 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %23)
  store i16 %24, ptr %12, align 2, !tbaa !20
  %25 = load i32, ptr %8, align 4, !tbaa !9
  %26 = sub i32 %25, 4
  store i32 %26, ptr %14, align 4, !tbaa !9
  %27 = load i32, ptr %14, align 4, !tbaa !9
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %28, i32 0, i32 8
  %30 = load i16, ptr %29, align 8, !tbaa !21
  %31 = zext i16 %30 to i32
  %32 = icmp ult i32 %27, %31
  br i1 %32, label %33, label %40

33:                                               ; preds = %4
  store i8 1, ptr %16, align 1, !tbaa !11
  %34 = load i16, ptr %12, align 2, !tbaa !20
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %35, i32 0, i32 9
  store i16 %34, ptr %36, align 2, !tbaa !22
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %37, i32 0, i32 10
  %39 = load i16, ptr %12, align 2, !tbaa !20
  call void @Mtftp6SetLastBlockNum(ptr noundef %38, i16 noundef zeroext %39)
  br label %40

40:                                               ; preds = %33, %4
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %41, i32 0, i32 10
  %43 = load i16, ptr %12, align 2, !tbaa !20
  %44 = load i8, ptr %16, align 1, !tbaa !11
  %45 = call i64 @Mtftp6RemoveBlockNum(ptr noundef %42, i16 noundef zeroext %43, i8 noundef zeroext %44, ptr noundef %15)
  store i64 %45, ptr %11, align 8, !tbaa !23
  %46 = load i64, ptr %11, align 8, !tbaa !23
  %47 = icmp eq i64 %46, -9223372036854775794
  br i1 %47, label %48, label %49

48:                                               ; preds = %40
  store i64 0, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %153

49:                                               ; preds = %40
  %50 = load i64, ptr %11, align 8, !tbaa !23
  %51 = icmp slt i64 %50, 0
  br i1 %51, label %52, label %54

52:                                               ; preds = %49
  %53 = load i64, ptr %11, align 8, !tbaa !23
  store i64 %53, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %153

54:                                               ; preds = %49
  br label %55

55:                                               ; preds = %54
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._EFI_MTFTP6_TOKEN, ptr %56, i32 0, i32 10
  %58 = load ptr, ptr %57, align 8, !tbaa !24
  %59 = icmp ne ptr %58, null
  br i1 %59, label %60, label %80

60:                                               ; preds = %55
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct._EFI_MTFTP6_TOKEN, ptr %61, i32 0, i32 10
  %63 = load ptr, ptr %62, align 8, !tbaa !24
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %64, i32 0, i32 3
  %66 = load ptr, ptr %10, align 8, !tbaa !5
  %67 = load i32, ptr %8, align 4, !tbaa !9
  %68 = trunc i32 %67 to i16
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = call i64 %63(ptr noundef %65, ptr noundef %66, i16 noundef zeroext %68, ptr noundef %69)
  store i64 %70, ptr %11, align 8, !tbaa !23
  %71 = load i64, ptr %11, align 8, !tbaa !23
  %72 = icmp slt i64 %71, 0
  br i1 %72, label %73, label %79

73:                                               ; preds = %60
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  %75 = load ptr, ptr %74, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %75)
  %76 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr null, ptr %76, align 8, !tbaa !5
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = call i64 @Mtftp6SendError(ptr noundef %77, i16 noundef zeroext 6, ptr noundef @.str.2)
  store i64 -9223372036854775787, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %153

79:                                               ; preds = %60
  br label %80

80:                                               ; preds = %79, %55
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct._EFI_MTFTP6_TOKEN, ptr %81, i32 0, i32 8
  %83 = load ptr, ptr %82, align 8, !tbaa !26
  %84 = icmp ne ptr %83, null
  br i1 %84, label %85, label %152

85:                                               ; preds = %80
  %86 = load i64, ptr %15, align 8, !tbaa !23
  %87 = sub i64 %86, 1
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %88, i32 0, i32 8
  %90 = load i16, ptr %89, align 8, !tbaa !21
  %91 = zext i16 %90 to i32
  %92 = call i64 @MultU64x32(i64 noundef %87, i32 noundef %91)
  store i64 %92, ptr %13, align 8, !tbaa !23
  %93 = load i64, ptr %13, align 8, !tbaa !23
  %94 = load i32, ptr %14, align 4, !tbaa !9
  %95 = zext i32 %94 to i64
  %96 = add i64 %93, %95
  %97 = load ptr, ptr %10, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct._EFI_MTFTP6_TOKEN, ptr %97, i32 0, i32 7
  %99 = load i64, ptr %98, align 8, !tbaa !27
  %100 = icmp ule i64 %96, %99
  br i1 %100, label %101, label %132

101:                                              ; preds = %85
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._EFI_MTFTP6_TOKEN, ptr %102, i32 0, i32 8
  %104 = load ptr, ptr %103, align 8, !tbaa !26
  %105 = load i64, ptr %13, align 8, !tbaa !23
  %106 = getelementptr inbounds i8, ptr %104, i64 %105
  %107 = load ptr, ptr %7, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.EFI_MTFTP6_DATA_HEADER, ptr %107, i32 0, i32 2
  %109 = getelementptr inbounds [1 x i8], ptr %108, i64 0, i64 0
  %110 = load i32, ptr %14, align 4, !tbaa !9
  %111 = zext i32 %110 to i64
  %112 = call ptr @CopyMem(ptr noundef %106, ptr noundef %109, i64 noundef %111)
  %113 = load ptr, ptr %6, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %113, i32 0, i32 9
  %115 = load i16, ptr %114, align 2, !tbaa !22
  %116 = zext i16 %115 to i32
  %117 = load i16, ptr %12, align 2, !tbaa !20
  %118 = zext i16 %117 to i32
  %119 = icmp eq i32 %116, %118
  br i1 %119, label %120, label %131

120:                                              ; preds = %101
  %121 = load i8, ptr %16, align 1, !tbaa !11
  %122 = zext i8 %121 to i32
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %131

124:                                              ; preds = %120
  %125 = load i64, ptr %13, align 8, !tbaa !23
  %126 = load i32, ptr %14, align 4, !tbaa !9
  %127 = zext i32 %126 to i64
  %128 = add i64 %125, %127
  %129 = load ptr, ptr %10, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct._EFI_MTFTP6_TOKEN, ptr %129, i32 0, i32 7
  store i64 %128, ptr %130, align 8, !tbaa !27
  br label %131

131:                                              ; preds = %124, %120, %101
  br label %151

132:                                              ; preds = %85
  %133 = load ptr, ptr %6, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %133, i32 0, i32 9
  %135 = load i16, ptr %134, align 2, !tbaa !22
  %136 = zext i16 %135 to i32
  %137 = icmp ne i32 %136, 0
  br i1 %137, label %138, label %150

138:                                              ; preds = %132
  %139 = load i64, ptr %13, align 8, !tbaa !23
  %140 = load i32, ptr %14, align 4, !tbaa !9
  %141 = zext i32 %140 to i64
  %142 = add i64 %139, %141
  %143 = load ptr, ptr %10, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct._EFI_MTFTP6_TOKEN, ptr %143, i32 0, i32 7
  store i64 %142, ptr %144, align 8, !tbaa !27
  %145 = load ptr, ptr %9, align 8, !tbaa !5
  %146 = load ptr, ptr %145, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %146)
  %147 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr null, ptr %147, align 8, !tbaa !5
  %148 = load ptr, ptr %6, align 8, !tbaa !5
  %149 = call i64 @Mtftp6SendError(ptr noundef %148, i16 noundef zeroext 3, ptr noundef @.str.3)
  store i64 -9223372036854775803, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %153

150:                                              ; preds = %132
  br label %151

151:                                              ; preds = %150, %131
  br label %152

152:                                              ; preds = %151, %80
  store i64 0, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %153

153:                                              ; preds = %152, %138, %73, %52, %48
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, 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 2, 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
  %154 = load i64, ptr %5, align 8
  ret i64 %154
}

declare void @Mtftp6SetLastBlockNum(ptr noundef, i16 noundef zeroext) #1

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

declare void @NetbufFree(ptr noundef) #1

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

declare i64 @MultU64x32(i64 noundef, i32 noundef) #1

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !6, i64 112}
!13 = !{!"_MTFTP6_INSTANCE", !10, i64 0, !6, i64 8, !14, i64 16, !15, i64 32, !6, i64 96, !6, i64 104, !6, i64 112, !16, i64 120, !17, i64 152, !17, i64 154, !14, i64 160, !18, i64 176, !17, i64 192, !17, i64 194, !6, i64 200, !18, i64 208, !17, i64 224, !6, i64 232, !6, i64 240, !10, i64 248, !10, i64 252, !10, i64 256, !10, i64 260, !19, i64 264, !7, i64 272, !7, i64 273, !7, i64 274}
!14 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!15 = !{!"_EFI_MTFTP6_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 = !{!"", !17, i64 0, !7, i64 2, !10, i64 4, !18, i64 8, !17, i64 24, !7, i64 26, !10, i64 28}
!17 = !{!"short", !7, i64 0}
!18 = !{!"", !7, i64 0}
!19 = !{!"long long", !7, i64 0}
!20 = !{!17, !17, i64 0}
!21 = !{!13, !17, i64 152}
!22 = !{!13, !17, i64 154}
!23 = !{!19, !19, i64 0}
!24 = !{!25, !6, i64 80}
!25 = !{!"_EFI_MTFTP6_TOKEN", !19, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !10, i64 40, !6, i64 48, !19, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}
!26 = !{!25, !6, i64 64}
!27 = !{!25, !19, i64 56}


; 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.2 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [40 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @Mtftp6RrqSaveBlock(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr nocapture noundef %3) local_unnamed_addr #2 {
  %5 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %6 = getelementptr inbounds i8, ptr %0, i64 112
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %1, i64 2
  %9 = load i16, ptr %8, align 1, !tbaa !17
  %10 = tail call zeroext i16 @SwapBytes16(i16 noundef zeroext %9) #3
  %11 = add i32 %2, -4
  %12 = getelementptr inbounds i8, ptr %0, i64 152
  %13 = load i16, ptr %12, align 8, !tbaa !18
  %14 = zext i16 %13 to i32
  %15 = icmp ult i32 %11, %14
  br i1 %15, label %16, label %19

16:                                               ; preds = %4
  %17 = getelementptr inbounds i8, ptr %0, i64 154
  store i16 %10, ptr %17, align 2, !tbaa !19
  %18 = getelementptr inbounds i8, ptr %0, i64 160
  tail call void @Mtftp6SetLastBlockNum(ptr noundef nonnull %18, i16 noundef zeroext %10) #3
  br label %19

19:                                               ; preds = %16, %4
  %.0 = phi i8 [ 1, %16 ], [ 0, %4 ]
  %20 = getelementptr inbounds i8, ptr %0, i64 160
  %21 = call i64 @Mtftp6RemoveBlockNum(ptr noundef nonnull %20, i16 noundef zeroext %10, i8 noundef zeroext %.0, ptr noundef nonnull %5) #3
  %22 = icmp eq i64 %21, -9223372036854775794
  br i1 %22, label %64, label %23

23:                                               ; preds = %19
  %24 = icmp slt i64 %21, 0
  br i1 %24, label %64, label %25

25:                                               ; preds = %23
  %26 = getelementptr inbounds i8, ptr %7, i64 80
  %27 = load ptr, ptr %26, align 8, !tbaa !20
  %.not = icmp eq ptr %27, null
  br i1 %.not, label %36, label %28

28:                                               ; preds = %25
  %29 = getelementptr inbounds i8, ptr %0, i64 32
  %30 = trunc i32 %2 to i16
  %31 = call i64 %27(ptr noundef nonnull %29, ptr noundef nonnull %7, i16 noundef zeroext %30, ptr noundef nonnull %1) #3
  %32 = icmp slt i64 %31, 0
  br i1 %32, label %33, label %36

33:                                               ; preds = %28
  %34 = load ptr, ptr %3, align 8, !tbaa !22
  call void @NetbufFree(ptr noundef %34) #3
  store ptr null, ptr %3, align 8, !tbaa !22
  %35 = call i64 @Mtftp6SendError(ptr noundef nonnull %0, i16 noundef zeroext 6, ptr noundef nonnull @.str.2) #3
  br label %64

36:                                               ; preds = %28, %25
  %37 = getelementptr inbounds i8, ptr %7, i64 64
  %38 = load ptr, ptr %37, align 8, !tbaa !23
  %.not53 = icmp eq ptr %38, null
  br i1 %.not53, label %64, label %39

39:                                               ; preds = %36
  %40 = load i64, ptr %5, align 8, !tbaa !24
  %41 = add i64 %40, -1
  %42 = load i16, ptr %12, align 8, !tbaa !18
  %43 = zext i16 %42 to i32
  %44 = call i64 @MultU64x32(i64 noundef %41, i32 noundef %43) #3
  %45 = zext i32 %11 to i64
  %46 = add i64 %44, %45
  %47 = getelementptr inbounds i8, ptr %7, i64 56
  %48 = load i64, ptr %47, align 8, !tbaa !25
  %.not54 = icmp ugt i64 %46, %48
  br i1 %.not54, label %58, label %49

49:                                               ; preds = %39
  %50 = load ptr, ptr %37, align 8, !tbaa !23
  %51 = getelementptr inbounds i8, ptr %50, i64 %44
  %52 = getelementptr inbounds i8, ptr %1, i64 4
  %53 = call ptr @CopyMem(ptr noundef %51, ptr noundef nonnull %52, i64 noundef %45) #3
  %54 = getelementptr inbounds i8, ptr %0, i64 154
  %55 = load i16, ptr %54, align 2, !tbaa !19
  %56 = icmp eq i16 %55, %10
  %or.cond = and i1 %15, %56
  br i1 %or.cond, label %57, label %64

57:                                               ; preds = %49
  store i64 %46, ptr %47, align 8, !tbaa !25
  br label %64

58:                                               ; preds = %39
  %59 = getelementptr inbounds i8, ptr %0, i64 154
  %60 = load i16, ptr %59, align 2, !tbaa !19
  %.not55 = icmp eq i16 %60, 0
  br i1 %.not55, label %64, label %61

61:                                               ; preds = %58
  store i64 %46, ptr %47, align 8, !tbaa !25
  %62 = load ptr, ptr %3, align 8, !tbaa !22
  call void @NetbufFree(ptr noundef %62) #3
  store ptr null, ptr %3, align 8, !tbaa !22
  %63 = call i64 @Mtftp6SendError(ptr noundef nonnull %0, i16 noundef zeroext 3, ptr noundef nonnull @.str.3) #3
  br label %64

64:                                               ; preds = %36, %58, %49, %57, %23, %19, %61, %33
  %.049 = phi i64 [ -9223372036854775787, %33 ], [ -9223372036854775803, %61 ], [ 0, %19 ], [ %21, %23 ], [ 0, %57 ], [ 0, %49 ], [ 0, %58 ], [ 0, %36 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  ret i64 %.049
}

declare void @Mtftp6SetLastBlockNum(ptr noundef, i16 noundef zeroext) local_unnamed_addr #1

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

declare void @NetbufFree(ptr noundef) local_unnamed_addr #1

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

declare i64 @MultU64x32(i64 noundef, i32 noundef) local_unnamed_addr #1

declare ptr @CopyMem(ptr noundef, 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, !10, i64 112}
!6 = !{!"_MTFTP6_INSTANCE", !7, i64 0, !10, i64 8, !11, i64 16, !12, i64 32, !10, i64 96, !10, i64 104, !10, i64 112, !13, i64 120, !14, i64 152, !14, i64 154, !11, i64 160, !15, i64 176, !14, i64 192, !14, i64 194, !10, i64 200, !15, i64 208, !14, i64 224, !10, i64 232, !10, i64 240, !7, i64 248, !7, i64 252, !7, i64 256, !7, i64 260, !16, i64 264, !8, i64 272, !8, i64 273, !8, i64 274}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_LIST_ENTRY", !10, i64 0, !10, i64 8}
!12 = !{!"_EFI_MTFTP6_PROTOCOL", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56}
!13 = !{!"", !14, i64 0, !8, i64 2, !7, i64 4, !15, i64 8, !14, i64 24, !8, i64 26, !7, i64 28}
!14 = !{!"short", !8, i64 0}
!15 = !{!"", !8, i64 0}
!16 = !{!"long long", !8, i64 0}
!17 = !{!8, !8, i64 0}
!18 = !{!6, !14, i64 152}
!19 = !{!6, !14, i64 154}
!20 = !{!21, !10, i64 80}
!21 = !{!"_EFI_MTFTP6_TOKEN", !16, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !7, i64 40, !10, i64 48, !16, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96}
!22 = !{!10, !10, i64 0}
!23 = !{!21, !10, i64 64}
!24 = !{!16, !16, i64 0}
!25 = !{!21, !16, i64 56}


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