; LLVM IR from ctlst-tech/catpilot :: bsp/mcu/periph/i2c/stm32 (i2c)

; 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.i2c_t = type { %struct.__I2C_HandleTypeDef, ptr, ptr, %struct.dma_t, %struct.dma_t, i32, i32, %struct.i2c_private_t }
%struct.__I2C_HandleTypeDef = type { ptr, %struct.I2C_InitTypeDef, ptr, i16, i16, i32, i32, ptr, ptr, ptr, i32, i32, i32, i32, i32 }
%struct.I2C_InitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.dma_t = type { %struct.__DMA_HandleTypeDef, i32, %struct.dma_private_t }
%struct.__DMA_HandleTypeDef = type { ptr, %struct.DMA_InitTypeDef, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i32, ptr, ptr, i32 }
%struct.DMA_InitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.dma_private_t = type { i32 }
%struct.i2c_private_t = type { i32, i32, ptr, ptr, ptr, i32 }

; Function Attrs: nounwind uwtable
define dso_local i32 @i2c_init(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 0, ptr %4, align 4, !tbaa !9
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = icmp eq ptr %6, null
  br i1 %7, label %8, label %9

8:                                                ; preds = %1
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

9:                                                ; preds = %1
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = call i32 @i2c_id_init(ptr noundef %10)
  store i32 %11, ptr %4, align 4, !tbaa !9
  %12 = icmp ne i32 %11, 0
  br i1 %12, label %13, label %15

13:                                               ; preds = %9
  %14 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %14, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

15:                                               ; preds = %9
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = call i32 @i2c_clock_init(ptr noundef %16)
  store i32 %17, ptr %4, align 4, !tbaa !9
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %19, label %21

19:                                               ; preds = %15
  %20 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %20, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

21:                                               ; preds = %15
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.i2c_t, ptr %22, i32 0, i32 2
  %24 = load ptr, ptr %23, align 8, !tbaa !11
  %25 = call i32 @gpio_init(ptr noundef %24)
  store i32 %25, ptr %4, align 4, !tbaa !9
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %27, label %29

27:                                               ; preds = %21
  %28 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %28, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

29:                                               ; preds = %21
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.i2c_t, ptr %30, i32 0, i32 1
  %32 = load ptr, ptr %31, align 8, !tbaa !21
  %33 = call i32 @gpio_init(ptr noundef %32)
  store i32 %33, ptr %4, align 4, !tbaa !9
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %37

35:                                               ; preds = %29
  %36 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %36, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

37:                                               ; preds = %29
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.i2c_t, ptr %38, i32 0, i32 3
  %40 = getelementptr inbounds %struct.dma_t, ptr %39, i32 0, i32 0
  %41 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %40, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8, !tbaa !22
  %43 = icmp ne ptr %42, null
  br i1 %43, label %44, label %92

44:                                               ; preds = %37
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.i2c_t, ptr %45, i32 0, i32 4
  %47 = getelementptr inbounds %struct.dma_t, ptr %46, i32 0, i32 0
  %48 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %47, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !23
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %92

51:                                               ; preds = %44
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.i2c_t, ptr %52, i32 0, i32 0
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.i2c_t, ptr %54, i32 0, i32 3
  %56 = getelementptr inbounds %struct.dma_t, ptr %55, i32 0, i32 0
  %57 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %56, i32 0, i32 4
  store ptr %53, ptr %57, align 8, !tbaa !24
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.i2c_t, ptr %58, i32 0, i32 0
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.i2c_t, ptr %60, i32 0, i32 4
  %62 = getelementptr inbounds %struct.dma_t, ptr %61, i32 0, i32 0
  %63 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %62, i32 0, i32 4
  store ptr %59, ptr %63, align 8, !tbaa !25
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.i2c_t, ptr %64, i32 0, i32 3
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = call i32 @dma_init(ptr noundef %65, ptr noundef @i2c_dma_tx_handler, ptr noundef %66)
  store i32 %67, ptr %4, align 4, !tbaa !9
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %71

69:                                               ; preds = %51
  %70 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %70, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

71:                                               ; preds = %51
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.i2c_t, ptr %72, i32 0, i32 4
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = call i32 @dma_init(ptr noundef %73, ptr noundef @i2c_dma_rx_handler, ptr noundef %74)
  store i32 %75, ptr %4, align 4, !tbaa !9
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %77, label %79

77:                                               ; preds = %71
  %78 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %78, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

79:                                               ; preds = %71
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.i2c_t, ptr %80, i32 0, i32 3
  %82 = getelementptr inbounds %struct.dma_t, ptr %81, i32 0, i32 0
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.i2c_t, ptr %83, i32 0, i32 0
  %85 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %84, i32 0, i32 8
  store ptr %82, ptr %85, align 8, !tbaa !26
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.i2c_t, ptr %86, i32 0, i32 4
  %88 = getelementptr inbounds %struct.dma_t, ptr %87, i32 0, i32 0
  %89 = load ptr, ptr %3, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.i2c_t, ptr %89, i32 0, i32 0
  %91 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %90, i32 0, i32 9
  store ptr %88, ptr %91, align 8, !tbaa !27
  br label %92

92:                                               ; preds = %79, %44, %37
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.i2c_t, ptr %93, i32 0, i32 0
  %95 = call i32 @HAL_I2C_Init(ptr noundef %94)
  store i32 %95, ptr %4, align 4, !tbaa !9
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %99

97:                                               ; preds = %92
  %98 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %98, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

99:                                               ; preds = %92
  %100 = load ptr, ptr %3, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.i2c_t, ptr %100, i32 0, i32 0
  %102 = call i32 @HAL_I2CEx_ConfigAnalogFilter(ptr noundef %101, i32 noundef 0)
  store i32 %102, ptr %4, align 4, !tbaa !9
  %103 = icmp ne i32 %102, 0
  br i1 %103, label %104, label %106

104:                                              ; preds = %99
  %105 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %105, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

106:                                              ; preds = %99
  %107 = load ptr, ptr %3, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.i2c_t, ptr %107, i32 0, i32 0
  %109 = call i32 @HAL_I2CEx_ConfigDigitalFilter(ptr noundef %108, i32 noundef 0)
  store i32 %109, ptr %4, align 4, !tbaa !9
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %111, label %113

111:                                              ; preds = %106
  %112 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %112, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

113:                                              ; preds = %106
  %114 = load ptr, ptr %3, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.i2c_t, ptr %114, i32 0, i32 7
  %116 = getelementptr inbounds %struct.i2c_private_t, ptr %115, i32 0, i32 0
  %117 = load i32, ptr %116, align 8, !tbaa !28
  %118 = load ptr, ptr %3, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.i2c_t, ptr %118, i32 0, i32 6
  %120 = load i32, ptr %119, align 4, !tbaa !29
  %121 = load ptr, ptr %3, align 8, !tbaa !5
  %122 = call i32 @irq_init(i32 noundef %117, i32 noundef %120, ptr noundef @i2c_ev_handler, ptr noundef %121)
  store i32 %122, ptr %4, align 4, !tbaa !9
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %126

124:                                              ; preds = %113
  %125 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %125, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

126:                                              ; preds = %113
  %127 = load ptr, ptr %3, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.i2c_t, ptr %127, i32 0, i32 7
  %129 = getelementptr inbounds %struct.i2c_private_t, ptr %128, i32 0, i32 1
  %130 = load i32, ptr %129, align 4, !tbaa !30
  %131 = load ptr, ptr %3, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.i2c_t, ptr %131, i32 0, i32 6
  %133 = load i32, ptr %132, align 4, !tbaa !29
  %134 = load ptr, ptr %3, align 8, !tbaa !5
  %135 = call i32 @irq_init(i32 noundef %130, i32 noundef %133, ptr noundef @i2c_er_handler, ptr noundef %134)
  store i32 %135, ptr %4, align 4, !tbaa !9
  %136 = icmp ne i32 %135, 0
  br i1 %136, label %137, label %139

137:                                              ; preds = %126
  %138 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %138, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

139:                                              ; preds = %126
  %140 = load ptr, ptr %3, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.i2c_t, ptr %140, i32 0, i32 7
  %142 = getelementptr inbounds %struct.i2c_private_t, ptr %141, i32 0, i32 0
  %143 = load i32, ptr %142, align 8, !tbaa !28
  %144 = call i32 @irq_enable(i32 noundef %143)
  store i32 %144, ptr %4, align 4, !tbaa !9
  %145 = icmp ne i32 %144, 0
  br i1 %145, label %146, label %148

146:                                              ; preds = %139
  %147 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %147, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

148:                                              ; preds = %139
  %149 = load ptr, ptr %3, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.i2c_t, ptr %149, i32 0, i32 7
  %151 = getelementptr inbounds %struct.i2c_private_t, ptr %150, i32 0, i32 1
  %152 = load i32, ptr %151, align 4, !tbaa !30
  %153 = call i32 @irq_enable(i32 noundef %152)
  store i32 %153, ptr %4, align 4, !tbaa !9
  %154 = icmp ne i32 %153, 0
  br i1 %154, label %155, label %157

155:                                              ; preds = %148
  %156 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %156, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

157:                                              ; preds = %148
  %158 = call ptr @xQueueCreateMutex(i8 noundef zeroext 1)
  %159 = load ptr, ptr %3, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.i2c_t, ptr %159, i32 0, i32 7
  %161 = getelementptr inbounds %struct.i2c_private_t, ptr %160, i32 0, i32 3
  store ptr %158, ptr %161, align 8, !tbaa !31
  %162 = load ptr, ptr %3, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.i2c_t, ptr %162, i32 0, i32 7
  %164 = getelementptr inbounds %struct.i2c_private_t, ptr %163, i32 0, i32 3
  %165 = load ptr, ptr %164, align 8, !tbaa !31
  %166 = icmp eq ptr %165, null
  br i1 %166, label %167, label %168

167:                                              ; preds = %157
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

168:                                              ; preds = %157
  %169 = call ptr @xQueueCreateMutex(i8 noundef zeroext 1)
  %170 = load ptr, ptr %3, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.i2c_t, ptr %170, i32 0, i32 7
  %172 = getelementptr inbounds %struct.i2c_private_t, ptr %171, i32 0, i32 4
  store ptr %169, ptr %172, align 8, !tbaa !32
  %173 = load ptr, ptr %3, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.i2c_t, ptr %173, i32 0, i32 7
  %175 = getelementptr inbounds %struct.i2c_private_t, ptr %174, i32 0, i32 4
  %176 = load ptr, ptr %175, align 8, !tbaa !32
  %177 = icmp eq ptr %176, null
  br i1 %177, label %178, label %179

178:                                              ; preds = %168
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

179:                                              ; preds = %168
  %180 = call ptr @xQueueGenericCreate(i64 noundef 1, i64 noundef 0, i8 noundef zeroext 3)
  %181 = load ptr, ptr %3, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.i2c_t, ptr %181, i32 0, i32 7
  %183 = getelementptr inbounds %struct.i2c_private_t, ptr %182, i32 0, i32 2
  store ptr %180, ptr %183, align 8, !tbaa !33
  %184 = load ptr, ptr %3, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.i2c_t, ptr %184, i32 0, i32 7
  %186 = getelementptr inbounds %struct.i2c_private_t, ptr %185, i32 0, i32 2
  %187 = load ptr, ptr %186, align 8, !tbaa !33
  %188 = icmp eq ptr %187, null
  br i1 %188, label %189, label %190

189:                                              ; preds = %179
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

190:                                              ; preds = %179
  %191 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %191, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %192

192:                                              ; preds = %190, %189, %178, %167, %155, %146, %137, %124, %111, %104, %97, %77, %69, %35, %27, %19, %13, %8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  %193 = load i32, ptr %2, align 4
  ret i32 %193
}

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

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

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

declare i32 @gpio_init(ptr noundef) #2

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

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

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

declare i32 @HAL_I2C_Init(ptr noundef) #2

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

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

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

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

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

declare i32 @irq_enable(i32 noundef) #2

declare ptr @xQueueCreateMutex(i8 noundef zeroext) #2

declare ptr @xQueueGenericCreate(i64 noundef, i64 noundef, i8 noundef zeroext) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 120}
!12 = !{!"", !13, i64 0, !6, i64 112, !6, i64 120, !16, i64 128, !16, i64 320, !10, i64 512, !10, i64 516, !20, i64 520}
!13 = !{!"__I2C_HandleTypeDef", !6, i64 0, !14, i64 8, !6, i64 40, !15, i64 48, !15, i64 50, !10, i64 52, !10, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104}
!14 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!15 = !{!"short", !7, i64 0}
!16 = !{!"", !17, i64 0, !10, i64 184, !19, i64 188}
!17 = !{!"__DMA_HandleTypeDef", !6, i64 0, !18, i64 8, !10, i64 56, !10, i64 60, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !10, i64 120, !10, i64 124, !10, i64 128, !6, i64 136, !6, i64 144, !10, i64 152, !6, i64 160, !6, i64 168, !10, i64 176}
!18 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44}
!19 = !{!"", !10, i64 0}
!20 = !{!"", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32}
!21 = !{!12, !6, i64 112}
!22 = !{!12, !6, i64 128}
!23 = !{!12, !6, i64 320}
!24 = !{!12, !6, i64 192}
!25 = !{!12, !6, i64 384}
!26 = !{!12, !6, i64 72}
!27 = !{!12, !6, i64 80}
!28 = !{!12, !10, i64 520}
!29 = !{!12, !10, i64 516}
!30 = !{!12, !10, i64 524}
!31 = !{!12, !6, i64 536}
!32 = !{!12, !6, i64 544}
!33 = !{!12, !6, i64 528}


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

; Function Attrs: nounwind uwtable
define dso_local i32 @i2c_init(ptr noundef %0) local_unnamed_addr #0 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %65, label %3

3:                                                ; preds = %1
  %4 = tail call i32 @i2c_id_init(ptr noundef nonnull %0)
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %5, label %65

5:                                                ; preds = %3
  %6 = tail call i32 @i2c_clock_init(ptr noundef nonnull %0)
  %.not64 = icmp eq i32 %6, 0
  br i1 %.not64, label %7, label %65

7:                                                ; preds = %5
  %8 = getelementptr inbounds i8, ptr %0, i64 120
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = tail call i32 @gpio_init(ptr noundef %9) #2
  %.not65 = icmp eq i32 %10, 0
  br i1 %.not65, label %11, label %65

11:                                               ; preds = %7
  %12 = getelementptr inbounds i8, ptr %0, i64 112
  %13 = load ptr, ptr %12, align 8, !tbaa !19
  %14 = tail call i32 @gpio_init(ptr noundef %13) #2
  %.not66 = icmp eq i32 %14, 0
  br i1 %.not66, label %15, label %65

15:                                               ; preds = %11
  %16 = getelementptr inbounds i8, ptr %0, i64 128
  %17 = load ptr, ptr %16, align 8, !tbaa !20
  %.not67 = icmp eq ptr %17, null
  br i1 %.not67, label %30, label %18

18:                                               ; preds = %15
  %19 = getelementptr inbounds i8, ptr %0, i64 320
  %20 = load ptr, ptr %19, align 8, !tbaa !21
  %.not68 = icmp eq ptr %20, null
  br i1 %.not68, label %30, label %21

21:                                               ; preds = %18
  %22 = getelementptr inbounds i8, ptr %0, i64 192
  store ptr %0, ptr %22, align 8, !tbaa !22
  %23 = getelementptr inbounds i8, ptr %0, i64 384
  store ptr %0, ptr %23, align 8, !tbaa !23
  %24 = tail call i32 @dma_init(ptr noundef nonnull %16, ptr noundef nonnull @i2c_dma_tx_handler, ptr noundef nonnull %0) #2
  %.not69 = icmp eq i32 %24, 0
  br i1 %.not69, label %25, label %65

25:                                               ; preds = %21
  %26 = tail call i32 @dma_init(ptr noundef nonnull %19, ptr noundef nonnull @i2c_dma_rx_handler, ptr noundef nonnull %0) #2
  %.not70 = icmp eq i32 %26, 0
  br i1 %.not70, label %27, label %65

27:                                               ; preds = %25
  %28 = getelementptr inbounds i8, ptr %0, i64 72
  store ptr %16, ptr %28, align 8, !tbaa !24
  %29 = getelementptr inbounds i8, ptr %0, i64 80
  store ptr %19, ptr %29, align 8, !tbaa !25
  br label %30

30:                                               ; preds = %27, %18, %15
  %31 = tail call i32 @HAL_I2C_Init(ptr noundef nonnull %0) #2
  %.not71 = icmp eq i32 %31, 0
  br i1 %.not71, label %32, label %65

32:                                               ; preds = %30
  %33 = tail call i32 @HAL_I2CEx_ConfigAnalogFilter(ptr noundef nonnull %0, i32 noundef 0) #2
  %.not72 = icmp eq i32 %33, 0
  br i1 %.not72, label %34, label %65

34:                                               ; preds = %32
  %35 = tail call i32 @HAL_I2CEx_ConfigDigitalFilter(ptr noundef nonnull %0, i32 noundef 0) #2
  %.not73 = icmp eq i32 %35, 0
  br i1 %.not73, label %36, label %65

36:                                               ; preds = %34
  %37 = getelementptr inbounds i8, ptr %0, i64 520
  %38 = load i32, ptr %37, align 8, !tbaa !26
  %39 = getelementptr inbounds i8, ptr %0, i64 516
  %40 = load i32, ptr %39, align 4, !tbaa !27
  %41 = tail call i32 @irq_init(i32 noundef %38, i32 noundef %40, ptr noundef nonnull @i2c_ev_handler, ptr noundef nonnull %0) #2
  %.not74 = icmp eq i32 %41, 0
  br i1 %.not74, label %42, label %65

42:                                               ; preds = %36
  %43 = getelementptr inbounds i8, ptr %0, i64 524
  %44 = load i32, ptr %43, align 4, !tbaa !28
  %45 = load i32, ptr %39, align 4, !tbaa !27
  %46 = tail call i32 @irq_init(i32 noundef %44, i32 noundef %45, ptr noundef nonnull @i2c_er_handler, ptr noundef nonnull %0) #2
  %.not75 = icmp eq i32 %46, 0
  br i1 %.not75, label %47, label %65

47:                                               ; preds = %42
  %48 = load i32, ptr %37, align 8, !tbaa !26
  %49 = tail call i32 @irq_enable(i32 noundef %48) #2
  %.not76 = icmp eq i32 %49, 0
  br i1 %.not76, label %50, label %65

50:                                               ; preds = %47
  %51 = load i32, ptr %43, align 4, !tbaa !28
  %52 = tail call i32 @irq_enable(i32 noundef %51) #2
  %.not77 = icmp eq i32 %52, 0
  br i1 %.not77, label %53, label %65

53:                                               ; preds = %50
  %54 = tail call ptr @xQueueCreateMutex(i8 noundef zeroext 1) #2
  %55 = getelementptr inbounds i8, ptr %0, i64 536
  store ptr %54, ptr %55, align 8, !tbaa !29
  %56 = icmp eq ptr %54, null
  br i1 %56, label %65, label %57

57:                                               ; preds = %53
  %58 = tail call ptr @xQueueCreateMutex(i8 noundef zeroext 1) #2
  %59 = getelementptr inbounds i8, ptr %0, i64 544
  store ptr %58, ptr %59, align 8, !tbaa !30
  %60 = icmp eq ptr %58, null
  br i1 %60, label %65, label %61

61:                                               ; preds = %57
  %62 = tail call ptr @xQueueGenericCreate(i64 noundef 1, i64 noundef 0, i8 noundef zeroext 3) #2
  %63 = getelementptr inbounds i8, ptr %0, i64 528
  store ptr %62, ptr %63, align 8, !tbaa !31
  %64 = icmp eq ptr %62, null
  %. = sext i1 %64 to i32
  br label %65

65:                                               ; preds = %61, %57, %53, %50, %47, %42, %36, %34, %32, %30, %25, %21, %11, %7, %5, %3, %1
  %.0 = phi i32 [ -1, %1 ], [ %4, %3 ], [ %6, %5 ], [ %10, %7 ], [ %14, %11 ], [ %24, %21 ], [ %26, %25 ], [ %31, %30 ], [ %33, %32 ], [ %35, %34 ], [ %41, %36 ], [ %46, %42 ], [ %49, %47 ], [ %52, %50 ], [ -1, %53 ], [ -1, %57 ], [ %., %61 ]
  ret i32 %.0
}

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

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

declare i32 @gpio_init(ptr noundef) local_unnamed_addr #1

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

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

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

declare i32 @HAL_I2C_Init(ptr noundef) local_unnamed_addr #1

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

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

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

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

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

declare i32 @irq_enable(i32 noundef) local_unnamed_addr #1

declare ptr @xQueueCreateMutex(i8 noundef zeroext) local_unnamed_addr #1

declare ptr @xQueueGenericCreate(i64 noundef, i64 noundef, i8 noundef zeroext) 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, !8, i64 120}
!6 = !{!"", !7, i64 0, !8, i64 112, !8, i64 120, !14, i64 128, !14, i64 320, !12, i64 512, !12, i64 516, !18, i64 520}
!7 = !{!"__I2C_HandleTypeDef", !8, i64 0, !11, i64 8, !8, i64 40, !13, i64 48, !13, i64 50, !12, i64 52, !12, i64 56, !8, i64 64, !8, i64 72, !8, i64 80, !12, i64 88, !12, i64 92, !12, i64 96, !12, i64 100, !12, i64 104}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28}
!12 = !{!"int", !9, i64 0}
!13 = !{!"short", !9, i64 0}
!14 = !{!"", !15, i64 0, !12, i64 184, !17, i64 188}
!15 = !{!"__DMA_HandleTypeDef", !8, i64 0, !16, i64 8, !12, i64 56, !12, i64 60, !8, i64 64, !8, i64 72, !8, i64 80, !8, i64 88, !8, i64 96, !8, i64 104, !8, i64 112, !12, i64 120, !12, i64 124, !12, i64 128, !8, i64 136, !8, i64 144, !12, i64 152, !8, i64 160, !8, i64 168, !12, i64 176}
!16 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44}
!17 = !{!"", !12, i64 0}
!18 = !{!"", !12, i64 0, !12, i64 4, !8, i64 8, !8, i64 16, !8, i64 24, !12, i64 32}
!19 = !{!6, !8, i64 112}
!20 = !{!6, !8, i64 128}
!21 = !{!6, !8, i64 320}
!22 = !{!6, !8, i64 192}
!23 = !{!6, !8, i64 384}
!24 = !{!6, !8, i64 72}
!25 = !{!6, !8, i64 80}
!26 = !{!6, !12, i64 520}
!27 = !{!6, !12, i64 516}
!28 = !{!6, !12, i64 524}
!29 = !{!6, !8, i64 536}
!30 = !{!6, !8, i64 544}
!31 = !{!6, !8, i64 528}


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