; LLVM IR from ARMmbed/mbed-crypto :: programs/pkey (pk_decrypt)

; 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_pk_context = type { ptr, ptr }
%struct.mbedtls_entropy_context = type { i32, %struct.mbedtls_sha512_context, i32, [20 x %struct.mbedtls_entropy_source_state] }
%struct.mbedtls_sha512_context = type { [2 x i64], [8 x i64], [128 x i8], i32 }
%struct.mbedtls_entropy_source_state = type { ptr, ptr, i64, i64, i32 }
%struct.mbedtls_ctr_drbg_context = type { [16 x i8], i32, i32, i64, i32, %struct.mbedtls_aes_context, ptr, ptr }
%struct.mbedtls_aes_context = type { i32, ptr, [68 x i32] }

@.str = external hidden unnamed_addr constant [19 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [44 x i8], align 1
@stdout = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca %struct.mbedtls_pk_context, align 8
  %13 = alloca %struct.mbedtls_entropy_context, align 8
  %14 = alloca %struct.mbedtls_ctr_drbg_context, align 8
  %15 = alloca [1024 x i8], align 16
  %16 = alloca [512 x i8], align 16
  %17 = alloca ptr, align 8
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 1, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store i64 0, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 1032, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 344, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 1024, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 512, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  store ptr @.str, ptr %17, align 8, !tbaa !9
  %18 = load ptr, ptr %5, align 8, !tbaa !9
  call void @mbedtls_pk_init(ptr noundef %12)
  call void @mbedtls_entropy_init(ptr noundef %13)
  call void @mbedtls_ctr_drbg_init(ptr noundef %14)
  %19 = getelementptr inbounds [1024 x i8], ptr %15, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %19, i8 0, i64 1024, i1 false)
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = icmp ne i32 %20, 2
  br i1 %21, label %22, label %24

22:                                               ; preds = %2
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  br label %93

24:                                               ; preds = %2
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %26 = load ptr, ptr @stdout, align 8, !tbaa !9
  %27 = call i32 @fflush(ptr noundef %26)
  %28 = load ptr, ptr %17, align 8, !tbaa !9
  %29 = load ptr, ptr %17, align 8, !tbaa !9
  %30 = call i64 @strlen(ptr noundef %29) #6
  %31 = call i32 @mbedtls_ctr_drbg_seed(ptr noundef %14, ptr noundef @mbedtls_entropy_func, ptr noundef %13, ptr noundef %28, i64 noundef %30)
  store i32 %31, ptr %7, align 4, !tbaa !5
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %37

33:                                               ; preds = %24
  %34 = load i32, ptr %7, align 4, !tbaa !5
  %35 = sub nsw i32 0, %34
  %36 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %35)
  br label %93

37:                                               ; preds = %24
  %38 = load ptr, ptr %5, align 8, !tbaa !9
  %39 = getelementptr inbounds ptr, ptr %38, i64 1
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  %41 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef %40)
  %42 = load ptr, ptr @stdout, align 8, !tbaa !9
  %43 = call i32 @fflush(ptr noundef %42)
  %44 = load ptr, ptr %5, align 8, !tbaa !9
  %45 = getelementptr inbounds ptr, ptr %44, i64 1
  %46 = load ptr, ptr %45, align 8, !tbaa !9
  %47 = call i32 @mbedtls_pk_parse_keyfile(ptr noundef %12, ptr noundef %46, ptr noundef @.str.5)
  store i32 %47, ptr %7, align 4, !tbaa !5
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %53

49:                                               ; preds = %37
  %50 = load i32, ptr %7, align 4, !tbaa !5
  %51 = sub nsw i32 0, %50
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %51)
  br label %93

53:                                               ; preds = %37
  %54 = call noalias ptr @fopen(ptr noundef @.str.7, ptr noundef @.str.8)
  store ptr %54, ptr %6, align 8, !tbaa !9
  %55 = icmp eq ptr %54, null
  br i1 %55, label %56, label %58

56:                                               ; preds = %53
  %57 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, ptr noundef @.str.7)
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %93

58:                                               ; preds = %53
  store i64 0, ptr %10, align 8, !tbaa !11
  br label %59

59:                                               ; preds = %68, %58
  %60 = load ptr, ptr %6, align 8, !tbaa !9
  %61 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %60, ptr noundef @.str.10, ptr noundef %8)
  %62 = icmp sgt i32 %61, 0
  br i1 %62, label %63, label %66

63:                                               ; preds = %59
  %64 = load i64, ptr %10, align 8, !tbaa !11
  %65 = icmp ult i64 %64, 512
  br label %66

66:                                               ; preds = %63, %59
  %67 = phi i1 [ false, %59 ], [ %65, %63 ]
  br i1 %67, label %68, label %74

68:                                               ; preds = %66
  %69 = load i32, ptr %8, align 4, !tbaa !5
  %70 = trunc i32 %69 to i8
  %71 = load i64, ptr %10, align 8, !tbaa !11
  %72 = add i64 %71, 1
  store i64 %72, ptr %10, align 8, !tbaa !11
  %73 = getelementptr inbounds [512 x i8], ptr %16, i64 0, i64 %71
  store i8 %70, ptr %73, align 1, !tbaa !13
  br label %59, !llvm.loop !14

74:                                               ; preds = %66
  %75 = load ptr, ptr %6, align 8, !tbaa !9
  %76 = call i32 @fclose(ptr noundef %75)
  %77 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  %78 = load ptr, ptr @stdout, align 8, !tbaa !9
  %79 = call i32 @fflush(ptr noundef %78)
  %80 = getelementptr inbounds [512 x i8], ptr %16, i64 0, i64 0
  %81 = load i64, ptr %10, align 8, !tbaa !11
  %82 = getelementptr inbounds [1024 x i8], ptr %15, i64 0, i64 0
  %83 = call i32 @mbedtls_pk_decrypt(ptr noundef %12, ptr noundef %80, i64 noundef %81, ptr noundef %82, ptr noundef %11, i64 noundef 1024, ptr noundef @mbedtls_ctr_drbg_random, ptr noundef %14)
  store i32 %83, ptr %7, align 4, !tbaa !5
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %89

85:                                               ; preds = %74
  %86 = load i32, ptr %7, align 4, !tbaa !5
  %87 = sub nsw i32 0, %86
  %88 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, i32 noundef %87)
  br label %93

89:                                               ; preds = %74
  %90 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  %91 = getelementptr inbounds [1024 x i8], ptr %15, i64 0, i64 0
  %92 = call i32 (ptr, ...) @printf(ptr noundef @.str.14, ptr noundef %91)
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %89, %85, %56, %49, %33, %22
  call void @mbedtls_pk_free(ptr noundef %12)
  call void @mbedtls_entropy_free(ptr noundef %13)
  call void @mbedtls_ctr_drbg_free(ptr noundef %14)
  %94 = load i32, ptr %9, align 4, !tbaa !5
  %95 = icmp ne i32 %94, 0
  br i1 %95, label %96, label %101

96:                                               ; preds = %93
  %97 = load i32, ptr %7, align 4, !tbaa !5
  %98 = getelementptr inbounds [512 x i8], ptr %16, i64 0, i64 0
  call void @mbedtls_strerror(i32 noundef %97, ptr noundef %98, i64 noundef 512)
  %99 = getelementptr inbounds [512 x i8], ptr %16, i64 0, i64 0
  %100 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, ptr noundef %99)
  br label %101

101:                                              ; preds = %96, %93
  %102 = load i32, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 512, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 344, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 1032, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  ret i32 %102
}

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

declare void @mbedtls_pk_init(ptr noundef) #2

declare void @mbedtls_entropy_init(ptr noundef) #2

declare void @mbedtls_ctr_drbg_init(ptr noundef) #2

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

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

declare i32 @fflush(ptr noundef) #2

declare i32 @mbedtls_ctr_drbg_seed(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) #2

declare i32 @mbedtls_entropy_func(ptr noundef, ptr noundef, i64 noundef) #2

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

declare i32 @mbedtls_pk_parse_keyfile(ptr noundef, ptr noundef, ptr noundef) #2

declare noalias ptr @fopen(ptr noundef, ptr noundef) #2

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

declare i32 @fclose(ptr noundef) #2

declare i32 @mbedtls_pk_decrypt(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #2

declare i32 @mbedtls_ctr_drbg_random(ptr noundef, ptr noundef, i64 noundef) #2

declare void @mbedtls_pk_free(ptr noundef) #2

declare void @mbedtls_entropy_free(ptr noundef) #2

declare void @mbedtls_ctr_drbg_free(ptr noundef) #2

declare void @mbedtls_strerror(i32 noundef, ptr noundef, i64 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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.mbedtls_pk_context = type { ptr, ptr }
%struct.mbedtls_entropy_context = type { i32, %struct.mbedtls_sha512_context, i32, [20 x %struct.mbedtls_entropy_source_state] }
%struct.mbedtls_sha512_context = type { [2 x i64], [8 x i64], [128 x i8], i32 }
%struct.mbedtls_entropy_source_state = type { ptr, ptr, i64, i64, i32 }
%struct.mbedtls_ctr_drbg_context = type { [16 x i8], i32, i32, i64, i32, %struct.mbedtls_aes_context, ptr, ptr }
%struct.mbedtls_aes_context = type { i32, ptr, [68 x i32] }

@.str = external hidden unnamed_addr constant [19 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [44 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca %struct.mbedtls_pk_context, align 8
  %6 = alloca %struct.mbedtls_entropy_context, align 8
  %7 = alloca %struct.mbedtls_ctr_drbg_context, align 8
  %8 = alloca [1024 x i8], align 16
  %9 = alloca [512 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  store i64 0, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 1032, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 344, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %9) #6
  call void @mbedtls_pk_init(ptr noundef nonnull %5) #6
  call void @mbedtls_entropy_init(ptr noundef nonnull %6) #6
  call void @mbedtls_ctr_drbg_init(ptr noundef nonnull %7) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %8, i8 0, i64 1024, i1 false)
  %.not = icmp eq i32 %0, 2
  br i1 %.not, label %12, label %10

10:                                               ; preds = %2
  %11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %58

12:                                               ; preds = %2
  %13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %14 = load ptr, ptr @stdout, align 8, !tbaa !9
  %15 = call i32 @fflush(ptr noundef %14)
  %16 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) @.str) #7
  %17 = call i32 @mbedtls_ctr_drbg_seed(ptr noundef nonnull %7, ptr noundef nonnull @mbedtls_entropy_func, ptr noundef nonnull %6, ptr noundef nonnull @.str, i64 noundef %16) #6
  %.not22 = icmp eq i32 %17, 0
  br i1 %.not22, label %21, label %18

18:                                               ; preds = %12
  %19 = sub nsw i32 0, %17
  %20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %19)
  br label %58

21:                                               ; preds = %12
  %22 = getelementptr inbounds i8, ptr %1, i64 8
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  %24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef %23)
  %25 = load ptr, ptr @stdout, align 8, !tbaa !9
  %26 = call i32 @fflush(ptr noundef %25)
  %27 = load ptr, ptr %22, align 8, !tbaa !9
  %28 = call i32 @mbedtls_pk_parse_keyfile(ptr noundef nonnull %5, ptr noundef %27, ptr noundef nonnull @.str.5) #6
  %.not23 = icmp eq i32 %28, 0
  br i1 %.not23, label %32, label %29

29:                                               ; preds = %21
  %30 = sub nsw i32 0, %28
  %31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %30)
  br label %58

32:                                               ; preds = %21
  %33 = call noalias ptr @fopen(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.8)
  %34 = icmp eq ptr %33, null
  br i1 %34, label %37, label %.preheader

.preheader:                                       ; preds = %32
  %35 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef nonnull %33, ptr noundef nonnull @.str.10, ptr noundef nonnull %3) #6
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %.lr.ph, label %._crit_edge

37:                                               ; preds = %32
  %38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, ptr noundef nonnull @.str.7)
  br label %58

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.01626 = phi i64 [ %41, %.lr.ph ], [ 0, %.preheader ]
  %39 = load i32, ptr %3, align 4, !tbaa !11
  %40 = trunc i32 %39 to i8
  %41 = add nuw nsw i64 %.01626, 1
  %42 = getelementptr inbounds [512 x i8], ptr %9, i64 0, i64 %.01626
  store i8 %40, ptr %42, align 1, !tbaa !13
  %43 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef nonnull %33, ptr noundef nonnull @.str.10, ptr noundef nonnull %3) #6
  %44 = icmp sgt i32 %43, 0
  %45 = icmp ult i64 %.01626, 511
  %46 = and i1 %44, %45
  br i1 %46, label %.lr.ph, label %._crit_edge, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %.016.lcssa = phi i64 [ 0, %.preheader ], [ %41, %.lr.ph ]
  %47 = call i32 @fclose(ptr noundef nonnull %33)
  %48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  %49 = load ptr, ptr @stdout, align 8, !tbaa !9
  %50 = call i32 @fflush(ptr noundef %49)
  %51 = call i32 @mbedtls_pk_decrypt(ptr noundef nonnull %5, ptr noundef nonnull %9, i64 noundef %.016.lcssa, ptr noundef nonnull %8, ptr noundef nonnull %4, i64 noundef 1024, ptr noundef nonnull @mbedtls_ctr_drbg_random, ptr noundef nonnull %7) #6
  %.not24 = icmp eq i32 %51, 0
  br i1 %.not24, label %55, label %52

52:                                               ; preds = %._crit_edge
  %53 = sub nsw i32 0, %51
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, i32 noundef %53)
  br label %58

55:                                               ; preds = %._crit_edge
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  %57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14, ptr noundef nonnull %8)
  br label %58

58:                                               ; preds = %55, %52, %37, %29, %18, %10
  %.not25 = phi i1 [ false, %10 ], [ false, %18 ], [ false, %29 ], [ false, %37 ], [ false, %52 ], [ true, %55 ]
  %.017 = phi i32 [ 1, %10 ], [ 1, %18 ], [ 1, %29 ], [ 1, %37 ], [ 1, %52 ], [ 0, %55 ]
  %.0 = phi i32 [ 1, %10 ], [ %17, %18 ], [ %28, %29 ], [ 1, %37 ], [ %51, %52 ], [ 0, %55 ]
  call void @mbedtls_pk_free(ptr noundef nonnull %5) #6
  call void @mbedtls_entropy_free(ptr noundef nonnull %6) #6
  call void @mbedtls_ctr_drbg_free(ptr noundef nonnull %7) #6
  br i1 %.not25, label %61, label %59

59:                                               ; preds = %58
  call void @mbedtls_strerror(i32 noundef %.0, ptr noundef nonnull %9, i64 noundef 512) #6
  %60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, ptr noundef nonnull %9)
  br label %61

61:                                               ; preds = %59, %58
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 344, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 1032, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  ret i32 %.017
}

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

declare void @mbedtls_pk_init(ptr noundef) local_unnamed_addr #2

declare void @mbedtls_entropy_init(ptr noundef) local_unnamed_addr #2

declare void @mbedtls_ctr_drbg_init(ptr noundef) local_unnamed_addr #2

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #4

declare i32 @mbedtls_ctr_drbg_seed(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare i32 @mbedtls_entropy_func(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5

declare i32 @mbedtls_pk_parse_keyfile(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #4

declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #4

declare i32 @mbedtls_pk_decrypt(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @mbedtls_ctr_drbg_random(ptr noundef, ptr noundef, i64 noundef) #2

declare void @mbedtls_pk_free(ptr noundef) local_unnamed_addr #2

declare void @mbedtls_entropy_free(ptr noundef) local_unnamed_addr #2

declare void @mbedtls_ctr_drbg_free(ptr noundef) local_unnamed_addr #2

declare void @mbedtls_strerror(i32 noundef, ptr noundef, i64 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { 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 = !{!"long", !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 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass