; LLVM IR from lichen-community-systems/signaletic :: hosts/daisy/vendor/libDaisy/Drivers/STM32H7xx_HAL_Driver/Src (SetAlarm)

; 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.RTC_HandleTypeDef = type { ptr, %struct.RTC_InitTypeDef, i32, i32 }
%struct.RTC_InitTypeDef = type { i32, i32, i32, i32, i32, i32, i32 }
%struct.RTC_TypeDef = 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, 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.RTC_AlarmTypeDef = type { %struct.RTC_TimeTypeDef, i32, i32, i32, i8, i32 }
%struct.RTC_TimeTypeDef = type { i8, i8, i8, i8, i32, i32, i32, i32 }

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

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

declare i32 @HAL_GetTick() #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @RTC_ByteToBcd2(i8 noundef zeroext) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @HAL_RTC_SetAlarm(ptr noundef %0, ptr noundef %1, i32 noundef %2) #2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  br label %12

12:                                               ; preds = %3
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %13, i32 0, i32 2
  %15 = load i32, ptr %14, align 4, !tbaa !11
  %16 = icmp eq i32 %15, 1
  br i1 %16, label %17, label %18

17:                                               ; preds = %12
  store i32 2, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %336

18:                                               ; preds = %12
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %19, i32 0, i32 2
  store i32 1, ptr %20, align 4, !tbaa !11
  br label %21

21:                                               ; preds = %18
  br label %22

22:                                               ; preds = %21
  br label %23

23:                                               ; preds = %22
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %24, i32 0, i32 3
  store volatile i32 2, ptr %25, align 8, !tbaa !14
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %94

28:                                               ; preds = %23
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !15
  %32 = getelementptr inbounds %struct.RTC_TypeDef, ptr %31, i32 0, i32 2
  %33 = load volatile i32, ptr %32, align 4, !tbaa !16
  %34 = zext i32 %33 to i64
  %35 = and i64 %34, 64
  %36 = icmp ne i64 %35, 0
  br i1 %36, label %37, label %38

37:                                               ; preds = %28
  br label %42

38:                                               ; preds = %28
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %39, i32 0, i32 0
  %41 = getelementptr inbounds %struct.RTC_TimeTypeDef, ptr %40, i32 0, i32 3
  store i8 0, ptr %41, align 1, !tbaa !18
  br label %42

42:                                               ; preds = %38, %37
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %43, i32 0, i32 3
  %45 = load i32, ptr %44, align 4, !tbaa !21
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %42
  br label %49

48:                                               ; preds = %42
  br label %49

49:                                               ; preds = %48, %47
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %50, i32 0, i32 0
  %52 = getelementptr inbounds %struct.RTC_TimeTypeDef, ptr %51, i32 0, i32 0
  %53 = load i8, ptr %52, align 4, !tbaa !22
  %54 = call zeroext i8 @RTC_ByteToBcd2(i8 noundef zeroext %53)
  %55 = zext i8 %54 to i32
  %56 = shl i32 %55, 16
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %57, i32 0, i32 0
  %59 = getelementptr inbounds %struct.RTC_TimeTypeDef, ptr %58, i32 0, i32 1
  %60 = load i8, ptr %59, align 1, !tbaa !23
  %61 = call zeroext i8 @RTC_ByteToBcd2(i8 noundef zeroext %60)
  %62 = zext i8 %61 to i32
  %63 = shl i32 %62, 8
  %64 = or i32 %56, %63
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %65, i32 0, i32 0
  %67 = getelementptr inbounds %struct.RTC_TimeTypeDef, ptr %66, i32 0, i32 2
  %68 = load i8, ptr %67, align 2, !tbaa !24
  %69 = call zeroext i8 @RTC_ByteToBcd2(i8 noundef zeroext %68)
  %70 = zext i8 %69 to i32
  %71 = or i32 %64, %70
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %72, i32 0, i32 0
  %74 = getelementptr inbounds %struct.RTC_TimeTypeDef, ptr %73, i32 0, i32 3
  %75 = load i8, ptr %74, align 1, !tbaa !18
  %76 = zext i8 %75 to i32
  %77 = shl i32 %76, 22
  %78 = or i32 %71, %77
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %79, i32 0, i32 4
  %81 = load i8, ptr %80, align 4, !tbaa !25
  %82 = call zeroext i8 @RTC_ByteToBcd2(i8 noundef zeroext %81)
  %83 = zext i8 %82 to i32
  %84 = shl i32 %83, 24
  %85 = or i32 %78, %84
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %86, i32 0, i32 3
  %88 = load i32, ptr %87, align 4, !tbaa !21
  %89 = or i32 %85, %88
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %90, i32 0, i32 1
  %92 = load i32, ptr %91, align 4, !tbaa !26
  %93 = or i32 %89, %92
  store i32 %93, ptr %9, align 4, !tbaa !9
  br label %156

94:                                               ; preds = %23
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %95, i32 0, i32 0
  %97 = load ptr, ptr %96, align 8, !tbaa !15
  %98 = getelementptr inbounds %struct.RTC_TypeDef, ptr %97, i32 0, i32 2
  %99 = load volatile i32, ptr %98, align 4, !tbaa !16
  %100 = zext i32 %99 to i64
  %101 = and i64 %100, 64
  %102 = icmp ne i64 %101, 0
  br i1 %102, label %103, label %104

103:                                              ; preds = %94
  br label %108

104:                                              ; preds = %94
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %105, i32 0, i32 0
  %107 = getelementptr inbounds %struct.RTC_TimeTypeDef, ptr %106, i32 0, i32 3
  store i8 0, ptr %107, align 1, !tbaa !18
  br label %108

108:                                              ; preds = %104, %103
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %109, i32 0, i32 3
  %111 = load i32, ptr %110, align 4, !tbaa !21
  %112 = icmp eq i32 %111, 0
  br i1 %112, label %113, label %114

113:                                              ; preds = %108
  br label %115

114:                                              ; preds = %108
  br label %115

115:                                              ; preds = %114, %113
  %116 = load ptr, ptr %6, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %116, i32 0, i32 0
  %118 = getelementptr inbounds %struct.RTC_TimeTypeDef, ptr %117, i32 0, i32 0
  %119 = load i8, ptr %118, align 4, !tbaa !22
  %120 = zext i8 %119 to i32
  %121 = shl i32 %120, 16
  %122 = load ptr, ptr %6, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %122, i32 0, i32 0
  %124 = getelementptr inbounds %struct.RTC_TimeTypeDef, ptr %123, i32 0, i32 1
  %125 = load i8, ptr %124, align 1, !tbaa !23
  %126 = zext i8 %125 to i32
  %127 = shl i32 %126, 8
  %128 = or i32 %121, %127
  %129 = load ptr, ptr %6, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %129, i32 0, i32 0
  %131 = getelementptr inbounds %struct.RTC_TimeTypeDef, ptr %130, i32 0, i32 2
  %132 = load i8, ptr %131, align 2, !tbaa !24
  %133 = zext i8 %132 to i32
  %134 = or i32 %128, %133
  %135 = load ptr, ptr %6, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %135, i32 0, i32 0
  %137 = getelementptr inbounds %struct.RTC_TimeTypeDef, ptr %136, i32 0, i32 3
  %138 = load i8, ptr %137, align 1, !tbaa !18
  %139 = zext i8 %138 to i32
  %140 = shl i32 %139, 22
  %141 = or i32 %134, %140
  %142 = load ptr, ptr %6, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %142, i32 0, i32 4
  %144 = load i8, ptr %143, align 4, !tbaa !25
  %145 = zext i8 %144 to i32
  %146 = shl i32 %145, 24
  %147 = or i32 %141, %146
  %148 = load ptr, ptr %6, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %148, i32 0, i32 3
  %150 = load i32, ptr %149, align 4, !tbaa !21
  %151 = or i32 %147, %150
  %152 = load ptr, ptr %6, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %152, i32 0, i32 1
  %154 = load i32, ptr %153, align 4, !tbaa !26
  %155 = or i32 %151, %154
  store i32 %155, ptr %9, align 4, !tbaa !9
  br label %156

156:                                              ; preds = %115, %49
  %157 = load ptr, ptr %6, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %157, i32 0, i32 0
  %159 = getelementptr inbounds %struct.RTC_TimeTypeDef, ptr %158, i32 0, i32 4
  %160 = load i32, ptr %159, align 4, !tbaa !27
  %161 = load ptr, ptr %6, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %161, i32 0, i32 2
  %163 = load i32, ptr %162, align 4, !tbaa !28
  %164 = or i32 %160, %163
  store i32 %164, ptr %10, align 4, !tbaa !9
  br label %165

165:                                              ; preds = %156
  %166 = load ptr, ptr %5, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %166, i32 0, i32 0
  %168 = load ptr, ptr %167, align 8, !tbaa !15
  %169 = getelementptr inbounds %struct.RTC_TypeDef, ptr %168, i32 0, i32 9
  store volatile i32 202, ptr %169, align 4, !tbaa !29
  %170 = load ptr, ptr %5, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %170, i32 0, i32 0
  %172 = load ptr, ptr %171, align 8, !tbaa !15
  %173 = getelementptr inbounds %struct.RTC_TypeDef, ptr %172, i32 0, i32 9
  store volatile i32 83, ptr %173, align 4, !tbaa !29
  br label %174

174:                                              ; preds = %165
  br label %175

175:                                              ; preds = %174
  %176 = load ptr, ptr %6, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.RTC_AlarmTypeDef, ptr %176, i32 0, i32 5
  %178 = load i32, ptr %177, align 4, !tbaa !30
  %179 = zext i32 %178 to i64
  %180 = icmp eq i64 %179, 256
  br i1 %180, label %181, label %251

181:                                              ; preds = %175
  %182 = load ptr, ptr %5, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %182, i32 0, i32 0
  %184 = load ptr, ptr %183, align 8, !tbaa !15
  %185 = getelementptr inbounds %struct.RTC_TypeDef, ptr %184, i32 0, i32 2
  %186 = load volatile i32, ptr %185, align 4, !tbaa !16
  %187 = zext i32 %186 to i64
  %188 = and i64 %187, -257
  %189 = trunc i64 %188 to i32
  store volatile i32 %189, ptr %185, align 4, !tbaa !16
  %190 = load ptr, ptr %5, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %190, i32 0, i32 0
  %192 = load ptr, ptr %191, align 8, !tbaa !15
  %193 = getelementptr inbounds %struct.RTC_TypeDef, ptr %192, i32 0, i32 2
  %194 = load volatile i32, ptr %193, align 4, !tbaa !16
  %195 = zext i32 %194 to i64
  %196 = and i64 %195, -4097
  %197 = trunc i64 %196 to i32
  store volatile i32 %197, ptr %193, align 4, !tbaa !16
  %198 = call i32 @HAL_GetTick()
  store i32 %198, ptr %8, align 4, !tbaa !9
  br label %199

199:                                              ; preds = %231, %181
  %200 = load ptr, ptr %5, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %200, i32 0, i32 0
  %202 = load ptr, ptr %201, align 8, !tbaa !15
  %203 = getelementptr inbounds %struct.RTC_TypeDef, ptr %202, i32 0, i32 3
  %204 = load volatile i32, ptr %203, align 4, !tbaa !31
  %205 = zext i32 %204 to i64
  %206 = and i64 %205, 1
  %207 = icmp ne i64 %206, 0
  %208 = zext i1 %207 to i64
  %209 = select i1 %207, i32 1, i32 0
  %210 = icmp eq i32 %209, 0
  br i1 %210, label %211, label %232

211:                                              ; preds = %199
  %212 = call i32 @HAL_GetTick()
  %213 = load i32, ptr %8, align 4, !tbaa !9
  %214 = sub i32 %212, %213
  %215 = icmp ugt i32 %214, 1000
  br i1 %215, label %216, label %231

216:                                              ; preds = %211
  br label %217

217:                                              ; preds = %216
  %218 = load ptr, ptr %5, align 8, !tbaa !5
  %219 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %218, i32 0, i32 0
  %220 = load ptr, ptr %219, align 8, !tbaa !15
  %221 = getelementptr inbounds %struct.RTC_TypeDef, ptr %220, i32 0, i32 9
  store volatile i32 255, ptr %221, align 4, !tbaa !29
  br label %222

222:                                              ; preds = %217
  br label %223

223:                                              ; preds = %222
  %224 = load ptr, ptr %5, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %224, i32 0, i32 3
  store volatile i32 3, ptr %225, align 8, !tbaa !14
  br label %226

226:                                              ; preds = %223
  %227 = load ptr, ptr %5, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %227, i32 0, i32 2
  store i32 0, ptr %228, align 4, !tbaa !11
  br label %229

229:                                              ; preds = %226
  br label %230

230:                                              ; preds = %229
  store i32 3, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %336

231:                                              ; preds = %211
  br label %199, !llvm.loop !32

232:                                              ; preds = %199
  %233 = load i32, ptr %9, align 4, !tbaa !9
  %234 = load ptr, ptr %5, align 8, !tbaa !5
  %235 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %234, i32 0, i32 0
  %236 = load ptr, ptr %235, align 8, !tbaa !15
  %237 = getelementptr inbounds %struct.RTC_TypeDef, ptr %236, i32 0, i32 7
  store volatile i32 %233, ptr %237, align 4, !tbaa !34
  %238 = load i32, ptr %10, align 4, !tbaa !9
  %239 = load ptr, ptr %5, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %239, i32 0, i32 0
  %241 = load ptr, ptr %240, align 8, !tbaa !15
  %242 = getelementptr inbounds %struct.RTC_TypeDef, ptr %241, i32 0, i32 17
  store volatile i32 %238, ptr %242, align 4, !tbaa !35
  %243 = load ptr, ptr %5, align 8, !tbaa !5
  %244 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %243, i32 0, i32 0
  %245 = load ptr, ptr %244, align 8, !tbaa !15
  %246 = getelementptr inbounds %struct.RTC_TypeDef, ptr %245, i32 0, i32 2
  %247 = load volatile i32, ptr %246, align 4, !tbaa !16
  %248 = zext i32 %247 to i64
  %249 = or i64 %248, 256
  %250 = trunc i64 %249 to i32
  store volatile i32 %250, ptr %246, align 4, !tbaa !16
  br label %321

251:                                              ; preds = %175
  %252 = load ptr, ptr %5, align 8, !tbaa !5
  %253 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %252, i32 0, i32 0
  %254 = load ptr, ptr %253, align 8, !tbaa !15
  %255 = getelementptr inbounds %struct.RTC_TypeDef, ptr %254, i32 0, i32 2
  %256 = load volatile i32, ptr %255, align 4, !tbaa !16
  %257 = zext i32 %256 to i64
  %258 = and i64 %257, -513
  %259 = trunc i64 %258 to i32
  store volatile i32 %259, ptr %255, align 4, !tbaa !16
  %260 = load ptr, ptr %5, align 8, !tbaa !5
  %261 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %260, i32 0, i32 0
  %262 = load ptr, ptr %261, align 8, !tbaa !15
  %263 = getelementptr inbounds %struct.RTC_TypeDef, ptr %262, i32 0, i32 2
  %264 = load volatile i32, ptr %263, align 4, !tbaa !16
  %265 = zext i32 %264 to i64
  %266 = and i64 %265, -8193
  %267 = trunc i64 %266 to i32
  store volatile i32 %267, ptr %263, align 4, !tbaa !16
  %268 = call i32 @HAL_GetTick()
  store i32 %268, ptr %8, align 4, !tbaa !9
  br label %269

269:                                              ; preds = %301, %251
  %270 = load ptr, ptr %5, align 8, !tbaa !5
  %271 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %270, i32 0, i32 0
  %272 = load ptr, ptr %271, align 8, !tbaa !15
  %273 = getelementptr inbounds %struct.RTC_TypeDef, ptr %272, i32 0, i32 3
  %274 = load volatile i32, ptr %273, align 4, !tbaa !31
  %275 = zext i32 %274 to i64
  %276 = and i64 %275, 2
  %277 = icmp ne i64 %276, 0
  %278 = zext i1 %277 to i64
  %279 = select i1 %277, i32 1, i32 0
  %280 = icmp eq i32 %279, 0
  br i1 %280, label %281, label %302

281:                                              ; preds = %269
  %282 = call i32 @HAL_GetTick()
  %283 = load i32, ptr %8, align 4, !tbaa !9
  %284 = sub i32 %282, %283
  %285 = icmp ugt i32 %284, 1000
  br i1 %285, label %286, label %301

286:                                              ; preds = %281
  br label %287

287:                                              ; preds = %286
  %288 = load ptr, ptr %5, align 8, !tbaa !5
  %289 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %288, i32 0, i32 0
  %290 = load ptr, ptr %289, align 8, !tbaa !15
  %291 = getelementptr inbounds %struct.RTC_TypeDef, ptr %290, i32 0, i32 9
  store volatile i32 255, ptr %291, align 4, !tbaa !29
  br label %292

292:                                              ; preds = %287
  br label %293

293:                                              ; preds = %292
  %294 = load ptr, ptr %5, align 8, !tbaa !5
  %295 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %294, i32 0, i32 3
  store volatile i32 3, ptr %295, align 8, !tbaa !14
  br label %296

296:                                              ; preds = %293
  %297 = load ptr, ptr %5, align 8, !tbaa !5
  %298 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %297, i32 0, i32 2
  store i32 0, ptr %298, align 4, !tbaa !11
  br label %299

299:                                              ; preds = %296
  br label %300

300:                                              ; preds = %299
  store i32 3, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %336

301:                                              ; preds = %281
  br label %269, !llvm.loop !36

302:                                              ; preds = %269
  %303 = load i32, ptr %9, align 4, !tbaa !9
  %304 = load ptr, ptr %5, align 8, !tbaa !5
  %305 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %304, i32 0, i32 0
  %306 = load ptr, ptr %305, align 8, !tbaa !15
  %307 = getelementptr inbounds %struct.RTC_TypeDef, ptr %306, i32 0, i32 8
  store volatile i32 %303, ptr %307, align 4, !tbaa !37
  %308 = load i32, ptr %10, align 4, !tbaa !9
  %309 = load ptr, ptr %5, align 8, !tbaa !5
  %310 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %309, i32 0, i32 0
  %311 = load ptr, ptr %310, align 8, !tbaa !15
  %312 = getelementptr inbounds %struct.RTC_TypeDef, ptr %311, i32 0, i32 18
  store volatile i32 %308, ptr %312, align 4, !tbaa !38
  %313 = load ptr, ptr %5, align 8, !tbaa !5
  %314 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %313, i32 0, i32 0
  %315 = load ptr, ptr %314, align 8, !tbaa !15
  %316 = getelementptr inbounds %struct.RTC_TypeDef, ptr %315, i32 0, i32 2
  %317 = load volatile i32, ptr %316, align 4, !tbaa !16
  %318 = zext i32 %317 to i64
  %319 = or i64 %318, 512
  %320 = trunc i64 %319 to i32
  store volatile i32 %320, ptr %316, align 4, !tbaa !16
  br label %321

321:                                              ; preds = %302, %232
  br label %322

322:                                              ; preds = %321
  %323 = load ptr, ptr %5, align 8, !tbaa !5
  %324 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %323, i32 0, i32 0
  %325 = load ptr, ptr %324, align 8, !tbaa !15
  %326 = getelementptr inbounds %struct.RTC_TypeDef, ptr %325, i32 0, i32 9
  store volatile i32 255, ptr %326, align 4, !tbaa !29
  br label %327

327:                                              ; preds = %322
  br label %328

328:                                              ; preds = %327
  %329 = load ptr, ptr %5, align 8, !tbaa !5
  %330 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %329, i32 0, i32 3
  store volatile i32 1, ptr %330, align 8, !tbaa !14
  br label %331

331:                                              ; preds = %328
  %332 = load ptr, ptr %5, align 8, !tbaa !5
  %333 = getelementptr inbounds %struct.RTC_HandleTypeDef, ptr %332, i32 0, i32 2
  store i32 0, ptr %333, align 4, !tbaa !11
  br label %334

334:                                              ; preds = %331
  br label %335

335:                                              ; preds = %334
  store i32 0, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %336

336:                                              ; preds = %335, %300, %230, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %337 = load i32, ptr %4, align 4
  ret i32 %337
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #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 36}
!12 = !{!"", !6, i64 0, !13, i64 8, !10, i64 36, !10, i64 40}
!13 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24}
!14 = !{!12, !10, i64 40}
!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, !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, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !10, i64 132, !10, i64 136, !10, i64 140, !10, i64 144, !10, i64 148, !10, i64 152, !10, i64 156, !10, i64 160, !10, i64 164, !10, i64 168, !10, i64 172, !10, i64 176, !10, i64 180, !10, i64 184, !10, i64 188, !10, i64 192, !10, i64 196, !10, i64 200, !10, i64 204}
!18 = !{!19, !7, i64 3}
!19 = !{!"", !20, i64 0, !10, i64 20, !10, i64 24, !10, i64 28, !7, i64 32, !10, i64 36}
!20 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16}
!21 = !{!19, !10, i64 28}
!22 = !{!19, !7, i64 0}
!23 = !{!19, !7, i64 1}
!24 = !{!19, !7, i64 2}
!25 = !{!19, !7, i64 32}
!26 = !{!19, !10, i64 20}
!27 = !{!19, !10, i64 4}
!28 = !{!19, !10, i64 24}
!29 = !{!17, !10, i64 36}
!30 = !{!19, !10, i64 36}
!31 = !{!17, !10, i64 12}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = !{!17, !10, i64 28}
!35 = !{!17, !10, i64 68}
!36 = distinct !{!36, !33}
!37 = !{!17, !10, i64 32}
!38 = !{!17, !10, 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"

declare i32 @HAL_GetTick() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @RTC_ByteToBcd2(i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 4) i32 @HAL_RTC_SetAlarm(ptr noundef %0, ptr nocapture noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %0, i64 36
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %6 = icmp eq i32 %5, 1
  br i1 %6, label %139, label %7

7:                                                ; preds = %3
  store i32 1, ptr %4, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 40
  store volatile i32 2, ptr %8, align 8, !tbaa !12
  %9 = icmp eq i32 %2, 0
  %10 = load ptr, ptr %0, align 8, !tbaa !13
  %11 = getelementptr inbounds i8, ptr %10, i64 8
  %12 = load volatile i32, ptr %11, align 4, !tbaa !14
  %13 = and i32 %12, 64
  %.not55 = icmp eq i32 %13, 0
  br i1 %9, label %14, label %50

14:                                               ; preds = %7
  br i1 %.not55, label %15, label %17

15:                                               ; preds = %14
  %16 = getelementptr inbounds i8, ptr %1, i64 3
  store i8 0, ptr %16, align 1, !tbaa !16
  br label %17

17:                                               ; preds = %15, %14
  %18 = load i8, ptr %1, align 4, !tbaa !19
  %19 = tail call zeroext i8 @RTC_ByteToBcd2(i8 noundef zeroext %18)
  %20 = zext i8 %19 to i32
  %21 = shl nuw nsw i32 %20, 16
  %22 = getelementptr inbounds i8, ptr %1, i64 1
  %23 = load i8, ptr %22, align 1, !tbaa !20
  %24 = tail call zeroext i8 @RTC_ByteToBcd2(i8 noundef zeroext %23)
  %25 = zext i8 %24 to i32
  %26 = shl nuw nsw i32 %25, 8
  %27 = or disjoint i32 %26, %21
  %28 = getelementptr inbounds i8, ptr %1, i64 2
  %29 = load i8, ptr %28, align 2, !tbaa !21
  %30 = tail call zeroext i8 @RTC_ByteToBcd2(i8 noundef zeroext %29)
  %31 = zext i8 %30 to i32
  %32 = or disjoint i32 %27, %31
  %33 = getelementptr inbounds i8, ptr %1, i64 3
  %34 = load i8, ptr %33, align 1, !tbaa !16
  %35 = zext i8 %34 to i32
  %36 = shl nuw nsw i32 %35, 22
  %37 = or i32 %36, %32
  %38 = getelementptr inbounds i8, ptr %1, i64 32
  %39 = load i8, ptr %38, align 4, !tbaa !22
  %40 = tail call zeroext i8 @RTC_ByteToBcd2(i8 noundef zeroext %39)
  %41 = zext i8 %40 to i32
  %42 = shl nuw i32 %41, 24
  %43 = getelementptr inbounds i8, ptr %1, i64 28
  %44 = load i32, ptr %43, align 4, !tbaa !23
  %45 = getelementptr inbounds i8, ptr %1, i64 20
  %46 = load i32, ptr %45, align 4, !tbaa !24
  %47 = or i32 %37, %44
  %48 = or i32 %47, %42
  %49 = or i32 %48, %46
  %.pre64 = load ptr, ptr %0, align 8, !tbaa !13
  br label %81

50:                                               ; preds = %7
  %51 = getelementptr inbounds i8, ptr %1, i64 3
  br i1 %.not55, label %54, label %._crit_edge

._crit_edge:                                      ; preds = %50
  %.pre = load i8, ptr %51, align 1, !tbaa !16
  %52 = zext i8 %.pre to i32
  %53 = shl nuw nsw i32 %52, 22
  br label %55

54:                                               ; preds = %50
  store i8 0, ptr %51, align 1, !tbaa !16
  br label %55

55:                                               ; preds = %._crit_edge, %54
  %56 = phi i32 [ %53, %._crit_edge ], [ 0, %54 ]
  %57 = load i8, ptr %1, align 4, !tbaa !19
  %58 = zext i8 %57 to i32
  %59 = shl nuw nsw i32 %58, 16
  %60 = getelementptr inbounds i8, ptr %1, i64 1
  %61 = load i8, ptr %60, align 1, !tbaa !20
  %62 = zext i8 %61 to i32
  %63 = shl nuw nsw i32 %62, 8
  %64 = or disjoint i32 %63, %59
  %65 = getelementptr inbounds i8, ptr %1, i64 2
  %66 = load i8, ptr %65, align 2, !tbaa !21
  %67 = zext i8 %66 to i32
  %68 = or disjoint i32 %64, %67
  %69 = or i32 %68, %56
  %70 = getelementptr inbounds i8, ptr %1, i64 32
  %71 = load i8, ptr %70, align 4, !tbaa !22
  %72 = zext i8 %71 to i32
  %73 = shl nuw i32 %72, 24
  %74 = getelementptr inbounds i8, ptr %1, i64 28
  %75 = load i32, ptr %74, align 4, !tbaa !23
  %76 = getelementptr inbounds i8, ptr %1, i64 20
  %77 = load i32, ptr %76, align 4, !tbaa !24
  %78 = or i32 %69, %75
  %79 = or i32 %78, %73
  %80 = or i32 %79, %77
  br label %81

81:                                               ; preds = %55, %17
  %82 = phi ptr [ %.pre64, %17 ], [ %10, %55 ]
  %.054 = phi i32 [ %49, %17 ], [ %80, %55 ]
  %83 = getelementptr inbounds i8, ptr %1, i64 4
  %84 = load i32, ptr %83, align 4, !tbaa !25
  %85 = getelementptr inbounds i8, ptr %1, i64 24
  %86 = load i32, ptr %85, align 4, !tbaa !26
  %87 = or i32 %86, %84
  %88 = getelementptr inbounds i8, ptr %82, i64 36
  store volatile i32 202, ptr %88, align 4, !tbaa !27
  store volatile i32 83, ptr %88, align 4, !tbaa !27
  %89 = getelementptr inbounds i8, ptr %1, i64 36
  %90 = load i32, ptr %89, align 4, !tbaa !28
  %91 = icmp eq i32 %90, 256
  %92 = getelementptr inbounds i8, ptr %82, i64 8
  %93 = load volatile i32, ptr %92, align 4, !tbaa !14
  br i1 %91, label %94, label %114

94:                                               ; preds = %81
  %95 = and i32 %93, -257
  store volatile i32 %95, ptr %92, align 4, !tbaa !14
  %96 = load volatile i32, ptr %92, align 4, !tbaa !14
  %97 = and i32 %96, -4097
  store volatile i32 %97, ptr %92, align 4, !tbaa !14
  %98 = tail call i32 @HAL_GetTick() #2
  br label %99

99:                                               ; preds = %105, %94
  %100 = load ptr, ptr %0, align 8, !tbaa !13
  %101 = getelementptr inbounds i8, ptr %100, i64 12
  %102 = load volatile i32, ptr %101, align 4, !tbaa !29
  %103 = and i32 %102, 1
  %104 = icmp eq i32 %103, 0
  br i1 %104, label %105, label %111

105:                                              ; preds = %99
  %106 = tail call i32 @HAL_GetTick() #2
  %107 = sub i32 %106, %98
  %108 = icmp ugt i32 %107, 1000
  br i1 %108, label %109, label %99, !llvm.loop !30

109:                                              ; preds = %105
  %110 = load ptr, ptr %0, align 8, !tbaa !13
  br label %.sink.split

111:                                              ; preds = %99
  %112 = getelementptr inbounds i8, ptr %100, i64 28
  store volatile i32 %.054, ptr %112, align 4, !tbaa !32
  %113 = getelementptr inbounds i8, ptr %100, i64 68
  br label %134

114:                                              ; preds = %81
  %115 = and i32 %93, -513
  store volatile i32 %115, ptr %92, align 4, !tbaa !14
  %116 = load volatile i32, ptr %92, align 4, !tbaa !14
  %117 = and i32 %116, -8193
  store volatile i32 %117, ptr %92, align 4, !tbaa !14
  %118 = tail call i32 @HAL_GetTick() #2
  br label %119

119:                                              ; preds = %125, %114
  %120 = load ptr, ptr %0, align 8, !tbaa !13
  %121 = getelementptr inbounds i8, ptr %120, i64 12
  %122 = load volatile i32, ptr %121, align 4, !tbaa !29
  %123 = and i32 %122, 2
  %124 = icmp eq i32 %123, 0
  br i1 %124, label %125, label %131

125:                                              ; preds = %119
  %126 = tail call i32 @HAL_GetTick() #2
  %127 = sub i32 %126, %118
  %128 = icmp ugt i32 %127, 1000
  br i1 %128, label %129, label %119, !llvm.loop !33

129:                                              ; preds = %125
  %130 = load ptr, ptr %0, align 8, !tbaa !13
  br label %.sink.split

131:                                              ; preds = %119
  %132 = getelementptr inbounds i8, ptr %120, i64 32
  store volatile i32 %.054, ptr %132, align 4, !tbaa !34
  %133 = getelementptr inbounds i8, ptr %120, i64 72
  br label %134

134:                                              ; preds = %111, %131
  %.sink = phi ptr [ %113, %111 ], [ %133, %131 ]
  %.lcssa.sink = phi ptr [ %100, %111 ], [ %120, %131 ]
  %.sink70 = phi i32 [ 256, %111 ], [ 512, %131 ]
  store volatile i32 %87, ptr %.sink, align 4, !tbaa !35
  %135 = getelementptr inbounds i8, ptr %.lcssa.sink, i64 8
  %136 = load volatile i32, ptr %135, align 4, !tbaa !14
  %137 = or i32 %136, %.sink70
  store volatile i32 %137, ptr %135, align 4, !tbaa !14
  br label %.sink.split

.sink.split:                                      ; preds = %109, %129, %134
  %.sink73 = phi ptr [ %.lcssa.sink, %134 ], [ %130, %129 ], [ %110, %109 ]
  %.sink71 = phi i32 [ 1, %134 ], [ 3, %129 ], [ 3, %109 ]
  %.0.ph = phi i32 [ 0, %134 ], [ 3, %129 ], [ 3, %109 ]
  %138 = getelementptr inbounds i8, ptr %.sink73, i64 36
  store volatile i32 255, ptr %138, align 4, !tbaa !27
  store volatile i32 %.sink71, ptr %8, align 8, !tbaa !12
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %139

139:                                              ; preds = %.sink.split, %3
  %.0 = phi i32 [ 2, %3 ], [ %.0.ph, %.sink.split ]
  ret i32 %.0
}

attributes #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 = { 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 = { 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 36}
!6 = !{!"", !7, i64 0, !10, i64 8, !11, i64 36, !11, i64 40}
!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 = !{!"int", !8, i64 0}
!12 = !{!6, !11, i64 40}
!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, !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, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !11, i64 136, !11, i64 140, !11, i64 144, !11, i64 148, !11, i64 152, !11, i64 156, !11, i64 160, !11, i64 164, !11, i64 168, !11, i64 172, !11, i64 176, !11, i64 180, !11, i64 184, !11, i64 188, !11, i64 192, !11, i64 196, !11, i64 200, !11, i64 204}
!16 = !{!17, !8, i64 3}
!17 = !{!"", !18, i64 0, !11, i64 20, !11, i64 24, !11, i64 28, !8, i64 32, !11, i64 36}
!18 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16}
!19 = !{!17, !8, i64 0}
!20 = !{!17, !8, i64 1}
!21 = !{!17, !8, i64 2}
!22 = !{!17, !8, i64 32}
!23 = !{!17, !11, i64 28}
!24 = !{!17, !11, i64 20}
!25 = !{!17, !11, i64 4}
!26 = !{!17, !11, i64 24}
!27 = !{!15, !11, i64 36}
!28 = !{!17, !11, i64 36}
!29 = !{!15, !11, i64 12}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{!15, !11, i64 28}
!33 = distinct !{!33, !31}
!34 = !{!15, !11, i64 32}
!35 = !{!11, !11, i64 0}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass