; LLVM IR from jingweizhanghuai/Morn :: src/ptc (morn_pipeline)

; 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.MThreadSignal = type { %union.pthread_mutex_t, %union.pthread_cond_t, %union.pthread_rwlock_t, i32 }
%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 }
%union.pthread_rwlock_t = type { %struct.__pthread_rwlock_arch_t }
%struct.__pthread_rwlock_arch_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, [7 x i8], i64, i32 }
%struct.MList = type { i32, ptr }
%struct.MHandle = type { i32, i32, ptr, ptr }
%struct.HandlePipeline = type { i32, ptr, ptr, i32, %struct.MThreadSignal, %struct.MThreadSignal, i32 }

@pipeline_sgn = external dso_local global %struct.MThreadSignal, align 8
@.str = external hidden unnamed_addr constant [79 x i8], align 1
@__FUNCTION__.mPipeline = external hidden unnamed_addr constant [10 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@mPipeline.Sgn_valid = external hidden global i32, align 4
@mPipeline.Sgn_valid.4 = external hidden global i32, align 4
@mPipeline.Sgn_valid.5 = external hidden global i32, align 4

; Function Attrs: nounwind uwtable
declare dso_local void @endPipeline(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 ptr @Pipeline0(ptr noundef, i32 noundef) #0

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

; Function Attrs: nounwind
declare i32 @pthread_mutex_init(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind
declare i32 @pthread_rwlock_init(ptr noundef, ptr noundef) #3

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @mPipeline(ptr noundef %0, i32 noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  br label %11

11:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = icmp eq ptr %12, null
  %14 = zext i1 %13 to i32
  store i32 %14, ptr %6, align 4, !tbaa !9
  %15 = load i32, ptr %6, align 4, !tbaa !9
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %17, label %19

17:                                               ; preds = %11
  %18 = load i32, ptr %6, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %18, i32 noundef -1, ptr noundef @.str, i32 noundef 87, ptr noundef @__FUNCTION__.mPipeline, ptr noundef @.str.2)
  br label %19

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

20:                                               ; preds = %19
  br label %21

21:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %22 = load i32, ptr %5, align 4, !tbaa !9
  %23 = icmp slt i32 %22, 0
  br i1 %23, label %30, label %24

24:                                               ; preds = %21
  %25 = load i32, ptr %5, align 4, !tbaa !9
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.MList, ptr %26, i32 0, i32 0
  %28 = load i32, ptr %27, align 8, !tbaa !11
  %29 = icmp sge i32 %25, %28
  br label %30

30:                                               ; preds = %24, %21
  %31 = phi i1 [ true, %21 ], [ %29, %24 ]
  %32 = zext i1 %31 to i32
  store i32 %32, ptr %7, align 4, !tbaa !9
  %33 = load i32, ptr %7, align 4, !tbaa !9
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %37

35:                                               ; preds = %30
  %36 = load i32, ptr %7, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %36, i32 noundef -1, ptr noundef @.str, i32 noundef 88, ptr noundef @__FUNCTION__.mPipeline, ptr noundef @.str.3)
  br label %37

37:                                               ; preds = %35, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %38

38:                                               ; preds = %37
  %39 = load i32, ptr %5, align 4, !tbaa !9
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.MList, ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 8, !tbaa !11
  %43 = sub nsw i32 %42, 1
  %44 = icmp eq i32 %39, %43
  br i1 %44, label %45, label %49

45:                                               ; preds = %38
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = load i32, ptr %5, align 4, !tbaa !9
  %48 = call ptr @Pipeline0(ptr noundef %46, i32 noundef %47)
  store ptr %48, ptr %3, align 8
  br label %245

49:                                               ; preds = %38
  br label %50

50:                                               ; preds = %49
  br label %51

51:                                               ; preds = %50
  %52 = load i32, ptr @mPipeline.Sgn_valid, align 4, !tbaa !9
  %53 = icmp eq i32 %52, 0
  br i1 %53, label %54, label %61

54:                                               ; preds = %51
  %55 = atomicrmw xchg ptr getelementptr inbounds (%struct.MThreadSignal, ptr @pipeline_sgn, i32 0, i32 3), i32 -1135873169 seq_cst, align 8
  %56 = icmp ne i32 %55, -1135873169
  br i1 %56, label %57, label %60

57:                                               ; preds = %54
  %58 = call i32 @pthread_mutex_init(ptr noundef @pipeline_sgn, ptr noundef null) #4
  %59 = call i32 @pthread_rwlock_init(ptr noundef getelementptr inbounds (%struct.MThreadSignal, ptr @pipeline_sgn, i32 0, i32 2), ptr noundef null) #4
  br label %60

60:                                               ; preds = %57, %54
  store i32 1, ptr @mPipeline.Sgn_valid, align 4, !tbaa !9
  br label %61

61:                                               ; preds = %60, %51
  br label %62

62:                                               ; preds = %61
  %63 = call i32 @pthread_mutex_lock(ptr noundef @pipeline_sgn) #4
  br label %64

64:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = call ptr @GetHandle(ptr noundef %65, i32 noundef 344, i32 noundef 75085391, ptr noundef @endPipeline)
  store ptr %66, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.MHandle, ptr %67, i32 0, i32 3
  %69 = load ptr, ptr %68, align 8, !tbaa !13
  store ptr %69, ptr %9, align 8, !tbaa !5
  br label %70

70:                                               ; preds = %75, %64
  %71 = load ptr, ptr %9, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.HandlePipeline, ptr %71, i32 0, i32 3
  %73 = load volatile i32, ptr %72, align 8, !tbaa !15
  %74 = icmp eq i32 %73, 0
  br i1 %74, label %75, label %77

75:                                               ; preds = %70
  %76 = call i32 @usleep(i32 noundef 1000)
  br label %70, !llvm.loop !18

77:                                               ; preds = %70
  %78 = load ptr, ptr %9, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.HandlePipeline, ptr %78, i32 0, i32 1
  %80 = load ptr, ptr %79, align 8, !tbaa !20
  %81 = load i32, ptr %5, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds i32, ptr %80, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !9
  %85 = load ptr, ptr %9, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.HandlePipeline, ptr %85, i32 0, i32 2
  %87 = load ptr, ptr %86, align 8, !tbaa !21
  %88 = load i32, ptr %5, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds i32, ptr %87, i64 %89
  store i32 %84, ptr %90, align 4, !tbaa !9
  %91 = load ptr, ptr %9, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.HandlePipeline, ptr %91, i32 0, i32 3
  %93 = load volatile i32, ptr %92, align 8, !tbaa !15
  %94 = add nsw i32 %93, 1
  store volatile i32 %94, ptr %92, align 8, !tbaa !15
  br label %95

95:                                               ; preds = %77
  %96 = load ptr, ptr %9, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.HandlePipeline, ptr %96, i32 0, i32 3
  %98 = load volatile i32, ptr %97, align 8, !tbaa !15
  %99 = load ptr, ptr %9, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.HandlePipeline, ptr %99, i32 0, i32 0
  %101 = load volatile i32, ptr %100, align 8, !tbaa !22
  %102 = icmp eq i32 %98, %101
  br i1 %102, label %103, label %141

103:                                              ; preds = %95
  br label %104

104:                                              ; preds = %103
  br label %105

105:                                              ; preds = %104
  %106 = load i32, ptr @mPipeline.Sgn_valid.4, align 4, !tbaa !9
  %107 = icmp eq i32 %106, 0
  br i1 %107, label %108, label %124

108:                                              ; preds = %105
  %109 = load ptr, ptr %9, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.HandlePipeline, ptr %109, i32 0, i32 4
  %111 = getelementptr inbounds %struct.MThreadSignal, ptr %110, i32 0, i32 3
  %112 = atomicrmw xchg ptr %111, i32 -1135873169 seq_cst, align 8
  %113 = icmp ne i32 %112, -1135873169
  br i1 %113, label %114, label %123

114:                                              ; preds = %108
  %115 = load ptr, ptr %9, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.HandlePipeline, ptr %115, i32 0, i32 4
  %117 = getelementptr inbounds %struct.MThreadSignal, ptr %116, i32 0, i32 0
  %118 = call i32 @pthread_mutex_init(ptr noundef %117, ptr noundef null) #4
  %119 = load ptr, ptr %9, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.HandlePipeline, ptr %119, i32 0, i32 4
  %121 = getelementptr inbounds %struct.MThreadSignal, ptr %120, i32 0, i32 2
  %122 = call i32 @pthread_rwlock_init(ptr noundef %121, ptr noundef null) #4
  br label %123

123:                                              ; preds = %114, %108
  store i32 1, ptr @mPipeline.Sgn_valid.4, align 4, !tbaa !9
  br label %124

124:                                              ; preds = %123, %105
  br label %125

125:                                              ; preds = %124
  br label %126

126:                                              ; preds = %125
  %127 = load ptr, ptr %9, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.HandlePipeline, ptr %127, i32 0, i32 4
  %129 = getelementptr inbounds %struct.MThreadSignal, ptr %128, i32 0, i32 0
  %130 = call i32 @pthread_mutex_lock(ptr noundef %129) #4
  br label %131

131:                                              ; preds = %126
  br label %132

132:                                              ; preds = %131
  %133 = load ptr, ptr %9, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.HandlePipeline, ptr %133, i32 0, i32 4
  %135 = getelementptr inbounds %struct.MThreadSignal, ptr %134, i32 0, i32 1
  %136 = call i32 @pthread_cond_signal(ptr noundef %135) #4
  %137 = load ptr, ptr %9, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.HandlePipeline, ptr %137, i32 0, i32 4
  %139 = getelementptr inbounds %struct.MThreadSignal, ptr %138, i32 0, i32 0
  %140 = call i32 @pthread_mutex_unlock(ptr noundef %139) #4
  br label %141

141:                                              ; preds = %132, %95
  br label %142

142:                                              ; preds = %141
  br label %143

143:                                              ; preds = %142
  %144 = call i32 @pthread_mutex_unlock(ptr noundef @pipeline_sgn) #4
  br label %145

145:                                              ; preds = %143
  br label %146

146:                                              ; preds = %145
  br label %147

147:                                              ; preds = %146
  %148 = load i32, ptr @mPipeline.Sgn_valid.5, align 4, !tbaa !9
  %149 = icmp eq i32 %148, 0
  br i1 %149, label %150, label %166

150:                                              ; preds = %147
  %151 = load ptr, ptr %9, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.HandlePipeline, ptr %151, i32 0, i32 5
  %153 = getelementptr inbounds %struct.MThreadSignal, ptr %152, i32 0, i32 3
  %154 = atomicrmw xchg ptr %153, i32 -1135873169 seq_cst, align 8
  %155 = icmp ne i32 %154, -1135873169
  br i1 %155, label %156, label %165

156:                                              ; preds = %150
  %157 = load ptr, ptr %9, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.HandlePipeline, ptr %157, i32 0, i32 5
  %159 = getelementptr inbounds %struct.MThreadSignal, ptr %158, i32 0, i32 0
  %160 = call i32 @pthread_mutex_init(ptr noundef %159, ptr noundef null) #4
  %161 = load ptr, ptr %9, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.HandlePipeline, ptr %161, i32 0, i32 5
  %163 = getelementptr inbounds %struct.MThreadSignal, ptr %162, i32 0, i32 2
  %164 = call i32 @pthread_rwlock_init(ptr noundef %163, ptr noundef null) #4
  br label %165

165:                                              ; preds = %156, %150
  store i32 1, ptr @mPipeline.Sgn_valid.5, align 4, !tbaa !9
  br label %166

166:                                              ; preds = %165, %147
  br label %167

167:                                              ; preds = %166
  br label %168

168:                                              ; preds = %167
  %169 = load ptr, ptr %9, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.HandlePipeline, ptr %169, i32 0, i32 5
  %171 = getelementptr inbounds %struct.MThreadSignal, ptr %170, i32 0, i32 0
  %172 = call i32 @pthread_mutex_lock(ptr noundef %171) #4
  br label %173

173:                                              ; preds = %168
  br label %174

174:                                              ; preds = %173
  br label %175

175:                                              ; preds = %192, %174
  %176 = load ptr, ptr %9, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.HandlePipeline, ptr %176, i32 0, i32 2
  %178 = load ptr, ptr %177, align 8, !tbaa !21
  %179 = load i32, ptr %5, align 4, !tbaa !9
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds i32, ptr %178, i64 %180
  %182 = load i32, ptr %181, align 4, !tbaa !9
  %183 = load ptr, ptr %9, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.HandlePipeline, ptr %183, i32 0, i32 1
  %185 = load ptr, ptr %184, align 8, !tbaa !20
  %186 = load i32, ptr %5, align 4, !tbaa !9
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds i32, ptr %185, i64 %187
  %189 = load i32, ptr %188, align 4, !tbaa !9
  %190 = icmp ne i32 %182, %189
  %191 = xor i1 %190, true
  br i1 %191, label %192, label %200

192:                                              ; preds = %175
  %193 = load ptr, ptr %9, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.HandlePipeline, ptr %193, i32 0, i32 5
  %195 = getelementptr inbounds %struct.MThreadSignal, ptr %194, i32 0, i32 1
  %196 = load ptr, ptr %9, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.HandlePipeline, ptr %196, i32 0, i32 5
  %198 = getelementptr inbounds %struct.MThreadSignal, ptr %197, i32 0, i32 0
  %199 = call i32 @pthread_cond_wait(ptr noundef %195, ptr noundef %198)
  br label %175, !llvm.loop !23

200:                                              ; preds = %175
  %201 = load ptr, ptr %9, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.HandlePipeline, ptr %201, i32 0, i32 5
  %203 = getelementptr inbounds %struct.MThreadSignal, ptr %202, i32 0, i32 0
  %204 = call i32 @pthread_mutex_unlock(ptr noundef %203) #4
  br label %205

205:                                              ; preds = %200
  br label %206

206:                                              ; preds = %205
  %207 = load ptr, ptr %9, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.HandlePipeline, ptr %207, i32 0, i32 0
  %209 = load volatile i32, ptr %208, align 8, !tbaa !22
  %210 = load i32, ptr %5, align 4, !tbaa !9
  %211 = add nsw i32 %209, %210
  %212 = load ptr, ptr %4, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct.MList, ptr %212, i32 0, i32 0
  %214 = load i32, ptr %213, align 8, !tbaa !11
  %215 = icmp slt i32 %211, %214
  br i1 %215, label %216, label %217

216:                                              ; preds = %206
  store ptr null, ptr %3, align 8
  store i32 1, ptr %10, align 4
  br label %244

217:                                              ; preds = %206
  %218 = load ptr, ptr %9, align 8, !tbaa !5
  %219 = getelementptr inbounds %struct.HandlePipeline, ptr %218, i32 0, i32 2
  %220 = load ptr, ptr %219, align 8, !tbaa !21
  %221 = load i32, ptr %5, align 4, !tbaa !9
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds i32, ptr %220, i64 %222
  %224 = load i32, ptr %223, align 4, !tbaa !9
  %225 = icmp slt i32 %224, 0
  br i1 %225, label %226, label %230

226:                                              ; preds = %217
  %227 = load ptr, ptr %4, align 8, !tbaa !5
  %228 = load i32, ptr %5, align 4, !tbaa !9
  %229 = call ptr @mPipeline(ptr noundef %227, i32 noundef %228)
  store ptr %229, ptr %3, align 8
  store i32 1, ptr %10, align 4
  br label %244

230:                                              ; preds = %217
  %231 = load ptr, ptr %4, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.MList, ptr %231, i32 0, i32 1
  %233 = load ptr, ptr %232, align 8, !tbaa !24
  %234 = load ptr, ptr %9, align 8, !tbaa !5
  %235 = getelementptr inbounds %struct.HandlePipeline, ptr %234, i32 0, i32 2
  %236 = load ptr, ptr %235, align 8, !tbaa !21
  %237 = load i32, ptr %5, align 4, !tbaa !9
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds i32, ptr %236, i64 %238
  %240 = load i32, ptr %239, align 4, !tbaa !9
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds ptr, ptr %233, i64 %241
  %243 = load ptr, ptr %242, align 8, !tbaa !5
  store ptr %243, ptr %3, align 8
  store i32 1, ptr %10, align 4
  br label %244

244:                                              ; preds = %230, %226, %216
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %245

245:                                              ; preds = %244, %45
  %246 = load ptr, ptr %3, align 8
  ret ptr %246
}

declare void @m_Exception(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) #2

declare i32 @usleep(i32 noundef) #2

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

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

!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, !10, i64 0}
!12 = !{!"MList", !10, i64 0, !6, i64 8}
!13 = !{!14, !6, i64 16}
!14 = !{!"MHandle", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16}
!15 = !{!16, !10, i64 24}
!16 = !{!"HandlePipeline", !10, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !17, i64 32, !17, i64 184, !10, i64 336}
!17 = !{!"MThreadSignal", !7, i64 0, !7, i64 40, !7, i64 88, !10, i64 144}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!16, !6, i64 8}
!21 = !{!16, !6, i64 16}
!22 = !{!16, !10, i64 0}
!23 = distinct !{!23, !19}
!24 = !{!12, !6, 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.MThreadSignal = type { %union.pthread_mutex_t, %union.pthread_cond_t, %union.pthread_rwlock_t, i32 }
%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 }
%union.pthread_rwlock_t = type { %struct.__pthread_rwlock_arch_t }
%struct.__pthread_rwlock_arch_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, [7 x i8], i64, i32 }

@pipeline_sgn = external dso_local global %struct.MThreadSignal, align 8
@.str = external hidden unnamed_addr constant [79 x i8], align 1
@__FUNCTION__.mPipeline = external hidden unnamed_addr constant [10 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@mPipeline.Sgn_valid = external hidden local_unnamed_addr global i32, align 4
@mPipeline.Sgn_valid.4 = external hidden local_unnamed_addr global i32, align 4
@mPipeline.Sgn_valid.5 = external hidden local_unnamed_addr global i32, align 4

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

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

declare ptr @GetHandle(ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare i32 @pthread_mutex_init(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare i32 @pthread_rwlock_init(ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare i32 @pthread_cond_wait(ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local ptr @mPipeline(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = icmp eq ptr %0, null
  %4 = icmp slt i32 %1, 0
  %5 = sext i32 %1 to i64
  br label %tailrecurse

tailrecurse:                                      ; preds = %102, %2
  br i1 %3, label %6, label %7

6:                                                ; preds = %tailrecurse
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 87, ptr noundef nonnull @__FUNCTION__.mPipeline, ptr noundef nonnull @.str.2) #3
  br label %7

7:                                                ; preds = %6, %tailrecurse
  br i1 %4, label %.thread, label %8

8:                                                ; preds = %7
  %9 = load i32, ptr %0, align 8, !tbaa !5
  %.not55 = icmp sgt i32 %9, %1
  br i1 %.not55, label %10, label %.thread

.thread:                                          ; preds = %7, %8
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 88, ptr noundef nonnull @__FUNCTION__.mPipeline, ptr noundef nonnull @.str.3) #3
  %.pre = load i32, ptr %0, align 8, !tbaa !5
  br label %10

10:                                               ; preds = %.thread, %8
  %11 = phi i32 [ %.pre, %.thread ], [ %9, %8 ]
  %12 = add nsw i32 %11, -1
  %13 = icmp eq i32 %12, %1
  br i1 %13, label %14, label %16

14:                                               ; preds = %10
  %15 = tail call ptr @Pipeline0(ptr noundef nonnull %0, i32 noundef %1)
  br label %.loopexit

16:                                               ; preds = %10
  %17 = load i32, ptr @mPipeline.Sgn_valid, align 4, !tbaa !11
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %25

19:                                               ; preds = %16
  %20 = atomicrmw xchg ptr getelementptr inbounds (i8, ptr @pipeline_sgn, i64 144), i32 -1135873169 seq_cst, align 8
  %.not = icmp eq i32 %20, -1135873169
  br i1 %.not, label %24, label %21

21:                                               ; preds = %19
  %22 = tail call i32 @pthread_mutex_init(ptr noundef nonnull @pipeline_sgn, ptr noundef null) #3
  %23 = tail call i32 @pthread_rwlock_init(ptr noundef nonnull getelementptr inbounds (i8, ptr @pipeline_sgn, i64 88), ptr noundef null) #3
  br label %24

24:                                               ; preds = %21, %19
  store i32 1, ptr @mPipeline.Sgn_valid, align 4, !tbaa !11
  br label %25

25:                                               ; preds = %16, %24
  %26 = tail call i32 @pthread_mutex_lock(ptr noundef nonnull @pipeline_sgn) #3
  %27 = tail call ptr @GetHandle(ptr noundef nonnull %0, i32 noundef 344, i32 noundef 75085391, ptr noundef nonnull @endPipeline) #3
  %28 = getelementptr inbounds i8, ptr %27, i64 16
  %29 = load ptr, ptr %28, align 8, !tbaa !12
  %30 = getelementptr inbounds i8, ptr %29, i64 24
  %31 = load volatile i32, ptr %30, align 8, !tbaa !14
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %25, %.lr.ph
  %33 = tail call i32 @usleep(i32 noundef 1000) #3
  %34 = load volatile i32, ptr %30, align 8, !tbaa !14
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %.lr.ph, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %.lr.ph, %25
  %36 = getelementptr inbounds i8, ptr %29, i64 8
  %37 = load ptr, ptr %36, align 8, !tbaa !19
  %38 = getelementptr inbounds i32, ptr %37, i64 %5
  %39 = load i32, ptr %38, align 4, !tbaa !11
  %40 = getelementptr inbounds i8, ptr %29, i64 16
  %41 = load ptr, ptr %40, align 8, !tbaa !20
  %42 = getelementptr inbounds i32, ptr %41, i64 %5
  store i32 %39, ptr %42, align 4, !tbaa !11
  %43 = load volatile i32, ptr %30, align 8, !tbaa !14
  %44 = add nsw i32 %43, 1
  store volatile i32 %44, ptr %30, align 8, !tbaa !14
  %45 = load volatile i32, ptr %30, align 8, !tbaa !14
  %46 = load volatile i32, ptr %29, align 8, !tbaa !21
  %47 = icmp eq i32 %45, %46
  br i1 %47, label %48, label %66

48:                                               ; preds = %._crit_edge
  %49 = load i32, ptr @mPipeline.Sgn_valid.4, align 4, !tbaa !11
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %60

51:                                               ; preds = %48
  %52 = getelementptr inbounds i8, ptr %29, i64 176
  %53 = atomicrmw xchg ptr %52, i32 -1135873169 seq_cst, align 8
  %.not52 = icmp eq i32 %53, -1135873169
  br i1 %.not52, label %59, label %54

54:                                               ; preds = %51
  %55 = getelementptr inbounds i8, ptr %29, i64 32
  %56 = tail call i32 @pthread_mutex_init(ptr noundef nonnull %55, ptr noundef null) #3
  %57 = getelementptr inbounds i8, ptr %29, i64 120
  %58 = tail call i32 @pthread_rwlock_init(ptr noundef nonnull %57, ptr noundef null) #3
  br label %59

59:                                               ; preds = %54, %51
  store i32 1, ptr @mPipeline.Sgn_valid.4, align 4, !tbaa !11
  br label %60

60:                                               ; preds = %59, %48
  %61 = getelementptr inbounds i8, ptr %29, i64 32
  %62 = tail call i32 @pthread_mutex_lock(ptr noundef nonnull %61) #3
  %63 = getelementptr inbounds i8, ptr %29, i64 72
  %64 = tail call i32 @pthread_cond_signal(ptr noundef nonnull %63) #3
  %65 = tail call i32 @pthread_mutex_unlock(ptr noundef nonnull %61) #3
  br label %66

66:                                               ; preds = %60, %._crit_edge
  %67 = tail call i32 @pthread_mutex_unlock(ptr noundef nonnull @pipeline_sgn) #3
  %68 = load i32, ptr @mPipeline.Sgn_valid.5, align 4, !tbaa !11
  %69 = icmp eq i32 %68, 0
  br i1 %69, label %70, label %79

70:                                               ; preds = %66
  %71 = getelementptr inbounds i8, ptr %29, i64 328
  %72 = atomicrmw xchg ptr %71, i32 -1135873169 seq_cst, align 8
  %.not53 = icmp eq i32 %72, -1135873169
  br i1 %.not53, label %78, label %73

73:                                               ; preds = %70
  %74 = getelementptr inbounds i8, ptr %29, i64 184
  %75 = tail call i32 @pthread_mutex_init(ptr noundef nonnull %74, ptr noundef null) #3
  %76 = getelementptr inbounds i8, ptr %29, i64 272
  %77 = tail call i32 @pthread_rwlock_init(ptr noundef nonnull %76, ptr noundef null) #3
  br label %78

78:                                               ; preds = %73, %70
  store i32 1, ptr @mPipeline.Sgn_valid.5, align 4, !tbaa !11
  br label %79

79:                                               ; preds = %78, %66
  %80 = getelementptr inbounds i8, ptr %29, i64 184
  %81 = tail call i32 @pthread_mutex_lock(ptr noundef nonnull %80) #3
  %82 = load ptr, ptr %40, align 8, !tbaa !20
  %83 = getelementptr inbounds i32, ptr %82, i64 %5
  %84 = load i32, ptr %83, align 4, !tbaa !11
  %85 = load ptr, ptr %36, align 8, !tbaa !19
  %86 = getelementptr inbounds i32, ptr %85, i64 %5
  %87 = load i32, ptr %86, align 4, !tbaa !11
  %.not5458 = icmp eq i32 %84, %87
  br i1 %.not5458, label %.lr.ph60, label %._crit_edge61

.lr.ph60:                                         ; preds = %79
  %88 = getelementptr inbounds i8, ptr %29, i64 224
  br label %89

89:                                               ; preds = %.lr.ph60, %89
  %90 = tail call i32 @pthread_cond_wait(ptr noundef nonnull %88, ptr noundef nonnull %80) #3
  %91 = load ptr, ptr %40, align 8, !tbaa !20
  %92 = getelementptr inbounds i32, ptr %91, i64 %5
  %93 = load i32, ptr %92, align 4, !tbaa !11
  %94 = load ptr, ptr %36, align 8, !tbaa !19
  %95 = getelementptr inbounds i32, ptr %94, i64 %5
  %96 = load i32, ptr %95, align 4, !tbaa !11
  %.not54 = icmp eq i32 %93, %96
  br i1 %.not54, label %89, label %._crit_edge61, !llvm.loop !22

._crit_edge61:                                    ; preds = %89, %79
  %97 = tail call i32 @pthread_mutex_unlock(ptr noundef nonnull %80) #3
  %98 = load volatile i32, ptr %29, align 8, !tbaa !21
  %99 = add nsw i32 %98, %1
  %100 = load i32, ptr %0, align 8, !tbaa !5
  %101 = icmp slt i32 %99, %100
  br i1 %101, label %.loopexit, label %102

102:                                              ; preds = %._crit_edge61
  %103 = load ptr, ptr %40, align 8, !tbaa !20
  %104 = getelementptr inbounds i32, ptr %103, i64 %5
  %105 = load i32, ptr %104, align 4, !tbaa !11
  %106 = icmp slt i32 %105, 0
  br i1 %106, label %tailrecurse, label %107

107:                                              ; preds = %102
  %108 = getelementptr inbounds i8, ptr %0, i64 8
  %109 = load ptr, ptr %108, align 8, !tbaa !23
  %110 = zext nneg i32 %105 to i64
  %111 = getelementptr inbounds ptr, ptr %109, i64 %110
  %112 = load ptr, ptr %111, align 8, !tbaa !24
  br label %.loopexit

.loopexit:                                        ; preds = %._crit_edge61, %107, %14
  %.1 = phi ptr [ %15, %14 ], [ %112, %107 ], [ null, %._crit_edge61 ]
  ret ptr %.1
}

declare void @m_Exception(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) local_unnamed_addr #1

declare i32 @usleep(i32 noundef) local_unnamed_addr #1

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"MList", !7, i64 0, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !10, i64 16}
!13 = !{!"MHandle", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16}
!14 = !{!15, !7, i64 24}
!15 = !{!"HandlePipeline", !7, i64 0, !10, i64 8, !10, i64 16, !7, i64 24, !16, i64 32, !16, i64 184, !7, i64 336}
!16 = !{!"MThreadSignal", !8, i64 0, !8, i64 40, !8, i64 88, !7, i64 144}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!15, !10, i64 8}
!20 = !{!15, !10, i64 16}
!21 = !{!15, !7, i64 0}
!22 = distinct !{!22, !18}
!23 = !{!6, !10, i64 8}
!24 = !{!10, !10, i64 0}


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