; LLVM IR from godzilla-foundation/godzilla-community :: core/deps/nanomsg-1.1.5/src/core (poll)

; 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.nn_pollfd = type { i32, i16, i16 }
%struct.pollfd = type { i32, i16, i16 }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [23 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [112 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @nn_poll(ptr noundef %0, i32 noundef %1, i32 noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %16 = load i32, ptr %6, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  %18 = mul i64 8, %17
  %19 = mul i64 %18, 2
  %20 = call ptr @nn_alloc_(i64 noundef %19)
  store ptr %20, ptr %14, align 8, !tbaa !5
  br label %21

21:                                               ; preds = %3
  %22 = load ptr, ptr %14, align 8, !tbaa !5
  %23 = icmp ne ptr %22, null
  %24 = xor i1 %23, true
  %25 = zext i1 %24 to i32
  %26 = sext i32 %25 to i64
  %27 = call i64 @llvm.expect.i64(i64 %26, i64 0)
  %28 = icmp ne i64 %27, 0
  br i1 %28, label %29, label %34

29:                                               ; preds = %21
  call void @nn_backtrace_print()
  %30 = load ptr, ptr @stderr, align 8, !tbaa !5
  %31 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 140) #7
  %32 = load ptr, ptr @stderr, align 8, !tbaa !5
  %33 = call i32 @fflush(ptr noundef %32)
  call void @nn_err_abort() #8
  unreachable

34:                                               ; preds = %21
  br label %35

35:                                               ; preds = %34
  br label %36

36:                                               ; preds = %35
  store i32 0, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %37

37:                                               ; preds = %154, %36
  %38 = load i32, ptr %9, align 4, !tbaa !9
  %39 = load i32, ptr %6, align 4, !tbaa !9
  %40 = icmp ne i32 %38, %39
  br i1 %40, label %41, label %157

41:                                               ; preds = %37
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = load i32, ptr %9, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds %struct.nn_pollfd, ptr %42, i64 %44
  %46 = getelementptr inbounds %struct.nn_pollfd, ptr %45, i32 0, i32 1
  %47 = load i16, ptr %46, align 4, !tbaa !11
  %48 = sext i16 %47 to i32
  %49 = and i32 %48, 1
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %51, label %97

51:                                               ; preds = %41
  store i64 4, ptr %13, align 8, !tbaa !14
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = load i32, ptr %9, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds %struct.nn_pollfd, ptr %52, i64 %54
  %56 = getelementptr inbounds %struct.nn_pollfd, ptr %55, i32 0, i32 0
  %57 = load i32, ptr %56, align 4, !tbaa !16
  %58 = call i32 @nn_getsockopt(i32 noundef %57, i32 noundef 0, i32 noundef 11, ptr noundef %11, ptr noundef %13)
  store i32 %58, ptr %8, align 4, !tbaa !9
  %59 = load i32, ptr %8, align 4, !tbaa !9
  %60 = icmp slt i32 %59, 0
  %61 = zext i1 %60 to i32
  %62 = sext i32 %61 to i64
  %63 = call i64 @llvm.expect.i64(i64 %62, i64 0)
  %64 = icmp ne i64 %63, 0
  br i1 %64, label %65, label %67

65:                                               ; preds = %51
  %66 = load ptr, ptr %14, align 8, !tbaa !5
  call void @nn_free(ptr noundef %66)
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %15, align 4
  br label %270

67:                                               ; preds = %51
  br label %68

68:                                               ; preds = %67
  %69 = load i64, ptr %13, align 8, !tbaa !14
  %70 = icmp eq i64 %69, 4
  %71 = xor i1 %70, true
  %72 = zext i1 %71 to i32
  %73 = sext i32 %72 to i64
  %74 = call i64 @llvm.expect.i64(i64 %73, i64 0)
  %75 = icmp ne i64 %74, 0
  br i1 %75, label %76, label %81

76:                                               ; preds = %68
  call void @nn_backtrace_print()
  %77 = load ptr, ptr @stderr, align 8, !tbaa !5
  %78 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 150) #7
  %79 = load ptr, ptr @stderr, align 8, !tbaa !5
  %80 = call i32 @fflush(ptr noundef %79)
  call void @nn_err_abort() #8
  unreachable

81:                                               ; preds = %68
  br label %82

82:                                               ; preds = %81
  br label %83

83:                                               ; preds = %82
  %84 = load i32, ptr %11, align 4, !tbaa !9
  %85 = load ptr, ptr %14, align 8, !tbaa !5
  %86 = load i32, ptr %10, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds %struct.pollfd, ptr %85, i64 %87
  %89 = getelementptr inbounds %struct.pollfd, ptr %88, i32 0, i32 0
  store i32 %84, ptr %89, align 4, !tbaa !17
  %90 = load ptr, ptr %14, align 8, !tbaa !5
  %91 = load i32, ptr %10, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds %struct.pollfd, ptr %90, i64 %92
  %94 = getelementptr inbounds %struct.pollfd, ptr %93, i32 0, i32 1
  store i16 1, ptr %94, align 4, !tbaa !19
  %95 = load i32, ptr %10, align 4, !tbaa !9
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %10, align 4, !tbaa !9
  br label %97

97:                                               ; preds = %83, %41
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = load i32, ptr %9, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds %struct.nn_pollfd, ptr %98, i64 %100
  %102 = getelementptr inbounds %struct.nn_pollfd, ptr %101, i32 0, i32 1
  %103 = load i16, ptr %102, align 4, !tbaa !11
  %104 = sext i16 %103 to i32
  %105 = and i32 %104, 2
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %153

107:                                              ; preds = %97
  store i64 4, ptr %13, align 8, !tbaa !14
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = load i32, ptr %9, align 4, !tbaa !9
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds %struct.nn_pollfd, ptr %108, i64 %110
  %112 = getelementptr inbounds %struct.nn_pollfd, ptr %111, i32 0, i32 0
  %113 = load i32, ptr %112, align 4, !tbaa !16
  %114 = call i32 @nn_getsockopt(i32 noundef %113, i32 noundef 0, i32 noundef 10, ptr noundef %11, ptr noundef %13)
  store i32 %114, ptr %8, align 4, !tbaa !9
  %115 = load i32, ptr %8, align 4, !tbaa !9
  %116 = icmp slt i32 %115, 0
  %117 = zext i1 %116 to i32
  %118 = sext i32 %117 to i64
  %119 = call i64 @llvm.expect.i64(i64 %118, i64 0)
  %120 = icmp ne i64 %119, 0
  br i1 %120, label %121, label %123

121:                                              ; preds = %107
  %122 = load ptr, ptr %14, align 8, !tbaa !5
  call void @nn_free(ptr noundef %122)
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %15, align 4
  br label %270

123:                                              ; preds = %107
  br label %124

124:                                              ; preds = %123
  %125 = load i64, ptr %13, align 8, !tbaa !14
  %126 = icmp eq i64 %125, 4
  %127 = xor i1 %126, true
  %128 = zext i1 %127 to i32
  %129 = sext i32 %128 to i64
  %130 = call i64 @llvm.expect.i64(i64 %129, i64 0)
  %131 = icmp ne i64 %130, 0
  br i1 %131, label %132, label %137

132:                                              ; preds = %124
  call void @nn_backtrace_print()
  %133 = load ptr, ptr @stderr, align 8, !tbaa !5
  %134 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %133, ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 162) #7
  %135 = load ptr, ptr @stderr, align 8, !tbaa !5
  %136 = call i32 @fflush(ptr noundef %135)
  call void @nn_err_abort() #8
  unreachable

137:                                              ; preds = %124
  br label %138

138:                                              ; preds = %137
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %11, align 4, !tbaa !9
  %141 = load ptr, ptr %14, align 8, !tbaa !5
  %142 = load i32, ptr %10, align 4, !tbaa !9
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds %struct.pollfd, ptr %141, i64 %143
  %145 = getelementptr inbounds %struct.pollfd, ptr %144, i32 0, i32 0
  store i32 %140, ptr %145, align 4, !tbaa !17
  %146 = load ptr, ptr %14, align 8, !tbaa !5
  %147 = load i32, ptr %10, align 4, !tbaa !9
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds %struct.pollfd, ptr %146, i64 %148
  %150 = getelementptr inbounds %struct.pollfd, ptr %149, i32 0, i32 1
  store i16 1, ptr %150, align 4, !tbaa !19
  %151 = load i32, ptr %10, align 4, !tbaa !9
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %10, align 4, !tbaa !9
  br label %153

153:                                              ; preds = %139, %97
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %9, align 4, !tbaa !9
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %9, align 4, !tbaa !9
  br label %37, !llvm.loop !20

157:                                              ; preds = %37
  %158 = load ptr, ptr %14, align 8, !tbaa !5
  %159 = load i32, ptr %10, align 4, !tbaa !9
  %160 = sext i32 %159 to i64
  %161 = load i32, ptr %7, align 4, !tbaa !9
  %162 = call i32 @poll(ptr noundef %158, i64 noundef %160, i32 noundef %161)
  store i32 %162, ptr %8, align 4, !tbaa !9
  %163 = load i32, ptr %8, align 4, !tbaa !9
  %164 = icmp sle i32 %163, 0
  %165 = zext i1 %164 to i32
  %166 = sext i32 %165 to i64
  %167 = call i64 @llvm.expect.i64(i64 %166, i64 0)
  %168 = icmp ne i64 %167, 0
  br i1 %168, label %169, label %176

169:                                              ; preds = %157
  %170 = call ptr @__errno_location() #9
  %171 = load i32, ptr %170, align 4, !tbaa !9
  store i32 %171, ptr %12, align 4, !tbaa !9
  %172 = load ptr, ptr %14, align 8, !tbaa !5
  call void @nn_free(ptr noundef %172)
  %173 = load i32, ptr %12, align 4, !tbaa !9
  %174 = call ptr @__errno_location() #9
  store i32 %173, ptr %174, align 4, !tbaa !9
  %175 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %175, ptr %4, align 4
  store i32 1, ptr %15, align 4
  br label %270

176:                                              ; preds = %157
  store i32 0, ptr %12, align 4, !tbaa !9
  store i32 0, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %177

177:                                              ; preds = %264, %176
  %178 = load i32, ptr %9, align 4, !tbaa !9
  %179 = load i32, ptr %6, align 4, !tbaa !9
  %180 = icmp ne i32 %178, %179
  br i1 %180, label %181, label %267

181:                                              ; preds = %177
  %182 = load ptr, ptr %5, align 8, !tbaa !5
  %183 = load i32, ptr %9, align 4, !tbaa !9
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds %struct.nn_pollfd, ptr %182, i64 %184
  %186 = getelementptr inbounds %struct.nn_pollfd, ptr %185, i32 0, i32 2
  store i16 0, ptr %186, align 2, !tbaa !22
  %187 = load ptr, ptr %5, align 8, !tbaa !5
  %188 = load i32, ptr %9, align 4, !tbaa !9
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds %struct.nn_pollfd, ptr %187, i64 %189
  %191 = getelementptr inbounds %struct.nn_pollfd, ptr %190, i32 0, i32 1
  %192 = load i16, ptr %191, align 4, !tbaa !11
  %193 = sext i16 %192 to i32
  %194 = and i32 %193, 1
  %195 = icmp ne i32 %194, 0
  br i1 %195, label %196, label %219

196:                                              ; preds = %181
  %197 = load ptr, ptr %14, align 8, !tbaa !5
  %198 = load i32, ptr %10, align 4, !tbaa !9
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds %struct.pollfd, ptr %197, i64 %199
  %201 = getelementptr inbounds %struct.pollfd, ptr %200, i32 0, i32 2
  %202 = load i16, ptr %201, align 2, !tbaa !23
  %203 = sext i16 %202 to i32
  %204 = and i32 %203, 1
  %205 = icmp ne i32 %204, 0
  br i1 %205, label %206, label %216

206:                                              ; preds = %196
  %207 = load ptr, ptr %5, align 8, !tbaa !5
  %208 = load i32, ptr %9, align 4, !tbaa !9
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds %struct.nn_pollfd, ptr %207, i64 %209
  %211 = getelementptr inbounds %struct.nn_pollfd, ptr %210, i32 0, i32 2
  %212 = load i16, ptr %211, align 2, !tbaa !22
  %213 = sext i16 %212 to i32
  %214 = or i32 %213, 1
  %215 = trunc i32 %214 to i16
  store i16 %215, ptr %211, align 2, !tbaa !22
  br label %216

216:                                              ; preds = %206, %196
  %217 = load i32, ptr %10, align 4, !tbaa !9
  %218 = add nsw i32 %217, 1
  store i32 %218, ptr %10, align 4, !tbaa !9
  br label %219

219:                                              ; preds = %216, %181
  %220 = load ptr, ptr %5, align 8, !tbaa !5
  %221 = load i32, ptr %9, align 4, !tbaa !9
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds %struct.nn_pollfd, ptr %220, i64 %222
  %224 = getelementptr inbounds %struct.nn_pollfd, ptr %223, i32 0, i32 1
  %225 = load i16, ptr %224, align 4, !tbaa !11
  %226 = sext i16 %225 to i32
  %227 = and i32 %226, 2
  %228 = icmp ne i32 %227, 0
  br i1 %228, label %229, label %252

229:                                              ; preds = %219
  %230 = load ptr, ptr %14, align 8, !tbaa !5
  %231 = load i32, ptr %10, align 4, !tbaa !9
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds %struct.pollfd, ptr %230, i64 %232
  %234 = getelementptr inbounds %struct.pollfd, ptr %233, i32 0, i32 2
  %235 = load i16, ptr %234, align 2, !tbaa !23
  %236 = sext i16 %235 to i32
  %237 = and i32 %236, 1
  %238 = icmp ne i32 %237, 0
  br i1 %238, label %239, label %249

239:                                              ; preds = %229
  %240 = load ptr, ptr %5, align 8, !tbaa !5
  %241 = load i32, ptr %9, align 4, !tbaa !9
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds %struct.nn_pollfd, ptr %240, i64 %242
  %244 = getelementptr inbounds %struct.nn_pollfd, ptr %243, i32 0, i32 2
  %245 = load i16, ptr %244, align 2, !tbaa !22
  %246 = sext i16 %245 to i32
  %247 = or i32 %246, 2
  %248 = trunc i32 %247 to i16
  store i16 %248, ptr %244, align 2, !tbaa !22
  br label %249

249:                                              ; preds = %239, %229
  %250 = load i32, ptr %10, align 4, !tbaa !9
  %251 = add nsw i32 %250, 1
  store i32 %251, ptr %10, align 4, !tbaa !9
  br label %252

252:                                              ; preds = %249, %219
  %253 = load ptr, ptr %5, align 8, !tbaa !5
  %254 = load i32, ptr %9, align 4, !tbaa !9
  %255 = sext i32 %254 to i64
  %256 = getelementptr inbounds %struct.nn_pollfd, ptr %253, i64 %255
  %257 = getelementptr inbounds %struct.nn_pollfd, ptr %256, i32 0, i32 2
  %258 = load i16, ptr %257, align 2, !tbaa !22
  %259 = icmp ne i16 %258, 0
  br i1 %259, label %260, label %263

260:                                              ; preds = %252
  %261 = load i32, ptr %12, align 4, !tbaa !9
  %262 = add nsw i32 %261, 1
  store i32 %262, ptr %12, align 4, !tbaa !9
  br label %263

263:                                              ; preds = %260, %252
  br label %264

264:                                              ; preds = %263
  %265 = load i32, ptr %9, align 4, !tbaa !9
  %266 = add nsw i32 %265, 1
  store i32 %266, ptr %9, align 4, !tbaa !9
  br label %177, !llvm.loop !24

267:                                              ; preds = %177
  %268 = load ptr, ptr %14, align 8, !tbaa !5
  call void @nn_free(ptr noundef %268)
  %269 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %269, ptr %4, align 4
  store i32 1, ptr %15, align 4
  br label %270

270:                                              ; preds = %267, %169, %121, %65
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  %271 = load i32, ptr %4, align 4
  ret i32 %271
}

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

declare ptr @nn_alloc_(i64 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #3

declare void @nn_backtrace_print() #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #4

declare i32 @fflush(ptr noundef) #2

; Function Attrs: noreturn
declare void @nn_err_abort() #5

declare i32 @nn_getsockopt(i32 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) #2

declare void @nn_free(ptr noundef) #2

declare i32 @poll(ptr noundef, i64 noundef, i32 noundef) #2

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #4 = { 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 = { noreturn "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 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 #7 = { nounwind }
attributes #8 = { noreturn }
attributes #9 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 4}
!12 = !{!"nn_pollfd", !10, i64 0, !13, i64 4, !13, i64 6}
!13 = !{!"short", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!12, !10, i64 0}
!17 = !{!18, !10, i64 0}
!18 = !{!"pollfd", !10, i64 0, !13, i64 4, !13, i64 6}
!19 = !{!18, !13, i64 4}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!12, !13, i64 6}
!23 = !{!18, !13, i64 6}
!24 = distinct !{!24, !21}


; 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.nn_pollfd = type { i32, i16, i16 }
%struct.pollfd = type { i32, i16, i16 }

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [23 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [112 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @nn_poll(ptr nocapture noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %6 = sext i32 %1 to i64
  %7 = shl nsw i64 %6, 4
  %8 = tail call ptr @nn_alloc_(i64 noundef %7) #6
  %.not = icmp eq ptr %8, null
  br i1 %.not, label %10, label %.preheader76, !prof !5

.preheader76:                                     ; preds = %3
  %.not6581 = icmp eq i32 %1, 0
  br i1 %.not6581, label %._crit_edge.thread, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader76
  %9 = zext i32 %1 to i64
  br label %.lr.ph

10:                                               ; preds = %3
  tail call void @nn_backtrace_print() #6
  %11 = load ptr, ptr @stderr, align 8, !tbaa !6
  %12 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 140) #7
  %13 = load ptr, ptr @stderr, align 8, !tbaa !6
  %14 = tail call i32 @fflush(ptr noundef %13)
  tail call void @nn_err_abort() #8
  unreachable

.lr.ph:                                           ; preds = %.lr.ph.preheader, %58
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %58 ]
  %.05983 = phi i32 [ 0, %.lr.ph.preheader ], [ %.2, %58 ]
  %15 = getelementptr inbounds %struct.nn_pollfd, ptr %0, i64 %indvars.iv
  %16 = getelementptr inbounds i8, ptr %15, i64 4
  %17 = load i16, ptr %16, align 4, !tbaa !10
  %18 = and i16 %17, 1
  %.not72 = icmp eq i16 %18, 0
  br i1 %.not72, label %37, label %19

19:                                               ; preds = %.lr.ph
  store i64 4, ptr %5, align 8, !tbaa !14
  %20 = load i32, ptr %15, align 4, !tbaa !16
  %21 = call i32 @nn_getsockopt(i32 noundef %20, i32 noundef 0, i32 noundef 11, ptr noundef nonnull %4, ptr noundef nonnull %5) #6
  %22 = icmp slt i32 %21, 0
  br i1 %22, label %23, label %24, !prof !5

23:                                               ; preds = %19
  call void @nn_free(ptr noundef nonnull %8) #6
  br label %99

24:                                               ; preds = %19
  %25 = load i64, ptr %5, align 8, !tbaa !14
  %.not73 = icmp eq i64 %25, 4
  br i1 %.not73, label %31, label %26, !prof !17

26:                                               ; preds = %24
  call void @nn_backtrace_print() #6
  %27 = load ptr, ptr @stderr, align 8, !tbaa !6
  %28 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 150) #7
  %29 = load ptr, ptr @stderr, align 8, !tbaa !6
  %30 = call i32 @fflush(ptr noundef %29)
  call void @nn_err_abort() #8
  unreachable

31:                                               ; preds = %24
  %32 = load i32, ptr %4, align 4, !tbaa !18
  %33 = sext i32 %.05983 to i64
  %34 = getelementptr inbounds %struct.pollfd, ptr %8, i64 %33
  store i32 %32, ptr %34, align 4, !tbaa !19
  %35 = getelementptr inbounds i8, ptr %34, i64 4
  store i16 1, ptr %35, align 4, !tbaa !21
  %36 = add nsw i32 %.05983, 1
  %.pre = load i16, ptr %16, align 4, !tbaa !10
  br label %37

37:                                               ; preds = %31, %.lr.ph
  %38 = phi i16 [ %.pre, %31 ], [ %17, %.lr.ph ]
  %.160 = phi i32 [ %36, %31 ], [ %.05983, %.lr.ph ]
  %39 = and i16 %38, 2
  %.not74 = icmp eq i16 %39, 0
  br i1 %.not74, label %58, label %40

40:                                               ; preds = %37
  store i64 4, ptr %5, align 8, !tbaa !14
  %41 = load i32, ptr %15, align 4, !tbaa !16
  %42 = call i32 @nn_getsockopt(i32 noundef %41, i32 noundef 0, i32 noundef 10, ptr noundef nonnull %4, ptr noundef nonnull %5) #6
  %43 = icmp slt i32 %42, 0
  br i1 %43, label %44, label %45, !prof !5

44:                                               ; preds = %40
  call void @nn_free(ptr noundef nonnull %8) #6
  br label %99

45:                                               ; preds = %40
  %46 = load i64, ptr %5, align 8, !tbaa !14
  %.not75 = icmp eq i64 %46, 4
  br i1 %.not75, label %52, label %47, !prof !17

47:                                               ; preds = %45
  call void @nn_backtrace_print() #6
  %48 = load ptr, ptr @stderr, align 8, !tbaa !6
  %49 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 162) #7
  %50 = load ptr, ptr @stderr, align 8, !tbaa !6
  %51 = call i32 @fflush(ptr noundef %50)
  call void @nn_err_abort() #8
  unreachable

52:                                               ; preds = %45
  %53 = load i32, ptr %4, align 4, !tbaa !18
  %54 = sext i32 %.160 to i64
  %55 = getelementptr inbounds %struct.pollfd, ptr %8, i64 %54
  store i32 %53, ptr %55, align 4, !tbaa !19
  %56 = getelementptr inbounds i8, ptr %55, i64 4
  store i16 1, ptr %56, align 4, !tbaa !21
  %57 = add nsw i32 %.160, 1
  br label %58

58:                                               ; preds = %37, %52
  %.2 = phi i32 [ %57, %52 ], [ %.160, %37 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %.not65 = icmp eq i64 %indvars.iv.next, %9
  br i1 %.not65, label %._crit_edge, label %.lr.ph, !llvm.loop !22

._crit_edge:                                      ; preds = %58
  %59 = sext i32 %.2 to i64
  %60 = call i32 @poll(ptr noundef nonnull %8, i64 noundef %59, i32 noundef %2) #6
  %61 = icmp slt i32 %60, 1
  br i1 %61, label %65, label %.preheader, !prof !5

._crit_edge.thread:                               ; preds = %.preheader76
  %62 = tail call i32 @poll(ptr noundef nonnull %8, i64 noundef 0, i32 noundef %2) #6
  %63 = icmp slt i32 %62, 1
  br i1 %63, label %65, label %._crit_edge89, !prof !5

.preheader:                                       ; preds = %._crit_edge
  br i1 %.not6581, label %._crit_edge89, label %.lr.ph88.preheader

.lr.ph88.preheader:                               ; preds = %.preheader
  %64 = zext i32 %1 to i64
  br label %.lr.ph88

65:                                               ; preds = %._crit_edge.thread, %._crit_edge
  %66 = phi i32 [ %62, %._crit_edge.thread ], [ %60, %._crit_edge ]
  %67 = tail call ptr @__errno_location() #9
  %68 = load i32, ptr %67, align 4, !tbaa !18
  call void @nn_free(ptr noundef nonnull %8) #6
  store i32 %68, ptr %67, align 4, !tbaa !18
  br label %99

.lr.ph88:                                         ; preds = %.lr.ph88.preheader, %96
  %indvars.iv92 = phi i64 [ 0, %.lr.ph88.preheader ], [ %indvars.iv.next93, %96 ]
  %.05887 = phi i32 [ 0, %.lr.ph88.preheader ], [ %spec.select, %96 ]
  %.386 = phi i32 [ 0, %.lr.ph88.preheader ], [ %.5, %96 ]
  %69 = getelementptr inbounds %struct.nn_pollfd, ptr %0, i64 %indvars.iv92
  %70 = getelementptr inbounds i8, ptr %69, i64 6
  store i16 0, ptr %70, align 2, !tbaa !24
  %71 = getelementptr inbounds i8, ptr %69, i64 4
  %72 = load i16, ptr %71, align 4, !tbaa !10
  %73 = and i16 %72, 1
  %.not67 = icmp eq i16 %73, 0
  br i1 %.not67, label %83, label %74

74:                                               ; preds = %.lr.ph88
  %75 = sext i32 %.386 to i64
  %76 = getelementptr inbounds %struct.pollfd, ptr %8, i64 %75, i32 2
  %77 = load i16, ptr %76, align 2, !tbaa !25
  %78 = and i16 %77, 1
  %.not68 = icmp eq i16 %78, 0
  br i1 %.not68, label %80, label %79

79:                                               ; preds = %74
  store i16 1, ptr %70, align 2, !tbaa !24
  br label %80

80:                                               ; preds = %79, %74
  %81 = phi i16 [ 1, %79 ], [ 0, %74 ]
  %82 = add nsw i32 %.386, 1
  br label %83

83:                                               ; preds = %80, %.lr.ph88
  %84 = phi i16 [ %81, %80 ], [ 0, %.lr.ph88 ]
  %.4 = phi i32 [ %82, %80 ], [ %.386, %.lr.ph88 ]
  %85 = and i16 %72, 2
  %.not69 = icmp eq i16 %85, 0
  br i1 %.not69, label %96, label %86

86:                                               ; preds = %83
  %87 = sext i32 %.4 to i64
  %88 = getelementptr inbounds %struct.pollfd, ptr %8, i64 %87, i32 2
  %89 = load i16, ptr %88, align 2, !tbaa !25
  %90 = and i16 %89, 1
  %.not70 = icmp eq i16 %90, 0
  br i1 %.not70, label %93, label %91

91:                                               ; preds = %86
  %92 = or i16 %84, 2
  store i16 %92, ptr %70, align 2, !tbaa !24
  br label %93

93:                                               ; preds = %91, %86
  %94 = phi i16 [ %92, %91 ], [ %84, %86 ]
  %95 = add nsw i32 %.4, 1
  br label %96

96:                                               ; preds = %93, %83
  %97 = phi i16 [ %94, %93 ], [ %84, %83 ]
  %.5 = phi i32 [ %95, %93 ], [ %.4, %83 ]
  %.not71 = icmp ne i16 %97, 0
  %98 = zext i1 %.not71 to i32
  %spec.select = add nuw nsw i32 %.05887, %98
  %indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
  %.not66 = icmp eq i64 %indvars.iv.next93, %64
  br i1 %.not66, label %._crit_edge89, label %.lr.ph88, !llvm.loop !26

._crit_edge89:                                    ; preds = %96, %._crit_edge.thread, %.preheader
  %.058.lcssa = phi i32 [ 0, %.preheader ], [ 0, %._crit_edge.thread ], [ %spec.select, %96 ]
  call void @nn_free(ptr noundef nonnull %8) #6
  br label %99

99:                                               ; preds = %._crit_edge89, %65, %44, %23
  %.0 = phi i32 [ -1, %23 ], [ -1, %44 ], [ %66, %65 ], [ %.058.lcssa, %._crit_edge89 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  ret i32 %.0
}

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

declare ptr @nn_alloc_(i64 noundef) local_unnamed_addr #2

declare void @nn_backtrace_print() local_unnamed_addr #2

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

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: noreturn
declare void @nn_err_abort() local_unnamed_addr #4

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

declare void @nn_free(ptr noundef) local_unnamed_addr #2

declare i32 @poll(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #2

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { noreturn "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 = { 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 #6 = { nounwind }
attributes #7 = { cold nounwind }
attributes #8 = { noreturn nounwind }
attributes #9 = { 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 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!6 = !{!7, !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !13, i64 4}
!11 = !{!"nn_pollfd", !12, i64 0, !13, i64 4, !13, i64 6}
!12 = !{!"int", !8, i64 0}
!13 = !{!"short", !8, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !8, i64 0}
!16 = !{!11, !12, i64 0}
!17 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!18 = !{!12, !12, i64 0}
!19 = !{!20, !12, i64 0}
!20 = !{!"pollfd", !12, i64 0, !13, i64 4, !13, i64 6}
!21 = !{!20, !13, i64 4}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!11, !13, i64 6}
!25 = !{!20, !13, i64 6}
!26 = distinct !{!26, !23}


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