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

; 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
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [14 x i8], align 1
@options = external hidden global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1
@stdout = external global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [4 x i8], align 1

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

25:                                               ; preds = %2
  %26 = load ptr, ptr @stderr, align 8, !tbaa !9
  %27 = load ptr, ptr %7, align 8, !tbaa !9
  %28 = load ptr, ptr @options, align 8, !tbaa !9
  %29 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef @.str, ptr noundef %27, ptr noundef %28) #7
  store i32 1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %146

30:                                               ; preds = %2
  br label %31

31:                                               ; preds = %82, %30
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = icmp sgt i32 %32, 1
  br i1 %33, label %34, label %87

34:                                               ; preds = %31
  %35 = load ptr, ptr %5, align 8, !tbaa !9
  %36 = load ptr, ptr %35, align 8, !tbaa !9
  %37 = call i32 @strcmp(ptr noundef %36, ptr noundef @.str.1) #8
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %43, label %39

39:                                               ; preds = %34
  %40 = load ptr, ptr %7, align 8, !tbaa !9
  %41 = load ptr, ptr @options, align 8, !tbaa !9
  %42 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %40, ptr noundef %41)
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %133

43:                                               ; preds = %34
  %44 = load ptr, ptr %5, align 8, !tbaa !9
  %45 = load ptr, ptr %44, align 8, !tbaa !9
  %46 = call i32 @strcmp(ptr noundef %45, ptr noundef @.str.2) #8
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %69, label %48

48:                                               ; preds = %43
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = add nsw i32 %49, -1
  store i32 %50, ptr %4, align 4, !tbaa !5
  %51 = icmp slt i32 %50, 1
  br i1 %51, label %52, label %53

52:                                               ; preds = %48
  br label %75

53:                                               ; preds = %48
  %54 = load ptr, ptr %5, align 8, !tbaa !9
  %55 = getelementptr inbounds ptr, ptr %54, i32 1
  store ptr %55, ptr %5, align 8, !tbaa !9
  %56 = load ptr, ptr %55, align 8, !tbaa !9
  store ptr %56, ptr %8, align 8, !tbaa !9
  %57 = load ptr, ptr %8, align 8, !tbaa !9
  %58 = call noalias ptr @fopen(ptr noundef %57, ptr noundef @.str.3)
  store ptr %58, ptr %9, align 8, !tbaa !9
  %59 = icmp ne ptr %58, null
  br i1 %59, label %68, label %60

60:                                               ; preds = %53
  %61 = load ptr, ptr @stderr, align 8, !tbaa !9
  %62 = load ptr, ptr %7, align 8, !tbaa !9
  %63 = load ptr, ptr %8, align 8, !tbaa !9
  %64 = call ptr @__errno_location() #9
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = call ptr @strerror(i32 noundef %65) #7
  %67 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %61, ptr noundef @.str.4, ptr noundef %62, ptr noundef %63, ptr noundef %66) #7
  br label %133

68:                                               ; preds = %53
  br label %81

69:                                               ; preds = %43
  %70 = load ptr, ptr @stderr, align 8, !tbaa !9
  %71 = load ptr, ptr %7, align 8, !tbaa !9
  %72 = load ptr, ptr %5, align 8, !tbaa !9
  %73 = load ptr, ptr %72, align 8, !tbaa !9
  %74 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %70, ptr noundef @.str.5, ptr noundef %71, ptr noundef %73) #7
  br label %133

75:                                               ; preds = %52
  %76 = load ptr, ptr @stderr, align 8, !tbaa !9
  %77 = load ptr, ptr %7, align 8, !tbaa !9
  %78 = load ptr, ptr %5, align 8, !tbaa !9
  %79 = load ptr, ptr %78, align 8, !tbaa !9
  %80 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %76, ptr noundef @.str.6, ptr noundef %77, ptr noundef %79) #7
  br label %133

81:                                               ; preds = %68
  br label %82

82:                                               ; preds = %81
  %83 = load i32, ptr %4, align 4, !tbaa !5
  %84 = add nsw i32 %83, -1
  store i32 %84, ptr %4, align 4, !tbaa !5
  %85 = load ptr, ptr %5, align 8, !tbaa !9
  %86 = getelementptr inbounds ptr, ptr %85, i32 1
  store ptr %86, ptr %5, align 8, !tbaa !9
  br label %31, !llvm.loop !11

87:                                               ; preds = %31
  %88 = load ptr, ptr %8, align 8, !tbaa !9
  %89 = icmp ne ptr %88, null
  br i1 %89, label %94, label %90

90:                                               ; preds = %87
  %91 = load ptr, ptr @stderr, align 8, !tbaa !9
  %92 = load ptr, ptr %7, align 8, !tbaa !9
  %93 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %91, ptr noundef @.str.7, ptr noundef %92) #7
  br label %133

94:                                               ; preds = %87
  %95 = load ptr, ptr %9, align 8, !tbaa !9
  %96 = call i32 @file_size(ptr noundef %95, ptr noundef %10)
  %97 = icmp ne i32 %96, 1
  br i1 %97, label %98, label %106

98:                                               ; preds = %94
  %99 = load ptr, ptr @stderr, align 8, !tbaa !9
  %100 = load ptr, ptr %7, align 8, !tbaa !9
  %101 = load ptr, ptr %8, align 8, !tbaa !9
  %102 = call ptr @__errno_location() #9
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = call ptr @strerror(i32 noundef %103) #7
  %105 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %99, ptr noundef @.str.8, ptr noundef %100, ptr noundef %101, ptr noundef %104) #7
  br label %133

106:                                              ; preds = %94
  %107 = load i64, ptr %10, align 8, !tbaa !13
  %108 = mul i64 %107, 3
  %109 = udiv i64 %108, 4
  %110 = add i64 %109, 1
  store i64 %110, ptr %12, align 8, !tbaa !13
  %111 = load i64, ptr %12, align 8, !tbaa !13
  %112 = call noalias ptr @malloc(i64 noundef %111) #10
  store ptr %112, ptr %11, align 8, !tbaa !9
  %113 = icmp ne ptr %112, null
  br i1 %113, label %118, label %114

114:                                              ; preds = %106
  %115 = load ptr, ptr @stderr, align 8, !tbaa !9
  %116 = load ptr, ptr %7, align 8, !tbaa !9
  %117 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %115, ptr noundef @.str.9, ptr noundef %116) #7
  br label %133

118:                                              ; preds = %106
  %119 = load ptr, ptr %11, align 8, !tbaa !9
  %120 = load i64, ptr %12, align 8, !tbaa !13
  %121 = load ptr, ptr %9, align 8, !tbaa !9
  %122 = call i32 @cms_from_pem(ptr noundef %119, ptr noundef %13, i64 noundef %120, ptr noundef %121)
  %123 = icmp ne i32 %122, 1
  br i1 %123, label %124, label %128

124:                                              ; preds = %118
  %125 = load ptr, ptr @stderr, align 8, !tbaa !9
  %126 = load ptr, ptr %7, align 8, !tbaa !9
  %127 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %125, ptr noundef @.str.10, ptr noundef %126) #7
  br label %133

128:                                              ; preds = %118
  %129 = load ptr, ptr @stdout, align 8, !tbaa !9
  %130 = load ptr, ptr %11, align 8, !tbaa !9
  %131 = load i64, ptr %13, align 8, !tbaa !13
  %132 = call i32 @cms_print(ptr noundef %129, i32 noundef 0, i32 noundef 0, ptr noundef @.str.11, ptr noundef %130, i64 noundef %131)
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %133

133:                                              ; preds = %128, %124, %114, %98, %90, %75, %69, %60, %39
  %134 = load ptr, ptr %9, align 8, !tbaa !9
  %135 = icmp ne ptr %134, null
  br i1 %135, label %136, label %139

136:                                              ; preds = %133
  %137 = load ptr, ptr %9, align 8, !tbaa !9
  %138 = call i32 @fclose(ptr noundef %137)
  br label %139

139:                                              ; preds = %136, %133
  %140 = load ptr, ptr %11, align 8, !tbaa !9
  %141 = icmp ne ptr %140, null
  br i1 %141, label %142, label %144

142:                                              ; preds = %139
  %143 = load ptr, ptr %11, align 8, !tbaa !9
  call void @free(ptr noundef %143) #7
  br label %144

144:                                              ; preds = %142, %139
  %145 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %145, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %146

146:                                              ; preds = %144, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %147 = load i32, ptr %3, align 4
  ret i32 %147
}

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

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

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

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

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

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

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

declare i32 @file_size(ptr noundef, ptr noundef) #4

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #6

declare i32 @cms_from_pem(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #4

declare i32 @cms_print(ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, i64 noundef) #4

declare i32 @fclose(ptr noundef) #4

; Function Attrs: nounwind
declare void @free(ptr 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 = { 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 #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 = { "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 allocsize(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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { nounwind willreturn memory(none) }
attributes #10 = { nounwind allocsize(0) }

!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
@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [14 x i8], align 1
@options = external hidden local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @cmsparse_main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = load ptr, ptr %1, align 8, !tbaa !5
  %6 = load ptr, ptr @stdin, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #9
  %7 = icmp slt i32 %0, 2
  br i1 %7, label %9, label %.preheader

.preheader:                                       ; preds = %2
  %.not81 = icmp eq i32 %0, 2
  br i1 %.not81, label %._crit_edge.thread, label %.lr.ph.preheader

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

9:                                                ; preds = %2
  %10 = load ptr, ptr @stderr, align 8, !tbaa !5
  %11 = load ptr, ptr @options, align 8, !tbaa !5
  %12 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %10, ptr noundef nonnull @.str, ptr noundef %5, ptr noundef %11) #10
  br label %.thread105

.lr.ph:                                           ; preds = %.lr.ph.preheader, %32
  %.03879 = phi ptr [ %23, %32 ], [ %6, %.lr.ph.preheader ]
  %.040.in78 = phi i32 [ %33, %32 ], [ %0, %.lr.ph.preheader ]
  %.04277 = phi ptr [ %34, %32 ], [ %8, %.lr.ph.preheader ]
  %13 = load ptr, ptr %.04277, align 8, !tbaa !5
  %14 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %13, ptr noundef nonnull dereferenceable(1) @.str.1) #11
  %.not52 = icmp eq i32 %14, 0
  br i1 %.not52, label %15, label %18

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

18:                                               ; preds = %.lr.ph
  %19 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %13, ptr noundef nonnull dereferenceable(1) @.str.2) #11
  %.not53 = icmp eq i32 %19, 0
  br i1 %.not53, label %20, label %29

20:                                               ; preds = %18
  %21 = getelementptr inbounds i8, ptr %.04277, i64 8
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  %23 = tail call noalias ptr @fopen(ptr noundef %22, ptr noundef nonnull @.str.3)
  %.not54 = icmp eq ptr %23, null
  br i1 %.not54, label %.thread63, label %32

.thread63:                                        ; preds = %20
  %24 = load ptr, ptr @stderr, align 8, !tbaa !5
  %25 = tail call ptr @__errno_location() #12
  %26 = load i32, ptr %25, align 4, !tbaa !9
  %27 = tail call ptr @strerror(i32 noundef %26) #9
  %28 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef nonnull @.str.4, ptr noundef %5, ptr noundef %22, ptr noundef %27) #10
  br label %.thread105

29:                                               ; preds = %18
  %30 = load ptr, ptr @stderr, align 8, !tbaa !5
  %31 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef nonnull @.str.5, ptr noundef %5, ptr noundef %13) #10
  br label %64

32:                                               ; preds = %20
  %33 = add nsw i32 %.040.in78, -2
  %34 = getelementptr inbounds i8, ptr %.04277, i64 16
  %35 = icmp sgt i32 %.040.in78, 4
  br i1 %35, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %32
  %.not = icmp eq ptr %22, null
  br i1 %.not, label %._crit_edge.thread, label %38

._crit_edge.thread:                               ; preds = %.preheader, %._crit_edge
  %.038.lcssa95 = phi ptr [ %23, %._crit_edge ], [ %6, %.preheader ]
  %36 = load ptr, ptr @stderr, align 8, !tbaa !5
  %37 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef nonnull @.str.7, ptr noundef %5) #10
  br label %64

38:                                               ; preds = %._crit_edge
  %39 = call i32 @file_size(ptr noundef nonnull %23, ptr noundef nonnull %3) #9
  %.not49 = icmp eq i32 %39, 1
  br i1 %.not49, label %46, label %40

40:                                               ; preds = %38
  %41 = load ptr, ptr @stderr, align 8, !tbaa !5
  %42 = tail call ptr @__errno_location() #12
  %43 = load i32, ptr %42, align 4, !tbaa !9
  %44 = call ptr @strerror(i32 noundef %43) #9
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %41, ptr noundef nonnull @.str.8, ptr noundef %5, ptr noundef nonnull %22, ptr noundef %44) #10
  br label %.thread115

46:                                               ; preds = %38
  %47 = load i64, ptr %3, align 8, !tbaa !13
  %48 = mul i64 %47, 3
  %49 = lshr i64 %48, 2
  %50 = add nuw nsw i64 %49, 1
  %51 = call noalias ptr @malloc(i64 noundef %50) #13
  %.not50 = icmp eq ptr %51, null
  br i1 %.not50, label %52, label %55

52:                                               ; preds = %46
  %53 = load ptr, ptr @stderr, align 8, !tbaa !5
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef nonnull @.str.9, ptr noundef %5) #10
  br label %.thread115

55:                                               ; preds = %46
  %56 = call i32 @cms_from_pem(ptr noundef nonnull %51, ptr noundef nonnull %4, i64 noundef %50, ptr noundef nonnull %23) #9
  %.not51 = icmp eq i32 %56, 1
  br i1 %.not51, label %60, label %57

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 %67

60:                                               ; preds = %55
  %61 = load ptr, ptr @stdout, align 8, !tbaa !5
  %62 = load i64, ptr %4, align 8, !tbaa !13
  %63 = call i32 @cms_print(ptr noundef %61, i32 noundef 0, i32 noundef 0, ptr noundef nonnull @.str.11, ptr noundef nonnull %51, i64 noundef %62) #9
  br label %67

64:                                               ; preds = %._crit_edge.thread, %29, %15
  %.03870 = phi ptr [ %.03879, %29 ], [ %.03879, %15 ], [ %.038.lcssa95, %._crit_edge.thread ]
  %.041 = phi i32 [ 1, %29 ], [ 0, %15 ], [ 1, %._crit_edge.thread ]
  %.not55 = icmp eq ptr %.03870, null
  br i1 %.not55, label %.thread105, label %.thread109

.thread109:                                       ; preds = %64
  %65 = tail call i32 @fclose(ptr noundef nonnull %.03870)
  br label %.thread105

.thread115:                                       ; preds = %52, %40
  %66 = call i32 @fclose(ptr noundef nonnull %23)
  br label %.thread105

67:                                               ; preds = %60, %57
  %.041.ph = phi i32 [ 0, %60 ], [ 1, %57 ]
  %68 = call i32 @fclose(ptr noundef nonnull %23)
  call void @free(ptr noundef nonnull %51) #9
  br label %.thread105

.thread105:                                       ; preds = %64, %.thread115, %.thread109, %.thread63, %67, %9
  %.0 = phi i32 [ 1, %9 ], [ %.041.ph, %67 ], [ 1, %.thread63 ], [ %.041, %.thread109 ], [ 1, %.thread115 ], [ %.041, %64 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #9
  ret i32 %.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: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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

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

; 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 @file_size(ptr noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #7

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

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

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

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

; 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 = { 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 #3 = { 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 #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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(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 #8 = { 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 #9 = { nounwind }
attributes #10 = { cold nounwind }
attributes #11 = { nounwind willreturn memory(read) }
attributes #12 = { nounwind willreturn memory(none) }
attributes #13 = { nounwind allocsize(0) }

!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