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

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

@__const.crlverify_main.signer_id = external hidden unnamed_addr constant [8192 x i8], align 16
@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 [28 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @crlverify_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 [8192 x i8], align 16
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = 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
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  %18 = getelementptr inbounds ptr, ptr %17, i64 0
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  store ptr %19, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store ptr null, 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 8192, ptr %13) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %13, ptr align 16 @__const.crlverify_main.signer_id, i64 8192, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  store i64 16, ptr %14, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = add nsw i32 %20, -1
  store i32 %21, ptr %4, align 4, !tbaa !5
  %22 = load ptr, ptr %5, align 8, !tbaa !9
  %23 = getelementptr inbounds ptr, ptr %22, i32 1
  store ptr %23, ptr %5, align 8, !tbaa !9
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = icmp slt i32 %24, 1
  br i1 %25, label %26, label %31

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

31:                                               ; preds = %2
  br label %32

32:                                               ; preds = %172, %31
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %35, label %177

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

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

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

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

53:                                               ; preds = %49
  br label %162

54:                                               ; preds = %49
  %55 = load ptr, ptr %5, align 8, !tbaa !9
  %56 = getelementptr inbounds ptr, ptr %55, i32 1
  store ptr %56, ptr %5, align 8, !tbaa !9
  %57 = load ptr, ptr %56, align 8, !tbaa !9
  store ptr %57, ptr %8, align 8, !tbaa !9
  %58 = load ptr, ptr %8, align 8, !tbaa !9
  %59 = call i32 @file_read_all(ptr noundef %58, ptr noundef %9, ptr noundef %10)
  %60 = icmp ne i32 %59, 1
  br i1 %60, label %61, label %69

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

69:                                               ; preds = %54
  br label %171

70:                                               ; preds = %44
  %71 = load ptr, ptr %5, align 8, !tbaa !9
  %72 = load ptr, ptr %71, align 8, !tbaa !9
  %73 = call i32 @strcmp(ptr noundef %72, ptr noundef @.str.4) #8
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %96, label %75

75:                                               ; preds = %70
  %76 = load i32, ptr %4, align 4, !tbaa !5
  %77 = add nsw i32 %76, -1
  store i32 %77, ptr %4, align 4, !tbaa !5
  %78 = icmp slt i32 %77, 1
  br i1 %78, label %79, label %80

79:                                               ; preds = %75
  br label %162

80:                                               ; preds = %75
  %81 = load ptr, ptr %5, align 8, !tbaa !9
  %82 = getelementptr inbounds ptr, ptr %81, i32 1
  store ptr %82, ptr %5, align 8, !tbaa !9
  %83 = load ptr, ptr %82, align 8, !tbaa !9
  store ptr %83, ptr %8, align 8, !tbaa !9
  %84 = load ptr, ptr %8, align 8, !tbaa !9
  %85 = call i32 @x509_cert_new_from_file(ptr noundef %11, ptr noundef %12, ptr noundef %84)
  %86 = icmp ne i32 %85, 1
  br i1 %86, label %87, label %95

87:                                               ; preds = %80
  %88 = load ptr, ptr @stderr, align 8, !tbaa !9
  %89 = load ptr, ptr %7, align 8, !tbaa !9
  %90 = load ptr, ptr %8, align 8, !tbaa !9
  %91 = call ptr @__errno_location() #9
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = call ptr @strerror(i32 noundef %92) #7
  %94 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %88, ptr noundef @.str.5, ptr noundef %89, ptr noundef %90, ptr noundef %93) #7
  br label %224

95:                                               ; preds = %80
  br label %170

96:                                               ; preds = %70
  %97 = load ptr, ptr %5, align 8, !tbaa !9
  %98 = load ptr, ptr %97, align 8, !tbaa !9
  %99 = call i32 @strcmp(ptr noundef %98, ptr noundef @.str.6) #8
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %123, label %101

101:                                              ; preds = %96
  %102 = load i32, ptr %4, align 4, !tbaa !5
  %103 = add nsw i32 %102, -1
  store i32 %103, ptr %4, align 4, !tbaa !5
  %104 = icmp slt i32 %103, 1
  br i1 %104, label %105, label %106

105:                                              ; preds = %101
  br label %162

106:                                              ; preds = %101
  %107 = load ptr, ptr %5, align 8, !tbaa !9
  %108 = getelementptr inbounds ptr, ptr %107, i32 1
  store ptr %108, ptr %5, align 8, !tbaa !9
  %109 = load ptr, ptr %108, align 8, !tbaa !9
  store ptr %109, ptr %8, align 8, !tbaa !9
  %110 = load ptr, ptr %8, align 8, !tbaa !9
  %111 = call i64 @strlen(ptr noundef %110) #8
  %112 = icmp ugt i64 %111, 8191
  br i1 %112, label %113, label %117

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

117:                                              ; preds = %106
  %118 = getelementptr inbounds [8192 x i8], ptr %13, i64 0, i64 0
  %119 = load ptr, ptr %8, align 8, !tbaa !9
  %120 = call ptr @strncpy(ptr noundef %118, ptr noundef %119, i64 noundef 8192) #7
  %121 = load ptr, ptr %8, align 8, !tbaa !9
  %122 = call i64 @strlen(ptr noundef %121) #8
  store i64 %122, ptr %14, align 8, !tbaa !11
  br label %169

123:                                              ; preds = %96
  %124 = load ptr, ptr %5, align 8, !tbaa !9
  %125 = load ptr, ptr %124, align 8, !tbaa !9
  %126 = call i32 @strcmp(ptr noundef %125, ptr noundef @.str.8) #8
  %127 = icmp ne i32 %126, 0
  br i1 %127, label %156, label %128

128:                                              ; preds = %123
  %129 = load i32, ptr %4, align 4, !tbaa !5
  %130 = add nsw i32 %129, -1
  store i32 %130, ptr %4, align 4, !tbaa !5
  %131 = icmp slt i32 %130, 1
  br i1 %131, label %132, label %133

132:                                              ; preds = %128
  br label %162

133:                                              ; preds = %128
  %134 = load ptr, ptr %5, align 8, !tbaa !9
  %135 = getelementptr inbounds ptr, ptr %134, i32 1
  store ptr %135, ptr %5, align 8, !tbaa !9
  %136 = load ptr, ptr %135, align 8, !tbaa !9
  store ptr %136, ptr %8, align 8, !tbaa !9
  %137 = load ptr, ptr %8, align 8, !tbaa !9
  %138 = call i64 @strlen(ptr noundef %137) #8
  %139 = icmp ugt i64 %138, 16382
  br i1 %139, label %140, label %144

140:                                              ; preds = %133
  %141 = load ptr, ptr @stderr, align 8, !tbaa !9
  %142 = load ptr, ptr %7, align 8, !tbaa !9
  %143 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %141, ptr noundef @.str.9, ptr noundef %142) #7
  br label %224

144:                                              ; preds = %133
  %145 = load ptr, ptr %8, align 8, !tbaa !9
  %146 = load ptr, ptr %8, align 8, !tbaa !9
  %147 = call i64 @strlen(ptr noundef %146) #8
  %148 = getelementptr inbounds [8192 x i8], ptr %13, i64 0, i64 0
  %149 = call i32 @hex_to_bytes(ptr noundef %145, i64 noundef %147, ptr noundef %148, ptr noundef %14)
  %150 = icmp ne i32 %149, 1
  br i1 %150, label %151, label %155

151:                                              ; preds = %144
  %152 = load ptr, ptr @stderr, align 8, !tbaa !9
  %153 = load ptr, ptr %7, align 8, !tbaa !9
  %154 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %152, ptr noundef @.str.10, ptr noundef %153) #7
  br label %224

155:                                              ; preds = %144
  br label %168

156:                                              ; preds = %123
  %157 = load ptr, ptr @stderr, align 8, !tbaa !9
  %158 = load ptr, ptr %7, align 8, !tbaa !9
  %159 = load ptr, ptr %5, align 8, !tbaa !9
  %160 = load ptr, ptr %159, align 8, !tbaa !9
  %161 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %157, ptr noundef @.str.11, ptr noundef %158, ptr noundef %160) #7
  br label %224

162:                                              ; preds = %132, %105, %79, %53
  %163 = load ptr, ptr @stderr, align 8, !tbaa !9
  %164 = load ptr, ptr %7, align 8, !tbaa !9
  %165 = load ptr, ptr %5, align 8, !tbaa !9
  %166 = load ptr, ptr %165, align 8, !tbaa !9
  %167 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %163, ptr noundef @.str.12, ptr noundef %164, ptr noundef %166) #7
  br label %224

168:                                              ; preds = %155
  br label %169

169:                                              ; preds = %168, %117
  br label %170

170:                                              ; preds = %169, %95
  br label %171

171:                                              ; preds = %170, %69
  br label %172

172:                                              ; preds = %171
  %173 = load i32, ptr %4, align 4, !tbaa !5
  %174 = add nsw i32 %173, -1
  store i32 %174, ptr %4, align 4, !tbaa !5
  %175 = load ptr, ptr %5, align 8, !tbaa !9
  %176 = getelementptr inbounds ptr, ptr %175, i32 1
  store ptr %176, ptr %5, align 8, !tbaa !9
  br label %32, !llvm.loop !13

177:                                              ; preds = %32
  %178 = load ptr, ptr %9, align 8, !tbaa !9
  %179 = icmp ne ptr %178, null
  br i1 %179, label %184, label %180

180:                                              ; preds = %177
  %181 = load ptr, ptr @stderr, align 8, !tbaa !9
  %182 = load ptr, ptr %7, align 8, !tbaa !9
  %183 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %181, ptr noundef @.str.13, ptr noundef %182) #7
  br label %224

184:                                              ; preds = %177
  %185 = load ptr, ptr %11, align 8, !tbaa !9
  %186 = icmp ne ptr %185, null
  br i1 %186, label %191, label %187

187:                                              ; preds = %184
  %188 = load ptr, ptr @stderr, align 8, !tbaa !9
  %189 = load ptr, ptr %7, align 8, !tbaa !9
  %190 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %188, ptr noundef @.str.14, ptr noundef %189) #7
  br label %224

191:                                              ; preds = %184
  %192 = load ptr, ptr %9, align 8, !tbaa !9
  %193 = load i64, ptr %10, align 8, !tbaa !11
  %194 = call i64 @time(ptr noundef null) #7
  %195 = call i32 @x509_crl_check(ptr noundef %192, i64 noundef %193, i64 noundef %194)
  %196 = icmp ne i32 %195, 1
  br i1 %196, label %197, label %201

197:                                              ; preds = %191
  %198 = load ptr, ptr @stderr, align 8, !tbaa !9
  %199 = load ptr, ptr %7, align 8, !tbaa !9
  %200 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %198, ptr noundef @.str.15, ptr noundef %199) #7
  br label %224

201:                                              ; preds = %191
  %202 = load ptr, ptr %9, align 8, !tbaa !9
  %203 = load i64, ptr %10, align 8, !tbaa !11
  %204 = load ptr, ptr %11, align 8, !tbaa !9
  %205 = load i64, ptr %12, align 8, !tbaa !11
  %206 = getelementptr inbounds [8192 x i8], ptr %13, i64 0, i64 0
  %207 = load i64, ptr %14, align 8, !tbaa !11
  %208 = call i32 @x509_crl_verify_by_ca_cert(ptr noundef %202, i64 noundef %203, ptr noundef %204, i64 noundef %205, ptr noundef %206, i64 noundef %207)
  store i32 %208, ptr %15, align 4, !tbaa !5
  %209 = icmp slt i32 %208, 0
  br i1 %209, label %210, label %214

210:                                              ; preds = %201
  %211 = load ptr, ptr @stderr, align 8, !tbaa !9
  %212 = load ptr, ptr %7, align 8, !tbaa !9
  %213 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %211, ptr noundef @.str.16, ptr noundef %212) #7
  br label %224

214:                                              ; preds = %201
  %215 = load i32, ptr %15, align 4, !tbaa !5
  %216 = icmp ne i32 %215, 0
  %217 = zext i1 %216 to i64
  %218 = select i1 %216, ptr @.str.18, ptr @.str.19
  %219 = call i32 (ptr, ...) @printf(ptr noundef @.str.17, ptr noundef %218)
  %220 = load i32, ptr %15, align 4, !tbaa !5
  %221 = icmp eq i32 %220, 1
  br i1 %221, label %222, label %223

222:                                              ; preds = %214
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %223

223:                                              ; preds = %222, %214
  br label %224

224:                                              ; preds = %223, %210, %197, %187, %180, %162, %156, %151, %140, %113, %87, %61, %40
  %225 = load ptr, ptr %9, align 8, !tbaa !9
  %226 = icmp ne ptr %225, null
  br i1 %226, label %227, label %229

227:                                              ; preds = %224
  %228 = load ptr, ptr %9, align 8, !tbaa !9
  call void @free(ptr noundef %228) #7
  br label %229

229:                                              ; preds = %227, %224
  %230 = load ptr, ptr %11, align 8, !tbaa !9
  %231 = icmp ne ptr %230, null
  br i1 %231, label %232, label %234

232:                                              ; preds = %229
  %233 = load ptr, ptr %11, align 8, !tbaa !9
  call void @free(ptr noundef %233) #7
  br label %234

234:                                              ; preds = %232, %229
  %235 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %235, ptr %3, align 4
  store i32 1, ptr %16, align 4
  br label %236

236:                                              ; preds = %234, %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8192, 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
  %237 = load i32, ptr %3, align 4
  ret i32 %237
}

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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

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

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

declare i32 @file_read_all(ptr noundef, ptr noundef, ptr noundef) #5

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

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

declare i32 @x509_cert_new_from_file(ptr noundef, ptr noundef, ptr noundef) #5

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

; Function Attrs: nounwind
declare ptr @strncpy(ptr noundef, ptr noundef, i64 noundef) #3

declare i32 @hex_to_bytes(ptr noundef, i64 noundef, ptr noundef, ptr noundef) #5

declare i32 @x509_crl_check(ptr noundef, i64 noundef, i64 noundef) #5

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #3

declare i32 @x509_crl_verify_by_ca_cert(ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef) #5

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

; 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 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 = { "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 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { 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 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

@__const.crlverify_main.signer_id = external hidden unnamed_addr constant [8192 x i8], align 16
@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 [28 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @crlverify_main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca [8192 x i8], align 16
  %8 = alloca i64, align 8
  %9 = load ptr, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #10
  store ptr null, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #10
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #10
  call void @llvm.lifetime.start.p0(i64 8192, ptr nonnull %7) #10
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(8192) %7, ptr noundef nonnull align 16 dereferenceable(8192) @__const.crlverify_main.signer_id, i64 8192, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #10
  store i64 16, ptr %8, align 8, !tbaa !9
  %10 = icmp slt i32 %0, 2
  br i1 %10, label %12, label %.preheader.preheader

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

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

.preheader:                                       ; preds = %.preheader.preheader, %87
  %.048.in85 = phi i32 [ %.1, %87 ], [ %0, %.preheader.preheader ]
  %.05084 = phi ptr [ %88, %87 ], [ %11, %.preheader.preheader ]
  %16 = load ptr, ptr %.05084, align 8, !tbaa !5
  %17 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %16, ptr noundef nonnull dereferenceable(1) @.str.1) #12
  %.not65 = icmp eq i32 %17, 0
  br i1 %.not65, label %18, label %21

18:                                               ; preds = %.preheader
  %19 = load ptr, ptr @options, align 8, !tbaa !5
  %20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %9, ptr noundef %19)
  br label %122

21:                                               ; preds = %.preheader
  %22 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %16, ptr noundef nonnull dereferenceable(1) @.str.2) #12
  %.not66 = icmp eq i32 %22, 0
  br i1 %.not66, label %23, label %35

23:                                               ; preds = %21
  %24 = icmp eq i32 %.048.in85, 2
  br i1 %24, label %84, label %25

25:                                               ; preds = %23
  %26 = getelementptr inbounds i8, ptr %.05084, i64 8
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  %28 = call i32 @file_read_all(ptr noundef %27, ptr noundef nonnull %3, ptr noundef nonnull %4) #10
  %.not67 = icmp eq i32 %28, 1
  br i1 %.not67, label %87, label %29

29:                                               ; preds = %25
  %30 = load ptr, ptr @stderr, align 8, !tbaa !5
  %31 = tail call ptr @__errno_location() #13
  %32 = load i32, ptr %31, align 4, !tbaa !11
  %33 = call ptr @strerror(i32 noundef %32) #10
  %34 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef nonnull @.str.3, ptr noundef %9, ptr noundef %27, ptr noundef %33) #11
  br label %122

35:                                               ; preds = %21
  %36 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %16, ptr noundef nonnull dereferenceable(1) @.str.4) #12
  %.not68 = icmp eq i32 %36, 0
  br i1 %.not68, label %37, label %49

37:                                               ; preds = %35
  %38 = icmp eq i32 %.048.in85, 2
  br i1 %38, label %84, label %39

39:                                               ; preds = %37
  %40 = getelementptr inbounds i8, ptr %.05084, i64 8
  %41 = load ptr, ptr %40, align 8, !tbaa !5
  %42 = call i32 @x509_cert_new_from_file(ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef %41) #10
  %.not69 = icmp eq i32 %42, 1
  br i1 %.not69, label %87, label %43

43:                                               ; preds = %39
  %44 = load ptr, ptr @stderr, align 8, !tbaa !5
  %45 = tail call ptr @__errno_location() #13
  %46 = load i32, ptr %45, align 4, !tbaa !11
  %47 = call ptr @strerror(i32 noundef %46) #10
  %48 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef nonnull @.str.5, ptr noundef %9, ptr noundef %41, ptr noundef %47) #11
  br label %122

49:                                               ; preds = %35
  %50 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %16, ptr noundef nonnull dereferenceable(1) @.str.6) #12
  %.not70 = icmp eq i32 %50, 0
  br i1 %.not70, label %51, label %64

51:                                               ; preds = %49
  %52 = icmp eq i32 %.048.in85, 2
  br i1 %52, label %84, label %53

53:                                               ; preds = %51
  %54 = getelementptr inbounds i8, ptr %.05084, i64 8
  %55 = load ptr, ptr %54, align 8, !tbaa !5
  %56 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %55) #12
  %57 = icmp ugt i64 %56, 8191
  br i1 %57, label %58, label %61

58:                                               ; preds = %53
  %59 = load ptr, ptr @stderr, align 8, !tbaa !5
  %60 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %59, ptr noundef nonnull @.str.7, ptr noundef %9) #11
  br label %122

61:                                               ; preds = %53
  %62 = call ptr @strncpy(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) %55, i64 noundef 8192) #10
  %63 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %55) #12
  store i64 %63, ptr %8, align 8, !tbaa !9
  br label %87

64:                                               ; preds = %49
  %65 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %16, ptr noundef nonnull dereferenceable(1) @.str.8) #12
  %.not71 = icmp eq i32 %65, 0
  br i1 %.not71, label %66, label %81

66:                                               ; preds = %64
  %67 = icmp eq i32 %.048.in85, 2
  br i1 %67, label %84, label %68

68:                                               ; preds = %66
  %69 = getelementptr inbounds i8, ptr %.05084, i64 8
  %70 = load ptr, ptr %69, align 8, !tbaa !5
  %71 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %70) #12
  %72 = icmp ugt i64 %71, 16382
  br i1 %72, label %73, label %76

73:                                               ; preds = %68
  %74 = load ptr, ptr @stderr, align 8, !tbaa !5
  %75 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %74, ptr noundef nonnull @.str.9, ptr noundef %9) #11
  br label %122

76:                                               ; preds = %68
  %77 = call i32 @hex_to_bytes(ptr noundef %70, i64 noundef %71, ptr noundef nonnull %7, ptr noundef nonnull %8) #10
  %.not72 = icmp eq i32 %77, 1
  br i1 %.not72, label %87, label %78

78:                                               ; preds = %76
  %79 = load ptr, ptr @stderr, align 8, !tbaa !5
  %80 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %79, ptr noundef nonnull @.str.10, ptr noundef %9) #11
  br label %122

81:                                               ; preds = %64
  %82 = load ptr, ptr @stderr, align 8, !tbaa !5
  %83 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef nonnull @.str.11, ptr noundef %9, ptr noundef %16) #11
  br label %122

84:                                               ; preds = %66, %51, %37, %23
  %85 = load ptr, ptr @stderr, align 8, !tbaa !5
  %86 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %85, ptr noundef nonnull @.str.12, ptr noundef %9, ptr noundef %16) #11
  br label %122

87:                                               ; preds = %25, %61, %76, %39
  %.1 = add nsw i32 %.048.in85, -2
  %88 = getelementptr inbounds i8, ptr %.05084, i64 16
  %89 = icmp sgt i32 %.048.in85, 3
  br i1 %89, label %.preheader, label %90, !llvm.loop !13

90:                                               ; preds = %87
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %.not = icmp eq ptr %91, null
  br i1 %.not, label %92, label %95

92:                                               ; preds = %90
  %93 = load ptr, ptr @stderr, align 8, !tbaa !5
  %94 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %93, ptr noundef nonnull @.str.13, ptr noundef %9) #11
  br label %122

95:                                               ; preds = %90
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %.not62 = icmp eq ptr %96, null
  br i1 %.not62, label %97, label %100

97:                                               ; preds = %95
  %98 = load ptr, ptr @stderr, align 8, !tbaa !5
  %99 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %98, ptr noundef nonnull @.str.14, ptr noundef %9) #11
  br label %122

100:                                              ; preds = %95
  %101 = load i64, ptr %4, align 8, !tbaa !9
  %102 = call i64 @time(ptr noundef null) #10
  %103 = call i32 @x509_crl_check(ptr noundef nonnull %91, i64 noundef %101, i64 noundef %102) #10
  %.not63 = icmp eq i32 %103, 1
  br i1 %.not63, label %107, label %104

104:                                              ; preds = %100
  %105 = load ptr, ptr @stderr, align 8, !tbaa !5
  %106 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %105, ptr noundef nonnull @.str.15, ptr noundef %9) #11
  br label %122

107:                                              ; preds = %100
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = load i64, ptr %4, align 8, !tbaa !9
  %110 = load ptr, ptr %5, align 8, !tbaa !5
  %111 = load i64, ptr %6, align 8, !tbaa !9
  %112 = load i64, ptr %8, align 8, !tbaa !9
  %113 = call i32 @x509_crl_verify_by_ca_cert(ptr noundef %108, i64 noundef %109, ptr noundef %110, i64 noundef %111, ptr noundef nonnull %7, i64 noundef %112) #10
  %114 = icmp slt i32 %113, 0
  br i1 %114, label %115, label %118

115:                                              ; preds = %107
  %116 = load ptr, ptr @stderr, align 8, !tbaa !5
  %117 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %116, ptr noundef nonnull @.str.16, ptr noundef %9) #11
  br label %122

118:                                              ; preds = %107
  %.not64 = icmp eq i32 %113, 0
  %119 = select i1 %.not64, ptr @.str.19, ptr @.str.18
  %120 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17, ptr noundef nonnull %119)
  %121 = icmp ne i32 %113, 1
  %spec.select = zext i1 %121 to i32
  br label %122

122:                                              ; preds = %118, %115, %104, %97, %92, %84, %81, %78, %73, %58, %43, %29, %18
  %.049 = phi i32 [ 1, %81 ], [ 1, %84 ], [ 1, %73 ], [ 1, %78 ], [ 1, %58 ], [ 1, %43 ], [ 1, %29 ], [ 0, %18 ], [ 1, %104 ], [ 1, %115 ], [ 1, %97 ], [ 1, %92 ], [ %spec.select, %118 ]
  %123 = load ptr, ptr %3, align 8, !tbaa !5
  %.not73 = icmp eq ptr %123, null
  br i1 %.not73, label %125, label %124

124:                                              ; preds = %122
  call void @free(ptr noundef nonnull %123) #10
  br label %125

125:                                              ; preds = %124, %122
  %126 = load ptr, ptr %5, align 8, !tbaa !5
  %.not74 = icmp eq ptr %126, null
  br i1 %.not74, label %128, label %127

127:                                              ; preds = %125
  call void @free(ptr noundef nonnull %126) #10
  br label %128

128:                                              ; preds = %125, %127, %12
  %.0 = phi i32 [ 1, %12 ], [ %.049, %127 ], [ %.049, %125 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #10
  call void @llvm.lifetime.end.p0(i64 8192, ptr nonnull %7) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #10
  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: 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) #2

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

; 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

declare i32 @file_read_all(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

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

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

declare i32 @x509_cert_new_from_file(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #8

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

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

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #6

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

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

; 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #7 = { 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 #8 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 = { 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 #10 = { nounwind }
attributes #11 = { cold nounwind }
attributes #12 = { nounwind willreturn memory(read) }
attributes #13 = { 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 = !{!"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, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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