; LLVM IR from intel/QAT_Engine :: qat_self_test_tls_prf (populateMdKeyExpansion)

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

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@prf_ke_lseed2 = external hidden constant [32 x i8], align 16
@prf_ke_lseed3 = external hidden constant [32 x i8], align 16
@prf_ke_lsec = external hidden constant [48 x i8], align 16
@prf_ke_resMasSec_TLS1_2_SHA256 = external hidden constant [104 x i8], align 16
@prf_ke_resMasSec_TLS1_2_SHA384 = external hidden constant [104 x i8], align 16
@prf_ke_resMasSec_TLS1_2_SHA512 = external hidden constant [104 x i8], align 16
@prf_ke_resMasSec_TLS1_TLS1_1_MD5SHA1 = external hidden constant [104 x i8], align 16

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @populateMdKeyExpansion(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, ptr noundef %9, ptr noundef %10, ptr noundef %11, ptr noundef %12, i32 noundef %13, ptr noundef %14) #1 {
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  %26 = alloca ptr, align 8
  %27 = alloca ptr, align 8
  %28 = alloca ptr, align 8
  %29 = alloca i32, align 4
  %30 = alloca ptr, align 8
  store ptr %0, ptr %16, align 8, !tbaa !5
  store ptr %1, ptr %17, align 8, !tbaa !5
  store ptr %2, ptr %18, align 8, !tbaa !5
  store ptr %3, ptr %19, align 8, !tbaa !5
  store ptr %4, ptr %20, align 8, !tbaa !5
  store ptr %5, ptr %21, align 8, !tbaa !5
  store ptr %6, ptr %22, align 8, !tbaa !5
  store ptr %7, ptr %23, align 8, !tbaa !5
  store ptr %8, ptr %24, align 8, !tbaa !5
  store ptr %9, ptr %25, align 8, !tbaa !5
  store ptr %10, ptr %26, align 8, !tbaa !5
  store ptr %11, ptr %27, align 8, !tbaa !5
  store ptr %12, ptr %28, align 8, !tbaa !5
  store i32 %13, ptr %29, align 4, !tbaa !9
  store ptr %14, ptr %30, align 8, !tbaa !5
  %31 = load ptr, ptr %17, align 8, !tbaa !5
  store i32 32, ptr %31, align 4, !tbaa !9
  %32 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr @prf_ke_lseed2, ptr %32, align 8, !tbaa !5
  %33 = load ptr, ptr %19, align 8, !tbaa !5
  store i32 32, ptr %33, align 4, !tbaa !9
  %34 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr @prf_ke_lseed3, ptr %34, align 8, !tbaa !5
  store ptr null, ptr %20, align 8, !tbaa !5
  store ptr null, ptr %22, align 8, !tbaa !5
  %35 = load ptr, ptr %25, align 8, !tbaa !5
  store i32 48, ptr %35, align 4, !tbaa !9
  %36 = load ptr, ptr %24, align 8, !tbaa !5
  store ptr @prf_ke_lsec, ptr %36, align 8, !tbaa !5
  %37 = load ptr, ptr %26, align 8, !tbaa !5
  store i32 104, ptr %37, align 4, !tbaa !9
  %38 = load ptr, ptr %27, align 8, !tbaa !5
  store i64 104, ptr %38, align 8, !tbaa !11
  %39 = load i32, ptr %29, align 4, !tbaa !9
  %40 = icmp eq i32 771, %39
  br i1 %40, label %41, label %62

41:                                               ; preds = %15
  %42 = load ptr, ptr %30, align 8, !tbaa !5
  %43 = call i32 @strcmp(ptr noundef %42, ptr noundef @.str) #2
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %47, label %45

45:                                               ; preds = %41
  %46 = load ptr, ptr %28, align 8, !tbaa !5
  store ptr @prf_ke_resMasSec_TLS1_2_SHA256, ptr %46, align 8, !tbaa !5
  br label %61

47:                                               ; preds = %41
  %48 = load ptr, ptr %30, align 8, !tbaa !5
  %49 = call i32 @strcmp(ptr noundef %48, ptr noundef @.str.1) #2
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %53, label %51

51:                                               ; preds = %47
  %52 = load ptr, ptr %28, align 8, !tbaa !5
  store ptr @prf_ke_resMasSec_TLS1_2_SHA384, ptr %52, align 8, !tbaa !5
  br label %60

53:                                               ; preds = %47
  %54 = load ptr, ptr %30, align 8, !tbaa !5
  %55 = call i32 @strcmp(ptr noundef %54, ptr noundef @.str.2) #2
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %59, label %57

57:                                               ; preds = %53
  %58 = load ptr, ptr %28, align 8, !tbaa !5
  store ptr @prf_ke_resMasSec_TLS1_2_SHA512, ptr %58, align 8, !tbaa !5
  br label %59

59:                                               ; preds = %57, %53
  br label %60

60:                                               ; preds = %59, %51
  br label %61

61:                                               ; preds = %60, %45
  br label %64

62:                                               ; preds = %15
  %63 = load ptr, ptr %28, align 8, !tbaa !5
  store ptr @prf_ke_resMasSec_TLS1_TLS1_1_MD5SHA1, ptr %63, align 8, !tbaa !5
  br label %64

64:                                               ; preds = %62, %61
  ret void
}

attributes #0 = { nounwind willreturn memory(read) "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 willreturn memory(read) }

!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, !12, i64 0}
!12 = !{!"long", !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"

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@prf_ke_lseed2 = external hidden constant [32 x i8], align 16
@prf_ke_lseed3 = external hidden constant [32 x i8], align 16
@prf_ke_lsec = external hidden constant [48 x i8], align 16
@prf_ke_resMasSec_TLS1_2_SHA256 = external hidden constant [104 x i8], align 16
@prf_ke_resMasSec_TLS1_2_SHA384 = external hidden constant [104 x i8], align 16
@prf_ke_resMasSec_TLS1_2_SHA512 = external hidden constant [104 x i8], align 16
@prf_ke_resMasSec_TLS1_TLS1_1_MD5SHA1 = external hidden constant [104 x i8], align 16

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @populateMdKeyExpansion(ptr nocapture noundef writeonly %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef readnone %4, ptr nocapture noundef readnone %5, ptr nocapture noundef readnone %6, ptr nocapture noundef readnone %7, ptr nocapture noundef writeonly %8, ptr nocapture noundef writeonly %9, ptr nocapture noundef writeonly %10, ptr nocapture noundef writeonly %11, ptr nocapture noundef writeonly %12, i32 noundef %13, ptr nocapture noundef readonly %14) local_unnamed_addr #1 {
  store i32 32, ptr %1, align 4, !tbaa !5
  store ptr @prf_ke_lseed2, ptr %0, align 8, !tbaa !9
  store i32 32, ptr %3, align 4, !tbaa !5
  store ptr @prf_ke_lseed3, ptr %2, align 8, !tbaa !9
  store i32 48, ptr %9, align 4, !tbaa !5
  store ptr @prf_ke_lsec, ptr %8, align 8, !tbaa !9
  store i32 104, ptr %10, align 4, !tbaa !5
  store i64 104, ptr %11, align 8, !tbaa !11
  %16 = icmp eq i32 %13, 771
  br i1 %16, label %17, label %.sink.split

17:                                               ; preds = %15
  %18 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %14, ptr noundef nonnull dereferenceable(1) @.str) #2
  %.not = icmp eq i32 %18, 0
  br i1 %.not, label %.sink.split, label %19

19:                                               ; preds = %17
  %20 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %14, ptr noundef nonnull dereferenceable(1) @.str.1) #2
  %.not15 = icmp eq i32 %20, 0
  br i1 %.not15, label %.sink.split, label %21

21:                                               ; preds = %19
  %22 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %14, ptr noundef nonnull dereferenceable(1) @.str.2) #2
  %.not16 = icmp eq i32 %22, 0
  br i1 %.not16, label %.sink.split, label %23

.sink.split:                                      ; preds = %15, %21, %19, %17
  %prf_ke_resMasSec_TLS1_2_SHA256.sink = phi ptr [ @prf_ke_resMasSec_TLS1_2_SHA256, %17 ], [ @prf_ke_resMasSec_TLS1_2_SHA384, %19 ], [ @prf_ke_resMasSec_TLS1_2_SHA512, %21 ], [ @prf_ke_resMasSec_TLS1_TLS1_1_MD5SHA1, %15 ]
  store ptr %prf_ke_resMasSec_TLS1_2_SHA256.sink, ptr %12, align 8, !tbaa !9
  br label %23

23:                                               ; preds = %.sink.split, %21
  ret void
}

attributes #0 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { mustprogress nofree 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 #2 = { nounwind willreturn memory(read) }

!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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass