; LLVM IR from sca-secure-library-sca25519/sca25519 :: libopencm3/lib/lpc43xx (ssp)

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

; 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: nounwind uwtable
define dso_local void @ssp_init(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i8 noundef zeroext %4, i8 noundef zeroext %5, i32 noundef %6, i32 noundef %7, i32 noundef %8) #1 {
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i8, align 1
  %15 = alloca i8, align 1
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  store i32 %0, ptr %10, align 4, !tbaa !5
  store i32 %1, ptr %11, align 4, !tbaa !5
  store i32 %2, ptr %12, align 4, !tbaa !5
  store i32 %3, ptr %13, align 4, !tbaa !5
  store i8 %4, ptr %14, align 1, !tbaa !9
  store i8 %5, ptr %15, align 1, !tbaa !9
  store i32 %6, ptr %16, align 4, !tbaa !5
  store i32 %7, ptr %17, align 4, !tbaa !5
  store i32 %8, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #2
  %21 = load i32, ptr %10, align 4, !tbaa !5
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %24

23:                                               ; preds = %9
  store i32 1074278400, ptr %19, align 4, !tbaa !5
  br label %25

24:                                               ; preds = %9
  store i32 1074548736, ptr %19, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %24, %23
  store volatile i32 150996992, ptr inttoptr (i64 1074069656 to ptr), align 4, !tbaa !5
  %26 = load i32, ptr %19, align 4, !tbaa !5
  %27 = add i32 %26, 4
  %28 = zext i32 %27 to i64
  %29 = inttoptr i64 %28 to ptr
  store volatile i32 0, ptr %29, align 4, !tbaa !5
  %30 = load i8, ptr %14, align 1, !tbaa !9
  %31 = zext i8 %30 to i32
  store i32 %31, ptr %20, align 4, !tbaa !5
  %32 = load i8, ptr %15, align 1, !tbaa !9
  %33 = zext i8 %32 to i32
  %34 = load i32, ptr %19, align 4, !tbaa !5
  %35 = add i32 %34, 16
  %36 = zext i32 %35 to i64
  %37 = inttoptr i64 %36 to ptr
  store volatile i32 %33, ptr %37, align 4, !tbaa !5
  %38 = load i32, ptr %11, align 4, !tbaa !5
  %39 = load i32, ptr %12, align 4, !tbaa !5
  %40 = or i32 %38, %39
  %41 = load i32, ptr %13, align 4, !tbaa !5
  %42 = or i32 %40, %41
  %43 = load i32, ptr %20, align 4, !tbaa !5
  %44 = shl i32 %43, 8
  %45 = or i32 %42, %44
  %46 = load i32, ptr %19, align 4, !tbaa !5
  %47 = add i32 %46, 0
  %48 = zext i32 %47 to i64
  %49 = inttoptr i64 %48 to ptr
  store volatile i32 %45, ptr %49, align 4, !tbaa !5
  %50 = load i32, ptr %16, align 4, !tbaa !5
  %51 = or i32 2, %50
  %52 = load i32, ptr %17, align 4, !tbaa !5
  %53 = or i32 %51, %52
  %54 = load i32, ptr %18, align 4, !tbaa !5
  %55 = or i32 %53, %54
  %56 = load i32, ptr %19, align 4, !tbaa !5
  %57 = add i32 %56, 4
  %58 = zext i32 %57 to i64
  %59 = inttoptr i64 %58 to ptr
  store volatile i32 %55, ptr %59, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #2
  ret void
}

attributes #0 = { nocallback nofree nosync 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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}


; 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: nofree norecurse nounwind uwtable
define dso_local void @ssp_init(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i8 noundef zeroext %4, i8 noundef zeroext %5, i32 noundef %6, i32 noundef %7, i32 noundef %8) local_unnamed_addr #0 {
  %10 = icmp eq i32 %0, 0
  %. = select i1 %10, i32 1074278400, i32 1074548736
  store volatile i32 150996992, ptr inttoptr (i64 1074069656 to ptr), align 8, !tbaa !5
  %11 = or disjoint i32 %., 4
  %12 = zext nneg i32 %11 to i64
  %13 = inttoptr i64 %12 to ptr
  store volatile i32 0, ptr %13, align 4, !tbaa !5
  %14 = zext i8 %4 to i32
  %15 = zext i8 %5 to i32
  %16 = or disjoint i32 %., 16
  %17 = zext nneg i32 %16 to i64
  %18 = inttoptr i64 %17 to ptr
  store volatile i32 %15, ptr %18, align 16, !tbaa !5
  %19 = or i32 %2, %1
  %20 = or i32 %19, %3
  %21 = shl nuw nsw i32 %14, 8
  %22 = or i32 %20, %21
  %23 = zext nneg i32 %. to i64
  %24 = inttoptr i64 %23 to ptr
  store volatile i32 %22, ptr %24, align 4096, !tbaa !5
  %25 = or i32 %6, %7
  %26 = or i32 %25, %8
  %27 = or i32 %26, 2
  store volatile i32 %27, ptr %13, align 4, !tbaa !5
  ret void
}

attributes #0 = { nofree norecurse 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" }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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