; LLVM IR from intel/intel-ipsec-mb :: test/kat-app (gmac_test)

; 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.mac_test = type { i64, i64, i64, ptr, ptr, ptr, i32, i64, ptr, i64 }
%struct.test_suite_context = type { i32, i32, ptr }

@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1
@gmac_test_kat_json = external constant [0 x %struct.mac_test], align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @gmac_test(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.test_suite_context, align 8
  %4 = alloca %struct.test_suite_context, align 8
  %5 = alloca %struct.test_suite_context, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @test_suite_start(ptr noundef %3, ptr noundef @.str)
  call void @test_suite_start(ptr noundef %4, ptr noundef @.str.1)
  call void @test_suite_start(ptr noundef %5, ptr noundef @.str.2)
  %9 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store ptr @gmac_test_kat_json, ptr %7, align 8, !tbaa !5
  br label %10

10:                                               ; preds = %26, %1
  %11 = load ptr, ptr %7, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.mac_test, ptr %11, i32 0, i32 4
  %13 = load ptr, ptr %12, align 8, !tbaa !11
  %14 = icmp ne ptr %13, null
  br i1 %14, label %15, label %35

15:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  store i64 1, ptr %8, align 8, !tbaa !14
  br label %16

16:                                               ; preds = %23, %15
  %17 = load i64, ptr %8, align 8, !tbaa !14
  %18 = icmp ule i64 %17, 64
  br i1 %18, label %19, label %26

19:                                               ; preds = %16
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = load i64, ptr %8, align 8, !tbaa !14
  call void @gmac_test_vector(ptr noundef %20, ptr noundef %21, i64 noundef %22, i32 noundef 0, ptr noundef %3, ptr noundef %4, ptr noundef %5)
  br label %23

23:                                               ; preds = %19
  %24 = load i64, ptr %8, align 8, !tbaa !14
  %25 = add i64 %24, 1
  store i64 %25, ptr %8, align 8, !tbaa !14
  br label %16, !llvm.loop !15

26:                                               ; preds = %16
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.mac_test, ptr %29, i32 0, i32 7
  %31 = load i64, ptr %30, align 8, !tbaa !17
  %32 = udiv i64 %31, 8
  call void @gmac_test_vector(ptr noundef %27, ptr noundef %28, i64 noundef %32, i32 noundef 1, ptr noundef %3, ptr noundef %4, ptr noundef %5)
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.mac_test, ptr %33, i32 1
  store ptr %34, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %10, !llvm.loop !18

35:                                               ; preds = %10
  %36 = call i32 @test_suite_end(ptr noundef %3)
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = add nsw i32 %37, %36
  store i32 %38, ptr %6, align 4, !tbaa !9
  %39 = call i32 @test_suite_end(ptr noundef %4)
  %40 = load i32, ptr %6, align 4, !tbaa !9
  %41 = add nsw i32 %40, %39
  store i32 %41, ptr %6, align 4, !tbaa !9
  %42 = call i32 @test_suite_end(ptr noundef %5)
  %43 = load i32, ptr %6, align 4, !tbaa !9
  %44 = add nsw i32 %43, %42
  store i32 %44, ptr %6, align 4, !tbaa !9
  %45 = load i32, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #3
  ret i32 %45
}

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

declare void @test_suite_start(ptr noundef, ptr noundef) #2

declare i32 @printf(ptr noundef, ...) #2

; Function Attrs: nounwind uwtable
declare hidden void @gmac_test_vector(ptr noundef, ptr noundef, i64 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #0

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

declare i32 @test_suite_end(ptr noundef) #2

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 = { "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 }

!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, !6, i64 32}
!12 = !{!"mac_test", !13, i64 0, !13, i64 8, !13, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !10, i64 48, !13, i64 56, !6, i64 64, !13, i64 72}
!13 = !{!"long", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!12, !13, i64 56}
!18 = distinct !{!18, !16}


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

%struct.mac_test = type { i64, i64, i64, ptr, ptr, ptr, i32, i64, ptr, i64 }
%struct.test_suite_context = type { i32, i32, ptr }

@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1
@gmac_test_kat_json = external constant [0 x %struct.mac_test], align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @gmac_test(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca %struct.test_suite_context, align 8
  %3 = alloca %struct.test_suite_context, align 8
  %4 = alloca %struct.test_suite_context, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  call void @test_suite_start(ptr noundef nonnull %2, ptr noundef nonnull @.str) #4
  call void @test_suite_start(ptr noundef nonnull %3, ptr noundef nonnull @.str.1) #4
  call void @test_suite_start(ptr noundef nonnull %4, ptr noundef nonnull @.str.2) #4
  %5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %6 = load ptr, ptr getelementptr inbounds (i8, ptr @gmac_test_kat_json, i64 32), align 8, !tbaa !5
  %.not15 = icmp eq ptr %6, null
  br i1 %.not15, label %._crit_edge, label %.preheader

.preheader:                                       ; preds = %1, %9
  %.01316 = phi ptr [ %13, %9 ], [ @gmac_test_kat_json, %1 ]
  br label %7

7:                                                ; preds = %.preheader, %7
  %.014 = phi i64 [ 1, %.preheader ], [ %8, %7 ]
  call void @gmac_test_vector(ptr noundef %0, ptr noundef nonnull %.01316, i64 noundef %.014, i32 noundef 0, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4)
  %8 = add nuw nsw i64 %.014, 1
  %exitcond.not = icmp eq i64 %8, 65
  br i1 %exitcond.not, label %9, label %7, !llvm.loop !12

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %.01316, i64 56
  %11 = load i64, ptr %10, align 8, !tbaa !14
  %12 = lshr i64 %11, 3
  call void @gmac_test_vector(ptr noundef %0, ptr noundef nonnull %.01316, i64 noundef %12, i32 noundef 1, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4)
  %13 = getelementptr inbounds i8, ptr %.01316, i64 80
  %14 = getelementptr inbounds i8, ptr %.01316, i64 112
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  %.not = icmp eq ptr %15, null
  br i1 %.not, label %._crit_edge, label %.preheader, !llvm.loop !15

._crit_edge:                                      ; preds = %9, %1
  %16 = call i32 @test_suite_end(ptr noundef nonnull %2) #4
  %17 = call i32 @test_suite_end(ptr noundef nonnull %3) #4
  %18 = add nsw i32 %17, %16
  %19 = call i32 @test_suite_end(ptr noundef nonnull %4) #4
  %20 = add nsw i32 %18, %19
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  ret i32 %20
}

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

declare void @test_suite_start(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @gmac_test_vector(ptr noundef, ptr noundef, i64 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

declare i32 @test_suite_end(ptr noundef) local_unnamed_addr #2

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

!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, !10, i64 32}
!6 = !{!"mac_test", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !11, i64 48, !7, i64 56, !10, i64 64, !7, i64 72}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!6, !7, i64 56}
!15 = distinct !{!15, !13}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass