; LLVM IR from jingweizhanghuai/Morn :: src/util (morn_time)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.MHandle = type { i32, i32, ptr, ptr }
%struct.HandleChrono = type { ptr, i32, i32, i32 }
%struct.MChainNode = type { ptr, ptr, ptr }
%struct.ChronoData = type { double, i32, i32, i32 }
%struct.MObject = type { i32, %union.anon }
%union.anon = type { ptr }

@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local double @mTime() #0

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

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

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

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

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

declare void @m_PropertyVariate(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #2

declare ptr @mChainCreate(...) #2

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

declare void @mChainNodeInsert(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @mChronoDelete(i32 noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @mChrono() #0 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca double, align 8
  %10 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %11 = call ptr @mMornObject(ptr noundef @.str.2, i32 noundef -1)
  %12 = call ptr @GetHandle(ptr noundef %11, i32 noundef 24, i32 noundef -2033341518, ptr noundef @endChrono)
  store ptr %12, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.MHandle, ptr %13, i32 0, i32 3
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %15, ptr %4, align 8, !tbaa !5
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.HandleChrono, ptr %16, i32 0, i32 1
  %18 = load i32, ptr %17, align 8, !tbaa !12
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %63

20:                                               ; preds = %0
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.HandleChrono, ptr %21, i32 0, i32 2
  store i32 100, ptr %22, align 4, !tbaa !14
  %23 = call ptr @mMornObject(ptr noundef @.str.2, i32 noundef -1)
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.HandleChrono, ptr %24, i32 0, i32 2
  call void @m_PropertyVariate(ptr noundef %23, ptr noundef @.str.3, ptr noundef %25, i32 noundef 4)
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.HandleChrono, ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !15
  %29 = icmp eq ptr %28, null
  br i1 %29, label %30, label %34

30:                                               ; preds = %20
  %31 = call ptr (...) @mChainCreate()
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.HandleChrono, ptr %32, i32 0, i32 0
  store ptr %31, ptr %33, align 8, !tbaa !15
  br label %34

34:                                               ; preds = %30, %20
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.HandleChrono, ptr %35, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8, !tbaa !15
  %38 = call ptr @mChainNode(ptr noundef %37, ptr noundef null, i32 noundef 24)
  store ptr %38, ptr %1, align 8, !tbaa !5
  %39 = load ptr, ptr %1, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.MChainNode, ptr %39, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8, !tbaa !16
  store ptr %41, ptr %2, align 8, !tbaa !5
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.ChronoData, ptr %42, i32 0, i32 3
  store i32 -1, ptr %43, align 8, !tbaa !18
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.ChronoData, ptr %44, i32 0, i32 1
  store i32 -1, ptr %45, align 8, !tbaa !21
  %46 = call double @mTime()
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.ChronoData, ptr %47, i32 0, i32 0
  store double %46, ptr %48, align 8, !tbaa !22
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.HandleChrono, ptr %49, i32 0, i32 2
  %51 = load i32, ptr %50, align 4, !tbaa !14
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.ChronoData, ptr %52, i32 0, i32 2
  store i32 %51, ptr %53, align 4, !tbaa !23
  %54 = load ptr, ptr %1, align 8, !tbaa !5
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.HandleChrono, ptr %55, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8, !tbaa !15
  %58 = getelementptr inbounds %struct.MObject, ptr %57, i32 0, i32 1
  store ptr %54, ptr %58, align 8, !tbaa !24
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.HandleChrono, ptr %59, i32 0, i32 1
  store i32 1, ptr %60, align 8, !tbaa !12
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.MHandle, ptr %61, i32 0, i32 1
  store volatile i32 1, ptr %62, align 4, !tbaa !25
  br label %63

63:                                               ; preds = %34, %0
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.HandleChrono, ptr %64, i32 0, i32 0
  %66 = load ptr, ptr %65, align 8, !tbaa !15
  store ptr %66, ptr %5, align 8, !tbaa !5
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.MObject, ptr %67, i32 0, i32 1
  %69 = load ptr, ptr %68, align 8, !tbaa !24
  store ptr %69, ptr %1, align 8, !tbaa !5
  %70 = load ptr, ptr %1, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.MChainNode, ptr %70, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8, !tbaa !16
  store ptr %72, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %73 = load ptr, ptr %2, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.ChronoData, ptr %73, i32 0, i32 3
  %75 = load i32, ptr %74, align 8, !tbaa !18
  store i32 %75, ptr %6, align 4, !tbaa !26
  %76 = load i32, ptr %6, align 4, !tbaa !26
  %77 = icmp slt i32 %76, 0
  br i1 %77, label %78, label %178

78:                                               ; preds = %63
  %79 = load i32, ptr %6, align 4, !tbaa !26
  %80 = sub nsw i32 -2, %79
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.ChronoData, ptr %81, i32 0, i32 3
  store i32 %80, ptr %82, align 8, !tbaa !18
  %83 = load ptr, ptr %2, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.ChronoData, ptr %83, i32 0, i32 1
  %85 = load i32, ptr %84, align 8, !tbaa !21
  %86 = add nsw i32 %85, -1
  store i32 %86, ptr %84, align 8, !tbaa !21
  %87 = load ptr, ptr %2, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.ChronoData, ptr %87, i32 0, i32 1
  %89 = load i32, ptr %88, align 8, !tbaa !21
  %90 = icmp eq i32 %89, 0
  br i1 %90, label %91, label %95

91:                                               ; preds = %78
  %92 = load ptr, ptr %2, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.ChronoData, ptr %92, i32 0, i32 3
  %94 = load i32, ptr %93, align 8, !tbaa !18
  call void @mChronoDelete(i32 noundef %94)
  br label %168

95:                                               ; preds = %78
  %96 = load ptr, ptr %2, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.ChronoData, ptr %96, i32 0, i32 0
  %98 = load double, ptr %97, align 8, !tbaa !22
  %99 = load ptr, ptr %2, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.ChronoData, ptr %99, i32 0, i32 2
  %101 = load i32, ptr %100, align 4, !tbaa !23
  %102 = sitofp i32 %101 to double
  %103 = fadd double %98, %102
  %104 = load ptr, ptr %2, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.ChronoData, ptr %104, i32 0, i32 0
  store double %103, ptr %105, align 8, !tbaa !22
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.HandleChrono, ptr %106, i32 0, i32 1
  %108 = load i32, ptr %107, align 8, !tbaa !12
  %109 = icmp sgt i32 %108, 1
  br i1 %109, label %110, label %167

110:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %111 = load ptr, ptr %1, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.MChainNode, ptr %111, i32 0, i32 2
  %113 = load ptr, ptr %112, align 8, !tbaa !27
  store ptr %113, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %114 = load ptr, ptr %7, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.MChainNode, ptr %114, i32 0, i32 0
  %116 = load ptr, ptr %115, align 8, !tbaa !16
  store ptr %116, ptr %8, align 8, !tbaa !5
  %117 = load ptr, ptr %2, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.ChronoData, ptr %117, i32 0, i32 0
  %119 = load double, ptr %118, align 8, !tbaa !22
  %120 = load ptr, ptr %8, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.ChronoData, ptr %120, i32 0, i32 0
  %122 = load double, ptr %121, align 8, !tbaa !22
  %123 = fcmp ogt double %119, %122
  br i1 %123, label %124, label %166

124:                                              ; preds = %110
  %125 = load ptr, ptr %7, align 8, !tbaa !5
  %126 = load ptr, ptr %1, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.MChainNode, ptr %126, i32 0, i32 1
  %128 = load ptr, ptr %127, align 8, !tbaa !28
  %129 = getelementptr inbounds %struct.MChainNode, ptr %128, i32 0, i32 2
  store ptr %125, ptr %129, align 8, !tbaa !27
  %130 = load ptr, ptr %1, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.MChainNode, ptr %130, i32 0, i32 1
  %132 = load ptr, ptr %131, align 8, !tbaa !28
  %133 = load ptr, ptr %7, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.MChainNode, ptr %133, i32 0, i32 1
  store ptr %132, ptr %134, align 8, !tbaa !28
  %135 = load ptr, ptr %7, align 8, !tbaa !5
  %136 = load ptr, ptr %5, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.MObject, ptr %136, i32 0, i32 1
  store ptr %135, ptr %137, align 8, !tbaa !24
  %138 = load ptr, ptr %7, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.MChainNode, ptr %138, i32 0, i32 2
  %140 = load ptr, ptr %139, align 8, !tbaa !27
  store ptr %140, ptr %7, align 8, !tbaa !5
  br label %141

141:                                              ; preds = %159, %124
  %142 = load ptr, ptr %7, align 8, !tbaa !5
  %143 = load ptr, ptr %5, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.MObject, ptr %143, i32 0, i32 1
  %145 = load ptr, ptr %144, align 8, !tbaa !24
  %146 = icmp ne ptr %142, %145
  br i1 %146, label %147, label %163

147:                                              ; preds = %141
  %148 = load ptr, ptr %7, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.MChainNode, ptr %148, i32 0, i32 0
  %150 = load ptr, ptr %149, align 8, !tbaa !16
  store ptr %150, ptr %8, align 8, !tbaa !5
  %151 = load ptr, ptr %2, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.ChronoData, ptr %151, i32 0, i32 0
  %153 = load double, ptr %152, align 8, !tbaa !22
  %154 = load ptr, ptr %8, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.ChronoData, ptr %154, i32 0, i32 0
  %156 = load double, ptr %155, align 8, !tbaa !22
  %157 = fcmp olt double %153, %156
  br i1 %157, label %158, label %159

158:                                              ; preds = %147
  br label %163

159:                                              ; preds = %147
  %160 = load ptr, ptr %7, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.MChainNode, ptr %160, i32 0, i32 2
  %162 = load ptr, ptr %161, align 8, !tbaa !27
  store ptr %162, ptr %7, align 8, !tbaa !5
  br label %141, !llvm.loop !29

163:                                              ; preds = %158, %141
  %164 = load ptr, ptr %1, align 8, !tbaa !5
  %165 = load ptr, ptr %7, align 8, !tbaa !5
  call void @mChainNodeInsert(ptr noundef null, ptr noundef %164, ptr noundef %165)
  br label %166

166:                                              ; preds = %163, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %167

167:                                              ; preds = %166, %95
  br label %168

168:                                              ; preds = %167, %91
  %169 = load ptr, ptr %5, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.MObject, ptr %169, i32 0, i32 1
  %171 = load ptr, ptr %170, align 8, !tbaa !24
  store ptr %171, ptr %1, align 8, !tbaa !5
  %172 = load ptr, ptr %1, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.MChainNode, ptr %172, i32 0, i32 0
  %174 = load ptr, ptr %173, align 8, !tbaa !16
  store ptr %174, ptr %2, align 8, !tbaa !5
  %175 = load ptr, ptr %2, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.ChronoData, ptr %175, i32 0, i32 3
  %177 = load i32, ptr %176, align 8, !tbaa !18
  store i32 %177, ptr %6, align 4, !tbaa !26
  br label %178

178:                                              ; preds = %168, %63
  %179 = load i32, ptr %6, align 4, !tbaa !26
  %180 = sub nsw i32 -2, %179
  %181 = load ptr, ptr %2, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.ChronoData, ptr %181, i32 0, i32 3
  store i32 %180, ptr %182, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %183 = call double @mTime()
  store double %183, ptr %9, align 8, !tbaa !31
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %184 = load ptr, ptr %2, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.ChronoData, ptr %184, i32 0, i32 0
  %186 = load double, ptr %185, align 8, !tbaa !22
  %187 = load double, ptr %9, align 8, !tbaa !31
  %188 = fsub double %186, %187
  %189 = fptosi double %188 to i32
  store i32 %189, ptr %10, align 4, !tbaa !26
  %190 = load i32, ptr %10, align 4, !tbaa !26
  %191 = icmp sgt i32 %190, 20
  br i1 %191, label %192, label %197

192:                                              ; preds = %178
  %193 = load i32, ptr %10, align 4, !tbaa !26
  %194 = sub nsw i32 %193, 15
  %195 = mul nsw i32 %194, 1000
  %196 = call i32 @usleep(i32 noundef %195)
  br label %197

197:                                              ; preds = %192, %178
  br label %198

198:                                              ; preds = %205, %197
  %199 = load ptr, ptr %2, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.ChronoData, ptr %199, i32 0, i32 0
  %201 = load double, ptr %200, align 8, !tbaa !22
  %202 = load double, ptr %9, align 8, !tbaa !31
  %203 = fsub double %201, %202
  %204 = fcmp ogt double %203, 5.000000e-01
  br i1 %204, label %205, label %207

205:                                              ; preds = %198
  %206 = call double @mTime()
  store double %206, ptr %9, align 8, !tbaa !31
  br label %198, !llvm.loop !32

207:                                              ; preds = %198
  %208 = load i32, ptr %6, align 4, !tbaa !26
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #3
  ret i32 %208
}

declare i32 @usleep(i32 noundef) #2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 16}
!10 = !{!"MHandle", !11, i64 0, !11, i64 4, !6, i64 8, !6, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 8}
!13 = !{!"HandleChrono", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16}
!14 = !{!13, !11, i64 12}
!15 = !{!13, !6, i64 0}
!16 = !{!17, !6, i64 0}
!17 = !{!"MChainNode", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!19, !11, i64 16}
!19 = !{!"ChronoData", !20, i64 0, !11, i64 8, !11, i64 12, !11, i64 16}
!20 = !{!"double", !7, i64 0}
!21 = !{!19, !11, i64 8}
!22 = !{!19, !20, i64 0}
!23 = !{!19, !11, i64 12}
!24 = !{!7, !7, i64 0}
!25 = !{!10, !11, i64 4}
!26 = !{!11, !11, i64 0}
!27 = !{!17, !6, i64 16}
!28 = !{!17, !6, i64 8}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!20, !20, i64 0}
!32 = distinct !{!32, !30}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local double @mTime() local_unnamed_addr #0

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

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

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

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

declare ptr @mChainCreate(...) local_unnamed_addr #1

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

declare void @mChainNodeInsert(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @mChronoDelete(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @mChrono() local_unnamed_addr #0 {
  %1 = tail call ptr @mMornObject(ptr noundef nonnull @.str.2, i32 noundef -1) #2
  %2 = tail call ptr @GetHandle(ptr noundef %1, i32 noundef 24, i32 noundef -2033341518, ptr noundef nonnull @endChrono) #2
  %3 = getelementptr inbounds i8, ptr %2, i64 16
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 8
  %6 = load i32, ptr %5, align 8, !tbaa !11
  %7 = icmp eq i32 %6, 0
  br i1 %7, label %8, label %27

8:                                                ; preds = %0
  %9 = getelementptr inbounds i8, ptr %4, i64 12
  store i32 100, ptr %9, align 4, !tbaa !13
  %10 = tail call ptr @mMornObject(ptr noundef nonnull @.str.2, i32 noundef -1) #2
  tail call void @m_PropertyVariate(ptr noundef %10, ptr noundef nonnull @.str.3, ptr noundef nonnull %9, i32 noundef 4) #2
  %11 = load ptr, ptr %4, align 8, !tbaa !14
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %15

13:                                               ; preds = %8
  %14 = tail call ptr (...) @mChainCreate() #2
  store ptr %14, ptr %4, align 8, !tbaa !14
  br label %15

15:                                               ; preds = %13, %8
  %16 = phi ptr [ %14, %13 ], [ %11, %8 ]
  %17 = tail call ptr @mChainNode(ptr noundef %16, ptr noundef null, i32 noundef 24) #2
  %18 = load ptr, ptr %17, align 8, !tbaa !15
  %19 = getelementptr inbounds i8, ptr %18, i64 16
  store i32 -1, ptr %19, align 8, !tbaa !17
  %20 = getelementptr inbounds i8, ptr %18, i64 8
  store i32 -1, ptr %20, align 8, !tbaa !20
  %21 = tail call double @mTime()
  store double %21, ptr %18, align 8, !tbaa !21
  %22 = load i32, ptr %9, align 4, !tbaa !13
  %23 = getelementptr inbounds i8, ptr %18, i64 12
  store i32 %22, ptr %23, align 4, !tbaa !22
  %24 = load ptr, ptr %4, align 8, !tbaa !14
  %25 = getelementptr inbounds i8, ptr %24, i64 8
  store ptr %17, ptr %25, align 8, !tbaa !23
  store i32 1, ptr %5, align 8, !tbaa !11
  %26 = getelementptr inbounds i8, ptr %2, i64 4
  store volatile i32 1, ptr %26, align 4, !tbaa !24
  br label %27

27:                                               ; preds = %15, %0
  %28 = phi i32 [ 1, %15 ], [ %6, %0 ]
  %29 = load ptr, ptr %4, align 8, !tbaa !14
  %30 = getelementptr inbounds i8, ptr %29, i64 8
  %31 = load ptr, ptr %30, align 8, !tbaa !23
  %32 = load ptr, ptr %31, align 8, !tbaa !15
  %33 = getelementptr inbounds i8, ptr %32, i64 16
  %34 = load i32, ptr %33, align 8, !tbaa !17
  %35 = icmp slt i32 %34, 0
  br i1 %35, label %36, label %73

36:                                               ; preds = %27
  %37 = sub nsw i32 -2, %34
  store i32 %37, ptr %33, align 8, !tbaa !17
  %38 = getelementptr inbounds i8, ptr %32, i64 8
  %39 = load i32, ptr %38, align 8, !tbaa !20
  %40 = add nsw i32 %39, -1
  store i32 %40, ptr %38, align 8, !tbaa !20
  %41 = icmp eq i32 %40, 0
  br i1 %41, label %42, label %43

42:                                               ; preds = %36
  tail call void @mChronoDelete(i32 noundef %37)
  br label %68

43:                                               ; preds = %36
  %44 = load double, ptr %32, align 8, !tbaa !21
  %45 = getelementptr inbounds i8, ptr %32, i64 12
  %46 = load i32, ptr %45, align 4, !tbaa !22
  %47 = sitofp i32 %46 to double
  %48 = fadd double %44, %47
  store double %48, ptr %32, align 8, !tbaa !21
  %49 = icmp sgt i32 %28, 1
  br i1 %49, label %50, label %68

50:                                               ; preds = %43
  %51 = getelementptr inbounds i8, ptr %31, i64 16
  %52 = load ptr, ptr %51, align 8, !tbaa !25
  %53 = load ptr, ptr %52, align 8, !tbaa !15
  %54 = load double, ptr %53, align 8, !tbaa !21
  %55 = fcmp ogt double %48, %54
  br i1 %55, label %56, label %68

56:                                               ; preds = %50
  %57 = getelementptr inbounds i8, ptr %31, i64 8
  %58 = load ptr, ptr %57, align 8, !tbaa !26
  %59 = getelementptr inbounds i8, ptr %58, i64 16
  store ptr %52, ptr %59, align 8, !tbaa !25
  %60 = getelementptr inbounds i8, ptr %52, i64 8
  store ptr %58, ptr %60, align 8, !tbaa !26
  store ptr %52, ptr %30, align 8, !tbaa !23
  br label %61

61:                                               ; preds = %62, %56
  %.pn = phi ptr [ %52, %56 ], [ %.061, %62 ]
  %.061.in = getelementptr inbounds i8, ptr %.pn, i64 16
  %.061 = load ptr, ptr %.061.in, align 8, !tbaa !25
  %.not = icmp eq ptr %.061, %52
  br i1 %.not, label %67, label %62

62:                                               ; preds = %61
  %63 = load ptr, ptr %.061, align 8, !tbaa !15
  %64 = load double, ptr %32, align 8, !tbaa !21
  %65 = load double, ptr %63, align 8, !tbaa !21
  %66 = fcmp olt double %64, %65
  br i1 %66, label %67, label %61, !llvm.loop !27

67:                                               ; preds = %62, %61
  tail call void @mChainNodeInsert(ptr noundef null, ptr noundef nonnull %31, ptr noundef %.061) #2
  br label %68

68:                                               ; preds = %50, %67, %43, %42
  %69 = load ptr, ptr %30, align 8, !tbaa !23
  %70 = load ptr, ptr %69, align 8, !tbaa !15
  %71 = getelementptr inbounds i8, ptr %70, i64 16
  %72 = load i32, ptr %71, align 8, !tbaa !17
  br label %73

73:                                               ; preds = %68, %27
  %.063 = phi ptr [ %70, %68 ], [ %32, %27 ]
  %.062 = phi i32 [ %72, %68 ], [ %34, %27 ]
  %74 = sub nsw i32 -2, %.062
  %75 = getelementptr inbounds i8, ptr %.063, i64 16
  store i32 %74, ptr %75, align 8, !tbaa !17
  %76 = tail call double @mTime()
  %77 = load double, ptr %.063, align 8, !tbaa !21
  %78 = fsub double %77, %76
  %79 = fptosi double %78 to i32
  %80 = icmp sgt i32 %79, 20
  br i1 %80, label %81, label %85

81:                                               ; preds = %73
  %82 = mul i32 %79, 1000
  %83 = add i32 %82, -15000
  %84 = tail call i32 @usleep(i32 noundef %83) #2
  %.pre = load double, ptr %.063, align 8, !tbaa !21
  %.pre66 = fsub double %.pre, %76
  br label %85

85:                                               ; preds = %81, %73
  %.pre-phi = phi double [ %.pre66, %81 ], [ %78, %73 ]
  %86 = fcmp ogt double %.pre-phi, 5.000000e-01
  br i1 %86, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %85, %.lr.ph
  %87 = tail call double @mTime()
  %88 = load double, ptr %.063, align 8, !tbaa !21
  %89 = fsub double %88, %87
  %90 = fcmp ogt double %89, 5.000000e-01
  br i1 %90, label %.lr.ph, label %._crit_edge, !llvm.loop !29

._crit_edge:                                      ; preds = %.lr.ph, %85
  ret i32 %.062
}

declare i32 @usleep(i32 noundef) local_unnamed_addr #1

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 16}
!6 = !{!"MHandle", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!12, !7, i64 8}
!12 = !{!"HandleChrono", !10, i64 0, !7, i64 8, !7, i64 12, !7, i64 16}
!13 = !{!12, !7, i64 12}
!14 = !{!12, !10, i64 0}
!15 = !{!16, !10, i64 0}
!16 = !{!"MChainNode", !10, i64 0, !10, i64 8, !10, i64 16}
!17 = !{!18, !7, i64 16}
!18 = !{!"ChronoData", !19, i64 0, !7, i64 8, !7, i64 12, !7, i64 16}
!19 = !{!"double", !8, i64 0}
!20 = !{!18, !7, i64 8}
!21 = !{!18, !19, i64 0}
!22 = !{!18, !7, i64 12}
!23 = !{!8, !8, i64 0}
!24 = !{!6, !7, i64 4}
!25 = !{!16, !10, i64 16}
!26 = !{!16, !10, i64 8}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = distinct !{!29, !28}


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