; LLVM IR from tezc/sc :: socket (sock_test)

; 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.sc_sock = type { %struct.sc_sock_fd, i8, i32, [128 x i8] }
%struct.sc_sock_fd = type { i32, i32, i32 }
%struct.sc_sock_poll = type { i32, ptr }
%struct.poll_and_sock = type { ptr, ptr, i8, i32 }
%struct.sc_thread = type { i64 }

@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.76 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.89 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.96 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.101 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.111 = external hidden unnamed_addr constant [19 x i8], align 1
@__PRETTY_FUNCTION__.test_poll_threadsafe = external hidden unnamed_addr constant [32 x i8], align 1
@.str.136 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.137 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.138 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.139 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.140 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.141 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.142 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.143 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.144 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.145 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.146 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.147 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.148 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.149 = external hidden unnamed_addr constant [20 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @sc_thread_start(ptr noundef, 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

; 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 i32 @sc_thread_join(ptr noundef, ptr noundef) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #3

declare void @sc_sock_init(ptr noundef, i32 noundef, i1 noundef zeroext, i32 noundef) #4

declare i32 @sc_sock_listen(ptr noundef, ptr noundef, ptr noundef) #4

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #5

declare i32 @sc_sock_accept(ptr noundef, ptr noundef) #4

declare i32 @sc_sock_term(ptr noundef) #4

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

declare i32 @sc_sock_poll_init(ptr noundef) #4

declare i32 @sc_sock_poll_term(ptr noundef) #4

declare ptr @sc_sock_poll_err(ptr noundef) #4

declare i32 @sc_sock_poll_wait(ptr noundef, i32 noundef) #4

declare i32 @sc_sock_poll_event(ptr noundef, i32 noundef) #4

declare ptr @sc_sock_poll_data(ptr noundef, i32 noundef) #4

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

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

; Function Attrs: nounwind uwtable
define dso_local void @test_poll_threadsafe() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %struct.sc_sock, align 4
  %6 = alloca %struct.sc_sock_poll, align 8
  %7 = alloca [10 x %struct.poll_and_sock], align 16
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca [10 x %struct.sc_sock], align 16
  %11 = alloca [10 x %struct.sc_thread], align 16
  %12 = alloca [10 x %struct.sc_thread], align 16
  %13 = alloca i32, align 4
  %14 = alloca %struct.poll_and_sock, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 148, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 240, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1480, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 80, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 80, ptr %12) #6
  %23 = call i32 @sc_sock_poll_init(ptr noundef %6)
  store i32 %23, ptr %2, align 4, !tbaa !5
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = icmp eq i32 %24, 0
  br i1 %25, label %26, label %27

26:                                               ; preds = %0
  br label %28

27:                                               ; preds = %0
  call void @__assert_fail(ptr noundef @.str.15, ptr noundef @.str.3, i32 noundef 1776, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

28:                                               ; preds = %26
  call void @sc_sock_init(ptr noundef %5, i32 noundef 0, i1 noundef zeroext false, i32 noundef 2)
  %29 = call i32 @sc_sock_listen(ptr noundef %5, ptr noundef @.str, ptr noundef @.str.83)
  store i32 %29, ptr %2, align 4, !tbaa !5
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %32, label %33

32:                                               ; preds = %28
  br label %34

33:                                               ; preds = %28
  call void @__assert_fail(ptr noundef @.str.15, ptr noundef @.str.3, i32 noundef 1780, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

34:                                               ; preds = %32
  %35 = getelementptr inbounds [10 x %struct.sc_sock], ptr %10, i64 0, i64 0
  %36 = call i32 @sc_sock_accept(ptr noundef %5, ptr noundef %35)
  store i32 %36, ptr %2, align 4, !tbaa !5
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %40

39:                                               ; preds = %34
  br label %41

40:                                               ; preds = %34
  call void @__assert_fail(ptr noundef @.str.136, ptr noundef @.str.3, i32 noundef 1784, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

41:                                               ; preds = %39
  %42 = call ptr @__errno_location() #8
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = icmp eq i32 %43, 11
  br i1 %44, label %45, label %46

45:                                               ; preds = %41
  br label %47

46:                                               ; preds = %41
  call void @__assert_fail(ptr noundef @.str.101, ptr noundef @.str.3, i32 noundef 1785, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

47:                                               ; preds = %45
  %48 = call i32 (ptr, ...) @printf(ptr noundef @.str.137)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %68, %47
  %50 = load i32, ptr %13, align 4, !tbaa !5
  %51 = icmp slt i32 %50, 10
  br i1 %51, label %53, label %52

52:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %71

53:                                               ; preds = %49
  %54 = load i32, ptr %13, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [10 x %struct.poll_and_sock], ptr %7, i64 0, i64 %55
  %57 = getelementptr inbounds %struct.poll_and_sock, ptr %14, i32 0, i32 0
  store ptr %6, ptr %57, align 8, !tbaa !9
  %58 = getelementptr inbounds %struct.poll_and_sock, ptr %14, i32 0, i32 1
  store ptr null, ptr %58, align 8, !tbaa !13
  %59 = getelementptr inbounds %struct.poll_and_sock, ptr %14, i32 0, i32 2
  store i8 0, ptr %59, align 8, !tbaa !14
  %60 = getelementptr inbounds %struct.poll_and_sock, ptr %14, i32 0, i32 3
  %61 = load i32, ptr %13, align 4, !tbaa !5
  store i32 %61, ptr %60, align 4, !tbaa !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %56, ptr align 8 %14, i64 24, i1 false), !tbaa.struct !16
  %62 = load i32, ptr %13, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [10 x %struct.sc_thread], ptr %11, i64 0, i64 %63
  call void @sc_thread_init(ptr noundef %64)
  %65 = load i32, ptr %13, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [10 x %struct.sc_thread], ptr %12, i64 0, i64 %66
  call void @sc_thread_init(ptr noundef %67)
  br label %68

68:                                               ; preds = %53
  %69 = load i32, ptr %13, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %13, align 4, !tbaa !5
  br label %49, !llvm.loop !19

71:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %89, %71
  %73 = load i32, ptr %15, align 4, !tbaa !5
  %74 = icmp slt i32 %73, 10
  br i1 %74, label %76, label %75

75:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %92

76:                                               ; preds = %72
  %77 = load i32, ptr %15, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [10 x %struct.sc_thread], ptr %11, i64 0, i64 %78
  %80 = load i32, ptr %15, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [10 x %struct.poll_and_sock], ptr %7, i64 0, i64 %81
  %83 = call i32 @sc_thread_start(ptr noundef %79, ptr noundef @client_poll_add, ptr noundef %82)
  store i32 %83, ptr %2, align 4, !tbaa !5
  %84 = load i32, ptr %2, align 4, !tbaa !5
  %85 = icmp eq i32 %84, 0
  br i1 %85, label %86, label %87

86:                                               ; preds = %76
  br label %88

87:                                               ; preds = %76
  call void @__assert_fail(ptr noundef @.str.15, ptr noundef @.str.3, i32 noundef 1799, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

88:                                               ; preds = %86
  br label %89

89:                                               ; preds = %88
  %90 = load i32, ptr %15, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %15, align 4, !tbaa !5
  br label %72, !llvm.loop !21

92:                                               ; preds = %75
  %93 = call i32 (ptr, ...) @printf(ptr noundef @.str.138)
  br label %94

94:                                               ; preds = %171, %92
  %95 = load i32, ptr %4, align 4, !tbaa !5
  %96 = icmp slt i32 %95, 10
  br i1 %96, label %97, label %172

97:                                               ; preds = %94
  %98 = call i32 @sc_sock_poll_wait(ptr noundef %6, i32 noundef 7200000)
  store i32 %98, ptr %3, align 4, !tbaa !5
  %99 = load i32, ptr %3, align 4, !tbaa !5
  %100 = icmp slt i32 %99, 0
  br i1 %100, label %101, label %109

101:                                              ; preds = %97
  %102 = call ptr @sc_sock_poll_err(ptr noundef %6)
  %103 = call i32 (ptr, ...) @printf(ptr noundef @.str.139, ptr noundef %102)
  %104 = load i32, ptr %3, align 4, !tbaa !5
  %105 = icmp sge i32 %104, 0
  br i1 %105, label %106, label %107

106:                                              ; preds = %101
  br label %108

107:                                              ; preds = %101
  call void @__assert_fail(ptr noundef @.str.96, ptr noundef @.str.3, i32 noundef 1808, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

108:                                              ; preds = %106
  br label %109

109:                                              ; preds = %108, %97
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %168, %109
  %111 = load i32, ptr %16, align 4, !tbaa !5
  %112 = load i32, ptr %3, align 4, !tbaa !5
  %113 = icmp slt i32 %111, %112
  br i1 %113, label %115, label %114

114:                                              ; preds = %110
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %171

115:                                              ; preds = %110
  %116 = load i32, ptr %9, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [10 x %struct.sc_sock], ptr %10, i64 0, i64 %117
  %119 = call i32 @sc_sock_accept(ptr noundef %5, ptr noundef %118)
  %120 = icmp eq i32 %119, 0
  br i1 %120, label %121, label %124

121:                                              ; preds = %115
  %122 = load i32, ptr %9, align 4, !tbaa !5
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %9, align 4, !tbaa !5
  br label %124

124:                                              ; preds = %121, %115
  %125 = load i32, ptr %16, align 4, !tbaa !5
  %126 = call i32 @sc_sock_poll_event(ptr noundef %6, i32 noundef %125)
  store i32 %126, ptr %1, align 4, !tbaa !5
  %127 = load i32, ptr %16, align 4, !tbaa !5
  %128 = call ptr @sc_sock_poll_data(ptr noundef %6, i32 noundef %127)
  store ptr %128, ptr %8, align 8, !tbaa !17
  %129 = load ptr, ptr %8, align 8, !tbaa !17
  %130 = icmp ne ptr %129, null
  br i1 %130, label %131, label %132

131:                                              ; preds = %124
  br label %133

132:                                              ; preds = %124
  call void @__assert_fail(ptr noundef @.str.140, ptr noundef @.str.3, i32 noundef 1819, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

133:                                              ; preds = %131
  %134 = load i32, ptr %1, align 4, !tbaa !5
  %135 = icmp eq i32 %134, 0
  br i1 %135, label %141, label %136

136:                                              ; preds = %133
  %137 = load ptr, ptr %8, align 8, !tbaa !17
  %138 = getelementptr inbounds %struct.poll_and_sock, ptr %137, i32 0, i32 2
  %139 = load i8, ptr %138, align 8, !tbaa !14, !range !22, !noundef !23
  %140 = trunc i8 %139 to i1
  br i1 %140, label %141, label %142

141:                                              ; preds = %136, %133
  br label %168

142:                                              ; preds = %136
  %143 = load i32, ptr %1, align 4, !tbaa !5
  %144 = and i32 %143, 1
  %145 = icmp eq i32 %144, 0
  br i1 %145, label %146, label %147

146:                                              ; preds = %142
  br label %148

147:                                              ; preds = %142
  call void @__assert_fail(ptr noundef @.str.141, ptr noundef @.str.3, i32 noundef 1825, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

148:                                              ; preds = %146
  %149 = load i32, ptr %1, align 4, !tbaa !5
  %150 = and i32 %149, 2
  %151 = icmp ne i32 %150, 0
  br i1 %151, label %152, label %153

152:                                              ; preds = %148
  br label %154

153:                                              ; preds = %148
  call void @__assert_fail(ptr noundef @.str.111, ptr noundef @.str.3, i32 noundef 1826, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

154:                                              ; preds = %152
  %155 = load ptr, ptr %8, align 8, !tbaa !17
  %156 = getelementptr inbounds %struct.poll_and_sock, ptr %155, i32 0, i32 2
  store i8 1, ptr %156, align 8, !tbaa !14
  %157 = load i32, ptr %4, align 4, !tbaa !5
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %4, align 4, !tbaa !5
  %159 = sext i32 %157 to i64
  %160 = getelementptr inbounds [10 x %struct.sc_thread], ptr %12, i64 0, i64 %159
  %161 = load ptr, ptr %8, align 8, !tbaa !17
  %162 = call i32 @sc_thread_start(ptr noundef %160, ptr noundef @client_poll_del, ptr noundef %161)
  store i32 %162, ptr %2, align 4, !tbaa !5
  %163 = load i32, ptr %2, align 4, !tbaa !5
  %164 = icmp eq i32 %163, 0
  br i1 %164, label %165, label %166

165:                                              ; preds = %154
  br label %167

166:                                              ; preds = %154
  call void @__assert_fail(ptr noundef @.str.15, ptr noundef @.str.3, i32 noundef 1831, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

167:                                              ; preds = %165
  br label %168

168:                                              ; preds = %167, %141
  %169 = load i32, ptr %16, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %16, align 4, !tbaa !5
  br label %110, !llvm.loop !24

171:                                              ; preds = %114
  br label %94, !llvm.loop !25

172:                                              ; preds = %94
  %173 = load i32, ptr %4, align 4, !tbaa !5
  %174 = call i32 (ptr, ...) @printf(ptr noundef @.str.142, i32 noundef %173)
  %175 = load i32, ptr %4, align 4, !tbaa !5
  %176 = icmp eq i32 %175, 10
  br i1 %176, label %177, label %178

177:                                              ; preds = %172
  br label %179

178:                                              ; preds = %172
  call void @__assert_fail(ptr noundef @.str.143, ptr noundef @.str.3, i32 noundef 1835, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

179:                                              ; preds = %177
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %180

180:                                              ; preds = %194, %179
  %181 = load i32, ptr %17, align 4, !tbaa !5
  %182 = icmp slt i32 %181, 10
  br i1 %182, label %184, label %183

183:                                              ; preds = %180
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %197

184:                                              ; preds = %180
  %185 = load i32, ptr %17, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [10 x %struct.poll_and_sock], ptr %7, i64 0, i64 %186
  %188 = getelementptr inbounds %struct.poll_and_sock, ptr %187, i32 0, i32 2
  %189 = load i8, ptr %188, align 8, !tbaa !14, !range !22, !noundef !23
  %190 = trunc i8 %189 to i1
  br i1 %190, label %191, label %192

191:                                              ; preds = %184
  br label %193

192:                                              ; preds = %184
  call void @__assert_fail(ptr noundef @.str.144, ptr noundef @.str.3, i32 noundef 1838, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

193:                                              ; preds = %191
  br label %194

194:                                              ; preds = %193
  %195 = load i32, ptr %17, align 4, !tbaa !5
  %196 = add nsw i32 %195, 1
  store i32 %196, ptr %17, align 4, !tbaa !5
  br label %180, !llvm.loop !26

197:                                              ; preds = %183
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %198

198:                                              ; preds = %217, %197
  %199 = load i32, ptr %18, align 4, !tbaa !5
  %200 = icmp slt i32 %199, 10
  br i1 %200, label %202, label %201

201:                                              ; preds = %198
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %220

202:                                              ; preds = %198
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %203 = load i32, ptr %18, align 4, !tbaa !5
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [10 x %struct.sc_thread], ptr %11, i64 0, i64 %204
  %206 = call i32 @sc_thread_join(ptr noundef %205, ptr noundef %19)
  store i32 %206, ptr %2, align 4, !tbaa !5
  %207 = load i32, ptr %2, align 4, !tbaa !5
  %208 = icmp eq i32 %207, 0
  br i1 %208, label %209, label %210

209:                                              ; preds = %202
  br label %211

210:                                              ; preds = %202
  call void @__assert_fail(ptr noundef @.str.15, ptr noundef @.str.3, i32 noundef 1844, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

211:                                              ; preds = %209
  %212 = load ptr, ptr %19, align 8, !tbaa !17
  %213 = icmp eq ptr %212, %6
  br i1 %213, label %214, label %215

214:                                              ; preds = %211
  br label %216

215:                                              ; preds = %211
  call void @__assert_fail(ptr noundef @.str.145, ptr noundef @.str.3, i32 noundef 1845, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

216:                                              ; preds = %214
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  br label %217

217:                                              ; preds = %216
  %218 = load i32, ptr %18, align 4, !tbaa !5
  %219 = add nsw i32 %218, 1
  store i32 %219, ptr %18, align 4, !tbaa !5
  br label %198, !llvm.loop !27

220:                                              ; preds = %201
  %221 = call i32 (ptr, ...) @printf(ptr noundef @.str.146)
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 0, ptr %20, align 4, !tbaa !5
  br label %222

222:                                              ; preds = %241, %220
  %223 = load i32, ptr %20, align 4, !tbaa !5
  %224 = icmp slt i32 %223, 10
  br i1 %224, label %226, label %225

225:                                              ; preds = %222
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %244

226:                                              ; preds = %222
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %227 = load i32, ptr %20, align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [10 x %struct.sc_thread], ptr %12, i64 0, i64 %228
  %230 = call i32 @sc_thread_join(ptr noundef %229, ptr noundef %21)
  store i32 %230, ptr %2, align 4, !tbaa !5
  %231 = load i32, ptr %2, align 4, !tbaa !5
  %232 = icmp eq i32 %231, 0
  br i1 %232, label %233, label %234

233:                                              ; preds = %226
  br label %235

234:                                              ; preds = %226
  call void @__assert_fail(ptr noundef @.str.15, ptr noundef @.str.3, i32 noundef 1852, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

235:                                              ; preds = %233
  %236 = load ptr, ptr %21, align 8, !tbaa !17
  %237 = icmp eq ptr %236, %6
  br i1 %237, label %238, label %239

238:                                              ; preds = %235
  br label %240

239:                                              ; preds = %235
  call void @__assert_fail(ptr noundef @.str.145, ptr noundef @.str.3, i32 noundef 1853, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

240:                                              ; preds = %238
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %241

241:                                              ; preds = %240
  %242 = load i32, ptr %20, align 4, !tbaa !5
  %243 = add nsw i32 %242, 1
  store i32 %243, ptr %20, align 4, !tbaa !5
  br label %222, !llvm.loop !28

244:                                              ; preds = %225
  %245 = call i32 (ptr, ...) @printf(ptr noundef @.str.147)
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 0, ptr %22, align 4, !tbaa !5
  br label %246

246:                                              ; preds = %260, %244
  %247 = load i32, ptr %22, align 4, !tbaa !5
  %248 = load i32, ptr %9, align 4, !tbaa !5
  %249 = icmp slt i32 %247, %248
  br i1 %249, label %251, label %250

250:                                              ; preds = %246
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  br label %263

251:                                              ; preds = %246
  %252 = load i32, ptr %22, align 4, !tbaa !5
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds [10 x %struct.sc_sock], ptr %10, i64 0, i64 %253
  %255 = call i32 @sc_sock_term(ptr noundef %254)
  %256 = icmp eq i32 %255, 0
  br i1 %256, label %257, label %258

257:                                              ; preds = %251
  br label %259

258:                                              ; preds = %251
  call void @__assert_fail(ptr noundef @.str.148, ptr noundef @.str.3, i32 noundef 1858, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

259:                                              ; preds = %257
  br label %260

260:                                              ; preds = %259
  %261 = load i32, ptr %22, align 4, !tbaa !5
  %262 = add nsw i32 %261, 1
  store i32 %262, ptr %22, align 4, !tbaa !5
  br label %246, !llvm.loop !29

263:                                              ; preds = %250
  %264 = call i32 @sc_sock_term(ptr noundef %5)
  %265 = icmp eq i32 %264, 0
  br i1 %265, label %266, label %267

266:                                              ; preds = %263
  br label %268

267:                                              ; preds = %263
  call void @__assert_fail(ptr noundef @.str.89, ptr noundef @.str.3, i32 noundef 1861, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

268:                                              ; preds = %266
  %269 = call i32 @sc_sock_poll_term(ptr noundef %6)
  %270 = icmp eq i32 %269, 0
  br i1 %270, label %271, label %272

271:                                              ; preds = %268
  br label %273

272:                                              ; preds = %268
  call void @__assert_fail(ptr noundef @.str.76, ptr noundef @.str.3, i32 noundef 1870, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

273:                                              ; preds = %271
  %274 = getelementptr inbounds %struct.sc_sock_poll, ptr %6, i32 0, i32 1
  %275 = load ptr, ptr %274, align 8, !tbaa !30
  %276 = icmp eq ptr %275, null
  br i1 %276, label %277, label %278

277:                                              ; preds = %273
  br label %279

278:                                              ; preds = %273
  call void @__assert_fail(ptr noundef @.str.149, ptr noundef @.str.3, i32 noundef 1871, ptr noundef @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

279:                                              ; preds = %277
  call void @llvm.lifetime.end.p0(i64 80, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 1480, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 240, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 148, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #6
  ret void
}

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind willreturn memory(none) "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 #4 = { "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 #5 = { noreturn 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 #6 = { nounwind }
attributes #7 = { noreturn nounwind }
attributes #8 = { nounwind willreturn memory(none) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"poll_and_sock", !11, i64 0, !11, i64 8, !12, i64 16, !6, i64 20}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!10, !11, i64 8}
!14 = !{!10, !12, i64 16}
!15 = !{!10, !6, i64 20}
!16 = !{i64 0, i64 8, !17, i64 8, i64 8, !17, i64 16, i64 1, !18, i64 20, i64 4, !5}
!17 = !{!11, !11, i64 0}
!18 = !{!12, !12, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = distinct !{!24, !20}
!25 = distinct !{!25, !20}
!26 = distinct !{!26, !20}
!27 = distinct !{!27, !20}
!28 = distinct !{!28, !20}
!29 = distinct !{!29, !20}
!30 = !{!31, !11, i64 8}
!31 = !{!"sc_sock_poll", !6, i64 0, !11, i64 8}


; 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.sc_sock = type { %struct.sc_sock_fd, i8, i32, [128 x i8] }
%struct.sc_sock_fd = type { i32, i32, i32 }
%struct.sc_sock_poll = type { i32, ptr }
%struct.poll_and_sock = type { ptr, ptr, i8, i32 }
%struct.sc_thread = type { i64 }

@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.76 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.89 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.96 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.101 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.111 = external hidden unnamed_addr constant [19 x i8], align 1
@__PRETTY_FUNCTION__.test_poll_threadsafe = external hidden unnamed_addr constant [32 x i8], align 1
@.str.136 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.137 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.138 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.139 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.140 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.141 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.142 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.143 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.144 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.145 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.146 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.147 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.148 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.149 = external hidden unnamed_addr constant [20 x i8], align 1

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

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

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

; Function Attrs: mustprogress 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 i32 @sc_thread_join(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #2

declare void @sc_sock_init(ptr noundef, i32 noundef, i1 noundef zeroext, i32 noundef) local_unnamed_addr #3

declare i32 @sc_sock_listen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

declare i32 @sc_sock_accept(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @sc_sock_term(ptr noundef) local_unnamed_addr #3

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

declare i32 @sc_sock_poll_init(ptr noundef) local_unnamed_addr #3

declare i32 @sc_sock_poll_term(ptr noundef) local_unnamed_addr #3

declare ptr @sc_sock_poll_err(ptr noundef) local_unnamed_addr #3

declare i32 @sc_sock_poll_wait(ptr noundef, i32 noundef) local_unnamed_addr #3

declare i32 @sc_sock_poll_event(ptr noundef, i32 noundef) local_unnamed_addr #3

declare ptr @sc_sock_poll_data(ptr noundef, i32 noundef) local_unnamed_addr #3

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

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

; Function Attrs: nounwind uwtable
define dso_local void @test_poll_threadsafe() local_unnamed_addr #0 {
  %1 = alloca %struct.sc_sock, align 4
  %2 = alloca %struct.sc_sock_poll, align 8
  %3 = alloca [10 x %struct.poll_and_sock], align 16
  %4 = alloca [10 x %struct.sc_sock], align 16
  %5 = alloca [10 x %struct.sc_thread], align 16
  %6 = alloca [10 x %struct.sc_thread], align 16
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 148, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 240, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 1480, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %6) #6
  %9 = call i32 @sc_sock_poll_init(ptr noundef nonnull %2) #6
  %10 = icmp eq i32 %9, 0
  br i1 %10, label %12, label %11

11:                                               ; preds = %0
  call void @__assert_fail(ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.3, i32 noundef 1776, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

12:                                               ; preds = %0
  call void @sc_sock_init(ptr noundef nonnull %1, i32 noundef 0, i1 noundef zeroext false, i32 noundef 2) #6
  %13 = call i32 @sc_sock_listen(ptr noundef nonnull %1, ptr noundef nonnull @.str, ptr noundef nonnull @.str.83) #6
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  call void @__assert_fail(ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.3, i32 noundef 1780, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

16:                                               ; preds = %12
  %17 = call i32 @sc_sock_accept(ptr noundef nonnull %1, ptr noundef nonnull %4) #6
  %.not = icmp eq i32 %17, 0
  br i1 %.not, label %18, label %19

18:                                               ; preds = %16
  call void @__assert_fail(ptr noundef nonnull @.str.136, ptr noundef nonnull @.str.3, i32 noundef 1784, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

19:                                               ; preds = %16
  %20 = tail call ptr @__errno_location() #8
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = icmp eq i32 %21, 11
  br i1 %22, label %.preheader66.preheader, label %23

23:                                               ; preds = %19
  call void @__assert_fail(ptr noundef nonnull @.str.101, ptr noundef nonnull @.str.3, i32 noundef 1785, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

.preheader66.preheader:                           ; preds = %19
  %24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.137)
  store ptr %2, ptr %3, align 16, !tbaa !9
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  store ptr null, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !9
  %.sroa.3.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 16
  store i8 0, ptr %.sroa.3.0..sroa_idx, align 16, !tbaa !11
  %.sroa.420.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 20
  store i32 0, ptr %.sroa.420.0..sroa_idx, align 4, !tbaa !5
  call void @sc_thread_init(ptr noundef nonnull %5)
  call void @sc_thread_init(ptr noundef nonnull %6)
  %25 = getelementptr inbounds i8, ptr %3, i64 24
  store ptr %2, ptr %25, align 8, !tbaa !9
  %.sroa.2.0..sroa_idx.1 = getelementptr inbounds i8, ptr %3, i64 32
  store ptr null, ptr %.sroa.2.0..sroa_idx.1, align 16, !tbaa !9
  %.sroa.3.0..sroa_idx.1 = getelementptr inbounds i8, ptr %3, i64 40
  store i8 0, ptr %.sroa.3.0..sroa_idx.1, align 8, !tbaa !11
  %.sroa.420.0..sroa_idx.1 = getelementptr inbounds i8, ptr %3, i64 44
  store i32 1, ptr %.sroa.420.0..sroa_idx.1, align 4, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %5, i64 8
  call void @sc_thread_init(ptr noundef nonnull %26)
  %27 = getelementptr inbounds i8, ptr %6, i64 8
  call void @sc_thread_init(ptr noundef nonnull %27)
  %28 = getelementptr inbounds i8, ptr %3, i64 48
  store ptr %2, ptr %28, align 16, !tbaa !9
  %.sroa.2.0..sroa_idx.2 = getelementptr inbounds i8, ptr %3, i64 56
  store ptr null, ptr %.sroa.2.0..sroa_idx.2, align 8, !tbaa !9
  %.sroa.3.0..sroa_idx.2 = getelementptr inbounds i8, ptr %3, i64 64
  store i8 0, ptr %.sroa.3.0..sroa_idx.2, align 16, !tbaa !11
  %.sroa.420.0..sroa_idx.2 = getelementptr inbounds i8, ptr %3, i64 68
  store i32 2, ptr %.sroa.420.0..sroa_idx.2, align 4, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %5, i64 16
  call void @sc_thread_init(ptr noundef nonnull %29)
  %30 = getelementptr inbounds i8, ptr %6, i64 16
  call void @sc_thread_init(ptr noundef nonnull %30)
  %31 = getelementptr inbounds i8, ptr %3, i64 72
  store ptr %2, ptr %31, align 8, !tbaa !9
  %.sroa.2.0..sroa_idx.3 = getelementptr inbounds i8, ptr %3, i64 80
  store ptr null, ptr %.sroa.2.0..sroa_idx.3, align 16, !tbaa !9
  %.sroa.3.0..sroa_idx.3 = getelementptr inbounds i8, ptr %3, i64 88
  store i8 0, ptr %.sroa.3.0..sroa_idx.3, align 8, !tbaa !11
  %.sroa.420.0..sroa_idx.3 = getelementptr inbounds i8, ptr %3, i64 92
  store i32 3, ptr %.sroa.420.0..sroa_idx.3, align 4, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %5, i64 24
  call void @sc_thread_init(ptr noundef nonnull %32)
  %33 = getelementptr inbounds i8, ptr %6, i64 24
  call void @sc_thread_init(ptr noundef nonnull %33)
  %34 = getelementptr inbounds i8, ptr %3, i64 96
  store ptr %2, ptr %34, align 16, !tbaa !9
  %.sroa.2.0..sroa_idx.4 = getelementptr inbounds i8, ptr %3, i64 104
  store ptr null, ptr %.sroa.2.0..sroa_idx.4, align 8, !tbaa !9
  %.sroa.3.0..sroa_idx.4 = getelementptr inbounds i8, ptr %3, i64 112
  store i8 0, ptr %.sroa.3.0..sroa_idx.4, align 16, !tbaa !11
  %.sroa.420.0..sroa_idx.4 = getelementptr inbounds i8, ptr %3, i64 116
  store i32 4, ptr %.sroa.420.0..sroa_idx.4, align 4, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %5, i64 32
  call void @sc_thread_init(ptr noundef nonnull %35)
  %36 = getelementptr inbounds i8, ptr %6, i64 32
  call void @sc_thread_init(ptr noundef nonnull %36)
  %37 = getelementptr inbounds i8, ptr %3, i64 120
  store ptr %2, ptr %37, align 8, !tbaa !9
  %.sroa.2.0..sroa_idx.5 = getelementptr inbounds i8, ptr %3, i64 128
  store ptr null, ptr %.sroa.2.0..sroa_idx.5, align 16, !tbaa !9
  %.sroa.3.0..sroa_idx.5 = getelementptr inbounds i8, ptr %3, i64 136
  store i8 0, ptr %.sroa.3.0..sroa_idx.5, align 8, !tbaa !11
  %.sroa.420.0..sroa_idx.5 = getelementptr inbounds i8, ptr %3, i64 140
  store i32 5, ptr %.sroa.420.0..sroa_idx.5, align 4, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %5, i64 40
  call void @sc_thread_init(ptr noundef nonnull %38)
  %39 = getelementptr inbounds i8, ptr %6, i64 40
  call void @sc_thread_init(ptr noundef nonnull %39)
  %40 = getelementptr inbounds i8, ptr %3, i64 144
  store ptr %2, ptr %40, align 16, !tbaa !9
  %.sroa.2.0..sroa_idx.6 = getelementptr inbounds i8, ptr %3, i64 152
  store ptr null, ptr %.sroa.2.0..sroa_idx.6, align 8, !tbaa !9
  %.sroa.3.0..sroa_idx.6 = getelementptr inbounds i8, ptr %3, i64 160
  store i8 0, ptr %.sroa.3.0..sroa_idx.6, align 16, !tbaa !11
  %.sroa.420.0..sroa_idx.6 = getelementptr inbounds i8, ptr %3, i64 164
  store i32 6, ptr %.sroa.420.0..sroa_idx.6, align 4, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %5, i64 48
  call void @sc_thread_init(ptr noundef nonnull %41)
  %42 = getelementptr inbounds i8, ptr %6, i64 48
  call void @sc_thread_init(ptr noundef nonnull %42)
  %43 = getelementptr inbounds i8, ptr %3, i64 168
  store ptr %2, ptr %43, align 8, !tbaa !9
  %.sroa.2.0..sroa_idx.7 = getelementptr inbounds i8, ptr %3, i64 176
  store ptr null, ptr %.sroa.2.0..sroa_idx.7, align 16, !tbaa !9
  %.sroa.3.0..sroa_idx.7 = getelementptr inbounds i8, ptr %3, i64 184
  store i8 0, ptr %.sroa.3.0..sroa_idx.7, align 8, !tbaa !11
  %.sroa.420.0..sroa_idx.7 = getelementptr inbounds i8, ptr %3, i64 188
  store i32 7, ptr %.sroa.420.0..sroa_idx.7, align 4, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %5, i64 56
  call void @sc_thread_init(ptr noundef nonnull %44)
  %45 = getelementptr inbounds i8, ptr %6, i64 56
  call void @sc_thread_init(ptr noundef nonnull %45)
  %46 = getelementptr inbounds i8, ptr %3, i64 192
  store ptr %2, ptr %46, align 16, !tbaa !9
  %.sroa.2.0..sroa_idx.8 = getelementptr inbounds i8, ptr %3, i64 200
  store ptr null, ptr %.sroa.2.0..sroa_idx.8, align 8, !tbaa !9
  %.sroa.3.0..sroa_idx.8 = getelementptr inbounds i8, ptr %3, i64 208
  store i8 0, ptr %.sroa.3.0..sroa_idx.8, align 16, !tbaa !11
  %.sroa.420.0..sroa_idx.8 = getelementptr inbounds i8, ptr %3, i64 212
  store i32 8, ptr %.sroa.420.0..sroa_idx.8, align 4, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %5, i64 64
  call void @sc_thread_init(ptr noundef nonnull %47)
  %48 = getelementptr inbounds i8, ptr %6, i64 64
  call void @sc_thread_init(ptr noundef nonnull %48)
  %49 = getelementptr inbounds i8, ptr %3, i64 216
  store ptr %2, ptr %49, align 8, !tbaa !9
  %.sroa.2.0..sroa_idx.9 = getelementptr inbounds i8, ptr %3, i64 224
  store ptr null, ptr %.sroa.2.0..sroa_idx.9, align 16, !tbaa !9
  %.sroa.3.0..sroa_idx.9 = getelementptr inbounds i8, ptr %3, i64 232
  store i8 0, ptr %.sroa.3.0..sroa_idx.9, align 8, !tbaa !11
  %.sroa.420.0..sroa_idx.9 = getelementptr inbounds i8, ptr %3, i64 236
  store i32 9, ptr %.sroa.420.0..sroa_idx.9, align 4, !tbaa !5
  %50 = getelementptr inbounds i8, ptr %5, i64 72
  call void @sc_thread_init(ptr noundef nonnull %50)
  %51 = getelementptr inbounds i8, ptr %6, i64 72
  call void @sc_thread_init(ptr noundef nonnull %51)
  %52 = call i32 @sc_thread_start(ptr noundef nonnull %5, ptr noundef nonnull @client_poll_add, ptr noundef nonnull %3)
  %53 = icmp eq i32 %52, 0
  br i1 %53, label %.preheader66.1, label %74

.preheader66.1:                                   ; preds = %.preheader66.preheader
  %54 = call i32 @sc_thread_start(ptr noundef nonnull %26, ptr noundef nonnull @client_poll_add, ptr noundef nonnull %25)
  %55 = icmp eq i32 %54, 0
  br i1 %55, label %.preheader66.2, label %74

.preheader66.2:                                   ; preds = %.preheader66.1
  %56 = call i32 @sc_thread_start(ptr noundef nonnull %29, ptr noundef nonnull @client_poll_add, ptr noundef nonnull %28)
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %.preheader66.3, label %74

.preheader66.3:                                   ; preds = %.preheader66.2
  %58 = call i32 @sc_thread_start(ptr noundef nonnull %32, ptr noundef nonnull @client_poll_add, ptr noundef nonnull %31)
  %59 = icmp eq i32 %58, 0
  br i1 %59, label %.preheader66.4, label %74

.preheader66.4:                                   ; preds = %.preheader66.3
  %60 = call i32 @sc_thread_start(ptr noundef nonnull %35, ptr noundef nonnull @client_poll_add, ptr noundef nonnull %34)
  %61 = icmp eq i32 %60, 0
  br i1 %61, label %.preheader66.5, label %74

.preheader66.5:                                   ; preds = %.preheader66.4
  %62 = call i32 @sc_thread_start(ptr noundef nonnull %38, ptr noundef nonnull @client_poll_add, ptr noundef nonnull %37)
  %63 = icmp eq i32 %62, 0
  br i1 %63, label %.preheader66.6, label %74

.preheader66.6:                                   ; preds = %.preheader66.5
  %64 = call i32 @sc_thread_start(ptr noundef nonnull %41, ptr noundef nonnull @client_poll_add, ptr noundef nonnull %40)
  %65 = icmp eq i32 %64, 0
  br i1 %65, label %.preheader66.7, label %74

.preheader66.7:                                   ; preds = %.preheader66.6
  %66 = call i32 @sc_thread_start(ptr noundef nonnull %44, ptr noundef nonnull @client_poll_add, ptr noundef nonnull %43)
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %.preheader66.8, label %74

.preheader66.8:                                   ; preds = %.preheader66.7
  %68 = call i32 @sc_thread_start(ptr noundef nonnull %47, ptr noundef nonnull @client_poll_add, ptr noundef nonnull %46)
  %69 = icmp eq i32 %68, 0
  br i1 %69, label %.preheader66.9, label %74

.preheader66.9:                                   ; preds = %.preheader66.8
  %70 = call i32 @sc_thread_start(ptr noundef nonnull %50, ptr noundef nonnull @client_poll_add, ptr noundef nonnull %49)
  %71 = icmp eq i32 %70, 0
  br i1 %71, label %72, label %74

72:                                               ; preds = %.preheader66.9
  %73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.138)
  br label %76

74:                                               ; preds = %.preheader66.9, %.preheader66.8, %.preheader66.7, %.preheader66.6, %.preheader66.5, %.preheader66.4, %.preheader66.3, %.preheader66.2, %.preheader66.1, %.preheader66.preheader
  call void @__assert_fail(ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.3, i32 noundef 1799, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

.loopexit:                                        ; preds = %110, %.preheader65
  %.157.lcssa = phi i32 [ %.05691, %.preheader65 ], [ %spec.select, %110 ]
  %.1.lcssa = phi i32 [ %.05592, %.preheader65 ], [ %.2, %110 ]
  %75 = icmp slt i32 %.1.lcssa, 10
  br i1 %75, label %76, label %112, !llvm.loop !13

76:                                               ; preds = %72, %.loopexit
  %.05592 = phi i32 [ 0, %72 ], [ %.1.lcssa, %.loopexit ]
  %.05691 = phi i32 [ 0, %72 ], [ %.157.lcssa, %.loopexit ]
  %77 = call i32 @sc_sock_poll_wait(ptr noundef nonnull %2, i32 noundef 7200000) #6
  %78 = icmp slt i32 %77, 0
  br i1 %78, label %79, label %.preheader65

.preheader65:                                     ; preds = %76
  %.not98 = icmp eq i32 %77, 0
  br i1 %.not98, label %.loopexit, label %.lr.ph

79:                                               ; preds = %76
  %80 = call ptr @sc_sock_poll_err(ptr noundef nonnull %2) #6
  %81 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.139, ptr noundef %80)
  call void @__assert_fail(ptr noundef nonnull @.str.96, ptr noundef nonnull @.str.3, i32 noundef 1808, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

.lr.ph:                                           ; preds = %.preheader65, %110
  %.05389 = phi i32 [ %111, %110 ], [ 0, %.preheader65 ]
  %.188 = phi i32 [ %.2, %110 ], [ %.05592, %.preheader65 ]
  %.15787 = phi i32 [ %spec.select, %110 ], [ %.05691, %.preheader65 ]
  %82 = sext i32 %.15787 to i64
  %83 = getelementptr inbounds [10 x %struct.sc_sock], ptr %4, i64 0, i64 %82
  %84 = call i32 @sc_sock_accept(ptr noundef nonnull %1, ptr noundef nonnull %83) #6
  %85 = icmp eq i32 %84, 0
  %86 = zext i1 %85 to i32
  %spec.select = add nsw i32 %.15787, %86
  %87 = call i32 @sc_sock_poll_event(ptr noundef nonnull %2, i32 noundef %.05389) #6
  %88 = call ptr @sc_sock_poll_data(ptr noundef nonnull %2, i32 noundef %.05389) #6
  %.not62 = icmp eq ptr %88, null
  br i1 %.not62, label %89, label %90

89:                                               ; preds = %.lr.ph
  call void @__assert_fail(ptr noundef nonnull @.str.140, ptr noundef nonnull @.str.3, i32 noundef 1819, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

90:                                               ; preds = %.lr.ph
  %91 = icmp eq i32 %87, 0
  br i1 %91, label %110, label %92

92:                                               ; preds = %90
  %93 = getelementptr inbounds i8, ptr %88, i64 16
  %94 = load i8, ptr %93, align 8, !tbaa !15, !range !17, !noundef !18
  %95 = trunc nuw i8 %94 to i1
  br i1 %95, label %110, label %96

96:                                               ; preds = %92
  %97 = and i32 %87, 1
  %98 = icmp eq i32 %97, 0
  br i1 %98, label %100, label %99

99:                                               ; preds = %96
  call void @__assert_fail(ptr noundef nonnull @.str.141, ptr noundef nonnull @.str.3, i32 noundef 1825, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

100:                                              ; preds = %96
  %101 = and i32 %87, 2
  %.not63 = icmp eq i32 %101, 0
  br i1 %.not63, label %102, label %103

102:                                              ; preds = %100
  call void @__assert_fail(ptr noundef nonnull @.str.111, ptr noundef nonnull @.str.3, i32 noundef 1826, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

103:                                              ; preds = %100
  store i8 1, ptr %93, align 8, !tbaa !15
  %104 = add nsw i32 %.188, 1
  %105 = sext i32 %.188 to i64
  %106 = getelementptr inbounds [10 x %struct.sc_thread], ptr %6, i64 0, i64 %105
  %107 = call i32 @sc_thread_start(ptr noundef nonnull %106, ptr noundef nonnull @client_poll_del, ptr noundef nonnull %88)
  %108 = icmp eq i32 %107, 0
  br i1 %108, label %110, label %109

109:                                              ; preds = %103
  call void @__assert_fail(ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.3, i32 noundef 1831, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

110:                                              ; preds = %103, %90, %92
  %.2 = phi i32 [ %.188, %90 ], [ %.188, %92 ], [ %104, %103 ]
  %111 = add nuw nsw i32 %.05389, 1
  %exitcond.not = icmp eq i32 %111, %77
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph, !llvm.loop !19

112:                                              ; preds = %.loopexit
  %113 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.142, i32 noundef %.1.lcssa)
  %114 = icmp eq i32 %.1.lcssa, 10
  br i1 %114, label %.preheader64.preheader, label %117

.preheader64.preheader:                           ; preds = %112
  %115 = load i8, ptr %.sroa.3.0..sroa_idx, align 16, !tbaa !15, !range !17, !noundef !18
  %116 = trunc nuw i8 %115 to i1
  br i1 %116, label %.preheader64.1, label %147

117:                                              ; preds = %112
  call void @__assert_fail(ptr noundef nonnull @.str.143, ptr noundef nonnull @.str.3, i32 noundef 1835, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

.preheader64.1:                                   ; preds = %.preheader64.preheader
  %118 = getelementptr inbounds i8, ptr %3, i64 40
  %119 = load i8, ptr %118, align 8, !tbaa !15, !range !17, !noundef !18
  %120 = trunc nuw i8 %119 to i1
  br i1 %120, label %.preheader64.2, label %147

.preheader64.2:                                   ; preds = %.preheader64.1
  %121 = getelementptr inbounds i8, ptr %3, i64 64
  %122 = load i8, ptr %121, align 16, !tbaa !15, !range !17, !noundef !18
  %123 = trunc nuw i8 %122 to i1
  br i1 %123, label %.preheader64.3, label %147

.preheader64.3:                                   ; preds = %.preheader64.2
  %124 = getelementptr inbounds i8, ptr %3, i64 88
  %125 = load i8, ptr %124, align 8, !tbaa !15, !range !17, !noundef !18
  %126 = trunc nuw i8 %125 to i1
  br i1 %126, label %.preheader64.4, label %147

.preheader64.4:                                   ; preds = %.preheader64.3
  %127 = getelementptr inbounds i8, ptr %3, i64 112
  %128 = load i8, ptr %127, align 16, !tbaa !15, !range !17, !noundef !18
  %129 = trunc nuw i8 %128 to i1
  br i1 %129, label %.preheader64.5, label %147

.preheader64.5:                                   ; preds = %.preheader64.4
  %130 = getelementptr inbounds i8, ptr %3, i64 136
  %131 = load i8, ptr %130, align 8, !tbaa !15, !range !17, !noundef !18
  %132 = trunc nuw i8 %131 to i1
  br i1 %132, label %.preheader64.6, label %147

.preheader64.6:                                   ; preds = %.preheader64.5
  %133 = getelementptr inbounds i8, ptr %3, i64 160
  %134 = load i8, ptr %133, align 16, !tbaa !15, !range !17, !noundef !18
  %135 = trunc nuw i8 %134 to i1
  br i1 %135, label %.preheader64.7, label %147

.preheader64.7:                                   ; preds = %.preheader64.6
  %136 = getelementptr inbounds i8, ptr %3, i64 184
  %137 = load i8, ptr %136, align 8, !tbaa !15, !range !17, !noundef !18
  %138 = trunc nuw i8 %137 to i1
  br i1 %138, label %.preheader64.8, label %147

.preheader64.8:                                   ; preds = %.preheader64.7
  %139 = getelementptr inbounds i8, ptr %3, i64 208
  %140 = load i8, ptr %139, align 16, !tbaa !15, !range !17, !noundef !18
  %141 = trunc nuw i8 %140 to i1
  br i1 %141, label %.preheader64.9, label %147

.preheader64.9:                                   ; preds = %.preheader64.8
  %142 = getelementptr inbounds i8, ptr %3, i64 232
  %143 = load i8, ptr %142, align 8, !tbaa !15, !range !17, !noundef !18
  %144 = trunc nuw i8 %143 to i1
  br i1 %144, label %.preheader.preheader, label %147

.preheader.preheader:                             ; preds = %.preheader64.9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %145 = call i32 @sc_thread_join(ptr noundef nonnull %5, ptr noundef nonnull %7)
  %146 = icmp eq i32 %145, 0
  br i1 %146, label %149, label %148

147:                                              ; preds = %.preheader64.9, %.preheader64.8, %.preheader64.7, %.preheader64.6, %.preheader64.5, %.preheader64.4, %.preheader64.3, %.preheader64.2, %.preheader64.1, %.preheader64.preheader
  call void @__assert_fail(ptr noundef nonnull @.str.144, ptr noundef nonnull @.str.3, i32 noundef 1838, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

148:                                              ; preds = %.preheader.9, %.preheader.8, %.preheader.7, %.preheader.6, %.preheader.5, %.preheader.4, %.preheader.3, %.preheader.2, %.preheader.1, %.preheader.preheader
  call void @__assert_fail(ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.3, i32 noundef 1844, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

149:                                              ; preds = %.preheader.preheader
  %150 = load ptr, ptr %7, align 8, !tbaa !9
  %151 = icmp eq ptr %150, %2
  br i1 %151, label %.preheader.1, label %152

152:                                              ; preds = %195, %190, %185, %180, %175, %170, %165, %160, %155, %149
  call void @__assert_fail(ptr noundef nonnull @.str.145, ptr noundef nonnull @.str.3, i32 noundef 1845, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

.preheader.1:                                     ; preds = %149
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %153 = call i32 @sc_thread_join(ptr noundef nonnull %26, ptr noundef nonnull %7)
  %154 = icmp eq i32 %153, 0
  br i1 %154, label %155, label %148

155:                                              ; preds = %.preheader.1
  %156 = load ptr, ptr %7, align 8, !tbaa !9
  %157 = icmp eq ptr %156, %2
  br i1 %157, label %.preheader.2, label %152

.preheader.2:                                     ; preds = %155
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %158 = call i32 @sc_thread_join(ptr noundef nonnull %29, ptr noundef nonnull %7)
  %159 = icmp eq i32 %158, 0
  br i1 %159, label %160, label %148

160:                                              ; preds = %.preheader.2
  %161 = load ptr, ptr %7, align 8, !tbaa !9
  %162 = icmp eq ptr %161, %2
  br i1 %162, label %.preheader.3, label %152

.preheader.3:                                     ; preds = %160
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %163 = call i32 @sc_thread_join(ptr noundef nonnull %32, ptr noundef nonnull %7)
  %164 = icmp eq i32 %163, 0
  br i1 %164, label %165, label %148

165:                                              ; preds = %.preheader.3
  %166 = load ptr, ptr %7, align 8, !tbaa !9
  %167 = icmp eq ptr %166, %2
  br i1 %167, label %.preheader.4, label %152

.preheader.4:                                     ; preds = %165
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %168 = call i32 @sc_thread_join(ptr noundef nonnull %35, ptr noundef nonnull %7)
  %169 = icmp eq i32 %168, 0
  br i1 %169, label %170, label %148

170:                                              ; preds = %.preheader.4
  %171 = load ptr, ptr %7, align 8, !tbaa !9
  %172 = icmp eq ptr %171, %2
  br i1 %172, label %.preheader.5, label %152

.preheader.5:                                     ; preds = %170
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %173 = call i32 @sc_thread_join(ptr noundef nonnull %38, ptr noundef nonnull %7)
  %174 = icmp eq i32 %173, 0
  br i1 %174, label %175, label %148

175:                                              ; preds = %.preheader.5
  %176 = load ptr, ptr %7, align 8, !tbaa !9
  %177 = icmp eq ptr %176, %2
  br i1 %177, label %.preheader.6, label %152

.preheader.6:                                     ; preds = %175
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %178 = call i32 @sc_thread_join(ptr noundef nonnull %41, ptr noundef nonnull %7)
  %179 = icmp eq i32 %178, 0
  br i1 %179, label %180, label %148

180:                                              ; preds = %.preheader.6
  %181 = load ptr, ptr %7, align 8, !tbaa !9
  %182 = icmp eq ptr %181, %2
  br i1 %182, label %.preheader.7, label %152

.preheader.7:                                     ; preds = %180
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %183 = call i32 @sc_thread_join(ptr noundef nonnull %44, ptr noundef nonnull %7)
  %184 = icmp eq i32 %183, 0
  br i1 %184, label %185, label %148

185:                                              ; preds = %.preheader.7
  %186 = load ptr, ptr %7, align 8, !tbaa !9
  %187 = icmp eq ptr %186, %2
  br i1 %187, label %.preheader.8, label %152

.preheader.8:                                     ; preds = %185
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %188 = call i32 @sc_thread_join(ptr noundef nonnull %47, ptr noundef nonnull %7)
  %189 = icmp eq i32 %188, 0
  br i1 %189, label %190, label %148

190:                                              ; preds = %.preheader.8
  %191 = load ptr, ptr %7, align 8, !tbaa !9
  %192 = icmp eq ptr %191, %2
  br i1 %192, label %.preheader.9, label %152

.preheader.9:                                     ; preds = %190
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %193 = call i32 @sc_thread_join(ptr noundef nonnull %50, ptr noundef nonnull %7)
  %194 = icmp eq i32 %193, 0
  br i1 %194, label %195, label %148

195:                                              ; preds = %.preheader.9
  %196 = load ptr, ptr %7, align 8, !tbaa !9
  %197 = icmp eq ptr %196, %2
  br i1 %197, label %198, label %152

198:                                              ; preds = %195
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  %199 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.146)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %200 = call i32 @sc_thread_join(ptr noundef nonnull %6, ptr noundef nonnull %8)
  %201 = icmp eq i32 %200, 0
  br i1 %201, label %203, label %202

.lr.ph97.preheader:                               ; preds = %261
  %wide.trip.count = zext nneg i32 %.157.lcssa to i64
  br label %.lr.ph97

202:                                              ; preds = %255, %249, %243, %237, %231, %225, %219, %213, %207, %198
  call void @__assert_fail(ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.3, i32 noundef 1852, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

203:                                              ; preds = %198
  %204 = load ptr, ptr %8, align 8, !tbaa !9
  %205 = icmp eq ptr %204, %2
  br i1 %205, label %207, label %206

206:                                              ; preds = %258, %252, %246, %240, %234, %228, %222, %216, %210, %203
  call void @__assert_fail(ptr noundef nonnull @.str.145, ptr noundef nonnull @.str.3, i32 noundef 1853, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

207:                                              ; preds = %203
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %208 = call i32 @sc_thread_join(ptr noundef nonnull %27, ptr noundef nonnull %8)
  %209 = icmp eq i32 %208, 0
  br i1 %209, label %210, label %202

210:                                              ; preds = %207
  %211 = load ptr, ptr %8, align 8, !tbaa !9
  %212 = icmp eq ptr %211, %2
  br i1 %212, label %213, label %206

213:                                              ; preds = %210
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %214 = call i32 @sc_thread_join(ptr noundef nonnull %30, ptr noundef nonnull %8)
  %215 = icmp eq i32 %214, 0
  br i1 %215, label %216, label %202

216:                                              ; preds = %213
  %217 = load ptr, ptr %8, align 8, !tbaa !9
  %218 = icmp eq ptr %217, %2
  br i1 %218, label %219, label %206

219:                                              ; preds = %216
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %220 = call i32 @sc_thread_join(ptr noundef nonnull %33, ptr noundef nonnull %8)
  %221 = icmp eq i32 %220, 0
  br i1 %221, label %222, label %202

222:                                              ; preds = %219
  %223 = load ptr, ptr %8, align 8, !tbaa !9
  %224 = icmp eq ptr %223, %2
  br i1 %224, label %225, label %206

225:                                              ; preds = %222
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %226 = call i32 @sc_thread_join(ptr noundef nonnull %36, ptr noundef nonnull %8)
  %227 = icmp eq i32 %226, 0
  br i1 %227, label %228, label %202

228:                                              ; preds = %225
  %229 = load ptr, ptr %8, align 8, !tbaa !9
  %230 = icmp eq ptr %229, %2
  br i1 %230, label %231, label %206

231:                                              ; preds = %228
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %232 = call i32 @sc_thread_join(ptr noundef nonnull %39, ptr noundef nonnull %8)
  %233 = icmp eq i32 %232, 0
  br i1 %233, label %234, label %202

234:                                              ; preds = %231
  %235 = load ptr, ptr %8, align 8, !tbaa !9
  %236 = icmp eq ptr %235, %2
  br i1 %236, label %237, label %206

237:                                              ; preds = %234
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %238 = call i32 @sc_thread_join(ptr noundef nonnull %42, ptr noundef nonnull %8)
  %239 = icmp eq i32 %238, 0
  br i1 %239, label %240, label %202

240:                                              ; preds = %237
  %241 = load ptr, ptr %8, align 8, !tbaa !9
  %242 = icmp eq ptr %241, %2
  br i1 %242, label %243, label %206

243:                                              ; preds = %240
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %244 = call i32 @sc_thread_join(ptr noundef nonnull %45, ptr noundef nonnull %8)
  %245 = icmp eq i32 %244, 0
  br i1 %245, label %246, label %202

246:                                              ; preds = %243
  %247 = load ptr, ptr %8, align 8, !tbaa !9
  %248 = icmp eq ptr %247, %2
  br i1 %248, label %249, label %206

249:                                              ; preds = %246
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %250 = call i32 @sc_thread_join(ptr noundef nonnull %48, ptr noundef nonnull %8)
  %251 = icmp eq i32 %250, 0
  br i1 %251, label %252, label %202

252:                                              ; preds = %249
  %253 = load ptr, ptr %8, align 8, !tbaa !9
  %254 = icmp eq ptr %253, %2
  br i1 %254, label %255, label %206

255:                                              ; preds = %252
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %256 = call i32 @sc_thread_join(ptr noundef nonnull %51, ptr noundef nonnull %8)
  %257 = icmp eq i32 %256, 0
  br i1 %257, label %258, label %202

258:                                              ; preds = %255
  %259 = load ptr, ptr %8, align 8, !tbaa !9
  %260 = icmp eq ptr %259, %2
  br i1 %260, label %261, label %206

261:                                              ; preds = %258
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  %262 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.147)
  %263 = icmp sgt i32 %.157.lcssa, 0
  br i1 %263, label %.lr.ph97.preheader, label %._crit_edge

264:                                              ; preds = %.lr.ph97
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond112.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond112.not, label %._crit_edge, label %.lr.ph97, !llvm.loop !20

._crit_edge:                                      ; preds = %264, %261
  %265 = call i32 @sc_sock_term(ptr noundef nonnull %1) #6
  %266 = icmp eq i32 %265, 0
  br i1 %266, label %272, label %271

.lr.ph97:                                         ; preds = %.lr.ph97.preheader, %264
  %indvars.iv = phi i64 [ 0, %.lr.ph97.preheader ], [ %indvars.iv.next, %264 ]
  %267 = getelementptr inbounds [10 x %struct.sc_sock], ptr %4, i64 0, i64 %indvars.iv
  %268 = call i32 @sc_sock_term(ptr noundef nonnull %267) #6
  %269 = icmp eq i32 %268, 0
  br i1 %269, label %264, label %270

270:                                              ; preds = %.lr.ph97
  call void @__assert_fail(ptr noundef nonnull @.str.148, ptr noundef nonnull @.str.3, i32 noundef 1858, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

271:                                              ; preds = %._crit_edge
  call void @__assert_fail(ptr noundef nonnull @.str.89, ptr noundef nonnull @.str.3, i32 noundef 1861, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

272:                                              ; preds = %._crit_edge
  %273 = call i32 @sc_sock_poll_term(ptr noundef nonnull %2) #6
  %274 = icmp eq i32 %273, 0
  br i1 %274, label %276, label %275

275:                                              ; preds = %272
  call void @__assert_fail(ptr noundef nonnull @.str.76, ptr noundef nonnull @.str.3, i32 noundef 1870, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

276:                                              ; preds = %272
  %277 = getelementptr inbounds i8, ptr %2, i64 8
  %278 = load ptr, ptr %277, align 8, !tbaa !21
  %279 = icmp eq ptr %278, null
  br i1 %279, label %281, label %280

280:                                              ; preds = %276
  call void @__assert_fail(ptr noundef nonnull @.str.149, ptr noundef nonnull @.str.3, i32 noundef 1871, ptr noundef nonnull @__PRETTY_FUNCTION__.test_poll_threadsafe) #7
  unreachable

281:                                              ; preds = %276
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 1480, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 240, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 148, ptr nonnull %1) #6
  ret void
}

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 = { "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 #4 = { noreturn 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn nounwind }
attributes #8 = { nounwind willreturn memory(none) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !12, i64 16}
!16 = !{!"poll_and_sock", !10, i64 0, !10, i64 8, !12, i64 16, !6, i64 20}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = !{!22, !10, i64 8}
!22 = !{!"sc_sock_poll", !6, i64 0, !10, i64 8}


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