; LLVM IR from septag/dmon :: test-incremental (dmon_watch)

; 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.dmon__state = type { [64 x ptr], [64 x i32], ptr, i32, i64, %union.pthread_mutex_t, i8 }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.dmon_watch_id = type { i32 }
%struct.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }
%struct.dmon__watch_subdir = type { [260 x i8] }
%struct.dmon__watch_state = type { %struct.dmon_watch_id, i32, i32, ptr, ptr, [260 x i8], ptr, ptr }

@_dmon_init = external hidden global i8, align 1
@.str.1 = external hidden unnamed_addr constant [52 x i8], align 1
@_dmon = external hidden global %struct.dmon__state, align 8
@.str.4 = external hidden unnamed_addr constant [11 x i8], align 1
@__PRETTY_FUNCTION__.dmon_watch = external hidden unnamed_addr constant [145 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @dmon_watch(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3) #3 {
  %5 = alloca %struct.dmon_watch_id, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca %struct.dmon_watch_id, align 4
  %17 = alloca %struct.stat, align 8
  %18 = alloca [512 x i8], align 16
  %19 = alloca [4096 x i8], align 16
  %20 = alloca ptr, align 8
  %21 = alloca [512 x i8], align 16
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca [512 x i8], align 16
  %26 = alloca %struct.dmon__watch_subdir, align 1
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  %27 = load i8, ptr @_dmon_init, align 1, !tbaa !11, !range !13, !noundef !14
  %28 = trunc i8 %27 to i1
  br i1 %28, label %29, label %30

29:                                               ; preds = %4
  br label %31

30:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 1207, ptr noundef @__PRETTY_FUNCTION__.dmon_watch) #10
  unreachable

31:                                               ; preds = %29
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %35

34:                                               ; preds = %31
  br label %36

35:                                               ; preds = %31
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 1208, ptr noundef @__PRETTY_FUNCTION__.dmon_watch) #10
  unreachable

36:                                               ; preds = %34
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %46

39:                                               ; preds = %36
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %40, i64 0
  %42 = load i8, ptr %41, align 1, !tbaa !15
  %43 = sext i8 %42 to i32
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %46

45:                                               ; preds = %39
  br label %47

46:                                               ; preds = %39, %36
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 1209, ptr noundef @__PRETTY_FUNCTION__.dmon_watch) #10
  unreachable

47:                                               ; preds = %45
  %48 = call i32 @pthread_mutex_lock(ptr noundef getelementptr inbounds (%struct.dmon__state, ptr @_dmon, i32 0, i32 5)) #11
  %49 = load i32, ptr getelementptr inbounds (%struct.dmon__state, ptr @_dmon, i32 0, i32 3), align 8, !tbaa !16
  %50 = icmp slt i32 %49, 64
  br i1 %50, label %51, label %52

51:                                               ; preds = %47
  br label %53

52:                                               ; preds = %47
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 1213, ptr noundef @__PRETTY_FUNCTION__.dmon_watch) #10
  unreachable

53:                                               ; preds = %51
  %54 = load i32, ptr getelementptr inbounds (%struct.dmon__state, ptr @_dmon, i32 0, i32 3), align 8, !tbaa !16
  %55 = icmp sge i32 %54, 64
  br i1 %55, label %56, label %62

56:                                               ; preds = %53
  br label %57

57:                                               ; preds = %56
  %58 = call i32 @puts(ptr noundef @.str.8)
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.1, i32 noundef 1215, ptr noundef @__PRETTY_FUNCTION__.dmon_watch) #10
  unreachable

59:                                               ; No predecessors!
  %60 = call i32 @pthread_mutex_unlock(ptr noundef getelementptr inbounds (%struct.dmon__state, ptr @_dmon, i32 0, i32 5)) #11
  %61 = getelementptr inbounds %struct.dmon_watch_id, ptr %5, i32 0, i32 0
  store i32 0, ptr %61, align 4, !tbaa !19
  br label %379

62:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #11
  %63 = load i32, ptr getelementptr inbounds (%struct.dmon__state, ptr @_dmon, i32 0, i32 3), align 8, !tbaa !16
  %64 = sub nsw i32 64, %63
  store i32 %64, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #11
  %65 = load i32, ptr %10, align 4, !tbaa !9
  %66 = sub nsw i32 %65, 1
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [64 x i32], ptr getelementptr inbounds (%struct.dmon__state, ptr @_dmon, i32 0, i32 1), i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !9
  store i32 %69, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #11
  %70 = load i32, ptr %11, align 4, !tbaa !9
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %12, align 4, !tbaa !9
  %72 = load i32, ptr %11, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [64 x ptr], ptr @_dmon, i64 0, i64 %73
  %75 = load ptr, ptr %74, align 8, !tbaa !5
  %76 = icmp eq ptr %75, null
  br i1 %76, label %77, label %98

77:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #11
  %78 = call noalias ptr @malloc(i64 noundef 312) #12
  store ptr %78, ptr %13, align 8, !tbaa !5
  %79 = load ptr, ptr %13, align 8, !tbaa !5
  %80 = icmp ne ptr %79, null
  br i1 %80, label %81, label %82

81:                                               ; preds = %77
  br label %83

82:                                               ; preds = %77
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.1, i32 noundef 1226, ptr noundef @__PRETTY_FUNCTION__.dmon_watch) #10
  unreachable

83:                                               ; preds = %81
  %84 = load ptr, ptr %13, align 8, !tbaa !5
  %85 = icmp eq ptr %84, null
  br i1 %85, label %86, label %89

86:                                               ; preds = %83
  %87 = call i32 @pthread_mutex_unlock(ptr noundef getelementptr inbounds (%struct.dmon__state, ptr @_dmon, i32 0, i32 5)) #11
  %88 = getelementptr inbounds %struct.dmon_watch_id, ptr %5, i32 0, i32 0
  store i32 0, ptr %88, align 4, !tbaa !19
  store i32 1, ptr %14, align 4
  br label %95

89:                                               ; preds = %83
  %90 = load ptr, ptr %13, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %90, i8 0, i64 312, i1 false)
  %91 = load ptr, ptr %13, align 8, !tbaa !5
  %92 = load i32, ptr %11, align 4, !tbaa !9
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [64 x ptr], ptr @_dmon, i64 0, i64 %93
  store ptr %91, ptr %94, align 8, !tbaa !5
  store i32 0, ptr %14, align 4
  br label %95

95:                                               ; preds = %89, %86
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #11
  %96 = load i32, ptr %14, align 4
  switch i32 %96, label %378 [
    i32 0, label %97
  ]

97:                                               ; preds = %95
  br label %98

98:                                               ; preds = %97, %62
  %99 = load i32, ptr getelementptr inbounds (%struct.dmon__state, ptr @_dmon, i32 0, i32 3), align 8, !tbaa !16
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr getelementptr inbounds (%struct.dmon__state, ptr @_dmon, i32 0, i32 3), align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #11
  %101 = load i32, ptr %11, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [64 x ptr], ptr @_dmon, i64 0, i64 %102
  %104 = load ptr, ptr %103, align 8, !tbaa !5
  store ptr %104, ptr %15, align 8, !tbaa !5
  %105 = load ptr, ptr %15, align 8, !tbaa !5
  %106 = icmp ne ptr %105, null
  br i1 %106, label %107, label %108

107:                                              ; preds = %98
  br label %109

108:                                              ; preds = %98
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.1, i32 noundef 1238, ptr noundef @__PRETTY_FUNCTION__.dmon_watch) #10
  unreachable

109:                                              ; preds = %107
  %110 = load ptr, ptr %15, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.dmon__watch_state, ptr %110, i32 0, i32 0
  %112 = getelementptr inbounds %struct.dmon_watch_id, ptr %16, i32 0, i32 0
  %113 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %113, ptr %112, align 4, !tbaa !19
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %111, ptr align 4 %16, i64 4, i1 false), !tbaa.struct !21
  %114 = load i32, ptr %8, align 4, !tbaa !9
  %115 = load ptr, ptr %15, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.dmon__watch_state, ptr %115, i32 0, i32 2
  store i32 %114, ptr %116, align 8, !tbaa !22
  %117 = load ptr, ptr %7, align 8, !tbaa !5
  %118 = load ptr, ptr %15, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.dmon__watch_state, ptr %118, i32 0, i32 3
  store ptr %117, ptr %119, align 8, !tbaa !24
  %120 = load ptr, ptr %9, align 8, !tbaa !5
  %121 = load ptr, ptr %15, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.dmon__watch_state, ptr %121, i32 0, i32 4
  store ptr %120, ptr %122, align 8, !tbaa !25
  call void @llvm.lifetime.start.p0(i64 144, ptr %17) #11
  %123 = load ptr, ptr %6, align 8, !tbaa !5
  %124 = call i32 @stat(ptr noundef %123, ptr noundef %17) #11
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %136, label %126

126:                                              ; preds = %109
  %127 = getelementptr inbounds %struct.stat, ptr %17, i32 0, i32 3
  %128 = load i32, ptr %127, align 8, !tbaa !26
  %129 = and i32 %128, 61440
  %130 = icmp eq i32 %129, 16384
  br i1 %130, label %131, label %136

131:                                              ; preds = %126
  %132 = getelementptr inbounds %struct.stat, ptr %17, i32 0, i32 3
  %133 = load i32, ptr %132, align 8, !tbaa !26
  %134 = and i32 %133, 256
  %135 = icmp ne i32 %134, 256
  br i1 %135, label %136, label %150

136:                                              ; preds = %131, %126, %109
  br label %137

137:                                              ; preds = %136
  call void @llvm.lifetime.start.p0(i64 512, ptr %18) #11
  %138 = getelementptr inbounds [512 x i8], ptr %18, i64 0, i64 0
  %139 = load ptr, ptr %6, align 8, !tbaa !5
  %140 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %138, i64 noundef 512, ptr noundef @.str.12, ptr noundef %139) #11
  br label %141

141:                                              ; preds = %137
  %142 = getelementptr inbounds [512 x i8], ptr %18, i64 0, i64 0
  %143 = call i32 @puts(ptr noundef %142)
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.1, i32 noundef 1246, ptr noundef @__PRETTY_FUNCTION__.dmon_watch) #10
  unreachable

144:                                              ; No predecessors!
  br label %145

145:                                              ; preds = %144
  call void @llvm.lifetime.end.p0(i64 512, ptr %18) #11
  br label %146

146:                                              ; preds = %145
  br label %147

147:                                              ; preds = %146
  %148 = call i32 @pthread_mutex_unlock(ptr noundef getelementptr inbounds (%struct.dmon__state, ptr @_dmon, i32 0, i32 5)) #11
  %149 = getelementptr inbounds %struct.dmon_watch_id, ptr %5, i32 0, i32 0
  store i32 0, ptr %149, align 4, !tbaa !19
  store i32 1, ptr %14, align 4
  br label %377

150:                                              ; preds = %131
  %151 = getelementptr inbounds %struct.stat, ptr %17, i32 0, i32 3
  %152 = load i32, ptr %151, align 8, !tbaa !26
  %153 = and i32 %152, 61440
  %154 = icmp eq i32 %153, 40960
  br i1 %154, label %155, label %189

155:                                              ; preds = %150
  %156 = load i32, ptr %8, align 4, !tbaa !9
  %157 = and i32 %156, 2
  %158 = icmp ne i32 %157, 0
  br i1 %158, label %159, label %174

159:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 4096, ptr %19) #11
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #11
  %160 = load ptr, ptr %6, align 8, !tbaa !5
  %161 = getelementptr inbounds [4096 x i8], ptr %19, i64 0, i64 0
  %162 = call ptr @realpath(ptr noundef %160, ptr noundef %161) #11
  store ptr %162, ptr %20, align 8, !tbaa !5
  %163 = load ptr, ptr %20, align 8, !tbaa !5
  %164 = load ptr, ptr %20, align 8, !tbaa !5
  %165 = icmp ne ptr %164, null
  br i1 %165, label %166, label %167

166:                                              ; preds = %159
  br label %168

167:                                              ; preds = %159
  call void @__assert_fail(ptr noundef @.str.13, ptr noundef @.str.1, i32 noundef 1256, ptr noundef @__PRETTY_FUNCTION__.dmon_watch) #10
  unreachable

168:                                              ; preds = %166
  %169 = load ptr, ptr %15, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.dmon__watch_state, ptr %169, i32 0, i32 5
  %171 = getelementptr inbounds [260 x i8], ptr %170, i64 0, i64 0
  %172 = getelementptr inbounds [4096 x i8], ptr %19, i64 0, i64 0
  %173 = call ptr @_dmon_strcpy(ptr noundef %171, i32 noundef 259, ptr noundef %172)
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #11
  call void @llvm.lifetime.end.p0(i64 4096, ptr %19) #11
  br label %188

174:                                              ; preds = %155
  br label %175

175:                                              ; preds = %174
  call void @llvm.lifetime.start.p0(i64 512, ptr %21) #11
  %176 = getelementptr inbounds [512 x i8], ptr %21, i64 0, i64 0
  %177 = load ptr, ptr %6, align 8, !tbaa !5
  %178 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %176, i64 noundef 512, ptr noundef @.str.14, ptr noundef %177) #11
  br label %179

179:                                              ; preds = %175
  %180 = getelementptr inbounds [512 x i8], ptr %21, i64 0, i64 0
  %181 = call i32 @puts(ptr noundef %180)
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.1, i32 noundef 1261, ptr noundef @__PRETTY_FUNCTION__.dmon_watch) #10
  unreachable

182:                                              ; No predecessors!
  br label %183

183:                                              ; preds = %182
  call void @llvm.lifetime.end.p0(i64 512, ptr %21) #11
  br label %184

184:                                              ; preds = %183
  br label %185

185:                                              ; preds = %184
  %186 = call i32 @pthread_mutex_unlock(ptr noundef getelementptr inbounds (%struct.dmon__state, ptr @_dmon, i32 0, i32 5)) #11
  %187 = getelementptr inbounds %struct.dmon_watch_id, ptr %5, i32 0, i32 0
  store i32 0, ptr %187, align 4, !tbaa !19
  store i32 1, ptr %14, align 4
  br label %377

188:                                              ; preds = %168
  br label %195

189:                                              ; preds = %150
  %190 = load ptr, ptr %15, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.dmon__watch_state, ptr %190, i32 0, i32 5
  %192 = getelementptr inbounds [260 x i8], ptr %191, i64 0, i64 0
  %193 = load ptr, ptr %6, align 8, !tbaa !5
  %194 = call ptr @_dmon_strcpy(ptr noundef %192, i32 noundef 259, ptr noundef %193)
  br label %195

195:                                              ; preds = %189, %188
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #11
  %196 = load ptr, ptr %15, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.dmon__watch_state, ptr %196, i32 0, i32 5
  %198 = getelementptr inbounds [260 x i8], ptr %197, i64 0, i64 0
  %199 = call i64 @strlen(ptr noundef %198) #13
  %200 = trunc i64 %199 to i32
  store i32 %200, ptr %22, align 4, !tbaa !9
  %201 = load ptr, ptr %15, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.dmon__watch_state, ptr %201, i32 0, i32 5
  %203 = load i32, ptr %22, align 4, !tbaa !9
  %204 = sub nsw i32 %203, 1
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds [260 x i8], ptr %202, i64 0, i64 %205
  %207 = load i8, ptr %206, align 1, !tbaa !15
  %208 = sext i8 %207 to i32
  %209 = icmp ne i32 %208, 47
  br i1 %209, label %210, label %222

210:                                              ; preds = %195
  %211 = load ptr, ptr %15, align 8, !tbaa !5
  %212 = getelementptr inbounds %struct.dmon__watch_state, ptr %211, i32 0, i32 5
  %213 = load i32, ptr %22, align 4, !tbaa !9
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [260 x i8], ptr %212, i64 0, i64 %214
  store i8 47, ptr %215, align 1, !tbaa !15
  %216 = load ptr, ptr %15, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.dmon__watch_state, ptr %216, i32 0, i32 5
  %218 = load i32, ptr %22, align 4, !tbaa !9
  %219 = add nsw i32 %218, 1
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [260 x i8], ptr %217, i64 0, i64 %220
  store i8 0, ptr %221, align 1, !tbaa !15
  br label %222

222:                                              ; preds = %210, %195
  %223 = call i32 @inotify_init() #11
  %224 = load ptr, ptr %15, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.dmon__watch_state, ptr %224, i32 0, i32 1
  store i32 %223, ptr %225, align 4, !tbaa !29
  %226 = load ptr, ptr %15, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.dmon__watch_state, ptr %226, i32 0, i32 1
  %228 = load i32, ptr %227, align 4, !tbaa !29
  %229 = icmp slt i32 %228, -1
  br i1 %229, label %230, label %237

230:                                              ; preds = %222
  br label %231

231:                                              ; preds = %230
  %232 = call i32 @puts(ptr noundef @.str.15)
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.1, i32 noundef 1278, ptr noundef @__PRETTY_FUNCTION__.dmon_watch) #10
  unreachable

233:                                              ; No predecessors!
  br label %234

234:                                              ; preds = %233
  %235 = call i32 @pthread_mutex_unlock(ptr noundef getelementptr inbounds (%struct.dmon__state, ptr @_dmon, i32 0, i32 5)) #11
  %236 = getelementptr inbounds %struct.dmon_watch_id, ptr %5, i32 0, i32 0
  store i32 0, ptr %236, align 4, !tbaa !19
  store i32 1, ptr %14, align 4
  br label %376

237:                                              ; preds = %222
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #11
  store i32 962, ptr %23, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #11
  %238 = load ptr, ptr %15, align 8, !tbaa !5
  %239 = getelementptr inbounds %struct.dmon__watch_state, ptr %238, i32 0, i32 1
  %240 = load i32, ptr %239, align 4, !tbaa !29
  %241 = load ptr, ptr %15, align 8, !tbaa !5
  %242 = getelementptr inbounds %struct.dmon__watch_state, ptr %241, i32 0, i32 5
  %243 = getelementptr inbounds [260 x i8], ptr %242, i64 0, i64 0
  %244 = load i32, ptr %23, align 4, !tbaa !9
  %245 = call i32 @inotify_add_watch(i32 noundef %240, ptr noundef %243, i32 noundef %244) #11
  store i32 %245, ptr %24, align 4, !tbaa !9
  %246 = load i32, ptr %24, align 4, !tbaa !9
  %247 = icmp slt i32 %246, 0
  br i1 %247, label %248, label %266

248:                                              ; preds = %237
  br label %249

249:                                              ; preds = %248
  call void @llvm.lifetime.start.p0(i64 512, ptr %25) #11
  %250 = getelementptr inbounds [512 x i8], ptr %25, i64 0, i64 0
  %251 = load ptr, ptr %15, align 8, !tbaa !5
  %252 = getelementptr inbounds %struct.dmon__watch_state, ptr %251, i32 0, i32 5
  %253 = getelementptr inbounds [260 x i8], ptr %252, i64 0, i64 0
  %254 = call ptr @__errno_location() #14
  %255 = load i32, ptr %254, align 4, !tbaa !9
  %256 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %250, i64 noundef 512, ptr noundef @.str.16, ptr noundef %253, i32 noundef %255) #11
  br label %257

257:                                              ; preds = %249
  %258 = getelementptr inbounds [512 x i8], ptr %25, i64 0, i64 0
  %259 = call i32 @puts(ptr noundef %258)
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.1, i32 noundef 1286, ptr noundef @__PRETTY_FUNCTION__.dmon_watch) #10
  unreachable

260:                                              ; No predecessors!
  br label %261

261:                                              ; preds = %260
  call void @llvm.lifetime.end.p0(i64 512, ptr %25) #11
  br label %262

262:                                              ; preds = %261
  br label %263

263:                                              ; preds = %262
  %264 = call i32 @pthread_mutex_unlock(ptr noundef getelementptr inbounds (%struct.dmon__state, ptr @_dmon, i32 0, i32 5)) #11
  %265 = getelementptr inbounds %struct.dmon_watch_id, ptr %5, i32 0, i32 0
  store i32 0, ptr %265, align 4, !tbaa !19
  store i32 1, ptr %14, align 4
  br label %375

266:                                              ; preds = %237
  call void @llvm.lifetime.start.p0(i64 260, ptr %26) #11
  %267 = getelementptr inbounds %struct.dmon__watch_subdir, ptr %26, i32 0, i32 0
  %268 = getelementptr inbounds [260 x i8], ptr %267, i64 0, i64 0
  %269 = call ptr @_dmon_strcpy(ptr noundef %268, i32 noundef 260, ptr noundef @.str.17)
  %270 = load ptr, ptr %15, align 8, !tbaa !5
  %271 = getelementptr inbounds %struct.dmon__watch_state, ptr %270, i32 0, i32 6
  %272 = load ptr, ptr %271, align 8, !tbaa !30
  %273 = icmp eq ptr %272, null
  br i1 %273, label %289, label %274

274:                                              ; preds = %266
  %275 = load ptr, ptr %15, align 8, !tbaa !5
  %276 = getelementptr inbounds %struct.dmon__watch_state, ptr %275, i32 0, i32 6
  %277 = load ptr, ptr %276, align 8, !tbaa !30
  %278 = getelementptr inbounds i32, ptr %277, i64 -2
  %279 = getelementptr inbounds i32, ptr %278, i64 1
  %280 = load i32, ptr %279, align 4, !tbaa !9
  %281 = add nsw i32 %280, 1
  %282 = load ptr, ptr %15, align 8, !tbaa !5
  %283 = getelementptr inbounds %struct.dmon__watch_state, ptr %282, i32 0, i32 6
  %284 = load ptr, ptr %283, align 8, !tbaa !30
  %285 = getelementptr inbounds i32, ptr %284, i64 -2
  %286 = getelementptr inbounds i32, ptr %285, i64 0
  %287 = load i32, ptr %286, align 4, !tbaa !9
  %288 = icmp sge i32 %281, %287
  br i1 %288, label %289, label %296

289:                                              ; preds = %274, %266
  %290 = load ptr, ptr %15, align 8, !tbaa !5
  %291 = getelementptr inbounds %struct.dmon__watch_state, ptr %290, i32 0, i32 6
  %292 = load ptr, ptr %291, align 8, !tbaa !30
  %293 = call ptr @stb__sbgrowf(ptr noundef %292, i32 noundef 1, i32 noundef 260)
  %294 = load ptr, ptr %15, align 8, !tbaa !5
  %295 = getelementptr inbounds %struct.dmon__watch_state, ptr %294, i32 0, i32 6
  store ptr %293, ptr %295, align 8, !tbaa !5
  br label %297

296:                                              ; preds = %274
  br label %297

297:                                              ; preds = %296, %289
  %298 = phi ptr [ %293, %289 ], [ null, %296 ]
  %299 = load ptr, ptr %15, align 8, !tbaa !5
  %300 = getelementptr inbounds %struct.dmon__watch_state, ptr %299, i32 0, i32 6
  %301 = load ptr, ptr %300, align 8, !tbaa !30
  %302 = load ptr, ptr %15, align 8, !tbaa !5
  %303 = getelementptr inbounds %struct.dmon__watch_state, ptr %302, i32 0, i32 6
  %304 = load ptr, ptr %303, align 8, !tbaa !30
  %305 = getelementptr inbounds i32, ptr %304, i64 -2
  %306 = getelementptr inbounds i32, ptr %305, i64 1
  %307 = load i32, ptr %306, align 4, !tbaa !9
  %308 = add nsw i32 %307, 1
  store i32 %308, ptr %306, align 4, !tbaa !9
  %309 = sext i32 %307 to i64
  %310 = getelementptr inbounds %struct.dmon__watch_subdir, ptr %301, i64 %309
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %310, ptr align 1 %26, i64 260, i1 false), !tbaa.struct !31
  %311 = load ptr, ptr %15, align 8, !tbaa !5
  %312 = getelementptr inbounds %struct.dmon__watch_state, ptr %311, i32 0, i32 7
  %313 = load ptr, ptr %312, align 8, !tbaa !32
  %314 = icmp eq ptr %313, null
  br i1 %314, label %330, label %315

315:                                              ; preds = %297
  %316 = load ptr, ptr %15, align 8, !tbaa !5
  %317 = getelementptr inbounds %struct.dmon__watch_state, ptr %316, i32 0, i32 7
  %318 = load ptr, ptr %317, align 8, !tbaa !32
  %319 = getelementptr inbounds i32, ptr %318, i64 -2
  %320 = getelementptr inbounds i32, ptr %319, i64 1
  %321 = load i32, ptr %320, align 4, !tbaa !9
  %322 = add nsw i32 %321, 1
  %323 = load ptr, ptr %15, align 8, !tbaa !5
  %324 = getelementptr inbounds %struct.dmon__watch_state, ptr %323, i32 0, i32 7
  %325 = load ptr, ptr %324, align 8, !tbaa !32
  %326 = getelementptr inbounds i32, ptr %325, i64 -2
  %327 = getelementptr inbounds i32, ptr %326, i64 0
  %328 = load i32, ptr %327, align 4, !tbaa !9
  %329 = icmp sge i32 %322, %328
  br i1 %329, label %330, label %337

330:                                              ; preds = %315, %297
  %331 = load ptr, ptr %15, align 8, !tbaa !5
  %332 = getelementptr inbounds %struct.dmon__watch_state, ptr %331, i32 0, i32 7
  %333 = load ptr, ptr %332, align 8, !tbaa !32
  %334 = call ptr @stb__sbgrowf(ptr noundef %333, i32 noundef 1, i32 noundef 4)
  %335 = load ptr, ptr %15, align 8, !tbaa !5
  %336 = getelementptr inbounds %struct.dmon__watch_state, ptr %335, i32 0, i32 7
  store ptr %334, ptr %336, align 8, !tbaa !5
  br label %338

337:                                              ; preds = %315
  br label %338

338:                                              ; preds = %337, %330
  %339 = phi ptr [ %334, %330 ], [ null, %337 ]
  %340 = load i32, ptr %24, align 4, !tbaa !9
  %341 = load ptr, ptr %15, align 8, !tbaa !5
  %342 = getelementptr inbounds %struct.dmon__watch_state, ptr %341, i32 0, i32 7
  %343 = load ptr, ptr %342, align 8, !tbaa !32
  %344 = load ptr, ptr %15, align 8, !tbaa !5
  %345 = getelementptr inbounds %struct.dmon__watch_state, ptr %344, i32 0, i32 7
  %346 = load ptr, ptr %345, align 8, !tbaa !32
  %347 = getelementptr inbounds i32, ptr %346, i64 -2
  %348 = getelementptr inbounds i32, ptr %347, i64 1
  %349 = load i32, ptr %348, align 4, !tbaa !9
  %350 = add nsw i32 %349, 1
  store i32 %350, ptr %348, align 4, !tbaa !9
  %351 = sext i32 %349 to i64
  %352 = getelementptr inbounds i32, ptr %343, i64 %351
  store i32 %340, ptr %352, align 4, !tbaa !9
  %353 = load i32, ptr %8, align 4, !tbaa !9
  %354 = and i32 %353, 1
  %355 = icmp ne i32 %354, 0
  br i1 %355, label %356, label %371

356:                                              ; preds = %338
  %357 = load ptr, ptr %15, align 8, !tbaa !5
  %358 = getelementptr inbounds %struct.dmon__watch_state, ptr %357, i32 0, i32 5
  %359 = getelementptr inbounds [260 x i8], ptr %358, i64 0, i64 0
  %360 = load ptr, ptr %15, align 8, !tbaa !5
  %361 = getelementptr inbounds %struct.dmon__watch_state, ptr %360, i32 0, i32 1
  %362 = load i32, ptr %361, align 4, !tbaa !29
  %363 = load i32, ptr %23, align 4, !tbaa !9
  %364 = load i32, ptr %8, align 4, !tbaa !9
  %365 = and i32 %364, 2
  %366 = icmp ne i32 %365, 0
  %367 = zext i1 %366 to i64
  %368 = select i1 %366, i32 1, i32 0
  %369 = icmp ne i32 %368, 0
  %370 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_dmon_watch_recursive(ptr noundef %359, i32 noundef %362, i32 noundef %363, i1 noundef zeroext %369, ptr noundef %370)
  br label %371

371:                                              ; preds = %356, %338
  %372 = call i32 @pthread_mutex_unlock(ptr noundef getelementptr inbounds (%struct.dmon__state, ptr @_dmon, i32 0, i32 5)) #11
  %373 = getelementptr inbounds %struct.dmon_watch_id, ptr %5, i32 0, i32 0
  %374 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %374, ptr %373, align 4, !tbaa !19
  store i32 1, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 260, ptr %26) #11
  br label %375

375:                                              ; preds = %371, %263
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #11
  br label %376

376:                                              ; preds = %375, %234
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #11
  br label %377

377:                                              ; preds = %376, %185, %147
  call void @llvm.lifetime.end.p0(i64 144, ptr %17) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #11
  br label %378

378:                                              ; preds = %377, %95
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #11
  br label %379

379:                                              ; preds = %378, %59
  %380 = getelementptr inbounds %struct.dmon_watch_id, ptr %5, i32 0, i32 0
  %381 = load i32, ptr %380, align 4
  ret i32 %381
}

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

declare i32 @puts(ptr noundef) #5

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

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

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

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

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

; Function Attrs: nounwind
declare ptr @realpath(ptr noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
declare hidden ptr @_dmon_strcpy(ptr noundef, i32 noundef, ptr noundef) #3

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #8

; Function Attrs: nounwind
declare i32 @inotify_init() #4

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

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

; Function Attrs: nounwind uwtable
declare hidden ptr @stb__sbgrowf(ptr noundef, i32 noundef, i32 noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @_dmon_watch_recursive(ptr noundef, i32 noundef, i32 noundef, i1 noundef zeroext, ptr noundef) #3

attributes #0 = { noreturn 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 "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 = { "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 allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nounwind willreturn memory(read) "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 #9 = { nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { noreturn nounwind }
attributes #11 = { nounwind }
attributes #12 = { nounwind allocsize(0) }
attributes #13 = { nounwind willreturn memory(read) }
attributes #14 = { nounwind willreturn memory(none) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!7, !7, i64 0}
!16 = !{!17, !10, i64 776}
!17 = !{!"dmon__state", !7, i64 0, !7, i64 512, !6, i64 768, !10, i64 776, !18, i64 784, !7, i64 792, !12, i64 832}
!18 = !{!"long", !7, i64 0}
!19 = !{!20, !10, i64 0}
!20 = !{!"", !10, i64 0}
!21 = !{i64 0, i64 4, !9}
!22 = !{!23, !10, i64 8}
!23 = !{!"dmon__watch_state", !20, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !6, i64 24, !7, i64 32, !6, i64 296, !6, i64 304}
!24 = !{!23, !6, i64 16}
!25 = !{!23, !6, i64 24}
!26 = !{!27, !10, i64 24}
!27 = !{!"stat", !18, i64 0, !18, i64 8, !18, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !18, i64 40, !18, i64 48, !18, i64 56, !18, i64 64, !28, i64 72, !28, i64 88, !28, i64 104, !7, i64 120}
!28 = !{!"timespec", !18, i64 0, !18, i64 8}
!29 = !{!23, !10, i64 4}
!30 = !{!23, !6, i64 296}
!31 = !{i64 0, i64 260, !15}
!32 = !{!23, !6, i64 304}


; 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.dmon__state = type { [64 x ptr], [64 x i32], ptr, i32, i64, %union.pthread_mutex_t, i8 }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }
%struct.dmon__watch_subdir = type { [260 x i8] }

@_dmon_init = external hidden local_unnamed_addr global i8, align 1
@.str.1 = external hidden unnamed_addr constant [52 x i8], align 1
@_dmon = external hidden global %struct.dmon__state, align 8
@.str.4 = external hidden unnamed_addr constant [11 x i8], align 1
@__PRETTY_FUNCTION__.dmon_watch = external hidden unnamed_addr constant [145 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -2147483647, -2147483648) i32 @dmon_watch(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3) local_unnamed_addr #2 {
  %5 = alloca %struct.stat, align 8
  %6 = alloca [512 x i8], align 16
  %7 = alloca [512 x i8], align 16
  %8 = alloca %struct.dmon__watch_subdir, align 1
  %9 = load i8, ptr @_dmon_init, align 1, !tbaa !5, !range !9, !noundef !10
  %10 = trunc nuw i8 %9 to i1
  br i1 %10, label %12, label %11

11:                                               ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 1207, ptr noundef nonnull @__PRETTY_FUNCTION__.dmon_watch) #9
  unreachable

12:                                               ; preds = %4
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %13, label %14

13:                                               ; preds = %12
  tail call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 1208, ptr noundef nonnull @__PRETTY_FUNCTION__.dmon_watch) #9
  unreachable

14:                                               ; preds = %12
  %.not78 = icmp eq ptr %0, null
  br i1 %.not78, label %17, label %15

15:                                               ; preds = %14
  %16 = load i8, ptr %0, align 1, !tbaa !11
  %.not79 = icmp eq i8 %16, 0
  br i1 %.not79, label %17, label %18

17:                                               ; preds = %15, %14
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 1209, ptr noundef nonnull @__PRETTY_FUNCTION__.dmon_watch) #9
  unreachable

18:                                               ; preds = %15
  %19 = tail call i32 @pthread_mutex_lock(ptr noundef nonnull getelementptr inbounds (i8, ptr @_dmon, i64 792)) #10
  %20 = load i32, ptr getelementptr inbounds (i8, ptr @_dmon, i64 776), align 8, !tbaa !12
  %21 = icmp slt i32 %20, 64
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 1213, ptr noundef nonnull @__PRETTY_FUNCTION__.dmon_watch) #9
  unreachable

23:                                               ; preds = %18
  %24 = sub i32 63, %20
  %25 = zext nneg i32 %24 to i64
  %26 = getelementptr inbounds [64 x i32], ptr getelementptr inbounds (i8, ptr @_dmon, i64 512), i64 0, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !17
  %28 = add nsw i32 %27, 1
  %29 = sext i32 %27 to i64
  %30 = getelementptr inbounds [64 x ptr], ptr @_dmon, i64 0, i64 %29
  %31 = load ptr, ptr %30, align 8, !tbaa !18
  %32 = icmp eq ptr %31, null
  br i1 %32, label %33, label %36

33:                                               ; preds = %23
  %calloc = tail call dereferenceable_or_null(312) ptr @calloc(i64 1, i64 312)
  %.not80 = icmp eq ptr %calloc, null
  br i1 %.not80, label %34, label %35

34:                                               ; preds = %33
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.1, i32 noundef 1226, ptr noundef nonnull @__PRETTY_FUNCTION__.dmon_watch) #9
  unreachable

35:                                               ; preds = %33
  store ptr %calloc, ptr %30, align 8, !tbaa !18
  br label %36

36:                                               ; preds = %23, %35
  %37 = phi ptr [ %calloc, %35 ], [ %31, %23 ]
  %38 = add nsw i32 %20, 1
  store i32 %38, ptr getelementptr inbounds (i8, ptr @_dmon, i64 776), align 8, !tbaa !12
  store i32 %28, ptr %37, align 8, !tbaa !17
  %39 = getelementptr inbounds i8, ptr %37, i64 8
  store i32 %2, ptr %39, align 8, !tbaa !19
  %40 = getelementptr inbounds i8, ptr %37, i64 16
  store ptr %1, ptr %40, align 8, !tbaa !22
  %41 = getelementptr inbounds i8, ptr %37, i64 24
  store ptr %3, ptr %41, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %5) #10
  %42 = call i32 @stat(ptr noundef nonnull %0, ptr noundef nonnull %5) #10
  %.not82 = icmp eq i32 %42, 0
  br i1 %.not82, label %43, label %47

43:                                               ; preds = %36
  %44 = getelementptr inbounds i8, ptr %5, i64 24
  %45 = load i32, ptr %44, align 8, !tbaa !24
  %46 = and i32 %45, 61696
  %or.cond.not = icmp eq i32 %46, 16640
  br i1 %or.cond.not, label %50, label %47

47:                                               ; preds = %36, %43
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %6) #10
  %48 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %6, i64 noundef 512, ptr noundef nonnull @.str.12, ptr noundef nonnull %0) #10
  %49 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %6)
  tail call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.1, i32 noundef 1246, ptr noundef nonnull @__PRETTY_FUNCTION__.dmon_watch) #9
  unreachable

50:                                               ; preds = %43
  %51 = getelementptr inbounds i8, ptr %37, i64 32
  %52 = tail call ptr @_dmon_strcpy(ptr noundef nonnull %51, i32 noundef 259, ptr noundef nonnull %0)
  %53 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %51) #11
  %54 = shl i64 %53, 32
  %sext = add i64 %54, -4294967296
  %55 = ashr exact i64 %sext, 32
  %56 = getelementptr inbounds [260 x i8], ptr %51, i64 0, i64 %55
  %57 = load i8, ptr %56, align 1, !tbaa !11
  %.not84 = icmp eq i8 %57, 47
  br i1 %.not84, label %63, label %58

58:                                               ; preds = %50
  %59 = ashr exact i64 %54, 32
  %60 = getelementptr inbounds [260 x i8], ptr %51, i64 0, i64 %59
  store i8 47, ptr %60, align 1, !tbaa !11
  %sext86 = add i64 %54, 4294967296
  %61 = ashr exact i64 %sext86, 32
  %62 = getelementptr inbounds [260 x i8], ptr %51, i64 0, i64 %61
  store i8 0, ptr %62, align 1, !tbaa !11
  br label %63

63:                                               ; preds = %58, %50
  %64 = tail call i32 @inotify_init() #10
  %65 = getelementptr inbounds i8, ptr %37, i64 4
  store i32 %64, ptr %65, align 4, !tbaa !27
  %66 = icmp slt i32 %64, -1
  br i1 %66, label %67, label %69

67:                                               ; preds = %63
  %68 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.15)
  tail call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.1, i32 noundef 1278, ptr noundef nonnull @__PRETTY_FUNCTION__.dmon_watch) #9
  unreachable

69:                                               ; preds = %63
  %70 = tail call i32 @inotify_add_watch(i32 noundef %64, ptr noundef nonnull %51, i32 noundef 962) #10
  %71 = icmp slt i32 %70, 0
  br i1 %71, label %72, label %77

72:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %7) #10
  %73 = tail call ptr @__errno_location() #12
  %74 = load i32, ptr %73, align 4, !tbaa !17
  %75 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %7, i64 noundef 512, ptr noundef nonnull @.str.16, ptr noundef nonnull %51, i32 noundef %74) #10
  %76 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %7)
  tail call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.1, i32 noundef 1286, ptr noundef nonnull @__PRETTY_FUNCTION__.dmon_watch) #9
  unreachable

77:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 260, ptr nonnull %8) #10
  %78 = call ptr @_dmon_strcpy(ptr noundef nonnull %8, i32 noundef 260, ptr noundef nonnull @.str.17)
  %79 = getelementptr inbounds i8, ptr %37, i64 296
  %80 = load ptr, ptr %79, align 8, !tbaa !28
  %81 = icmp eq ptr %80, null
  br i1 %81, label %88, label %82

82:                                               ; preds = %77
  %83 = getelementptr inbounds i8, ptr %80, i64 -8
  %84 = getelementptr inbounds i8, ptr %80, i64 -4
  %85 = load i32, ptr %84, align 4, !tbaa !17
  %86 = add nsw i32 %85, 1
  %87 = load i32, ptr %83, align 4, !tbaa !17
  %.not87 = icmp slt i32 %86, %87
  br i1 %.not87, label %90, label %88

88:                                               ; preds = %82, %77
  %89 = call ptr @stb__sbgrowf(ptr noundef %80, i32 noundef 1, i32 noundef 260)
  store ptr %89, ptr %79, align 8, !tbaa !18
  %.phi.trans.insert = getelementptr inbounds i8, ptr %89, i64 -4
  %.pre = load i32, ptr %.phi.trans.insert, align 4, !tbaa !17
  %.pre92 = add nsw i32 %.pre, 1
  br label %90

90:                                               ; preds = %82, %88
  %.pre-phi = phi i32 [ %86, %82 ], [ %.pre92, %88 ]
  %91 = phi i32 [ %85, %82 ], [ %.pre, %88 ]
  %92 = phi ptr [ %80, %82 ], [ %89, %88 ]
  %93 = getelementptr inbounds i8, ptr %92, i64 -4
  store i32 %.pre-phi, ptr %93, align 4, !tbaa !17
  %94 = sext i32 %91 to i64
  %95 = getelementptr inbounds %struct.dmon__watch_subdir, ptr %92, i64 %94
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(260) %95, ptr noundef nonnull align 1 dereferenceable(260) %8, i64 260, i1 false), !tbaa.struct !29
  %96 = getelementptr inbounds i8, ptr %37, i64 304
  %97 = load ptr, ptr %96, align 8, !tbaa !30
  %98 = icmp eq ptr %97, null
  br i1 %98, label %105, label %99

99:                                               ; preds = %90
  %100 = getelementptr inbounds i8, ptr %97, i64 -8
  %101 = getelementptr inbounds i8, ptr %97, i64 -4
  %102 = load i32, ptr %101, align 4, !tbaa !17
  %103 = add nsw i32 %102, 1
  %104 = load i32, ptr %100, align 4, !tbaa !17
  %.not88 = icmp slt i32 %103, %104
  br i1 %.not88, label %107, label %105

105:                                              ; preds = %99, %90
  %106 = call ptr @stb__sbgrowf(ptr noundef %97, i32 noundef 1, i32 noundef 4)
  store ptr %106, ptr %96, align 8, !tbaa !18
  %.phi.trans.insert90 = getelementptr inbounds i8, ptr %106, i64 -4
  %.pre91 = load i32, ptr %.phi.trans.insert90, align 4, !tbaa !17
  %.pre93 = add nsw i32 %.pre91, 1
  br label %107

107:                                              ; preds = %99, %105
  %.pre-phi94 = phi i32 [ %103, %99 ], [ %.pre93, %105 ]
  %108 = phi i32 [ %102, %99 ], [ %.pre91, %105 ]
  %109 = phi ptr [ %97, %99 ], [ %106, %105 ]
  %110 = getelementptr inbounds i8, ptr %109, i64 -4
  store i32 %.pre-phi94, ptr %110, align 4, !tbaa !17
  %111 = sext i32 %108 to i64
  %112 = getelementptr inbounds i32, ptr %109, i64 %111
  store i32 %70, ptr %112, align 4, !tbaa !17
  %113 = and i32 %2, 1
  %.not89 = icmp eq i32 %113, 0
  br i1 %.not89, label %118, label %114

114:                                              ; preds = %107
  %115 = load i32, ptr %65, align 4, !tbaa !27
  %116 = and i32 %2, 2
  %117 = icmp ne i32 %116, 0
  call void @_dmon_watch_recursive(ptr noundef nonnull %51, i32 noundef %115, i32 noundef 962, i1 noundef zeroext %117, ptr noundef nonnull %37)
  br label %118

118:                                              ; preds = %114, %107
  %119 = call i32 @pthread_mutex_unlock(ptr noundef nonnull getelementptr inbounds (i8, ptr @_dmon, i64 792)) #10
  call void @llvm.lifetime.end.p0(i64 260, ptr nonnull %8) #10
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %5) #10
  ret i32 %28
}

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

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

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

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

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

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #6

; Function Attrs: nounwind
declare i32 @inotify_init() local_unnamed_addr #3

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @_dmon_watch_recursive(ptr noundef, i32 noundef, i32 noundef, i1 noundef zeroext, ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #8

attributes #0 = { noreturn 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree nosync nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(read) }
attributes #12 = { nounwind willreturn memory(none) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"_Bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i8 0, i8 2}
!10 = !{}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !15, i64 776}
!13 = !{!"dmon__state", !7, i64 0, !7, i64 512, !14, i64 768, !15, i64 776, !16, i64 784, !7, i64 792, !6, i64 832}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!15, !15, i64 0}
!18 = !{!14, !14, i64 0}
!19 = !{!20, !15, i64 8}
!20 = !{!"dmon__watch_state", !21, i64 0, !15, i64 4, !15, i64 8, !14, i64 16, !14, i64 24, !7, i64 32, !14, i64 296, !14, i64 304}
!21 = !{!"", !15, i64 0}
!22 = !{!20, !14, i64 16}
!23 = !{!20, !14, i64 24}
!24 = !{!25, !15, i64 24}
!25 = !{!"stat", !16, i64 0, !16, i64 8, !16, i64 16, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !16, i64 40, !16, i64 48, !16, i64 56, !16, i64 64, !26, i64 72, !26, i64 88, !26, i64 104, !7, i64 120}
!26 = !{!"timespec", !16, i64 0, !16, i64 8}
!27 = !{!20, !15, i64 4}
!28 = !{!20, !14, i64 296}
!29 = !{i64 0, i64 260, !11}
!30 = !{!20, !14, i64 304}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PromotePass,SROAPass,SimplifyCFGPass,TailCallElimPass