; LLVM IR from tezc/sc :: timer (timer_test)

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

@.str.1 = external hidden unnamed_addr constant [60 x i8], align 1
@count = external dso_local global i32, align 4
@ids = external dso_local global [1000 x i64], align 16
@.str.4 = external hidden unnamed_addr constant [27 x i8], align 1
@__PRETTY_FUNCTION__.test1 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [27 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i64 @time_ms() #0

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

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

; 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 @sleep_ms(i64 noundef) #0

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

; Function Attrs: nounwind uwtable
define dso_local void @test1() #0 {
  %1 = alloca %struct.sc_timer, align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 24, ptr %1) #5
  %8 = call i64 @time_ms()
  call void @sc_timer_init(ptr noundef %1, i64 noundef %8)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %9

9:                                                ; preds = %36, %0
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = icmp slt i32 %10, 1000
  br i1 %11, label %13, label %12

12:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %39

13:                                               ; preds = %9
  %14 = call i32 @rand() #5
  %15 = srem i32 %14, 100
  %16 = sext i32 %15 to i64
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = inttoptr i64 %20 to ptr
  %22 = call i64 @sc_timer_add(ptr noundef %1, i64 noundef %16, i64 noundef %18, ptr noundef %21)
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %24
  store i64 %22, ptr %25, align 8, !tbaa !9
  %26 = load i32, ptr @count, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr @count, align 4, !tbaa !5
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %29
  %31 = load i64, ptr %30, align 8, !tbaa !9
  %32 = icmp ne i64 %31, -1
  br i1 %32, label %33, label %34

33:                                               ; preds = %13
  br label %35

34:                                               ; preds = %13
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 88, ptr noundef @__PRETTY_FUNCTION__.test1) #6
  unreachable

35:                                               ; preds = %33
  br label %36

36:                                               ; preds = %35
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %2, align 4, !tbaa !5
  br label %9, !llvm.loop !11

39:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 10000, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  br label %40

40:                                               ; preds = %49, %39
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = icmp sgt i32 %41, 0
  br i1 %42, label %43, label %55

43:                                               ; preds = %40
  %44 = call i64 @time_ms()
  %45 = call i64 @sc_timer_timeout(ptr noundef %1, i64 noundef %44, ptr noundef inttoptr (i64 333 to ptr), ptr noundef @callback)
  store i64 %45, ptr %4, align 8, !tbaa !9
  %46 = load i32, ptr @count, align 4, !tbaa !5
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %48, label %49

48:                                               ; preds = %43
  br label %55

49:                                               ; preds = %43
  %50 = load i64, ptr %4, align 8, !tbaa !9
  %51 = trunc i64 %50 to i32
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = sub nsw i32 %52, %51
  store i32 %53, ptr %3, align 4, !tbaa !5
  %54 = load i64, ptr %4, align 8, !tbaa !9
  call void @sleep_ms(i64 noundef %54)
  br label %40, !llvm.loop !13

55:                                               ; preds = %48, %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %69, %55
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = icmp slt i32 %57, 1000
  br i1 %58, label %60, label %59

59:                                               ; preds = %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %72

60:                                               ; preds = %56
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %62
  %64 = load i64, ptr %63, align 8, !tbaa !9
  %65 = icmp eq i64 %64, -1
  br i1 %65, label %66, label %67

66:                                               ; preds = %60
  br label %68

67:                                               ; preds = %60
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 104, ptr noundef @__PRETTY_FUNCTION__.test1) #6
  unreachable

68:                                               ; preds = %66
  br label %69

69:                                               ; preds = %68
  %70 = load i32, ptr %5, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %5, align 4, !tbaa !5
  br label %56, !llvm.loop !14

72:                                               ; preds = %59
  call void @sc_timer_term(ptr noundef %1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %100, %72
  %74 = load i32, ptr %6, align 4, !tbaa !5
  %75 = icmp slt i32 %74, 1000
  br i1 %75, label %77, label %76

76:                                               ; preds = %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %103

77:                                               ; preds = %73
  %78 = call i32 @rand() #5
  %79 = srem i32 %78, 100
  %80 = sext i32 %79 to i64
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = inttoptr i64 %84 to ptr
  %86 = call i64 @sc_timer_add(ptr noundef %1, i64 noundef %80, i64 noundef %82, ptr noundef %85)
  %87 = load i32, ptr %6, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %88
  store i64 %86, ptr %89, align 8, !tbaa !9
  %90 = load i32, ptr @count, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr @count, align 4, !tbaa !5
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %93
  %95 = load i64, ptr %94, align 8, !tbaa !9
  %96 = icmp ne i64 %95, -1
  br i1 %96, label %97, label %98

97:                                               ; preds = %77
  br label %99

98:                                               ; preds = %77
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 113, ptr noundef @__PRETTY_FUNCTION__.test1) #6
  unreachable

99:                                               ; preds = %97
  br label %100

100:                                              ; preds = %99
  %101 = load i32, ptr %6, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %6, align 4, !tbaa !5
  br label %73, !llvm.loop !15

103:                                              ; preds = %76
  store i32 10000, ptr %3, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %113, %103
  %105 = load i32, ptr %3, align 4, !tbaa !5
  %106 = icmp sgt i32 %105, 0
  br i1 %106, label %107, label %119

107:                                              ; preds = %104
  %108 = call i64 @time_ms()
  %109 = call i64 @sc_timer_timeout(ptr noundef %1, i64 noundef %108, ptr noundef inttoptr (i64 333 to ptr), ptr noundef @callback)
  store i64 %109, ptr %4, align 8, !tbaa !9
  %110 = load i32, ptr @count, align 4, !tbaa !5
  %111 = icmp eq i32 %110, 0
  br i1 %111, label %112, label %113

112:                                              ; preds = %107
  br label %119

113:                                              ; preds = %107
  %114 = load i64, ptr %4, align 8, !tbaa !9
  %115 = trunc i64 %114 to i32
  %116 = load i32, ptr %3, align 4, !tbaa !5
  %117 = sub nsw i32 %116, %115
  store i32 %117, ptr %3, align 4, !tbaa !5
  %118 = load i64, ptr %4, align 8, !tbaa !9
  call void @sleep_ms(i64 noundef %118)
  br label %104, !llvm.loop !16

119:                                              ; preds = %112, %104
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %120

120:                                              ; preds = %133, %119
  %121 = load i32, ptr %7, align 4, !tbaa !5
  %122 = icmp slt i32 %121, 1000
  br i1 %122, label %124, label %123

123:                                              ; preds = %120
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %136

124:                                              ; preds = %120
  %125 = load i32, ptr %7, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %126
  %128 = load i64, ptr %127, align 8, !tbaa !9
  %129 = icmp eq i64 %128, -1
  br i1 %129, label %130, label %131

130:                                              ; preds = %124
  br label %132

131:                                              ; preds = %124
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 128, ptr noundef @__PRETTY_FUNCTION__.test1) #6
  unreachable

132:                                              ; preds = %130
  br label %133

133:                                              ; preds = %132
  %134 = load i32, ptr %7, align 4, !tbaa !5
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %7, align 4, !tbaa !5
  br label %120, !llvm.loop !17

136:                                              ; preds = %123
  call void @sc_timer_term(ptr noundef %1)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %1) #5
  ret void
}

declare void @sc_timer_init(ptr noundef, i64 noundef) #3

declare i64 @sc_timer_add(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #3

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

declare i64 @sc_timer_timeout(ptr noundef, i64 noundef, ptr noundef, ptr noundef) #3

declare void @sc_timer_term(ptr noundef) #3

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 = { 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


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

@.str.1 = external hidden unnamed_addr constant [60 x i8], align 1
@count = external dso_local local_unnamed_addr global i32, align 4
@ids = external dso_local local_unnamed_addr global [1000 x i64], align 16
@.str.4 = external hidden unnamed_addr constant [27 x i8], align 1
@__PRETTY_FUNCTION__.test1 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [27 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i64 @time_ms() local_unnamed_addr #0

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @test1() local_unnamed_addr #0 {
  %1 = alloca %struct.sc_timer, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #5
  %2 = tail call i64 @time_ms()
  call void @sc_timer_init(ptr noundef nonnull %1, i64 noundef %2) #5
  br label %4

3:                                                ; preds = %4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 1000
  br i1 %exitcond.not, label %.preheader31, label %4, !llvm.loop !5

4:                                                ; preds = %0, %3
  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %3 ]
  %5 = call i32 @rand() #5
  %6 = srem i32 %5, 100
  %7 = sext i32 %6 to i64
  %8 = inttoptr i64 %indvars.iv to ptr
  %9 = call i64 @sc_timer_add(ptr noundef nonnull %1, i64 noundef %7, i64 noundef %indvars.iv, ptr noundef %8) #5
  %10 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %indvars.iv
  store i64 %9, ptr %10, align 8, !tbaa !7
  %11 = load i32, ptr @count, align 4, !tbaa !11
  %12 = add nsw i32 %11, 1
  store i32 %12, ptr @count, align 4, !tbaa !11
  %.not30 = icmp eq i64 %9, -1
  br i1 %.not30, label %13, label %3

13:                                               ; preds = %4
  call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 88, ptr noundef nonnull @__PRETTY_FUNCTION__.test1) #6
  unreachable

.preheader31:                                     ; preds = %3, %18
  %.02833 = phi i32 [ %20, %18 ], [ 10000, %3 ]
  %14 = call i64 @time_ms()
  %15 = call i64 @sc_timer_timeout(ptr noundef nonnull %1, i64 noundef %14, ptr noundef nonnull inttoptr (i64 333 to ptr), ptr noundef nonnull @callback) #5
  %16 = load i32, ptr @count, align 4, !tbaa !11
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %.preheader52, label %18

18:                                               ; preds = %.preheader31
  %19 = trunc i64 %15 to i32
  %20 = sub nsw i32 %.02833, %19
  call void @sleep_ms(i64 noundef %15)
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.preheader31, label %.preheader52, !llvm.loop !13

.preheader52:                                     ; preds = %.preheader31, %18
  br label %40

22:                                               ; preds = %40
  %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
  %23 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %indvars.iv.next40
  %24 = load i64, ptr %23, align 8, !tbaa !7
  %25 = icmp eq i64 %24, -1
  br i1 %25, label %26, label %44

26:                                               ; preds = %22
  %indvars.iv.next40.1 = add nuw nsw i64 %indvars.iv39, 2
  %27 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %indvars.iv.next40.1
  %28 = load i64, ptr %27, align 8, !tbaa !7
  %29 = icmp eq i64 %28, -1
  br i1 %29, label %30, label %44

30:                                               ; preds = %26
  %indvars.iv.next40.2 = add nuw nsw i64 %indvars.iv39, 3
  %31 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %indvars.iv.next40.2
  %32 = load i64, ptr %31, align 8, !tbaa !7
  %33 = icmp eq i64 %32, -1
  br i1 %33, label %34, label %44

34:                                               ; preds = %30
  %indvars.iv.next40.3 = add nuw nsw i64 %indvars.iv39, 4
  %35 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %indvars.iv.next40.3
  %36 = load i64, ptr %35, align 8, !tbaa !7
  %37 = icmp eq i64 %36, -1
  br i1 %37, label %38, label %44

38:                                               ; preds = %34
  %indvars.iv.next40.4 = add nuw nsw i64 %indvars.iv39, 5
  %exitcond42.not.4 = icmp eq i64 %indvars.iv.next40.4, 1000
  br i1 %exitcond42.not.4, label %39, label %40, !llvm.loop !14

39:                                               ; preds = %38
  call void @sc_timer_term(ptr noundef nonnull %1) #5
  br label %46

40:                                               ; preds = %38, %.preheader52
  %indvars.iv39 = phi i64 [ 0, %.preheader52 ], [ %indvars.iv.next40.4, %38 ]
  %41 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %indvars.iv39
  %42 = load i64, ptr %41, align 8, !tbaa !7
  %43 = icmp eq i64 %42, -1
  br i1 %43, label %22, label %44

44:                                               ; preds = %34, %30, %26, %22, %40
  call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 104, ptr noundef nonnull @__PRETTY_FUNCTION__.test1) #6
  unreachable

45:                                               ; preds = %46
  %indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
  %exitcond46.not = icmp eq i64 %indvars.iv.next44, 1000
  br i1 %exitcond46.not, label %.preheader, label %46, !llvm.loop !15

46:                                               ; preds = %39, %45
  %indvars.iv43 = phi i64 [ 0, %39 ], [ %indvars.iv.next44, %45 ]
  %47 = call i32 @rand() #5
  %48 = srem i32 %47, 100
  %49 = sext i32 %48 to i64
  %50 = inttoptr i64 %indvars.iv43 to ptr
  %51 = call i64 @sc_timer_add(ptr noundef nonnull %1, i64 noundef %49, i64 noundef %indvars.iv43, ptr noundef %50) #5
  %52 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %indvars.iv43
  store i64 %51, ptr %52, align 8, !tbaa !7
  %53 = load i32, ptr @count, align 4, !tbaa !11
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr @count, align 4, !tbaa !11
  %.not = icmp eq i64 %51, -1
  br i1 %.not, label %55, label %45

55:                                               ; preds = %46
  call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 113, ptr noundef nonnull @__PRETTY_FUNCTION__.test1) #6
  unreachable

.preheader:                                       ; preds = %45, %60
  %.136 = phi i32 [ %62, %60 ], [ 10000, %45 ]
  %56 = call i64 @time_ms()
  %57 = call i64 @sc_timer_timeout(ptr noundef nonnull %1, i64 noundef %56, ptr noundef nonnull inttoptr (i64 333 to ptr), ptr noundef nonnull @callback) #5
  %58 = load i32, ptr @count, align 4, !tbaa !11
  %59 = icmp eq i32 %58, 0
  br i1 %59, label %.preheader51, label %60

60:                                               ; preds = %.preheader
  %61 = trunc i64 %57 to i32
  %62 = sub nsw i32 %.136, %61
  call void @sleep_ms(i64 noundef %57)
  %63 = icmp sgt i32 %62, 0
  br i1 %63, label %.preheader, label %.preheader51, !llvm.loop !16

.preheader51:                                     ; preds = %.preheader, %60
  br label %82

64:                                               ; preds = %82
  %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
  %65 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %indvars.iv.next48
  %66 = load i64, ptr %65, align 8, !tbaa !7
  %67 = icmp eq i64 %66, -1
  br i1 %67, label %68, label %86

68:                                               ; preds = %64
  %indvars.iv.next48.1 = add nuw nsw i64 %indvars.iv47, 2
  %69 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %indvars.iv.next48.1
  %70 = load i64, ptr %69, align 8, !tbaa !7
  %71 = icmp eq i64 %70, -1
  br i1 %71, label %72, label %86

72:                                               ; preds = %68
  %indvars.iv.next48.2 = add nuw nsw i64 %indvars.iv47, 3
  %73 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %indvars.iv.next48.2
  %74 = load i64, ptr %73, align 8, !tbaa !7
  %75 = icmp eq i64 %74, -1
  br i1 %75, label %76, label %86

76:                                               ; preds = %72
  %indvars.iv.next48.3 = add nuw nsw i64 %indvars.iv47, 4
  %77 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %indvars.iv.next48.3
  %78 = load i64, ptr %77, align 8, !tbaa !7
  %79 = icmp eq i64 %78, -1
  br i1 %79, label %80, label %86

80:                                               ; preds = %76
  %indvars.iv.next48.4 = add nuw nsw i64 %indvars.iv47, 5
  %exitcond50.not.4 = icmp eq i64 %indvars.iv.next48.4, 1000
  br i1 %exitcond50.not.4, label %81, label %82, !llvm.loop !17

81:                                               ; preds = %80
  call void @sc_timer_term(ptr noundef nonnull %1) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #5
  ret void

82:                                               ; preds = %80, %.preheader51
  %indvars.iv47 = phi i64 [ 0, %.preheader51 ], [ %indvars.iv.next48.4, %80 ]
  %83 = getelementptr inbounds [1000 x i64], ptr @ids, i64 0, i64 %indvars.iv47
  %84 = load i64, ptr %83, align 8, !tbaa !7
  %85 = icmp eq i64 %84, -1
  br i1 %85, label %64, label %86

86:                                               ; preds = %76, %72, %68, %64, %82
  call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 128, ptr noundef nonnull @__PRETTY_FUNCTION__.test1) #6
  unreachable
}

declare void @sc_timer_init(ptr noundef, i64 noundef) local_unnamed_addr #3

declare i64 @sc_timer_add(ptr noundef, i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #3

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

declare i64 @sc_timer_timeout(ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @sc_timer_term(ptr noundef) local_unnamed_addr #3

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !9, i64 0}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass