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

; 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._EFI_MTFTP4_TOKEN = type { i64, ptr, ptr, ptr, ptr, i32, ptr, i64, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_MTFTP4_OPTION = type { ptr, ptr }
%struct.EFI_MTFTP4_REQ_HEADER = type <{ i16, [1 x i8] }>

@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [158 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [23 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

; 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 @Mtftp4SendRequest(ptr noundef %0) #1 {
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %15, i32 0, i32 8
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  store ptr %17, ptr %6, align 8, !tbaa !5
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %18, i32 0, i32 6
  %20 = load ptr, ptr %19, align 8, !tbaa !19
  store ptr %20, ptr %5, align 8, !tbaa !5
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %21, i32 0, i32 8
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  %24 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %23, i32 0, i32 4
  %25 = load ptr, ptr %24, align 8, !tbaa !21
  store ptr %25, ptr %8, align 8, !tbaa !5
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %29

28:                                               ; preds = %1
  store ptr @.str, ptr %8, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %28, %1
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %30, i32 0, i32 3
  %32 = load ptr, ptr %31, align 8, !tbaa !22
  %33 = call i64 @AsciiStrLen(ptr noundef %32)
  %34 = trunc i64 %33 to i32
  store i32 %34, ptr %12, align 4, !tbaa !23
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = call i64 @AsciiStrLen(ptr noundef %35)
  %37 = trunc i64 %36 to i32
  store i32 %37, ptr %13, align 4, !tbaa !23
  %38 = load i32, ptr %12, align 4, !tbaa !23
  %39 = load i32, ptr %13, align 4, !tbaa !23
  %40 = add i32 %38, %39
  %41 = add i32 %40, 4
  store i32 %41, ptr %10, align 4, !tbaa !23
  store i64 0, ptr %11, align 8, !tbaa !24
  br label %42

42:                                               ; preds = %70, %29
  %43 = load i64, ptr %11, align 8, !tbaa !24
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %44, i32 0, i32 5
  %46 = load i32, ptr %45, align 8, !tbaa !25
  %47 = zext i32 %46 to i64
  %48 = icmp ult i64 %43, %47
  br i1 %48, label %49, label %73

49:                                               ; preds = %42
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = load i64, ptr %11, align 8, !tbaa !24
  %52 = getelementptr inbounds %struct.EFI_MTFTP4_OPTION, ptr %50, i64 %51
  %53 = getelementptr inbounds %struct.EFI_MTFTP4_OPTION, ptr %52, i32 0, i32 0
  %54 = load ptr, ptr %53, align 8, !tbaa !26
  %55 = call i64 @AsciiStrLen(ptr noundef %54)
  %56 = trunc i64 %55 to i32
  store i32 %56, ptr %12, align 4, !tbaa !23
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = load i64, ptr %11, align 8, !tbaa !24
  %59 = getelementptr inbounds %struct.EFI_MTFTP4_OPTION, ptr %57, i64 %58
  %60 = getelementptr inbounds %struct.EFI_MTFTP4_OPTION, ptr %59, i32 0, i32 1
  %61 = load ptr, ptr %60, align 8, !tbaa !28
  %62 = call i64 @AsciiStrLen(ptr noundef %61)
  %63 = trunc i64 %62 to i32
  store i32 %63, ptr %13, align 4, !tbaa !23
  %64 = load i32, ptr %12, align 4, !tbaa !23
  %65 = load i32, ptr %13, align 4, !tbaa !23
  %66 = add i32 %64, %65
  %67 = add i32 %66, 2
  %68 = load i32, ptr %10, align 4, !tbaa !23
  %69 = add i32 %68, %67
  store i32 %69, ptr %10, align 4, !tbaa !23
  br label %70

70:                                               ; preds = %49
  %71 = load i64, ptr %11, align 8, !tbaa !24
  %72 = add i64 %71, 1
  store i64 %72, ptr %11, align 8, !tbaa !24
  br label %42, !llvm.loop !29

73:                                               ; preds = %42
  %74 = load i32, ptr %10, align 4, !tbaa !23
  %75 = call ptr @NetbufAlloc(i32 noundef %74)
  store ptr %75, ptr %7, align 8, !tbaa !5
  %76 = icmp eq ptr %75, null
  br i1 %76, label %77, label %78

77:                                               ; preds = %73
  store i64 -9223372036854775799, ptr %2, align 8
  store i32 1, ptr %14, align 4
  br label %168

78:                                               ; preds = %73
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = load i32, ptr %10, align 4, !tbaa !23
  %81 = call ptr @NetbufAllocSpace(ptr noundef %79, i32 noundef %80, i8 noundef zeroext 0)
  store ptr %81, ptr %4, align 8, !tbaa !5
  br label %82

82:                                               ; preds = %78
  %83 = call zeroext i8 @DebugAssertEnabled()
  %84 = icmp ne i8 %83, 0
  br i1 %84, label %85, label %90

85:                                               ; preds = %82
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = icmp ne ptr %86, null
  br i1 %87, label %89, label %88

88:                                               ; preds = %85
  call void @DebugAssert(ptr noundef @.str.1, i64 noundef 318, ptr noundef @.str.2)
  br label %89

89:                                               ; preds = %88, %85
  br label %90

90:                                               ; preds = %89, %82
  br label %91

91:                                               ; preds = %90
  br label %92

92:                                               ; preds = %91
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %93, i32 0, i32 10
  %95 = load i16, ptr %94, align 4, !tbaa !31
  %96 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %95)
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  store i16 %96, ptr %97, align 1, !tbaa !32
  %98 = load ptr, ptr %4, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.EFI_MTFTP4_REQ_HEADER, ptr %98, i32 0, i32 1
  %100 = getelementptr inbounds [1 x i8], ptr %99, i64 0, i64 0
  store ptr %100, ptr %9, align 8, !tbaa !5
  %101 = load ptr, ptr %9, align 8, !tbaa !5
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %102, i32 0, i32 3
  %104 = load ptr, ptr %103, align 8, !tbaa !22
  %105 = call ptr @AsciiStrCpy(ptr noundef %101, ptr noundef %104)
  store ptr %105, ptr %9, align 8, !tbaa !5
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %106, i32 0, i32 3
  %108 = load ptr, ptr %107, align 8, !tbaa !22
  %109 = call i64 @AsciiStrLen(ptr noundef %108)
  %110 = add i64 %109, 1
  %111 = load ptr, ptr %9, align 8, !tbaa !5
  %112 = getelementptr inbounds i8, ptr %111, i64 %110
  store ptr %112, ptr %9, align 8, !tbaa !5
  %113 = load ptr, ptr %9, align 8, !tbaa !5
  %114 = load ptr, ptr %8, align 8, !tbaa !5
  %115 = call ptr @AsciiStrCpy(ptr noundef %113, ptr noundef %114)
  store ptr %115, ptr %9, align 8, !tbaa !5
  %116 = load ptr, ptr %8, align 8, !tbaa !5
  %117 = call i64 @AsciiStrLen(ptr noundef %116)
  %118 = add i64 %117, 1
  %119 = load ptr, ptr %9, align 8, !tbaa !5
  %120 = getelementptr inbounds i8, ptr %119, i64 %118
  store ptr %120, ptr %9, align 8, !tbaa !5
  store i64 0, ptr %11, align 8, !tbaa !24
  br label %121

121:                                              ; preds = %161, %92
  %122 = load i64, ptr %11, align 8, !tbaa !24
  %123 = load ptr, ptr %6, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %123, i32 0, i32 5
  %125 = load i32, ptr %124, align 8, !tbaa !25
  %126 = zext i32 %125 to i64
  %127 = icmp ult i64 %122, %126
  br i1 %127, label %128, label %164

128:                                              ; preds = %121
  %129 = load ptr, ptr %9, align 8, !tbaa !5
  %130 = load ptr, ptr %5, align 8, !tbaa !5
  %131 = load i64, ptr %11, align 8, !tbaa !24
  %132 = getelementptr inbounds %struct.EFI_MTFTP4_OPTION, ptr %130, i64 %131
  %133 = getelementptr inbounds %struct.EFI_MTFTP4_OPTION, ptr %132, i32 0, i32 0
  %134 = load ptr, ptr %133, align 8, !tbaa !26
  %135 = call ptr @AsciiStrCpy(ptr noundef %129, ptr noundef %134)
  store ptr %135, ptr %9, align 8, !tbaa !5
  %136 = load ptr, ptr %5, align 8, !tbaa !5
  %137 = load i64, ptr %11, align 8, !tbaa !24
  %138 = getelementptr inbounds %struct.EFI_MTFTP4_OPTION, ptr %136, i64 %137
  %139 = getelementptr inbounds %struct.EFI_MTFTP4_OPTION, ptr %138, i32 0, i32 0
  %140 = load ptr, ptr %139, align 8, !tbaa !26
  %141 = call i64 @AsciiStrLen(ptr noundef %140)
  %142 = add i64 %141, 1
  %143 = load ptr, ptr %9, align 8, !tbaa !5
  %144 = getelementptr inbounds i8, ptr %143, i64 %142
  store ptr %144, ptr %9, align 8, !tbaa !5
  %145 = load ptr, ptr %9, align 8, !tbaa !5
  %146 = load ptr, ptr %5, align 8, !tbaa !5
  %147 = load i64, ptr %11, align 8, !tbaa !24
  %148 = getelementptr inbounds %struct.EFI_MTFTP4_OPTION, ptr %146, i64 %147
  %149 = getelementptr inbounds %struct.EFI_MTFTP4_OPTION, ptr %148, i32 0, i32 1
  %150 = load ptr, ptr %149, align 8, !tbaa !28
  %151 = call ptr @AsciiStrCpy(ptr noundef %145, ptr noundef %150)
  store ptr %151, ptr %9, align 8, !tbaa !5
  %152 = load ptr, ptr %5, align 8, !tbaa !5
  %153 = load i64, ptr %11, align 8, !tbaa !24
  %154 = getelementptr inbounds %struct.EFI_MTFTP4_OPTION, ptr %152, i64 %153
  %155 = getelementptr inbounds %struct.EFI_MTFTP4_OPTION, ptr %154, i32 0, i32 1
  %156 = load ptr, ptr %155, align 8, !tbaa !28
  %157 = call i64 @AsciiStrLen(ptr noundef %156)
  %158 = add i64 %157, 1
  %159 = load ptr, ptr %9, align 8, !tbaa !5
  %160 = getelementptr inbounds i8, ptr %159, i64 %158
  store ptr %160, ptr %9, align 8, !tbaa !5
  br label %161

161:                                              ; preds = %128
  %162 = load i64, ptr %11, align 8, !tbaa !24
  %163 = add i64 %162, 1
  store i64 %163, ptr %11, align 8, !tbaa !24
  br label %121, !llvm.loop !33

164:                                              ; preds = %121
  %165 = load ptr, ptr %3, align 8, !tbaa !5
  %166 = load ptr, ptr %7, align 8, !tbaa !5
  %167 = call i64 @Mtftp4SendPacket(ptr noundef %165, ptr noundef %166)
  store i64 %167, ptr %2, align 8
  store i32 1, ptr %14, align 4
  br label %168

168:                                              ; preds = %164, %77
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %169 = load i64, ptr %2, align 8
  ret i64 %169
}

declare i64 @AsciiStrLen(ptr noundef) #2

declare ptr @NetbufAlloc(i32 noundef) #2

declare ptr @NetbufAllocSpace(ptr noundef, i32 noundef, i8 noundef zeroext) #2

declare zeroext i8 @DebugAssertEnabled() #2

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @Mtftp4SendPacket(ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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, !6, i64 152}
!10 = !{!"_MTFTP4_PROTOCOL", !11, i64 0, !12, i64 8, !13, i64 24, !14, i64 88, !7, i64 96, !6, i64 104, !6, i64 112, !15, i64 120, !6, i64 152, !18, i64 160, !17, i64 180, !17, i64 182, !17, i64 184, !12, i64 192, !11, i64 208, !17, i64 212, !17, i64 214, !11, i64 216, !6, i64 224, !6, i64 232, !11, i64 240, !11, i64 244, !11, i64 248, !11, i64 252, !11, i64 256, !17, i64 260, !7, i64 262, !6, i64 264}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!13 = !{!"_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}
!14 = !{!"long long", !7, i64 0}
!15 = !{!"", !7, i64 0, !16, i64 1, !16, i64 5, !17, i64 10, !16, i64 12, !16, i64 16, !17, i64 20, !17, i64 22, !17, i64 24}
!16 = !{!"", !7, i64 0}
!17 = !{!"short", !7, i64 0}
!18 = !{!"", !17, i64 0, !7, i64 2, !11, i64 4, !11, i64 8, !17, i64 12, !7, i64 14, !11, i64 16}
!19 = !{!20, !6, i64 48}
!20 = !{!"_EFI_MTFTP4_TOKEN", !14, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !6, i64 48, !14, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}
!21 = !{!20, !6, i64 32}
!22 = !{!20, !6, i64 24}
!23 = !{!11, !11, i64 0}
!24 = !{!14, !14, i64 0}
!25 = !{!20, !11, i64 40}
!26 = !{!27, !6, i64 0}
!27 = !{!"", !6, i64 0, !6, i64 8}
!28 = !{!27, !6, i64 8}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!10, !17, i64 180}
!32 = !{!7, !7, i64 0}
!33 = distinct !{!33, !30}


; 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.EFI_MTFTP4_OPTION = type { ptr, ptr }

@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [158 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @Mtftp4SendRequest(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 152
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 48
  %5 = load ptr, ptr %4, align 8, !tbaa !18
  %6 = getelementptr inbounds i8, ptr %3, i64 32
  %7 = load ptr, ptr %6, align 8, !tbaa !20
  %8 = icmp eq ptr %7, null
  %spec.store.select = select i1 %8, ptr @.str, ptr %7
  %9 = getelementptr inbounds i8, ptr %3, i64 24
  %10 = load ptr, ptr %9, align 8, !tbaa !21
  %11 = tail call i64 @AsciiStrLen(ptr noundef %10) #2
  %12 = trunc i64 %11 to i32
  %13 = tail call i64 @AsciiStrLen(ptr noundef nonnull %spec.store.select) #2
  %14 = trunc i64 %13 to i32
  %15 = add i32 %12, 4
  %16 = add i32 %15, %14
  %17 = getelementptr inbounds i8, ptr %3, i64 40
  %18 = load i32, ptr %17, align 8, !tbaa !22
  %.not = icmp eq i32 %18, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1, %.lr.ph
  %.056 = phi i64 [ %30, %.lr.ph ], [ 0, %1 ]
  %.05155 = phi i32 [ %29, %.lr.ph ], [ %16, %1 ]
  %19 = getelementptr inbounds %struct.EFI_MTFTP4_OPTION, ptr %5, i64 %.056
  %20 = load ptr, ptr %19, align 8, !tbaa !23
  %21 = tail call i64 @AsciiStrLen(ptr noundef %20) #2
  %22 = trunc i64 %21 to i32
  %23 = getelementptr inbounds i8, ptr %19, i64 8
  %24 = load ptr, ptr %23, align 8, !tbaa !25
  %25 = tail call i64 @AsciiStrLen(ptr noundef %24) #2
  %26 = trunc i64 %25 to i32
  %27 = add i32 %.05155, 2
  %28 = add i32 %27, %22
  %29 = add i32 %28, %26
  %30 = add nuw nsw i64 %.056, 1
  %31 = load i32, ptr %17, align 8, !tbaa !22
  %32 = zext i32 %31 to i64
  %33 = icmp ult i64 %30, %32
  br i1 %33, label %.lr.ph, label %._crit_edge, !llvm.loop !26

._crit_edge:                                      ; preds = %.lr.ph, %1
  %.051.lcssa = phi i32 [ %16, %1 ], [ %29, %.lr.ph ]
  %34 = tail call ptr @NetbufAlloc(i32 noundef %.051.lcssa) #2
  %35 = icmp eq ptr %34, null
  br i1 %35, label %75, label %36

36:                                               ; preds = %._crit_edge
  %37 = tail call ptr @NetbufAllocSpace(ptr noundef nonnull %34, i32 noundef %.051.lcssa, i8 noundef zeroext 0) #2
  %38 = tail call zeroext i8 @DebugAssertEnabled() #2
  %39 = icmp eq i8 %38, 0
  %40 = icmp ne ptr %37, null
  %or.cond = select i1 %39, i1 true, i1 %40
  br i1 %or.cond, label %42, label %41

41:                                               ; preds = %36
  tail call void @DebugAssert(ptr noundef nonnull @.str.1, i64 noundef 318, ptr noundef nonnull @.str.2) #2
  br label %42

42:                                               ; preds = %41, %36
  %43 = getelementptr inbounds i8, ptr %0, i64 180
  %44 = load i16, ptr %43, align 4, !tbaa !28
  %45 = tail call zeroext i16 @SwapBytes16(i16 noundef zeroext %44) #2
  store i16 %45, ptr %37, align 1, !tbaa !29
  %46 = getelementptr inbounds i8, ptr %37, i64 2
  %47 = load ptr, ptr %9, align 8, !tbaa !21
  %48 = tail call ptr @AsciiStrCpy(ptr noundef nonnull %46, ptr noundef %47) #2
  %49 = load ptr, ptr %9, align 8, !tbaa !21
  %50 = tail call i64 @AsciiStrLen(ptr noundef %49) #2
  %51 = getelementptr i8, ptr %48, i64 %50
  %52 = getelementptr i8, ptr %51, i64 1
  %53 = tail call ptr @AsciiStrCpy(ptr noundef %52, ptr noundef nonnull %spec.store.select) #2
  %54 = tail call i64 @AsciiStrLen(ptr noundef nonnull %spec.store.select) #2
  %55 = load i32, ptr %17, align 8, !tbaa !22
  %.not62 = icmp eq i32 %55, 0
  br i1 %.not62, label %._crit_edge61, label %.lr.ph60.preheader

.lr.ph60.preheader:                               ; preds = %42
  %56 = getelementptr i8, ptr %53, i64 %54
  br label %.lr.ph60

.lr.ph60:                                         ; preds = %.lr.ph60.preheader, %.lr.ph60
  %.158 = phi i64 [ %70, %.lr.ph60 ], [ 0, %.lr.ph60.preheader ]
  %.pn57 = phi ptr [ %69, %.lr.ph60 ], [ %56, %.lr.ph60.preheader ]
  %.052 = getelementptr i8, ptr %.pn57, i64 1
  %57 = getelementptr inbounds %struct.EFI_MTFTP4_OPTION, ptr %5, i64 %.158
  %58 = load ptr, ptr %57, align 8, !tbaa !23
  %59 = tail call ptr @AsciiStrCpy(ptr noundef %.052, ptr noundef %58) #2
  %60 = load ptr, ptr %57, align 8, !tbaa !23
  %61 = tail call i64 @AsciiStrLen(ptr noundef %60) #2
  %62 = getelementptr i8, ptr %59, i64 %61
  %63 = getelementptr i8, ptr %62, i64 1
  %64 = getelementptr inbounds i8, ptr %57, i64 8
  %65 = load ptr, ptr %64, align 8, !tbaa !25
  %66 = tail call ptr @AsciiStrCpy(ptr noundef %63, ptr noundef %65) #2
  %67 = load ptr, ptr %64, align 8, !tbaa !25
  %68 = tail call i64 @AsciiStrLen(ptr noundef %67) #2
  %69 = getelementptr i8, ptr %66, i64 %68
  %70 = add nuw nsw i64 %.158, 1
  %71 = load i32, ptr %17, align 8, !tbaa !22
  %72 = zext i32 %71 to i64
  %73 = icmp ult i64 %70, %72
  br i1 %73, label %.lr.ph60, label %._crit_edge61, !llvm.loop !30

._crit_edge61:                                    ; preds = %.lr.ph60, %42
  %74 = tail call i64 @Mtftp4SendPacket(ptr noundef %0, ptr noundef nonnull %34)
  br label %75

75:                                               ; preds = %._crit_edge, %._crit_edge61
  %.053 = phi i64 [ %74, %._crit_edge61 ], [ -9223372036854775799, %._crit_edge ]
  ret i64 %.053
}

declare i64 @AsciiStrLen(ptr noundef) local_unnamed_addr #1

declare ptr @NetbufAlloc(i32 noundef) local_unnamed_addr #1

declare ptr @NetbufAllocSpace(ptr noundef, i32 noundef, i8 noundef zeroext) local_unnamed_addr #1

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 ptr @AsciiStrCpy(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @Mtftp4SendPacket(ptr noundef, ptr noundef) local_unnamed_addr #0

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 = { "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 }

!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, !11, i64 152}
!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 = !{!19, !11, i64 48}
!19 = !{!"_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}
!20 = !{!19, !11, i64 32}
!21 = !{!19, !11, i64 24}
!22 = !{!19, !7, i64 40}
!23 = !{!24, !11, i64 0}
!24 = !{!"", !11, i64 0, !11, i64 8}
!25 = !{!24, !11, i64 8}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!6, !16, i64 180}
!29 = !{!8, !8, i64 0}
!30 = distinct !{!30, !27}


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