; LLVM IR from ARMmbed/mbed-crypto :: programs/util (pem2der)

; 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.options = type { ptr, ptr }

@.str.2 = external hidden unnamed_addr constant [142 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@opt = external dso_local global %struct.options, align 8
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [30 x i8], align 1
@stdout = external global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [43 x i8], align 1

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca [4096 x i8], align 16
  %10 = alloca [1024 x i8], align 16
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = 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 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  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 8, ptr %8) #6
  store ptr null, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4096, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 1024, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store i64 4096, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %16 = getelementptr inbounds [1024 x i8], ptr %10, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %16, i8 0, i64 1024, i1 false)
  %17 = getelementptr inbounds [4096 x i8], ptr %9, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %17, i8 0, i64 4096, i1 false)
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %23

20:                                               ; preds = %2
  br label %21

21:                                               ; preds = %52, %37, %20
  %22 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %107

23:                                               ; preds = %2
  store ptr @.str.3, ptr @opt, align 8, !tbaa !13
  store ptr @.str.4, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 1), align 8, !tbaa !15
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %55, %23
  %25 = load i32, ptr %13, align 4, !tbaa !5
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %28, label %58

28:                                               ; preds = %24
  %29 = load ptr, ptr %5, align 8, !tbaa !9
  %30 = load i32, ptr %13, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds ptr, ptr %29, i64 %31
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  store ptr %33, ptr %14, align 8, !tbaa !9
  %34 = load ptr, ptr %14, align 8, !tbaa !9
  %35 = call ptr @strchr(ptr noundef %34, i32 noundef 61) #7
  store ptr %35, ptr %15, align 8, !tbaa !9
  %36 = icmp eq ptr %35, null
  br i1 %36, label %37, label %38

37:                                               ; preds = %28
  br label %21

38:                                               ; preds = %28
  %39 = load ptr, ptr %15, align 8, !tbaa !9
  %40 = getelementptr inbounds i8, ptr %39, i32 1
  store ptr %40, ptr %15, align 8, !tbaa !9
  store i8 0, ptr %39, align 1, !tbaa !16
  %41 = load ptr, ptr %14, align 8, !tbaa !9
  %42 = call i32 @strcmp(ptr noundef %41, ptr noundef @.str.5) #7
  %43 = icmp eq i32 %42, 0
  br i1 %43, label %44, label %46

44:                                               ; preds = %38
  %45 = load ptr, ptr %15, align 8, !tbaa !9
  store ptr %45, ptr @opt, align 8, !tbaa !13
  br label %54

46:                                               ; preds = %38
  %47 = load ptr, ptr %14, align 8, !tbaa !9
  %48 = call i32 @strcmp(ptr noundef %47, ptr noundef @.str.6) #7
  %49 = icmp eq i32 %48, 0
  br i1 %49, label %50, label %52

50:                                               ; preds = %46
  %51 = load ptr, ptr %15, align 8, !tbaa !9
  store ptr %51, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 1), align 8, !tbaa !15
  br label %53

52:                                               ; preds = %46
  br label %21

53:                                               ; preds = %50
  br label %54

54:                                               ; preds = %53, %44
  br label %55

55:                                               ; preds = %54
  %56 = load i32, ptr %13, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %13, align 4, !tbaa !5
  br label %24, !llvm.loop !17

58:                                               ; preds = %24
  %59 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  %60 = load ptr, ptr @stdout, align 8, !tbaa !9
  %61 = call i32 @fflush(ptr noundef %60)
  %62 = load ptr, ptr @opt, align 8, !tbaa !13
  %63 = call i32 @load_file(ptr noundef %62, ptr noundef %8, ptr noundef %11)
  store i32 %63, ptr %6, align 4, !tbaa !5
  %64 = load i32, ptr %6, align 4, !tbaa !5
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %66, label %72

66:                                               ; preds = %58
  %67 = load i32, ptr %6, align 4, !tbaa !5
  %68 = getelementptr inbounds [1024 x i8], ptr %10, i64 0, i64 0
  call void @mbedtls_strerror(i32 noundef %67, ptr noundef %68, i64 noundef 1024)
  %69 = load i32, ptr %6, align 4, !tbaa !5
  %70 = getelementptr inbounds [1024 x i8], ptr %10, i64 0, i64 0
  %71 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, i32 noundef %69, ptr noundef %70)
  br label %107

72:                                               ; preds = %58
  %73 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %74 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  %75 = load ptr, ptr @stdout, align 8, !tbaa !9
  %76 = call i32 @fflush(ptr noundef %75)
  %77 = load ptr, ptr %8, align 8, !tbaa !9
  %78 = load i64, ptr %11, align 8, !tbaa !11
  %79 = getelementptr inbounds [4096 x i8], ptr %9, i64 0, i64 0
  %80 = call i32 @convert_pem_to_der(ptr noundef %77, i64 noundef %78, ptr noundef %79, ptr noundef %12)
  store i32 %80, ptr %6, align 4, !tbaa !5
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %88

82:                                               ; preds = %72
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = getelementptr inbounds [1024 x i8], ptr %10, i64 0, i64 0
  call void @mbedtls_strerror(i32 noundef %83, ptr noundef %84, i64 noundef 1024)
  %85 = load i32, ptr %6, align 4, !tbaa !5
  %86 = getelementptr inbounds [1024 x i8], ptr %10, i64 0, i64 0
  %87 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, i32 noundef %85, ptr noundef %86)
  br label %107

88:                                               ; preds = %72
  %89 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %90 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  %91 = load ptr, ptr @stdout, align 8, !tbaa !9
  %92 = call i32 @fflush(ptr noundef %91)
  %93 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 1), align 8, !tbaa !15
  %94 = getelementptr inbounds [4096 x i8], ptr %9, i64 0, i64 0
  %95 = load i64, ptr %12, align 8, !tbaa !11
  %96 = call i32 @write_file(ptr noundef %93, ptr noundef %94, i64 noundef %95)
  store i32 %96, ptr %6, align 4, !tbaa !5
  %97 = load i32, ptr %6, align 4, !tbaa !5
  %98 = icmp ne i32 %97, 0
  br i1 %98, label %99, label %105

99:                                               ; preds = %88
  %100 = load i32, ptr %6, align 4, !tbaa !5
  %101 = getelementptr inbounds [1024 x i8], ptr %10, i64 0, i64 0
  call void @mbedtls_strerror(i32 noundef %100, ptr noundef %101, i64 noundef 1024)
  %102 = load i32, ptr %6, align 4, !tbaa !5
  %103 = getelementptr inbounds [1024 x i8], ptr %10, i64 0, i64 0
  %104 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, i32 noundef %102, ptr noundef %103)
  br label %107

105:                                              ; preds = %88
  %106 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %107

107:                                              ; preds = %105, %99, %82, %66, %21
  %108 = load ptr, ptr %8, align 8, !tbaa !9
  call void @free(ptr noundef %108) #6
  %109 = load i32, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 1024, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4096, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  ret i32 %109
}

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

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

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

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

declare i32 @fflush(ptr noundef) #3

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

declare void @mbedtls_strerror(i32 noundef, ptr noundef, i64 noundef) #3

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #5

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 "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 = !{!14, !10, i64 0}
!14 = !{!"options", !10, i64 0, !10, i64 8}
!15 = !{!14, !10, i64 8}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"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.options = type { ptr, ptr }

@.str.2 = external hidden unnamed_addr constant [142 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@opt = external dso_local local_unnamed_addr global %struct.options, align 8
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [30 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [43 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @convert_pem_to_der(ptr noundef, i64 noundef, ptr noundef, 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) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 ptr, align 8
  %4 = alloca [4096 x i8], align 16
  %5 = alloca [1024 x i8], align 16
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  store ptr null, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  store i64 4096, ptr %7, align 8, !tbaa !9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %5, i8 0, i64 1024, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4096) %4, i8 0, i64 4096, i1 false)
  %8 = icmp eq i32 %0, 0
  br i1 %8, label %.loopexit, label %10

.loopexit:                                        ; preds = %20, %.lr.ph, %2
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %53

10:                                               ; preds = %2
  store ptr @.str.3, ptr @opt, align 8, !tbaa !11
  store ptr @.str.4, ptr getelementptr inbounds (i8, ptr @opt, i64 8), align 8, !tbaa !13
  %11 = icmp sgt i32 %0, 1
  br i1 %11, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %10
  %wide.trip.count = zext nneg i32 %0 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %23
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %23 ]
  %12 = getelementptr inbounds ptr, ptr %1, i64 %indvars.iv
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  %14 = tail call ptr @strchr(ptr noundef nonnull dereferenceable(1) %13, i32 noundef 61) #8
  %15 = icmp eq ptr %14, null
  br i1 %15, label %.loopexit, label %16

16:                                               ; preds = %.lr.ph
  %17 = getelementptr inbounds i8, ptr %14, i64 1
  store i8 0, ptr %14, align 1, !tbaa !14
  %18 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %13, ptr noundef nonnull dereferenceable(1) @.str.5) #8
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %23, label %20

20:                                               ; preds = %16
  %21 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %13, ptr noundef nonnull dereferenceable(1) @.str.6) #8
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %.loopexit

23:                                               ; preds = %20, %16
  %opt.sink = phi ptr [ @opt, %16 ], [ getelementptr inbounds (i8, ptr @opt, i64 8), %20 ]
  store ptr %17, ptr %opt.sink, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !15

._crit_edge:                                      ; preds = %23, %10
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  %25 = load ptr, ptr @stdout, align 8, !tbaa !5
  %26 = tail call i32 @fflush(ptr noundef %25)
  %27 = load ptr, ptr @opt, align 8, !tbaa !11
  %28 = call i32 @load_file(ptr noundef %27, ptr noundef nonnull %3, ptr noundef nonnull %6)
  %.not = icmp eq i32 %28, 0
  br i1 %.not, label %31, label %29

29:                                               ; preds = %._crit_edge
  call void @mbedtls_strerror(i32 noundef %28, ptr noundef nonnull %5, i64 noundef 1024) #7
  %30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %28, ptr noundef nonnull %5)
  br label %53

31:                                               ; preds = %._crit_edge
  %32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  %33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  %34 = load ptr, ptr @stdout, align 8, !tbaa !5
  %35 = call i32 @fflush(ptr noundef %34)
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = load i64, ptr %6, align 8, !tbaa !9
  %38 = call i32 @convert_pem_to_der(ptr noundef %36, i64 noundef %37, ptr noundef nonnull %4, ptr noundef nonnull %7)
  %.not26 = icmp eq i32 %38, 0
  br i1 %.not26, label %41, label %39

39:                                               ; preds = %31
  call void @mbedtls_strerror(i32 noundef %38, ptr noundef nonnull %5, i64 noundef 1024) #7
  %40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, i32 noundef %38, ptr noundef nonnull %5)
  br label %53

41:                                               ; preds = %31
  %42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  %43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  %44 = load ptr, ptr @stdout, align 8, !tbaa !5
  %45 = call i32 @fflush(ptr noundef %44)
  %46 = load ptr, ptr getelementptr inbounds (i8, ptr @opt, i64 8), align 8, !tbaa !13
  %47 = load i64, ptr %7, align 8, !tbaa !9
  %48 = call i32 @write_file(ptr noundef %46, ptr noundef nonnull %4, i64 noundef %47)
  %.not27 = icmp eq i32 %48, 0
  br i1 %.not27, label %51, label %49

49:                                               ; preds = %41
  call void @mbedtls_strerror(i32 noundef %48, ptr noundef nonnull %5, i64 noundef 1024) #7
  %50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, i32 noundef %48, ptr noundef nonnull %5)
  br label %53

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

53:                                               ; preds = %51, %49, %39, %29, %.loopexit
  %.020 = phi i32 [ 1, %.loopexit ], [ 1, %29 ], [ 1, %39 ], [ 1, %49 ], [ 0, %51 ]
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %54) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  ret i32 %.020
}

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strchr(ptr noundef, i32 noundef) local_unnamed_addr #4

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

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

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

declare void @mbedtls_strerror(i32 noundef, ptr noundef, i64 noundef) local_unnamed_addr #5

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #6

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #7 = { nounwind }
attributes #8 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"options", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


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