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

; 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._SOCKET = type { i32, ptr, ptr, ptr, ptr, %struct._LIST_ENTRY, i8, i32, i8, i16, %struct.EFI_LOCK, %struct._SOCK_BUFFER, %struct._SOCK_BUFFER, i64, i8, i32, i32, ptr, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, ptr, ptr, [20 x i8], %union._NET_PROTOCOL, ptr, ptr, ptr }
%struct.EFI_LOCK = type { i64, i64, i32 }
%struct._SOCK_BUFFER = type { i32, i32, ptr }
%struct._LIST_ENTRY = type { ptr, ptr }
%union._NET_PROTOCOL = type { %struct._EFI_TCP4_PROTOCOL }
%struct._EFI_TCP4_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct._TCP4_PROTO_DATA = type { ptr, ptr }
%struct._TCP4_SERVICE_DATA = type { i32, ptr, ptr, %struct._EFI_SERVICE_BINDING_PROTOCOL, ptr, %struct._LIST_ENTRY }
%struct._EFI_SERVICE_BINDING_PROTOCOL = type { ptr, ptr }
%struct._IP_IO = type { %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, ptr, ptr, %union.IP_IO_IP_PROTOCOL, i8, i8, %union.IP_IO_IP_COMPLETION_TOKEN, %struct._LIST_ENTRY, ptr, ptr, ptr, ptr, i8 }
%union.IP_IO_IP_PROTOCOL = type { ptr }
%union.IP_IO_IP_COMPLETION_TOKEN = type { %struct.EFI_IP4_COMPLETION_TOKEN }
%struct.EFI_IP4_COMPLETION_TOKEN = type { ptr, i64, %union.anon }
%union.anon = type { ptr }
%struct._EFI_IP4_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%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] }
%struct.NET_BUF_QUEUE = type { i32, i64, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, i32 }

@.str = external hidden unnamed_addr constant [157 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [48 x i8], align 1

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

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

declare zeroext i8 @DebugAssertEnabled() #2

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @Tcp4FlushPcb(ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare dso_local void @Tcp4DetachPcb(ptr noundef) #0

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

; Function Attrs: nounwind uwtable
define dso_local i64 @Tcp4Dispatcher(ptr noundef %0, i8 noundef zeroext %1, ptr noundef %2) #0 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i8 %1, ptr %6, align 1, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  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 8, ptr %10) #3
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct._SOCKET, ptr %12, i32 0, i32 26
  %14 = getelementptr inbounds [20 x i8], ptr %13, i64 0, i64 0
  store ptr %14, ptr %9, align 8, !tbaa !5
  %15 = load ptr, ptr %9, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct._TCP4_PROTO_DATA, ptr %15, i32 0, i32 1
  %17 = load ptr, ptr %16, align 8, !tbaa !10
  store ptr %17, ptr %8, align 8, !tbaa !5
  %18 = load i8, ptr %6, align 1, !tbaa !9
  %19 = zext i8 %18 to i32
  switch i32 %19, label %150 [
    i32 11, label %20
    i32 7, label %33
    i32 4, label %46
    i32 9, label %60
    i32 10, label %62
    i32 5, label %64
    i32 6, label %82
    i32 8, label %101
    i32 0, label %103
    i32 3, label %106
    i32 1, label %108
    i32 2, label %110
    i32 13, label %114
    i32 12, label %132
  ]

20:                                               ; preds = %3
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._TCP4_PROTO_DATA, ptr %21, i32 0, i32 0
  %23 = load ptr, ptr %22, align 8, !tbaa !12
  %24 = getelementptr inbounds %struct._TCP4_SERVICE_DATA, ptr %23, i32 0, i32 2
  %25 = load ptr, ptr %24, align 8, !tbaa !13
  %26 = getelementptr inbounds %struct._IP_IO, ptr %25, i32 0, i32 5
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  store ptr %27, ptr %10, align 8, !tbaa !5
  %28 = load ptr, ptr %10, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._EFI_IP4_PROTOCOL, ptr %28, i32 0, i32 7
  %30 = load ptr, ptr %29, align 8, !tbaa !18
  %31 = load ptr, ptr %10, align 8, !tbaa !5
  %32 = call i64 %30(ptr noundef %31)
  br label %151

33:                                               ; preds = %3
  br label %34

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

37:                                               ; preds = %34
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = icmp ne ptr %38, null
  br i1 %39, label %41, label %40

40:                                               ; preds = %37
  call void @DebugAssert(ptr noundef @.str, i64 noundef 645, ptr noundef @.str.5)
  br label %41

41:                                               ; preds = %40, %37
  br label %42

42:                                               ; preds = %41, %34
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  call void @TcpOnAppConsume(ptr noundef %45)
  br label %151

46:                                               ; preds = %3
  br label %47

47:                                               ; preds = %46
  %48 = call zeroext i8 @DebugAssertEnabled()
  %49 = icmp ne i8 %48, 0
  br i1 %49, label %50, label %55

50:                                               ; preds = %47
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = icmp ne ptr %51, null
  br i1 %52, label %54, label %53

53:                                               ; preds = %50
  call void @DebugAssert(ptr noundef @.str, i64 noundef 651, ptr noundef @.str.5)
  br label %54

54:                                               ; preds = %53, %50
  br label %55

55:                                               ; preds = %54, %47
  br label %56

56:                                               ; preds = %55
  br label %57

57:                                               ; preds = %56
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = call i64 @TcpOnAppSend(ptr noundef %58)
  br label %151

60:                                               ; preds = %3
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  call void @TcpOnAppClose(ptr noundef %61)
  br label %151

62:                                               ; preds = %3
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  call void @TcpOnAppAbort(ptr noundef %63)
  br label %151

64:                                               ; preds = %3
  %65 = load ptr, ptr %8, align 8, !tbaa !5
  %66 = call i32 @TcpGetMaxSndNxt(ptr noundef %65)
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct._TCP_CB, ptr %67, i32 0, i32 2
  %69 = load ptr, ptr %68, align 8, !tbaa !20
  %70 = getelementptr inbounds %struct._SOCKET, ptr %69, i32 0, i32 11
  %71 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %70, i32 0, i32 2
  %72 = load ptr, ptr %71, align 8, !tbaa !25
  %73 = getelementptr inbounds %struct.NET_BUF_QUEUE, ptr %72, i32 0, i32 4
  %74 = load i32, ptr %73, align 8, !tbaa !30
  %75 = add i32 %66, %74
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct._TCP_CB, ptr %76, i32 0, i32 15
  store i32 %75, ptr %77, align 8, !tbaa !32
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct._TCP_CB, ptr %78, i32 0, i32 7
  %80 = load i32, ptr %79, align 8, !tbaa !33
  %81 = or i32 %80, 512
  store i32 %81, ptr %79, align 8, !tbaa !33
  br label %151

82:                                               ; preds = %3
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = call i32 @TcpGetMaxSndNxt(ptr noundef %83)
  %85 = load ptr, ptr %8, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct._TCP_CB, ptr %85, i32 0, i32 2
  %87 = load ptr, ptr %86, align 8, !tbaa !20
  %88 = getelementptr inbounds %struct._SOCKET, ptr %87, i32 0, i32 11
  %89 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %88, i32 0, i32 2
  %90 = load ptr, ptr %89, align 8, !tbaa !25
  %91 = getelementptr inbounds %struct.NET_BUF_QUEUE, ptr %90, i32 0, i32 4
  %92 = load i32, ptr %91, align 8, !tbaa !30
  %93 = add i32 %84, %92
  %94 = sub i32 %93, 1
  %95 = load ptr, ptr %8, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct._TCP_CB, ptr %95, i32 0, i32 16
  store i32 %94, ptr %96, align 4, !tbaa !34
  %97 = load ptr, ptr %8, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct._TCP_CB, ptr %97, i32 0, i32 7
  %99 = load i32, ptr %98, align 8, !tbaa !33
  %100 = or i32 %99, 128
  store i32 %100, ptr %98, align 8, !tbaa !33
  br label %151

101:                                              ; preds = %3
  %102 = load ptr, ptr %8, align 8, !tbaa !5
  call void @TcpOnAppConnect(ptr noundef %102)
  br label %151

103:                                              ; preds = %3
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = call i64 @Tcp4AttachPcb(ptr noundef %104)
  store i64 %105, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %152

106:                                              ; preds = %3
  %107 = load ptr, ptr %8, align 8, !tbaa !5
  call void @Tcp4FlushPcb(ptr noundef %107)
  br label %151

108:                                              ; preds = %3
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  call void @Tcp4DetachPcb(ptr noundef %109)
  br label %151

110:                                              ; preds = %3
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = load ptr, ptr %7, align 8, !tbaa !5
  %113 = call i64 @Tcp4ConfigurePcb(ptr noundef %111, ptr noundef %112)
  store i64 %113, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %152

114:                                              ; preds = %3
  br label %115

115:                                              ; preds = %114
  %116 = call zeroext i8 @DebugAssertEnabled()
  %117 = icmp ne i8 %116, 0
  br i1 %117, label %118, label %126

118:                                              ; preds = %115
  %119 = load ptr, ptr %7, align 8, !tbaa !5
  %120 = icmp ne ptr %119, null
  br i1 %120, label %121, label %124

121:                                              ; preds = %118
  %122 = load ptr, ptr %8, align 8, !tbaa !5
  %123 = icmp ne ptr %122, null
  br i1 %123, label %125, label %124

124:                                              ; preds = %121, %118
  call void @DebugAssert(ptr noundef @.str, i64 noundef 710, ptr noundef @.str.9)
  br label %125

125:                                              ; preds = %124, %121
  br label %126

126:                                              ; preds = %125, %115
  br label %127

127:                                              ; preds = %126
  br label %128

128:                                              ; preds = %127
  %129 = load ptr, ptr %8, align 8, !tbaa !5
  %130 = load ptr, ptr %7, align 8, !tbaa !5
  %131 = call i64 @Tcp4GetMode(ptr noundef %129, ptr noundef %130)
  store i64 %131, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %152

132:                                              ; preds = %3
  br label %133

133:                                              ; preds = %132
  %134 = call zeroext i8 @DebugAssertEnabled()
  %135 = icmp ne i8 %134, 0
  br i1 %135, label %136, label %144

136:                                              ; preds = %133
  %137 = load ptr, ptr %7, align 8, !tbaa !5
  %138 = icmp ne ptr %137, null
  br i1 %138, label %139, label %142

139:                                              ; preds = %136
  %140 = load ptr, ptr %8, align 8, !tbaa !5
  %141 = icmp ne ptr %140, null
  br i1 %141, label %143, label %142

142:                                              ; preds = %139, %136
  call void @DebugAssert(ptr noundef @.str, i64 noundef 716, ptr noundef @.str.9)
  br label %143

143:                                              ; preds = %142, %139
  br label %144

144:                                              ; preds = %143, %133
  br label %145

145:                                              ; preds = %144
  br label %146

146:                                              ; preds = %145
  %147 = load ptr, ptr %8, align 8, !tbaa !5
  %148 = load ptr, ptr %7, align 8, !tbaa !5
  %149 = call i64 @Tcp4Route(ptr noundef %147, ptr noundef %148)
  store i64 %149, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %152

150:                                              ; preds = %3
  store i64 -9223372036854775805, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %152

151:                                              ; preds = %108, %106, %101, %82, %64, %62, %60, %57, %44, %20
  store i64 0, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %152

152:                                              ; preds = %151, %150, %146, %128, %110, %103
  call void @llvm.lifetime.end.p0(i64 8, 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
  %153 = load i64, ptr %4, align 8
  ret i64 %153
}

declare void @TcpOnAppConsume(ptr noundef) #2

declare i64 @TcpOnAppSend(ptr noundef) #2

declare void @TcpOnAppClose(ptr noundef) #2

declare void @TcpOnAppAbort(ptr noundef) #2

declare i32 @TcpGetMaxSndNxt(ptr noundef) #2

declare void @TcpOnAppConnect(ptr noundef) #2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !6, i64 8}
!11 = !{!"_TCP4_PROTO_DATA", !6, i64 0, !6, i64 8}
!12 = !{!11, !6, i64 0}
!13 = !{!14, !6, i64 16}
!14 = !{!"_TCP4_SERVICE_DATA", !15, i64 0, !6, i64 8, !6, i64 16, !16, i64 24, !6, i64 40, !17, i64 48}
!15 = !{!"int", !7, i64 0}
!16 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!17 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!18 = !{!19, !6, i64 56}
!19 = !{!"_EFI_IP4_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}
!20 = !{!21, !6, i64 24}
!21 = !{!"_TCP_CB", !17, i64 0, !6, i64 16, !6, i64 24, !22, i64 32, !22, i64 40, !17, i64 48, !17, i64 64, !15, i64 80, !15, i64 84, !7, i64 88, !7, i64 89, !23, i64 90, !15, i64 92, !15, i64 96, !15, i64 100, !15, i64 104, !15, i64 108, !15, i64 112, !15, i64 116, !15, i64 120, !15, i64 124, !23, i64 128, !15, i64 132, !15, i64 136, !15, i64 140, !15, i64 144, !15, i64 148, !23, i64 152, !23, i64 154, !7, i64 156, !15, i64 180, !15, i64 184, !15, i64 188, !7, i64 192, !7, i64 193, !7, i64 194, !15, i64 196, !15, i64 200, !15, i64 204, !15, i64 208, !15, i64 212, !15, i64 216, !15, i64 220, !15, i64 224, !15, i64 228, !15, i64 232, !23, i64 236, !7, i64 238, !7, i64 239, !15, i64 240, !15, i64 244, !15, i64 248, !7, i64 252, !7, i64 253, !23, i64 254, !15, i64 256, !15, i64 260, !15, i64 264, !7, i64 268, !7, i64 269, !7, i64 270, !24, i64 271, !6, i64 280}
!22 = !{!"_TCP_PEER", !15, i64 0, !23, i64 4}
!23 = !{!"short", !7, i64 0}
!24 = !{!"", !7, i64 0}
!25 = !{!26, !6, i64 104}
!26 = !{!"_SOCKET", !15, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !17, i64 40, !7, i64 56, !15, i64 60, !7, i64 64, !23, i64 66, !27, i64 72, !29, i64 96, !29, i64 112, !28, i64 128, !7, i64 136, !15, i64 140, !15, i64 144, !6, i64 152, !17, i64 160, !17, i64 176, !17, i64 192, !17, i64 208, !17, i64 224, !6, i64 240, !6, i64 248, !6, i64 256, !7, i64 264, !7, i64 288, !6, i64 368, !6, i64 376, !6, i64 384}
!27 = !{!"", !28, i64 0, !28, i64 8, !15, i64 16}
!28 = !{!"long long", !7, i64 0}
!29 = !{!"_SOCK_BUFFER", !15, i64 0, !15, i64 4, !6, i64 8}
!30 = !{!31, !15, i64 48}
!31 = !{!"", !15, i64 0, !28, i64 8, !17, i64 16, !17, i64 32, !15, i64 48, !15, i64 52}
!32 = !{!21, !15, i64 104}
!33 = !{!21, !15, i64 80}
!34 = !{!21, !15, i64 108}


; 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 [157 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [48 x i8], align 1

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @Tcp4FlushPcb(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local void @Tcp4DetachPcb(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local i64 @Tcp4Dispatcher(ptr noundef %0, i8 noundef zeroext %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 272
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  switch i8 %1, label %81 [
    i8 11, label %6
    i8 7, label %16
    i8 4, label %22
    i8 9, label %29
    i8 10, label %30
    i8 5, label %31
    i8 6, label %44
    i8 8, label %58
    i8 0, label %59
    i8 3, label %61
    i8 1, label %62
    i8 2, label %63
    i8 13, label %65
    i8 12, label %73
  ]

6:                                                ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 264
  %8 = load ptr, ptr %7, align 8, !tbaa !10
  %9 = getelementptr inbounds i8, ptr %8, i64 16
  %10 = load ptr, ptr %9, align 8, !tbaa !11
  %11 = getelementptr inbounds i8, ptr %10, i64 56
  %12 = load ptr, ptr %11, align 8, !tbaa !16
  %13 = getelementptr inbounds i8, ptr %12, i64 56
  %14 = load ptr, ptr %13, align 8, !tbaa !17
  %15 = tail call i64 %14(ptr noundef %12) #2
  br label %81

16:                                               ; preds = %3
  %17 = tail call zeroext i8 @DebugAssertEnabled() #2
  %18 = icmp eq i8 %17, 0
  %19 = icmp ne ptr %5, null
  %or.cond5 = select i1 %18, i1 true, i1 %19
  br i1 %or.cond5, label %21, label %20

20:                                               ; preds = %16
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 645, ptr noundef nonnull @.str.5) #2
  br label %21

21:                                               ; preds = %20, %16
  tail call void @TcpOnAppConsume(ptr noundef %5) #2
  br label %81

22:                                               ; preds = %3
  %23 = tail call zeroext i8 @DebugAssertEnabled() #2
  %24 = icmp eq i8 %23, 0
  %25 = icmp ne ptr %5, null
  %or.cond7 = select i1 %24, i1 true, i1 %25
  br i1 %or.cond7, label %27, label %26

26:                                               ; preds = %22
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 651, ptr noundef nonnull @.str.5) #2
  br label %27

27:                                               ; preds = %26, %22
  %28 = tail call i64 @TcpOnAppSend(ptr noundef %5) #2
  br label %81

29:                                               ; preds = %3
  tail call void @TcpOnAppClose(ptr noundef %5) #2
  br label %81

30:                                               ; preds = %3
  tail call void @TcpOnAppAbort(ptr noundef %5) #2
  br label %81

31:                                               ; preds = %3
  %32 = tail call i32 @TcpGetMaxSndNxt(ptr noundef %5) #2
  %33 = getelementptr inbounds i8, ptr %5, i64 24
  %34 = load ptr, ptr %33, align 8, !tbaa !19
  %35 = getelementptr inbounds i8, ptr %34, i64 104
  %36 = load ptr, ptr %35, align 8, !tbaa !24
  %37 = getelementptr inbounds i8, ptr %36, i64 48
  %38 = load i32, ptr %37, align 8, !tbaa !29
  %39 = add i32 %38, %32
  %40 = getelementptr inbounds i8, ptr %5, i64 104
  store i32 %39, ptr %40, align 8, !tbaa !31
  %41 = getelementptr inbounds i8, ptr %5, i64 80
  %42 = load i32, ptr %41, align 8, !tbaa !32
  %43 = or i32 %42, 512
  store i32 %43, ptr %41, align 8, !tbaa !32
  br label %81

44:                                               ; preds = %3
  %45 = tail call i32 @TcpGetMaxSndNxt(ptr noundef %5) #2
  %46 = getelementptr inbounds i8, ptr %5, i64 24
  %47 = load ptr, ptr %46, align 8, !tbaa !19
  %48 = getelementptr inbounds i8, ptr %47, i64 104
  %49 = load ptr, ptr %48, align 8, !tbaa !24
  %50 = getelementptr inbounds i8, ptr %49, i64 48
  %51 = load i32, ptr %50, align 8, !tbaa !29
  %52 = add i32 %45, -1
  %53 = add i32 %52, %51
  %54 = getelementptr inbounds i8, ptr %5, i64 108
  store i32 %53, ptr %54, align 4, !tbaa !33
  %55 = getelementptr inbounds i8, ptr %5, i64 80
  %56 = load i32, ptr %55, align 8, !tbaa !32
  %57 = or i32 %56, 128
  store i32 %57, ptr %55, align 8, !tbaa !32
  br label %81

58:                                               ; preds = %3
  tail call void @TcpOnAppConnect(ptr noundef %5) #2
  br label %81

59:                                               ; preds = %3
  %60 = tail call i64 @Tcp4AttachPcb(ptr noundef nonnull %0)
  br label %81

61:                                               ; preds = %3
  tail call void @Tcp4FlushPcb(ptr noundef %5)
  br label %81

62:                                               ; preds = %3
  tail call void @Tcp4DetachPcb(ptr noundef nonnull %0)
  br label %81

63:                                               ; preds = %3
  %64 = tail call i64 @Tcp4ConfigurePcb(ptr noundef nonnull %0, ptr noundef %2)
  br label %81

65:                                               ; preds = %3
  %66 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not41 = icmp eq i8 %66, 0
  br i1 %.not41, label %71, label %67

67:                                               ; preds = %65
  %68 = icmp ne ptr %2, null
  %69 = icmp ne ptr %5, null
  %or.cond = select i1 %68, i1 %69, i1 false
  br i1 %or.cond, label %71, label %70

70:                                               ; preds = %67
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 710, ptr noundef nonnull @.str.9) #2
  br label %71

71:                                               ; preds = %70, %67, %65
  %72 = tail call i64 @Tcp4GetMode(ptr noundef %5, ptr noundef %2)
  br label %81

73:                                               ; preds = %3
  %74 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not = icmp eq i8 %74, 0
  br i1 %.not, label %79, label %75

75:                                               ; preds = %73
  %76 = icmp ne ptr %2, null
  %77 = icmp ne ptr %5, null
  %or.cond3 = select i1 %76, i1 %77, i1 false
  br i1 %or.cond3, label %79, label %78

78:                                               ; preds = %75
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 716, ptr noundef nonnull @.str.9) #2
  br label %79

79:                                               ; preds = %78, %75, %73
  %80 = tail call i64 @Tcp4Route(ptr noundef %5, ptr noundef %2)
  br label %81

81:                                               ; preds = %6, %21, %27, %29, %30, %31, %44, %58, %61, %62, %3, %79, %71, %63, %59
  %.0 = phi i64 [ %80, %79 ], [ %72, %71 ], [ %64, %63 ], [ %60, %59 ], [ -9223372036854775805, %3 ], [ 0, %62 ], [ 0, %61 ], [ 0, %58 ], [ 0, %44 ], [ 0, %31 ], [ 0, %30 ], [ 0, %29 ], [ 0, %27 ], [ 0, %21 ], [ 0, %6 ]
  ret i64 %.0
}

declare void @TcpOnAppConsume(ptr noundef) local_unnamed_addr #1

declare i64 @TcpOnAppSend(ptr noundef) local_unnamed_addr #1

declare void @TcpOnAppClose(ptr noundef) local_unnamed_addr #1

declare void @TcpOnAppAbort(ptr noundef) local_unnamed_addr #1

declare i32 @TcpGetMaxSndNxt(ptr noundef) local_unnamed_addr #1

declare void @TcpOnAppConnect(ptr noundef) local_unnamed_addr #1

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


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