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

; 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.file_operations = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.can_t = type { [32 x i8], [32 x i8], %struct.FDCAN_HandleTypeDef, ptr, ptr, i32, i32, i32, i32, i32, i32, %struct.can_private_t }
%struct.FDCAN_HandleTypeDef = type { ptr, ptr, %struct.FDCAN_InitTypeDef, %struct.FDCAN_MsgRamAddressTypeDef, i32, i32, i32, i32 }
%struct.FDCAN_InitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.FDCAN_MsgRamAddressTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.can_private_t = type { i32, i32, ptr, ptr, ptr, ptr, i32, i8, i32, [32 x ptr], ptr, ptr }

@FreeRTOS_errno = external global i32, align 4
@.str = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @can_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
  %6 = alloca %struct.file_operations, align 8
  %7 = alloca [32 x i8], align 16
  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
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = icmp eq ptr %8, null
  br i1 %9, label %10, label %11

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

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

15:                                               ; preds = %11
  %16 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %16, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

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

21:                                               ; preds = %17
  %22 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %22, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

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

29:                                               ; preds = %23
  %30 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %30, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

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

37:                                               ; preds = %31
  %38 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %38, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

39:                                               ; preds = %31
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.can_t, ptr %40, i32 0, i32 2
  %42 = call i32 @HAL_FDCAN_Init(ptr noundef %41)
  store i32 %42, ptr %4, align 4, !tbaa !9
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %46

44:                                               ; preds = %39
  %45 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %45, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

46:                                               ; preds = %39
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.can_t, ptr %47, i32 0, i32 11
  %49 = getelementptr inbounds %struct.can_private_t, ptr %48, i32 0, i32 0
  %50 = load i32, ptr %49, align 8, !tbaa !19
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.can_t, ptr %51, i32 0, i32 7
  %53 = load i32, ptr %52, align 8, !tbaa !20
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = call i32 @irq_init(i32 noundef %50, i32 noundef %53, ptr noundef @can_it_handler, ptr noundef %54)
  store i32 %55, ptr %4, align 4, !tbaa !9
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %57, label %59

57:                                               ; preds = %46
  %58 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %58, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

59:                                               ; preds = %46
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.can_t, ptr %60, i32 0, i32 11
  %62 = getelementptr inbounds %struct.can_private_t, ptr %61, i32 0, i32 1
  %63 = load i32, ptr %62, align 4, !tbaa !21
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.can_t, ptr %64, i32 0, i32 7
  %66 = load i32, ptr %65, align 8, !tbaa !20
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = call i32 @irq_init(i32 noundef %63, i32 noundef %66, ptr noundef @can_it_handler, ptr noundef %67)
  store i32 %68, ptr %4, align 4, !tbaa !9
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %70, label %72

70:                                               ; preds = %59
  %71 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %71, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

72:                                               ; preds = %59
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.can_t, ptr %73, i32 0, i32 11
  %75 = getelementptr inbounds %struct.can_private_t, ptr %74, i32 0, i32 0
  %76 = load i32, ptr %75, align 8, !tbaa !19
  %77 = call i32 @irq_enable(i32 noundef %76)
  store i32 %77, ptr %4, align 4, !tbaa !9
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %81

79:                                               ; preds = %72
  %80 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %80, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

81:                                               ; preds = %72
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.can_t, ptr %82, i32 0, i32 11
  %84 = getelementptr inbounds %struct.can_private_t, ptr %83, i32 0, i32 1
  %85 = load i32, ptr %84, align 4, !tbaa !21
  %86 = call i32 @irq_enable(i32 noundef %85)
  store i32 %86, ptr %4, align 4, !tbaa !9
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %88, label %90

88:                                               ; preds = %81
  %89 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %89, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

90:                                               ; preds = %81
  %91 = call ptr @xQueueCreateMutex(i8 noundef zeroext 1)
  %92 = load ptr, ptr %3, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.can_t, ptr %92, i32 0, i32 11
  %94 = getelementptr inbounds %struct.can_private_t, ptr %93, i32 0, i32 4
  store ptr %91, ptr %94, align 8, !tbaa !22
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.can_t, ptr %95, i32 0, i32 11
  %97 = getelementptr inbounds %struct.can_private_t, ptr %96, i32 0, i32 4
  %98 = load ptr, ptr %97, align 8, !tbaa !22
  %99 = icmp eq ptr %98, null
  br i1 %99, label %100, label %101

100:                                              ; preds = %90
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

101:                                              ; preds = %90
  %102 = call ptr @xQueueGenericCreate(i64 noundef 1, i64 noundef 0, i8 noundef zeroext 3)
  %103 = load ptr, ptr %3, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.can_t, ptr %103, i32 0, i32 11
  %105 = getelementptr inbounds %struct.can_private_t, ptr %104, i32 0, i32 2
  store ptr %102, ptr %105, align 8, !tbaa !23
  %106 = load ptr, ptr %3, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.can_t, ptr %106, i32 0, i32 11
  %108 = getelementptr inbounds %struct.can_private_t, ptr %107, i32 0, i32 2
  %109 = load ptr, ptr %108, align 8, !tbaa !23
  %110 = icmp eq ptr %109, null
  br i1 %110, label %111, label %112

111:                                              ; preds = %101
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

112:                                              ; preds = %101
  %113 = call ptr @xQueueCreateMutex(i8 noundef zeroext 1)
  %114 = load ptr, ptr %3, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.can_t, ptr %114, i32 0, i32 11
  %116 = getelementptr inbounds %struct.can_private_t, ptr %115, i32 0, i32 5
  store ptr %113, ptr %116, align 8, !tbaa !24
  %117 = load ptr, ptr %3, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.can_t, ptr %117, i32 0, i32 11
  %119 = getelementptr inbounds %struct.can_private_t, ptr %118, i32 0, i32 5
  %120 = load ptr, ptr %119, align 8, !tbaa !24
  %121 = icmp eq ptr %120, null
  br i1 %121, label %122, label %123

122:                                              ; preds = %112
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

123:                                              ; preds = %112
  %124 = call ptr @xQueueGenericCreate(i64 noundef 1, i64 noundef 0, i8 noundef zeroext 3)
  %125 = load ptr, ptr %3, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.can_t, ptr %125, i32 0, i32 11
  %127 = getelementptr inbounds %struct.can_private_t, ptr %126, i32 0, i32 3
  store ptr %124, ptr %127, align 8, !tbaa !25
  %128 = load ptr, ptr %3, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.can_t, ptr %128, i32 0, i32 11
  %130 = getelementptr inbounds %struct.can_private_t, ptr %129, i32 0, i32 3
  %131 = load ptr, ptr %130, align 8, !tbaa !25
  %132 = icmp eq ptr %131, null
  br i1 %132, label %133, label %134

133:                                              ; preds = %123
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

134:                                              ; preds = %123
  %135 = call ptr @xQueueCreateMutex(i8 noundef zeroext 1)
  %136 = load ptr, ptr %3, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.can_t, ptr %136, i32 0, i32 11
  %138 = getelementptr inbounds %struct.can_private_t, ptr %137, i32 0, i32 10
  store ptr %135, ptr %138, align 8, !tbaa !26
  %139 = load ptr, ptr %3, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.can_t, ptr %139, i32 0, i32 11
  %141 = getelementptr inbounds %struct.can_private_t, ptr %140, i32 0, i32 10
  %142 = load ptr, ptr %141, align 8, !tbaa !26
  %143 = icmp eq ptr %142, null
  br i1 %143, label %144, label %145

144:                                              ; preds = %134
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

145:                                              ; preds = %134
  %146 = load ptr, ptr %3, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.can_t, ptr %146, i32 0, i32 9
  %148 = load i32, ptr %147, align 8, !tbaa !27
  %149 = sext i32 %148 to i64
  %150 = call ptr @xQueueGenericCreate(i64 noundef %149, i64 noundef 32, i8 noundef zeroext 0)
  %151 = load ptr, ptr %3, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.can_t, ptr %151, i32 0, i32 11
  %153 = getelementptr inbounds %struct.can_private_t, ptr %152, i32 0, i32 11
  store ptr %150, ptr %153, align 8, !tbaa !28
  %154 = load ptr, ptr %3, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.can_t, ptr %154, i32 0, i32 11
  %156 = getelementptr inbounds %struct.can_private_t, ptr %155, i32 0, i32 11
  %157 = load ptr, ptr %156, align 8, !tbaa !28
  %158 = icmp eq ptr %157, null
  br i1 %158, label %159, label %160

159:                                              ; preds = %145
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

160:                                              ; preds = %145
  %161 = load ptr, ptr %3, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.can_t, ptr %161, i32 0, i32 2
  %163 = call i32 @HAL_FDCAN_Start(ptr noundef %162)
  store i32 %163, ptr %4, align 4, !tbaa !9
  %164 = icmp ne i32 %163, 0
  br i1 %164, label %165, label %167

165:                                              ; preds = %160
  %166 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %166, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

167:                                              ; preds = %160
  %168 = load ptr, ptr %3, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.can_t, ptr %168, i32 0, i32 2
  %170 = call i32 @HAL_FDCAN_ActivateNotification(ptr noundef %169, i32 noundef 432014079, i32 noundef -1)
  store i32 %170, ptr %4, align 4, !tbaa !9
  %171 = icmp ne i32 %170, 0
  br i1 %171, label %172, label %174

172:                                              ; preds = %167
  %173 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %173, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

174:                                              ; preds = %167
  %175 = load ptr, ptr %3, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.can_t, ptr %175, i32 0, i32 11
  %177 = getelementptr inbounds %struct.can_private_t, ptr %176, i32 0, i32 3
  %178 = load ptr, ptr %177, align 8, !tbaa !25
  %179 = call i64 @xQueueSemaphoreTake(ptr noundef %178, i32 noundef 0)
  %180 = load ptr, ptr %3, align 8, !tbaa !5
  %181 = call i32 @can_start_service(ptr noundef %180)
  %182 = icmp ne i32 %181, 0
  br i1 %182, label %183, label %184

183:                                              ; preds = %174
  store i32 6, ptr @FreeRTOS_errno, align 4, !tbaa !9
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %212

184:                                              ; preds = %174
  call void @llvm.lifetime.start.p0(i64 88, ptr %6) #3
  %185 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 0
  store ptr @can_open, ptr %185, align 8, !tbaa !29
  %186 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 1
  store ptr @can_write, ptr %186, align 8, !tbaa !31
  %187 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 2
  store ptr @can_read, ptr %187, align 8, !tbaa !32
  %188 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 3
  store ptr @can_close, ptr %188, align 8, !tbaa !33
  %189 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 4
  store ptr @can_ioctl, ptr %189, align 8, !tbaa !34
  %190 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 5
  store ptr null, ptr %190, align 8, !tbaa !35
  %191 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 6
  store ptr null, ptr %191, align 8, !tbaa !36
  %192 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 7
  store ptr null, ptr %192, align 8, !tbaa !37
  %193 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 8
  store ptr null, ptr %193, align 8, !tbaa !38
  %194 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 9
  store ptr null, ptr %194, align 8, !tbaa !39
  %195 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 10
  %196 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %196, ptr %195, align 8, !tbaa !40
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #3
  %197 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %198 = load ptr, ptr %3, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.can_t, ptr %198, i32 0, i32 0
  %200 = getelementptr inbounds [32 x i8], ptr %199, i64 0, i64 0
  %201 = call i32 (ptr, ptr, ...) @sprintf_(ptr noundef %197, ptr noundef @.str, ptr noundef %200)
  %202 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %203 = call ptr @node_mount(ptr noundef %202, ptr noundef %6)
  %204 = icmp eq ptr %203, null
  br i1 %204, label %205, label %206

205:                                              ; preds = %184
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %211

206:                                              ; preds = %184
  %207 = load ptr, ptr %3, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.can_t, ptr %207, i32 0, i32 11
  %209 = getelementptr inbounds %struct.can_private_t, ptr %208, i32 0, i32 7
  store i8 1, ptr %209, align 4, !tbaa !41
  %210 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %210, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %211

211:                                              ; preds = %206, %205
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 88, ptr %6) #3
  br label %212

212:                                              ; preds = %211, %183, %172, %165, %159, %144, %133, %122, %111, %100, %88, %79, %70, %57, %44, %37, %29, %21, %15, %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  %213 = load i32, ptr %2, align 4
  ret i32 %213
}

; 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 @can_id_init(ptr noundef) #0

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

declare i32 @gpio_init(ptr noundef) #2

declare i32 @HAL_FDCAN_Init(ptr noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local void @can_it_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

declare i32 @HAL_FDCAN_Start(ptr noundef) #2

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

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

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

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

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

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

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

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

declare i32 @sprintf_(ptr noundef, ptr noundef, ...) #2

declare ptr @node_mount(ptr 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

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 248}
!12 = !{!"", !7, i64 0, !7, i64 32, !13, i64 64, !6, i64 248, !6, i64 256, !10, i64 264, !10, i64 268, !10, i64 272, !10, i64 276, !10, i64 280, !10, i64 284, !16, i64 288}
!13 = !{!"", !6, i64 0, !6, i64 8, !14, i64 16, !15, i64 124, !10, i64 164, !10, i64 168, !10, i64 172, !10, i64 176}
!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, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104}
!15 = !{!"", !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}
!16 = !{!"", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !10, i64 40, !17, i64 44, !10, i64 48, !7, i64 56, !6, i64 312, !6, i64 320}
!17 = !{!"_Bool", !7, i64 0}
!18 = !{!12, !6, i64 256}
!19 = !{!12, !10, i64 288}
!20 = !{!12, !10, i64 272}
!21 = !{!12, !10, i64 292}
!22 = !{!12, !6, i64 312}
!23 = !{!12, !6, i64 296}
!24 = !{!12, !6, i64 320}
!25 = !{!12, !6, i64 304}
!26 = !{!12, !6, i64 600}
!27 = !{!12, !10, i64 280}
!28 = !{!12, !6, i64 608}
!29 = !{!30, !6, i64 0}
!30 = !{!"file_operations", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80}
!31 = !{!30, !6, i64 8}
!32 = !{!30, !6, i64 16}
!33 = !{!30, !6, i64 24}
!34 = !{!30, !6, i64 32}
!35 = !{!30, !6, i64 40}
!36 = !{!30, !6, i64 48}
!37 = !{!30, !6, i64 56}
!38 = !{!30, !6, i64 64}
!39 = !{!30, !6, i64 72}
!40 = !{!30, !6, i64 80}
!41 = !{!12, !17, i64 332}


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

@FreeRTOS_errno = external local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @can_init(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca %struct.file_operations, align 8
  %3 = alloca [32 x i8], align 16
  %4 = icmp eq ptr %0, null
  br i1 %4, label %86, label %5

5:                                                ; preds = %1
  %6 = tail call i32 @can_id_init(ptr noundef nonnull %0)
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %7, label %86

7:                                                ; preds = %5
  %8 = tail call i32 @can_clock_init(ptr noundef nonnull %0)
  %.not59 = icmp eq i32 %8, 0
  br i1 %.not59, label %9, label %86

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %0, i64 248
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = tail call i32 @gpio_init(ptr noundef %11) #4
  %.not60 = icmp eq i32 %12, 0
  br i1 %.not60, label %13, label %86

13:                                               ; preds = %9
  %14 = getelementptr inbounds i8, ptr %0, i64 256
  %15 = load ptr, ptr %14, align 8, !tbaa !16
  %16 = tail call i32 @gpio_init(ptr noundef %15) #4
  %.not61 = icmp eq i32 %16, 0
  br i1 %.not61, label %17, label %86

17:                                               ; preds = %13
  %18 = getelementptr inbounds i8, ptr %0, i64 64
  %19 = tail call i32 @HAL_FDCAN_Init(ptr noundef nonnull %18) #4
  %.not62 = icmp eq i32 %19, 0
  br i1 %.not62, label %20, label %86

20:                                               ; preds = %17
  %21 = getelementptr inbounds i8, ptr %0, i64 288
  %22 = load i32, ptr %21, align 8, !tbaa !17
  %23 = getelementptr inbounds i8, ptr %0, i64 272
  %24 = load i32, ptr %23, align 8, !tbaa !18
  %25 = tail call i32 @irq_init(i32 noundef %22, i32 noundef %24, ptr noundef nonnull @can_it_handler, ptr noundef nonnull %0) #4
  %.not63 = icmp eq i32 %25, 0
  br i1 %.not63, label %26, label %86

26:                                               ; preds = %20
  %27 = getelementptr inbounds i8, ptr %0, i64 292
  %28 = load i32, ptr %27, align 4, !tbaa !19
  %29 = load i32, ptr %23, align 8, !tbaa !18
  %30 = tail call i32 @irq_init(i32 noundef %28, i32 noundef %29, ptr noundef nonnull @can_it_handler, ptr noundef nonnull %0) #4
  %.not64 = icmp eq i32 %30, 0
  br i1 %.not64, label %31, label %86

31:                                               ; preds = %26
  %32 = load i32, ptr %21, align 8, !tbaa !17
  %33 = tail call i32 @irq_enable(i32 noundef %32) #4
  %.not65 = icmp eq i32 %33, 0
  br i1 %.not65, label %34, label %86

34:                                               ; preds = %31
  %35 = load i32, ptr %27, align 4, !tbaa !19
  %36 = tail call i32 @irq_enable(i32 noundef %35) #4
  %.not66 = icmp eq i32 %36, 0
  br i1 %.not66, label %37, label %86

37:                                               ; preds = %34
  %38 = tail call ptr @xQueueCreateMutex(i8 noundef zeroext 1) #4
  %39 = getelementptr inbounds i8, ptr %0, i64 312
  store ptr %38, ptr %39, align 8, !tbaa !20
  %40 = icmp eq ptr %38, null
  br i1 %40, label %86, label %41

41:                                               ; preds = %37
  %42 = tail call ptr @xQueueGenericCreate(i64 noundef 1, i64 noundef 0, i8 noundef zeroext 3) #4
  %43 = getelementptr inbounds i8, ptr %0, i64 296
  store ptr %42, ptr %43, align 8, !tbaa !21
  %44 = icmp eq ptr %42, null
  br i1 %44, label %86, label %45

45:                                               ; preds = %41
  %46 = tail call ptr @xQueueCreateMutex(i8 noundef zeroext 1) #4
  %47 = getelementptr inbounds i8, ptr %0, i64 320
  store ptr %46, ptr %47, align 8, !tbaa !22
  %48 = icmp eq ptr %46, null
  br i1 %48, label %86, label %49

49:                                               ; preds = %45
  %50 = tail call ptr @xQueueGenericCreate(i64 noundef 1, i64 noundef 0, i8 noundef zeroext 3) #4
  %51 = getelementptr inbounds i8, ptr %0, i64 304
  store ptr %50, ptr %51, align 8, !tbaa !23
  %52 = icmp eq ptr %50, null
  br i1 %52, label %86, label %53

53:                                               ; preds = %49
  %54 = tail call ptr @xQueueCreateMutex(i8 noundef zeroext 1) #4
  %55 = getelementptr inbounds i8, ptr %0, i64 600
  store ptr %54, ptr %55, align 8, !tbaa !24
  %56 = icmp eq ptr %54, null
  br i1 %56, label %86, label %57

57:                                               ; preds = %53
  %58 = getelementptr inbounds i8, ptr %0, i64 280
  %59 = load i32, ptr %58, align 8, !tbaa !25
  %60 = sext i32 %59 to i64
  %61 = tail call ptr @xQueueGenericCreate(i64 noundef %60, i64 noundef 32, i8 noundef zeroext 0) #4
  %62 = getelementptr inbounds i8, ptr %0, i64 608
  store ptr %61, ptr %62, align 8, !tbaa !26
  %63 = icmp eq ptr %61, null
  br i1 %63, label %86, label %64

64:                                               ; preds = %57
  %65 = tail call i32 @HAL_FDCAN_Start(ptr noundef nonnull %18) #4
  %.not67 = icmp eq i32 %65, 0
  br i1 %.not67, label %66, label %86

66:                                               ; preds = %64
  %67 = tail call i32 @HAL_FDCAN_ActivateNotification(ptr noundef nonnull %18, i32 noundef 432014079, i32 noundef -1) #4
  %.not68 = icmp eq i32 %67, 0
  br i1 %.not68, label %68, label %86

68:                                               ; preds = %66
  %69 = load ptr, ptr %51, align 8, !tbaa !23
  %70 = tail call i64 @xQueueSemaphoreTake(ptr noundef %69, i32 noundef 0) #4
  %71 = tail call i32 @can_start_service(ptr noundef nonnull %0)
  %.not69 = icmp eq i32 %71, 0
  br i1 %.not69, label %73, label %72

72:                                               ; preds = %68
  store i32 6, ptr @FreeRTOS_errno, align 4, !tbaa !27
  br label %86

73:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %2) #4
  store ptr @can_open, ptr %2, align 8, !tbaa !28
  %74 = getelementptr inbounds i8, ptr %2, i64 8
  store ptr @can_write, ptr %74, align 8, !tbaa !30
  %75 = getelementptr inbounds i8, ptr %2, i64 16
  store ptr @can_read, ptr %75, align 8, !tbaa !31
  %76 = getelementptr inbounds i8, ptr %2, i64 24
  store ptr @can_close, ptr %76, align 8, !tbaa !32
  %77 = getelementptr inbounds i8, ptr %2, i64 32
  store ptr @can_ioctl, ptr %77, align 8, !tbaa !33
  %78 = getelementptr inbounds i8, ptr %2, i64 40
  %79 = getelementptr inbounds i8, ptr %2, i64 80
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %78, i8 0, i64 40, i1 false)
  store ptr %0, ptr %79, align 8, !tbaa !34
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #4
  %80 = call i32 (ptr, ptr, ...) @sprintf_(ptr noundef nonnull %3, ptr noundef nonnull @.str, ptr noundef nonnull %0) #4
  %81 = call ptr @node_mount(ptr noundef nonnull %3, ptr noundef nonnull %2) #4
  %82 = icmp eq ptr %81, null
  br i1 %82, label %85, label %83

83:                                               ; preds = %73
  %84 = getelementptr inbounds i8, ptr %0, i64 332
  store i8 1, ptr %84, align 4, !tbaa !35
  br label %85

85:                                               ; preds = %73, %83
  %.0 = phi i32 [ 0, %83 ], [ -1, %73 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %2) #4
  br label %86

86:                                               ; preds = %66, %64, %57, %53, %49, %45, %41, %37, %34, %31, %26, %20, %17, %13, %9, %7, %5, %1, %85, %72
  %.1 = phi i32 [ -1, %72 ], [ %.0, %85 ], [ -1, %1 ], [ %6, %5 ], [ %8, %7 ], [ %12, %9 ], [ %16, %13 ], [ %19, %17 ], [ %25, %20 ], [ %30, %26 ], [ %33, %31 ], [ %36, %34 ], [ -1, %37 ], [ -1, %41 ], [ -1, %45 ], [ -1, %49 ], [ -1, %53 ], [ -1, %57 ], [ %65, %64 ], [ %67, %66 ]
  ret i32 %.1
}

; Function Attrs: mustprogress 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 @can_id_init(ptr noundef) local_unnamed_addr #0

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

declare i32 @gpio_init(ptr noundef) local_unnamed_addr #2

declare i32 @HAL_FDCAN_Init(ptr noundef) local_unnamed_addr #2

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

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

declare i32 @irq_enable(i32 noundef) local_unnamed_addr #2

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

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

declare i32 @HAL_FDCAN_Start(ptr noundef) local_unnamed_addr #2

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

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

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

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

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

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

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

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

declare i32 @sprintf_(ptr noundef, ptr noundef, ...) local_unnamed_addr #2

declare ptr @node_mount(ptr 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { "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, !10, i64 248}
!6 = !{!"", !7, i64 0, !7, i64 32, !9, i64 64, !10, i64 248, !10, i64 256, !12, i64 264, !12, i64 268, !12, i64 272, !12, i64 276, !12, i64 280, !12, i64 284, !14, i64 288}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"", !10, i64 0, !10, i64 8, !11, i64 16, !13, i64 124, !12, i64 164, !12, i64 168, !12, i64 172, !12, i64 176}
!10 = !{!"any pointer", !7, i64 0}
!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, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !12, i64 80, !12, i64 84, !12, i64 88, !12, i64 92, !12, i64 96, !12, i64 100, !12, i64 104}
!12 = !{!"int", !7, i64 0}
!13 = !{!"", !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}
!14 = !{!"", !12, i64 0, !12, i64 4, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !12, i64 40, !15, i64 44, !12, i64 48, !7, i64 56, !10, i64 312, !10, i64 320}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{!6, !10, i64 256}
!17 = !{!6, !12, i64 288}
!18 = !{!6, !12, i64 272}
!19 = !{!6, !12, i64 292}
!20 = !{!6, !10, i64 312}
!21 = !{!6, !10, i64 296}
!22 = !{!6, !10, i64 320}
!23 = !{!6, !10, i64 304}
!24 = !{!6, !10, i64 600}
!25 = !{!6, !12, i64 280}
!26 = !{!6, !10, i64 608}
!27 = !{!12, !12, i64 0}
!28 = !{!29, !10, i64 0}
!29 = !{!"file_operations", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80}
!30 = !{!29, !10, i64 8}
!31 = !{!29, !10, i64 16}
!32 = !{!29, !10, i64 24}
!33 = !{!29, !10, i64 32}
!34 = !{!29, !10, i64 80}
!35 = !{!6, !15, i64 332}


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