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

; 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 [69 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 [34 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.16 = 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 i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca %struct.mbedtls_pk_context, align 8
  %12 = alloca %struct.mbedtls_entropy_context, align 8
  %13 = alloca %struct.mbedtls_ctr_drbg_context, align 8
  %14 = alloca [1024 x i8], align 16
  %15 = alloca [512 x i8], align 16
  %16 = 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) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 1032, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 344, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 1024, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 512, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  store ptr @.str, ptr %16, align 8, !tbaa !9
  call void @mbedtls_ctr_drbg_init(ptr noundef %13)
  call void @mbedtls_entropy_init(ptr noundef %12)
  call void @mbedtls_pk_init(ptr noundef %11)
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = icmp ne i32 %17, 3
  br i1 %18, label %19, label %21

19:                                               ; preds = %2
  %20 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  br label %112

21:                                               ; preds = %2
  %22 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %23 = load ptr, ptr @stdout, align 8, !tbaa !9
  %24 = call i32 @fflush(ptr noundef %23)
  %25 = load ptr, ptr %16, align 8, !tbaa !9
  %26 = load ptr, ptr %16, align 8, !tbaa !9
  %27 = call i64 @strlen(ptr noundef %26) #7
  %28 = call i32 @mbedtls_ctr_drbg_seed(ptr noundef %13, ptr noundef @mbedtls_entropy_func, ptr noundef %12, ptr noundef %25, i64 noundef %27)
  store i32 %28, ptr %7, align 4, !tbaa !5
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %34

30:                                               ; preds = %21
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = sub nsw i32 0, %31
  %33 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %32)
  br label %112

34:                                               ; preds = %21
  %35 = load ptr, ptr %5, align 8, !tbaa !9
  %36 = getelementptr inbounds ptr, ptr %35, i64 1
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef %37)
  %39 = load ptr, ptr @stdout, align 8, !tbaa !9
  %40 = call i32 @fflush(ptr noundef %39)
  %41 = load ptr, ptr %5, align 8, !tbaa !9
  %42 = getelementptr inbounds ptr, ptr %41, i64 1
  %43 = load ptr, ptr %42, align 8, !tbaa !9
  %44 = call i32 @mbedtls_pk_parse_public_keyfile(ptr noundef %11, ptr noundef %43)
  store i32 %44, ptr %7, align 4, !tbaa !5
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %50

46:                                               ; preds = %34
  %47 = load i32, ptr %7, align 4, !tbaa !5
  %48 = sub nsw i32 0, %47
  %49 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %48)
  br label %112

50:                                               ; preds = %34
  %51 = load ptr, ptr %5, align 8, !tbaa !9
  %52 = getelementptr inbounds ptr, ptr %51, i64 2
  %53 = load ptr, ptr %52, align 8, !tbaa !9
  %54 = call i64 @strlen(ptr noundef %53) #7
  %55 = icmp ugt i64 %54, 100
  br i1 %55, label %56, label %58

56:                                               ; preds = %50
  %57 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  br label %112

58:                                               ; preds = %50
  %59 = getelementptr inbounds [1024 x i8], ptr %14, i64 0, i64 0
  %60 = load ptr, ptr %5, align 8, !tbaa !9
  %61 = getelementptr inbounds ptr, ptr %60, i64 2
  %62 = load ptr, ptr %61, align 8, !tbaa !9
  %63 = load ptr, ptr %5, align 8, !tbaa !9
  %64 = getelementptr inbounds ptr, ptr %63, i64 2
  %65 = load ptr, ptr %64, align 8, !tbaa !9
  %66 = call i64 @strlen(ptr noundef %65) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %59, ptr align 1 %62, i64 %66, i1 false)
  %67 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  %68 = load ptr, ptr @stdout, align 8, !tbaa !9
  %69 = call i32 @fflush(ptr noundef %68)
  %70 = getelementptr inbounds [1024 x i8], ptr %14, i64 0, i64 0
  %71 = load ptr, ptr %5, align 8, !tbaa !9
  %72 = getelementptr inbounds ptr, ptr %71, i64 2
  %73 = load ptr, ptr %72, align 8, !tbaa !9
  %74 = call i64 @strlen(ptr noundef %73) #7
  %75 = getelementptr inbounds [512 x i8], ptr %15, i64 0, i64 0
  %76 = call i32 @mbedtls_pk_encrypt(ptr noundef %11, ptr noundef %70, i64 noundef %74, ptr noundef %75, ptr noundef %10, i64 noundef 512, ptr noundef @mbedtls_ctr_drbg_random, ptr noundef %13)
  store i32 %76, ptr %7, align 4, !tbaa !5
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %82

78:                                               ; preds = %58
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = sub nsw i32 0, %79
  %81 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, i32 noundef %80)
  br label %112

82:                                               ; preds = %58
  %83 = call noalias ptr @fopen(ptr noundef @.str.9, ptr noundef @.str.10)
  store ptr %83, ptr %6, align 8, !tbaa !9
  %84 = icmp eq ptr %83, null
  br i1 %84, label %85, label %87

85:                                               ; preds = %82
  %86 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, ptr noundef @.str.9)
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %112

87:                                               ; preds = %82
  store i64 0, ptr %9, align 8, !tbaa !11
  br label %88

88:                                               ; preds = %105, %87
  %89 = load i64, ptr %9, align 8, !tbaa !11
  %90 = load i64, ptr %10, align 8, !tbaa !11
  %91 = icmp ult i64 %89, %90
  br i1 %91, label %92, label %108

92:                                               ; preds = %88
  %93 = load ptr, ptr %6, align 8, !tbaa !9
  %94 = load i64, ptr %9, align 8, !tbaa !11
  %95 = getelementptr inbounds [512 x i8], ptr %15, i64 0, i64 %94
  %96 = load i8, ptr %95, align 1, !tbaa !13
  %97 = zext i8 %96 to i32
  %98 = load i64, ptr %9, align 8, !tbaa !11
  %99 = add i64 %98, 1
  %100 = urem i64 %99, 16
  %101 = icmp eq i64 %100, 0
  %102 = zext i1 %101 to i64
  %103 = select i1 %101, ptr @.str.13, ptr @.str.14
  %104 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %93, ptr noundef @.str.12, i32 noundef %97, ptr noundef %103) #6
  br label %105

105:                                              ; preds = %92
  %106 = load i64, ptr %9, align 8, !tbaa !11
  %107 = add i64 %106, 1
  store i64 %107, ptr %9, align 8, !tbaa !11
  br label %88, !llvm.loop !14

108:                                              ; preds = %88
  %109 = load ptr, ptr %6, align 8, !tbaa !9
  %110 = call i32 @fclose(ptr noundef %109)
  %111 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, ptr noundef @.str.9)
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %108, %85, %78, %56, %46, %30, %19
  call void @mbedtls_pk_free(ptr noundef %11)
  call void @mbedtls_entropy_free(ptr noundef %12)
  call void @mbedtls_ctr_drbg_free(ptr noundef %13)
  %113 = load i32, ptr %8, align 4, !tbaa !5
  %114 = icmp ne i32 %113, 0
  br i1 %114, label %115, label %120

115:                                              ; preds = %112
  %116 = load i32, ptr %7, align 4, !tbaa !5
  %117 = getelementptr inbounds [512 x i8], ptr %15, i64 0, i64 0
  call void @mbedtls_strerror(i32 noundef %116, ptr noundef %117, i64 noundef 512)
  %118 = getelementptr inbounds [512 x i8], ptr %15, i64 0, i64 0
  %119 = call i32 (ptr, ...) @printf(ptr noundef @.str.16, ptr noundef %118)
  br label %120

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

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

declare void @mbedtls_ctr_drbg_init(ptr noundef) #2

declare void @mbedtls_entropy_init(ptr noundef) #2

declare void @mbedtls_pk_init(ptr noundef) #2

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) #3

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

declare i32 @mbedtls_pk_encrypt(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 noalias ptr @fopen(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #5

declare i32 @fclose(ptr 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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #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 = !{!"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 [69 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 [34 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.16 = 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 i64, align 8
  %4 = alloca %struct.mbedtls_pk_context, align 8
  %5 = alloca %struct.mbedtls_entropy_context, align 8
  %6 = alloca %struct.mbedtls_ctr_drbg_context, align 8
  %7 = alloca [1024 x i8], align 16
  %8 = alloca [512 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  store i64 0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 1032, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 344, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %8) #6
  call void @mbedtls_ctr_drbg_init(ptr noundef nonnull %6) #6
  call void @mbedtls_entropy_init(ptr noundef nonnull %5) #6
  call void @mbedtls_pk_init(ptr noundef nonnull %4) #6
  %.not = icmp eq i32 %0, 3
  br i1 %.not, label %11, label %9

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

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

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

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

28:                                               ; preds = %20
  %29 = sub nsw i32 0, %27
  %30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %29)
  br label %66

31:                                               ; preds = %20
  %32 = getelementptr inbounds i8, ptr %1, i64 16
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %33) #7
  %35 = icmp ugt i64 %34, 100
  br i1 %35, label %36, label %38

36:                                               ; preds = %31
  %37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %66

38:                                               ; preds = %31
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %7, ptr align 1 %33, i64 %34, i1 false)
  %39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  %40 = load ptr, ptr @stdout, align 8, !tbaa !9
  %41 = call i32 @fflush(ptr noundef %40)
  %42 = load ptr, ptr %32, align 8, !tbaa !9
  %43 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %42) #7
  %44 = call i32 @mbedtls_pk_encrypt(ptr noundef nonnull %4, ptr noundef nonnull %7, i64 noundef %43, ptr noundef nonnull %8, ptr noundef nonnull %3, i64 noundef 512, ptr noundef nonnull @mbedtls_ctr_drbg_random, ptr noundef nonnull %6) #6
  %.not30 = icmp eq i32 %44, 0
  br i1 %.not30, label %48, label %45

45:                                               ; preds = %38
  %46 = sub nsw i32 0, %44
  %47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %46)
  br label %66

48:                                               ; preds = %38
  %49 = call noalias ptr @fopen(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.10)
  %50 = icmp eq ptr %49, null
  br i1 %50, label %52, label %.preheader

.preheader:                                       ; preds = %48
  %51 = load i64, ptr %3, align 8, !tbaa !5
  %.not33 = icmp eq i64 %51, 0
  br i1 %.not33, label %._crit_edge, label %.lr.ph

52:                                               ; preds = %48
  %53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, ptr noundef nonnull @.str.9)
  br label %66

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.02032 = phi i64 [ %57, %.lr.ph ], [ 0, %.preheader ]
  %54 = getelementptr inbounds [512 x i8], ptr %8, i64 0, i64 %.02032
  %55 = load i8, ptr %54, align 1, !tbaa !11
  %56 = zext i8 %55 to i32
  %57 = add nuw i64 %.02032, 1
  %58 = and i64 %57, 15
  %59 = icmp eq i64 %58, 0
  %60 = select i1 %59, ptr @.str.13, ptr @.str.14
  %61 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %49, ptr noundef nonnull @.str.12, i32 noundef %56, ptr noundef nonnull %60) #6
  %62 = load i64, ptr %3, align 8, !tbaa !5
  %63 = icmp ult i64 %57, %62
  br i1 %63, label %.lr.ph, label %._crit_edge, !llvm.loop !12

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %64 = call i32 @fclose(ptr noundef nonnull %49)
  %65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, ptr noundef nonnull @.str.9)
  br label %66

66:                                               ; preds = %._crit_edge, %52, %45, %36, %28, %17, %9
  %.not31 = phi i1 [ false, %9 ], [ false, %17 ], [ false, %28 ], [ false, %36 ], [ false, %45 ], [ false, %52 ], [ true, %._crit_edge ]
  %.021 = phi i32 [ 1, %9 ], [ 1, %17 ], [ 1, %28 ], [ 1, %36 ], [ 1, %45 ], [ 1, %52 ], [ 0, %._crit_edge ]
  %.0 = phi i32 [ 1, %9 ], [ %16, %17 ], [ %27, %28 ], [ 0, %36 ], [ %44, %45 ], [ 1, %52 ], [ 0, %._crit_edge ]
  call void @mbedtls_pk_free(ptr noundef nonnull %4) #6
  call void @mbedtls_entropy_free(ptr noundef nonnull %5) #6
  call void @mbedtls_ctr_drbg_free(ptr noundef nonnull %6) #6
  br i1 %.not31, label %69, label %67

67:                                               ; preds = %66
  call void @mbedtls_strerror(i32 noundef %.0, ptr noundef nonnull %8, i64 noundef 512) #6
  %68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16, ptr noundef nonnull %8)
  br label %69

69:                                               ; preds = %67, %66
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 344, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 1032, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  ret i32 %.021
}

; 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_ctr_drbg_init(ptr noundef) local_unnamed_addr #2

declare void @mbedtls_entropy_init(ptr noundef) local_unnamed_addr #2

declare void @mbedtls_pk_init(ptr noundef) local_unnamed_addr #2

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

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

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 #4

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

declare i32 @mbedtls_pk_encrypt(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

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

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

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

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 = { 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 = { 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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