; LLVM IR from guanzhi/GmSSL :: tools (certparse)

; 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"

@stdin = external global ptr, align 8
@stdout = external global ptr, align 8
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@options = external hidden global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@usage = external hidden global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@stderr = external global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @certparse_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 ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca [18192 x i8], align 16
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, 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 8, ptr %7) #6
  %16 = load ptr, ptr %5, align 8, !tbaa !9
  %17 = getelementptr inbounds ptr, ptr %16, i64 0
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  store ptr %18, ptr %7, align 8, !tbaa !9
  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 8, ptr %9) #6
  store ptr null, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %19 = load ptr, ptr @stdin, align 8, !tbaa !9
  store ptr %19, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %20 = load ptr, ptr @stdout, align 8, !tbaa !9
  store ptr %20, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 18192, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = add nsw i32 %21, -1
  store i32 %22, ptr %4, align 4, !tbaa !5
  %23 = load ptr, ptr %5, align 8, !tbaa !9
  %24 = getelementptr inbounds ptr, ptr %23, i32 1
  store ptr %24, ptr %5, align 8, !tbaa !9
  br label %25

25:                                               ; preds = %105, %2
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = icmp sgt i32 %26, 0
  br i1 %27, label %28, label %110

28:                                               ; preds = %25
  %29 = load ptr, ptr %5, align 8, !tbaa !9
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = call i32 @strcmp(ptr noundef %30, ptr noundef @.str) #7
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %39, label %33

33:                                               ; preds = %28
  %34 = load ptr, ptr %7, align 8, !tbaa !9
  %35 = load ptr, ptr @options, align 8, !tbaa !9
  %36 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, ptr noundef %34, ptr noundef %35)
  %37 = load ptr, ptr @usage, align 8, !tbaa !9
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %37)
  br label %143

39:                                               ; preds = %28
  %40 = load ptr, ptr %5, align 8, !tbaa !9
  %41 = load ptr, ptr %40, align 8, !tbaa !9
  %42 = call i32 @strcmp(ptr noundef %41, ptr noundef @.str.3) #7
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %65, label %44

44:                                               ; preds = %39
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = add nsw i32 %45, -1
  store i32 %46, ptr %4, align 4, !tbaa !5
  %47 = icmp slt i32 %46, 1
  br i1 %47, label %48, label %49

48:                                               ; preds = %44
  br label %97

49:                                               ; preds = %44
  %50 = load ptr, ptr %5, align 8, !tbaa !9
  %51 = getelementptr inbounds ptr, ptr %50, i32 1
  store ptr %51, ptr %5, align 8, !tbaa !9
  %52 = load ptr, ptr %51, align 8, !tbaa !9
  store ptr %52, ptr %8, align 8, !tbaa !9
  %53 = load ptr, ptr %8, align 8, !tbaa !9
  %54 = call noalias ptr @fopen(ptr noundef %53, ptr noundef @.str.4)
  store ptr %54, ptr %10, align 8, !tbaa !9
  %55 = icmp ne ptr %54, null
  br i1 %55, label %64, label %56

56:                                               ; preds = %49
  %57 = load ptr, ptr @stderr, align 8, !tbaa !9
  %58 = load ptr, ptr %7, align 8, !tbaa !9
  %59 = load ptr, ptr %8, align 8, !tbaa !9
  %60 = call ptr @__errno_location() #8
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = call ptr @strerror(i32 noundef %61) #6
  %63 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef @.str.5, ptr noundef %58, ptr noundef %59, ptr noundef %62) #6
  br label %143

64:                                               ; preds = %49
  br label %104

65:                                               ; preds = %39
  %66 = load ptr, ptr %5, align 8, !tbaa !9
  %67 = load ptr, ptr %66, align 8, !tbaa !9
  %68 = call i32 @strcmp(ptr noundef %67, ptr noundef @.str.6) #7
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %91, label %70

70:                                               ; preds = %65
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = add nsw i32 %71, -1
  store i32 %72, ptr %4, align 4, !tbaa !5
  %73 = icmp slt i32 %72, 1
  br i1 %73, label %74, label %75

74:                                               ; preds = %70
  br label %97

75:                                               ; preds = %70
  %76 = load ptr, ptr %5, align 8, !tbaa !9
  %77 = getelementptr inbounds ptr, ptr %76, i32 1
  store ptr %77, ptr %5, align 8, !tbaa !9
  %78 = load ptr, ptr %77, align 8, !tbaa !9
  store ptr %78, ptr %9, align 8, !tbaa !9
  %79 = load ptr, ptr %9, align 8, !tbaa !9
  %80 = call noalias ptr @fopen(ptr noundef %79, ptr noundef @.str.7)
  store ptr %80, ptr %11, align 8, !tbaa !9
  %81 = icmp ne ptr %80, null
  br i1 %81, label %90, label %82

82:                                               ; preds = %75
  %83 = load ptr, ptr @stderr, align 8, !tbaa !9
  %84 = load ptr, ptr %7, align 8, !tbaa !9
  %85 = load ptr, ptr %9, align 8, !tbaa !9
  %86 = call ptr @__errno_location() #8
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = call ptr @strerror(i32 noundef %87) #6
  %89 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %83, ptr noundef @.str.5, ptr noundef %84, ptr noundef %85, ptr noundef %88) #6
  br label %143

90:                                               ; preds = %75
  br label %103

91:                                               ; preds = %65
  %92 = load ptr, ptr @stderr, align 8, !tbaa !9
  %93 = load ptr, ptr %7, align 8, !tbaa !9
  %94 = load ptr, ptr %5, align 8, !tbaa !9
  %95 = load ptr, ptr %94, align 8, !tbaa !9
  %96 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %92, ptr noundef @.str.8, ptr noundef %93, ptr noundef %95) #6
  br label %143

97:                                               ; preds = %74, %48
  %98 = load ptr, ptr @stderr, align 8, !tbaa !9
  %99 = load ptr, ptr %7, align 8, !tbaa !9
  %100 = load ptr, ptr %5, align 8, !tbaa !9
  %101 = load ptr, ptr %100, align 8, !tbaa !9
  %102 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %98, ptr noundef @.str.9, ptr noundef %99, ptr noundef %101) #6
  br label %143

103:                                              ; preds = %90
  br label %104

104:                                              ; preds = %103, %64
  br label %105

105:                                              ; preds = %104
  %106 = load i32, ptr %4, align 4, !tbaa !5
  %107 = add nsw i32 %106, -1
  store i32 %107, ptr %4, align 4, !tbaa !5
  %108 = load ptr, ptr %5, align 8, !tbaa !9
  %109 = getelementptr inbounds ptr, ptr %108, i32 1
  store ptr %109, ptr %5, align 8, !tbaa !9
  br label %25, !llvm.loop !11

110:                                              ; preds = %25
  br label %111

111:                                              ; preds = %142, %110
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %112 = getelementptr inbounds [18192 x i8], ptr %12, i64 0, i64 0
  %113 = load ptr, ptr %10, align 8, !tbaa !9
  %114 = call i32 @x509_cert_from_pem(ptr noundef %112, ptr noundef %13, i64 noundef 18192, ptr noundef %113)
  store i32 %114, ptr %14, align 4, !tbaa !5
  %115 = icmp ne i32 %114, 1
  br i1 %115, label %116, label %125

116:                                              ; preds = %111
  %117 = load i32, ptr %14, align 4, !tbaa !5
  %118 = icmp slt i32 %117, 0
  br i1 %118, label %119, label %123

119:                                              ; preds = %116
  %120 = load ptr, ptr @stderr, align 8, !tbaa !9
  %121 = load ptr, ptr %7, align 8, !tbaa !9
  %122 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %120, ptr noundef @.str.10, ptr noundef %121) #6
  br label %124

123:                                              ; preds = %116
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %124

124:                                              ; preds = %123, %119
  store i32 4, ptr %15, align 4
  br label %140

125:                                              ; preds = %111
  %126 = load ptr, ptr %11, align 8, !tbaa !9
  %127 = getelementptr inbounds [18192 x i8], ptr %12, i64 0, i64 0
  %128 = load i64, ptr %13, align 8, !tbaa !13
  %129 = call i32 @x509_cert_print(ptr noundef %126, i32 noundef 0, i32 noundef 0, ptr noundef @.str.11, ptr noundef %127, i64 noundef %128)
  %130 = getelementptr inbounds [18192 x i8], ptr %12, i64 0, i64 0
  %131 = load i64, ptr %13, align 8, !tbaa !13
  %132 = load ptr, ptr %11, align 8, !tbaa !9
  %133 = call i32 @x509_cert_to_pem(ptr noundef %130, i64 noundef %131, ptr noundef %132)
  %134 = icmp ne i32 %133, 1
  br i1 %134, label %135, label %139

135:                                              ; preds = %125
  %136 = load ptr, ptr @stderr, align 8, !tbaa !9
  %137 = load ptr, ptr %7, align 8, !tbaa !9
  %138 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %136, ptr noundef @.str.12, ptr noundef %137) #6
  store i32 4, ptr %15, align 4
  br label %140

139:                                              ; preds = %125
  store i32 0, ptr %15, align 4
  br label %140

140:                                              ; preds = %139, %135, %124
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  %141 = load i32, ptr %15, align 4
  switch i32 %141, label %163 [
    i32 0, label %142
    i32 4, label %143
  ]

142:                                              ; preds = %140
  br label %111

143:                                              ; preds = %140, %97, %91, %82, %56, %33
  %144 = load ptr, ptr %8, align 8, !tbaa !9
  %145 = icmp ne ptr %144, null
  br i1 %145, label %146, label %152

146:                                              ; preds = %143
  %147 = load ptr, ptr %10, align 8, !tbaa !9
  %148 = icmp ne ptr %147, null
  br i1 %148, label %149, label %152

149:                                              ; preds = %146
  %150 = load ptr, ptr %10, align 8, !tbaa !9
  %151 = call i32 @fclose(ptr noundef %150)
  br label %152

152:                                              ; preds = %149, %146, %143
  %153 = load ptr, ptr %9, align 8, !tbaa !9
  %154 = icmp ne ptr %153, null
  br i1 %154, label %155, label %161

155:                                              ; preds = %152
  %156 = load ptr, ptr %11, align 8, !tbaa !9
  %157 = icmp ne ptr %156, null
  br i1 %157, label %158, label %161

158:                                              ; preds = %155
  %159 = load ptr, ptr %11, align 8, !tbaa !9
  %160 = call i32 @fclose(ptr noundef %159)
  br label %161

161:                                              ; preds = %158, %155, %152
  %162 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %162, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %163

163:                                              ; preds = %161, %140
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 18192, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, 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 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %164 = load i32, ptr %3, align 4
  ret i32 %164
}

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

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

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

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

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

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) #4

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #5

declare i32 @x509_cert_from_pem(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #3

declare i32 @x509_cert_print(ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, i64 noundef) #3

declare i32 @x509_cert_to_pem(ptr noundef, i64 noundef, ptr noundef) #3

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

declare i32 @fclose(ptr noundef) #3

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 "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 willreturn memory(none) "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) }
attributes #8 = { nounwind willreturn memory(none) }

!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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}


; 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"

@stdin = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@options = external hidden local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@usage = external hidden local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @certparse_main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca [18192 x i8], align 16
  %4 = alloca i64, align 8
  %5 = load ptr, ptr %1, align 8, !tbaa !5
  %6 = load ptr, ptr @stdin, align 8, !tbaa !5
  %7 = load ptr, ptr @stdout, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 18192, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %8 = icmp sgt i32 %0, 1
  br i1 %8, label %.lr.ph.preheader, label %.preheader

.lr.ph.preheader:                                 ; preds = %2
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  br label %.lr.ph

.preheader:                                       ; preds = %50, %2
  %.049.lcssa = phi ptr [ null, %2 ], [ %.150, %50 ]
  %.046.lcssa = phi ptr [ null, %2 ], [ %.147, %50 ]
  %.043.lcssa = phi ptr [ %6, %2 ], [ %.144, %50 ]
  %.042.lcssa = phi ptr [ %7, %2 ], [ %.1, %50 ]
  br label %53

.lr.ph:                                           ; preds = %.lr.ph.preheader, %50
  %.042121 = phi ptr [ %.1, %50 ], [ %7, %.lr.ph.preheader ]
  %.043120 = phi ptr [ %.144, %50 ], [ %6, %.lr.ph.preheader ]
  %.046119 = phi ptr [ %.147, %50 ], [ null, %.lr.ph.preheader ]
  %.049118 = phi ptr [ %.150, %50 ], [ null, %.lr.ph.preheader ]
  %.052.in117 = phi i32 [ %.153, %50 ], [ %0, %.lr.ph.preheader ]
  %.057116 = phi ptr [ %51, %50 ], [ %9, %.lr.ph.preheader ]
  %10 = load ptr, ptr %.057116, align 8, !tbaa !5
  %11 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %10, ptr noundef nonnull dereferenceable(1) @.str) #8
  %.not67 = icmp eq i32 %11, 0
  br i1 %.not67, label %12, label %17

12:                                               ; preds = %.lr.ph
  %13 = load ptr, ptr @options, align 8, !tbaa !5
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef %5, ptr noundef %13)
  %15 = load ptr, ptr @usage, align 8, !tbaa !5
  %16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef %15)
  br label %.thread

17:                                               ; preds = %.lr.ph
  %18 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %10, ptr noundef nonnull dereferenceable(1) @.str.3) #8
  %.not68 = icmp eq i32 %18, 0
  br i1 %.not68, label %19, label %30

19:                                               ; preds = %17
  %20 = icmp eq i32 %.052.in117, 2
  br i1 %20, label %47, label %21

21:                                               ; preds = %19
  %22 = getelementptr inbounds i8, ptr %.057116, i64 8
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  %24 = tail call noalias ptr @fopen(ptr noundef %23, ptr noundef nonnull @.str.4)
  %.not69 = icmp eq ptr %24, null
  br i1 %.not69, label %.thread76, label %50

.thread76:                                        ; preds = %21
  %25 = load ptr, ptr @stderr, align 8, !tbaa !5
  %26 = tail call ptr @__errno_location() #9
  %27 = load i32, ptr %26, align 4, !tbaa !9
  %28 = tail call ptr @strerror(i32 noundef %27) #7
  %29 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.5, ptr noundef %5, ptr noundef %23, ptr noundef %28) #10
  br label %72

30:                                               ; preds = %17
  %31 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %10, ptr noundef nonnull dereferenceable(1) @.str.6) #8
  %.not70 = icmp eq i32 %31, 0
  br i1 %.not70, label %32, label %44

32:                                               ; preds = %30
  %33 = icmp eq i32 %.052.in117, 2
  br i1 %33, label %47, label %34

34:                                               ; preds = %32
  %35 = getelementptr inbounds i8, ptr %.057116, i64 8
  %36 = load ptr, ptr %35, align 8, !tbaa !5
  %37 = tail call noalias ptr @fopen(ptr noundef %36, ptr noundef nonnull @.str.7)
  %.not71 = icmp eq ptr %37, null
  br i1 %.not71, label %38, label %50

38:                                               ; preds = %34
  %39 = load ptr, ptr @stderr, align 8, !tbaa !5
  %40 = tail call ptr @__errno_location() #9
  %41 = load i32, ptr %40, align 4, !tbaa !9
  %42 = tail call ptr @strerror(i32 noundef %41) #7
  %43 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef nonnull @.str.5, ptr noundef %5, ptr noundef %36, ptr noundef %42) #10
  br label %.thread

44:                                               ; preds = %30
  %45 = load ptr, ptr @stderr, align 8, !tbaa !5
  %46 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.8, ptr noundef %5, ptr noundef %10) #10
  br label %.thread

47:                                               ; preds = %32, %19
  %48 = load ptr, ptr @stderr, align 8, !tbaa !5
  %49 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef nonnull @.str.9, ptr noundef %5, ptr noundef %10) #10
  br label %.thread

50:                                               ; preds = %21, %34
  %.150 = phi ptr [ %.049118, %34 ], [ %23, %21 ]
  %.147 = phi ptr [ %36, %34 ], [ %.046119, %21 ]
  %.144 = phi ptr [ %.043120, %34 ], [ %24, %21 ]
  %.1 = phi ptr [ %37, %34 ], [ %.042121, %21 ]
  %.153 = add nsw i32 %.052.in117, -2
  %51 = getelementptr inbounds i8, ptr %.057116, i64 16
  %52 = icmp sgt i32 %.052.in117, 3
  br i1 %52, label %.lr.ph, label %.preheader, !llvm.loop !11

53:                                               ; preds = %.preheader, %60
  %54 = call i32 @x509_cert_from_pem(ptr noundef nonnull %3, ptr noundef nonnull %4, i64 noundef 18192, ptr noundef %.043.lcssa) #7
  %.not = icmp eq i32 %54, 1
  br i1 %.not, label %60, label %55

55:                                               ; preds = %53
  %56 = icmp slt i32 %54, 0
  br i1 %56, label %57, label %.thread

57:                                               ; preds = %55
  %58 = load ptr, ptr @stderr, align 8, !tbaa !5
  %59 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %58, ptr noundef nonnull @.str.10, ptr noundef %5) #10
  br label %.thread

60:                                               ; preds = %53
  %61 = load i64, ptr %4, align 8, !tbaa !13
  %62 = call i32 @x509_cert_print(ptr noundef %.042.lcssa, i32 noundef 0, i32 noundef 0, ptr noundef nonnull @.str.11, ptr noundef nonnull %3, i64 noundef %61) #7
  %63 = load i64, ptr %4, align 8, !tbaa !13
  %64 = call i32 @x509_cert_to_pem(ptr noundef nonnull %3, i64 noundef %63, ptr noundef %.042.lcssa) #7
  %.not66 = icmp eq i32 %64, 1
  br i1 %.not66, label %53, label %65

65:                                               ; preds = %60
  %66 = load ptr, ptr @stderr, align 8, !tbaa !5
  %67 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %66, ptr noundef nonnull @.str.12, ptr noundef %5) #10
  br label %.thread

.thread:                                          ; preds = %57, %55, %65, %47, %44, %38, %12
  %.049109 = phi ptr [ %.049118, %44 ], [ %.049118, %47 ], [ %.049118, %38 ], [ %.049118, %12 ], [ %.049.lcssa, %55 ], [ %.049.lcssa, %57 ], [ %.049.lcssa, %65 ]
  %.04398 = phi ptr [ %.043120, %44 ], [ %.043120, %47 ], [ %.043120, %38 ], [ %.043120, %12 ], [ %.043.lcssa, %55 ], [ %.043.lcssa, %57 ], [ %.043.lcssa, %65 ]
  %.3 = phi i32 [ 1, %44 ], [ 1, %47 ], [ 1, %38 ], [ 1, %12 ], [ 0, %55 ], [ 1, %57 ], [ 1, %65 ]
  %.248 = phi ptr [ %.046119, %44 ], [ %.046119, %47 ], [ %36, %38 ], [ %.046119, %12 ], [ %.046.lcssa, %55 ], [ %.046.lcssa, %57 ], [ %.046.lcssa, %65 ]
  %.2 = phi ptr [ %.042121, %44 ], [ %.042121, %47 ], [ null, %38 ], [ %.042121, %12 ], [ %.042.lcssa, %55 ], [ %.042.lcssa, %57 ], [ %.042.lcssa, %65 ]
  %68 = icmp ne ptr %.049109, null
  %69 = icmp ne ptr %.04398, null
  %or.cond = select i1 %68, i1 %69, i1 false
  br i1 %or.cond, label %70, label %72

70:                                               ; preds = %.thread
  %71 = call i32 @fclose(ptr noundef nonnull %.04398)
  br label %72

72:                                               ; preds = %.thread76, %70, %.thread
  %.285 = phi ptr [ %.042121, %.thread76 ], [ %.2, %70 ], [ %.2, %.thread ]
  %.24884 = phi ptr [ %.046119, %.thread76 ], [ %.248, %70 ], [ %.248, %.thread ]
  %.383 = phi i32 [ 1, %.thread76 ], [ %.3, %70 ], [ %.3, %.thread ]
  %73 = icmp ne ptr %.24884, null
  %74 = icmp ne ptr %.285, null
  %or.cond3 = select i1 %73, i1 %74, i1 false
  br i1 %or.cond3, label %75, label %77

75:                                               ; preds = %72
  %76 = call i32 @fclose(ptr noundef nonnull %.285)
  br label %77

77:                                               ; preds = %72, %75
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 18192, ptr nonnull %3) #7
  ret i32 %.383
}

; 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 nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture 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 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: nounwind
declare ptr @strerror(i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #5

declare i32 @x509_cert_from_pem(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #6

declare i32 @x509_cert_print(ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #6

declare i32 @x509_cert_to_pem(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #6

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { 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 nosync nounwind willreturn memory(none) "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 = { "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) }
attributes #9 = { nounwind willreturn memory(none) }
attributes #10 = { cold 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}


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