; LLVM IR from holzschu/ios_system :: ssh_keygen/openbsd-compat/regress (opensslvertest)

; 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.version_test = type { i64, i64, i32 }

@version_tests = external dso_local global [15 x %struct.version_test], align 16

; Function Attrs: nounwind uwtable
declare dso_local void @fail(i64 noundef, i64 noundef, i32 noundef) #0

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %6

6:                                                ; preds = %36, %0
  %7 = load i32, ptr %2, align 4, !tbaa !5
  %8 = zext i32 %7 to i64
  %9 = icmp ult i64 %8, 15
  br i1 %9, label %10, label %39

10:                                               ; preds = %6
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = zext i32 %11 to i64
  %13 = getelementptr inbounds [15 x %struct.version_test], ptr @version_tests, i64 0, i64 %12
  %14 = getelementptr inbounds %struct.version_test, ptr %13, i32 0, i32 0
  %15 = load i64, ptr %14, align 8, !tbaa !9
  store i64 %15, ptr %4, align 8, !tbaa !12
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = zext i32 %16 to i64
  %18 = getelementptr inbounds [15 x %struct.version_test], ptr @version_tests, i64 0, i64 %17
  %19 = getelementptr inbounds %struct.version_test, ptr %18, i32 0, i32 1
  %20 = load i64, ptr %19, align 8, !tbaa !13
  store i64 %20, ptr %5, align 8, !tbaa !12
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = zext i32 %21 to i64
  %23 = getelementptr inbounds [15 x %struct.version_test], ptr @version_tests, i64 0, i64 %22
  %24 = getelementptr inbounds %struct.version_test, ptr %23, i32 0, i32 2
  %25 = load i32, ptr %24, align 8, !tbaa !14
  store i32 %25, ptr %3, align 4, !tbaa !5
  %26 = load i64, ptr %4, align 8, !tbaa !12
  %27 = load i64, ptr %5, align 8, !tbaa !12
  %28 = call i32 @ssh_compatible_openssl(i64 noundef %26, i64 noundef %27)
  %29 = load i32, ptr %3, align 4, !tbaa !5
  %30 = icmp ne i32 %28, %29
  br i1 %30, label %31, label %35

31:                                               ; preds = %10
  %32 = load i64, ptr %4, align 8, !tbaa !12
  %33 = load i64, ptr %5, align 8, !tbaa !12
  %34 = load i32, ptr %3, align 4, !tbaa !5
  call void @fail(i64 noundef %32, i64 noundef %33, i32 noundef %34)
  br label %35

35:                                               ; preds = %31, %10
  br label %36

36:                                               ; preds = %35
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = add i32 %37, 1
  store i32 %38, ptr %2, align 4, !tbaa !5
  br label %6, !llvm.loop !15

39:                                               ; preds = %6
  call void @exit(i32 noundef 0) #5
  unreachable
}

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

declare i32 @ssh_compatible_openssl(i64 noundef, i64 noundef) #3

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 = { noreturn 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 }
attributes #5 = { noreturn 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"version_test", !11, i64 0, !11, i64 8, !6, i64 16}
!11 = !{!"long", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 8}
!14 = !{!10, !6, i64 16}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; 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.version_test = type { i64, i64, i32 }

@version_tests = external dso_local local_unnamed_addr global [15 x %struct.version_test], align 16

; Function Attrs: nounwind uwtable
declare dso_local void @fail(i64 noundef, i64 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #1

; Function Attrs: noreturn nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = load i64, ptr @version_tests, align 16, !tbaa !5
  %2 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 8), align 8, !tbaa !11
  %3 = load i32, ptr getelementptr inbounds (i8, ptr @version_tests, i64 16), align 16, !tbaa !12
  %4 = tail call i32 @ssh_compatible_openssl(i64 noundef %1, i64 noundef %2) #4
  %.not = icmp eq i32 %4, %3
  br i1 %.not, label %6, label %5

5:                                                ; preds = %0
  tail call void @fail(i64 noundef %1, i64 noundef %2, i32 noundef %3)
  br label %6

6:                                                ; preds = %0, %5
  %7 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 24), align 8, !tbaa !5
  %8 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 32), align 16, !tbaa !11
  %9 = load i32, ptr getelementptr inbounds (i8, ptr @version_tests, i64 40), align 8, !tbaa !12
  %10 = tail call i32 @ssh_compatible_openssl(i64 noundef %7, i64 noundef %8) #4
  %.not.1 = icmp eq i32 %10, %9
  br i1 %.not.1, label %12, label %11

11:                                               ; preds = %6
  tail call void @fail(i64 noundef %7, i64 noundef %8, i32 noundef %9)
  br label %12

12:                                               ; preds = %11, %6
  %13 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 48), align 16, !tbaa !5
  %14 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 56), align 8, !tbaa !11
  %15 = load i32, ptr getelementptr inbounds (i8, ptr @version_tests, i64 64), align 16, !tbaa !12
  %16 = tail call i32 @ssh_compatible_openssl(i64 noundef %13, i64 noundef %14) #4
  %.not.2 = icmp eq i32 %16, %15
  br i1 %.not.2, label %18, label %17

17:                                               ; preds = %12
  tail call void @fail(i64 noundef %13, i64 noundef %14, i32 noundef %15)
  br label %18

18:                                               ; preds = %17, %12
  %19 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 72), align 8, !tbaa !5
  %20 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 80), align 16, !tbaa !11
  %21 = load i32, ptr getelementptr inbounds (i8, ptr @version_tests, i64 88), align 8, !tbaa !12
  %22 = tail call i32 @ssh_compatible_openssl(i64 noundef %19, i64 noundef %20) #4
  %.not.3 = icmp eq i32 %22, %21
  br i1 %.not.3, label %24, label %23

23:                                               ; preds = %18
  tail call void @fail(i64 noundef %19, i64 noundef %20, i32 noundef %21)
  br label %24

24:                                               ; preds = %23, %18
  %25 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 96), align 16, !tbaa !5
  %26 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 104), align 8, !tbaa !11
  %27 = load i32, ptr getelementptr inbounds (i8, ptr @version_tests, i64 112), align 16, !tbaa !12
  %28 = tail call i32 @ssh_compatible_openssl(i64 noundef %25, i64 noundef %26) #4
  %.not.4 = icmp eq i32 %28, %27
  br i1 %.not.4, label %30, label %29

29:                                               ; preds = %24
  tail call void @fail(i64 noundef %25, i64 noundef %26, i32 noundef %27)
  br label %30

30:                                               ; preds = %29, %24
  %31 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 120), align 8, !tbaa !5
  %32 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 128), align 16, !tbaa !11
  %33 = load i32, ptr getelementptr inbounds (i8, ptr @version_tests, i64 136), align 8, !tbaa !12
  %34 = tail call i32 @ssh_compatible_openssl(i64 noundef %31, i64 noundef %32) #4
  %.not.5 = icmp eq i32 %34, %33
  br i1 %.not.5, label %36, label %35

35:                                               ; preds = %30
  tail call void @fail(i64 noundef %31, i64 noundef %32, i32 noundef %33)
  br label %36

36:                                               ; preds = %35, %30
  %37 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 144), align 16, !tbaa !5
  %38 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 152), align 8, !tbaa !11
  %39 = load i32, ptr getelementptr inbounds (i8, ptr @version_tests, i64 160), align 16, !tbaa !12
  %40 = tail call i32 @ssh_compatible_openssl(i64 noundef %37, i64 noundef %38) #4
  %.not.6 = icmp eq i32 %40, %39
  br i1 %.not.6, label %42, label %41

41:                                               ; preds = %36
  tail call void @fail(i64 noundef %37, i64 noundef %38, i32 noundef %39)
  br label %42

42:                                               ; preds = %41, %36
  %43 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 168), align 8, !tbaa !5
  %44 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 176), align 16, !tbaa !11
  %45 = load i32, ptr getelementptr inbounds (i8, ptr @version_tests, i64 184), align 8, !tbaa !12
  %46 = tail call i32 @ssh_compatible_openssl(i64 noundef %43, i64 noundef %44) #4
  %.not.7 = icmp eq i32 %46, %45
  br i1 %.not.7, label %48, label %47

47:                                               ; preds = %42
  tail call void @fail(i64 noundef %43, i64 noundef %44, i32 noundef %45)
  br label %48

48:                                               ; preds = %47, %42
  %49 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 192), align 16, !tbaa !5
  %50 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 200), align 8, !tbaa !11
  %51 = load i32, ptr getelementptr inbounds (i8, ptr @version_tests, i64 208), align 16, !tbaa !12
  %52 = tail call i32 @ssh_compatible_openssl(i64 noundef %49, i64 noundef %50) #4
  %.not.8 = icmp eq i32 %52, %51
  br i1 %.not.8, label %54, label %53

53:                                               ; preds = %48
  tail call void @fail(i64 noundef %49, i64 noundef %50, i32 noundef %51)
  br label %54

54:                                               ; preds = %53, %48
  %55 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 216), align 8, !tbaa !5
  %56 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 224), align 16, !tbaa !11
  %57 = load i32, ptr getelementptr inbounds (i8, ptr @version_tests, i64 232), align 8, !tbaa !12
  %58 = tail call i32 @ssh_compatible_openssl(i64 noundef %55, i64 noundef %56) #4
  %.not.9 = icmp eq i32 %58, %57
  br i1 %.not.9, label %60, label %59

59:                                               ; preds = %54
  tail call void @fail(i64 noundef %55, i64 noundef %56, i32 noundef %57)
  br label %60

60:                                               ; preds = %59, %54
  %61 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 240), align 16, !tbaa !5
  %62 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 248), align 8, !tbaa !11
  %63 = load i32, ptr getelementptr inbounds (i8, ptr @version_tests, i64 256), align 16, !tbaa !12
  %64 = tail call i32 @ssh_compatible_openssl(i64 noundef %61, i64 noundef %62) #4
  %.not.10 = icmp eq i32 %64, %63
  br i1 %.not.10, label %66, label %65

65:                                               ; preds = %60
  tail call void @fail(i64 noundef %61, i64 noundef %62, i32 noundef %63)
  br label %66

66:                                               ; preds = %65, %60
  %67 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 264), align 8, !tbaa !5
  %68 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 272), align 16, !tbaa !11
  %69 = load i32, ptr getelementptr inbounds (i8, ptr @version_tests, i64 280), align 8, !tbaa !12
  %70 = tail call i32 @ssh_compatible_openssl(i64 noundef %67, i64 noundef %68) #4
  %.not.11 = icmp eq i32 %70, %69
  br i1 %.not.11, label %72, label %71

71:                                               ; preds = %66
  tail call void @fail(i64 noundef %67, i64 noundef %68, i32 noundef %69)
  br label %72

72:                                               ; preds = %71, %66
  %73 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 288), align 16, !tbaa !5
  %74 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 296), align 8, !tbaa !11
  %75 = load i32, ptr getelementptr inbounds (i8, ptr @version_tests, i64 304), align 16, !tbaa !12
  %76 = tail call i32 @ssh_compatible_openssl(i64 noundef %73, i64 noundef %74) #4
  %.not.12 = icmp eq i32 %76, %75
  br i1 %.not.12, label %78, label %77

77:                                               ; preds = %72
  tail call void @fail(i64 noundef %73, i64 noundef %74, i32 noundef %75)
  br label %78

78:                                               ; preds = %77, %72
  %79 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 312), align 8, !tbaa !5
  %80 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 320), align 16, !tbaa !11
  %81 = load i32, ptr getelementptr inbounds (i8, ptr @version_tests, i64 328), align 8, !tbaa !12
  %82 = tail call i32 @ssh_compatible_openssl(i64 noundef %79, i64 noundef %80) #4
  %.not.13 = icmp eq i32 %82, %81
  br i1 %.not.13, label %84, label %83

83:                                               ; preds = %78
  tail call void @fail(i64 noundef %79, i64 noundef %80, i32 noundef %81)
  br label %84

84:                                               ; preds = %83, %78
  %85 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 336), align 16, !tbaa !5
  %86 = load i64, ptr getelementptr inbounds (i8, ptr @version_tests, i64 344), align 8, !tbaa !11
  %87 = load i32, ptr getelementptr inbounds (i8, ptr @version_tests, i64 352), align 16, !tbaa !12
  %88 = tail call i32 @ssh_compatible_openssl(i64 noundef %85, i64 noundef %86) #4
  %.not.14 = icmp eq i32 %88, %87
  br i1 %.not.14, label %90, label %89

89:                                               ; preds = %84
  tail call void @fail(i64 noundef %85, i64 noundef %86, i32 noundef %87)
  br label %90

90:                                               ; preds = %89, %84
  tail call void @exit(i32 noundef 0) #5
  unreachable
}

declare i32 @ssh_compatible_openssl(i64 noundef, i64 noundef) local_unnamed_addr #3

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 = { noreturn 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 #2 = { noreturn 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 #3 = { "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 }
attributes #5 = { noreturn 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 = !{!"version_test", !7, i64 0, !7, i64 8, !10, i64 16}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 8}
!12 = !{!6, !10, i64 16}


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