; 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.HandleProcTopic = type { [256 x i8], i32, i32, i32, i32, ptr, i64 }
%struct.ProcTopicInfo = type { i32, i32, i32, i32, i32, i32, i64, [128 x %struct.ProcCommunicateState], [0 x i8] }
%struct.ProcCommunicateState = type { i32, i32 }

@.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.4 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [16 x i8], align 1
@__FUNCTION__.m_ProcTopicRead = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @endProcTopic(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: nounwind
declare i32 @flock(i32 noundef, i32 noundef) #2

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

declare void @m_Exception(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr 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

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

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

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

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

declare i32 @mHandleValid(ptr noundef) #3

declare void @m_PropertyFunction(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

declare void @mornObjectRemove(ptr noundef, ptr noundef) #3

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

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

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

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

; Function Attrs: nounwind
declare ptr @mmap(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef) #2

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @m_ProcTopicRead(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca [128 x i8], align 16
  %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 i64, align 8
  %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
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca ptr, align 8
  %27 = alloca i64, align 8
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca ptr, align 8
  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
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %35

34:                                               ; preds = %3
  store ptr @.str.4, ptr %5, align 8, !tbaa !5
  br label %35

35:                                               ; preds = %34, %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = call ptr @mMornObject(ptr noundef %36, i32 noundef -1)
  %38 = call ptr @GetHandle(ptr noundef %37, i32 noundef 288, i32 noundef 1928559086, ptr noundef @endProcTopic)
  store ptr %38, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.MHandle, ptr %39, i32 0, i32 3
  %41 = load ptr, ptr %40, align 8, !tbaa !9
  store ptr %41, ptr %9, align 8, !tbaa !5
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = call i32 @mHandleValid(ptr noundef %42)
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %303, label %45

45:                                               ; preds = %35
  br label %46

46:                                               ; preds = %45
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = call ptr @mMornObject(ptr noundef %47, i32 noundef -1)
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  call void @m_PropertyFunction(ptr noundef %48, ptr noundef @.str.6, ptr noundef @mornObjectRemove, ptr noundef %49)
  br label %50

50:                                               ; preds = %46
  br label %51

51:                                               ; preds = %50
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.HandleProcTopic, ptr %52, i32 0, i32 6
  store i64 -1, ptr %53, align 8, !tbaa !12
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = icmp ne ptr %54, null
  br i1 %55, label %56, label %58

56:                                               ; preds = %51
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 0, ptr %57, align 4, !tbaa !15
  br label %58

58:                                               ; preds = %56, %51
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.HandleProcTopic, ptr %59, i32 0, i32 3
  %61 = load i32, ptr %60, align 8, !tbaa !16
  %62 = icmp eq i32 %61, 0
  br i1 %62, label %63, label %114

63:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 128, ptr %10) #5
  %64 = getelementptr inbounds [128 x i8], ptr %10, i64 0, i64 0
  %65 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %64, ptr noundef @.str.8) #5
  %66 = getelementptr inbounds [128 x i8], ptr %10, i64 0, i64 0
  %67 = call i32 @access(ptr noundef %66, i32 noundef 0) #5
  %68 = icmp slt i32 %67, 0
  br i1 %68, label %69, label %72

69:                                               ; preds = %63
  %70 = getelementptr inbounds [128 x i8], ptr %10, i64 0, i64 0
  %71 = call i32 @mkdir(ptr noundef %70, i32 noundef 511) #5
  br label %72

72:                                               ; preds = %69, %63
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.HandleProcTopic, ptr %73, i32 0, i32 0
  %75 = getelementptr inbounds [256 x i8], ptr %74, i64 0, i64 0
  %76 = getelementptr inbounds [128 x i8], ptr %10, i64 0, i64 0
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %75, ptr noundef @.str.9, ptr noundef %76, ptr noundef %77) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.HandleProcTopic, ptr %79, i32 0, i32 0
  %81 = getelementptr inbounds [256 x i8], ptr %80, i64 0, i64 0
  %82 = call i32 @access(ptr noundef %81, i32 noundef 0) #5
  store i32 %82, ptr %11, align 4, !tbaa !15
  %83 = load i32, ptr %11, align 4, !tbaa !15
  %84 = icmp slt i32 %83, 0
  br i1 %84, label %85, label %88

85:                                               ; preds = %72
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.MHandle, ptr %86, i32 0, i32 1
  store volatile i32 0, ptr %87, align 4, !tbaa !17
  store ptr null, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %111

88:                                               ; preds = %72
  %89 = load ptr, ptr %9, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.HandleProcTopic, ptr %89, i32 0, i32 0
  %91 = getelementptr inbounds [256 x i8], ptr %90, i64 0, i64 0
  %92 = call i32 (ptr, i32, ...) @open(ptr noundef %91, i32 noundef 66, i32 noundef 438)
  %93 = load ptr, ptr %9, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.HandleProcTopic, ptr %93, i32 0, i32 2
  store i32 %92, ptr %94, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %95 = load ptr, ptr %9, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.HandleProcTopic, ptr %95, i32 0, i32 2
  %97 = load i32, ptr %96, align 4, !tbaa !18
  %98 = call i64 @lseek(i32 noundef %97, i64 noundef 1, i32 noundef 2) #5
  %99 = trunc i64 %98 to i32
  store i32 %99, ptr %13, align 4, !tbaa !15
  %100 = load i32, ptr %13, align 4, !tbaa !15
  %101 = sext i32 %100 to i64
  %102 = icmp ult i64 %101, 1056
  br i1 %102, label %103, label %106

103:                                              ; preds = %88
  %104 = load ptr, ptr %8, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.MHandle, ptr %104, i32 0, i32 1
  store volatile i32 0, ptr %105, align 4, !tbaa !17
  store ptr null, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %110

106:                                              ; preds = %88
  %107 = load i32, ptr %13, align 4, !tbaa !15
  %108 = load ptr, ptr %9, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.HandleProcTopic, ptr %108, i32 0, i32 3
  store i32 %107, ptr %109, align 8, !tbaa !16
  store i32 0, ptr %12, align 4
  br label %110

110:                                              ; preds = %106, %103
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %111

111:                                              ; preds = %110, %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 128, ptr %10) #5
  %112 = load i32, ptr %12, align 4
  switch i32 %112, label %392 [
    i32 0, label %113
  ]

113:                                              ; preds = %111
  br label %114

114:                                              ; preds = %113, %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  br label %115

115:                                              ; preds = %114
  br label %116

116:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %117 = load ptr, ptr %9, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.HandleProcTopic, ptr %117, i32 0, i32 2
  %119 = load i32, ptr %118, align 4, !tbaa !18
  %120 = call i64 @lseek(i32 noundef %119, i64 noundef 0, i32 noundef 0) #5
  %121 = icmp ne i64 %120, 0
  %122 = zext i1 %121 to i32
  store i32 %122, ptr %15, align 4, !tbaa !15
  %123 = load i32, ptr %15, align 4, !tbaa !15
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %125, label %127

125:                                              ; preds = %116
  %126 = load i32, ptr %15, align 4, !tbaa !15
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %126, i32 noundef -1, ptr noundef @.str, i32 noundef 272, ptr noundef @__FUNCTION__.m_ProcTopicRead, ptr noundef @.str.1)
  br label %127

127:                                              ; preds = %125, %116
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %128

128:                                              ; preds = %127
  br label %129

129:                                              ; preds = %128
  br label %130

130:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %131 = load ptr, ptr %9, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.HandleProcTopic, ptr %131, i32 0, i32 2
  %133 = load i32, ptr %132, align 4, !tbaa !18
  %134 = call i64 @read(i32 noundef %133, ptr noundef %14, i64 noundef 4)
  %135 = icmp ne i64 %134, 4
  %136 = zext i1 %135 to i32
  store i32 %136, ptr %16, align 4, !tbaa !15
  %137 = load i32, ptr %16, align 4, !tbaa !15
  %138 = icmp ne i32 %137, 0
  br i1 %138, label %139, label %141

139:                                              ; preds = %130
  %140 = load i32, ptr %16, align 4, !tbaa !15
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %140, i32 noundef -1, ptr noundef @.str, i32 noundef 272, ptr noundef @__FUNCTION__.m_ProcTopicRead, ptr noundef @.str.2)
  br label %141

141:                                              ; preds = %139, %130
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %142

142:                                              ; preds = %141
  br label %143

143:                                              ; preds = %142
  br label %144

144:                                              ; preds = %143
  br label %145

145:                                              ; preds = %144
  %146 = load i32, ptr %14, align 4, !tbaa !15
  %147 = sdiv i32 %146, 1000
  %148 = call i32 @kill(i32 noundef %147, i32 noundef 0) #5
  %149 = icmp eq i32 %148, 0
  %150 = zext i1 %149 to i32
  %151 = icmp eq i32 %150, 0
  br i1 %151, label %152, label %155

152:                                              ; preds = %145
  %153 = load ptr, ptr %8, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.MHandle, ptr %153, i32 0, i32 1
  store volatile i32 0, ptr %154, align 4, !tbaa !17
  store ptr null, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %300

155:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  br label %156

156:                                              ; preds = %155
  br label %157

157:                                              ; preds = %156
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %158 = load ptr, ptr %9, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.HandleProcTopic, ptr %158, i32 0, i32 2
  %160 = load i32, ptr %159, align 4, !tbaa !18
  %161 = call i64 @lseek(i32 noundef %160, i64 noundef 24, i32 noundef 0) #5
  %162 = icmp ne i64 %161, 24
  %163 = zext i1 %162 to i32
  store i32 %163, ptr %18, align 4, !tbaa !15
  %164 = load i32, ptr %18, align 4, !tbaa !15
  %165 = icmp ne i32 %164, 0
  br i1 %165, label %166, label %168

166:                                              ; preds = %157
  %167 = load i32, ptr %18, align 4, !tbaa !15
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %167, i32 noundef -1, ptr noundef @.str, i32 noundef 275, ptr noundef @__FUNCTION__.m_ProcTopicRead, ptr noundef @.str.1)
  br label %168

168:                                              ; preds = %166, %157
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %169

169:                                              ; preds = %168
  br label %170

170:                                              ; preds = %169
  br label %171

171:                                              ; preds = %170
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %172 = load ptr, ptr %9, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.HandleProcTopic, ptr %172, i32 0, i32 2
  %174 = load i32, ptr %173, align 4, !tbaa !18
  %175 = call i64 @read(i32 noundef %174, ptr noundef %17, i64 noundef 8)
  %176 = icmp ne i64 %175, 8
  %177 = zext i1 %176 to i32
  store i32 %177, ptr %19, align 4, !tbaa !15
  %178 = load i32, ptr %19, align 4, !tbaa !15
  %179 = icmp ne i32 %178, 0
  br i1 %179, label %180, label %182

180:                                              ; preds = %171
  %181 = load i32, ptr %19, align 4, !tbaa !15
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %181, i32 noundef -1, ptr noundef @.str, i32 noundef 275, ptr noundef @__FUNCTION__.m_ProcTopicRead, ptr noundef @.str.2)
  br label %182

182:                                              ; preds = %180, %171
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %183

183:                                              ; preds = %182
  br label %184

184:                                              ; preds = %183
  br label %185

185:                                              ; preds = %184
  br label %186

186:                                              ; preds = %185
  %187 = load i64, ptr %17, align 8, !tbaa !19
  %188 = icmp eq i64 %187, 0
  br i1 %188, label %189, label %192

189:                                              ; preds = %186
  %190 = load ptr, ptr %8, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.MHandle, ptr %190, i32 0, i32 1
  store volatile i32 0, ptr %191, align 4, !tbaa !17
  store ptr null, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %299

192:                                              ; preds = %186
  br label %193

193:                                              ; preds = %192
  %194 = load ptr, ptr %9, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.HandleProcTopic, ptr %194, i32 0, i32 3
  %196 = load i32, ptr %195, align 8, !tbaa !16
  %197 = sext i32 %196 to i64
  %198 = add i64 %197, 1056
  %199 = load ptr, ptr %9, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.HandleProcTopic, ptr %199, i32 0, i32 2
  %201 = load i32, ptr %200, align 4, !tbaa !18
  %202 = call ptr @mmap(ptr noundef null, i64 noundef %198, i32 noundef 3, i32 noundef 1, i32 noundef %201, i64 noundef 0) #5
  %203 = load ptr, ptr %9, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.HandleProcTopic, ptr %203, i32 0, i32 5
  store ptr %202, ptr %204, align 8, !tbaa !20
  br label %205

205:                                              ; preds = %193
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  %206 = load ptr, ptr %9, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.HandleProcTopic, ptr %206, i32 0, i32 5
  %208 = load ptr, ptr %207, align 8, !tbaa !20
  %209 = icmp eq ptr %208, null
  %210 = zext i1 %209 to i32
  store i32 %210, ptr %20, align 4, !tbaa !15
  %211 = load i32, ptr %20, align 4, !tbaa !15
  %212 = icmp ne i32 %211, 0
  br i1 %212, label %213, label %215

213:                                              ; preds = %205
  %214 = load i32, ptr %20, align 4, !tbaa !15
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %214, i32 noundef -1, ptr noundef @.str, i32 noundef 278, ptr noundef @__FUNCTION__.m_ProcTopicRead, ptr noundef @.str.10)
  br label %215

215:                                              ; preds = %213, %205
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %216

216:                                              ; preds = %215
  br label %217

217:                                              ; preds = %216
  br label %218

218:                                              ; preds = %217
  br label %219

219:                                              ; preds = %218
  %220 = load ptr, ptr %9, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.HandleProcTopic, ptr %220, i32 0, i32 2
  %222 = load i32, ptr %221, align 4, !tbaa !18
  %223 = call i32 @flock(i32 noundef %222, i32 noundef 2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  br label %224

224:                                              ; preds = %219
  br label %225

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

234:                                              ; preds = %225
  %235 = load i32, ptr %22, align 4, !tbaa !15
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %235, i32 noundef -1, ptr noundef @.str, i32 noundef 281, ptr noundef @__FUNCTION__.m_ProcTopicRead, ptr noundef @.str.1)
  br label %236

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

237:                                              ; preds = %236
  br label %238

238:                                              ; preds = %237
  br label %239

239:                                              ; preds = %238
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  %240 = load ptr, ptr %9, align 8, !tbaa !5
  %241 = getelementptr inbounds %struct.HandleProcTopic, ptr %240, i32 0, i32 2
  %242 = load i32, ptr %241, align 4, !tbaa !18
  %243 = call i64 @read(i32 noundef %242, ptr noundef %21, i64 noundef 4)
  %244 = icmp ne i64 %243, 4
  %245 = zext i1 %244 to i32
  store i32 %245, ptr %23, align 4, !tbaa !15
  %246 = load i32, ptr %23, align 4, !tbaa !15
  %247 = icmp ne i32 %246, 0
  br i1 %247, label %248, label %250

248:                                              ; preds = %239
  %249 = load i32, ptr %23, align 4, !tbaa !15
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %249, i32 noundef -1, ptr noundef @.str, i32 noundef 281, ptr noundef @__FUNCTION__.m_ProcTopicRead, ptr noundef @.str.2)
  br label %250

250:                                              ; preds = %248, %239
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  br label %251

251:                                              ; preds = %250
  br label %252

252:                                              ; preds = %251
  br label %253

253:                                              ; preds = %252
  br label %254

254:                                              ; preds = %253
  %255 = load i32, ptr %21, align 4, !tbaa !15
  %256 = add nsw i32 %255, 1
  store i32 %256, ptr %21, align 4, !tbaa !15
  br label %257

257:                                              ; preds = %254
  br label %258

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

267:                                              ; preds = %258
  %268 = load i32, ptr %24, align 4, !tbaa !15
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %268, i32 noundef -1, ptr noundef @.str, i32 noundef 282, ptr noundef @__FUNCTION__.m_ProcTopicRead, ptr noundef @.str.1)
  br label %269

269:                                              ; preds = %267, %258
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  br label %270

270:                                              ; preds = %269
  br label %271

271:                                              ; preds = %270
  br label %272

272:                                              ; preds = %271
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  %273 = load ptr, ptr %9, align 8, !tbaa !5
  %274 = getelementptr inbounds %struct.HandleProcTopic, ptr %273, i32 0, i32 2
  %275 = load i32, ptr %274, align 4, !tbaa !18
  %276 = call i64 @write(i32 noundef %275, ptr noundef %21, i64 noundef 4)
  %277 = icmp ne i64 %276, 4
  %278 = zext i1 %277 to i32
  store i32 %278, ptr %25, align 4, !tbaa !15
  %279 = load i32, ptr %25, align 4, !tbaa !15
  %280 = icmp ne i32 %279, 0
  br i1 %280, label %281, label %283

281:                                              ; preds = %272
  %282 = load i32, ptr %25, align 4, !tbaa !15
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %282, i32 noundef -1, ptr noundef @.str, i32 noundef 282, ptr noundef @__FUNCTION__.m_ProcTopicRead, ptr noundef @.str.3)
  br label %283

283:                                              ; preds = %281, %272
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  br label %284

284:                                              ; preds = %283
  br label %285

285:                                              ; preds = %284
  br label %286

286:                                              ; preds = %285
  br label %287

287:                                              ; preds = %286
  %288 = load i32, ptr %21, align 4, !tbaa !15
  %289 = load ptr, ptr %9, align 8, !tbaa !5
  %290 = getelementptr inbounds %struct.HandleProcTopic, ptr %289, i32 0, i32 5
  %291 = load ptr, ptr %290, align 8, !tbaa !20
  %292 = getelementptr inbounds %struct.ProcTopicInfo, ptr %291, i32 0, i32 1
  store volatile i32 %288, ptr %292, align 4, !tbaa !21
  %293 = load ptr, ptr %9, align 8, !tbaa !5
  %294 = getelementptr inbounds %struct.HandleProcTopic, ptr %293, i32 0, i32 2
  %295 = load i32, ptr %294, align 4, !tbaa !18
  %296 = call i32 @flock(i32 noundef %295, i32 noundef 8) #5
  %297 = load ptr, ptr %8, align 8, !tbaa !5
  %298 = getelementptr inbounds %struct.MHandle, ptr %297, i32 0, i32 1
  store volatile i32 1, ptr %298, align 4, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  store i32 0, ptr %12, align 4
  br label %299

299:                                              ; preds = %287, %189
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %300

300:                                              ; preds = %299, %152
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  %301 = load i32, ptr %12, align 4
  switch i32 %301, label %392 [
    i32 0, label %302
  ]

302:                                              ; preds = %300
  br label %303

303:                                              ; preds = %302, %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #5
  %304 = load ptr, ptr %9, align 8, !tbaa !5
  %305 = getelementptr inbounds %struct.HandleProcTopic, ptr %304, i32 0, i32 5
  %306 = load ptr, ptr %305, align 8, !tbaa !20
  store ptr %306, ptr %26, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #5
  %307 = load ptr, ptr %26, align 8, !tbaa !5
  %308 = getelementptr inbounds %struct.ProcTopicInfo, ptr %307, i32 0, i32 6
  %309 = load volatile i64, ptr %308, align 8, !tbaa !23
  %310 = sub nsw i64 %309, 1
  store i64 %310, ptr %27, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #5
  %311 = load i64, ptr %27, align 8, !tbaa !19
  %312 = srem i64 %311, 8
  %313 = trunc i64 %312 to i32
  store i32 %313, ptr %28, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #5
  %314 = load ptr, ptr %26, align 8, !tbaa !5
  %315 = getelementptr inbounds %struct.ProcTopicInfo, ptr %314, i32 0, i32 7
  %316 = load i32, ptr %28, align 4, !tbaa !15
  %317 = sext i32 %316 to i64
  %318 = getelementptr inbounds [128 x %struct.ProcCommunicateState], ptr %315, i64 0, i64 %317
  %319 = getelementptr inbounds %struct.ProcCommunicateState, ptr %318, i32 0, i32 0
  %320 = load volatile i32, ptr %319, align 8, !tbaa !24
  store i32 %320, ptr %29, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #5
  %321 = load ptr, ptr %26, align 8, !tbaa !5
  %322 = getelementptr inbounds %struct.ProcTopicInfo, ptr %321, i32 0, i32 7
  %323 = load i32, ptr %28, align 4, !tbaa !15
  %324 = sext i32 %323 to i64
  %325 = getelementptr inbounds [128 x %struct.ProcCommunicateState], ptr %322, i64 0, i64 %324
  %326 = getelementptr inbounds %struct.ProcCommunicateState, ptr %325, i32 0, i32 1
  %327 = load volatile i32, ptr %326, align 4, !tbaa !26
  store i32 %327, ptr %30, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #5
  %328 = load i64, ptr %27, align 8, !tbaa !19
  %329 = load ptr, ptr %9, align 8, !tbaa !5
  %330 = getelementptr inbounds %struct.HandleProcTopic, ptr %329, i32 0, i32 6
  %331 = load i64, ptr %330, align 8, !tbaa !12
  %332 = icmp sgt i64 %328, %331
  br i1 %332, label %333, label %340

333:                                              ; preds = %303
  %334 = load ptr, ptr %26, align 8, !tbaa !5
  %335 = getelementptr inbounds %struct.ProcTopicInfo, ptr %334, i32 0, i32 8
  %336 = getelementptr inbounds [0 x i8], ptr %335, i64 0, i64 0
  %337 = load i32, ptr %29, align 4, !tbaa !15
  %338 = sext i32 %337 to i64
  %339 = getelementptr inbounds i8, ptr %336, i64 %338
  br label %341

340:                                              ; preds = %303
  br label %341

341:                                              ; preds = %340, %333
  %342 = phi ptr [ %339, %333 ], [ null, %340 ]
  store ptr %342, ptr %31, align 8, !tbaa !5
  %343 = load ptr, ptr %31, align 8, !tbaa !5
  %344 = icmp eq ptr %343, null
  br i1 %344, label %345, label %351

345:                                              ; preds = %341
  %346 = load ptr, ptr %7, align 8, !tbaa !5
  %347 = icmp ne ptr %346, null
  br i1 %347, label %348, label %350

348:                                              ; preds = %345
  %349 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 0, ptr %349, align 4, !tbaa !15
  br label %350

350:                                              ; preds = %348, %345
  br label %387

351:                                              ; preds = %341
  %352 = load ptr, ptr %7, align 8, !tbaa !5
  %353 = icmp ne ptr %352, null
  br i1 %353, label %354, label %373

354:                                              ; preds = %351
  %355 = load ptr, ptr %7, align 8, !tbaa !5
  %356 = load i32, ptr %355, align 4, !tbaa !15
  %357 = icmp sgt i32 %356, 0
  br i1 %357, label %358, label %370

358:                                              ; preds = %354
  %359 = load ptr, ptr %7, align 8, !tbaa !5
  %360 = load i32, ptr %359, align 4, !tbaa !15
  %361 = load i32, ptr %30, align 4, !tbaa !15
  %362 = icmp slt i32 %360, %361
  br i1 %362, label %363, label %366

363:                                              ; preds = %358
  %364 = load ptr, ptr %7, align 8, !tbaa !5
  %365 = load i32, ptr %364, align 4, !tbaa !15
  br label %368

366:                                              ; preds = %358
  %367 = load i32, ptr %30, align 4, !tbaa !15
  br label %368

368:                                              ; preds = %366, %363
  %369 = phi i32 [ %365, %363 ], [ %367, %366 ]
  store i32 %369, ptr %30, align 4, !tbaa !15
  br label %370

370:                                              ; preds = %368, %354
  %371 = load i32, ptr %30, align 4, !tbaa !15
  %372 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 %371, ptr %372, align 4, !tbaa !15
  br label %373

373:                                              ; preds = %370, %351
  %374 = load ptr, ptr %6, align 8, !tbaa !5
  %375 = icmp ne ptr %374, null
  br i1 %375, label %376, label %386

376:                                              ; preds = %373
  %377 = load ptr, ptr %6, align 8, !tbaa !5
  %378 = load ptr, ptr %26, align 8, !tbaa !5
  %379 = getelementptr inbounds %struct.ProcTopicInfo, ptr %378, i32 0, i32 8
  %380 = getelementptr inbounds [0 x i8], ptr %379, i64 0, i64 0
  %381 = load i32, ptr %29, align 4, !tbaa !15
  %382 = sext i32 %381 to i64
  %383 = getelementptr inbounds i8, ptr %380, i64 %382
  %384 = load i32, ptr %30, align 4, !tbaa !15
  %385 = sext i32 %384 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %377, ptr align 1 %383, i64 %385, i1 false)
  br label %386

386:                                              ; preds = %376, %373
  br label %387

387:                                              ; preds = %386, %350
  %388 = load i64, ptr %27, align 8, !tbaa !19
  %389 = load ptr, ptr %9, align 8, !tbaa !5
  %390 = getelementptr inbounds %struct.HandleProcTopic, ptr %389, i32 0, i32 6
  store i64 %388, ptr %390, align 8, !tbaa !12
  %391 = load ptr, ptr %31, align 8, !tbaa !5
  store ptr %391, ptr %4, align 8
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #5
  br label %392

392:                                              ; preds = %387, %300, %111
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %393 = load ptr, ptr %4, align 8
  ret ptr %393
}

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 "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = !{!13, !14, i64 280}
!13 = !{!"HandleProcTopic", !7, i64 0, !11, i64 256, !11, i64 260, !11, i64 264, !11, i64 268, !6, i64 272, !14, i64 280}
!14 = !{!"long", !7, i64 0}
!15 = !{!11, !11, i64 0}
!16 = !{!13, !11, i64 264}
!17 = !{!10, !11, i64 4}
!18 = !{!13, !11, i64 260}
!19 = !{!14, !14, i64 0}
!20 = !{!13, !6, i64 272}
!21 = !{!22, !11, i64 4}
!22 = !{!"ProcTopicInfo", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !14, i64 24, !7, i64 32, !7, i64 1056}
!23 = !{!22, !14, i64 24}
!24 = !{!25, !11, i64 0}
!25 = !{!"ProcCommunicateState", !11, i64 0, !11, i64 4}
!26 = !{!25, !11, i64 4}


; 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.ProcCommunicateState = type { i32, i32 }

@.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.4 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [16 x i8], align 1
@__FUNCTION__.m_ProcTopicRead = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @endProcTopic(ptr noundef) #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: nounwind
declare i32 @flock(i32 noundef, i32 noundef) local_unnamed_addr #2

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

declare void @m_Exception(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr 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: nofree
declare noundef i64 @read(i32 noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #4

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

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

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

declare i32 @mHandleValid(ptr noundef) local_unnamed_addr #3

declare void @m_PropertyFunction(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @mornObjectRemove(ptr noundef, ptr noundef) #3

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

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

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

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

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

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

; Function Attrs: mustprogress 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) #6

; Function Attrs: nounwind uwtable
define dso_local ptr @m_ProcTopicRead(ptr noundef %0, ptr noundef writeonly %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = alloca [128 x i8], align 16
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = icmp eq ptr %0, null
  %spec.store.select = select i1 %8, ptr @.str.4, ptr %0
  %9 = tail call ptr @mMornObject(ptr noundef nonnull %spec.store.select, i32 noundef -1) #8
  %10 = tail call ptr @GetHandle(ptr noundef %9, i32 noundef 288, i32 noundef 1928559086, ptr noundef nonnull @endProcTopic) #8
  %11 = getelementptr inbounds i8, ptr %10, i64 16
  %12 = load ptr, ptr %11, align 8, !tbaa !5
  %13 = tail call i32 @mHandleValid(ptr noundef %10) #8
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %14, label %100

14:                                               ; preds = %3
  %15 = tail call ptr @mMornObject(ptr noundef nonnull %spec.store.select, i32 noundef -1) #8
  tail call void @m_PropertyFunction(ptr noundef %15, ptr noundef nonnull @.str.6, ptr noundef nonnull @mornObjectRemove, ptr noundef nonnull %spec.store.select) #8
  %16 = getelementptr inbounds i8, ptr %12, i64 280
  store i64 -1, ptr %16, align 8, !tbaa !11
  %.not100 = icmp eq ptr %2, null
  br i1 %.not100, label %18, label %17

17:                                               ; preds = %14
  store i32 0, ptr %2, align 4, !tbaa !14
  br label %18

18:                                               ; preds = %17, %14
  %19 = getelementptr inbounds i8, ptr %12, i64 264
  %20 = load i32, ptr %19, align 8, !tbaa !15
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %22, label %40

22:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %4) #8
  %23 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) @.str.8) #8
  %24 = call i32 @access(ptr noundef nonnull %4, i32 noundef 0) #8
  %25 = icmp slt i32 %24, 0
  br i1 %25, label %26, label %28

26:                                               ; preds = %22
  %27 = call i32 @mkdir(ptr noundef nonnull %4, i32 noundef 511) #8
  br label %28

28:                                               ; preds = %26, %22
  %29 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %12, ptr noundef nonnull dereferenceable(1) @.str.9, ptr noundef nonnull %4, ptr noundef nonnull %spec.store.select) #8
  %30 = call i32 @access(ptr noundef nonnull %12, i32 noundef 0) #8
  %31 = icmp slt i32 %30, 0
  br i1 %31, label %.thread, label %32

32:                                               ; preds = %28
  %33 = call i32 (ptr, i32, ...) @open(ptr noundef nonnull %12, i32 noundef 66, i32 noundef 438) #8
  %34 = getelementptr inbounds i8, ptr %12, i64 260
  store i32 %33, ptr %34, align 4, !tbaa !16
  %35 = call i64 @lseek(i32 noundef %33, i64 noundef 1, i32 noundef 2) #8
  %36 = trunc i64 %35 to i32
  %37 = icmp ult i32 %36, 1056
  br i1 %37, label %.thread, label %39

.thread:                                          ; preds = %32, %28
  %38 = getelementptr inbounds i8, ptr %10, i64 4
  store volatile i32 0, ptr %38, align 4, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %4) #8
  br label %128

39:                                               ; preds = %32
  store i32 %36, ptr %19, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %4) #8
  br label %40

40:                                               ; preds = %39, %18
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %41 = getelementptr inbounds i8, ptr %12, i64 260
  %42 = load i32, ptr %41, align 4, !tbaa !16
  %43 = call i64 @lseek(i32 noundef %42, i64 noundef 0, i32 noundef 0) #8
  %.not109 = icmp eq i64 %43, 0
  br i1 %.not109, label %45, label %44

44:                                               ; preds = %40
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 272, ptr noundef nonnull @__FUNCTION__.m_ProcTopicRead, ptr noundef nonnull @.str.1) #8
  br label %45

45:                                               ; preds = %44, %40
  %46 = load i32, ptr %41, align 4, !tbaa !16
  %47 = call i64 @read(i32 noundef %46, ptr noundef nonnull %5, i64 noundef 4) #8
  %.not110 = icmp eq i64 %47, 4
  br i1 %.not110, label %49, label %48

48:                                               ; preds = %45
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 272, ptr noundef nonnull @__FUNCTION__.m_ProcTopicRead, ptr noundef nonnull @.str.2) #8
  br label %49

49:                                               ; preds = %48, %45
  %50 = load i32, ptr %5, align 4, !tbaa !14
  %51 = sdiv i32 %50, 1000
  %52 = call i32 @kill(i32 noundef %51, i32 noundef 0) #8
  %.not101 = icmp eq i32 %52, 0
  br i1 %.not101, label %54, label %.critedge

.critedge:                                        ; preds = %49
  %53 = getelementptr inbounds i8, ptr %10, i64 4
  store volatile i32 0, ptr %53, align 4, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  br label %128

54:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  %55 = load i32, ptr %41, align 4, !tbaa !16
  %56 = call i64 @lseek(i32 noundef %55, i64 noundef 24, i32 noundef 0) #8
  %.not111 = icmp eq i64 %56, 24
  br i1 %.not111, label %58, label %57

57:                                               ; preds = %54
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 275, ptr noundef nonnull @__FUNCTION__.m_ProcTopicRead, ptr noundef nonnull @.str.1) #8
  br label %58

58:                                               ; preds = %57, %54
  %59 = load i32, ptr %41, align 4, !tbaa !16
  %60 = call i64 @read(i32 noundef %59, ptr noundef nonnull %6, i64 noundef 8) #8
  %.not112 = icmp eq i64 %60, 8
  br i1 %.not112, label %62, label %61

61:                                               ; preds = %58
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 275, ptr noundef nonnull @__FUNCTION__.m_ProcTopicRead, ptr noundef nonnull @.str.2) #8
  br label %62

62:                                               ; preds = %61, %58
  %63 = load i64, ptr %6, align 8, !tbaa !18
  %.not113 = icmp eq i64 %63, 0
  br i1 %.not113, label %98, label %64

64:                                               ; preds = %62
  %65 = load i32, ptr %19, align 8, !tbaa !15
  %66 = sext i32 %65 to i64
  %67 = add nsw i64 %66, 1056
  %68 = load i32, ptr %41, align 4, !tbaa !16
  %69 = call ptr @mmap(ptr noundef null, i64 noundef %67, i32 noundef 3, i32 noundef 1, i32 noundef %68, i64 noundef 0) #8
  %70 = getelementptr inbounds i8, ptr %12, i64 272
  store ptr %69, ptr %70, align 8, !tbaa !19
  %71 = icmp eq ptr %69, null
  br i1 %71, label %72, label %73

72:                                               ; preds = %64
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 278, ptr noundef nonnull @__FUNCTION__.m_ProcTopicRead, ptr noundef nonnull @.str.10) #8
  br label %73

73:                                               ; preds = %72, %64
  %74 = load i32, ptr %41, align 4, !tbaa !16
  %75 = call i32 @flock(i32 noundef %74, i32 noundef 2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #8
  %76 = load i32, ptr %41, align 4, !tbaa !16
  %77 = call i64 @lseek(i32 noundef %76, i64 noundef 4, i32 noundef 0) #8
  %.not114 = icmp eq i64 %77, 4
  br i1 %.not114, label %79, label %78

78:                                               ; preds = %73
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 281, ptr noundef nonnull @__FUNCTION__.m_ProcTopicRead, ptr noundef nonnull @.str.1) #8
  br label %79

79:                                               ; preds = %78, %73
  %80 = load i32, ptr %41, align 4, !tbaa !16
  %81 = call i64 @read(i32 noundef %80, ptr noundef nonnull %7, i64 noundef 4) #8
  %.not115 = icmp eq i64 %81, 4
  br i1 %.not115, label %83, label %82

82:                                               ; preds = %79
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 281, ptr noundef nonnull @__FUNCTION__.m_ProcTopicRead, ptr noundef nonnull @.str.2) #8
  br label %83

83:                                               ; preds = %82, %79
  %84 = load i32, ptr %7, align 4, !tbaa !14
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %7, align 4, !tbaa !14
  %86 = load i32, ptr %41, align 4, !tbaa !16
  %87 = call i64 @lseek(i32 noundef %86, i64 noundef 4, i32 noundef 0) #8
  %.not116 = icmp eq i64 %87, 4
  br i1 %.not116, label %89, label %88

88:                                               ; preds = %83
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 282, ptr noundef nonnull @__FUNCTION__.m_ProcTopicRead, ptr noundef nonnull @.str.1) #8
  br label %89

89:                                               ; preds = %88, %83
  %90 = load i32, ptr %41, align 4, !tbaa !16
  %91 = call i64 @write(i32 noundef %90, ptr noundef nonnull %7, i64 noundef 4) #8
  %.not117 = icmp eq i64 %91, 4
  br i1 %.not117, label %.thread108, label %92

92:                                               ; preds = %89
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 282, ptr noundef nonnull @__FUNCTION__.m_ProcTopicRead, ptr noundef nonnull @.str.3) #8
  br label %.thread108

.thread108:                                       ; preds = %89, %92
  %93 = load ptr, ptr %70, align 8, !tbaa !19
  %94 = getelementptr inbounds i8, ptr %93, i64 4
  store volatile i32 %85, ptr %94, align 4, !tbaa !20
  %95 = load i32, ptr %41, align 4, !tbaa !16
  %96 = call i32 @flock(i32 noundef %95, i32 noundef 8) #8
  %97 = getelementptr inbounds i8, ptr %10, i64 4
  store volatile i32 1, ptr %97, align 4, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  br label %100

98:                                               ; preds = %62
  %99 = getelementptr inbounds i8, ptr %10, i64 4
  store volatile i32 0, ptr %99, align 4, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  br label %128

100:                                              ; preds = %.thread108, %3
  %101 = getelementptr inbounds i8, ptr %12, i64 272
  %102 = load ptr, ptr %101, align 8, !tbaa !19
  %103 = getelementptr inbounds i8, ptr %102, i64 24
  %104 = load volatile i64, ptr %103, align 8, !tbaa !22
  %105 = add nsw i64 %104, -1
  %106 = srem i64 %105, 8
  %107 = getelementptr inbounds i8, ptr %102, i64 32
  %108 = getelementptr inbounds [128 x %struct.ProcCommunicateState], ptr %107, i64 0, i64 %106
  %109 = load volatile i32, ptr %108, align 8, !tbaa !23
  %110 = getelementptr inbounds i8, ptr %108, i64 4
  %111 = load volatile i32, ptr %110, align 4, !tbaa !25
  %112 = getelementptr inbounds i8, ptr %12, i64 280
  %113 = load i64, ptr %112, align 8, !tbaa !11
  %.not102 = icmp sgt i64 %105, %113
  %114 = getelementptr inbounds i8, ptr %102, i64 1056
  %115 = sext i32 %109 to i64
  %116 = getelementptr inbounds i8, ptr %114, i64 %115
  %117 = select i1 %.not102, ptr %116, ptr null
  %.not103 = icmp eq ptr %2, null
  br i1 %.not102, label %120, label %118

118:                                              ; preds = %100
  br i1 %.not103, label %127, label %119

119:                                              ; preds = %118
  store i32 0, ptr %2, align 4, !tbaa !14
  br label %127

120:                                              ; preds = %100
  br i1 %.not103, label %124, label %121

121:                                              ; preds = %120
  %122 = load i32, ptr %2, align 4, !tbaa !14
  %123 = icmp sgt i32 %122, 0
  %. = call i32 @llvm.smin.i32(i32 %122, i32 %111)
  %.091 = select i1 %123, i32 %., i32 %111
  store i32 %.091, ptr %2, align 4, !tbaa !14
  br label %124

124:                                              ; preds = %121, %120
  %.192 = phi i32 [ %.091, %121 ], [ %111, %120 ]
  %.not104 = icmp eq ptr %1, null
  br i1 %.not104, label %127, label %125

125:                                              ; preds = %124
  %126 = sext i32 %.192 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %1, ptr nonnull align 1 %116, i64 %126, i1 false)
  br label %127

127:                                              ; preds = %124, %125, %118, %119
  store i64 %105, ptr %112, align 8, !tbaa !11
  br label %128

128:                                              ; preds = %98, %.thread, %.critedge, %127
  %.5 = phi ptr [ %117, %127 ], [ null, %98 ], [ null, %.critedge ], [ null, %.thread ]
  ret ptr %.5
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7

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 = { 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 = { "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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { 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 = !{!12, !13, i64 280}
!12 = !{!"HandleProcTopic", !8, i64 0, !7, i64 256, !7, i64 260, !7, i64 264, !7, i64 268, !10, i64 272, !13, i64 280}
!13 = !{!"long", !8, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!12, !7, i64 264}
!16 = !{!12, !7, i64 260}
!17 = !{!6, !7, i64 4}
!18 = !{!13, !13, i64 0}
!19 = !{!12, !10, i64 272}
!20 = !{!21, !7, i64 4}
!21 = !{!"ProcTopicInfo", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !13, i64 24, !8, i64 32, !8, i64 1056}
!22 = !{!21, !13, i64 24}
!23 = !{!24, !7, i64 0}
!24 = !{!"ProcCommunicateState", !7, i64 0, !7, i64 4}
!25 = !{!24, !7, i64 4}


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