; LLVM IR from ARMmbed/mbed-crypto :: library (sha1)

; 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.mbedtls_sha1_context = type { [2 x i32], [5 x i32], [64 x i8] }

@.str = external hidden unnamed_addr constant [19 x i8], align 1
@sha1_test_buf = external hidden constant [3 x [57 x i8]], align 16
@sha1_test_buflen = external hidden constant [3 x i64], align 16
@sha1_test_sum = external hidden constant [3 x [20 x i8]], align 16
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @mbedtls_sha1_init(ptr noundef) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
declare dso_local void @mbedtls_sha1_free(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_sha1_starts_ret(ptr noundef) #0

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_sha1_finish_ret(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_sha1_self_test(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca [1024 x i8], align 16
  %8 = alloca [20 x i8], align 16
  %9 = alloca %struct.mbedtls_sha1_context, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1024, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 20, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 92, ptr %9) #5
  call void @mbedtls_sha1_init(ptr noundef %9)
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %79, %1
  %11 = load i32, ptr %3, align 4, !tbaa !5
  %12 = icmp slt i32 %11, 3
  br i1 %12, label %13, label %82

13:                                               ; preds = %10
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = icmp ne i32 %14, 0
  br i1 %15, label %16, label %20

16:                                               ; preds = %13
  %17 = load i32, ptr %3, align 4, !tbaa !5
  %18 = add nsw i32 %17, 1
  %19 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %18)
  br label %20

20:                                               ; preds = %16, %13
  %21 = call i32 @mbedtls_sha1_starts_ret(ptr noundef %9)
  store i32 %21, ptr %6, align 4, !tbaa !5
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %24

23:                                               ; preds = %20
  br label %88

24:                                               ; preds = %20
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = icmp eq i32 %25, 2
  br i1 %26, label %27, label %45

27:                                               ; preds = %24
  %28 = getelementptr inbounds [1024 x i8], ptr %7, i64 0, i64 0
  store i32 1000, ptr %5, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 16 %28, i8 97, i64 1000, i1 false)
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %41, %27
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = icmp slt i32 %30, 1000
  br i1 %31, label %32, label %44

32:                                               ; preds = %29
  %33 = getelementptr inbounds [1024 x i8], ptr %7, i64 0, i64 0
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = call i32 @mbedtls_sha1_update_ret(ptr noundef %9, ptr noundef %33, i64 noundef %35)
  store i32 %36, ptr %6, align 4, !tbaa !5
  %37 = load i32, ptr %6, align 4, !tbaa !5
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %40

39:                                               ; preds = %32
  br label %88

40:                                               ; preds = %32
  br label %41

41:                                               ; preds = %40
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %4, align 4, !tbaa !5
  br label %29, !llvm.loop !9

44:                                               ; preds = %29
  br label %59

45:                                               ; preds = %24
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [3 x [57 x i8]], ptr @sha1_test_buf, i64 0, i64 %47
  %49 = getelementptr inbounds [57 x i8], ptr %48, i64 0, i64 0
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [3 x i64], ptr @sha1_test_buflen, i64 0, i64 %51
  %53 = load i64, ptr %52, align 8, !tbaa !11
  %54 = call i32 @mbedtls_sha1_update_ret(ptr noundef %9, ptr noundef %49, i64 noundef %53)
  store i32 %54, ptr %6, align 4, !tbaa !5
  %55 = load i32, ptr %6, align 4, !tbaa !5
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %57, label %58

57:                                               ; preds = %45
  br label %88

58:                                               ; preds = %45
  br label %59

59:                                               ; preds = %58, %44
  %60 = getelementptr inbounds [20 x i8], ptr %8, i64 0, i64 0
  %61 = call i32 @mbedtls_sha1_finish_ret(ptr noundef %9, ptr noundef %60)
  store i32 %61, ptr %6, align 4, !tbaa !5
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %64

63:                                               ; preds = %59
  br label %88

64:                                               ; preds = %59
  %65 = getelementptr inbounds [20 x i8], ptr %8, i64 0, i64 0
  %66 = load i32, ptr %3, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [3 x [20 x i8]], ptr @sha1_test_sum, i64 0, i64 %67
  %69 = getelementptr inbounds [20 x i8], ptr %68, i64 0, i64 0
  %70 = call i32 @memcmp(ptr noundef %65, ptr noundef %69, i64 noundef 20) #6
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %73

72:                                               ; preds = %64
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %88

73:                                               ; preds = %64
  %74 = load i32, ptr %2, align 4, !tbaa !5
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %78

76:                                               ; preds = %73
  %77 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  br label %78

78:                                               ; preds = %76, %73
  br label %79

79:                                               ; preds = %78
  %80 = load i32, ptr %3, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %3, align 4, !tbaa !5
  br label %10, !llvm.loop !13

82:                                               ; preds = %10
  %83 = load i32, ptr %2, align 4, !tbaa !5
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %87

85:                                               ; preds = %82
  %86 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %87

87:                                               ; preds = %85, %82
  br label %94

88:                                               ; preds = %72, %63, %57, %39, %23
  %89 = load i32, ptr %2, align 4, !tbaa !5
  %90 = icmp ne i32 %89, 0
  br i1 %90, label %91, label %93

91:                                               ; preds = %88
  %92 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %93

93:                                               ; preds = %91, %88
  br label %94

94:                                               ; preds = %93, %87
  call void @mbedtls_sha1_free(ptr noundef %9)
  %95 = load i32, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 92, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 20, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  ret i32 %95
}

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #4

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 nounwind willreturn memory(argmem: write) }
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 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 #5 = { nounwind }
attributes #6 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !10}


; 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.mbedtls_sha1_context = type { [2 x i32], [5 x i32], [64 x i8] }

@.str = external hidden unnamed_addr constant [19 x i8], align 1
@sha1_test_buf = external hidden constant [3 x [57 x i8]], align 16
@sha1_test_buflen = external hidden local_unnamed_addr constant [3 x i64], align 16
@sha1_test_sum = external hidden constant [3 x [20 x i8]], align 16
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @mbedtls_sha1_init(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
declare dso_local void @mbedtls_sha1_free(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_sha1_starts_ret(ptr noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_sha1_finish_ret(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_sha1_self_test(i32 noundef %0) local_unnamed_addr #0 {
  %2 = alloca [1024 x i8], align 16
  %3 = alloca [20 x i8], align 16
  %4 = alloca %struct.mbedtls_sha1_context, align 4
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 92, ptr nonnull %4) #5
  call void @mbedtls_sha1_init(ptr noundef nonnull %4)
  %.not24 = icmp eq i32 %0, 0
  br i1 %.not24, label %.split.us.preheader, label %.split.preheader

.split.preheader:                                 ; preds = %1
  %5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 1)
  %6 = call i32 @mbedtls_sha1_starts_ret(ptr noundef nonnull %4)
  %.not25 = icmp eq i32 %6, 0
  br i1 %.not25, label %27, label %.loopexit30.thread.sink.split

.split.us.preheader:                              ; preds = %1
  %7 = call i32 @mbedtls_sha1_starts_ret(ptr noundef nonnull %4)
  %.not25.us = icmp eq i32 %7, 0
  br i1 %.not25.us, label %8, label %.loopexit30.thread

8:                                                ; preds = %.split.us.preheader
  %9 = load i64, ptr @sha1_test_buflen, align 16, !tbaa !5
  %10 = call i32 @mbedtls_sha1_update_ret(ptr noundef nonnull %4, ptr noundef nonnull @sha1_test_buf, i64 noundef %9)
  %.not26.us = icmp eq i32 %10, 0
  br i1 %.not26.us, label %.loopexit.us, label %.loopexit30.thread

.loopexit.us:                                     ; preds = %8
  %11 = call i32 @mbedtls_sha1_finish_ret(ptr noundef nonnull %4, ptr noundef nonnull %3)
  %.not27.us = icmp eq i32 %11, 0
  br i1 %.not27.us, label %12, label %.loopexit30.thread

12:                                               ; preds = %.loopexit.us
  %bcmp.us = call i32 @bcmp(ptr noundef nonnull dereferenceable(20) %3, ptr noundef nonnull dereferenceable(20) @sha1_test_sum, i64 20)
  %.not28.us = icmp eq i32 %bcmp.us, 0
  br i1 %.not28.us, label %.split.us.1, label %.loopexit30.thread

.split.us.1:                                      ; preds = %12
  %13 = call i32 @mbedtls_sha1_starts_ret(ptr noundef nonnull %4)
  %.not25.us.1 = icmp eq i32 %13, 0
  br i1 %.not25.us.1, label %14, label %.loopexit30.thread

14:                                               ; preds = %.split.us.1
  %15 = load i64, ptr getelementptr inbounds (i8, ptr @sha1_test_buflen, i64 8), align 8, !tbaa !5
  %16 = call i32 @mbedtls_sha1_update_ret(ptr noundef nonnull %4, ptr noundef nonnull getelementptr inbounds (i8, ptr @sha1_test_buf, i64 57), i64 noundef %15)
  %.not26.us.1 = icmp eq i32 %16, 0
  br i1 %.not26.us.1, label %.loopexit.us.1, label %.loopexit30.thread

.loopexit.us.1:                                   ; preds = %14
  %17 = call i32 @mbedtls_sha1_finish_ret(ptr noundef nonnull %4, ptr noundef nonnull %3)
  %.not27.us.1 = icmp eq i32 %17, 0
  br i1 %.not27.us.1, label %18, label %.loopexit30.thread

18:                                               ; preds = %.loopexit.us.1
  %bcmp.us.1 = call i32 @bcmp(ptr noundef nonnull dereferenceable(20) %3, ptr noundef nonnull dereferenceable(20) getelementptr inbounds (i8, ptr @sha1_test_sum, i64 20), i64 20)
  %.not28.us.1 = icmp eq i32 %bcmp.us.1, 0
  br i1 %.not28.us.1, label %.split.us.2, label %.loopexit30.thread

.split.us.2:                                      ; preds = %18
  %19 = call i32 @mbedtls_sha1_starts_ret(ptr noundef nonnull %4)
  %.not25.us.2 = icmp eq i32 %19, 0
  br i1 %.not25.us.2, label %20, label %.loopexit30.thread

20:                                               ; preds = %.split.us.2
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1000) %2, i8 97, i64 1000, i1 false)
  br label %21

21:                                               ; preds = %23, %20
  %.01834.us.2 = phi i32 [ 0, %20 ], [ %24, %23 ]
  %22 = call i32 @mbedtls_sha1_update_ret(ptr noundef nonnull %4, ptr noundef nonnull %2, i64 noundef 1000)
  %.not29.us.2 = icmp eq i32 %22, 0
  br i1 %.not29.us.2, label %23, label %.loopexit30

23:                                               ; preds = %21
  %24 = add nuw nsw i32 %.01834.us.2, 1
  %exitcond.257.not = icmp eq i32 %24, 1000
  br i1 %exitcond.257.not, label %.loopexit.us.2, label %21, !llvm.loop !9

.loopexit.us.2:                                   ; preds = %23
  %25 = call i32 @mbedtls_sha1_finish_ret(ptr noundef nonnull %4, ptr noundef nonnull %3)
  %.not27.us.2 = icmp eq i32 %25, 0
  br i1 %.not27.us.2, label %26, label %.loopexit30

26:                                               ; preds = %.loopexit.us.2
  %bcmp.us.2 = call i32 @bcmp(ptr noundef nonnull dereferenceable(20) %3, ptr noundef nonnull dereferenceable(20) getelementptr inbounds (i8, ptr @sha1_test_sum, i64 40), i64 20)
  %.not28.us.2 = icmp eq i32 %bcmp.us.2, 0
  br i1 %.not28.us.2, label %.split38.us, label %.loopexit30

27:                                               ; preds = %.split.preheader
  %28 = load i64, ptr @sha1_test_buflen, align 16, !tbaa !5
  %29 = call i32 @mbedtls_sha1_update_ret(ptr noundef nonnull %4, ptr noundef nonnull @sha1_test_buf, i64 noundef %28)
  %.not26 = icmp eq i32 %29, 0
  br i1 %.not26, label %.loopexit, label %.loopexit30.thread.sink.split

.loopexit:                                        ; preds = %27
  %30 = call i32 @mbedtls_sha1_finish_ret(ptr noundef nonnull %4, ptr noundef nonnull %3)
  %.not27 = icmp eq i32 %30, 0
  br i1 %.not27, label %31, label %.loopexit30.thread.sink.split

31:                                               ; preds = %.loopexit
  %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(20) %3, ptr noundef nonnull dereferenceable(20) @sha1_test_sum, i64 20)
  %.not28 = icmp eq i32 %bcmp, 0
  br i1 %.not28, label %.split.1, label %.loopexit30.thread.sink.split

.split.1:                                         ; preds = %31
  %32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 2)
  %34 = call i32 @mbedtls_sha1_starts_ret(ptr noundef nonnull %4)
  %.not25.1 = icmp eq i32 %34, 0
  br i1 %.not25.1, label %35, label %.loopexit30.thread.sink.split

35:                                               ; preds = %.split.1
  %36 = load i64, ptr getelementptr inbounds (i8, ptr @sha1_test_buflen, i64 8), align 8, !tbaa !5
  %37 = call i32 @mbedtls_sha1_update_ret(ptr noundef nonnull %4, ptr noundef nonnull getelementptr inbounds (i8, ptr @sha1_test_buf, i64 57), i64 noundef %36)
  %.not26.1 = icmp eq i32 %37, 0
  br i1 %.not26.1, label %.loopexit.1, label %.loopexit30.thread.sink.split

.loopexit.1:                                      ; preds = %35
  %38 = call i32 @mbedtls_sha1_finish_ret(ptr noundef nonnull %4, ptr noundef nonnull %3)
  %.not27.1 = icmp eq i32 %38, 0
  br i1 %.not27.1, label %39, label %.loopexit30.thread.sink.split

39:                                               ; preds = %.loopexit.1
  %bcmp.1 = call i32 @bcmp(ptr noundef nonnull dereferenceable(20) %3, ptr noundef nonnull dereferenceable(20) getelementptr inbounds (i8, ptr @sha1_test_sum, i64 20), i64 20)
  %.not28.1 = icmp eq i32 %bcmp.1, 0
  br i1 %.not28.1, label %.split.2, label %.loopexit30.thread.sink.split

.split.2:                                         ; preds = %39
  %40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 3)
  %42 = call i32 @mbedtls_sha1_starts_ret(ptr noundef nonnull %4)
  %.not25.2 = icmp eq i32 %42, 0
  br i1 %.not25.2, label %43, label %.loopexit30.thread.sink.split

43:                                               ; preds = %.split.2
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1000) %2, i8 97, i64 1000, i1 false)
  br label %44

44:                                               ; preds = %46, %43
  %.01834.2 = phi i32 [ 0, %43 ], [ %47, %46 ]
  %45 = call i32 @mbedtls_sha1_update_ret(ptr noundef nonnull %4, ptr noundef nonnull %2, i64 noundef 1000)
  %.not29.2 = icmp eq i32 %45, 0
  br i1 %.not29.2, label %46, label %.loopexit30

46:                                               ; preds = %44
  %47 = add nuw nsw i32 %.01834.2, 1
  %exitcond.2.not = icmp eq i32 %47, 1000
  br i1 %exitcond.2.not, label %.loopexit.2, label %44, !llvm.loop !9

.loopexit.2:                                      ; preds = %46
  %48 = call i32 @mbedtls_sha1_finish_ret(ptr noundef nonnull %4, ptr noundef nonnull %3)
  %.not27.2 = icmp eq i32 %48, 0
  br i1 %.not27.2, label %49, label %.loopexit30

49:                                               ; preds = %.loopexit.2
  %bcmp.2 = call i32 @bcmp(ptr noundef nonnull dereferenceable(20) %3, ptr noundef nonnull dereferenceable(20) getelementptr inbounds (i8, ptr @sha1_test_sum, i64 40), i64 20)
  %.not28.2 = icmp eq i32 %bcmp.2, 0
  br i1 %.not28.2, label %.split38.us.loopexit45, label %.loopexit30

.split38.us.loopexit45:                           ; preds = %49
  %50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %.split38.us

.split38.us:                                      ; preds = %26, %.split38.us.loopexit45
  br i1 %.not24, label %.loopexit30.thread, label %.loopexit30.thread.sink.split

.loopexit30:                                      ; preds = %44, %21, %.loopexit.2, %49, %.loopexit.us.2, %26
  %.1 = phi i32 [ %25, %.loopexit.us.2 ], [ 1, %26 ], [ %48, %.loopexit.2 ], [ 1, %49 ], [ %22, %21 ], [ %45, %44 ]
  br i1 %.not24, label %.loopexit30.thread, label %.loopexit30.thread.sink.split

.loopexit30.thread.sink.split:                    ; preds = %.loopexit30, %.split.preheader, %27, %.loopexit, %31, %.split.1, %35, %.loopexit.1, %39, %.split.2, %.split38.us
  %.str.3.sink = phi ptr [ @.str.2, %.split38.us ], [ @.str.3, %.split.2 ], [ @.str.3, %39 ], [ @.str.3, %.loopexit.1 ], [ @.str.3, %35 ], [ @.str.3, %.split.1 ], [ @.str.3, %31 ], [ @.str.3, %.loopexit ], [ @.str.3, %27 ], [ @.str.3, %.split.preheader ], [ @.str.3, %.loopexit30 ]
  %.2.ph = phi i32 [ 0, %.split38.us ], [ %42, %.split.2 ], [ 1, %39 ], [ %38, %.loopexit.1 ], [ %37, %35 ], [ %34, %.split.1 ], [ 1, %31 ], [ %30, %.loopexit ], [ %29, %27 ], [ %6, %.split.preheader ], [ %.1, %.loopexit30 ]
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
  br label %.loopexit30.thread

.loopexit30.thread:                               ; preds = %.loopexit30.thread.sink.split, %.split.us.2, %18, %.loopexit.us.1, %14, %.split.us.1, %.split.us.preheader, %8, %.loopexit.us, %12, %.loopexit30, %.split38.us
  %.2 = phi i32 [ %.1, %.loopexit30 ], [ 0, %.split38.us ], [ %19, %.split.us.2 ], [ 1, %18 ], [ %17, %.loopexit.us.1 ], [ %16, %14 ], [ %13, %.split.us.1 ], [ %7, %.split.us.preheader ], [ %10, %8 ], [ %11, %.loopexit.us ], [ 1, %12 ], [ %.2.ph, %.loopexit30.thread.sink.split ]
  call void @mbedtls_sha1_free(ptr noundef nonnull %4)
  call void @llvm.lifetime.end.p0(i64 92, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %2) #5
  ret i32 %.2
}

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

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #4

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 nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nofree nounwind willreturn memory(argmem: read) }
attributes #5 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimplifyCFGPass