; LLVM IR from machinefi/psa-crypto-esp32 :: crypto (cmac_mode)

; 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: nounwind uwtable
define dso_local void @gf_double(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 15
  store ptr %8, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #2
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 0
  %11 = load i8, ptr %10, align 1, !tbaa !9
  %12 = zext i8 %11 to i32
  %13 = ashr i32 %12, 7
  %14 = icmp ne i32 %13, 0
  %15 = zext i1 %14 to i64
  %16 = select i1 %14, i32 135, i32 0
  %17 = trunc i32 %16 to i8
  store i8 %17, ptr %6, align 1, !tbaa !9
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %18, i64 15
  store ptr %19, ptr %3, align 8, !tbaa !5
  br label %20

20:                                               ; preds = %35, %2
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = load i8, ptr %21, align 1, !tbaa !9
  %23 = zext i8 %22 to i32
  %24 = shl i32 %23, 1
  %25 = load i8, ptr %6, align 1, !tbaa !9
  %26 = zext i8 %25 to i32
  %27 = xor i32 %24, %26
  %28 = trunc i32 %27 to i8
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %29, i32 -1
  store ptr %30, ptr %3, align 8, !tbaa !5
  store i8 %28, ptr %29, align 1, !tbaa !9
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = icmp eq ptr %31, %32
  br i1 %33, label %34, label %35

34:                                               ; preds = %20
  br label %42

35:                                               ; preds = %20
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %36, i32 -1
  store ptr %37, ptr %5, align 8, !tbaa !5
  %38 = load i8, ptr %36, align 1, !tbaa !9
  %39 = zext i8 %38 to i32
  %40 = ashr i32 %39, 7
  %41 = trunc i32 %40 to i8
  store i8 %41, ptr %6, align 1, !tbaa !9
  br label %20

42:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  ret void
}

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

; 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 = { 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 = !{!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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @gf_double(ptr nocapture noundef writeonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %1, i64 15
  %4 = load i8, ptr %1, align 1, !tbaa !5
  %.not.inv = icmp slt i8 %4, 0
  %5 = select i1 %.not.inv, i8 -121, i8 0
  %6 = getelementptr inbounds i8, ptr %0, i64 15
  %7 = load i8, ptr %3, align 1, !tbaa !5
  %8 = shl i8 %7, 1
  %9 = xor i8 %8, %5
  store i8 %9, ptr %6, align 1, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 14
  %11 = getelementptr inbounds i8, ptr %1, i64 14
  %12 = load i8, ptr %3, align 1, !tbaa !5
  %13 = load i8, ptr %11, align 1, !tbaa !5
  %14 = tail call i8 @llvm.fshl.i8(i8 %13, i8 %12, i8 1)
  store i8 %14, ptr %10, align 1, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %0, i64 13
  %16 = getelementptr inbounds i8, ptr %1, i64 13
  %17 = load i8, ptr %11, align 1, !tbaa !5
  %18 = load i8, ptr %16, align 1, !tbaa !5
  %19 = tail call i8 @llvm.fshl.i8(i8 %18, i8 %17, i8 1)
  store i8 %19, ptr %15, align 1, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %0, i64 12
  %21 = getelementptr inbounds i8, ptr %1, i64 12
  %22 = load i8, ptr %16, align 1, !tbaa !5
  %23 = load i8, ptr %21, align 1, !tbaa !5
  %24 = tail call i8 @llvm.fshl.i8(i8 %23, i8 %22, i8 1)
  store i8 %24, ptr %20, align 1, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %0, i64 11
  %26 = getelementptr inbounds i8, ptr %1, i64 11
  %27 = load i8, ptr %21, align 1, !tbaa !5
  %28 = load i8, ptr %26, align 1, !tbaa !5
  %29 = tail call i8 @llvm.fshl.i8(i8 %28, i8 %27, i8 1)
  store i8 %29, ptr %25, align 1, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %0, i64 10
  %31 = getelementptr inbounds i8, ptr %1, i64 10
  %32 = load i8, ptr %26, align 1, !tbaa !5
  %33 = load i8, ptr %31, align 1, !tbaa !5
  %34 = tail call i8 @llvm.fshl.i8(i8 %33, i8 %32, i8 1)
  store i8 %34, ptr %30, align 1, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %0, i64 9
  %36 = getelementptr inbounds i8, ptr %1, i64 9
  %37 = load i8, ptr %31, align 1, !tbaa !5
  %38 = load i8, ptr %36, align 1, !tbaa !5
  %39 = tail call i8 @llvm.fshl.i8(i8 %38, i8 %37, i8 1)
  store i8 %39, ptr %35, align 1, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %0, i64 8
  %41 = getelementptr inbounds i8, ptr %1, i64 8
  %42 = load i8, ptr %36, align 1, !tbaa !5
  %43 = load i8, ptr %41, align 1, !tbaa !5
  %44 = tail call i8 @llvm.fshl.i8(i8 %43, i8 %42, i8 1)
  store i8 %44, ptr %40, align 1, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %0, i64 7
  %46 = getelementptr inbounds i8, ptr %1, i64 7
  %47 = load i8, ptr %41, align 1, !tbaa !5
  %48 = load i8, ptr %46, align 1, !tbaa !5
  %49 = tail call i8 @llvm.fshl.i8(i8 %48, i8 %47, i8 1)
  store i8 %49, ptr %45, align 1, !tbaa !5
  %50 = getelementptr inbounds i8, ptr %0, i64 6
  %51 = getelementptr inbounds i8, ptr %1, i64 6
  %52 = load i8, ptr %46, align 1, !tbaa !5
  %53 = load i8, ptr %51, align 1, !tbaa !5
  %54 = tail call i8 @llvm.fshl.i8(i8 %53, i8 %52, i8 1)
  store i8 %54, ptr %50, align 1, !tbaa !5
  %55 = getelementptr inbounds i8, ptr %0, i64 5
  %56 = getelementptr inbounds i8, ptr %1, i64 5
  %57 = load i8, ptr %51, align 1, !tbaa !5
  %58 = load i8, ptr %56, align 1, !tbaa !5
  %59 = tail call i8 @llvm.fshl.i8(i8 %58, i8 %57, i8 1)
  store i8 %59, ptr %55, align 1, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %0, i64 4
  %61 = getelementptr inbounds i8, ptr %1, i64 4
  %62 = load i8, ptr %56, align 1, !tbaa !5
  %63 = load i8, ptr %61, align 1, !tbaa !5
  %64 = tail call i8 @llvm.fshl.i8(i8 %63, i8 %62, i8 1)
  store i8 %64, ptr %60, align 1, !tbaa !5
  %65 = getelementptr inbounds i8, ptr %0, i64 3
  %66 = getelementptr inbounds i8, ptr %1, i64 3
  %67 = load i8, ptr %61, align 1, !tbaa !5
  %68 = load i8, ptr %66, align 1, !tbaa !5
  %69 = tail call i8 @llvm.fshl.i8(i8 %68, i8 %67, i8 1)
  store i8 %69, ptr %65, align 1, !tbaa !5
  %70 = getelementptr inbounds i8, ptr %0, i64 2
  %71 = getelementptr inbounds i8, ptr %1, i64 2
  %72 = load i8, ptr %66, align 1, !tbaa !5
  %73 = load i8, ptr %71, align 1, !tbaa !5
  %74 = tail call i8 @llvm.fshl.i8(i8 %73, i8 %72, i8 1)
  store i8 %74, ptr %70, align 1, !tbaa !5
  %75 = getelementptr inbounds i8, ptr %0, i64 1
  %76 = getelementptr inbounds i8, ptr %1, i64 1
  %77 = load i8, ptr %71, align 1, !tbaa !5
  %78 = load i8, ptr %76, align 1, !tbaa !5
  %79 = tail call i8 @llvm.fshl.i8(i8 %78, i8 %77, i8 1)
  store i8 %79, ptr %75, align 1, !tbaa !5
  %80 = load i8, ptr %76, align 1, !tbaa !5
  %81 = load i8, ptr %1, align 1, !tbaa !5
  %82 = tail call i8 @llvm.fshl.i8(i8 %81, i8 %80, i8 1)
  store i8 %82, ptr %0, align 1, !tbaa !5
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.fshl.i8(i8, i8, i8) #1

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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 speculatable willreturn memory(none) }

!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"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass