; LLVM IR from ARMmbed/mbed-crypto :: library (psa_crypto_storage)

; 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.psa_persistent_key_storage_format = type { [8 x i8], [4 x i8], [4 x i8], [4 x i8], [12 x i8], [4 x i8], [0 x i8] }
%struct.psa_core_key_attributes_t = type { i16, i16, i32, i32, %struct.psa_key_policy_s, i16 }
%struct.psa_key_policy_s = type { 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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @psa_parse_key_data_from_storage(ptr noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #2 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i64 %1, ptr %8, align 8, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %17, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %18 = load i64, ptr %8, align 8, !tbaa !9
  %19 = icmp ult i64 %18, 36
  br i1 %19, label %20, label %21

20:                                               ; preds = %5
  store i32 -146, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %271

21:                                               ; preds = %5
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = call i32 @check_magic_header(ptr noundef %22)
  store i32 %23, ptr %12, align 4, !tbaa !11
  %24 = load i32, ptr %12, align 4, !tbaa !11
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %26, label %28

26:                                               ; preds = %21
  %27 = load i32, ptr %12, align 4, !tbaa !11
  store i32 %27, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %271

28:                                               ; preds = %21
  %29 = load ptr, ptr %13, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %29, i32 0, i32 1
  %31 = getelementptr inbounds [4 x i8], ptr %30, i64 0, i64 0
  %32 = load i8, ptr %31, align 1, !tbaa !13
  %33 = zext i8 %32 to i32
  %34 = load ptr, ptr %13, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %34, i32 0, i32 1
  %36 = getelementptr inbounds [4 x i8], ptr %35, i64 0, i64 1
  %37 = load i8, ptr %36, align 1, !tbaa !13
  %38 = zext i8 %37 to i32
  %39 = shl i32 %38, 8
  %40 = or i32 %33, %39
  %41 = load ptr, ptr %13, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %41, i32 0, i32 1
  %43 = getelementptr inbounds [4 x i8], ptr %42, i64 0, i64 2
  %44 = load i8, ptr %43, align 1, !tbaa !13
  %45 = zext i8 %44 to i32
  %46 = shl i32 %45, 16
  %47 = or i32 %40, %46
  %48 = load ptr, ptr %13, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %48, i32 0, i32 1
  %50 = getelementptr inbounds [4 x i8], ptr %49, i64 0, i64 3
  %51 = load i8, ptr %50, align 1, !tbaa !13
  %52 = zext i8 %51 to i32
  %53 = shl i32 %52, 24
  %54 = or i32 %47, %53
  store i32 %54, ptr %14, align 4, !tbaa !11
  %55 = load i32, ptr %14, align 4, !tbaa !11
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %57, label %58

57:                                               ; preds = %28
  store i32 -146, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %271

58:                                               ; preds = %28
  %59 = load ptr, ptr %13, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %59, i32 0, i32 5
  %61 = getelementptr inbounds [4 x i8], ptr %60, i64 0, i64 0
  %62 = load i8, ptr %61, align 1, !tbaa !13
  %63 = zext i8 %62 to i32
  %64 = load ptr, ptr %13, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %64, i32 0, i32 5
  %66 = getelementptr inbounds [4 x i8], ptr %65, i64 0, i64 1
  %67 = load i8, ptr %66, align 1, !tbaa !13
  %68 = zext i8 %67 to i32
  %69 = shl i32 %68, 8
  %70 = or i32 %63, %69
  %71 = load ptr, ptr %13, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %71, i32 0, i32 5
  %73 = getelementptr inbounds [4 x i8], ptr %72, i64 0, i64 2
  %74 = load i8, ptr %73, align 1, !tbaa !13
  %75 = zext i8 %74 to i32
  %76 = shl i32 %75, 16
  %77 = or i32 %70, %76
  %78 = load ptr, ptr %13, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %78, i32 0, i32 5
  %80 = getelementptr inbounds [4 x i8], ptr %79, i64 0, i64 3
  %81 = load i8, ptr %80, align 1, !tbaa !13
  %82 = zext i8 %81 to i32
  %83 = shl i32 %82, 24
  %84 = or i32 %77, %83
  %85 = zext i32 %84 to i64
  %86 = load ptr, ptr %10, align 8, !tbaa !5
  store i64 %85, ptr %86, align 8, !tbaa !9
  %87 = load ptr, ptr %10, align 8, !tbaa !5
  %88 = load i64, ptr %87, align 8, !tbaa !9
  %89 = load i64, ptr %8, align 8, !tbaa !9
  %90 = sub i64 %89, 36
  %91 = icmp ugt i64 %88, %90
  br i1 %91, label %96, label %92

92:                                               ; preds = %58
  %93 = load ptr, ptr %10, align 8, !tbaa !5
  %94 = load i64, ptr %93, align 8, !tbaa !9
  %95 = icmp ugt i64 %94, 8191
  br i1 %95, label %96, label %97

96:                                               ; preds = %92, %58
  store i32 -146, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %271

97:                                               ; preds = %92
  %98 = load ptr, ptr %10, align 8, !tbaa !5
  %99 = load i64, ptr %98, align 8, !tbaa !9
  %100 = icmp eq i64 %99, 0
  br i1 %100, label %101, label %103

101:                                              ; preds = %97
  %102 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr null, ptr %102, align 8, !tbaa !5
  br label %120

103:                                              ; preds = %97
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  %105 = load i64, ptr %104, align 8, !tbaa !9
  %106 = call noalias ptr @calloc(i64 noundef 1, i64 noundef %105) #5
  %107 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %106, ptr %107, align 8, !tbaa !5
  %108 = load ptr, ptr %9, align 8, !tbaa !5
  %109 = load ptr, ptr %108, align 8, !tbaa !5
  %110 = icmp eq ptr %109, null
  br i1 %110, label %111, label %112

111:                                              ; preds = %103
  store i32 -141, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %271

112:                                              ; preds = %103
  %113 = load ptr, ptr %9, align 8, !tbaa !5
  %114 = load ptr, ptr %113, align 8, !tbaa !5
  %115 = load ptr, ptr %13, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %115, i32 0, i32 6
  %117 = getelementptr inbounds [0 x i8], ptr %116, i64 0, i64 0
  %118 = load ptr, ptr %10, align 8, !tbaa !5
  %119 = load i64, ptr %118, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %114, ptr align 1 %117, i64 %119, i1 false)
  br label %120

120:                                              ; preds = %112, %101
  %121 = load ptr, ptr %13, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %121, i32 0, i32 2
  %123 = getelementptr inbounds [4 x i8], ptr %122, i64 0, i64 0
  %124 = load i8, ptr %123, align 1, !tbaa !13
  %125 = zext i8 %124 to i32
  %126 = load ptr, ptr %13, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %126, i32 0, i32 2
  %128 = getelementptr inbounds [4 x i8], ptr %127, i64 0, i64 1
  %129 = load i8, ptr %128, align 1, !tbaa !13
  %130 = zext i8 %129 to i32
  %131 = shl i32 %130, 8
  %132 = or i32 %125, %131
  %133 = load ptr, ptr %13, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %133, i32 0, i32 2
  %135 = getelementptr inbounds [4 x i8], ptr %134, i64 0, i64 2
  %136 = load i8, ptr %135, align 1, !tbaa !13
  %137 = zext i8 %136 to i32
  %138 = shl i32 %137, 16
  %139 = or i32 %132, %138
  %140 = load ptr, ptr %13, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %140, i32 0, i32 2
  %142 = getelementptr inbounds [4 x i8], ptr %141, i64 0, i64 3
  %143 = load i8, ptr %142, align 1, !tbaa !13
  %144 = zext i8 %143 to i32
  %145 = shl i32 %144, 24
  %146 = or i32 %139, %145
  %147 = load ptr, ptr %11, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.psa_core_key_attributes_t, ptr %147, i32 0, i32 2
  store i32 %146, ptr %148, align 4, !tbaa !14
  %149 = load ptr, ptr %13, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %149, i32 0, i32 3
  %151 = getelementptr inbounds [4 x i8], ptr %150, i64 0, i64 0
  %152 = load i8, ptr %151, align 1, !tbaa !13
  %153 = zext i8 %152 to i32
  %154 = load ptr, ptr %13, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %154, i32 0, i32 3
  %156 = getelementptr inbounds [4 x i8], ptr %155, i64 0, i64 1
  %157 = load i8, ptr %156, align 1, !tbaa !13
  %158 = zext i8 %157 to i32
  %159 = shl i32 %158, 8
  %160 = or i32 %153, %159
  %161 = load ptr, ptr %13, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %161, i32 0, i32 3
  %163 = getelementptr inbounds [4 x i8], ptr %162, i64 0, i64 2
  %164 = load i8, ptr %163, align 1, !tbaa !13
  %165 = zext i8 %164 to i32
  %166 = shl i32 %165, 16
  %167 = or i32 %160, %166
  %168 = load ptr, ptr %13, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %168, i32 0, i32 3
  %170 = getelementptr inbounds [4 x i8], ptr %169, i64 0, i64 3
  %171 = load i8, ptr %170, align 1, !tbaa !13
  %172 = zext i8 %171 to i32
  %173 = shl i32 %172, 24
  %174 = or i32 %167, %173
  store i32 %174, ptr %15, align 4, !tbaa !11
  %175 = load i32, ptr %15, align 4, !tbaa !11
  %176 = icmp ule i32 %175, 65535
  br i1 %176, label %177, label %182

177:                                              ; preds = %120
  %178 = load i32, ptr %15, align 4, !tbaa !11
  %179 = trunc i32 %178 to i16
  %180 = load ptr, ptr %11, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.psa_core_key_attributes_t, ptr %180, i32 0, i32 0
  store i16 %179, ptr %181, align 4, !tbaa !18
  br label %183

182:                                              ; preds = %120
  store i32 -146, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %271

183:                                              ; preds = %177
  %184 = load ptr, ptr %13, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %184, i32 0, i32 4
  %186 = getelementptr inbounds [12 x i8], ptr %185, i64 0, i64 0
  %187 = load i8, ptr %186, align 1, !tbaa !13
  %188 = zext i8 %187 to i32
  %189 = load ptr, ptr %13, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %189, i32 0, i32 4
  %191 = getelementptr inbounds [12 x i8], ptr %190, i64 0, i64 1
  %192 = load i8, ptr %191, align 1, !tbaa !13
  %193 = zext i8 %192 to i32
  %194 = shl i32 %193, 8
  %195 = or i32 %188, %194
  %196 = load ptr, ptr %13, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %196, i32 0, i32 4
  %198 = getelementptr inbounds [12 x i8], ptr %197, i64 0, i64 2
  %199 = load i8, ptr %198, align 1, !tbaa !13
  %200 = zext i8 %199 to i32
  %201 = shl i32 %200, 16
  %202 = or i32 %195, %201
  %203 = load ptr, ptr %13, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %203, i32 0, i32 4
  %205 = getelementptr inbounds [12 x i8], ptr %204, i64 0, i64 3
  %206 = load i8, ptr %205, align 1, !tbaa !13
  %207 = zext i8 %206 to i32
  %208 = shl i32 %207, 24
  %209 = or i32 %202, %208
  %210 = load ptr, ptr %11, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.psa_core_key_attributes_t, ptr %210, i32 0, i32 4
  %212 = getelementptr inbounds %struct.psa_key_policy_s, ptr %211, i32 0, i32 0
  store i32 %209, ptr %212, align 4, !tbaa !19
  %213 = load ptr, ptr %13, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %213, i32 0, i32 4
  %215 = getelementptr inbounds [12 x i8], ptr %214, i64 0, i64 4
  %216 = load i8, ptr %215, align 1, !tbaa !13
  %217 = zext i8 %216 to i32
  %218 = load ptr, ptr %13, align 8, !tbaa !5
  %219 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %218, i32 0, i32 4
  %220 = getelementptr inbounds [12 x i8], ptr %219, i64 0, i64 5
  %221 = load i8, ptr %220, align 1, !tbaa !13
  %222 = zext i8 %221 to i32
  %223 = shl i32 %222, 8
  %224 = or i32 %217, %223
  %225 = load ptr, ptr %13, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %225, i32 0, i32 4
  %227 = getelementptr inbounds [12 x i8], ptr %226, i64 0, i64 6
  %228 = load i8, ptr %227, align 1, !tbaa !13
  %229 = zext i8 %228 to i32
  %230 = shl i32 %229, 16
  %231 = or i32 %224, %230
  %232 = load ptr, ptr %13, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %232, i32 0, i32 4
  %234 = getelementptr inbounds [12 x i8], ptr %233, i64 0, i64 7
  %235 = load i8, ptr %234, align 1, !tbaa !13
  %236 = zext i8 %235 to i32
  %237 = shl i32 %236, 24
  %238 = or i32 %231, %237
  %239 = load ptr, ptr %11, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct.psa_core_key_attributes_t, ptr %239, i32 0, i32 4
  %241 = getelementptr inbounds %struct.psa_key_policy_s, ptr %240, i32 0, i32 1
  store i32 %238, ptr %241, align 4, !tbaa !20
  %242 = load ptr, ptr %13, align 8, !tbaa !5
  %243 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %242, i32 0, i32 4
  %244 = getelementptr inbounds [12 x i8], ptr %243, i64 0, i64 8
  %245 = load i8, ptr %244, align 1, !tbaa !13
  %246 = zext i8 %245 to i32
  %247 = load ptr, ptr %13, align 8, !tbaa !5
  %248 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %247, i32 0, i32 4
  %249 = getelementptr inbounds [12 x i8], ptr %248, i64 0, i64 9
  %250 = load i8, ptr %249, align 1, !tbaa !13
  %251 = zext i8 %250 to i32
  %252 = shl i32 %251, 8
  %253 = or i32 %246, %252
  %254 = load ptr, ptr %13, align 8, !tbaa !5
  %255 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %254, i32 0, i32 4
  %256 = getelementptr inbounds [12 x i8], ptr %255, i64 0, i64 10
  %257 = load i8, ptr %256, align 1, !tbaa !13
  %258 = zext i8 %257 to i32
  %259 = shl i32 %258, 16
  %260 = or i32 %253, %259
  %261 = load ptr, ptr %13, align 8, !tbaa !5
  %262 = getelementptr inbounds %struct.psa_persistent_key_storage_format, ptr %261, i32 0, i32 4
  %263 = getelementptr inbounds [12 x i8], ptr %262, i64 0, i64 11
  %264 = load i8, ptr %263, align 1, !tbaa !13
  %265 = zext i8 %264 to i32
  %266 = shl i32 %265, 24
  %267 = or i32 %260, %266
  %268 = load ptr, ptr %11, align 8, !tbaa !5
  %269 = getelementptr inbounds %struct.psa_core_key_attributes_t, ptr %268, i32 0, i32 4
  %270 = getelementptr inbounds %struct.psa_key_policy_s, ptr %269, i32 0, i32 2
  store i32 %267, ptr %270, align 4, !tbaa !21
  store i32 0, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %271

271:                                              ; preds = %183, %182, %111, %96, %57, %26, %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  %272 = load i32, ptr %6, align 4
  ret i32 %272
}

; Function Attrs: nounwind uwtable
declare hidden i32 @check_magic_header(ptr noundef) #2

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 allocsize(0,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 #4 = { nounwind }
attributes #5 = { nounwind allocsize(0,1) }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !12, i64 4}
!15 = !{!"", !16, i64 0, !16, i64 2, !12, i64 4, !12, i64 8, !17, i64 12, !16, i64 24}
!16 = !{!"short", !7, i64 0}
!17 = !{!"psa_key_policy_s", !12, i64 0, !12, i64 4, !12, i64 8}
!18 = !{!15, !16, i64 0}
!19 = !{!15, !12, i64 12}
!20 = !{!15, !12, i64 16}
!21 = !{!15, !12, i64 20}


; 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @psa_parse_key_data_from_storage(ptr noundef %0, i64 noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #1 {
  %6 = icmp ult i64 %1, 36
  br i1 %6, label %56, label %7

7:                                                ; preds = %5
  %8 = tail call i32 @check_magic_header(ptr noundef %0)
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %9, label %56

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  %11 = load i32, ptr %10, align 1
  %.not58 = icmp eq i32 %11, 0
  br i1 %.not58, label %12, label %56

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %0, i64 32
  %14 = load i16, ptr %13, align 1
  %15 = zext i16 %14 to i64
  %16 = getelementptr inbounds i8, ptr %0, i64 34
  %17 = load i8, ptr %16, align 1, !tbaa !5
  %18 = zext i8 %17 to i64
  %19 = shl nuw nsw i64 %18, 16
  %20 = or disjoint i64 %19, %15
  %21 = getelementptr inbounds i8, ptr %0, i64 35
  %22 = load i8, ptr %21, align 1, !tbaa !5
  %23 = zext i8 %22 to i64
  %24 = shl nuw nsw i64 %23, 24
  %25 = or disjoint i64 %20, %24
  store i64 %25, ptr %3, align 8, !tbaa !8
  %26 = add i64 %1, -36
  %27 = icmp ugt i64 %25, %26
  %28 = icmp ugt i64 %25, 8191
  %or.cond = or i1 %27, %28
  br i1 %or.cond, label %56, label %29

29:                                               ; preds = %12
  %30 = icmp eq i64 %25, 0
  br i1 %30, label %31, label %32

31:                                               ; preds = %29
  store ptr null, ptr %2, align 8, !tbaa !10
  br label %37

32:                                               ; preds = %29
  %33 = tail call noalias ptr @calloc(i64 noundef 1, i64 noundef %25) #3
  store ptr %33, ptr %2, align 8, !tbaa !10
  %34 = icmp eq ptr %33, null
  br i1 %34, label %56, label %35

35:                                               ; preds = %32
  %36 = getelementptr inbounds i8, ptr %0, i64 36
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %33, ptr nonnull align 1 %36, i64 %25, i1 false)
  br label %37

37:                                               ; preds = %35, %31
  %38 = getelementptr inbounds i8, ptr %0, i64 12
  %39 = load i32, ptr %38, align 1
  %40 = getelementptr inbounds i8, ptr %4, i64 4
  store i32 %39, ptr %40, align 4, !tbaa !12
  %41 = getelementptr inbounds i8, ptr %0, i64 18
  %42 = load i16, ptr %41, align 1
  %43 = icmp eq i16 %42, 0
  br i1 %43, label %44, label %56

44:                                               ; preds = %37
  %45 = getelementptr i8, ptr %0, i64 16
  %46 = load i16, ptr %45, align 1
  store i16 %46, ptr %4, align 4, !tbaa !17
  %47 = getelementptr inbounds i8, ptr %0, i64 20
  %48 = load i32, ptr %47, align 1
  %49 = getelementptr inbounds i8, ptr %4, i64 12
  store i32 %48, ptr %49, align 4, !tbaa !18
  %50 = getelementptr inbounds i8, ptr %0, i64 24
  %51 = load i32, ptr %50, align 1
  %52 = getelementptr inbounds i8, ptr %4, i64 16
  store i32 %51, ptr %52, align 4, !tbaa !19
  %53 = getelementptr inbounds i8, ptr %0, i64 28
  %54 = load i32, ptr %53, align 1
  %55 = getelementptr inbounds i8, ptr %4, i64 20
  store i32 %54, ptr %55, align 4, !tbaa !20
  br label %56

56:                                               ; preds = %37, %32, %12, %9, %7, %5, %44
  %.0 = phi i32 [ 0, %44 ], [ -146, %5 ], [ %8, %7 ], [ -146, %9 ], [ -146, %12 ], [ -141, %32 ], [ -146, %37 ]
  ret i32 %.0
}

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 allocsize(0,1) }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !6, i64 0}
!12 = !{!13, !15, i64 4}
!13 = !{!"", !14, i64 0, !14, i64 2, !15, i64 4, !15, i64 8, !16, i64 12, !14, i64 24}
!14 = !{!"short", !6, i64 0}
!15 = !{!"int", !6, i64 0}
!16 = !{!"psa_key_policy_s", !15, i64 0, !15, i64 4, !15, i64 8}
!17 = !{!13, !14, i64 0}
!18 = !{!13, !15, i64 12}
!19 = !{!13, !15, i64 16}
!20 = !{!13, !15, i64 20}


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