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

; 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.MHandle = type { i32, i32, ptr, ptr }
%struct.HandleProcLock = type { i32, i32, i32, [256 x i8] }

@.str = external hidden unnamed_addr constant [78 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [15 x i8], align 1
@__FUNCTION__.m_ProcLockBegin = external hidden unnamed_addr constant [16 x i8], align 1

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

; Function Attrs: nounwind
declare i32 @flock(i32 noundef, i32 noundef) #1

; Function Attrs: nounwind
declare i64 @lseek(i32 noundef, i64 noundef, i32 noundef) #1

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

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

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

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

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

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

; Function Attrs: nounwind
declare i32 @getpid() #1

declare i32 @mThreadOrder(...) #2

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: nounwind
declare i32 @access(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind
declare i32 @mkdir(ptr noundef, i32 noundef) #1

declare i32 @open(ptr noundef, i32 noundef, ...) #2

; Function Attrs: nounwind
declare i32 @kill(i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @endProcLock(ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @m_ProcLockBegin(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [128 x i8], align 16
  %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 i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = icmp eq ptr %23, null
  br i1 %24, label %25, label %26

25:                                               ; preds = %1
  store ptr @.str.24, ptr %2, align 8, !tbaa !5
  br label %26

26:                                               ; preds = %25, %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = call ptr @mMornObject(ptr noundef %27, i32 noundef -1)
  %29 = call ptr @GetHandle(ptr noundef %28, i32 noundef 268, i32 noundef 69658724, ptr noundef @endProcLock)
  store ptr %29, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.MHandle, ptr %30, i32 0, i32 3
  %32 = load ptr, ptr %31, align 8, !tbaa !9
  store ptr %32, ptr %4, align 8, !tbaa !5
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.MHandle, ptr %33, i32 0, i32 1
  %35 = load volatile i32, ptr %34, align 4, !tbaa !12
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %249

37:                                               ; preds = %26
  %38 = call i32 @getpid() #4
  %39 = mul nsw i32 %38, 1000
  %40 = call i32 (...) @mThreadOrder()
  %41 = add nsw i32 %39, %40
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.HandleProcLock, ptr %42, i32 0, i32 0
  store i32 %41, ptr %43, align 4, !tbaa !13
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.HandleProcLock, ptr %44, i32 0, i32 3
  %46 = getelementptr inbounds [256 x i8], ptr %45, i64 0, i64 0
  %47 = load i8, ptr %46, align 4, !tbaa !15
  %48 = sext i8 %47 to i32
  %49 = icmp eq i32 %48, 0
  br i1 %49, label %50, label %66

50:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 128, ptr %5) #4
  %51 = getelementptr inbounds [128 x i8], ptr %5, i64 0, i64 0
  %52 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %51, ptr noundef @.str.25) #4
  %53 = getelementptr inbounds [128 x i8], ptr %5, i64 0, i64 0
  %54 = call i32 @access(ptr noundef %53, i32 noundef 0) #4
  %55 = icmp slt i32 %54, 0
  br i1 %55, label %56, label %59

56:                                               ; preds = %50
  %57 = getelementptr inbounds [128 x i8], ptr %5, i64 0, i64 0
  %58 = call i32 @mkdir(ptr noundef %57, i32 noundef 511) #4
  br label %59

59:                                               ; preds = %56, %50
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.HandleProcLock, ptr %60, i32 0, i32 3
  %62 = getelementptr inbounds [256 x i8], ptr %61, i64 0, i64 0
  %63 = getelementptr inbounds [128 x i8], ptr %5, i64 0, i64 0
  %64 = load ptr, ptr %2, align 8, !tbaa !5
  %65 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %62, ptr noundef @.str.9, ptr noundef %63, ptr noundef %64) #4
  call void @llvm.lifetime.end.p0(i64 128, ptr %5) #4
  br label %66

66:                                               ; preds = %59, %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.HandleProcLock, ptr %67, i32 0, i32 3
  %69 = getelementptr inbounds [256 x i8], ptr %68, i64 0, i64 0
  %70 = call i32 @access(ptr noundef %69, i32 noundef 0) #4
  store i32 %70, ptr %8, align 4, !tbaa !16
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.HandleProcLock, ptr %71, i32 0, i32 3
  %73 = getelementptr inbounds [256 x i8], ptr %72, i64 0, i64 0
  %74 = call i32 (ptr, i32, ...) @open(ptr noundef %73, i32 noundef 66, i32 noundef 438)
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.HandleProcLock, ptr %75, i32 0, i32 2
  store i32 %74, ptr %76, align 4, !tbaa !17
  %77 = load i32, ptr %8, align 4, !tbaa !16
  %78 = icmp sge i32 %77, 0
  br i1 %78, label %79, label %91

79:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  br label %80

80:                                               ; preds = %86, %79
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.HandleProcLock, ptr %81, i32 0, i32 2
  %83 = load i32, ptr %82, align 4, !tbaa !17
  %84 = call i64 @lseek(i32 noundef %83, i64 noundef 1, i32 noundef 2) #4
  %85 = trunc i64 %84 to i32
  store volatile i32 %85, ptr %9, align 4, !tbaa !16
  br label %86

86:                                               ; preds = %80
  %87 = load volatile i32, ptr %9, align 4, !tbaa !16
  %88 = sext i32 %87 to i64
  %89 = icmp ult i64 %88, 8
  br i1 %89, label %80, label %90, !llvm.loop !18

90:                                               ; preds = %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %91

91:                                               ; preds = %90, %66
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.HandleProcLock, ptr %92, i32 0, i32 2
  %94 = load i32, ptr %93, align 4, !tbaa !17
  %95 = call i32 @flock(i32 noundef %94, i32 noundef 2) #4
  %96 = load i32, ptr %8, align 4, !tbaa !16
  %97 = icmp sge i32 %96, 0
  br i1 %97, label %98, label %140

98:                                               ; preds = %91
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.HandleProcLock, ptr %101, i32 0, i32 2
  %103 = load i32, ptr %102, align 4, !tbaa !17
  %104 = call i64 @lseek(i32 noundef %103, i64 noundef 0, i32 noundef 0) #4
  %105 = icmp ne i64 %104, 0
  %106 = zext i1 %105 to i32
  store i32 %106, ptr %10, align 4, !tbaa !16
  %107 = load i32, ptr %10, align 4, !tbaa !16
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %109, label %111

109:                                              ; preds = %100
  %110 = load i32, ptr %10, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %110, i32 noundef -1, ptr noundef @.str, i32 noundef 817, ptr noundef @__FUNCTION__.m_ProcLockBegin, ptr noundef @.str.1)
  br label %111

111:                                              ; preds = %109, %100
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %112

112:                                              ; preds = %111
  br label %113

113:                                              ; preds = %112
  br label %114

114:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.HandleProcLock, ptr %115, i32 0, i32 2
  %117 = load i32, ptr %116, align 4, !tbaa !17
  %118 = call i64 @read(i32 noundef %117, ptr noundef %7, i64 noundef 4)
  %119 = icmp ne i64 %118, 4
  %120 = zext i1 %119 to i32
  store i32 %120, ptr %11, align 4, !tbaa !16
  %121 = load i32, ptr %11, align 4, !tbaa !16
  %122 = icmp ne i32 %121, 0
  br i1 %122, label %123, label %125

123:                                              ; preds = %114
  %124 = load i32, ptr %11, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %124, i32 noundef -1, ptr noundef @.str, i32 noundef 817, ptr noundef @__FUNCTION__.m_ProcLockBegin, ptr noundef @.str.2)
  br label %125

125:                                              ; preds = %123, %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %126

126:                                              ; preds = %125
  br label %127

127:                                              ; preds = %126
  br label %128

128:                                              ; preds = %127
  br label %129

129:                                              ; preds = %128
  %130 = load i32, ptr %7, align 4, !tbaa !16
  %131 = icmp ne i32 %130, 0
  br i1 %131, label %132, label %139

132:                                              ; preds = %129
  %133 = load i32, ptr %7, align 4, !tbaa !16
  %134 = sdiv i32 %133, 1000
  %135 = call i32 @kill(i32 noundef %134, i32 noundef 0) #4
  %136 = icmp eq i32 %135, 0
  br i1 %136, label %138, label %137

137:                                              ; preds = %132
  store i32 -1, ptr %8, align 4, !tbaa !16
  store i32 0, ptr %7, align 4, !tbaa !16
  br label %138

138:                                              ; preds = %137, %132
  br label %139

139:                                              ; preds = %138, %129
  br label %140

140:                                              ; preds = %139, %91
  %141 = load i32, ptr %8, align 4, !tbaa !16
  %142 = icmp sge i32 %141, 0
  br i1 %142, label %143, label %175

143:                                              ; preds = %140
  br label %144

144:                                              ; preds = %143
  br label %145

145:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %146 = load ptr, ptr %4, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.HandleProcLock, ptr %146, i32 0, i32 2
  %148 = load i32, ptr %147, align 4, !tbaa !17
  %149 = call i64 @lseek(i32 noundef %148, i64 noundef 4, i32 noundef 0) #4
  %150 = icmp ne i64 %149, 4
  %151 = zext i1 %150 to i32
  store i32 %151, ptr %12, align 4, !tbaa !16
  %152 = load i32, ptr %12, align 4, !tbaa !16
  %153 = icmp ne i32 %152, 0
  br i1 %153, label %154, label %156

154:                                              ; preds = %145
  %155 = load i32, ptr %12, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %155, i32 noundef -1, ptr noundef @.str, i32 noundef 820, ptr noundef @__FUNCTION__.m_ProcLockBegin, ptr noundef @.str.1)
  br label %156

156:                                              ; preds = %154, %145
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %157

157:                                              ; preds = %156
  br label %158

158:                                              ; preds = %157
  br label %159

159:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %160 = load ptr, ptr %4, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.HandleProcLock, ptr %160, i32 0, i32 2
  %162 = load i32, ptr %161, align 4, !tbaa !17
  %163 = call i64 @read(i32 noundef %162, ptr noundef %6, i64 noundef 4)
  %164 = icmp ne i64 %163, 4
  %165 = zext i1 %164 to i32
  store i32 %165, ptr %13, align 4, !tbaa !16
  %166 = load i32, ptr %13, align 4, !tbaa !16
  %167 = icmp ne i32 %166, 0
  br i1 %167, label %168, label %170

168:                                              ; preds = %159
  %169 = load i32, ptr %13, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %169, i32 noundef -1, ptr noundef @.str, i32 noundef 820, ptr noundef @__FUNCTION__.m_ProcLockBegin, ptr noundef @.str.2)
  br label %170

170:                                              ; preds = %168, %159
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %171

171:                                              ; preds = %170
  br label %172

172:                                              ; preds = %171
  br label %173

173:                                              ; preds = %172
  br label %174

174:                                              ; preds = %173
  br label %207

175:                                              ; preds = %140
  br label %176

176:                                              ; preds = %175
  br label %177

177:                                              ; preds = %176
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %178 = load ptr, ptr %4, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.HandleProcLock, ptr %178, i32 0, i32 2
  %180 = load i32, ptr %179, align 4, !tbaa !17
  %181 = call i64 @lseek(i32 noundef %180, i64 noundef 0, i32 noundef 0) #4
  %182 = icmp ne i64 %181, 0
  %183 = zext i1 %182 to i32
  store i32 %183, ptr %14, align 4, !tbaa !16
  %184 = load i32, ptr %14, align 4, !tbaa !16
  %185 = icmp ne i32 %184, 0
  br i1 %185, label %186, label %188

186:                                              ; preds = %177
  %187 = load i32, ptr %14, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %187, i32 noundef -1, ptr noundef @.str, i32 noundef 821, ptr noundef @__FUNCTION__.m_ProcLockBegin, ptr noundef @.str.1)
  br label %188

188:                                              ; preds = %186, %177
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %189

189:                                              ; preds = %188
  br label %190

190:                                              ; preds = %189
  br label %191

191:                                              ; preds = %190
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %192 = load ptr, ptr %4, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.HandleProcLock, ptr %192, i32 0, i32 2
  %194 = load i32, ptr %193, align 4, !tbaa !17
  %195 = call i64 @write(i32 noundef %194, ptr noundef %7, i64 noundef 4)
  %196 = icmp ne i64 %195, 4
  %197 = zext i1 %196 to i32
  store i32 %197, ptr %15, align 4, !tbaa !16
  %198 = load i32, ptr %15, align 4, !tbaa !16
  %199 = icmp ne i32 %198, 0
  br i1 %199, label %200, label %202

200:                                              ; preds = %191
  %201 = load i32, ptr %15, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %201, i32 noundef -1, ptr noundef @.str, i32 noundef 821, ptr noundef @__FUNCTION__.m_ProcLockBegin, ptr noundef @.str.3)
  br label %202

202:                                              ; preds = %200, %191
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %203

203:                                              ; preds = %202
  br label %204

204:                                              ; preds = %203
  br label %205

205:                                              ; preds = %204
  br label %206

206:                                              ; preds = %205
  br label %207

207:                                              ; preds = %206, %174
  %208 = load i32, ptr %6, align 4, !tbaa !16
  %209 = add nsw i32 %208, 1
  store i32 %209, ptr %6, align 4, !tbaa !16
  br label %210

210:                                              ; preds = %207
  br label %211

211:                                              ; preds = %210
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %212 = load ptr, ptr %4, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct.HandleProcLock, ptr %212, i32 0, i32 2
  %214 = load i32, ptr %213, align 4, !tbaa !17
  %215 = call i64 @lseek(i32 noundef %214, i64 noundef 4, i32 noundef 0) #4
  %216 = icmp ne i64 %215, 4
  %217 = zext i1 %216 to i32
  store i32 %217, ptr %16, align 4, !tbaa !16
  %218 = load i32, ptr %16, align 4, !tbaa !16
  %219 = icmp ne i32 %218, 0
  br i1 %219, label %220, label %222

220:                                              ; preds = %211
  %221 = load i32, ptr %16, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %221, i32 noundef -1, ptr noundef @.str, i32 noundef 822, ptr noundef @__FUNCTION__.m_ProcLockBegin, ptr noundef @.str.1)
  br label %222

222:                                              ; preds = %220, %211
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %223

223:                                              ; preds = %222
  br label %224

224:                                              ; preds = %223
  br label %225

225:                                              ; preds = %224
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %226 = load ptr, ptr %4, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.HandleProcLock, ptr %226, i32 0, i32 2
  %228 = load i32, ptr %227, align 4, !tbaa !17
  %229 = call i64 @write(i32 noundef %228, ptr noundef %6, i64 noundef 4)
  %230 = icmp ne i64 %229, 4
  %231 = zext i1 %230 to i32
  store i32 %231, ptr %17, align 4, !tbaa !16
  %232 = load i32, ptr %17, align 4, !tbaa !16
  %233 = icmp ne i32 %232, 0
  br i1 %233, label %234, label %236

234:                                              ; preds = %225
  %235 = load i32, ptr %17, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %235, i32 noundef -1, ptr noundef @.str, i32 noundef 822, ptr noundef @__FUNCTION__.m_ProcLockBegin, ptr noundef @.str.3)
  br label %236

236:                                              ; preds = %234, %225
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %237

237:                                              ; preds = %236
  br label %238

238:                                              ; preds = %237
  br label %239

239:                                              ; preds = %238
  br label %240

240:                                              ; preds = %239
  %241 = load ptr, ptr %4, align 8, !tbaa !5
  %242 = getelementptr inbounds %struct.HandleProcLock, ptr %241, i32 0, i32 2
  %243 = load i32, ptr %242, align 4, !tbaa !17
  %244 = call i32 @flock(i32 noundef %243, i32 noundef 8) #4
  %245 = load ptr, ptr %4, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct.HandleProcLock, ptr %245, i32 0, i32 1
  store i32 0, ptr %246, align 4, !tbaa !20
  %247 = load ptr, ptr %3, align 8, !tbaa !5
  %248 = getelementptr inbounds %struct.MHandle, ptr %247, i32 0, i32 1
  store volatile i32 1, ptr %248, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %249

249:                                              ; preds = %240, %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  br label %250

250:                                              ; preds = %328, %249
  %251 = load ptr, ptr %4, align 8, !tbaa !5
  %252 = getelementptr inbounds %struct.HandleProcLock, ptr %251, i32 0, i32 2
  %253 = load i32, ptr %252, align 4, !tbaa !17
  %254 = call i32 @flock(i32 noundef %253, i32 noundef 2) #4
  br label %255

255:                                              ; preds = %250
  br label %256

256:                                              ; preds = %255
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %257 = load ptr, ptr %4, align 8, !tbaa !5
  %258 = getelementptr inbounds %struct.HandleProcLock, ptr %257, i32 0, i32 2
  %259 = load i32, ptr %258, align 4, !tbaa !17
  %260 = call i64 @lseek(i32 noundef %259, i64 noundef 0, i32 noundef 0) #4
  %261 = icmp ne i64 %260, 0
  %262 = zext i1 %261 to i32
  store i32 %262, ptr %19, align 4, !tbaa !16
  %263 = load i32, ptr %19, align 4, !tbaa !16
  %264 = icmp ne i32 %263, 0
  br i1 %264, label %265, label %267

265:                                              ; preds = %256
  %266 = load i32, ptr %19, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %266, i32 noundef -1, ptr noundef @.str, i32 noundef 835, ptr noundef @__FUNCTION__.m_ProcLockBegin, ptr noundef @.str.1)
  br label %267

267:                                              ; preds = %265, %256
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %268

268:                                              ; preds = %267
  br label %269

269:                                              ; preds = %268
  br label %270

270:                                              ; preds = %269
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %271 = load ptr, ptr %4, align 8, !tbaa !5
  %272 = getelementptr inbounds %struct.HandleProcLock, ptr %271, i32 0, i32 2
  %273 = load i32, ptr %272, align 4, !tbaa !17
  %274 = call i64 @read(i32 noundef %273, ptr noundef %18, i64 noundef 4)
  %275 = icmp ne i64 %274, 4
  %276 = zext i1 %275 to i32
  store i32 %276, ptr %20, align 4, !tbaa !16
  %277 = load i32, ptr %20, align 4, !tbaa !16
  %278 = icmp ne i32 %277, 0
  br i1 %278, label %279, label %281

279:                                              ; preds = %270
  %280 = load i32, ptr %20, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %280, i32 noundef -1, ptr noundef @.str, i32 noundef 835, ptr noundef @__FUNCTION__.m_ProcLockBegin, ptr noundef @.str.2)
  br label %281

281:                                              ; preds = %279, %270
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %282

282:                                              ; preds = %281
  br label %283

283:                                              ; preds = %282
  br label %284

284:                                              ; preds = %283
  br label %285

285:                                              ; preds = %284
  %286 = load i32, ptr %18, align 4, !tbaa !16
  %287 = icmp eq i32 %286, 0
  br i1 %287, label %288, label %323

288:                                              ; preds = %285
  %289 = load ptr, ptr %4, align 8, !tbaa !5
  %290 = getelementptr inbounds %struct.HandleProcLock, ptr %289, i32 0, i32 0
  %291 = load i32, ptr %290, align 4, !tbaa !13
  store i32 %291, ptr %18, align 4, !tbaa !16
  br label %292

292:                                              ; preds = %288
  br label %293

293:                                              ; preds = %292
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %294 = load ptr, ptr %4, align 8, !tbaa !5
  %295 = getelementptr inbounds %struct.HandleProcLock, ptr %294, i32 0, i32 2
  %296 = load i32, ptr %295, align 4, !tbaa !17
  %297 = call i64 @lseek(i32 noundef %296, i64 noundef 0, i32 noundef 0) #4
  %298 = icmp ne i64 %297, 0
  %299 = zext i1 %298 to i32
  store i32 %299, ptr %21, align 4, !tbaa !16
  %300 = load i32, ptr %21, align 4, !tbaa !16
  %301 = icmp ne i32 %300, 0
  br i1 %301, label %302, label %304

302:                                              ; preds = %293
  %303 = load i32, ptr %21, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %303, i32 noundef -1, ptr noundef @.str, i32 noundef 839, ptr noundef @__FUNCTION__.m_ProcLockBegin, ptr noundef @.str.1)
  br label %304

304:                                              ; preds = %302, %293
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  br label %305

305:                                              ; preds = %304
  br label %306

306:                                              ; preds = %305
  br label %307

307:                                              ; preds = %306
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  %308 = load ptr, ptr %4, align 8, !tbaa !5
  %309 = getelementptr inbounds %struct.HandleProcLock, ptr %308, i32 0, i32 2
  %310 = load i32, ptr %309, align 4, !tbaa !17
  %311 = call i64 @write(i32 noundef %310, ptr noundef %18, i64 noundef 4)
  %312 = icmp ne i64 %311, 4
  %313 = zext i1 %312 to i32
  store i32 %313, ptr %22, align 4, !tbaa !16
  %314 = load i32, ptr %22, align 4, !tbaa !16
  %315 = icmp ne i32 %314, 0
  br i1 %315, label %316, label %318

316:                                              ; preds = %307
  %317 = load i32, ptr %22, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %317, i32 noundef -1, ptr noundef @.str, i32 noundef 839, ptr noundef @__FUNCTION__.m_ProcLockBegin, ptr noundef @.str.3)
  br label %318

318:                                              ; preds = %316, %307
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  br label %319

319:                                              ; preds = %318
  br label %320

320:                                              ; preds = %319
  br label %321

321:                                              ; preds = %320
  br label %322

322:                                              ; preds = %321
  br label %323

323:                                              ; preds = %322, %285
  %324 = load ptr, ptr %4, align 8, !tbaa !5
  %325 = getelementptr inbounds %struct.HandleProcLock, ptr %324, i32 0, i32 2
  %326 = load i32, ptr %325, align 4, !tbaa !17
  %327 = call i32 @flock(i32 noundef %326, i32 noundef 8) #4
  br label %328

328:                                              ; preds = %323
  %329 = load i32, ptr %18, align 4, !tbaa !16
  %330 = load ptr, ptr %4, align 8, !tbaa !5
  %331 = getelementptr inbounds %struct.HandleProcLock, ptr %330, i32 0, i32 0
  %332 = load i32, ptr %331, align 4, !tbaa !13
  %333 = icmp ne i32 %329, %332
  br i1 %333, label %250, label %334, !llvm.loop !21

334:                                              ; preds = %328
  %335 = load ptr, ptr %4, align 8, !tbaa !5
  %336 = getelementptr inbounds %struct.HandleProcLock, ptr %335, i32 0, i32 1
  store i32 1, ptr %336, align 4, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 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 #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, !6, i64 16}
!10 = !{!"MHandle", !11, i64 0, !11, i64 4, !6, i64 8, !6, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{!14, !11, i64 0}
!14 = !{!"HandleProcLock", !11, i64 0, !11, i64 4, !11, i64 8, !7, i64 12}
!15 = !{!7, !7, i64 0}
!16 = !{!11, !11, i64 0}
!17 = !{!14, !11, i64 8}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!14, !11, i64 4}
!21 = distinct !{!21, !19}


; 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 [78 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [15 x i8], align 1
@__FUNCTION__.m_ProcLockBegin = external hidden unnamed_addr constant [16 x i8], align 1

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

; Function Attrs: nounwind
declare i32 @flock(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare i64 @lseek(i32 noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

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

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

; Function Attrs: nofree
declare noundef i64 @read(i32 noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nofree
declare noundef i64 @write(i32 noundef, ptr nocapture noundef readonly, i64 noundef) local_unnamed_addr #3

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

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

; Function Attrs: nounwind
declare i32 @getpid() local_unnamed_addr #1

declare i32 @mThreadOrder(...) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @access(ptr nocapture noundef readonly, i32 noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @mkdir(ptr nocapture noundef readonly, i32 noundef) local_unnamed_addr #4

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

; Function Attrs: nounwind
declare i32 @kill(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @endProcLock(ptr noundef) #5

; Function Attrs: nounwind uwtable
define dso_local void @m_ProcLockBegin(ptr noundef %0) local_unnamed_addr #5 {
  %2 = alloca [128 x i8], align 16
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = icmp eq ptr %0, null
  %spec.store.select = select i1 %7, ptr @.str.24, ptr %0
  %8 = tail call ptr @mMornObject(ptr noundef nonnull %spec.store.select, i32 noundef -1) #6
  %9 = tail call ptr @GetHandle(ptr noundef %8, i32 noundef 268, i32 noundef 69658724, ptr noundef nonnull @endProcLock) #6
  %10 = getelementptr inbounds i8, ptr %9, i64 16
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %9, i64 4
  %13 = load volatile i32, ptr %12, align 4, !tbaa !11
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %15, label %89

15:                                               ; preds = %1
  %16 = tail call i32 @getpid() #6
  %17 = mul nsw i32 %16, 1000
  %18 = tail call i32 (...) @mThreadOrder() #6
  %19 = add nsw i32 %17, %18
  store i32 %19, ptr %11, align 4, !tbaa !12
  %20 = getelementptr inbounds i8, ptr %11, i64 12
  %21 = load i8, ptr %20, align 4, !tbaa !14
  %22 = icmp eq i8 %21, 0
  br i1 %22, label %23, label %31

23:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %2) #6
  %24 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %2, ptr noundef nonnull dereferenceable(1) @.str.25) #6
  %25 = call i32 @access(ptr noundef nonnull %2, i32 noundef 0) #6
  %26 = icmp slt i32 %25, 0
  br i1 %26, label %27, label %29

27:                                               ; preds = %23
  %28 = call i32 @mkdir(ptr noundef nonnull %2, i32 noundef 511) #6
  br label %29

29:                                               ; preds = %27, %23
  %30 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %20, ptr noundef nonnull dereferenceable(1) @.str.9, ptr noundef nonnull %2, ptr noundef nonnull %spec.store.select) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %2) #6
  br label %31

31:                                               ; preds = %29, %15
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  store i32 0, ptr %3, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  store i32 0, ptr %4, align 4, !tbaa !15
  %32 = call i32 @access(ptr noundef nonnull %20, i32 noundef 0) #6
  %33 = call i32 (ptr, i32, ...) @open(ptr noundef nonnull %20, i32 noundef 66, i32 noundef 438) #6
  %34 = getelementptr inbounds i8, ptr %11, i64 8
  store i32 %33, ptr %34, align 4, !tbaa !16
  %35 = icmp sgt i32 %32, -1
  br i1 %35, label %36, label %.critedge

36:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5)
  br label %37

37:                                               ; preds = %37, %36
  %38 = load i32, ptr %34, align 4, !tbaa !16
  %39 = call i64 @lseek(i32 noundef %38, i64 noundef 1, i32 noundef 2) #6
  %40 = trunc i64 %39 to i32
  store volatile i32 %40, ptr %5, align 4, !tbaa !15
  %.0..0..0..0. = load volatile i32, ptr %5, align 4, !tbaa !15
  %41 = icmp ult i32 %.0..0..0..0., 8
  br i1 %41, label %37, label %42, !llvm.loop !17

42:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5)
  %43 = load i32, ptr %34, align 4, !tbaa !16
  %44 = call i32 @flock(i32 noundef %43, i32 noundef 2) #6
  %45 = load i32, ptr %34, align 4, !tbaa !16
  %46 = call i64 @lseek(i32 noundef %45, i64 noundef 0, i32 noundef 0) #6
  %.not64 = icmp eq i64 %46, 0
  br i1 %.not64, label %48, label %47

47:                                               ; preds = %42
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 817, ptr noundef nonnull @__FUNCTION__.m_ProcLockBegin, ptr noundef nonnull @.str.1) #6
  br label %48

48:                                               ; preds = %47, %42
  %49 = load i32, ptr %34, align 4, !tbaa !16
  %50 = call i64 @read(i32 noundef %49, ptr noundef nonnull %4, i64 noundef 4) #6
  %.not65 = icmp eq i64 %50, 4
  br i1 %.not65, label %52, label %51

51:                                               ; preds = %48
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 817, ptr noundef nonnull @__FUNCTION__.m_ProcLockBegin, ptr noundef nonnull @.str.2) #6
  br label %52

52:                                               ; preds = %51, %48
  %53 = load i32, ptr %4, align 4, !tbaa !15
  %.not = icmp eq i32 %53, 0
  br i1 %.not, label %60, label %54

54:                                               ; preds = %52
  %55 = sdiv i32 %53, 1000
  %56 = call i32 @kill(i32 noundef %55, i32 noundef 0) #6
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %60, label %58

58:                                               ; preds = %54
  store i32 0, ptr %4, align 4, !tbaa !15
  br label %.thread

.critedge:                                        ; preds = %31
  %59 = call i32 @flock(i32 noundef %33, i32 noundef 2) #6
  br label %.thread

60:                                               ; preds = %54, %52
  %61 = load i32, ptr %34, align 4, !tbaa !16
  %62 = call i64 @lseek(i32 noundef %61, i64 noundef 4, i32 noundef 0) #6
  %.not68 = icmp eq i64 %62, 4
  br i1 %.not68, label %64, label %63

63:                                               ; preds = %60
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 820, ptr noundef nonnull @__FUNCTION__.m_ProcLockBegin, ptr noundef nonnull @.str.1) #6
  br label %64

64:                                               ; preds = %63, %60
  %65 = load i32, ptr %34, align 4, !tbaa !16
  %66 = call i64 @read(i32 noundef %65, ptr noundef nonnull %3, i64 noundef 4) #6
  %.not69 = icmp eq i64 %66, 4
  br i1 %.not69, label %75, label %67

67:                                               ; preds = %64
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 820, ptr noundef nonnull @__FUNCTION__.m_ProcLockBegin, ptr noundef nonnull @.str.2) #6
  br label %75

.thread:                                          ; preds = %.critedge, %58
  %68 = load i32, ptr %34, align 4, !tbaa !16
  %69 = call i64 @lseek(i32 noundef %68, i64 noundef 0, i32 noundef 0) #6
  %.not66 = icmp eq i64 %69, 0
  br i1 %.not66, label %71, label %70

70:                                               ; preds = %.thread
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 821, ptr noundef nonnull @__FUNCTION__.m_ProcLockBegin, ptr noundef nonnull @.str.1) #6
  br label %71

71:                                               ; preds = %70, %.thread
  %72 = load i32, ptr %34, align 4, !tbaa !16
  %73 = call i64 @write(i32 noundef %72, ptr noundef nonnull %4, i64 noundef 4) #6
  %.not67 = icmp eq i64 %73, 4
  br i1 %.not67, label %75, label %74

74:                                               ; preds = %71
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 821, ptr noundef nonnull @__FUNCTION__.m_ProcLockBegin, ptr noundef nonnull @.str.3) #6
  br label %75

75:                                               ; preds = %71, %74, %64, %67
  %76 = load i32, ptr %3, align 4, !tbaa !15
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %3, align 4, !tbaa !15
  %78 = load i32, ptr %34, align 4, !tbaa !16
  %79 = call i64 @lseek(i32 noundef %78, i64 noundef 4, i32 noundef 0) #6
  %.not70 = icmp eq i64 %79, 4
  br i1 %.not70, label %81, label %80

80:                                               ; preds = %75
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 822, ptr noundef nonnull @__FUNCTION__.m_ProcLockBegin, ptr noundef nonnull @.str.1) #6
  br label %81

81:                                               ; preds = %80, %75
  %82 = load i32, ptr %34, align 4, !tbaa !16
  %83 = call i64 @write(i32 noundef %82, ptr noundef nonnull %3, i64 noundef 4) #6
  %.not71 = icmp eq i64 %83, 4
  br i1 %.not71, label %85, label %84

84:                                               ; preds = %81
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 822, ptr noundef nonnull @__FUNCTION__.m_ProcLockBegin, ptr noundef nonnull @.str.3) #6
  br label %85

85:                                               ; preds = %84, %81
  %86 = load i32, ptr %34, align 4, !tbaa !16
  %87 = call i32 @flock(i32 noundef %86, i32 noundef 8) #6
  %88 = getelementptr inbounds i8, ptr %11, i64 4
  store i32 0, ptr %88, align 4, !tbaa !19
  store volatile i32 1, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  br label %89

89:                                               ; preds = %85, %1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  %90 = getelementptr inbounds i8, ptr %11, i64 8
  br label %91

91:                                               ; preds = %113, %89
  %92 = load i32, ptr %90, align 4, !tbaa !16
  %93 = call i32 @flock(i32 noundef %92, i32 noundef 2) #6
  %94 = load i32, ptr %90, align 4, !tbaa !16
  %95 = call i64 @lseek(i32 noundef %94, i64 noundef 0, i32 noundef 0) #6
  %.not72 = icmp eq i64 %95, 0
  br i1 %.not72, label %97, label %96

96:                                               ; preds = %91
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 835, ptr noundef nonnull @__FUNCTION__.m_ProcLockBegin, ptr noundef nonnull @.str.1) #6
  br label %97

97:                                               ; preds = %96, %91
  %98 = load i32, ptr %90, align 4, !tbaa !16
  %99 = call i64 @read(i32 noundef %98, ptr noundef nonnull %6, i64 noundef 4) #6
  %.not73 = icmp eq i64 %99, 4
  br i1 %.not73, label %101, label %100

100:                                              ; preds = %97
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 835, ptr noundef nonnull @__FUNCTION__.m_ProcLockBegin, ptr noundef nonnull @.str.2) #6
  br label %101

101:                                              ; preds = %100, %97
  %102 = load i32, ptr %6, align 4, !tbaa !15
  %103 = icmp eq i32 %102, 0
  br i1 %103, label %104, label %113

104:                                              ; preds = %101
  %105 = load i32, ptr %11, align 4, !tbaa !12
  store i32 %105, ptr %6, align 4, !tbaa !15
  %106 = load i32, ptr %90, align 4, !tbaa !16
  %107 = call i64 @lseek(i32 noundef %106, i64 noundef 0, i32 noundef 0) #6
  %.not74 = icmp eq i64 %107, 0
  br i1 %.not74, label %109, label %108

108:                                              ; preds = %104
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 839, ptr noundef nonnull @__FUNCTION__.m_ProcLockBegin, ptr noundef nonnull @.str.1) #6
  br label %109

109:                                              ; preds = %108, %104
  %110 = load i32, ptr %90, align 4, !tbaa !16
  %111 = call i64 @write(i32 noundef %110, ptr noundef nonnull %6, i64 noundef 4) #6
  %.not75 = icmp eq i64 %111, 4
  br i1 %.not75, label %113, label %112

112:                                              ; preds = %109
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 839, ptr noundef nonnull @__FUNCTION__.m_ProcLockBegin, ptr noundef nonnull @.str.3) #6
  br label %113

113:                                              ; preds = %109, %112, %101
  %114 = phi i32 [ %105, %109 ], [ %105, %112 ], [ %102, %101 ]
  %115 = load i32, ptr %90, align 4, !tbaa !16
  %116 = call i32 @flock(i32 noundef %115, i32 noundef 8) #6
  %117 = load i32, ptr %11, align 4, !tbaa !12
  %.not62 = icmp eq i32 %114, %117
  br i1 %.not62, label %118, label %91, !llvm.loop !20

118:                                              ; preds = %113
  %119 = getelementptr inbounds i8, ptr %11, i64 4
  store i32 1, ptr %119, align 4, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 "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 = { 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 #5 = { 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 #6 = { 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, !10, i64 16}
!6 = !{!"MHandle", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!13, !7, i64 0}
!13 = !{!"HandleProcLock", !7, i64 0, !7, i64 4, !7, i64 8, !8, i64 12}
!14 = !{!8, !8, i64 0}
!15 = !{!7, !7, i64 0}
!16 = !{!13, !7, i64 8}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!13, !7, i64 4}
!20 = distinct !{!20, !18}


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