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

; 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_ems_lseed2 = external hidden constant [32 x i8], align 16
@prf_ems_lsec = external hidden constant [48 x i8], align 16
@prf_ems_resMasSec_TLS1_2_SHA256 = external hidden constant [48 x i8], align 16
@prf_ems_resMasSec_TLS1_2_SHA384 = external hidden constant [48 x i8], align 16
@prf_ems_resMasSec_TLS1_2_SHA512 = external hidden constant [48 x i8], align 16
@prf_ems_resMasSec_TLS1_TLS1_1_MD5SHA1 = external hidden constant [48 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 @populateExtendedMasterSecret(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_ems_lseed2, ptr %32, align 8, !tbaa !5
  store ptr null, ptr %18, align 8, !tbaa !5
  store ptr null, ptr %20, align 8, !tbaa !5
  store ptr null, ptr %22, align 8, !tbaa !5
  %33 = load ptr, ptr %25, align 8, !tbaa !5
  store i32 48, ptr %33, align 4, !tbaa !9
  %34 = load ptr, ptr %24, align 8, !tbaa !5
  store ptr @prf_ems_lsec, ptr %34, align 8, !tbaa !5
  %35 = load ptr, ptr %26, align 8, !tbaa !5
  store i32 48, ptr %35, align 4, !tbaa !9
  %36 = load ptr, ptr %27, align 8, !tbaa !5
  store i64 48, ptr %36, align 8, !tbaa !11
  %37 = load i32, ptr %29, align 4, !tbaa !9
  %38 = icmp eq i32 771, %37
  br i1 %38, label %39, label %60

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

43:                                               ; preds = %39
  %44 = load ptr, ptr %28, align 8, !tbaa !5
  store ptr @prf_ems_resMasSec_TLS1_2_SHA256, ptr %44, align 8, !tbaa !5
  br label %59

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

49:                                               ; preds = %45
  %50 = load ptr, ptr %28, align 8, !tbaa !5
  store ptr @prf_ems_resMasSec_TLS1_2_SHA384, ptr %50, align 8, !tbaa !5
  br label %58

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

55:                                               ; preds = %51
  %56 = load ptr, ptr %28, align 8, !tbaa !5
  store ptr @prf_ems_resMasSec_TLS1_2_SHA512, ptr %56, align 8, !tbaa !5
  br label %57

57:                                               ; preds = %55, %51
  br label %58

58:                                               ; preds = %57, %49
  br label %59

59:                                               ; preds = %58, %43
  br label %62

60:                                               ; preds = %15
  %61 = load ptr, ptr %28, align 8, !tbaa !5
  store ptr @prf_ems_resMasSec_TLS1_TLS1_1_MD5SHA1, ptr %61, align 8, !tbaa !5
  br label %62

62:                                               ; preds = %60, %59
  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_ems_lseed2 = external hidden constant [32 x i8], align 16
@prf_ems_lsec = external hidden constant [48 x i8], align 16
@prf_ems_resMasSec_TLS1_2_SHA256 = external hidden constant [48 x i8], align 16
@prf_ems_resMasSec_TLS1_2_SHA384 = external hidden constant [48 x i8], align 16
@prf_ems_resMasSec_TLS1_2_SHA512 = external hidden constant [48 x i8], align 16
@prf_ems_resMasSec_TLS1_TLS1_1_MD5SHA1 = external hidden constant [48 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 @populateExtendedMasterSecret(ptr nocapture noundef writeonly %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef readnone %2, ptr nocapture noundef readnone %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_ems_lseed2, ptr %0, align 8, !tbaa !9
  store i32 48, ptr %9, align 4, !tbaa !5
  store ptr @prf_ems_lsec, ptr %8, align 8, !tbaa !9
  store i32 48, ptr %10, align 4, !tbaa !5
  store i64 48, 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
  %.not13 = icmp eq i32 %20, 0
  br i1 %.not13, 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
  %.not14 = icmp eq i32 %22, 0
  br i1 %.not14, label %.sink.split, label %23

.sink.split:                                      ; preds = %15, %21, %19, %17
  %prf_ems_resMasSec_TLS1_2_SHA256.sink = phi ptr [ @prf_ems_resMasSec_TLS1_2_SHA256, %17 ], [ @prf_ems_resMasSec_TLS1_2_SHA384, %19 ], [ @prf_ems_resMasSec_TLS1_2_SHA512, %21 ], [ @prf_ems_resMasSec_TLS1_TLS1_1_MD5SHA1, %15 ]
  store ptr %prf_ems_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