; LLVM IR from ctlst-tech/catpilot :: bsp/ics/icm20649 (icm20649)

; 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.icm20649_t = type { [32 x i8], %struct.icm20649_interface_t, ptr, %struct.icm20649_sync_t, %struct.icm20649_fifo_buffer_t, %struct.icm20649_fifo_param_t, %struct.icm20649_meas_buffer_t, %struct.icm20649_meas_t, %struct.icm20649_meas_param_t, i32, i8 }
%struct.icm20649_interface_t = type { ptr, ptr, ptr }
%struct.icm20649_sync_t = type { ptr, ptr, ptr }
%struct.icm20649_fifo_buffer_t = type { i8, i8, i8, [1 x %struct.icm20649_fifo_t] }
%struct.icm20649_fifo_t = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }
%struct.icm20649_fifo_param_t = type { i16, i16 }
%struct.icm20649_meas_buffer_t = type { [1 x %struct.icm20649_meas_t], double }
%struct.icm20649_meas_t = type { double, double, double, double, double, double, double }
%struct.icm20649_meas_param_t = type { double, double, double, double }
%struct.exti_t = type { %struct.gpio_t, %struct.EXTI_ConfigTypeDef, %struct.EXTI_HandleTypeDef, i32, %struct.exti_private_t }
%struct.gpio_t = type { ptr, %struct.GPIO_InitTypeDef }
%struct.GPIO_InitTypeDef = type { i32, i32, i32, i32, i32 }
%struct.EXTI_ConfigTypeDef = type { i32, i32, i32, i32, i32 }
%struct.EXTI_HandleTypeDef = type { i32, ptr }
%struct.exti_private_t = type { i32 }

@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [21 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

; Function Attrs: nounwind uwtable
define dso_local void @icm20649_fsm(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %5, ptr %3, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.icm20649_t, ptr %6, i32 0, i32 9
  %8 = load i32, ptr %7, align 8, !tbaa !9
  switch i32 %8, label %135 [
    i32 0, label %9
    i32 1, label %13
    i32 2, label %53
    i32 3, label %90
    i32 4, label %129
  ]

9:                                                ; preds = %1
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  call void @icm20649_write_reg(ptr noundef %10, i8 noundef zeroext 0, i8 noundef zeroext 6, i8 noundef zeroext -128)
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.icm20649_t, ptr %11, i32 0, i32 9
  store i32 1, ptr %12, align 8, !tbaa !9
  call void @vTaskDelay(i32 noundef 100)
  br label %136

13:                                               ; preds = %1
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = call zeroext i8 @icm20649_read_reg(ptr noundef %14, i8 noundef zeroext 0, i8 noundef zeroext 0)
  %16 = zext i8 %15 to i32
  %17 = icmp eq i32 %16, 225
  br i1 %17, label %18, label %28

18:                                               ; preds = %13
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = call zeroext i8 @icm20649_read_reg(ptr noundef %19, i8 noundef zeroext 0, i8 noundef zeroext 6)
  %21 = zext i8 %20 to i32
  %22 = icmp eq i32 %21, 65
  br i1 %22, label %23, label %28

23:                                               ; preds = %18
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  call void @icm20649_write_reg(ptr noundef %24, i8 noundef zeroext 0, i8 noundef zeroext 6, i8 noundef zeroext 1)
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  call void @icm20649_write_reg(ptr noundef %25, i8 noundef zeroext 0, i8 noundef zeroext 3, i8 noundef zeroext 20)
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.icm20649_t, ptr %26, i32 0, i32 9
  store i32 2, ptr %27, align 8, !tbaa !9
  br label %52

28:                                               ; preds = %18, %13
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.icm20649_t, ptr %29, i32 0, i32 9
  store i32 0, ptr %30, align 8, !tbaa !9
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.icm20649_t, ptr %31, i32 0, i32 10
  %33 = load i8, ptr %32, align 4, !tbaa !20
  %34 = add i8 %33, 1
  store i8 %34, ptr %32, align 4, !tbaa !20
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.icm20649_t, ptr %35, i32 0, i32 10
  %37 = load i8, ptr %36, align 4, !tbaa !20
  %38 = zext i8 %37 to i32
  %39 = icmp sgt i32 %38, 5
  br i1 %39, label %40, label %51

40:                                               ; preds = %28
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.icm20649_t, ptr %41, i32 0, i32 9
  store i32 4, ptr %42, align 8, !tbaa !9
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.icm20649_t, ptr %43, i32 0, i32 0
  %45 = getelementptr inbounds [32 x i8], ptr %44, i64 0, i64 0
  call void (i8, ptr, ptr, ...) @log_module(i8 noundef zeroext 2, ptr noundef %45, ptr noundef @.str.1)
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.icm20649_t, ptr %46, i32 0, i32 0
  %48 = getelementptr inbounds [32 x i8], ptr %47, i64 0, i64 0
  call void (i8, ptr, ptr, ...) @log_module(i8 noundef zeroext 2, ptr noundef %48, ptr noundef @.str)
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.icm20649_t, ptr %49, i32 0, i32 10
  store i8 0, ptr %50, align 4, !tbaa !20
  br label %51

51:                                               ; preds = %40, %28
  br label %52

52:                                               ; preds = %51, %23
  br label %136

53:                                               ; preds = %1
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = call i32 @icm20649_configure(ptr noundef %54)
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %57, label %64

57:                                               ; preds = %53
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  call void @icm20649_fifo_reset(ptr noundef %58)
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.icm20649_t, ptr %59, i32 0, i32 0
  %61 = getelementptr inbounds [32 x i8], ptr %60, i64 0, i64 0
  call void (i8, ptr, ptr, ...) @log_module(i8 noundef zeroext 0, ptr noundef %61, ptr noundef @.str.2)
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.icm20649_t, ptr %62, i32 0, i32 9
  store i32 3, ptr %63, align 8, !tbaa !9
  br label %89

64:                                               ; preds = %53
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.icm20649_t, ptr %65, i32 0, i32 0
  %67 = getelementptr inbounds [32 x i8], ptr %66, i64 0, i64 0
  call void (i8, ptr, ptr, ...) @log_module(i8 noundef zeroext 1, ptr noundef %67, ptr noundef @.str.3)
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.icm20649_t, ptr %68, i32 0, i32 10
  %70 = load i8, ptr %69, align 4, !tbaa !20
  %71 = add i8 %70, 1
  store i8 %71, ptr %69, align 4, !tbaa !20
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.icm20649_t, ptr %72, i32 0, i32 10
  %74 = load i8, ptr %73, align 4, !tbaa !20
  %75 = zext i8 %74 to i32
  %76 = icmp sgt i32 %75, 5
  br i1 %76, label %77, label %88

77:                                               ; preds = %64
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.icm20649_t, ptr %78, i32 0, i32 9
  store i32 0, ptr %79, align 8, !tbaa !9
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.icm20649_t, ptr %80, i32 0, i32 0
  %82 = getelementptr inbounds [32 x i8], ptr %81, i64 0, i64 0
  call void (i8, ptr, ptr, ...) @log_module(i8 noundef zeroext 2, ptr noundef %82, ptr noundef @.str.4)
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.icm20649_t, ptr %83, i32 0, i32 0
  %85 = getelementptr inbounds [32 x i8], ptr %84, i64 0, i64 0
  call void (i8, ptr, ptr, ...) @log_module(i8 noundef zeroext 2, ptr noundef %85, ptr noundef @.str)
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.icm20649_t, ptr %86, i32 0, i32 10
  store i8 0, ptr %87, align 4, !tbaa !20
  br label %88

88:                                               ; preds = %77, %64
  br label %89

89:                                               ; preds = %88, %57
  br label %136

90:                                               ; preds = %1
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.icm20649_t, ptr %91, i32 0, i32 1
  %93 = getelementptr inbounds %struct.icm20649_interface_t, ptr %92, i32 0, i32 2
  %94 = load ptr, ptr %93, align 8, !tbaa !21
  %95 = icmp ne ptr %94, null
  br i1 %95, label %96, label %102

96:                                               ; preds = %90
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.icm20649_t, ptr %97, i32 0, i32 3
  %99 = getelementptr inbounds %struct.icm20649_sync_t, ptr %98, i32 0, i32 0
  %100 = load ptr, ptr %99, align 8, !tbaa !22
  %101 = call i64 @xQueueSemaphoreTake(ptr noundef %100, i32 noundef -1)
  br label %102

102:                                              ; preds = %96, %90
  %103 = load ptr, ptr %3, align 8, !tbaa !5
  %104 = call i32 @icm20649_fifo_read(ptr noundef %103, i16 noundef zeroext 1)
  %105 = load ptr, ptr %3, align 8, !tbaa !5
  call void @icm20649_temp_process(ptr noundef %105)
  %106 = load ptr, ptr %3, align 8, !tbaa !5
  call void @icm20649_accel_process(ptr noundef %106)
  %107 = load ptr, ptr %3, align 8, !tbaa !5
  call void @icm20649_gyro_process(ptr noundef %107)
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  call void @icm20649_update_meas(ptr noundef %108)
  %109 = load ptr, ptr %3, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.icm20649_t, ptr %109, i32 0, i32 1
  %111 = getelementptr inbounds %struct.icm20649_interface_t, ptr %110, i32 0, i32 2
  %112 = load ptr, ptr %111, align 8, !tbaa !21
  %113 = icmp ne ptr %112, null
  br i1 %113, label %114, label %123

114:                                              ; preds = %102
  %115 = load ptr, ptr %3, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.icm20649_t, ptr %115, i32 0, i32 1
  %117 = getelementptr inbounds %struct.icm20649_interface_t, ptr %116, i32 0, i32 2
  %118 = load ptr, ptr %117, align 8, !tbaa !21
  %119 = getelementptr inbounds %struct.exti_t, ptr %118, i32 0, i32 4
  %120 = getelementptr inbounds %struct.exti_private_t, ptr %119, i32 0, i32 0
  %121 = load i32, ptr %120, align 4, !tbaa !23
  %122 = call i32 @irq_enable(i32 noundef %121)
  br label %123

123:                                              ; preds = %114, %102
  %124 = load ptr, ptr %3, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.icm20649_t, ptr %124, i32 0, i32 3
  %126 = getelementptr inbounds %struct.icm20649_sync_t, ptr %125, i32 0, i32 1
  %127 = load ptr, ptr %126, align 8, !tbaa !29
  %128 = call i64 @xQueueGenericSend(ptr noundef %127, ptr noundef null, i32 noundef 0, i64 noundef 0)
  br label %136

129:                                              ; preds = %1
  %130 = load ptr, ptr %3, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.icm20649_t, ptr %130, i32 0, i32 3
  %132 = getelementptr inbounds %struct.icm20649_sync_t, ptr %131, i32 0, i32 1
  %133 = load ptr, ptr %132, align 8, !tbaa !29
  %134 = call i64 @xQueueGenericSend(ptr noundef %133, ptr noundef null, i32 noundef 0, i64 noundef 0)
  call void @vTaskDelete(ptr noundef null)
  store i32 1, ptr %4, align 4
  br label %137

135:                                              ; preds = %1
  br label %136

136:                                              ; preds = %135, %123, %89, %52, %9
  store i32 0, ptr %4, align 4
  br label %137

137:                                              ; preds = %136, %129
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  %138 = load i32, ptr %4, align 4
  switch i32 %138, label %140 [
    i32 0, label %139
    i32 1, label %139
  ]

139:                                              ; preds = %137, %137
  ret void

140:                                              ; preds = %137
  unreachable
}

declare void @log_module(i8 noundef zeroext, ptr noundef, ptr noundef, ...) #2

declare i64 @xQueueSemaphoreTake(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) #0

; Function Attrs: nounwind uwtable
declare hidden void @icm20649_write_reg(ptr noundef, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext) #1

declare void @vTaskDelay(i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden zeroext i8 @icm20649_read_reg(ptr noundef, i8 noundef zeroext, i8 noundef zeroext) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @icm20649_configure(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @icm20649_fifo_reset(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @icm20649_fifo_read(ptr noundef, i16 noundef zeroext) #1

; Function Attrs: nounwind uwtable
declare hidden void @icm20649_temp_process(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @icm20649_accel_process(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @icm20649_gyro_process(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @icm20649_update_meas(ptr noundef) #1

declare i32 @irq_enable(i32 noundef) #2

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

declare void @vTaskDelete(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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, !19, i64 264}
!10 = !{!"", !7, i64 0, !11, i64 32, !6, i64 56, !11, i64 64, !12, i64 88, !13, i64 104, !15, i64 112, !17, i64 176, !18, i64 232, !19, i64 264, !7, i64 268}
!11 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16}
!12 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3}
!13 = !{!"", !14, i64 0, !14, i64 2}
!14 = !{!"short", !7, i64 0}
!15 = !{!"", !7, i64 0, !16, i64 56}
!16 = !{!"double", !7, i64 0}
!17 = !{!"", !16, i64 0, !16, i64 8, !16, i64 16, !16, i64 24, !16, i64 32, !16, i64 40, !16, i64 48}
!18 = !{!"", !16, i64 0, !16, i64 8, !16, i64 16, !16, i64 24}
!19 = !{!"int", !7, i64 0}
!20 = !{!10, !7, i64 268}
!21 = !{!10, !6, i64 48}
!22 = !{!10, !6, i64 64}
!23 = !{!24, !19, i64 76}
!24 = !{!"", !25, i64 0, !26, i64 32, !27, i64 56, !19, i64 72, !28, i64 76}
!25 = !{!"gpio_t", !6, i64 0, !26, i64 8}
!26 = !{!"", !19, i64 0, !19, i64 4, !19, i64 8, !19, i64 12, !19, i64 16}
!27 = !{!"", !19, i64 0, !6, i64 8}
!28 = !{!"", !19, i64 0}
!29 = !{!10, !6, i64 72}


; 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 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @icm20649_fsm(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 264
  %3 = load i32, ptr %2, align 8, !tbaa !5
  switch i32 %3, label %49 [
    i32 0, label %4
    i32 1, label %5
    i32 2, label %18
    i32 3, label %27
    i32 4, label %45
  ]

4:                                                ; preds = %1
  tail call void @icm20649_write_reg(ptr noundef nonnull %0, i8 noundef zeroext 0, i8 noundef zeroext 6, i8 noundef zeroext -128)
  store i32 1, ptr %2, align 8, !tbaa !5
  tail call void @vTaskDelay(i32 noundef 100) #2
  br label %49

5:                                                ; preds = %1
  %6 = tail call zeroext i8 @icm20649_read_reg(ptr noundef nonnull %0, i8 noundef zeroext 0, i8 noundef zeroext 0)
  %7 = icmp eq i8 %6, -31
  br i1 %7, label %8, label %12

8:                                                ; preds = %5
  %9 = tail call zeroext i8 @icm20649_read_reg(ptr noundef nonnull %0, i8 noundef zeroext 0, i8 noundef zeroext 6)
  %10 = icmp eq i8 %9, 65
  br i1 %10, label %11, label %12

11:                                               ; preds = %8
  tail call void @icm20649_write_reg(ptr noundef nonnull %0, i8 noundef zeroext 0, i8 noundef zeroext 6, i8 noundef zeroext 1)
  tail call void @icm20649_write_reg(ptr noundef nonnull %0, i8 noundef zeroext 0, i8 noundef zeroext 3, i8 noundef zeroext 20)
  store i32 2, ptr %2, align 8, !tbaa !5
  br label %49

12:                                               ; preds = %8, %5
  store i32 0, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %0, i64 268
  %14 = load i8, ptr %13, align 4, !tbaa !19
  %15 = add i8 %14, 1
  store i8 %15, ptr %13, align 4, !tbaa !19
  %16 = icmp ugt i8 %15, 5
  br i1 %16, label %17, label %49

17:                                               ; preds = %12
  store i32 4, ptr %2, align 8, !tbaa !5
  tail call void (i8, ptr, ptr, ...) @log_module(i8 noundef zeroext 2, ptr noundef nonnull %0, ptr noundef nonnull @.str.1) #2
  tail call void (i8, ptr, ptr, ...) @log_module(i8 noundef zeroext 2, ptr noundef nonnull %0, ptr noundef nonnull @.str) #2
  store i8 0, ptr %13, align 4, !tbaa !19
  br label %49

18:                                               ; preds = %1
  %19 = tail call i32 @icm20649_configure(ptr noundef nonnull %0)
  %.not39 = icmp eq i32 %19, 0
  br i1 %.not39, label %21, label %20

20:                                               ; preds = %18
  tail call void @icm20649_fifo_reset(ptr noundef nonnull %0)
  tail call void (i8, ptr, ptr, ...) @log_module(i8 noundef zeroext 0, ptr noundef nonnull %0, ptr noundef nonnull @.str.2) #2
  store i32 3, ptr %2, align 8, !tbaa !5
  br label %49

21:                                               ; preds = %18
  tail call void (i8, ptr, ptr, ...) @log_module(i8 noundef zeroext 1, ptr noundef nonnull %0, ptr noundef nonnull @.str.3) #2
  %22 = getelementptr inbounds i8, ptr %0, i64 268
  %23 = load i8, ptr %22, align 4, !tbaa !19
  %24 = add i8 %23, 1
  store i8 %24, ptr %22, align 4, !tbaa !19
  %25 = icmp ugt i8 %24, 5
  br i1 %25, label %26, label %49

26:                                               ; preds = %21
  store i32 0, ptr %2, align 8, !tbaa !5
  tail call void (i8, ptr, ptr, ...) @log_module(i8 noundef zeroext 2, ptr noundef nonnull %0, ptr noundef nonnull @.str.4) #2
  tail call void (i8, ptr, ptr, ...) @log_module(i8 noundef zeroext 2, ptr noundef nonnull %0, ptr noundef nonnull @.str) #2
  store i8 0, ptr %22, align 4, !tbaa !19
  br label %49

27:                                               ; preds = %1
  %28 = getelementptr inbounds i8, ptr %0, i64 48
  %29 = load ptr, ptr %28, align 8, !tbaa !20
  %.not = icmp eq ptr %29, null
  br i1 %.not, label %34, label %30

30:                                               ; preds = %27
  %31 = getelementptr inbounds i8, ptr %0, i64 64
  %32 = load ptr, ptr %31, align 8, !tbaa !21
  %33 = tail call i64 @xQueueSemaphoreTake(ptr noundef %32, i32 noundef -1) #2
  br label %34

34:                                               ; preds = %30, %27
  %35 = tail call i32 @icm20649_fifo_read(ptr noundef nonnull %0, i16 noundef zeroext 1)
  tail call void @icm20649_temp_process(ptr noundef nonnull %0)
  tail call void @icm20649_accel_process(ptr noundef nonnull %0)
  tail call void @icm20649_gyro_process(ptr noundef nonnull %0)
  tail call void @icm20649_update_meas(ptr noundef nonnull %0)
  %36 = load ptr, ptr %28, align 8, !tbaa !20
  %.not38 = icmp eq ptr %36, null
  br i1 %.not38, label %41, label %37

37:                                               ; preds = %34
  %38 = getelementptr inbounds i8, ptr %36, i64 76
  %39 = load i32, ptr %38, align 4, !tbaa !22
  %40 = tail call i32 @irq_enable(i32 noundef %39) #2
  br label %41

41:                                               ; preds = %37, %34
  %42 = getelementptr inbounds i8, ptr %0, i64 72
  %43 = load ptr, ptr %42, align 8, !tbaa !28
  %44 = tail call i64 @xQueueGenericSend(ptr noundef %43, ptr noundef null, i32 noundef 0, i64 noundef 0) #2
  br label %49

45:                                               ; preds = %1
  %46 = getelementptr inbounds i8, ptr %0, i64 72
  %47 = load ptr, ptr %46, align 8, !tbaa !28
  %48 = tail call i64 @xQueueGenericSend(ptr noundef %47, ptr noundef null, i32 noundef 0, i64 noundef 0) #2
  tail call void @vTaskDelete(ptr noundef null) #2
  br label %49

49:                                               ; preds = %4, %41, %12, %17, %11, %21, %26, %20, %1, %45
  ret void
}

declare void @log_module(i8 noundef zeroext, ptr noundef, ptr noundef, ...) local_unnamed_addr #1

declare i64 @xQueueSemaphoreTake(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @icm20649_write_reg(ptr noundef, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #0

declare void @vTaskDelay(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i8 @icm20649_read_reg(ptr noundef, i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @icm20649_configure(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare hidden i32 @icm20649_fifo_read(ptr noundef, i16 noundef zeroext) local_unnamed_addr #0

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

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

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

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

declare i32 @irq_enable(i32 noundef) local_unnamed_addr #1

declare i64 @xQueueGenericSend(ptr noundef, ptr noundef, i32 noundef, i64 noundef) local_unnamed_addr #1

declare void @vTaskDelete(ptr 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, !18, i64 264}
!6 = !{!"", !7, i64 0, !9, i64 32, !10, i64 56, !9, i64 64, !11, i64 88, !12, i64 104, !14, i64 112, !16, i64 176, !17, i64 232, !18, i64 264, !7, i64 268}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3}
!12 = !{!"", !13, i64 0, !13, i64 2}
!13 = !{!"short", !7, i64 0}
!14 = !{!"", !7, i64 0, !15, i64 56}
!15 = !{!"double", !7, i64 0}
!16 = !{!"", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !15, i64 40, !15, i64 48}
!17 = !{!"", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24}
!18 = !{!"int", !7, i64 0}
!19 = !{!6, !7, i64 268}
!20 = !{!6, !10, i64 48}
!21 = !{!6, !10, i64 64}
!22 = !{!23, !18, i64 76}
!23 = !{!"", !24, i64 0, !25, i64 32, !26, i64 56, !18, i64 72, !27, i64 76}
!24 = !{!"gpio_t", !10, i64 0, !25, i64 8}
!25 = !{!"", !18, i64 0, !18, i64 4, !18, i64 8, !18, i64 12, !18, i64 16}
!26 = !{!"", !18, i64 0, !10, i64 8}
!27 = !{!"", !18, i64 0}
!28 = !{!6, !10, i64 72}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass