; LLVM IR from ctlst-tech/catpilot :: os/freertos/osa/FreeRTOS-Plus-POSIX/source (FreeRTOS_POSIX_timer)

; 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.timespec = type { i64, i64 }
%struct.itimerspec = type { %struct.timespec, %struct.timespec }
%struct.timer_internal = type { %struct.xSTATIC_TIMER, %struct.sigevent, i32 }
%struct.xSTATIC_TIMER = type { ptr, %struct.xSTATIC_LIST_ITEM, i32, ptr, ptr, i8 }
%struct.xSTATIC_LIST_ITEM = type { i32, [4 x ptr] }
%struct.sigevent = type { i32, i32, %union.sigval, ptr, ptr }
%union.sigval = type { ptr }

@FreeRTOS_errno = external global i32, align 4

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

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

declare ptr @pvTimerGetTimerID(ptr noundef) #2

declare i64 @xTimerGenericCommand(ptr noundef, i64 noundef, i32 noundef, ptr noundef, i32 noundef) #2

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

declare i64 @xTimerIsTimerActive(ptr noundef) #2

declare void @vTaskDelay(i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @timer_settime(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca %struct.timespec, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %16, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %17 = load ptr, ptr %10, align 8, !tbaa !5
  %18 = call ptr @pvTimerGetTimerID(ptr noundef %17)
  store ptr %18, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  store i64 0, ptr %14, align 8, !tbaa !11
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.itimerspec, ptr %19, i32 0, i32 1
  %21 = getelementptr inbounds %struct.timespec, ptr %20, i32 0, i32 0
  %22 = load i64, ptr %21, align 8, !tbaa !13
  %23 = icmp eq i64 %22, 0
  br i1 %23, label %24, label %30

24:                                               ; preds = %4
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.itimerspec, ptr %25, i32 0, i32 1
  %27 = getelementptr inbounds %struct.timespec, ptr %26, i32 0, i32 1
  %28 = load i64, ptr %27, align 8, !tbaa !16
  %29 = icmp eq i64 %28, 0
  br i1 %29, label %44, label %30

30:                                               ; preds = %24, %4
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.itimerspec, ptr %31, i32 0, i32 0
  %33 = call zeroext i1 @UTILS_ValidateTimespec(ptr noundef %32)
  %34 = zext i1 %33 to i32
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %42, label %36

36:                                               ; preds = %30
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.itimerspec, ptr %37, i32 0, i32 1
  %39 = call zeroext i1 @UTILS_ValidateTimespec(ptr noundef %38)
  %40 = zext i1 %39 to i32
  %41 = icmp eq i32 %40, 0
  br i1 %41, label %42, label %43

42:                                               ; preds = %36, %30
  store i32 22, ptr @FreeRTOS_errno, align 4, !tbaa !9
  store i32 -1, ptr %9, align 4, !tbaa !9
  br label %43

43:                                               ; preds = %42, %36
  br label %44

44:                                               ; preds = %43, %24
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %51

47:                                               ; preds = %44
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = call i32 @timer_gettime(ptr noundef %48, ptr noundef %49)
  br label %51

51:                                               ; preds = %47, %44
  %52 = load i32, ptr %9, align 4, !tbaa !9
  %53 = icmp eq i32 %52, 0
  br i1 %53, label %54, label %61

54:                                               ; preds = %51
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  %56 = call i64 @xTimerIsTimerActive(ptr noundef %55)
  %57 = icmp ne i64 %56, 0
  br i1 %57, label %58, label %61

58:                                               ; preds = %54
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = call i64 @xTimerGenericCommand(ptr noundef %59, i64 noundef 3, i32 noundef 0, ptr noundef null, i32 noundef -1)
  br label %61

61:                                               ; preds = %58, %54, %51
  %62 = load i32, ptr %9, align 4, !tbaa !9
  %63 = icmp eq i32 %62, 0
  br i1 %63, label %64, label %158

64:                                               ; preds = %61
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.itimerspec, ptr %65, i32 0, i32 1
  %67 = getelementptr inbounds %struct.timespec, ptr %66, i32 0, i32 0
  %68 = load i64, ptr %67, align 8, !tbaa !13
  %69 = icmp eq i64 %68, 0
  br i1 %69, label %70, label %76

70:                                               ; preds = %64
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.itimerspec, ptr %71, i32 0, i32 1
  %73 = getelementptr inbounds %struct.timespec, ptr %72, i32 0, i32 1
  %74 = load i64, ptr %73, align 8, !tbaa !16
  %75 = icmp eq i64 %74, 0
  br i1 %75, label %158, label %76

76:                                               ; preds = %70, %64
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.itimerspec, ptr %77, i32 0, i32 0
  %79 = getelementptr inbounds %struct.timespec, ptr %78, i32 0, i32 0
  %80 = load i64, ptr %79, align 8, !tbaa !17
  %81 = icmp eq i64 %80, 0
  br i1 %81, label %82, label %88

82:                                               ; preds = %76
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.itimerspec, ptr %83, i32 0, i32 0
  %85 = getelementptr inbounds %struct.timespec, ptr %84, i32 0, i32 1
  %86 = load i64, ptr %85, align 8, !tbaa !18
  %87 = icmp eq i64 %86, 0
  br i1 %87, label %92, label %88

88:                                               ; preds = %82, %76
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.itimerspec, ptr %89, i32 0, i32 0
  %91 = call i32 @UTILS_TimespecToTicks(ptr noundef %90, ptr noundef %13)
  br label %92

92:                                               ; preds = %88, %82
  %93 = load i32, ptr %13, align 4, !tbaa !9
  %94 = load ptr, ptr %11, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.timer_internal, ptr %94, i32 0, i32 2
  store i32 %93, ptr %95, align 8, !tbaa !19
  %96 = load ptr, ptr %7, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.itimerspec, ptr %96, i32 0, i32 1
  %98 = getelementptr inbounds %struct.timespec, ptr %97, i32 0, i32 0
  %99 = load i64, ptr %98, align 8, !tbaa !13
  %100 = icmp eq i64 %99, 0
  br i1 %100, label %101, label %107

101:                                              ; preds = %92
  %102 = load ptr, ptr %7, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.itimerspec, ptr %102, i32 0, i32 1
  %104 = getelementptr inbounds %struct.timespec, ptr %103, i32 0, i32 1
  %105 = load i64, ptr %104, align 8, !tbaa !16
  %106 = icmp eq i64 %105, 0
  br i1 %106, label %133, label %107

107:                                              ; preds = %101, %92
  %108 = load i32, ptr %6, align 4, !tbaa !9
  %109 = and i32 %108, 1
  %110 = icmp eq i32 %109, 1
  br i1 %110, label %111, label %128

111:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #4
  call void @llvm.memset.p0.i64(ptr align 8 %15, i8 0, i64 16, i1 false)
  %112 = call i32 @clock_gettime(i32 noundef 0, ptr noundef %15)
  %113 = icmp ne i32 %112, 0
  br i1 %113, label %114, label %115

114:                                              ; preds = %111
  store i32 22, ptr %9, align 4, !tbaa !9
  br label %119

115:                                              ; preds = %111
  %116 = load ptr, ptr %7, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.itimerspec, ptr %116, i32 0, i32 1
  %118 = call i32 @UTILS_AbsoluteTimespecToDeltaTicks(ptr noundef %117, ptr noundef %15, ptr noundef %12)
  store i32 %118, ptr %9, align 4, !tbaa !9
  br label %119

119:                                              ; preds = %115, %114
  %120 = load i32, ptr %9, align 4, !tbaa !9
  %121 = icmp ne i32 %120, 0
  br i1 %121, label %122, label %127

122:                                              ; preds = %119
  store i32 0, ptr %12, align 4, !tbaa !9
  %123 = load i32, ptr %9, align 4, !tbaa !9
  %124 = icmp eq i32 %123, 116
  br i1 %124, label %125, label %126

125:                                              ; preds = %122
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %126

126:                                              ; preds = %125, %122
  br label %127

127:                                              ; preds = %126, %119
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #4
  br label %132

128:                                              ; preds = %107
  %129 = load ptr, ptr %7, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.itimerspec, ptr %129, i32 0, i32 1
  %131 = call i32 @UTILS_TimespecToTicks(ptr noundef %130, ptr noundef %12)
  br label %132

132:                                              ; preds = %128, %127
  br label %133

133:                                              ; preds = %132, %101
  %134 = load i32, ptr %12, align 4, !tbaa !9
  %135 = icmp eq i32 %134, 0
  br i1 %135, label %136, label %138

136:                                              ; preds = %133
  %137 = load ptr, ptr %10, align 8, !tbaa !5
  call void @prvTimerCallback(ptr noundef %137)
  br label %157

138:                                              ; preds = %133
  %139 = load ptr, ptr %10, align 8, !tbaa !5
  %140 = load i32, ptr %12, align 4, !tbaa !9
  %141 = call i64 @xTimerGenericCommand(ptr noundef %139, i64 noundef 4, i32 noundef %140, ptr noundef null, i32 noundef -1)
  %142 = load ptr, ptr %10, align 8, !tbaa !5
  %143 = call i32 @xTaskGetTickCount()
  %144 = load i32, ptr %12, align 4, !tbaa !9
  %145 = call i64 @xTimerGenericCommand(ptr noundef %142, i64 noundef 1, i32 noundef %143, ptr noundef null, i32 noundef %144)
  store i64 %145, ptr %14, align 8, !tbaa !11
  br label %146

146:                                              ; preds = %155, %138
  %147 = load i64, ptr %14, align 8, !tbaa !11
  %148 = icmp ne i64 %147, 0
  br i1 %148, label %149, label %153

149:                                              ; preds = %146
  %150 = load ptr, ptr %10, align 8, !tbaa !5
  %151 = call i64 @xTimerIsTimerActive(ptr noundef %150)
  %152 = icmp eq i64 %151, 0
  br label %153

153:                                              ; preds = %149, %146
  %154 = phi i1 [ false, %146 ], [ %152, %149 ]
  br i1 %154, label %155, label %156

155:                                              ; preds = %153
  call void @vTaskDelay(i32 noundef 1)
  br label %146, !llvm.loop !24

156:                                              ; preds = %153
  br label %157

157:                                              ; preds = %156, %136
  br label %158

158:                                              ; preds = %157, %70, %61
  %159 = load i32, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  ret i32 %159
}

declare zeroext i1 @UTILS_ValidateTimespec(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @timer_gettime(ptr noundef, ptr noundef) #0

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

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

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

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

declare i32 @xTaskGetTickCount() #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 16}
!14 = !{!"itimerspec", !15, i64 0, !15, i64 16}
!15 = !{!"timespec", !12, i64 0, !12, i64 8}
!16 = !{!14, !12, i64 24}
!17 = !{!14, !12, i64 0}
!18 = !{!14, !12, i64 8}
!19 = !{!20, !10, i64 112}
!20 = !{!"timer_internal", !21, i64 0, !23, i64 80, !10, i64 112}
!21 = !{!"xSTATIC_TIMER", !6, i64 0, !22, i64 8, !10, i64 48, !6, i64 56, !6, i64 64, !7, i64 72}
!22 = !{!"xSTATIC_LIST_ITEM", !10, i64 0, !7, i64 8}
!23 = !{!"sigevent", !10, i64 0, !10, i64 4, !7, i64 8, !6, i64 16, !6, i64 24}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


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

@FreeRTOS_errno = external local_unnamed_addr global i32, align 4

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

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

declare ptr @pvTimerGetTimerID(ptr noundef) local_unnamed_addr #2

declare i64 @xTimerGenericCommand(ptr noundef, i64 noundef, i32 noundef, ptr noundef, i32 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

declare i64 @xTimerIsTimerActive(ptr noundef) local_unnamed_addr #2

declare void @vTaskDelay(i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @timer_settime(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #0 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %struct.timespec, align 8
  %8 = tail call ptr @pvTimerGetTimerID(ptr noundef %0) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %2, i64 16
  %10 = load i64, ptr %9, align 8, !tbaa !9
  %11 = icmp eq i64 %10, 0
  br i1 %11, label %12, label %16

12:                                               ; preds = %4
  %13 = getelementptr inbounds i8, ptr %2, i64 24
  %14 = load i64, ptr %13, align 8, !tbaa !13
  %15 = icmp eq i64 %14, 0
  br i1 %15, label %21, label %16

16:                                               ; preds = %12, %4
  %17 = tail call zeroext i1 @UTILS_ValidateTimespec(ptr noundef nonnull %2) #4
  br i1 %17, label %18, label %20

18:                                               ; preds = %16
  %19 = tail call zeroext i1 @UTILS_ValidateTimespec(ptr noundef nonnull %9) #4
  br i1 %19, label %21, label %20

20:                                               ; preds = %18, %16
  store i32 22, ptr @FreeRTOS_errno, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %18, %20, %12
  %22 = phi i1 [ true, %12 ], [ false, %20 ], [ true, %18 ]
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %25, label %23

23:                                               ; preds = %21
  %24 = tail call i32 @timer_gettime(ptr noundef %0, ptr noundef nonnull %3)
  br label %25

25:                                               ; preds = %23, %21
  br i1 %22, label %26, label %.critedge

26:                                               ; preds = %25
  %27 = tail call i64 @xTimerIsTimerActive(ptr noundef %0) #4
  %.not33 = icmp eq i64 %27, 0
  br i1 %.not33, label %30, label %28

28:                                               ; preds = %26
  %29 = tail call i64 @xTimerGenericCommand(ptr noundef %0, i64 noundef 3, i32 noundef 0, ptr noundef null, i32 noundef -1) #4
  br label %30

30:                                               ; preds = %26, %28
  %31 = load i64, ptr %9, align 8, !tbaa !9
  %32 = icmp eq i64 %31, 0
  br i1 %32, label %33, label %37

33:                                               ; preds = %30
  %34 = getelementptr inbounds i8, ptr %2, i64 24
  %35 = load i64, ptr %34, align 8, !tbaa !13
  %36 = icmp eq i64 %35, 0
  br i1 %36, label %.critedge, label %37

37:                                               ; preds = %33, %30
  %38 = load i64, ptr %2, align 8, !tbaa !14
  %39 = icmp eq i64 %38, 0
  br i1 %39, label %40, label %44

40:                                               ; preds = %37
  %41 = getelementptr inbounds i8, ptr %2, i64 8
  %42 = load i64, ptr %41, align 8, !tbaa !15
  %43 = icmp eq i64 %42, 0
  br i1 %43, label %46, label %44

44:                                               ; preds = %40, %37
  %45 = call i32 @UTILS_TimespecToTicks(ptr noundef nonnull %2, ptr noundef nonnull %6) #4
  %.pre = load i32, ptr %6, align 4, !tbaa !5
  %.pre47 = load i64, ptr %9, align 8, !tbaa !9
  br label %46

46:                                               ; preds = %44, %40
  %47 = phi i64 [ %.pre47, %44 ], [ %31, %40 ]
  %48 = phi i32 [ %.pre, %44 ], [ 0, %40 ]
  %49 = getelementptr inbounds i8, ptr %8, i64 112
  store i32 %48, ptr %49, align 8, !tbaa !16
  %50 = icmp eq i64 %47, 0
  br i1 %50, label %51, label %55

51:                                               ; preds = %46
  %52 = getelementptr inbounds i8, ptr %2, i64 24
  %53 = load i64, ptr %52, align 8, !tbaa !13
  %54 = icmp eq i64 %53, 0
  br i1 %54, label %66, label %55

55:                                               ; preds = %51, %46
  %56 = and i32 %1, 1
  %.not34 = icmp eq i32 %56, 0
  br i1 %.not34, label %64, label %57

57:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %7, i8 0, i64 16, i1 false)
  %58 = call i32 @clock_gettime(i32 noundef 0, ptr noundef nonnull %7) #4
  %.not35 = icmp eq i32 %58, 0
  br i1 %.not35, label %59, label %.thread42

.thread42:                                        ; preds = %57
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %63

59:                                               ; preds = %57
  %60 = call i32 @UTILS_AbsoluteTimespecToDeltaTicks(ptr noundef nonnull %9, ptr noundef nonnull %7, ptr noundef nonnull %5) #4
  %.fr = freeze i32 %60
  %.not36 = icmp eq i32 %.fr, 0
  br i1 %.not36, label %63, label %61

61:                                               ; preds = %59
  store i32 0, ptr %5, align 4, !tbaa !5
  %62 = icmp eq i32 %.fr, 116
  %spec.select = select i1 %62, i32 0, i32 %.fr
  br label %63

63:                                               ; preds = %61, %.thread42, %59
  %.2 = phi i32 [ 0, %59 ], [ 22, %.thread42 ], [ %spec.select, %61 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #4
  br label %66

64:                                               ; preds = %55
  %65 = call i32 @UTILS_TimespecToTicks(ptr noundef nonnull %9, ptr noundef nonnull %5) #4
  br label %66

66:                                               ; preds = %63, %64, %51
  %.3 = phi i32 [ 0, %51 ], [ %.2, %63 ], [ 0, %64 ]
  %67 = load i32, ptr %5, align 4, !tbaa !5
  %68 = icmp eq i32 %67, 0
  br i1 %68, label %69, label %70

69:                                               ; preds = %66
  call void @prvTimerCallback(ptr noundef %0)
  br label %.critedge

70:                                               ; preds = %66
  %71 = call i64 @xTimerGenericCommand(ptr noundef %0, i64 noundef 4, i32 noundef %67, ptr noundef null, i32 noundef -1) #4
  %72 = call i32 @xTaskGetTickCount() #4
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = call i64 @xTimerGenericCommand(ptr noundef %0, i64 noundef 1, i32 noundef %72, ptr noundef null, i32 noundef %73) #4
  %.not37 = icmp eq i64 %74, 0
  br i1 %.not37, label %.critedge, label %.lr.ph.split

.lr.ph.split:                                     ; preds = %70
  %75 = call i64 @xTimerIsTimerActive(ptr noundef %0) #4
  %76 = icmp eq i64 %75, 0
  br i1 %76, label %.lr.ph46, label %.critedge

.lr.ph46:                                         ; preds = %.lr.ph.split, %.lr.ph46
  call void @vTaskDelay(i32 noundef 1) #4
  %77 = call i64 @xTimerIsTimerActive(ptr noundef %0) #4
  %78 = icmp eq i64 %77, 0
  br i1 %78, label %.lr.ph46, label %.critedge

.critedge:                                        ; preds = %.lr.ph46, %70, %.lr.ph.split, %25, %69, %33
  %.4 = phi i32 [ 0, %33 ], [ %.3, %69 ], [ -1, %25 ], [ %.3, %.lr.ph.split ], [ %.3, %70 ], [ %.3, %.lr.ph46 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  ret i32 %.4
}

declare zeroext i1 @UTILS_ValidateTimespec(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @timer_gettime(ptr noundef, ptr noundef) local_unnamed_addr #0

declare i32 @UTILS_TimespecToTicks(ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare i32 @clock_gettime(i32 noundef, ptr noundef) local_unnamed_addr #2

declare i32 @UTILS_AbsoluteTimespecToDeltaTicks(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @xTaskGetTickCount() local_unnamed_addr #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 = { mustprogress 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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, !12, i64 16}
!10 = !{!"itimerspec", !11, i64 0, !11, i64 16}
!11 = !{!"timespec", !12, i64 0, !12, i64 8}
!12 = !{!"long", !7, i64 0}
!13 = !{!10, !12, i64 24}
!14 = !{!10, !12, i64 0}
!15 = !{!10, !12, i64 8}
!16 = !{!17, !6, i64 112}
!17 = !{!"timer_internal", !18, i64 0, !21, i64 80, !6, i64 112}
!18 = !{!"xSTATIC_TIMER", !19, i64 0, !20, i64 8, !6, i64 48, !19, i64 56, !19, i64 64, !7, i64 72}
!19 = !{!"any pointer", !7, i64 0}
!20 = !{!"xSTATIC_LIST_ITEM", !6, i64 0, !7, i64 8}
!21 = !{!"sigevent", !6, i64 0, !6, i64 4, !7, i64 8, !19, i64 16, !19, i64 24}


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