; LLVM IR from reazon-research/OpenArm :: control/canfd_control/Drivers/STM32H7xx_HAL_Driver/Src (stm32h7xx_hal_ospi)

; 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.OSPI_HandleTypeDef = type { ptr, %struct.OSPI_InitTypeDef, ptr, i32, i32, ptr, i32, i32, i32 }
%struct.OSPI_InitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.OCTOSPI_TypeDef = type { i32, i32, i32, i32, i32, i32, [2 x i32], i32, i32, [6 x i32], i32, i32, i32, i32, i32, [11 x i32], i32, i32, i32, i32, i32, [27 x i32], i32, i32, i32, i32, i32, [3 x i32], i32, [3 x i32], i32, [3 x i32], i32, i32, i32, i32, i32, [3 x i32], i32, [7 x i32], i32, i32, i32, i32, i32, [3 x i32], i32, [23 x i32], i32, [122 x i32], i32, i32, i32, i32 }

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

8:                                                ; preds = %1
  store i32 1, ptr %3, align 4, !tbaa !9
  br label %230

9:                                                ; preds = %1
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %10, i32 0, i32 7
  store volatile i32 0, ptr %11, align 4, !tbaa !11
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %12, i32 0, i32 6
  %14 = load volatile i32, ptr %13, align 8, !tbaa !14
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %16, label %229

16:                                               ; preds = %9
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  call void @HAL_OSPI_MspInit(ptr noundef %17)
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = call i32 @HAL_OSPI_SetTimeout(ptr noundef %18, i32 noundef 5000)
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %20, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !15
  %23 = getelementptr inbounds %struct.OCTOSPI_TypeDef, ptr %22, i32 0, i32 2
  %24 = load volatile i32, ptr %23, align 4, !tbaa !16
  %25 = zext i32 %24 to i64
  %26 = and i64 %25, -119473932
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %27, i32 0, i32 1
  %29 = getelementptr inbounds %struct.OSPI_InitTypeDef, ptr %28, i32 0, i32 2
  %30 = load i32, ptr %29, align 8, !tbaa !18
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %31, i32 0, i32 1
  %33 = getelementptr inbounds %struct.OSPI_InitTypeDef, ptr %32, i32 0, i32 3
  %34 = load i32, ptr %33, align 4, !tbaa !19
  %35 = sub i32 %34, 1
  %36 = shl i32 %35, 16
  %37 = or i32 %30, %36
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %38, i32 0, i32 1
  %40 = getelementptr inbounds %struct.OSPI_InitTypeDef, ptr %39, i32 0, i32 4
  %41 = load i32, ptr %40, align 8, !tbaa !20
  %42 = sub i32 %41, 1
  %43 = shl i32 %42, 8
  %44 = or i32 %37, %43
  %45 = load ptr, ptr %2, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %45, i32 0, i32 1
  %47 = getelementptr inbounds %struct.OSPI_InitTypeDef, ptr %46, i32 0, i32 12
  %48 = load i32, ptr %47, align 8, !tbaa !21
  %49 = or i32 %44, %48
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %50, i32 0, i32 1
  %52 = getelementptr inbounds %struct.OSPI_InitTypeDef, ptr %51, i32 0, i32 6
  %53 = load i32, ptr %52, align 8, !tbaa !22
  %54 = or i32 %49, %53
  %55 = zext i32 %54 to i64
  %56 = or i64 %26, %55
  %57 = trunc i64 %56 to i32
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %58, i32 0, i32 0
  %60 = load ptr, ptr %59, align 8, !tbaa !15
  %61 = getelementptr inbounds %struct.OCTOSPI_TypeDef, ptr %60, i32 0, i32 2
  store volatile i32 %57, ptr %61, align 4, !tbaa !16
  %62 = load ptr, ptr %2, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %62, i32 0, i32 0
  %64 = load ptr, ptr %63, align 8, !tbaa !15
  %65 = getelementptr inbounds %struct.OCTOSPI_TypeDef, ptr %64, i32 0, i32 3
  %66 = load volatile i32, ptr %65, align 4, !tbaa !23
  %67 = zext i32 %66 to i64
  %68 = and i64 %67, -458753
  %69 = load ptr, ptr %2, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %69, i32 0, i32 1
  %71 = getelementptr inbounds %struct.OSPI_InitTypeDef, ptr %70, i32 0, i32 7
  %72 = load i32, ptr %71, align 4, !tbaa !24
  %73 = zext i32 %72 to i64
  %74 = or i64 %68, %73
  %75 = trunc i64 %74 to i32
  %76 = load ptr, ptr %2, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %76, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8, !tbaa !15
  %79 = getelementptr inbounds %struct.OCTOSPI_TypeDef, ptr %78, i32 0, i32 3
  store volatile i32 %75, ptr %79, align 4, !tbaa !23
  %80 = load ptr, ptr %2, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %80, i32 0, i32 1
  %82 = getelementptr inbounds %struct.OSPI_InitTypeDef, ptr %81, i32 0, i32 11
  %83 = load i32, ptr %82, align 4, !tbaa !25
  %84 = shl i32 %83, 16
  %85 = load ptr, ptr %2, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %85, i32 0, i32 1
  %87 = getelementptr inbounds %struct.OSPI_InitTypeDef, ptr %86, i32 0, i32 13
  %88 = load i32, ptr %87, align 4, !tbaa !26
  %89 = shl i32 %88, 0
  %90 = or i32 %84, %89
  %91 = load ptr, ptr %2, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %91, i32 0, i32 0
  %93 = load ptr, ptr %92, align 8, !tbaa !15
  %94 = getelementptr inbounds %struct.OCTOSPI_TypeDef, ptr %93, i32 0, i32 4
  store volatile i32 %90, ptr %94, align 4, !tbaa !27
  %95 = load ptr, ptr %2, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %95, i32 0, i32 1
  %97 = getelementptr inbounds %struct.OSPI_InitTypeDef, ptr %96, i32 0, i32 14
  %98 = load i32, ptr %97, align 8, !tbaa !28
  %99 = load ptr, ptr %2, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %99, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8, !tbaa !15
  %102 = getelementptr inbounds %struct.OCTOSPI_TypeDef, ptr %101, i32 0, i32 5
  store volatile i32 %98, ptr %102, align 4, !tbaa !29
  %103 = load ptr, ptr %2, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %103, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8, !tbaa !15
  %106 = getelementptr inbounds %struct.OCTOSPI_TypeDef, ptr %105, i32 0, i32 0
  %107 = load volatile i32, ptr %106, align 4, !tbaa !30
  %108 = zext i32 %107 to i64
  %109 = and i64 %108, -7937
  %110 = load ptr, ptr %2, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %110, i32 0, i32 1
  %112 = getelementptr inbounds %struct.OSPI_InitTypeDef, ptr %111, i32 0, i32 0
  %113 = load i32, ptr %112, align 8, !tbaa !31
  %114 = sub i32 %113, 1
  %115 = shl i32 %114, 8
  %116 = zext i32 %115 to i64
  %117 = or i64 %109, %116
  %118 = trunc i64 %117 to i32
  %119 = load ptr, ptr %2, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %119, i32 0, i32 0
  %121 = load ptr, ptr %120, align 8, !tbaa !15
  %122 = getelementptr inbounds %struct.OCTOSPI_TypeDef, ptr %121, i32 0, i32 0
  store volatile i32 %118, ptr %122, align 4, !tbaa !30
  %123 = load ptr, ptr %2, align 8, !tbaa !5
  %124 = load i32, ptr %4, align 4, !tbaa !9
  %125 = load ptr, ptr %2, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %125, i32 0, i32 8
  %127 = load i32, ptr %126, align 8, !tbaa !32
  %128 = call i32 @OSPI_WaitFlagStateUntilTimeout(ptr noundef %123, i32 noundef 32, i32 noundef 0, i32 noundef %124, i32 noundef %127)
  store i32 %128, ptr %3, align 4, !tbaa !9
  %129 = load i32, ptr %3, align 4, !tbaa !9
  %130 = icmp eq i32 %129, 0
  br i1 %130, label %131, label %228

131:                                              ; preds = %16
  %132 = load ptr, ptr %2, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %132, i32 0, i32 0
  %134 = load ptr, ptr %133, align 8, !tbaa !15
  %135 = getelementptr inbounds %struct.OCTOSPI_TypeDef, ptr %134, i32 0, i32 3
  %136 = load volatile i32, ptr %135, align 4, !tbaa !23
  %137 = zext i32 %136 to i64
  %138 = and i64 %137, -256
  %139 = load ptr, ptr %2, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %139, i32 0, i32 1
  %141 = getelementptr inbounds %struct.OSPI_InitTypeDef, ptr %140, i32 0, i32 8
  %142 = load i32, ptr %141, align 8, !tbaa !33
  %143 = sub i32 %142, 1
  %144 = shl i32 %143, 0
  %145 = zext i32 %144 to i64
  %146 = or i64 %138, %145
  %147 = trunc i64 %146 to i32
  %148 = load ptr, ptr %2, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %148, i32 0, i32 0
  %150 = load ptr, ptr %149, align 8, !tbaa !15
  %151 = getelementptr inbounds %struct.OCTOSPI_TypeDef, ptr %150, i32 0, i32 3
  store volatile i32 %147, ptr %151, align 4, !tbaa !23
  %152 = load ptr, ptr %2, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %152, i32 0, i32 0
  %154 = load ptr, ptr %153, align 8, !tbaa !15
  %155 = getelementptr inbounds %struct.OCTOSPI_TypeDef, ptr %154, i32 0, i32 0
  %156 = load volatile i32, ptr %155, align 4, !tbaa !30
  %157 = zext i32 %156 to i64
  %158 = and i64 %157, -65
  %159 = load ptr, ptr %2, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %159, i32 0, i32 1
  %161 = getelementptr inbounds %struct.OSPI_InitTypeDef, ptr %160, i32 0, i32 1
  %162 = load i32, ptr %161, align 4, !tbaa !34
  %163 = zext i32 %162 to i64
  %164 = or i64 %158, %163
  %165 = trunc i64 %164 to i32
  %166 = load ptr, ptr %2, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %166, i32 0, i32 0
  %168 = load ptr, ptr %167, align 8, !tbaa !15
  %169 = getelementptr inbounds %struct.OCTOSPI_TypeDef, ptr %168, i32 0, i32 0
  store volatile i32 %165, ptr %169, align 4, !tbaa !30
  %170 = load ptr, ptr %2, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %170, i32 0, i32 0
  %172 = load ptr, ptr %171, align 8, !tbaa !15
  %173 = getelementptr inbounds %struct.OCTOSPI_TypeDef, ptr %172, i32 0, i32 24
  %174 = load volatile i32, ptr %173, align 4, !tbaa !35
  %175 = zext i32 %174 to i64
  %176 = and i64 %175, -1342177281
  %177 = load ptr, ptr %2, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %177, i32 0, i32 1
  %179 = getelementptr inbounds %struct.OSPI_InitTypeDef, ptr %178, i32 0, i32 9
  %180 = load i32, ptr %179, align 4, !tbaa !36
  %181 = load ptr, ptr %2, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %181, i32 0, i32 1
  %183 = getelementptr inbounds %struct.OSPI_InitTypeDef, ptr %182, i32 0, i32 10
  %184 = load i32, ptr %183, align 8, !tbaa !37
  %185 = or i32 %180, %184
  %186 = zext i32 %185 to i64
  %187 = or i64 %176, %186
  %188 = trunc i64 %187 to i32
  %189 = load ptr, ptr %2, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %189, i32 0, i32 0
  %191 = load ptr, ptr %190, align 8, !tbaa !15
  %192 = getelementptr inbounds %struct.OCTOSPI_TypeDef, ptr %191, i32 0, i32 24
  store volatile i32 %188, ptr %192, align 4, !tbaa !35
  %193 = load ptr, ptr %2, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %193, i32 0, i32 0
  %195 = load ptr, ptr %194, align 8, !tbaa !15
  %196 = getelementptr inbounds %struct.OCTOSPI_TypeDef, ptr %195, i32 0, i32 0
  %197 = load volatile i32, ptr %196, align 4, !tbaa !30
  %198 = zext i32 %197 to i64
  %199 = or i64 %198, 1
  %200 = trunc i64 %199 to i32
  store volatile i32 %200, ptr %196, align 4, !tbaa !30
  %201 = load ptr, ptr %2, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %201, i32 0, i32 1
  %203 = getelementptr inbounds %struct.OSPI_InitTypeDef, ptr %202, i32 0, i32 5
  %204 = load i32, ptr %203, align 4, !tbaa !38
  %205 = icmp eq i32 %204, 2
  br i1 %205, label %206, label %215

206:                                              ; preds = %131
  %207 = load ptr, ptr %2, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %207, i32 0, i32 0
  %209 = load ptr, ptr %208, align 8, !tbaa !15
  %210 = getelementptr inbounds %struct.OCTOSPI_TypeDef, ptr %209, i32 0, i32 2
  %211 = load volatile i32, ptr %210, align 4, !tbaa !16
  %212 = zext i32 %211 to i64
  %213 = or i64 %212, 2
  %214 = trunc i64 %213 to i32
  store volatile i32 %214, ptr %210, align 4, !tbaa !16
  br label %215

215:                                              ; preds = %206, %131
  %216 = load ptr, ptr %2, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %216, i32 0, i32 1
  %218 = getelementptr inbounds %struct.OSPI_InitTypeDef, ptr %217, i32 0, i32 2
  %219 = load i32, ptr %218, align 8, !tbaa !18
  %220 = icmp eq i32 %219, 67108864
  br i1 %220, label %221, label %224

221:                                              ; preds = %215
  %222 = load ptr, ptr %2, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %222, i32 0, i32 6
  store volatile i32 1, ptr %223, align 8, !tbaa !14
  br label %227

224:                                              ; preds = %215
  %225 = load ptr, ptr %2, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.OSPI_HandleTypeDef, ptr %225, i32 0, i32 6
  store volatile i32 2, ptr %226, align 8, !tbaa !14
  br label %227

227:                                              ; preds = %224, %221
  br label %228

228:                                              ; preds = %227, %16
  br label %229

229:                                              ; preds = %228, %9
  br label %230

230:                                              ; preds = %229, %8
  %231 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret i32 %231
}

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

declare i32 @HAL_GetTick() #2

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

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

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

; 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, !10, i64 100}
!12 = !{!"", !6, i64 0, !13, i64 8, !6, i64 72, !10, i64 80, !10, i64 84, !6, i64 88, !10, i64 96, !10, i64 100, !10, i64 104}
!13 = !{!"", !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}
!14 = !{!12, !10, i64 96}
!15 = !{!12, !6, i64 0}
!16 = !{!17, !10, i64 8}
!17 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !7, i64 24, !10, i64 32, !10, i64 36, !7, i64 40, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !7, i64 84, !10, i64 128, !10, i64 132, !10, i64 136, !10, i64 140, !10, i64 144, !7, i64 148, !10, i64 256, !10, i64 260, !10, i64 264, !10, i64 268, !10, i64 272, !7, i64 276, !10, i64 288, !7, i64 292, !10, i64 304, !7, i64 308, !10, i64 320, !10, i64 324, !10, i64 328, !10, i64 332, !10, i64 336, !7, i64 340, !10, i64 352, !7, i64 356, !10, i64 384, !10, i64 388, !10, i64 392, !10, i64 396, !10, i64 400, !7, i64 404, !10, i64 416, !7, i64 420, !10, i64 512, !7, i64 516, !10, i64 1004, !10, i64 1008, !10, i64 1012, !10, i64 1016}
!18 = !{!12, !10, i64 16}
!19 = !{!12, !10, i64 20}
!20 = !{!12, !10, i64 24}
!21 = !{!12, !10, i64 56}
!22 = !{!12, !10, i64 32}
!23 = !{!17, !10, i64 12}
!24 = !{!12, !10, i64 36}
!25 = !{!12, !10, i64 52}
!26 = !{!12, !10, i64 60}
!27 = !{!17, !10, i64 16}
!28 = !{!12, !10, i64 64}
!29 = !{!17, !10, i64 20}
!30 = !{!17, !10, i64 0}
!31 = !{!12, !10, i64 8}
!32 = !{!12, !10, i64 104}
!33 = !{!12, !10, i64 40}
!34 = !{!12, !10, i64 12}
!35 = !{!17, !10, i64 264}
!36 = !{!12, !10, i64 44}
!37 = !{!12, !10, i64 48}
!38 = !{!12, !10, i64 28}


; 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 @HAL_OSPI_Init(ptr noundef %0) local_unnamed_addr #0 {
  %2 = tail call i32 @HAL_GetTick() #2
  %3 = icmp eq ptr %0, null
  br i1 %3, label %95, label %4

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 100
  store volatile i32 0, ptr %5, align 4, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 96
  %7 = load volatile i32, ptr %6, align 8, !tbaa !12
  %8 = icmp eq i32 %7, 0
  br i1 %8, label %9, label %95

9:                                                ; preds = %4
  tail call void @HAL_OSPI_MspInit(ptr noundef nonnull %0)
  %10 = tail call i32 @HAL_OSPI_SetTimeout(ptr noundef nonnull %0, i32 noundef 5000)
  %11 = load ptr, ptr %0, align 8, !tbaa !13
  %12 = getelementptr inbounds i8, ptr %11, i64 8
  %13 = load volatile i32, ptr %12, align 4, !tbaa !14
  %14 = and i32 %13, -119473932
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  %16 = getelementptr inbounds i8, ptr %0, i64 16
  %17 = load i32, ptr %16, align 8, !tbaa !16
  %18 = getelementptr inbounds i8, ptr %0, i64 20
  %19 = load i32, ptr %18, align 4, !tbaa !17
  %20 = shl i32 %19, 16
  %21 = add i32 %20, -65536
  %22 = getelementptr inbounds i8, ptr %0, i64 24
  %23 = load i32, ptr %22, align 8, !tbaa !18
  %24 = shl i32 %23, 8
  %25 = add i32 %24, -256
  %26 = getelementptr inbounds i8, ptr %0, i64 56
  %27 = load i32, ptr %26, align 8, !tbaa !19
  %28 = getelementptr inbounds i8, ptr %0, i64 32
  %29 = load i32, ptr %28, align 8, !tbaa !20
  %30 = or i32 %14, %17
  %31 = or i32 %30, %21
  %32 = or i32 %31, %27
  %33 = or i32 %32, %25
  %34 = or i32 %33, %29
  store volatile i32 %34, ptr %12, align 4, !tbaa !14
  %35 = getelementptr inbounds i8, ptr %11, i64 12
  %36 = load volatile i32, ptr %35, align 4, !tbaa !21
  %37 = and i32 %36, -458753
  %38 = getelementptr inbounds i8, ptr %0, i64 36
  %39 = load i32, ptr %38, align 4, !tbaa !22
  %40 = or i32 %37, %39
  store volatile i32 %40, ptr %35, align 4, !tbaa !21
  %41 = getelementptr inbounds i8, ptr %0, i64 52
  %42 = load i32, ptr %41, align 4, !tbaa !23
  %43 = shl i32 %42, 16
  %44 = getelementptr inbounds i8, ptr %0, i64 60
  %45 = load i32, ptr %44, align 4, !tbaa !24
  %46 = or i32 %43, %45
  %47 = getelementptr inbounds i8, ptr %11, i64 16
  store volatile i32 %46, ptr %47, align 4, !tbaa !25
  %48 = getelementptr inbounds i8, ptr %0, i64 64
  %49 = load i32, ptr %48, align 8, !tbaa !26
  %50 = getelementptr inbounds i8, ptr %11, i64 20
  store volatile i32 %49, ptr %50, align 4, !tbaa !27
  %51 = load volatile i32, ptr %11, align 4, !tbaa !28
  %52 = and i32 %51, -7937
  %53 = load i32, ptr %15, align 8, !tbaa !29
  %54 = shl i32 %53, 8
  %55 = add i32 %54, -256
  %56 = or i32 %55, %52
  store volatile i32 %56, ptr %11, align 4, !tbaa !28
  %57 = getelementptr inbounds i8, ptr %0, i64 104
  %58 = load i32, ptr %57, align 8, !tbaa !30
  %59 = tail call i32 @OSPI_WaitFlagStateUntilTimeout(ptr noundef nonnull %0, i32 noundef 32, i32 noundef 0, i32 noundef %2, i32 noundef %58)
  %60 = icmp eq i32 %59, 0
  br i1 %60, label %61, label %95

61:                                               ; preds = %9
  %62 = load ptr, ptr %0, align 8, !tbaa !13
  %63 = getelementptr inbounds i8, ptr %62, i64 12
  %64 = load volatile i32, ptr %63, align 4, !tbaa !21
  %65 = and i32 %64, -256
  %66 = getelementptr inbounds i8, ptr %0, i64 40
  %67 = load i32, ptr %66, align 8, !tbaa !31
  %68 = add i32 %67, -1
  %69 = or i32 %68, %65
  store volatile i32 %69, ptr %63, align 4, !tbaa !21
  %70 = load volatile i32, ptr %62, align 4, !tbaa !28
  %71 = and i32 %70, -65
  %72 = getelementptr inbounds i8, ptr %0, i64 12
  %73 = load i32, ptr %72, align 4, !tbaa !32
  %74 = or i32 %71, %73
  store volatile i32 %74, ptr %62, align 4, !tbaa !28
  %75 = getelementptr inbounds i8, ptr %62, i64 264
  %76 = load volatile i32, ptr %75, align 4, !tbaa !33
  %77 = and i32 %76, -1342177281
  %78 = getelementptr inbounds i8, ptr %0, i64 44
  %79 = load i32, ptr %78, align 4, !tbaa !34
  %80 = getelementptr inbounds i8, ptr %0, i64 48
  %81 = load i32, ptr %80, align 8, !tbaa !35
  %82 = or i32 %77, %79
  %83 = or i32 %82, %81
  store volatile i32 %83, ptr %75, align 4, !tbaa !33
  %84 = load volatile i32, ptr %62, align 4, !tbaa !28
  %85 = or i32 %84, 1
  store volatile i32 %85, ptr %62, align 4, !tbaa !28
  %86 = getelementptr inbounds i8, ptr %0, i64 28
  %87 = load i32, ptr %86, align 4, !tbaa !36
  %88 = icmp eq i32 %87, 2
  br i1 %88, label %89, label %.sink.split

89:                                               ; preds = %61
  %90 = getelementptr inbounds i8, ptr %62, i64 8
  %91 = load volatile i32, ptr %90, align 4, !tbaa !14
  %92 = or i32 %91, 2
  store volatile i32 %92, ptr %90, align 4, !tbaa !14
  br label %.sink.split

.sink.split:                                      ; preds = %89, %61
  %93 = load i32, ptr %16, align 8, !tbaa !16
  %94 = icmp eq i32 %93, 67108864
  %. = select i1 %94, i32 1, i32 2
  store volatile i32 %., ptr %6, align 8, !tbaa !12
  br label %95

95:                                               ; preds = %.sink.split, %1, %4, %9
  %.0 = phi i32 [ %59, %9 ], [ 0, %4 ], [ 1, %1 ], [ 0, %.sink.split ]
  ret i32 %.0
}

declare i32 @HAL_GetTick() local_unnamed_addr #1

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

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

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

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, !11, i64 100}
!6 = !{!"", !7, i64 0, !10, i64 8, !7, i64 72, !11, i64 80, !11, i64 84, !7, i64 88, !11, i64 96, !11, i64 100, !11, i64 104}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56}
!11 = !{!"int", !8, i64 0}
!12 = !{!6, !11, i64 96}
!13 = !{!6, !7, i64 0}
!14 = !{!15, !11, i64 8}
!15 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !8, i64 24, !11, i64 32, !11, i64 36, !8, i64 40, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !8, i64 84, !11, i64 128, !11, i64 132, !11, i64 136, !11, i64 140, !11, i64 144, !8, i64 148, !11, i64 256, !11, i64 260, !11, i64 264, !11, i64 268, !11, i64 272, !8, i64 276, !11, i64 288, !8, i64 292, !11, i64 304, !8, i64 308, !11, i64 320, !11, i64 324, !11, i64 328, !11, i64 332, !11, i64 336, !8, i64 340, !11, i64 352, !8, i64 356, !11, i64 384, !11, i64 388, !11, i64 392, !11, i64 396, !11, i64 400, !8, i64 404, !11, i64 416, !8, i64 420, !11, i64 512, !8, i64 516, !11, i64 1004, !11, i64 1008, !11, i64 1012, !11, i64 1016}
!16 = !{!6, !11, i64 16}
!17 = !{!6, !11, i64 20}
!18 = !{!6, !11, i64 24}
!19 = !{!6, !11, i64 56}
!20 = !{!6, !11, i64 32}
!21 = !{!15, !11, i64 12}
!22 = !{!6, !11, i64 36}
!23 = !{!6, !11, i64 52}
!24 = !{!6, !11, i64 60}
!25 = !{!15, !11, i64 16}
!26 = !{!6, !11, i64 64}
!27 = !{!15, !11, i64 20}
!28 = !{!15, !11, i64 0}
!29 = !{!6, !11, i64 8}
!30 = !{!6, !11, i64 104}
!31 = !{!6, !11, i64 40}
!32 = !{!6, !11, i64 12}
!33 = !{!15, !11, i64 264}
!34 = !{!6, !11, i64 44}
!35 = !{!6, !11, i64 48}
!36 = !{!6, !11, i64 28}


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