; LLVM IR from intel/intel-ipsec-mb :: test/kat-app (snow3g_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.anon = type { ptr, ptr }
%struct.test_suite_context = type { i32, i32, ptr }

@snow3g_func_tab = external dso_local global [11 x %struct.anon], align 16
@.str.33 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @snow3g_test(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %struct.test_suite_context, align 8
  %6 = alloca %struct.test_suite_context, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #3
  call void @test_suite_start(ptr noundef %5, ptr noundef @.str.33)
  call void @test_suite_start(ptr noundef %6, ptr noundef @.str.34)
  %7 = call i32 @validate_f8_iv_gen()
  %8 = icmp ne i32 %7, 0
  br i1 %8, label %9, label %11

9:                                                ; preds = %1
  %10 = call i32 (ptr, ...) @printf(ptr noundef @.str.35)
  call void @test_suite_update(ptr noundef %5, i32 noundef 0, i32 noundef 1)
  br label %12

11:                                               ; preds = %1
  call void @test_suite_update(ptr noundef %5, i32 noundef 1, i32 noundef 0)
  br label %12

12:                                               ; preds = %11, %9
  %13 = call i32 @validate_f9_iv_gen()
  %14 = icmp ne i32 %13, 0
  br i1 %14, label %15, label %17

15:                                               ; preds = %12
  %16 = call i32 (ptr, ...) @printf(ptr noundef @.str.36)
  call void @test_suite_update(ptr noundef %6, i32 noundef 0, i32 noundef 1)
  br label %18

17:                                               ; preds = %12
  call void @test_suite_update(ptr noundef %6, i32 noundef 1, i32 noundef 0)
  br label %18

18:                                               ; preds = %17, %15
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %30, %18
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = zext i32 %20 to i64
  %22 = icmp ult i64 %21, 11
  br i1 %22, label %23, label %33

23:                                               ; preds = %19
  %24 = load i32, ptr %4, align 4, !tbaa !9
  %25 = zext i32 %24 to i64
  %26 = getelementptr inbounds [11 x %struct.anon], ptr @snow3g_func_tab, i64 0, i64 %25
  %27 = getelementptr inbounds %struct.anon, ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 16, !tbaa !11
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  call void %28(ptr noundef %29, i32 noundef 0, ptr noundef %5, ptr noundef %6)
  br label %30

30:                                               ; preds = %23
  %31 = load i32, ptr %4, align 4, !tbaa !9
  %32 = add i32 %31, 1
  store i32 %32, ptr %4, align 4, !tbaa !9
  br label %19, !llvm.loop !13

33:                                               ; preds = %19
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %45, %33
  %35 = load i32, ptr %4, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = icmp ult i64 %36, 11
  br i1 %37, label %38, label %48

38:                                               ; preds = %34
  %39 = load i32, ptr %4, align 4, !tbaa !9
  %40 = zext i32 %39 to i64
  %41 = getelementptr inbounds [11 x %struct.anon], ptr @snow3g_func_tab, i64 0, i64 %40
  %42 = getelementptr inbounds %struct.anon, ptr %41, i32 0, i32 0
  %43 = load ptr, ptr %42, align 16, !tbaa !11
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  call void %43(ptr noundef %44, i32 noundef 1, ptr noundef %5, ptr noundef %6)
  br label %45

45:                                               ; preds = %38
  %46 = load i32, ptr %4, align 4, !tbaa !9
  %47 = add i32 %46, 1
  store i32 %47, ptr %4, align 4, !tbaa !9
  br label %34, !llvm.loop !15

48:                                               ; preds = %34
  %49 = call i32 @test_suite_end(ptr noundef %5)
  %50 = load i32, ptr %3, align 4, !tbaa !9
  %51 = add nsw i32 %50, %49
  store i32 %51, ptr %3, align 4, !tbaa !9
  %52 = call i32 @test_suite_end(ptr noundef %6)
  %53 = load i32, ptr %3, align 4, !tbaa !9
  %54 = add nsw i32 %53, %52
  store i32 %54, ptr %3, align 4, !tbaa !9
  %55 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret i32 %55
}

; 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

; Function Attrs: nounwind uwtable
declare hidden i32 @validate_f8_iv_gen() #0

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

declare void @test_suite_update(ptr noundef, i32 noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @validate_f9_iv_gen() #0

declare i32 @test_suite_end(ptr noundef) #2

; 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 = { "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 0}
!12 = !{!"", !6, i64 0, !6, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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

@snow3g_func_tab = external dso_local local_unnamed_addr global [11 x %struct.anon], align 16
@.str.33 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @snow3g_test(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca %struct.test_suite_context, align 8
  %3 = 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 @test_suite_start(ptr noundef nonnull %2, ptr noundef nonnull @.str.33) #4
  call void @test_suite_start(ptr noundef nonnull %3, ptr noundef nonnull @.str.34) #4
  %4 = call i32 @validate_f8_iv_gen()
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %7, label %5

5:                                                ; preds = %1
  %6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.35)
  call void @test_suite_update(ptr noundef nonnull %2, i32 noundef 0, i32 noundef 1) #4
  br label %8

7:                                                ; preds = %1
  call void @test_suite_update(ptr noundef nonnull %2, i32 noundef 1, i32 noundef 0) #4
  br label %8

8:                                                ; preds = %7, %5
  %9 = call i32 @validate_f9_iv_gen()
  %.not12 = icmp eq i32 %9, 0
  br i1 %.not12, label %12, label %10

10:                                               ; preds = %8
  %11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.36)
  call void @test_suite_update(ptr noundef nonnull %3, i32 noundef 0, i32 noundef 1) #4
  br label %.preheader.preheader

12:                                               ; preds = %8
  call void @test_suite_update(ptr noundef nonnull %3, i32 noundef 1, i32 noundef 0) #4
  br label %.preheader.preheader

.preheader.preheader:                             ; preds = %12, %10
  %13 = load ptr, ptr @snow3g_func_tab, align 16, !tbaa !5
  call void %13(ptr noundef %0, i32 noundef 0, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %14 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 16), align 16, !tbaa !5
  call void %14(ptr noundef %0, i32 noundef 0, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %15 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 32), align 16, !tbaa !5
  call void %15(ptr noundef %0, i32 noundef 0, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %16 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 48), align 16, !tbaa !5
  call void %16(ptr noundef %0, i32 noundef 0, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %17 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 64), align 16, !tbaa !5
  call void %17(ptr noundef %0, i32 noundef 0, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %18 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 80), align 16, !tbaa !5
  call void %18(ptr noundef %0, i32 noundef 0, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %19 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 96), align 16, !tbaa !5
  call void %19(ptr noundef %0, i32 noundef 0, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %20 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 112), align 16, !tbaa !5
  call void %20(ptr noundef %0, i32 noundef 0, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %21 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 128), align 16, !tbaa !5
  call void %21(ptr noundef %0, i32 noundef 0, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %22 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 144), align 16, !tbaa !5
  call void %22(ptr noundef %0, i32 noundef 0, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %23 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 160), align 16, !tbaa !5
  call void %23(ptr noundef %0, i32 noundef 0, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %24 = load ptr, ptr @snow3g_func_tab, align 16, !tbaa !5
  call void %24(ptr noundef %0, i32 noundef 1, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %25 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 16), align 16, !tbaa !5
  call void %25(ptr noundef %0, i32 noundef 1, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %26 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 32), align 16, !tbaa !5
  call void %26(ptr noundef %0, i32 noundef 1, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %27 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 48), align 16, !tbaa !5
  call void %27(ptr noundef %0, i32 noundef 1, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %28 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 64), align 16, !tbaa !5
  call void %28(ptr noundef %0, i32 noundef 1, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %29 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 80), align 16, !tbaa !5
  call void %29(ptr noundef %0, i32 noundef 1, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %30 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 96), align 16, !tbaa !5
  call void %30(ptr noundef %0, i32 noundef 1, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %31 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 112), align 16, !tbaa !5
  call void %31(ptr noundef %0, i32 noundef 1, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %32 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 128), align 16, !tbaa !5
  call void %32(ptr noundef %0, i32 noundef 1, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %33 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 144), align 16, !tbaa !5
  call void %33(ptr noundef %0, i32 noundef 1, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %34 = load ptr, ptr getelementptr inbounds (i8, ptr @snow3g_func_tab, i64 160), align 16, !tbaa !5
  call void %34(ptr noundef %0, i32 noundef 1, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  %35 = call i32 @test_suite_end(ptr noundef nonnull %2) #4
  %36 = call i32 @test_suite_end(ptr noundef nonnull %3) #4
  %37 = add nsw i32 %36, %35
  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 %37
}

; 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: nounwind uwtable
declare hidden i32 @validate_f8_iv_gen() local_unnamed_addr #0

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

declare void @test_suite_update(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i32 @validate_f9_iv_gen() local_unnamed_addr #0

declare i32 @test_suite_end(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress 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 = { 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, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,ReassociatePass,SROAPass,SimplifyCFGPass