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

; 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.TCP_HEAD = type { i16, i16, i32, i32, i8, i8, i16, i16, i16 }
%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] }
%struct._LIST_ENTRY = type { ptr, ptr }
%union.NET_IP_HEAD = type { ptr }
%struct.NET_BLOCK_OP = type { ptr, ptr, ptr, ptr, i32 }
%struct._TCP_CB = type { %struct._LIST_ENTRY, ptr, ptr, %struct._TCP_PEER, %struct._TCP_PEER, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, i32, i8, i8, i16, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i32, i32, i32, i32, i32, i16, i16, [6 x i32], i32, i32, i32, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i8, i8, i32, i32, i32, i8, i8, i16, i32, i32, i32, i8, i8, i8, %struct.EFI_IPv4_ADDRESS, ptr }
%struct._TCP_PEER = type { i32, i16 }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }

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

declare zeroext i8 @DebugAssertEnabled() #1

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

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

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

declare i32 @SwapBytes32(i32 noundef) #1

declare zeroext i16 @TcpChecksum(ptr noundef, i16 noundef zeroext) #1

declare i64 @TcpSendIpPacket(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #1

declare ptr @NetbufAlloc(i32 noundef) #1

declare void @NetbufFree(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i64 @TcpSendReset(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) #2 {
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i16, align 2
  %15 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i32 %2, ptr %9, align 4, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %14) #3
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.TCP_HEAD, ptr %16, i32 0, i32 5
  %18 = load i8, ptr %17, align 1, !tbaa !11
  %19 = zext i8 %18 to i32
  %20 = and i32 %19, 4
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %22, label %23

22:                                               ; preds = %5
  store i64 0, ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %147

23:                                               ; preds = %5
  %24 = call ptr @NetbufAlloc(i32 noundef 192)
  store ptr %24, ptr %12, align 8, !tbaa !5
  %25 = load ptr, ptr %12, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %28

27:                                               ; preds = %23
  store i64 -1, ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %147

28:                                               ; preds = %23
  %29 = load ptr, ptr %12, align 8, !tbaa !5
  %30 = call ptr @NetbufAllocSpace(ptr noundef %29, i32 noundef 20, i8 noundef zeroext 0)
  store ptr %30, ptr %13, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %28
  %32 = call zeroext i8 @DebugAssertEnabled()
  %33 = icmp ne i8 %32, 0
  br i1 %33, label %34, label %39

34:                                               ; preds = %31
  %35 = load ptr, ptr %13, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %38, label %37

37:                                               ; preds = %34
  call void @DebugAssert(ptr noundef @.str, i64 noundef 1069, ptr noundef @.str.27)
  br label %38

38:                                               ; preds = %37, %34
  br label %39

39:                                               ; preds = %38, %31
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40
  %42 = load ptr, ptr %13, align 8, !tbaa !5
  %43 = load ptr, ptr %12, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.NET_BUF, ptr %43, i32 0, i32 4
  store ptr %42, ptr %44, align 8, !tbaa !14
  %45 = load ptr, ptr %13, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.TCP_HEAD, ptr %45, i32 0, i32 5
  store i8 4, ptr %46, align 1, !tbaa !11
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = icmp eq ptr %47, null
  br i1 %48, label %49, label %86

49:                                               ; preds = %41
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.TCP_HEAD, ptr %50, i32 0, i32 5
  %52 = load i8, ptr %51, align 1, !tbaa !11
  %53 = zext i8 %52 to i32
  %54 = and i32 %53, 16
  %55 = icmp ne i32 %54, 0
  %56 = zext i1 %55 to i32
  %57 = trunc i32 %56 to i8
  %58 = icmp ne i8 %57, 0
  br i1 %58, label %59, label %67

59:                                               ; preds = %49
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.TCP_HEAD, ptr %60, i32 0, i32 3
  %62 = load i32, ptr %61, align 1, !tbaa !18
  %63 = load ptr, ptr %13, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.TCP_HEAD, ptr %63, i32 0, i32 2
  store i32 %62, ptr %64, align 1, !tbaa !19
  %65 = load ptr, ptr %13, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.TCP_HEAD, ptr %65, i32 0, i32 3
  store i32 0, ptr %66, align 1, !tbaa !18
  br label %85

67:                                               ; preds = %49
  %68 = load ptr, ptr %13, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.TCP_HEAD, ptr %68, i32 0, i32 2
  store i32 0, ptr %69, align 1, !tbaa !19
  %70 = load ptr, ptr %13, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.TCP_HEAD, ptr %70, i32 0, i32 5
  %72 = load i8, ptr %71, align 1, !tbaa !11
  %73 = zext i8 %72 to i32
  %74 = or i32 %73, 16
  %75 = trunc i32 %74 to i8
  store i8 %75, ptr %71, align 1, !tbaa !11
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.TCP_HEAD, ptr %76, i32 0, i32 2
  %78 = load i32, ptr %77, align 1, !tbaa !19
  %79 = call i32 @SwapBytes32(i32 noundef %78)
  %80 = load i32, ptr %9, align 4, !tbaa !9
  %81 = add i32 %79, %80
  %82 = call i32 @SwapBytes32(i32 noundef %81)
  %83 = load ptr, ptr %13, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.TCP_HEAD, ptr %83, i32 0, i32 3
  store i32 %82, ptr %84, align 1, !tbaa !18
  br label %85

85:                                               ; preds = %67, %59
  br label %105

86:                                               ; preds = %41
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct._TCP_CB, ptr %87, i32 0, i32 14
  %89 = load i32, ptr %88, align 4, !tbaa !20
  %90 = call i32 @SwapBytes32(i32 noundef %89)
  %91 = load ptr, ptr %13, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.TCP_HEAD, ptr %91, i32 0, i32 2
  store i32 %90, ptr %92, align 1, !tbaa !19
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct._TCP_CB, ptr %93, i32 0, i32 22
  %95 = load i32, ptr %94, align 4, !tbaa !24
  %96 = call i32 @SwapBytes32(i32 noundef %95)
  %97 = load ptr, ptr %13, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.TCP_HEAD, ptr %97, i32 0, i32 3
  store i32 %96, ptr %98, align 1, !tbaa !18
  %99 = load ptr, ptr %13, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.TCP_HEAD, ptr %99, i32 0, i32 5
  %101 = load i8, ptr %100, align 1, !tbaa !11
  %102 = zext i8 %101 to i32
  %103 = or i32 %102, 16
  %104 = trunc i32 %103 to i8
  store i8 %104, ptr %100, align 1, !tbaa !11
  br label %105

105:                                              ; preds = %86, %85
  %106 = load ptr, ptr %8, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.TCP_HEAD, ptr %106, i32 0, i32 1
  %108 = load i16, ptr %107, align 1, !tbaa !25
  %109 = load ptr, ptr %13, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.TCP_HEAD, ptr %109, i32 0, i32 0
  store i16 %108, ptr %110, align 1, !tbaa !26
  %111 = load ptr, ptr %8, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.TCP_HEAD, ptr %111, i32 0, i32 0
  %113 = load i16, ptr %112, align 1, !tbaa !26
  %114 = load ptr, ptr %13, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.TCP_HEAD, ptr %114, i32 0, i32 1
  store i16 %113, ptr %115, align 1, !tbaa !25
  %116 = load ptr, ptr %13, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.TCP_HEAD, ptr %116, i32 0, i32 4
  %118 = load i8, ptr %117, align 1
  %119 = and i8 %118, 15
  %120 = or i8 %119, 80
  store i8 %120, ptr %117, align 1
  %121 = load ptr, ptr %13, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.TCP_HEAD, ptr %121, i32 0, i32 4
  %123 = load i8, ptr %122, align 1
  %124 = and i8 %123, -16
  %125 = or i8 %124, 0
  store i8 %125, ptr %122, align 1
  %126 = call zeroext i16 @SwapBytes16(i16 noundef zeroext -1)
  %127 = load ptr, ptr %13, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.TCP_HEAD, ptr %127, i32 0, i32 6
  store i16 %126, ptr %128, align 1, !tbaa !27
  %129 = load ptr, ptr %13, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.TCP_HEAD, ptr %129, i32 0, i32 7
  store i16 0, ptr %130, align 1, !tbaa !28
  %131 = load ptr, ptr %13, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.TCP_HEAD, ptr %131, i32 0, i32 8
  store i16 0, ptr %132, align 1, !tbaa !29
  %133 = load i32, ptr %10, align 4, !tbaa !9
  %134 = load i32, ptr %11, align 4, !tbaa !9
  %135 = call zeroext i16 @NetPseudoHeadChecksum(i32 noundef %133, i32 noundef %134, i8 noundef zeroext 6, i16 noundef zeroext 0)
  store i16 %135, ptr %14, align 2, !tbaa !30
  %136 = load ptr, ptr %12, align 8, !tbaa !5
  %137 = load i16, ptr %14, align 2, !tbaa !30
  %138 = call zeroext i16 @TcpChecksum(ptr noundef %136, i16 noundef zeroext %137)
  %139 = load ptr, ptr %13, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.TCP_HEAD, ptr %139, i32 0, i32 7
  store i16 %138, ptr %140, align 1, !tbaa !28
  %141 = load ptr, ptr %7, align 8, !tbaa !5
  %142 = load ptr, ptr %12, align 8, !tbaa !5
  %143 = load i32, ptr %10, align 4, !tbaa !9
  %144 = load i32, ptr %11, align 4, !tbaa !9
  %145 = call i64 @TcpSendIpPacket(ptr noundef %141, ptr noundef %142, i32 noundef %143, i32 noundef %144)
  %146 = load ptr, ptr %12, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %146)
  store i64 0, ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %147

147:                                              ; preds = %105, %27, %22
  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 8, ptr %12) #3
  %148 = load i64, ptr %6, align 8
  ret i64 %148
}

declare zeroext i16 @NetPseudoHeadChecksum(i32 noundef, i32 noundef, i8 noundef zeroext, i16 noundef zeroext) #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 = !{!12, !7, i64 13}
!12 = !{!"", !13, i64 0, !13, i64 2, !10, i64 4, !10, i64 8, !7, i64 12, !7, i64 12, !7, i64 13, !13, i64 14, !13, i64 16, !13, i64 18}
!13 = !{!"short", !7, i64 0}
!14 = !{!15, !6, i64 40}
!15 = !{!"", !10, i64 0, !16, i64 8, !17, i64 16, !7, i64 32, !6, i64 40, !6, i64 48, !7, i64 56, !6, i64 120, !10, i64 128, !10, i64 132, !7, i64 136}
!16 = !{!"long long", !7, i64 0}
!17 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!18 = !{!12, !10, i64 8}
!19 = !{!12, !10, i64 4}
!20 = !{!21, !10, i64 100}
!21 = !{!"_TCP_CB", !17, i64 0, !6, i64 16, !6, i64 24, !22, i64 32, !22, i64 40, !17, i64 48, !17, i64 64, !10, i64 80, !10, i64 84, !7, i64 88, !7, i64 89, !13, i64 90, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !13, i64 128, !10, i64 132, !10, i64 136, !10, i64 140, !10, i64 144, !10, i64 148, !13, i64 152, !13, i64 154, !7, i64 156, !10, i64 180, !10, i64 184, !10, i64 188, !7, i64 192, !7, i64 193, !7, i64 194, !10, i64 196, !10, i64 200, !10, i64 204, !10, i64 208, !10, i64 212, !10, i64 216, !10, i64 220, !10, i64 224, !10, i64 228, !10, i64 232, !13, i64 236, !7, i64 238, !7, i64 239, !10, i64 240, !10, i64 244, !10, i64 248, !7, i64 252, !7, i64 253, !13, i64 254, !10, i64 256, !10, i64 260, !10, i64 264, !7, i64 268, !7, i64 269, !7, i64 270, !23, i64 271, !6, i64 280}
!22 = !{!"_TCP_PEER", !10, i64 0, !13, i64 4}
!23 = !{!"", !7, i64 0}
!24 = !{!21, !10, i64 132}
!25 = !{!12, !13, i64 2}
!26 = !{!12, !13, i64 0}
!27 = !{!12, !13, i64 14}
!28 = !{!12, !13, i64 16}
!29 = !{!12, !13, i64 18}
!30 = !{!13, !13, i64 0}


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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #0

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

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

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

declare i32 @SwapBytes32(i32 noundef) local_unnamed_addr #0

declare zeroext i16 @TcpChecksum(ptr noundef, i16 noundef zeroext) local_unnamed_addr #0

declare i64 @TcpSendIpPacket(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

declare ptr @NetbufAlloc(i32 noundef) local_unnamed_addr #0

declare void @NetbufFree(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i64 -1, 1) i64 @TcpSendReset(ptr noundef %0, ptr nocapture noundef readonly %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #1 {
  %6 = getelementptr inbounds i8, ptr %1, i64 13
  %7 = load i8, ptr %6, align 1, !tbaa !5
  %8 = and i8 %7, 4
  %.not = icmp eq i8 %8, 0
  br i1 %.not, label %9, label %62

9:                                                ; preds = %5
  %10 = tail call ptr @NetbufAlloc(i32 noundef 192) #2
  %11 = icmp eq ptr %10, null
  br i1 %11, label %62, label %12

12:                                               ; preds = %9
  %13 = tail call ptr @NetbufAllocSpace(ptr noundef nonnull %10, i32 noundef 20, i8 noundef zeroext 0) #2
  %14 = tail call zeroext i8 @DebugAssertEnabled() #2
  %15 = icmp eq i8 %14, 0
  %16 = icmp ne ptr %13, null
  %or.cond = select i1 %15, i1 true, i1 %16
  br i1 %or.cond, label %18, label %17

17:                                               ; preds = %12
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 1069, ptr noundef nonnull @.str.27) #2
  br label %18

18:                                               ; preds = %17, %12
  %19 = getelementptr inbounds i8, ptr %10, i64 40
  store ptr %13, ptr %19, align 8, !tbaa !11
  %20 = getelementptr inbounds i8, ptr %13, i64 13
  store i8 4, ptr %20, align 1, !tbaa !5
  %21 = icmp eq ptr %0, null
  br i1 %21, label %22, label %38

22:                                               ; preds = %18
  %23 = load i8, ptr %6, align 1, !tbaa !5
  %24 = and i8 %23, 16
  %.not44 = icmp eq i8 %24, 0
  br i1 %.not44, label %30, label %25

25:                                               ; preds = %22
  %26 = getelementptr inbounds i8, ptr %1, i64 8
  %27 = load i32, ptr %26, align 1, !tbaa !16
  %28 = getelementptr inbounds i8, ptr %13, i64 4
  store i32 %27, ptr %28, align 1, !tbaa !17
  %29 = getelementptr inbounds i8, ptr %13, i64 8
  store i32 0, ptr %29, align 1, !tbaa !16
  br label %49

30:                                               ; preds = %22
  %31 = getelementptr inbounds i8, ptr %13, i64 4
  store i32 0, ptr %31, align 1, !tbaa !17
  store i8 20, ptr %20, align 1, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %1, i64 4
  %33 = load i32, ptr %32, align 1, !tbaa !17
  %34 = tail call i32 @SwapBytes32(i32 noundef %33) #2
  %35 = add i32 %34, %2
  %36 = tail call i32 @SwapBytes32(i32 noundef %35) #2
  %37 = getelementptr inbounds i8, ptr %13, i64 8
  store i32 %36, ptr %37, align 1, !tbaa !16
  br label %49

38:                                               ; preds = %18
  %39 = getelementptr inbounds i8, ptr %0, i64 100
  %40 = load i32, ptr %39, align 4, !tbaa !18
  %41 = tail call i32 @SwapBytes32(i32 noundef %40) #2
  %42 = getelementptr inbounds i8, ptr %13, i64 4
  store i32 %41, ptr %42, align 1, !tbaa !17
  %43 = getelementptr inbounds i8, ptr %0, i64 132
  %44 = load i32, ptr %43, align 4, !tbaa !22
  %45 = tail call i32 @SwapBytes32(i32 noundef %44) #2
  %46 = getelementptr inbounds i8, ptr %13, i64 8
  store i32 %45, ptr %46, align 1, !tbaa !16
  %47 = load i8, ptr %20, align 1, !tbaa !5
  %48 = or i8 %47, 16
  store i8 %48, ptr %20, align 1, !tbaa !5
  br label %49

49:                                               ; preds = %25, %30, %38
  %50 = getelementptr inbounds i8, ptr %1, i64 2
  %51 = load i16, ptr %50, align 1, !tbaa !23
  store i16 %51, ptr %13, align 1, !tbaa !24
  %52 = load i16, ptr %1, align 1, !tbaa !24
  %53 = getelementptr inbounds i8, ptr %13, i64 2
  store i16 %52, ptr %53, align 1, !tbaa !23
  %54 = getelementptr inbounds i8, ptr %13, i64 12
  store i8 80, ptr %54, align 1
  %55 = tail call zeroext i16 @SwapBytes16(i16 noundef zeroext -1) #2
  %56 = getelementptr inbounds i8, ptr %13, i64 14
  store i16 %55, ptr %56, align 1, !tbaa !25
  %57 = getelementptr inbounds i8, ptr %13, i64 16
  store i16 0, ptr %57, align 1, !tbaa !26
  %58 = getelementptr inbounds i8, ptr %13, i64 18
  store i16 0, ptr %58, align 1, !tbaa !27
  %59 = tail call zeroext i16 @NetPseudoHeadChecksum(i32 noundef %3, i32 noundef %4, i8 noundef zeroext 6, i16 noundef zeroext 0) #2
  %60 = tail call zeroext i16 @TcpChecksum(ptr noundef nonnull %10, i16 noundef zeroext %59) #2
  store i16 %60, ptr %57, align 1, !tbaa !26
  %61 = tail call i64 @TcpSendIpPacket(ptr noundef %0, ptr noundef nonnull %10, i32 noundef %3, i32 noundef %4) #2
  tail call void @NetbufFree(ptr noundef nonnull %10) #2
  br label %62

62:                                               ; preds = %9, %5, %49
  %.0 = phi i64 [ 0, %49 ], [ 0, %5 ], [ -1, %9 ]
  ret i64 %.0
}

declare zeroext i16 @NetPseudoHeadChecksum(i32 noundef, i32 noundef, i8 noundef zeroext, i16 noundef zeroext) local_unnamed_addr #0

attributes #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 = { 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 = { 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, !8, i64 13}
!6 = !{!"", !7, i64 0, !7, i64 2, !10, i64 4, !10, i64 8, !8, i64 12, !8, i64 12, !8, i64 13, !7, i64 14, !7, i64 16, !7, i64 18}
!7 = !{!"short", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!12, !15, i64 40}
!12 = !{!"", !10, i64 0, !13, i64 8, !14, i64 16, !8, i64 32, !15, i64 40, !15, i64 48, !8, i64 56, !15, i64 120, !10, i64 128, !10, i64 132, !8, i64 136}
!13 = !{!"long long", !8, i64 0}
!14 = !{!"_LIST_ENTRY", !15, i64 0, !15, i64 8}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!6, !10, i64 8}
!17 = !{!6, !10, i64 4}
!18 = !{!19, !10, i64 100}
!19 = !{!"_TCP_CB", !14, i64 0, !15, i64 16, !15, i64 24, !20, i64 32, !20, i64 40, !14, i64 48, !14, i64 64, !10, i64 80, !10, i64 84, !8, i64 88, !8, i64 89, !7, i64 90, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !7, i64 128, !10, i64 132, !10, i64 136, !10, i64 140, !10, i64 144, !10, i64 148, !7, i64 152, !7, i64 154, !8, i64 156, !10, i64 180, !10, i64 184, !10, i64 188, !8, i64 192, !8, i64 193, !8, i64 194, !10, i64 196, !10, i64 200, !10, i64 204, !10, i64 208, !10, i64 212, !10, i64 216, !10, i64 220, !10, i64 224, !10, i64 228, !10, i64 232, !7, i64 236, !8, i64 238, !8, i64 239, !10, i64 240, !10, i64 244, !10, i64 248, !8, i64 252, !8, i64 253, !7, i64 254, !10, i64 256, !10, i64 260, !10, i64 264, !8, i64 268, !8, i64 269, !8, i64 270, !21, i64 271, !15, i64 280}
!20 = !{!"_TCP_PEER", !10, i64 0, !7, i64 4}
!21 = !{!"", !8, i64 0}
!22 = !{!19, !10, i64 132}
!23 = !{!6, !7, i64 2}
!24 = !{!6, !7, i64 0}
!25 = !{!6, !7, i64 14}
!26 = !{!6, !7, i64 16}
!27 = !{!6, !7, i64 18}


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