; LLVM IR from Softmotions/iowow :: src/utils (iwtp)

; 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._task = type { ptr, ptr, ptr }
%struct.iwtp = type { ptr, ptr, %union.pthread_mutex_t, %union.pthread_cond_t, %struct.iwulist, ptr, i32, i32, i32, i32, i32, i8, i8 }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%struct.iwulist = type { ptr, i64, i64, i64, i64 }

@.str = external hidden unnamed_addr constant [68 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @iwtp_schedule(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca %struct._task, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = icmp ne ptr %13, null
  br i1 %14, label %15, label %18

15:                                               ; preds = %3
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = icmp ne ptr %16, null
  br i1 %17, label %19, label %18

18:                                               ; preds = %15, %3
  store i64 70017, ptr %4, align 8
  br label %133

19:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store i64 0, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %20 = call noalias ptr @malloc(i64 noundef 24) #8
  store ptr %20, ptr %9, align 8, !tbaa !5
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %27, label %23

23:                                               ; preds = %19
  %24 = call ptr @__errno_location() #9
  %25 = load i32, ptr %24, align 4, !tbaa !11
  %26 = call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %25)
  store i64 %26, ptr %8, align 8, !tbaa !9
  br label %126

27:                                               ; preds = %19
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._task, ptr %10, i32 0, i32 0
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %30, ptr %29, align 8, !tbaa !13
  %31 = getelementptr inbounds %struct._task, ptr %10, i32 0, i32 1
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %32, ptr %31, align 8, !tbaa !15
  %33 = getelementptr inbounds %struct._task, ptr %10, i32 0, i32 2
  store ptr null, ptr %33, align 8, !tbaa !16
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %28, ptr align 8 %10, i64 24, i1 false), !tbaa.struct !17
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.iwtp, ptr %34, i32 0, i32 2
  %36 = call i32 @pthread_mutex_lock(ptr noundef %35) #7
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.iwtp, ptr %37, i32 0, i32 9
  %39 = load i32, ptr %38, align 4, !tbaa !18
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %57

41:                                               ; preds = %27
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.iwtp, ptr %42, i32 0, i32 10
  %44 = load i32, ptr %43, align 8, !tbaa !22
  %45 = add nsw i32 %44, 1
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.iwtp, ptr %46, i32 0, i32 9
  %48 = load i32, ptr %47, align 4, !tbaa !18
  %49 = icmp sgt i32 %45, %48
  br i1 %49, label %50, label %57

50:                                               ; preds = %41
  store i64 70019, ptr %8, align 8, !tbaa !9
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.iwtp, ptr %51, i32 0, i32 2
  %53 = call i32 @pthread_mutex_unlock(ptr noundef %52) #7
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.iwtp, ptr %54, i32 0, i32 9
  %56 = load i32, ptr %55, align 4, !tbaa !18
  call void (i32, i64, ptr, i32, ptr, ...) @iwlog2(i32 noundef 0, i64 noundef 0, ptr noundef @.str, i32 noundef 58, ptr noundef @.str.1, i32 noundef %56)
  br label %126

57:                                               ; preds = %41, %27
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.iwtp, ptr %58, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8, !tbaa !23
  %61 = icmp ne ptr %60, null
  br i1 %61, label %62, label %71

62:                                               ; preds = %57
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.iwtp, ptr %64, i32 0, i32 1
  %66 = load ptr, ptr %65, align 8, !tbaa !23
  %67 = getelementptr inbounds %struct._task, ptr %66, i32 0, i32 2
  store ptr %63, ptr %67, align 8, !tbaa !16
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.iwtp, ptr %69, i32 0, i32 1
  store ptr %68, ptr %70, align 8, !tbaa !23
  br label %78

71:                                               ; preds = %57
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.iwtp, ptr %73, i32 0, i32 0
  store ptr %72, ptr %74, align 8, !tbaa !24
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.iwtp, ptr %76, i32 0, i32 1
  store ptr %75, ptr %77, align 8, !tbaa !23
  br label %78

78:                                               ; preds = %71, %62
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.iwtp, ptr %79, i32 0, i32 10
  %81 = load i32, ptr %80, align 8, !tbaa !22
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %80, align 8, !tbaa !22
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.iwtp, ptr %83, i32 0, i32 10
  %85 = load i32, ptr %84, align 8, !tbaa !22
  %86 = icmp sgt i32 %85, 1
  br i1 %86, label %87, label %119

87:                                               ; preds = %78
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.iwtp, ptr %88, i32 0, i32 7
  %90 = load i32, ptr %89, align 4, !tbaa !25
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.iwtp, ptr %91, i32 0, i32 6
  %93 = load i32, ptr %92, align 8, !tbaa !26
  %94 = icmp sge i32 %90, %93
  br i1 %94, label %95, label %119

95:                                               ; preds = %87
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.iwtp, ptr %96, i32 0, i32 4
  %98 = call i64 @iwulist_length(ptr noundef %97)
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.iwtp, ptr %99, i32 0, i32 6
  %101 = load i32, ptr %100, align 8, !tbaa !26
  %102 = sext i32 %101 to i64
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.iwtp, ptr %103, i32 0, i32 8
  %105 = load i32, ptr %104, align 8, !tbaa !27
  %106 = add nsw i32 1, %105
  %107 = sext i32 %106 to i64
  %108 = mul i64 %102, %107
  %109 = icmp ult i64 %98, %108
  br i1 %109, label %110, label %119

110:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = call i32 @pthread_create(ptr noundef %11, ptr noundef null, ptr noundef @_worker_fn, ptr noundef %111) #7
  store i32 %112, ptr %12, align 4, !tbaa !11
  %113 = load i32, ptr %12, align 4, !tbaa !11
  %114 = icmp ne i32 %113, 0
  br i1 %114, label %115, label %118

115:                                              ; preds = %110
  %116 = load i32, ptr %12, align 4, !tbaa !11
  %117 = call i64 @iwrc_set_errno(i64 noundef 70008, i32 noundef %116)
  call void @iwlog3(i32 noundef 0, i64 noundef %117, ptr noundef @.str, i32 noundef 76, ptr noundef @.str.2)
  br label %118

118:                                              ; preds = %115, %110
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %119

119:                                              ; preds = %118, %95, %87, %78
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.iwtp, ptr %120, i32 0, i32 3
  %122 = call i32 @pthread_cond_signal(ptr noundef %121) #7
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.iwtp, ptr %123, i32 0, i32 2
  %125 = call i32 @pthread_mutex_unlock(ptr noundef %124) #7
  br label %126

126:                                              ; preds = %119, %50, %23
  %127 = load i64, ptr %8, align 8, !tbaa !9
  %128 = icmp ne i64 %127, 0
  br i1 %128, label %129, label %131

129:                                              ; preds = %126
  %130 = load ptr, ptr %9, align 8, !tbaa !5
  call void @free(ptr noundef %130) #7
  br label %131

131:                                              ; preds = %129, %126
  %132 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %132, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %133

133:                                              ; preds = %131, %18
  %134 = load i64, ptr %4, align 8
  ret i64 %134
}

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

declare i64 @iwrc_set_errno(i64 noundef, i32 noundef) #3

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

; 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) #5

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) #6

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) #6

declare void @iwlog2(i32 noundef, i64 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #3

declare i64 @iwulist_length(ptr noundef) #3

; Function Attrs: nounwind
declare i32 @pthread_create(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #6

; Function Attrs: nounwind uwtable
declare hidden ptr @_worker_fn(ptr noundef) #0

declare void @iwlog3(i32 noundef, i64 noundef, ptr noundef, i32 noundef, ptr noundef) #3

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

; Function Attrs: nounwind
declare i32 @pthread_cond_signal(ptr noundef) #6

; Function Attrs: nounwind
declare void @free(ptr noundef) #6

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 = { nounwind allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "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 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"_task", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!14, !6, i64 8}
!16 = !{!14, !6, i64 16}
!17 = !{i64 0, i64 8, !5, i64 8, i64 8, !5, i64 16, i64 8, !5}
!18 = !{!19, !12, i64 164}
!19 = !{!"iwtp", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 56, !20, i64 104, !6, i64 144, !12, i64 152, !12, i64 156, !12, i64 160, !12, i64 164, !12, i64 168, !21, i64 172, !21, i64 173}
!20 = !{!"iwulist", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!21 = !{!"_Bool", !7, i64 0}
!22 = !{!19, !12, i64 168}
!23 = !{!19, !6, i64 8}
!24 = !{!19, !6, i64 0}
!25 = !{!19, !12, i64 156}
!26 = !{!19, !12, i64 152}
!27 = !{!19, !12, i64 160}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = external hidden unnamed_addr constant [68 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @iwtp_schedule(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = alloca i64, align 8
  %5 = icmp ne ptr %0, null
  %6 = icmp ne ptr %1, null
  %or.cond = and i1 %5, %6
  br i1 %or.cond, label %7, label %56

7:                                                ; preds = %3
  %8 = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #7
  %.not = icmp eq ptr %8, null
  br i1 %.not, label %51, label %9

9:                                                ; preds = %7
  store ptr %1, ptr %8, align 8, !tbaa !5
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %8, i64 8
  store ptr %2, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !5
  %.sroa.3.0..sroa_idx = getelementptr inbounds i8, ptr %8, i64 16
  store ptr null, ptr %.sroa.3.0..sroa_idx, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %11 = tail call i32 @pthread_mutex_lock(ptr noundef nonnull %10) #8
  %12 = getelementptr inbounds i8, ptr %0, i64 164
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %.not44 = icmp eq i32 %13, 0
  br i1 %.not44, label %19, label %14

14:                                               ; preds = %9
  %15 = getelementptr inbounds i8, ptr %0, i64 168
  %16 = load i32, ptr %15, align 8, !tbaa !15
  %.not45 = icmp slt i32 %16, %13
  br i1 %.not45, label %19, label %.thread52

.thread52:                                        ; preds = %14
  %17 = tail call i32 @pthread_mutex_unlock(ptr noundef nonnull %10) #8
  %18 = load i32, ptr %12, align 4, !tbaa !9
  tail call void (i32, i64, ptr, i32, ptr, ...) @iwlog2(i32 noundef 0, i64 noundef 0, ptr noundef nonnull @.str, i32 noundef 58, ptr noundef nonnull @.str.1, i32 noundef %18) #8
  br label %55

19:                                               ; preds = %14, %9
  %20 = getelementptr inbounds i8, ptr %0, i64 8
  %21 = load ptr, ptr %20, align 8, !tbaa !16
  %.not46 = icmp eq ptr %21, null
  %22 = getelementptr inbounds i8, ptr %21, i64 16
  %.sink = select i1 %.not46, ptr %0, ptr %22
  store ptr %8, ptr %.sink, align 8, !tbaa !5
  store ptr %8, ptr %20, align 8, !tbaa !16
  %23 = getelementptr inbounds i8, ptr %0, i64 168
  %24 = load i32, ptr %23, align 8, !tbaa !15
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %23, align 8, !tbaa !15
  %26 = icmp sgt i32 %24, 0
  br i1 %26, label %27, label %.thread

27:                                               ; preds = %19
  %28 = getelementptr inbounds i8, ptr %0, i64 156
  %29 = load i32, ptr %28, align 4, !tbaa !17
  %30 = getelementptr inbounds i8, ptr %0, i64 152
  %31 = load i32, ptr %30, align 8, !tbaa !18
  %.not47 = icmp slt i32 %29, %31
  br i1 %.not47, label %.thread, label %32

32:                                               ; preds = %27
  %33 = getelementptr inbounds i8, ptr %0, i64 104
  %34 = tail call i64 @iwulist_length(ptr noundef nonnull %33) #8
  %35 = load i32, ptr %30, align 8, !tbaa !18
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds i8, ptr %0, i64 160
  %38 = load i32, ptr %37, align 8, !tbaa !19
  %39 = add nsw i32 %38, 1
  %40 = sext i32 %39 to i64
  %41 = mul nsw i64 %40, %36
  %42 = icmp ult i64 %34, %41
  br i1 %42, label %43, label %.thread

43:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %44 = call i32 @pthread_create(ptr noundef nonnull %4, ptr noundef null, ptr noundef nonnull @_worker_fn, ptr noundef nonnull %0) #8
  %.not48 = icmp eq i32 %44, 0
  br i1 %.not48, label %47, label %45

45:                                               ; preds = %43
  %46 = call i64 @iwrc_set_errno(i64 noundef 70008, i32 noundef %44) #8
  call void @iwlog3(i32 noundef 0, i64 noundef %46, ptr noundef nonnull @.str, i32 noundef 76, ptr noundef nonnull @.str.2) #8
  br label %47

47:                                               ; preds = %45, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  br label %.thread

.thread:                                          ; preds = %19, %27, %32, %47
  %48 = getelementptr inbounds i8, ptr %0, i64 56
  %49 = call i32 @pthread_cond_signal(ptr noundef nonnull %48) #8
  %50 = call i32 @pthread_mutex_unlock(ptr noundef nonnull %10) #8
  br label %56

51:                                               ; preds = %7
  %52 = tail call ptr @__errno_location() #9
  %53 = load i32, ptr %52, align 4, !tbaa !20
  %54 = tail call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %53) #8
  %.not49 = icmp eq i64 %54, 0
  br i1 %.not49, label %56, label %55

55:                                               ; preds = %.thread52, %51
  %.03755 = phi i64 [ 70019, %.thread52 ], [ %54, %51 ]
  tail call void @free(ptr noundef %8) #8
  br label %56

56:                                               ; preds = %.thread, %51, %55, %3
  %.0 = phi i64 [ 70017, %3 ], [ %.03755, %55 ], [ 0, %51 ], [ 0, %.thread ]
  ret i64 %.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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

declare i64 @iwrc_set_errno(i64 noundef, i32 noundef) local_unnamed_addr #3

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

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) local_unnamed_addr #5

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) local_unnamed_addr #5

declare void @iwlog2(i32 noundef, i64 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #3

declare i64 @iwulist_length(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare i32 @pthread_create(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
declare hidden ptr @_worker_fn(ptr noundef) #0

declare void @iwlog3(i32 noundef, i64 noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; 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
declare i32 @pthread_cond_signal(ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #6

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 nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 #5 = { 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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 allocsize(0) }
attributes #8 = { 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 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !13, i64 164}
!10 = !{!"iwtp", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 56, !11, i64 104, !6, i64 144, !13, i64 152, !13, i64 156, !13, i64 160, !13, i64 164, !13, i64 168, !14, i64 172, !14, i64 173}
!11 = !{!"iwulist", !6, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!12 = !{!"long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!10, !13, i64 168}
!16 = !{!10, !6, i64 8}
!17 = !{!10, !13, i64 156}
!18 = !{!10, !13, i64 152}
!19 = !{!10, !13, i64 160}
!20 = !{!13, !13, i64 0}


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