; LLVM IR from whoiswelliton/Computer_Engineering_UTFPR-PB :: Embedded_Systems/TIVA Connected TM4C1294XL Projects/01 - lwIP_HTTPServer_on_TIVA (delconn)

; 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.api_msg = type { ptr, i8, %union.anon }
%union.anon = type { %struct.anon.2 }
%struct.anon.2 = type { ptr, i16, i64, i64, i64, i8, i32 }
%struct.netconn = type { i32, i32, %union.anon.5, i8, ptr, ptr, ptr, i32, i32, i32, i8, ptr, ptr }
%union.anon.5 = type { ptr }
%struct.udp_pcb = type { %struct.ip4_addr, %struct.ip4_addr, i8, i8, i8, i8, ptr, i8, i16, i16, ptr, ptr }
%struct.ip4_addr = type { i32 }
%struct.anon.4 = type { i8, i32 }

@.str = external hidden unnamed_addr constant [40 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [181 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [7 x i8], align 1
@lock_tcpip_core = external global ptr, align 8

declare i32 @printf(ptr noundef, ...) #0

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

; 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
define dso_local void @lwip_netconn_do_delconn(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %6, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.api_msg, ptr %7, i32 0, i32 0
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %10 = getelementptr inbounds %struct.netconn, ptr %9, i32 0, i32 1
  %11 = load i32, ptr %10, align 4, !tbaa !11
  store i32 %11, ptr %4, align 4, !tbaa !14
  br label %12

12:                                               ; preds = %1
  %13 = load i32, ptr %4, align 4, !tbaa !14
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %28, label %15

15:                                               ; preds = %12
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.api_msg, ptr %16, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  %19 = getelementptr inbounds %struct.netconn, ptr %18, i32 0, i32 0
  %20 = load i32, ptr %19, align 8, !tbaa !15
  %21 = and i32 %20, 240
  %22 = icmp eq i32 %21, 16
  br i1 %22, label %28, label %23

23:                                               ; preds = %15
  br label %24

24:                                               ; preds = %23
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.7, i32 noundef 1119, ptr noundef @.str.2)
  br label %26

26:                                               ; preds = %24
  br label %27

27:                                               ; preds = %26
  br label %28

28:                                               ; preds = %27, %15, %12
  br label %29

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %29
  %31 = load i32, ptr %4, align 4, !tbaa !14
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %39

33:                                               ; preds = %30
  %34 = load i32, ptr %4, align 4, !tbaa !14
  %35 = icmp ne i32 %34, 2
  br i1 %35, label %36, label %39

36:                                               ; preds = %33
  %37 = load i32, ptr %4, align 4, !tbaa !14
  %38 = icmp ne i32 %37, 3
  br i1 %38, label %51, label %39

39:                                               ; preds = %36, %33, %30
  %40 = load i32, ptr %4, align 4, !tbaa !14
  %41 = icmp eq i32 %40, 3
  br i1 %41, label %42, label %54

42:                                               ; preds = %39
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.api_msg, ptr %43, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !9
  %46 = getelementptr inbounds %struct.netconn, ptr %45, i32 0, i32 10
  %47 = load i8, ptr %46, align 4, !tbaa !16
  %48 = zext i8 %47 to i32
  %49 = and i32 %48, 4
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %54, label %51

51:                                               ; preds = %42, %36
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.api_msg, ptr %52, i32 0, i32 1
  store i8 -5, ptr %53, align 8, !tbaa !17
  br label %215

54:                                               ; preds = %42, %39
  br label %55

55:                                               ; preds = %54
  %56 = load i32, ptr %4, align 4, !tbaa !14
  %57 = icmp ne i32 %56, 3
  br i1 %57, label %72, label %58

58:                                               ; preds = %55
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.api_msg, ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !9
  %62 = getelementptr inbounds %struct.netconn, ptr %61, i32 0, i32 10
  %63 = load i8, ptr %62, align 4, !tbaa !16
  %64 = zext i8 %63 to i32
  %65 = and i32 %64, 4
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %72, label %67

67:                                               ; preds = %58
  br label %68

68:                                               ; preds = %67
  %69 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.8, i32 noundef 1147, ptr noundef @.str.2)
  br label %70

70:                                               ; preds = %68
  br label %71

71:                                               ; preds = %70
  br label %72

72:                                               ; preds = %71, %58, %55
  br label %73

73:                                               ; preds = %72
  br label %74

74:                                               ; preds = %73
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.api_msg, ptr %75, i32 0, i32 1
  store i8 0, ptr %76, align 8, !tbaa !17
  %77 = load ptr, ptr %3, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.api_msg, ptr %77, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8, !tbaa !9
  call void @netconn_drain(ptr noundef %79)
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.api_msg, ptr %80, i32 0, i32 0
  %82 = load ptr, ptr %81, align 8, !tbaa !9
  %83 = getelementptr inbounds %struct.netconn, ptr %82, i32 0, i32 2
  %84 = load ptr, ptr %83, align 8, !tbaa !18
  %85 = icmp ne ptr %84, null
  br i1 %85, label %86, label %182

86:                                               ; preds = %74
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.api_msg, ptr %87, i32 0, i32 0
  %89 = load ptr, ptr %88, align 8, !tbaa !9
  %90 = getelementptr inbounds %struct.netconn, ptr %89, i32 0, i32 0
  %91 = load i32, ptr %90, align 8, !tbaa !15
  %92 = and i32 %91, 240
  switch i32 %92, label %176 [
    i32 32, label %93
    i32 16, label %105
  ]

93:                                               ; preds = %86
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.api_msg, ptr %94, i32 0, i32 0
  %96 = load ptr, ptr %95, align 8, !tbaa !9
  %97 = getelementptr inbounds %struct.netconn, ptr %96, i32 0, i32 2
  %98 = load ptr, ptr %97, align 8, !tbaa !18
  %99 = getelementptr inbounds %struct.udp_pcb, ptr %98, i32 0, i32 11
  store ptr null, ptr %99, align 8, !tbaa !19
  %100 = load ptr, ptr %3, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.api_msg, ptr %100, i32 0, i32 0
  %102 = load ptr, ptr %101, align 8, !tbaa !9
  %103 = getelementptr inbounds %struct.netconn, ptr %102, i32 0, i32 2
  %104 = load ptr, ptr %103, align 8, !tbaa !18
  call void @udp_remove(ptr noundef %104)
  br label %177

105:                                              ; preds = %86
  br label %106

106:                                              ; preds = %105
  %107 = load ptr, ptr %3, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.api_msg, ptr %107, i32 0, i32 0
  %109 = load ptr, ptr %108, align 8, !tbaa !9
  %110 = getelementptr inbounds %struct.netconn, ptr %109, i32 0, i32 11
  %111 = load ptr, ptr %110, align 8, !tbaa !23
  %112 = icmp eq ptr %111, null
  br i1 %112, label %118, label %113

113:                                              ; preds = %106
  br label %114

114:                                              ; preds = %113
  %115 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.9, i32 noundef 1172, ptr noundef @.str.2)
  br label %116

116:                                              ; preds = %114
  br label %117

117:                                              ; preds = %116
  br label %118

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

119:                                              ; preds = %118
  br label %120

120:                                              ; preds = %119
  %121 = load ptr, ptr %3, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.api_msg, ptr %121, i32 0, i32 0
  %123 = load ptr, ptr %122, align 8, !tbaa !9
  %124 = getelementptr inbounds %struct.netconn, ptr %123, i32 0, i32 1
  store i32 4, ptr %124, align 4, !tbaa !11
  %125 = load ptr, ptr %3, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.api_msg, ptr %125, i32 0, i32 2
  %127 = getelementptr inbounds %struct.anon.4, ptr %126, i32 0, i32 0
  store i8 3, ptr %127, align 8, !tbaa !18
  %128 = load ptr, ptr %3, align 8, !tbaa !5
  %129 = load ptr, ptr %3, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.api_msg, ptr %129, i32 0, i32 0
  %131 = load ptr, ptr %130, align 8, !tbaa !9
  %132 = getelementptr inbounds %struct.netconn, ptr %131, i32 0, i32 11
  store ptr %128, ptr %132, align 8, !tbaa !23
  %133 = load ptr, ptr %3, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.api_msg, ptr %133, i32 0, i32 0
  %135 = load ptr, ptr %134, align 8, !tbaa !9
  %136 = call signext i8 @lwip_netconn_do_close_internal(ptr noundef %135, i8 noundef zeroext 0)
  %137 = sext i8 %136 to i32
  %138 = icmp ne i32 %137, 0
  br i1 %138, label %139, label %175

139:                                              ; preds = %120
  br label %140

140:                                              ; preds = %139
  %141 = load ptr, ptr %3, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.api_msg, ptr %141, i32 0, i32 0
  %143 = load ptr, ptr %142, align 8, !tbaa !9
  %144 = getelementptr inbounds %struct.netconn, ptr %143, i32 0, i32 1
  %145 = load i32, ptr %144, align 4, !tbaa !11
  %146 = icmp eq i32 %145, 4
  br i1 %146, label %152, label %147

147:                                              ; preds = %140
  br label %148

148:                                              ; preds = %147
  %149 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.10, i32 noundef 1178, ptr noundef @.str.2)
  br label %150

150:                                              ; preds = %148
  br label %151

151:                                              ; preds = %150
  br label %152

152:                                              ; preds = %151, %140
  br label %153

153:                                              ; preds = %152
  br label %154

154:                                              ; preds = %153
  call void @sys_mutex_unlock(ptr noundef @lock_tcpip_core)
  %155 = load ptr, ptr %3, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.api_msg, ptr %155, i32 0, i32 0
  %157 = load ptr, ptr %156, align 8, !tbaa !9
  %158 = getelementptr inbounds %struct.netconn, ptr %157, i32 0, i32 4
  %159 = call i32 @sys_arch_sem_wait(ptr noundef %158, i32 noundef 0)
  call void @sys_mutex_lock(ptr noundef @lock_tcpip_core)
  br label %160

160:                                              ; preds = %154
  %161 = load ptr, ptr %3, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.api_msg, ptr %161, i32 0, i32 0
  %163 = load ptr, ptr %162, align 8, !tbaa !9
  %164 = getelementptr inbounds %struct.netconn, ptr %163, i32 0, i32 1
  %165 = load i32, ptr %164, align 4, !tbaa !11
  %166 = icmp eq i32 %165, 0
  br i1 %166, label %172, label %167

167:                                              ; preds = %160
  br label %168

168:                                              ; preds = %167
  %169 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.10, i32 noundef 1182, ptr noundef @.str.2)
  br label %170

170:                                              ; preds = %168
  br label %171

171:                                              ; preds = %170
  br label %172

172:                                              ; preds = %171, %160
  br label %173

173:                                              ; preds = %172
  br label %174

174:                                              ; preds = %173
  br label %175

175:                                              ; preds = %174, %120
  store i32 1, ptr %5, align 4
  br label %224

176:                                              ; preds = %86
  br label %177

177:                                              ; preds = %176, %93
  %178 = load ptr, ptr %3, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.api_msg, ptr %178, i32 0, i32 0
  %180 = load ptr, ptr %179, align 8, !tbaa !9
  %181 = getelementptr inbounds %struct.netconn, ptr %180, i32 0, i32 2
  store ptr null, ptr %181, align 8, !tbaa !18
  br label %182

182:                                              ; preds = %177, %74
  %183 = load ptr, ptr %3, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.api_msg, ptr %183, i32 0, i32 0
  %185 = load ptr, ptr %184, align 8, !tbaa !9
  %186 = getelementptr inbounds %struct.netconn, ptr %185, i32 0, i32 12
  %187 = load ptr, ptr %186, align 8, !tbaa !24
  %188 = icmp ne ptr %187, null
  br i1 %188, label %189, label %198

189:                                              ; preds = %182
  %190 = load ptr, ptr %3, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.api_msg, ptr %190, i32 0, i32 0
  %192 = load ptr, ptr %191, align 8, !tbaa !9
  %193 = getelementptr inbounds %struct.netconn, ptr %192, i32 0, i32 12
  %194 = load ptr, ptr %193, align 8, !tbaa !24
  %195 = load ptr, ptr %3, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.api_msg, ptr %195, i32 0, i32 0
  %197 = load ptr, ptr %196, align 8, !tbaa !9
  call void %194(ptr noundef %197, i32 noundef 0, i16 noundef zeroext 0)
  br label %198

198:                                              ; preds = %189, %182
  %199 = load ptr, ptr %3, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.api_msg, ptr %199, i32 0, i32 0
  %201 = load ptr, ptr %200, align 8, !tbaa !9
  %202 = getelementptr inbounds %struct.netconn, ptr %201, i32 0, i32 12
  %203 = load ptr, ptr %202, align 8, !tbaa !24
  %204 = icmp ne ptr %203, null
  br i1 %204, label %205, label %214

205:                                              ; preds = %198
  %206 = load ptr, ptr %3, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.api_msg, ptr %206, i32 0, i32 0
  %208 = load ptr, ptr %207, align 8, !tbaa !9
  %209 = getelementptr inbounds %struct.netconn, ptr %208, i32 0, i32 12
  %210 = load ptr, ptr %209, align 8, !tbaa !24
  %211 = load ptr, ptr %3, align 8, !tbaa !5
  %212 = getelementptr inbounds %struct.api_msg, ptr %211, i32 0, i32 0
  %213 = load ptr, ptr %212, align 8, !tbaa !9
  call void %210(ptr noundef %213, i32 noundef 2, i16 noundef zeroext 0)
  br label %214

214:                                              ; preds = %205, %198
  br label %215

215:                                              ; preds = %214, %51
  %216 = load ptr, ptr %3, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.api_msg, ptr %216, i32 0, i32 0
  %218 = load ptr, ptr %217, align 8, !tbaa !9
  %219 = getelementptr inbounds %struct.netconn, ptr %218, i32 0, i32 4
  %220 = call i32 @sys_sem_valid(ptr noundef %219)
  %221 = icmp ne i32 %220, 0
  br i1 %221, label %222, label %223

222:                                              ; preds = %215
  br label %223

223:                                              ; preds = %222, %215
  store i32 0, ptr %5, align 4
  br label %224

224:                                              ; preds = %223, %175
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  %225 = load i32, ptr %5, align 4
  switch i32 %225, label %227 [
    i32 0, label %226
    i32 1, label %226
  ]

226:                                              ; preds = %224, %224
  ret void

227:                                              ; preds = %224
  unreachable
}

; Function Attrs: nounwind uwtable
declare hidden void @netconn_drain(ptr noundef) #2

declare void @udp_remove(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden signext i8 @lwip_netconn_do_close_internal(ptr noundef, i8 noundef zeroext) #2

declare void @sys_mutex_unlock(ptr noundef) #0

declare i32 @sys_arch_sem_wait(ptr noundef, i32 noundef) #0

declare void @sys_mutex_lock(ptr noundef) #0

declare i32 @sys_sem_valid(ptr noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 0}
!10 = !{!"api_msg", !6, i64 0, !7, i64 8, !7, i64 16}
!11 = !{!12, !13, i64 4}
!12 = !{!"netconn", !13, i64 0, !13, i64 4, !7, i64 8, !7, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !13, i64 48, !13, i64 52, !13, i64 56, !7, i64 60, !6, i64 64, !6, i64 72}
!13 = !{!"int", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{!12, !13, i64 0}
!16 = !{!12, !7, i64 60}
!17 = !{!10, !7, i64 8}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !6, i64 40}
!20 = !{!"udp_pcb", !21, i64 0, !21, i64 4, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !6, i64 16, !7, i64 24, !22, i64 26, !22, i64 28, !6, i64 32, !6, i64 40}
!21 = !{!"ip4_addr", !13, i64 0}
!22 = !{!"short", !7, i64 0}
!23 = !{!12, !6, i64 64}
!24 = !{!12, !6, i64 72}


; 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 [40 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [181 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [7 x i8], align 1
@lock_tcpip_core = external global ptr, align 8

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @lwip_netconn_do_delconn(ptr noundef %0) local_unnamed_addr #1 {
  %2 = load ptr, ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %2, i64 4
  %4 = load i32, ptr %3, align 4, !tbaa !10
  %5 = icmp eq i32 %4, 0
  br i1 %5, label %.thread, label %6

6:                                                ; preds = %1
  %7 = load i32, ptr %2, align 8, !tbaa !13
  %8 = and i32 %7, 240
  %9 = icmp eq i32 %8, 16
  br i1 %9, label %12, label %10

10:                                               ; preds = %6
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.7, i32 noundef 1119, ptr noundef nonnull @.str.2)
  br label %12

12:                                               ; preds = %10, %6
  switch i32 %4, label %18 [
    i32 3, label %13
    i32 2, label %..thread_crit_edge
  ]

..thread_crit_edge:                               ; preds = %12
  %.pre = load ptr, ptr %0, align 8, !tbaa !5
  br label %.thread

13:                                               ; preds = %12
  %14 = load ptr, ptr %0, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %14, i64 60
  %16 = load i8, ptr %15, align 4, !tbaa !14
  %17 = and i8 %16, 4
  %.not = icmp eq i8 %17, 0
  br i1 %.not, label %18, label %.thread

18:                                               ; preds = %12, %13
  %19 = getelementptr inbounds i8, ptr %0, i64 8
  store i8 -5, ptr %19, align 8, !tbaa !15
  br label %.thread49

.thread:                                          ; preds = %..thread_crit_edge, %1, %13
  %20 = phi ptr [ %.pre, %..thread_crit_edge ], [ %2, %1 ], [ %14, %13 ]
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  store i8 0, ptr %21, align 8, !tbaa !15
  tail call void @netconn_drain(ptr noundef %20)
  %22 = load ptr, ptr %0, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %22, i64 8
  %24 = load ptr, ptr %23, align 8, !tbaa !16
  %.not40 = icmp eq ptr %24, null
  br i1 %.not40, label %63, label %25

25:                                               ; preds = %.thread
  %26 = load i32, ptr %22, align 8, !tbaa !13
  %27 = trunc i32 %26 to i8
  %trunc = and i8 %27, -16
  switch i8 %trunc, label %60 [
    i8 32, label %28
    i8 16, label %31
  ]

28:                                               ; preds = %25
  %29 = getelementptr inbounds i8, ptr %24, i64 40
  store ptr null, ptr %29, align 8, !tbaa !17
  %30 = load ptr, ptr %23, align 8, !tbaa !16
  tail call void @udp_remove(ptr noundef %30) #3
  %.pre45 = load ptr, ptr %0, align 8, !tbaa !5
  br label %60

31:                                               ; preds = %25
  %32 = getelementptr inbounds i8, ptr %22, i64 64
  %33 = load ptr, ptr %32, align 8, !tbaa !21
  %34 = icmp eq ptr %33, null
  br i1 %34, label %37, label %35

35:                                               ; preds = %31
  %36 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.9, i32 noundef 1172, ptr noundef nonnull @.str.2)
  %.pre44 = load ptr, ptr %0, align 8, !tbaa !5
  br label %37

37:                                               ; preds = %35, %31
  %38 = phi ptr [ %.pre44, %35 ], [ %22, %31 ]
  %39 = getelementptr inbounds i8, ptr %38, i64 4
  store i32 4, ptr %39, align 4, !tbaa !10
  %40 = getelementptr inbounds i8, ptr %0, i64 16
  store i8 3, ptr %40, align 8, !tbaa !16
  %41 = getelementptr inbounds i8, ptr %38, i64 64
  store ptr %0, ptr %41, align 8, !tbaa !21
  %42 = tail call signext i8 @lwip_netconn_do_close_internal(ptr noundef %38, i8 noundef zeroext 0)
  %.not41 = icmp eq i8 %42, 0
  br i1 %.not41, label %72, label %43

43:                                               ; preds = %37
  %44 = load ptr, ptr %0, align 8, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %44, i64 4
  %46 = load i32, ptr %45, align 4, !tbaa !10
  %47 = icmp eq i32 %46, 4
  br i1 %47, label %50, label %48

48:                                               ; preds = %43
  %49 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.10, i32 noundef 1178, ptr noundef nonnull @.str.2)
  br label %50

50:                                               ; preds = %48, %43
  tail call void @sys_mutex_unlock(ptr noundef nonnull @lock_tcpip_core) #3
  %51 = load ptr, ptr %0, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %51, i64 24
  %53 = tail call i32 @sys_arch_sem_wait(ptr noundef nonnull %52, i32 noundef 0) #3
  tail call void @sys_mutex_lock(ptr noundef nonnull @lock_tcpip_core) #3
  %54 = load ptr, ptr %0, align 8, !tbaa !5
  %55 = getelementptr inbounds i8, ptr %54, i64 4
  %56 = load i32, ptr %55, align 4, !tbaa !10
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %72, label %58

58:                                               ; preds = %50
  %59 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.10, i32 noundef 1182, ptr noundef nonnull @.str.2)
  br label %72

60:                                               ; preds = %25, %28
  %61 = phi ptr [ %22, %25 ], [ %.pre45, %28 ]
  %62 = getelementptr inbounds i8, ptr %61, i64 8
  store ptr null, ptr %62, align 8, !tbaa !16
  %.pre46 = load ptr, ptr %0, align 8, !tbaa !5
  br label %63

63:                                               ; preds = %60, %.thread
  %64 = phi ptr [ %.pre46, %60 ], [ %22, %.thread ]
  %65 = getelementptr inbounds i8, ptr %64, i64 72
  %66 = load ptr, ptr %65, align 8, !tbaa !22
  %.not42 = icmp eq ptr %66, null
  br i1 %.not42, label %.thread49, label %67

67:                                               ; preds = %63
  tail call void %66(ptr noundef nonnull %64, i32 noundef 0, i16 noundef zeroext 0) #3
  %.pre47 = load ptr, ptr %0, align 8, !tbaa !5
  %.phi.trans.insert = getelementptr inbounds i8, ptr %.pre47, i64 72
  %.pre48 = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !22
  %.not43 = icmp eq ptr %.pre48, null
  br i1 %.not43, label %.thread49, label %68

68:                                               ; preds = %67
  tail call void %.pre48(ptr noundef nonnull %.pre47, i32 noundef 2, i16 noundef zeroext 0) #3
  br label %.thread49

.thread49:                                        ; preds = %63, %67, %68, %18
  %69 = load ptr, ptr %0, align 8, !tbaa !5
  %70 = getelementptr inbounds i8, ptr %69, i64 24
  %71 = tail call i32 @sys_sem_valid(ptr noundef nonnull %70) #3
  br label %72

72:                                               ; preds = %37, %58, %50, %.thread49
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden void @netconn_drain(ptr noundef) local_unnamed_addr #1

declare void @udp_remove(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden signext i8 @lwip_netconn_do_close_internal(ptr noundef, i8 noundef zeroext) local_unnamed_addr #1

declare void @sys_mutex_unlock(ptr noundef) local_unnamed_addr #2

declare i32 @sys_arch_sem_wait(ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @sys_mutex_lock(ptr noundef) local_unnamed_addr #2

declare i32 @sys_sem_valid(ptr noundef) local_unnamed_addr #2

attributes #0 = { nofree nounwind "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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"api_msg", !7, i64 0, !8, i64 8, !8, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !12, i64 4}
!11 = !{!"netconn", !12, i64 0, !12, i64 4, !8, i64 8, !8, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !12, i64 48, !12, i64 52, !12, i64 56, !8, i64 60, !7, i64 64, !7, i64 72}
!12 = !{!"int", !8, i64 0}
!13 = !{!11, !12, i64 0}
!14 = !{!11, !8, i64 60}
!15 = !{!6, !8, i64 8}
!16 = !{!8, !8, i64 0}
!17 = !{!18, !7, i64 40}
!18 = !{!"udp_pcb", !19, i64 0, !19, i64 4, !8, i64 8, !8, i64 9, !8, i64 10, !8, i64 11, !7, i64 16, !8, i64 24, !20, i64 26, !20, i64 28, !7, i64 32, !7, i64 40}
!19 = !{!"ip4_addr", !12, i64 0}
!20 = !{!"short", !8, i64 0}
!21 = !{!11, !7, i64 64}
!22 = !{!11, !7, i64 72}


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