; LLVM IR from google/latency-benchmark :: src (latency-benchmark)

; 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.measurement_t = type { i64, i8, i8, i8, i8, i32 }
%struct.statistic = type { i64, i32, i32, i32, i64, i64, i64, ptr }
%struct.screenshot = type { i32, i32, i32, ptr, i64, ptr }

@.str.2 = external hidden unnamed_addr constant [82 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [48 x i8], align 1
@__PRETTY_FUNCTION__.measure_latency = external hidden unnamed_addr constant [98 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [227 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [104 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [144 x i8], align 1

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

declare i64 @get_nanoseconds(...) #1

declare void @debug_log(ptr noundef, ...) #1

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

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @measure_latency(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) #3 {
  %8 = alloca i1, align 1
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i8, align 1
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca %struct.measurement_t, align 8
  %24 = alloca %struct.measurement_t, align 8
  %25 = alloca i32, align 4
  %26 = alloca i8, align 1
  %27 = alloca ptr, align 8
  %28 = alloca i32, align 4
  %29 = alloca i8, align 1
  %30 = alloca i64, align 8
  %31 = alloca %struct.statistic, align 8
  %32 = alloca %struct.statistic, align 8
  %33 = alloca %struct.statistic, align 8
  %34 = alloca %struct.statistic, align 8
  %35 = alloca i32, align 4
  %36 = alloca i32, align 4
  %37 = alloca i32, align 4
  %38 = alloca i64, align 8
  %39 = alloca i8, align 1
  %40 = alloca i64, align 8
  %41 = alloca i64, align 8
  %42 = alloca i8, align 1
  %43 = alloca i64, align 8
  %44 = alloca i64, align 8
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store ptr %3, ptr %12, align 8, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #9
  %45 = call ptr @take_screenshot(i32 noundef 0, i32 noundef 0, i32 noundef -1, i32 noundef -1)
  store ptr %45, ptr %16, align 8, !tbaa !5
  %46 = load ptr, ptr %16, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %50, label %48

48:                                               ; preds = %7
  %49 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr @.str.9, ptr %49, align 8, !tbaa !5
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %435

50:                                               ; preds = %7
  %51 = load ptr, ptr %16, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.screenshot, ptr %51, i32 0, i32 0
  %53 = load i32, ptr %52, align 8, !tbaa !9
  %54 = icmp ugt i32 %53, 0
  br i1 %54, label %55, label %61

55:                                               ; preds = %50
  %56 = load ptr, ptr %16, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.screenshot, ptr %56, i32 0, i32 1
  %58 = load i32, ptr %57, align 4, !tbaa !13
  %59 = icmp ugt i32 %58, 0
  br i1 %59, label %60, label %61

60:                                               ; preds = %55
  br label %62

61:                                               ; preds = %55, %50
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.2, i32 noundef 333, ptr noundef @__PRETTY_FUNCTION__.measure_latency) #10
  unreachable

62:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #9
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #9
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = load ptr, ptr %16, align 8, !tbaa !5
  %65 = call zeroext i1 @find_pattern(ptr noundef %63, ptr noundef %64, ptr noundef %18, ptr noundef %19)
  %66 = zext i1 %65 to i8
  store i8 %66, ptr %20, align 1, !tbaa !14
  %67 = load ptr, ptr %16, align 8, !tbaa !5
  call void @free_screenshot(ptr noundef %67)
  %68 = load i8, ptr %20, align 1, !tbaa !14, !range !16, !noundef !17
  %69 = trunc i8 %68 to i1
  br i1 %69, label %72, label %70

70:                                               ; preds = %62
  %71 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr @.str.11, ptr %71, align 8, !tbaa !5
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %434

72:                                               ; preds = %62
  %73 = call ptr @llvm.stacksave.p0()
  store ptr %73, ptr %21, align 8
  %74 = alloca i8, i64 32, align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #9
  store i32 0, ptr %22, align 4, !tbaa !18
  br label %75

75:                                               ; preds = %88, %72
  %76 = load i32, ptr %22, align 4, !tbaa !18
  %77 = icmp slt i32 %76, 16
  br i1 %77, label %79, label %78

78:                                               ; preds = %75
  store i32 2, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #9
  br label %91

79:                                               ; preds = %75
  %80 = load ptr, ptr %9, align 8, !tbaa !5
  %81 = load i32, ptr %22, align 4, !tbaa !18
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds i8, ptr %80, i64 %82
  %84 = load i8, ptr %83, align 1, !tbaa !19
  %85 = load i32, ptr %22, align 4, !tbaa !18
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds i8, ptr %74, i64 %86
  store i8 %84, ptr %87, align 1, !tbaa !19
  br label %88

88:                                               ; preds = %79
  %89 = load i32, ptr %22, align 4, !tbaa !18
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %22, align 4, !tbaa !18
  br label %75, !llvm.loop !20

91:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #9
  call void @llvm.lifetime.start.p0(i64 16, ptr %24) #9
  call void @llvm.memset.p0.i64(ptr align 8 %23, i8 0, i64 16, i1 false)
  call void @llvm.memset.p0.i64(ptr align 8 %24, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #9
  store i32 0, ptr %25, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 1, ptr %26) #9
  %92 = load i64, ptr %18, align 8, !tbaa !22
  %93 = trunc i64 %92 to i32
  %94 = load i64, ptr %19, align 8, !tbaa !22
  %95 = trunc i64 %94 to i32
  %96 = load ptr, ptr %9, align 8, !tbaa !5
  %97 = call zeroext i1 @read_data_from_screen(i32 noundef %93, i32 noundef %95, ptr noundef %96, ptr noundef %23)
  %98 = zext i1 %97 to i8
  store i8 %98, ptr %26, align 1, !tbaa !14
  %99 = load i8, ptr %26, align 1, !tbaa !14, !range !16, !noundef !17
  %100 = trunc i8 %99 to i1
  br i1 %100, label %103, label %101

101:                                              ; preds = %91
  %102 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr @.str.12, ptr %102, align 8, !tbaa !5
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %432

103:                                              ; preds = %91
  %104 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 5
  %105 = load i32, ptr %104, align 4, !tbaa !23
  %106 = icmp eq i32 %105, 5
  br i1 %106, label %107, label %145

107:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #9
  %108 = call noalias ptr @malloc(i64 noundef 32) #11
  store ptr %108, ptr %27, align 8, !tbaa !5
  %109 = load ptr, ptr %27, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 1 %109, i8 0, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #9
  store i32 0, ptr %28, align 4, !tbaa !18
  br label %110

110:                                              ; preds = %121, %107
  %111 = load i32, ptr %28, align 4, !tbaa !18
  %112 = icmp slt i32 %111, 16
  br i1 %112, label %114, label %113

113:                                              ; preds = %110
  store i32 5, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #9
  br label %124

114:                                              ; preds = %110
  %115 = call i32 @rand() #9
  %116 = trunc i32 %115 to i8
  %117 = load ptr, ptr %27, align 8, !tbaa !5
  %118 = load i32, ptr %28, align 4, !tbaa !18
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds i8, ptr %117, i64 %119
  store i8 %116, ptr %120, align 1, !tbaa !19
  br label %121

121:                                              ; preds = %114
  %122 = load i32, ptr %28, align 4, !tbaa !18
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %28, align 4, !tbaa !18
  br label %110, !llvm.loop !25

124:                                              ; preds = %113
  %125 = load ptr, ptr %27, align 8, !tbaa !5
  %126 = call zeroext i1 @open_native_reference_window(ptr noundef %125)
  br i1 %126, label %129, label %127

127:                                              ; preds = %124
  %128 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr @.str.13, ptr %128, align 8, !tbaa !5
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %144

129:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 1, ptr %29) #9
  %130 = load ptr, ptr %27, align 8, !tbaa !5
  %131 = load ptr, ptr %10, align 8, !tbaa !5
  %132 = load ptr, ptr %11, align 8, !tbaa !5
  %133 = load ptr, ptr %12, align 8, !tbaa !5
  %134 = load ptr, ptr %13, align 8, !tbaa !5
  %135 = load ptr, ptr %14, align 8, !tbaa !5
  %136 = load ptr, ptr %15, align 8, !tbaa !5
  %137 = call zeroext i1 @measure_latency(ptr noundef %130, ptr noundef %131, ptr noundef %132, ptr noundef %133, ptr noundef %134, ptr noundef %135, ptr noundef %136)
  %138 = zext i1 %137 to i8
  store i8 %138, ptr %29, align 1, !tbaa !14
  %139 = call zeroext i1 (...) @close_native_reference_window()
  br i1 %139, label %141, label %140

140:                                              ; preds = %129
  call void (ptr, ...) @debug_log(ptr noundef @.str.14)
  br label %141

141:                                              ; preds = %140, %129
  %142 = load i8, ptr %29, align 1, !tbaa !14, !range !16, !noundef !17
  %143 = trunc i8 %142 to i1
  store i1 %143, ptr %8, align 1
  store i32 1, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %29) #9
  br label %144

144:                                              ; preds = %141, %127
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #9
  br label %432

145:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #9
  %146 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 0
  %147 = load i64, ptr %146, align 8, !tbaa !26
  store i64 %147, ptr %30, align 8, !tbaa !22
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %24, ptr align 8 %23, i64 16, i1 false), !tbaa.struct !27
  call void @llvm.lifetime.start.p0(i64 56, ptr %31) #9
  call void @llvm.lifetime.start.p0(i64 56, ptr %32) #9
  call void @llvm.lifetime.start.p0(i64 56, ptr %33) #9
  call void @llvm.lifetime.start.p0(i64 56, ptr %34) #9
  %148 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 1
  %149 = load i8, ptr %148, align 8, !tbaa !28
  %150 = zext i8 %149 to i32
  %151 = load i64, ptr %30, align 8, !tbaa !22
  call void @init_statistic(ptr noundef @.str.15, ptr noundef %31, i32 noundef %150, i64 noundef %151)
  %152 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 2
  %153 = load i8, ptr %152, align 1, !tbaa !29
  %154 = zext i8 %153 to i32
  %155 = load i64, ptr %30, align 8, !tbaa !22
  call void @init_statistic(ptr noundef @.str.16, ptr noundef %33, i32 noundef %154, i64 noundef %155)
  %156 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 3
  %157 = load i8, ptr %156, align 2, !tbaa !30
  %158 = zext i8 %157 to i32
  %159 = load i64, ptr %30, align 8, !tbaa !22
  call void @init_statistic(ptr noundef @.str.17, ptr noundef %32, i32 noundef %158, i64 noundef %159)
  %160 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 4
  %161 = load i8, ptr %160, align 1, !tbaa !31
  %162 = zext i8 %161 to i32
  %163 = load i64, ptr %30, align 8, !tbaa !22
  call void @init_statistic(ptr noundef @.str.18, ptr noundef %34, i32 noundef %162, i64 noundef %163)
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #9
  store i32 0, ptr %35, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #9
  %164 = load i64, ptr %18, align 8, !tbaa !22
  %165 = add i64 %164, 40
  %166 = trunc i64 %165 to i32
  store i32 %166, ptr %36, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %37) #9
  %167 = load i64, ptr %19, align 8, !tbaa !22
  %168 = add i64 %167, 40
  %169 = trunc i64 %168 to i32
  store i32 %169, ptr %37, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %38) #9
  %170 = load i64, ptr %30, align 8, !tbaa !22
  store i64 %170, ptr %38, align 8, !tbaa !22
  %171 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 5
  %172 = load i32, ptr %171, align 4, !tbaa !23
  %173 = icmp eq i32 %172, 2
  br i1 %173, label %174, label %180

174:                                              ; preds = %145
  %175 = load i32, ptr %36, align 4, !tbaa !18
  %176 = load i32, ptr %37, align 4, !tbaa !18
  %177 = call zeroext i1 @send_scroll_down(i32 noundef %175, i32 noundef %176)
  %178 = call i64 (...) @get_nanoseconds()
  %179 = getelementptr inbounds %struct.statistic, ptr %34, i32 0, i32 0
  store i64 %178, ptr %179, align 8, !tbaa !32
  br label %180

180:                                              ; preds = %174, %145
  br label %181

181:                                              ; preds = %394, %180
  br label %182

182:                                              ; preds = %181
  call void @llvm.lifetime.start.p0(i64 1, ptr %39) #9
  %183 = load i64, ptr %18, align 8, !tbaa !22
  %184 = trunc i64 %183 to i32
  %185 = load i64, ptr %19, align 8, !tbaa !22
  %186 = trunc i64 %185 to i32
  %187 = load ptr, ptr %9, align 8, !tbaa !5
  %188 = call zeroext i1 @read_data_from_screen(i32 noundef %184, i32 noundef %186, ptr noundef %187, ptr noundef %23)
  %189 = zext i1 %188 to i8
  store i8 %189, ptr %39, align 1, !tbaa !14
  %190 = load i8, ptr %39, align 1, !tbaa !14, !range !16, !noundef !17
  %191 = trunc i8 %190 to i1
  br i1 %191, label %194, label %192

192:                                              ; preds = %182
  %193 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr @.str.19, ptr %193, align 8, !tbaa !5
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %392

194:                                              ; preds = %182
  %195 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 5
  %196 = load i32, ptr %195, align 4, !tbaa !23
  %197 = icmp eq i32 %196, 6
  br i1 %197, label %198, label %200

198:                                              ; preds = %194
  %199 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr @.str.20, ptr %199, align 8, !tbaa !5
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %392

200:                                              ; preds = %194
  %201 = load i32, ptr %25, align 4, !tbaa !18
  %202 = add nsw i32 %201, 1
  store i32 %202, ptr %25, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %40) #9
  %203 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 0
  %204 = load i64, ptr %203, align 8, !tbaa !26
  store i64 %204, ptr %40, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 8, ptr %41) #9
  %205 = getelementptr inbounds %struct.measurement_t, ptr %24, i32 0, i32 0
  %206 = load i64, ptr %205, align 8, !tbaa !26
  store i64 %206, ptr %41, align 8, !tbaa !22
  %207 = load i64, ptr %40, align 8, !tbaa !22
  %208 = load i64, ptr %41, align 8, !tbaa !22
  %209 = sub nsw i64 %207, %208
  %210 = sitofp i64 %209 to double
  %211 = fdiv double %210, 1.000000e+06
  call void (ptr, ...) @debug_log(ptr noundef @.str.21, double noundef %211)
  %212 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 1
  %213 = load i8, ptr %212, align 8, !tbaa !28
  %214 = zext i8 %213 to i32
  %215 = load i64, ptr %40, align 8, !tbaa !22
  %216 = load i64, ptr %41, align 8, !tbaa !22
  %217 = call zeroext i1 @update_statistic(ptr noundef %31, i32 noundef %214, i64 noundef %215, i64 noundef %216)
  %218 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 2
  %219 = load i8, ptr %218, align 1, !tbaa !29
  %220 = zext i8 %219 to i32
  %221 = load i64, ptr %40, align 8, !tbaa !22
  %222 = load i64, ptr %41, align 8, !tbaa !22
  %223 = call zeroext i1 @update_statistic(ptr noundef %33, i32 noundef %220, i64 noundef %221, i64 noundef %222)
  %224 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 3
  %225 = load i8, ptr %224, align 2, !tbaa !30
  %226 = zext i8 %225 to i32
  %227 = load i64, ptr %40, align 8, !tbaa !22
  %228 = load i64, ptr %41, align 8, !tbaa !22
  %229 = call zeroext i1 @update_statistic(ptr noundef %32, i32 noundef %226, i64 noundef %227, i64 noundef %228)
  call void @llvm.lifetime.start.p0(i64 1, ptr %42) #9
  %230 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 4
  %231 = load i8, ptr %230, align 1, !tbaa !31
  %232 = zext i8 %231 to i32
  %233 = load i64, ptr %40, align 8, !tbaa !22
  %234 = load i64, ptr %41, align 8, !tbaa !22
  %235 = call zeroext i1 @update_statistic(ptr noundef %34, i32 noundef %232, i64 noundef %233, i64 noundef %234)
  %236 = zext i1 %235 to i8
  store i8 %236, ptr %42, align 1, !tbaa !14
  %237 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 5
  %238 = load i32, ptr %237, align 4, !tbaa !23
  %239 = icmp eq i32 %238, 1
  br i1 %239, label %240, label %279

240:                                              ; preds = %200
  %241 = getelementptr inbounds %struct.statistic, ptr %33, i32 0, i32 3
  %242 = load i32, ptr %241, align 8, !tbaa !34
  %243 = icmp sge i32 %242, 50
  br i1 %243, label %244, label %245

244:                                              ; preds = %240
  store i32 9, ptr %17, align 4
  br label %391

245:                                              ; preds = %240
  %246 = getelementptr inbounds %struct.statistic, ptr %33, i32 0, i32 2
  %247 = load i32, ptr %246, align 4, !tbaa !35
  %248 = load i32, ptr %35, align 4, !tbaa !18
  %249 = icmp sgt i32 %247, %248
  br i1 %249, label %250, label %252

250:                                              ; preds = %245
  %251 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr @.str.22, ptr %251, align 8, !tbaa !5
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %391

252:                                              ; preds = %245
  %253 = load i64, ptr %40, align 8, !tbaa !22
  %254 = getelementptr inbounds %struct.statistic, ptr %33, i32 0, i32 0
  %255 = load i64, ptr %254, align 8, !tbaa !32
  %256 = sub nsw i64 %253, %255
  %257 = icmp sgt i64 %256, 4000000000
  br i1 %257, label %258, label %260

258:                                              ; preds = %252
  %259 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr @.str.23, ptr %259, align 8, !tbaa !5
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %391

260:                                              ; preds = %252
  %261 = getelementptr inbounds %struct.statistic, ptr %33, i32 0, i32 2
  %262 = load i32, ptr %261, align 4, !tbaa !35
  %263 = load i32, ptr %35, align 4, !tbaa !18
  %264 = icmp eq i32 %262, %263
  br i1 %264, label %265, label %278

265:                                              ; preds = %260
  %266 = call i32 @rand() #9
  %267 = srem i32 %266, 17
  %268 = mul nsw i32 %267, 1000
  %269 = call i32 @usleep(i32 noundef %268)
  %270 = call zeroext i1 (...) @send_keystroke_z()
  br i1 %270, label %273, label %271

271:                                              ; preds = %265
  %272 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr @.str.24, ptr %272, align 8, !tbaa !5
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %391

273:                                              ; preds = %265
  %274 = call i64 (...) @get_nanoseconds()
  %275 = getelementptr inbounds %struct.statistic, ptr %33, i32 0, i32 0
  store i64 %274, ptr %275, align 8, !tbaa !32
  %276 = load i32, ptr %35, align 4, !tbaa !18
  %277 = add nsw i32 %276, 1
  store i32 %277, ptr %35, align 4, !tbaa !18
  br label %278

278:                                              ; preds = %273, %260
  br label %382

279:                                              ; preds = %200
  %280 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 5
  %281 = load i32, ptr %280, align 4, !tbaa !23
  %282 = icmp eq i32 %281, 2
  br i1 %282, label %283, label %358

283:                                              ; preds = %279
  %284 = getelementptr inbounds %struct.statistic, ptr %34, i32 0, i32 3
  %285 = load i32, ptr %284, align 8, !tbaa !34
  %286 = icmp sge i32 %285, 50
  br i1 %286, label %287, label %288

287:                                              ; preds = %283
  store i32 9, ptr %17, align 4
  br label %391

288:                                              ; preds = %283
  %289 = load i64, ptr %40, align 8, !tbaa !22
  %290 = getelementptr inbounds %struct.statistic, ptr %34, i32 0, i32 0
  %291 = load i64, ptr %290, align 8, !tbaa !32
  %292 = sub nsw i64 %289, %291
  %293 = icmp sgt i64 %292, 4000000000
  br i1 %293, label %294, label %296

294:                                              ; preds = %288
  %295 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr @.str.25, ptr %295, align 8, !tbaa !5
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %391

296:                                              ; preds = %288
  %297 = load i8, ptr %42, align 1, !tbaa !14, !range !16, !noundef !17
  %298 = trunc i8 %297 to i1
  br i1 %298, label %299, label %357

299:                                              ; preds = %296
  %300 = getelementptr inbounds %struct.statistic, ptr %34, i32 0, i32 3
  %301 = load i32, ptr %300, align 8, !tbaa !34
  call void (ptr, ...) @debug_log(ptr noundef @.str.26, i32 noundef %301)
  call void @llvm.lifetime.start.p0(i64 8, ptr %43) #9
  %302 = load i64, ptr %40, align 8, !tbaa !22
  store i64 %302, ptr %43, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 8, ptr %44) #9
  %303 = load i64, ptr %40, align 8, !tbaa !22
  store i64 %303, ptr %44, align 8, !tbaa !22
  br label %304

304:                                              ; preds = %343, %299
  %305 = load i64, ptr %40, align 8, !tbaa !22
  %306 = load i64, ptr %43, align 8, !tbaa !22
  %307 = sub nsw i64 %305, %306
  %308 = icmp slt i64 %307, 100000000
  br i1 %308, label %309, label %344

309:                                              ; preds = %304
  %310 = load i64, ptr %18, align 8, !tbaa !22
  %311 = trunc i64 %310 to i32
  %312 = load i64, ptr %19, align 8, !tbaa !22
  %313 = trunc i64 %312 to i32
  %314 = load ptr, ptr %9, align 8, !tbaa !5
  %315 = call zeroext i1 @read_data_from_screen(i32 noundef %311, i32 noundef %313, ptr noundef %314, ptr noundef %23)
  %316 = zext i1 %315 to i8
  store i8 %316, ptr %39, align 1, !tbaa !14
  %317 = load i8, ptr %39, align 1, !tbaa !14, !range !16, !noundef !17
  %318 = trunc i8 %317 to i1
  br i1 %318, label %321, label %319

319:                                              ; preds = %309
  %320 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr @.str.19, ptr %320, align 8, !tbaa !5
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %354

321:                                              ; preds = %309
  %322 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 0
  %323 = load i64, ptr %322, align 8, !tbaa !26
  store i64 %323, ptr %40, align 8, !tbaa !22
  %324 = load i64, ptr %40, align 8, !tbaa !22
  %325 = load i64, ptr %44, align 8, !tbaa !22
  %326 = sub nsw i64 %324, %325
  %327 = icmp sgt i64 %326, 1000000000
  br i1 %327, label %328, label %330

328:                                              ; preds = %321
  %329 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr @.str.27, ptr %329, align 8, !tbaa !5
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %354

330:                                              ; preds = %321
  %331 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 4
  %332 = load i8, ptr %331, align 1, !tbaa !31
  %333 = zext i8 %332 to i32
  %334 = getelementptr inbounds %struct.statistic, ptr %34, i32 0, i32 1
  %335 = load i32, ptr %334, align 8, !tbaa !36
  %336 = icmp ne i32 %333, %335
  br i1 %336, label %337, label %343

337:                                              ; preds = %330
  %338 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 4
  %339 = load i8, ptr %338, align 1, !tbaa !31
  %340 = zext i8 %339 to i32
  %341 = getelementptr inbounds %struct.statistic, ptr %34, i32 0, i32 1
  store i32 %340, ptr %341, align 8, !tbaa !36
  %342 = load i64, ptr %40, align 8, !tbaa !22
  store i64 %342, ptr %43, align 8, !tbaa !22
  br label %343

343:                                              ; preds = %337, %330
  br label %304, !llvm.loop !37

344:                                              ; preds = %304
  %345 = call i32 @rand() #9
  %346 = srem i32 %345, 17
  %347 = mul nsw i32 %346, 1000
  %348 = call i32 @usleep(i32 noundef %347)
  %349 = load i32, ptr %36, align 4, !tbaa !18
  %350 = load i32, ptr %37, align 4, !tbaa !18
  %351 = call zeroext i1 @send_scroll_down(i32 noundef %349, i32 noundef %350)
  %352 = call i64 (...) @get_nanoseconds()
  %353 = getelementptr inbounds %struct.statistic, ptr %34, i32 0, i32 0
  store i64 %352, ptr %353, align 8, !tbaa !32
  store i32 0, ptr %17, align 4
  br label %354

354:                                              ; preds = %344, %328, %319
  call void @llvm.lifetime.end.p0(i64 8, ptr %44) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %43) #9
  %355 = load i32, ptr %17, align 4
  switch i32 %355, label %391 [
    i32 0, label %356
  ]

356:                                              ; preds = %354
  br label %357

357:                                              ; preds = %356, %296
  br label %381

358:                                              ; preds = %279
  %359 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 5
  %360 = load i32, ptr %359, align 4, !tbaa !23
  %361 = icmp eq i32 %360, 3
  br i1 %361, label %362, label %373

362:                                              ; preds = %358
  %363 = load i64, ptr %40, align 8, !tbaa !22
  %364 = load i64, ptr %38, align 8, !tbaa !22
  %365 = sub nsw i64 %363, %364
  %366 = icmp sgt i64 %365, 17000000
  br i1 %366, label %367, label %372

367:                                              ; preds = %362
  %368 = load i32, ptr %36, align 4, !tbaa !18
  %369 = load i32, ptr %37, align 4, !tbaa !18
  %370 = call zeroext i1 @send_scroll_down(i32 noundef %368, i32 noundef %369)
  %371 = call i64 (...) @get_nanoseconds()
  store i64 %371, ptr %38, align 8, !tbaa !22
  br label %372

372:                                              ; preds = %367, %362
  br label %380

373:                                              ; preds = %358
  %374 = getelementptr inbounds %struct.measurement_t, ptr %23, i32 0, i32 5
  %375 = load i32, ptr %374, align 4, !tbaa !23
  %376 = icmp eq i32 %375, 4
  br i1 %376, label %377, label %378

377:                                              ; preds = %373
  store i32 9, ptr %17, align 4
  br label %391

378:                                              ; preds = %373
  %379 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr @.str.28, ptr %379, align 8, !tbaa !5
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %391

380:                                              ; preds = %372
  br label %381

381:                                              ; preds = %380, %357
  br label %382

382:                                              ; preds = %381, %278
  %383 = load i64, ptr %40, align 8, !tbaa !22
  %384 = load i64, ptr %30, align 8, !tbaa !22
  %385 = sub nsw i64 %383, %384
  %386 = icmp sgt i64 %385, 80000000000
  br i1 %386, label %387, label %389

387:                                              ; preds = %382
  %388 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr @.str.29, ptr %388, align 8, !tbaa !5
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %391

389:                                              ; preds = %382
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %24, ptr align 8 %23, i64 16, i1 false), !tbaa.struct !27
  %390 = call i32 @usleep(i32 noundef 0)
  store i32 0, ptr %17, align 4
  br label %391

391:                                              ; preds = %389, %387, %378, %377, %354, %294, %287, %271, %258, %250, %244
  call void @llvm.lifetime.end.p0(i64 1, ptr %42) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %41) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %40) #9
  br label %392

392:                                              ; preds = %391, %198, %192
  call void @llvm.lifetime.end.p0(i64 1, ptr %39) #9
  %393 = load i32, ptr %17, align 4
  switch i32 %393, label %431 [
    i32 0, label %394
    i32 9, label %395
  ]

394:                                              ; preds = %392
  br label %181

395:                                              ; preds = %392
  %396 = call double @upper_bound_ms(ptr noundef %33)
  %397 = call double @lower_bound_ms(ptr noundef %33)
  %398 = fadd double %396, %397
  %399 = fdiv double %398, 2.000000e+00
  %400 = load ptr, ptr %10, align 8, !tbaa !5
  store double %399, ptr %400, align 8, !tbaa !38
  %401 = call double @upper_bound_ms(ptr noundef %34)
  %402 = call double @lower_bound_ms(ptr noundef %34)
  %403 = fdiv double %402, 2.000000e+00
  %404 = fadd double %401, %403
  %405 = load ptr, ptr %11, align 8, !tbaa !5
  store double %404, ptr %405, align 8, !tbaa !38
  %406 = getelementptr inbounds %struct.statistic, ptr %31, i32 0, i32 6
  %407 = load i64, ptr %406, align 8, !tbaa !40
  %408 = sitofp i64 %407 to double
  %409 = fdiv double %408, 1.000000e+06
  %410 = load ptr, ptr %12, align 8, !tbaa !5
  store double %409, ptr %410, align 8, !tbaa !38
  %411 = getelementptr inbounds %struct.statistic, ptr %32, i32 0, i32 6
  %412 = load i64, ptr %411, align 8, !tbaa !40
  %413 = sitofp i64 %412 to double
  %414 = fdiv double %413, 1.000000e+06
  %415 = load ptr, ptr %13, align 8, !tbaa !5
  store double %414, ptr %415, align 8, !tbaa !38
  %416 = getelementptr inbounds %struct.statistic, ptr %34, i32 0, i32 6
  %417 = load i64, ptr %416, align 8, !tbaa !40
  %418 = sitofp i64 %417 to double
  %419 = fdiv double %418, 1.000000e+06
  %420 = load ptr, ptr %14, align 8, !tbaa !5
  store double %419, ptr %420, align 8, !tbaa !38
  %421 = load ptr, ptr %10, align 8, !tbaa !5
  %422 = load double, ptr %421, align 8, !tbaa !38
  %423 = load ptr, ptr %11, align 8, !tbaa !5
  %424 = load double, ptr %423, align 8, !tbaa !38
  %425 = load ptr, ptr %12, align 8, !tbaa !5
  %426 = load double, ptr %425, align 8, !tbaa !38
  %427 = load ptr, ptr %13, align 8, !tbaa !5
  %428 = load double, ptr %427, align 8, !tbaa !38
  %429 = load ptr, ptr %14, align 8, !tbaa !5
  %430 = load double, ptr %429, align 8, !tbaa !38
  call void (ptr, ...) @debug_log(ptr noundef @.str.30, double noundef %422, double noundef %424, double noundef %426, double noundef %428, double noundef %430)
  store i1 true, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %431

431:                                              ; preds = %395, %392
  call void @llvm.lifetime.end.p0(i64 8, ptr %38) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #9
  call void @llvm.lifetime.end.p0(i64 56, ptr %34) #9
  call void @llvm.lifetime.end.p0(i64 56, ptr %33) #9
  call void @llvm.lifetime.end.p0(i64 56, ptr %32) #9
  call void @llvm.lifetime.end.p0(i64 56, ptr %31) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #9
  br label %432

432:                                              ; preds = %431, %144, %101
  call void @llvm.lifetime.end.p0(i64 1, ptr %26) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %24) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #9
  %433 = load ptr, ptr %21, align 8
  call void @llvm.stackrestore.p0(ptr %433)
  br label %434

434:                                              ; preds = %432, %70
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  br label %435

435:                                              ; preds = %434, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  %436 = load i1, ptr %8, align 1
  ret i1 %436
}

declare ptr @take_screenshot(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

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

declare void @free_screenshot(ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

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

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

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

; Function Attrs: nounwind
declare i32 @rand() #7

declare zeroext i1 @open_native_reference_window(ptr noundef) #1

declare zeroext i1 @close_native_reference_window(...) #1

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

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

declare zeroext i1 @send_scroll_down(i32 noundef, i32 noundef) #1

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

declare i32 @usleep(i32 noundef) #1

declare zeroext i1 @send_keystroke_z(...) #1

; Function Attrs: nounwind uwtable
declare hidden double @upper_bound_ms(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden double @lower_bound_ms(ptr noundef) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

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

!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, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16, !12, i64 24, !6, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!10, !11, i64 4}
!14 = !{!15, !15, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!11, !11, i64 0}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!12, !12, i64 0}
!23 = !{!24, !11, i64 12}
!24 = !{!"", !12, i64 0, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !11, i64 12}
!25 = distinct !{!25, !21}
!26 = !{!24, !12, i64 0}
!27 = !{i64 0, i64 8, !22, i64 8, i64 1, !19, i64 9, i64 1, !19, i64 10, i64 1, !19, i64 11, i64 1, !19, i64 12, i64 4, !18}
!28 = !{!24, !7, i64 8}
!29 = !{!24, !7, i64 9}
!30 = !{!24, !7, i64 10}
!31 = !{!24, !7, i64 11}
!32 = !{!33, !12, i64 0}
!33 = !{!"", !12, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !6, i64 48}
!34 = !{!33, !11, i64 16}
!35 = !{!33, !11, i64 12}
!36 = !{!33, !11, i64 8}
!37 = distinct !{!37, !21}
!38 = !{!39, !39, i64 0}
!39 = !{!"double", !7, i64 0}
!40 = !{!33, !12, i64 40}


; 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.measurement_t = type { i64, i8, i8, i8, i8, i32 }
%struct.statistic = type { i64, i32, i32, i32, i64, i64, i64, ptr }

@.str.2 = external hidden unnamed_addr constant [82 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [48 x i8], align 1
@__PRETTY_FUNCTION__.measure_latency = external hidden unnamed_addr constant [98 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [227 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [104 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [144 x i8], align 1

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

declare i64 @get_nanoseconds(...) local_unnamed_addr #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @measure_latency(ptr noundef %0, ptr nocapture noundef %1, ptr nocapture noundef %2, ptr nocapture noundef %3, ptr nocapture noundef %4, ptr nocapture noundef writeonly %5, ptr nocapture noundef writeonly %6) local_unnamed_addr #3 {
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca %struct.measurement_t, align 8
  %11 = alloca %struct.statistic, align 8
  %12 = alloca %struct.statistic, align 8
  %13 = alloca %struct.statistic, align 8
  %14 = alloca %struct.statistic, align 8
  %15 = tail call ptr @take_screenshot(i32 noundef 0, i32 noundef 0, i32 noundef -1, i32 noundef -1) #8
  %.not = icmp eq ptr %15, null
  br i1 %.not, label %16, label %17

16:                                               ; preds = %7
  store ptr @.str.9, ptr %6, align 8, !tbaa !5
  br label %250

17:                                               ; preds = %7
  %18 = load i32, ptr %15, align 8, !tbaa !9
  %.not125 = icmp eq i32 %18, 0
  br i1 %.not125, label %22, label %19

19:                                               ; preds = %17
  %20 = getelementptr inbounds i8, ptr %15, i64 4
  %21 = load i32, ptr %20, align 4, !tbaa !13
  %.not126 = icmp eq i32 %21, 0
  br i1 %.not126, label %22, label %23

22:                                               ; preds = %19, %17
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.2, i32 noundef 333, ptr noundef nonnull @__PRETTY_FUNCTION__.measure_latency) #9
  unreachable

23:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %24 = call zeroext i1 @find_pattern(ptr noundef %0, ptr noundef nonnull %15, ptr noundef nonnull %8, ptr noundef nonnull %9)
  call void @free_screenshot(ptr noundef nonnull %15) #8
  br i1 %24, label %26, label %25

25:                                               ; preds = %23
  store ptr @.str.11, ptr %6, align 8, !tbaa !5
  br label %249

26:                                               ; preds = %23
  %27 = call ptr @llvm.stacksave.p0()
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %10, i8 0, i64 16, i1 false)
  %28 = load i64, ptr %8, align 8, !tbaa !14
  %29 = trunc i64 %28 to i32
  %30 = load i64, ptr %9, align 8, !tbaa !14
  %31 = trunc i64 %30 to i32
  %32 = call zeroext i1 @read_data_from_screen(i32 noundef %29, i32 noundef %31, ptr noundef %0, ptr noundef nonnull %10)
  br i1 %32, label %34, label %33

33:                                               ; preds = %26
  store ptr @.str.12, ptr %6, align 8, !tbaa !5
  br label %248

34:                                               ; preds = %26
  %35 = getelementptr inbounds i8, ptr %10, i64 12
  %36 = load i32, ptr %35, align 4, !tbaa !15
  %37 = icmp eq i32 %36, 5
  br i1 %37, label %38, label %92

38:                                               ; preds = %34
  %calloc = call dereferenceable_or_null(32) ptr @calloc(i64 1, i64 32)
  %39 = call i32 @rand() #8
  %40 = trunc i32 %39 to i8
  store i8 %40, ptr %calloc, align 1, !tbaa !17
  %41 = call i32 @rand() #8
  %42 = trunc i32 %41 to i8
  %43 = getelementptr inbounds i8, ptr %calloc, i64 1
  store i8 %42, ptr %43, align 1, !tbaa !17
  %44 = call i32 @rand() #8
  %45 = trunc i32 %44 to i8
  %46 = getelementptr inbounds i8, ptr %calloc, i64 2
  store i8 %45, ptr %46, align 1, !tbaa !17
  %47 = call i32 @rand() #8
  %48 = trunc i32 %47 to i8
  %49 = getelementptr inbounds i8, ptr %calloc, i64 3
  store i8 %48, ptr %49, align 1, !tbaa !17
  %50 = call i32 @rand() #8
  %51 = trunc i32 %50 to i8
  %52 = getelementptr inbounds i8, ptr %calloc, i64 4
  store i8 %51, ptr %52, align 1, !tbaa !17
  %53 = call i32 @rand() #8
  %54 = trunc i32 %53 to i8
  %55 = getelementptr inbounds i8, ptr %calloc, i64 5
  store i8 %54, ptr %55, align 1, !tbaa !17
  %56 = call i32 @rand() #8
  %57 = trunc i32 %56 to i8
  %58 = getelementptr inbounds i8, ptr %calloc, i64 6
  store i8 %57, ptr %58, align 1, !tbaa !17
  %59 = call i32 @rand() #8
  %60 = trunc i32 %59 to i8
  %61 = getelementptr inbounds i8, ptr %calloc, i64 7
  store i8 %60, ptr %61, align 1, !tbaa !17
  %62 = call i32 @rand() #8
  %63 = trunc i32 %62 to i8
  %64 = getelementptr inbounds i8, ptr %calloc, i64 8
  store i8 %63, ptr %64, align 1, !tbaa !17
  %65 = call i32 @rand() #8
  %66 = trunc i32 %65 to i8
  %67 = getelementptr inbounds i8, ptr %calloc, i64 9
  store i8 %66, ptr %67, align 1, !tbaa !17
  %68 = call i32 @rand() #8
  %69 = trunc i32 %68 to i8
  %70 = getelementptr inbounds i8, ptr %calloc, i64 10
  store i8 %69, ptr %70, align 1, !tbaa !17
  %71 = call i32 @rand() #8
  %72 = trunc i32 %71 to i8
  %73 = getelementptr inbounds i8, ptr %calloc, i64 11
  store i8 %72, ptr %73, align 1, !tbaa !17
  %74 = call i32 @rand() #8
  %75 = trunc i32 %74 to i8
  %76 = getelementptr inbounds i8, ptr %calloc, i64 12
  store i8 %75, ptr %76, align 1, !tbaa !17
  %77 = call i32 @rand() #8
  %78 = trunc i32 %77 to i8
  %79 = getelementptr inbounds i8, ptr %calloc, i64 13
  store i8 %78, ptr %79, align 1, !tbaa !17
  %80 = call i32 @rand() #8
  %81 = trunc i32 %80 to i8
  %82 = getelementptr inbounds i8, ptr %calloc, i64 14
  store i8 %81, ptr %82, align 1, !tbaa !17
  %83 = call i32 @rand() #8
  %84 = trunc i32 %83 to i8
  %85 = getelementptr inbounds i8, ptr %calloc, i64 15
  store i8 %84, ptr %85, align 1, !tbaa !17
  %86 = call zeroext i1 @open_native_reference_window(ptr noundef nonnull %calloc) #8
  br i1 %86, label %88, label %87

87:                                               ; preds = %38
  store ptr @.str.13, ptr %6, align 8, !tbaa !5
  br label %248

88:                                               ; preds = %38
  %89 = call zeroext i1 @measure_latency(ptr noundef nonnull %calloc, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6)
  %90 = call zeroext i1 (...) @close_native_reference_window() #8
  br i1 %90, label %248, label %91

91:                                               ; preds = %88
  call void (ptr, ...) @debug_log(ptr noundef nonnull @.str.14) #8
  br label %248

92:                                               ; preds = %34
  %93 = load i64, ptr %10, align 8, !tbaa !14
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %10, i64 8
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %11) #8
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %12) #8
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %13) #8
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %14) #8
  %94 = load i8, ptr %.sroa.6.0..sroa_idx, align 8, !tbaa !18
  %95 = zext i8 %94 to i32
  call void @init_statistic(ptr noundef nonnull @.str.15, ptr noundef nonnull %11, i32 noundef %95, i64 noundef %93)
  %96 = getelementptr inbounds i8, ptr %10, i64 9
  %97 = load i8, ptr %96, align 1, !tbaa !19
  %98 = zext i8 %97 to i32
  call void @init_statistic(ptr noundef nonnull @.str.16, ptr noundef nonnull %13, i32 noundef %98, i64 noundef %93)
  %99 = getelementptr inbounds i8, ptr %10, i64 10
  %100 = load i8, ptr %99, align 2, !tbaa !20
  %101 = zext i8 %100 to i32
  call void @init_statistic(ptr noundef nonnull @.str.17, ptr noundef nonnull %12, i32 noundef %101, i64 noundef %93)
  %102 = getelementptr inbounds i8, ptr %10, i64 11
  %103 = load i8, ptr %102, align 1, !tbaa !21
  %104 = zext i8 %103 to i32
  call void @init_statistic(ptr noundef nonnull @.str.18, ptr noundef nonnull %14, i32 noundef %104, i64 noundef %93)
  %105 = load i64, ptr %8, align 8, !tbaa !14
  %106 = trunc i64 %105 to i32
  %107 = add i32 %106, 40
  %108 = load i64, ptr %9, align 8, !tbaa !14
  %109 = trunc i64 %108 to i32
  %110 = add i32 %109, 40
  %111 = load i32, ptr %35, align 4, !tbaa !15
  %112 = icmp eq i32 %111, 2
  br i1 %112, label %113, label %116

113:                                              ; preds = %92
  %114 = call zeroext i1 @send_scroll_down(i32 noundef %107, i32 noundef %110) #8
  %115 = call i64 (...) @get_nanoseconds() #8
  store i64 %115, ptr %14, align 8, !tbaa !22
  %.pre = load i64, ptr %8, align 8, !tbaa !14
  %.pre152 = load i64, ptr %9, align 8, !tbaa !14
  %.pre153 = trunc i64 %.pre to i32
  %.pre154 = trunc i64 %.pre152 to i32
  br label %116

116:                                              ; preds = %113, %92
  %.pre-phi155 = phi i32 [ %.pre154, %113 ], [ %109, %92 ]
  %.pre-phi = phi i32 [ %.pre153, %113 ], [ %106, %92 ]
  %117 = call zeroext i1 @read_data_from_screen(i32 noundef %.pre-phi, i32 noundef %.pre-phi155, ptr noundef %0, ptr noundef nonnull %10)
  br i1 %117, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %116
  %118 = getelementptr inbounds i8, ptr %14, i64 16
  %119 = getelementptr inbounds i8, ptr %14, i64 8
  %120 = getelementptr inbounds i8, ptr %13, i64 16
  %121 = getelementptr inbounds i8, ptr %13, i64 12
  br label %122

._crit_edge:                                      ; preds = %216, %116
  store ptr @.str.19, ptr %6, align 8, !tbaa !5
  br label %.thread130

122:                                              ; preds = %.lr.ph, %216
  %.0109148 = phi i64 [ %93, %.lr.ph ], [ %.1110, %216 ]
  %.sroa.0.0147 = phi i64 [ %93, %.lr.ph ], [ %.sroa.0.0.copyload49, %216 ]
  %.0115146 = phi i32 [ 0, %.lr.ph ], [ %.1116, %216 ]
  %123 = load i32, ptr %35, align 4, !tbaa !15
  %124 = icmp eq i32 %123, 6
  br i1 %124, label %125, label %126

125:                                              ; preds = %122
  store ptr @.str.20, ptr %6, align 8, !tbaa !5
  br label %.thread130

126:                                              ; preds = %122
  %127 = load i64, ptr %10, align 8, !tbaa !24
  %128 = sub nsw i64 %127, %.sroa.0.0147
  %129 = sitofp i64 %128 to double
  %130 = fdiv double %129, 1.000000e+06
  call void (ptr, ...) @debug_log(ptr noundef nonnull @.str.21, double noundef %130) #8
  %131 = load i8, ptr %.sroa.6.0..sroa_idx, align 8, !tbaa !18
  %132 = zext i8 %131 to i32
  %133 = call zeroext i1 @update_statistic(ptr noundef nonnull %11, i32 noundef %132, i64 noundef %127, i64 noundef %.sroa.0.0147)
  %134 = load i8, ptr %96, align 1, !tbaa !19
  %135 = zext i8 %134 to i32
  %136 = call zeroext i1 @update_statistic(ptr noundef nonnull %13, i32 noundef %135, i64 noundef %127, i64 noundef %.sroa.0.0147)
  %137 = load i8, ptr %99, align 2, !tbaa !20
  %138 = zext i8 %137 to i32
  %139 = call zeroext i1 @update_statistic(ptr noundef nonnull %12, i32 noundef %138, i64 noundef %127, i64 noundef %.sroa.0.0147)
  %140 = load i8, ptr %102, align 1, !tbaa !21
  %141 = zext i8 %140 to i32
  %142 = call zeroext i1 @update_statistic(ptr noundef nonnull %14, i32 noundef %141, i64 noundef %127, i64 noundef %.sroa.0.0147)
  %143 = load i32, ptr %35, align 4, !tbaa !15
  switch i32 %143, label %211 [
    i32 1, label %144
    i32 2, label %168
    i32 3, label %205
    i32 4, label %223
  ]

144:                                              ; preds = %126
  %145 = load i32, ptr %120, align 8, !tbaa !25
  %146 = icmp sgt i32 %145, 49
  br i1 %146, label %223, label %147

147:                                              ; preds = %144
  %148 = load i32, ptr %121, align 4, !tbaa !26
  %149 = icmp sgt i32 %148, %.0115146
  br i1 %149, label %150, label %151

150:                                              ; preds = %147
  store ptr @.str.22, ptr %6, align 8, !tbaa !5
  br label %.thread130

151:                                              ; preds = %147
  %152 = load i64, ptr %13, align 8, !tbaa !22
  %153 = sub nsw i64 %127, %152
  %154 = icmp sgt i64 %153, 4000000000
  br i1 %154, label %155, label %156

155:                                              ; preds = %151
  store ptr @.str.23, ptr %6, align 8, !tbaa !5
  br label %.thread130

156:                                              ; preds = %151
  %157 = icmp eq i32 %148, %.0115146
  br i1 %157, label %158, label %212

158:                                              ; preds = %156
  %159 = call i32 @rand() #8
  %160 = srem i32 %159, 17
  %161 = mul nsw i32 %160, 1000
  %162 = call i32 @usleep(i32 noundef %161) #8
  %163 = call zeroext i1 (...) @send_keystroke_z() #8
  br i1 %163, label %165, label %164

164:                                              ; preds = %158
  store ptr @.str.24, ptr %6, align 8, !tbaa !5
  br label %.thread130

165:                                              ; preds = %158
  %166 = call i64 (...) @get_nanoseconds() #8
  store i64 %166, ptr %13, align 8, !tbaa !22
  %167 = add nsw i32 %.0115146, 1
  br label %212

168:                                              ; preds = %126
  %169 = load i32, ptr %118, align 8, !tbaa !25
  %170 = icmp sgt i32 %169, 49
  br i1 %170, label %223, label %171

171:                                              ; preds = %168
  %172 = load i64, ptr %14, align 8, !tbaa !22
  %173 = sub nsw i64 %127, %172
  %174 = icmp sgt i64 %173, 4000000000
  br i1 %174, label %175, label %176

175:                                              ; preds = %171
  store ptr @.str.25, ptr %6, align 8, !tbaa !5
  br label %.thread130

176:                                              ; preds = %171
  br i1 %142, label %177, label %212

177:                                              ; preds = %176
  call void (ptr, ...) @debug_log(ptr noundef nonnull @.str.26, i32 noundef %169) #8
  br label %178

178:                                              ; preds = %177, %195
  %.0100145 = phi i64 [ %127, %177 ], [ %.1101, %195 ]
  %179 = load i64, ptr %8, align 8, !tbaa !14
  %180 = trunc i64 %179 to i32
  %181 = load i64, ptr %9, align 8, !tbaa !14
  %182 = trunc i64 %181 to i32
  %183 = call zeroext i1 @read_data_from_screen(i32 noundef %180, i32 noundef %182, ptr noundef %0, ptr noundef nonnull %10)
  br i1 %183, label %185, label %184

184:                                              ; preds = %178
  store ptr @.str.19, ptr %6, align 8, !tbaa !5
  br label %.thread130

185:                                              ; preds = %178
  %186 = load i64, ptr %10, align 8, !tbaa !24
  %187 = sub nsw i64 %186, %127
  %188 = icmp sgt i64 %187, 1000000000
  br i1 %188, label %189, label %190

189:                                              ; preds = %185
  store ptr @.str.27, ptr %6, align 8, !tbaa !5
  br label %.thread130

190:                                              ; preds = %185
  %191 = load i8, ptr %102, align 1, !tbaa !21
  %192 = zext i8 %191 to i32
  %193 = load i32, ptr %119, align 8, !tbaa !27
  %.not127 = icmp eq i32 %193, %192
  br i1 %.not127, label %195, label %194

194:                                              ; preds = %190
  store i32 %192, ptr %119, align 8, !tbaa !27
  br label %195

195:                                              ; preds = %194, %190
  %.1101 = phi i64 [ %186, %194 ], [ %.0100145, %190 ]
  %196 = sub nsw i64 %186, %.1101
  %197 = icmp sgt i64 %196, 99999999
  br i1 %197, label %198, label %178, !llvm.loop !28

198:                                              ; preds = %195
  %199 = call i32 @rand() #8
  %200 = srem i32 %199, 17
  %201 = mul nsw i32 %200, 1000
  %202 = call i32 @usleep(i32 noundef %201) #8
  %203 = call zeroext i1 @send_scroll_down(i32 noundef %107, i32 noundef %110) #8
  %204 = call i64 (...) @get_nanoseconds() #8
  store i64 %204, ptr %14, align 8, !tbaa !22
  br label %212

205:                                              ; preds = %126
  %206 = sub nsw i64 %127, %.0109148
  %207 = icmp sgt i64 %206, 17000000
  br i1 %207, label %208, label %212

208:                                              ; preds = %205
  %209 = call zeroext i1 @send_scroll_down(i32 noundef %107, i32 noundef %110) #8
  %210 = call i64 (...) @get_nanoseconds() #8
  br label %212

211:                                              ; preds = %126
  store ptr @.str.28, ptr %6, align 8, !tbaa !5
  br label %.thread130

212:                                              ; preds = %198, %176, %205, %208, %156, %165
  %.1116 = phi i32 [ %167, %165 ], [ %.0115146, %156 ], [ %.0115146, %198 ], [ %.0115146, %176 ], [ %.0115146, %208 ], [ %.0115146, %205 ]
  %.1110 = phi i64 [ %.0109148, %165 ], [ %.0109148, %156 ], [ %.0109148, %198 ], [ %.0109148, %176 ], [ %210, %208 ], [ %.0109148, %205 ]
  %.2108 = phi i64 [ %127, %165 ], [ %127, %156 ], [ %186, %198 ], [ %127, %176 ], [ %127, %208 ], [ %127, %205 ]
  %213 = sub nsw i64 %.2108, %93
  %214 = icmp sgt i64 %213, 80000000000
  br i1 %214, label %215, label %216

215:                                              ; preds = %212
  store ptr @.str.29, ptr %6, align 8, !tbaa !5
  br label %.thread130

216:                                              ; preds = %212
  %.sroa.0.0.copyload49 = load i64, ptr %10, align 8, !tbaa !14
  %217 = call i32 @usleep(i32 noundef 0) #8
  %218 = load i64, ptr %8, align 8, !tbaa !14
  %219 = trunc i64 %218 to i32
  %220 = load i64, ptr %9, align 8, !tbaa !14
  %221 = trunc i64 %220 to i32
  %222 = call zeroext i1 @read_data_from_screen(i32 noundef %219, i32 noundef %221, ptr noundef %0, ptr noundef nonnull %10)
  br i1 %222, label %122, label %._crit_edge

223:                                              ; preds = %144, %168, %126
  %224 = call double @upper_bound_ms(ptr noundef nonnull %13)
  %225 = call double @lower_bound_ms(ptr noundef nonnull %13)
  %226 = fadd double %224, %225
  %227 = fmul double %226, 5.000000e-01
  store double %227, ptr %1, align 8, !tbaa !30
  %228 = call double @upper_bound_ms(ptr noundef nonnull %14)
  %229 = call double @lower_bound_ms(ptr noundef nonnull %14)
  %230 = fmul double %229, 5.000000e-01
  %231 = fadd double %228, %230
  store double %231, ptr %2, align 8, !tbaa !30
  %232 = getelementptr inbounds i8, ptr %11, i64 40
  %233 = load i64, ptr %232, align 8, !tbaa !32
  %234 = sitofp i64 %233 to double
  %235 = fdiv double %234, 1.000000e+06
  store double %235, ptr %3, align 8, !tbaa !30
  %236 = getelementptr inbounds i8, ptr %12, i64 40
  %237 = load i64, ptr %236, align 8, !tbaa !32
  %238 = sitofp i64 %237 to double
  %239 = fdiv double %238, 1.000000e+06
  store double %239, ptr %4, align 8, !tbaa !30
  %240 = getelementptr inbounds i8, ptr %14, i64 40
  %241 = load i64, ptr %240, align 8, !tbaa !32
  %242 = sitofp i64 %241 to double
  %243 = fdiv double %242, 1.000000e+06
  store double %243, ptr %5, align 8, !tbaa !30
  %244 = load double, ptr %1, align 8, !tbaa !30
  %245 = load double, ptr %2, align 8, !tbaa !30
  %246 = load double, ptr %3, align 8, !tbaa !30
  %247 = load double, ptr %4, align 8, !tbaa !30
  call void (ptr, ...) @debug_log(ptr noundef nonnull @.str.30, double noundef %244, double noundef %245, double noundef %246, double noundef %247, double noundef %243) #8
  br label %.thread130

.thread130:                                       ; preds = %184, %189, %211, %175, %164, %215, %155, %150, %._crit_edge, %125, %223
  %.6 = phi i1 [ true, %223 ], [ false, %125 ], [ false, %._crit_edge ], [ false, %150 ], [ false, %155 ], [ false, %215 ], [ false, %164 ], [ false, %175 ], [ false, %211 ], [ false, %189 ], [ false, %184 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %14) #8
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %13) #8
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %12) #8
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %11) #8
  br label %248

248:                                              ; preds = %87, %91, %88, %.thread130, %33
  %.7 = phi i1 [ %.6, %.thread130 ], [ false, %33 ], [ false, %87 ], [ %89, %91 ], [ %89, %88 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #8
  call void @llvm.stackrestore.p0(ptr %27)
  br label %249

249:                                              ; preds = %248, %25
  %.8 = phi i1 [ %.7, %248 ], [ false, %25 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  br label %250

250:                                              ; preds = %249, %16
  %.9 = phi i1 [ %.8, %249 ], [ false, %16 ]
  ret i1 %.9
}

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

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @find_pattern(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @free_screenshot(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

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

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

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #6

declare zeroext i1 @open_native_reference_window(ptr noundef) local_unnamed_addr #1

declare zeroext i1 @close_native_reference_window(...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @init_statistic(ptr noundef, ptr noundef, i32 noundef, i64 noundef) local_unnamed_addr #3

declare zeroext i1 @send_scroll_down(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @update_statistic(ptr noundef, i32 noundef, i64 noundef, i64 noundef) local_unnamed_addr #3

declare i32 @usleep(i32 noundef) local_unnamed_addr #1

declare zeroext i1 @send_keystroke_z(...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden double @upper_bound_ms(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden double @lower_bound_ms(ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #8 = { nounwind }
attributes #9 = { noreturn 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, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16, !12, i64 24, !6, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!10, !11, i64 4}
!14 = !{!12, !12, i64 0}
!15 = !{!16, !11, i64 12}
!16 = !{!"", !12, i64 0, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !11, i64 12}
!17 = !{!7, !7, i64 0}
!18 = !{!16, !7, i64 8}
!19 = !{!16, !7, i64 9}
!20 = !{!16, !7, i64 10}
!21 = !{!16, !7, i64 11}
!22 = !{!23, !12, i64 0}
!23 = !{!"", !12, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !6, i64 48}
!24 = !{!16, !12, i64 0}
!25 = !{!23, !11, i64 16}
!26 = !{!23, !11, i64 12}
!27 = !{!23, !11, i64 8}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!31, !31, i64 0}
!31 = !{!"double", !7, i64 0}
!32 = !{!23, !12, i64 40}


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