; LLVM IR from peacemakr-io/peacemakr-core-crypto :: src/core/src (Key)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.PeacemakrKey = type { %struct.crypto_config_t, %union.anon, ptr }
%struct.crypto_config_t = type { i32, i32, i32, i32 }
%union.anon = type { ptr }

@__FUNCTION__.peacemakr_key_generate_csr = external hidden unnamed_addr constant [27 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [32 x i8], align 1
@peacemakr_global_calloc = external global ptr, align 8
@.str.22 = external hidden unnamed_addr constant [46 x i8], align 1

declare void @log_printf(ptr noundef, i32 noundef, ptr noundef, ...) #0

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

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

declare void @openssl_log(ptr noundef, i32 noundef) #0

; 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 uwtable
define dso_local zeroext i1 @peacemakr_key_generate_csr(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, i64 noundef %4, ptr noundef %5, ptr noundef %6) #3 {
  %8 = alloca i1, align 1
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store i64 %2, ptr %11, align 8, !tbaa !9
  store ptr %3, ptr %12, align 8, !tbaa !5
  store i64 %4, ptr %13, align 8, !tbaa !9
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = icmp eq ptr %22, null
  br i1 %23, label %24, label %25

24:                                               ; preds = %7
  call void (ptr, i32, ptr, ...) @log_printf(ptr noundef @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 385, ptr noundef @.str.15)
  store i1 false, ptr %8, align 1
  br label %166

25:                                               ; preds = %7
  %26 = load ptr, ptr %14, align 8, !tbaa !5
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %29

28:                                               ; preds = %25
  call void (ptr, i32, ptr, ...) @log_printf(ptr noundef @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 386, ptr noundef @.str.16)
  store i1 false, ptr %8, align 1
  br label %166

29:                                               ; preds = %25
  %30 = load ptr, ptr %15, align 8, !tbaa !5
  %31 = icmp eq ptr %30, null
  br i1 %31, label %32, label %33

32:                                               ; preds = %29
  call void (ptr, i32, ptr, ...) @log_printf(ptr noundef @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 387, ptr noundef @.str.17)
  store i1 false, ptr %8, align 1
  br label %166

33:                                               ; preds = %29
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.PeacemakrKey, ptr %34, i32 0, i32 0
  %36 = getelementptr inbounds %struct.crypto_config_t, ptr %35, i32 0, i32 0
  %37 = load i32, ptr %36, align 8, !tbaa !11
  %38 = icmp ne i32 %37, 1
  br i1 %38, label %39, label %40

39:                                               ; preds = %33
  store i1 false, ptr %8, align 1
  br label %166

40:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %41 = call ptr @X509_REQ_new()
  store ptr %41, ptr %16, align 8, !tbaa !5
  %42 = load ptr, ptr %16, align 8, !tbaa !5
  %43 = icmp eq ptr %42, null
  br i1 %43, label %44, label %45

44:                                               ; preds = %40
  call void @openssl_log(ptr noundef @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 395)
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %165

45:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %46 = load ptr, ptr %16, align 8, !tbaa !5
  %47 = call ptr @X509_REQ_get_subject_name(ptr noundef %46)
  store ptr %47, ptr %18, align 8, !tbaa !5
  %48 = load ptr, ptr %18, align 8, !tbaa !5
  %49 = icmp eq ptr %48, null
  br i1 %49, label %50, label %52

50:                                               ; preds = %45
  call void @openssl_log(ptr noundef @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 401)
  %51 = load ptr, ptr %16, align 8, !tbaa !5
  call void @X509_REQ_free(ptr noundef %51)
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %164

52:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  store i32 0, ptr %19, align 4, !tbaa !15
  %53 = load ptr, ptr %10, align 8, !tbaa !5
  %54 = icmp ne ptr %53, null
  br i1 %54, label %55, label %69

55:                                               ; preds = %52
  %56 = load i64, ptr %11, align 8, !tbaa !9
  %57 = icmp ne i64 %56, 0
  br i1 %57, label %58, label %69

58:                                               ; preds = %55
  %59 = load ptr, ptr %18, align 8, !tbaa !5
  %60 = load ptr, ptr %10, align 8, !tbaa !5
  %61 = load i64, ptr %11, align 8, !tbaa !9
  %62 = trunc i64 %61 to i32
  %63 = call i32 @X509_NAME_add_entry_by_txt(ptr noundef %59, ptr noundef @.str.18, i32 noundef 4097, ptr noundef %60, i32 noundef %62, i32 noundef -1, i32 noundef 0)
  store i32 %63, ptr %19, align 4, !tbaa !15
  %64 = load i32, ptr %19, align 4, !tbaa !15
  %65 = icmp ne i32 %64, 1
  br i1 %65, label %66, label %68

66:                                               ; preds = %58
  call void @openssl_log(ptr noundef @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 412)
  %67 = load ptr, ptr %16, align 8, !tbaa !5
  call void @X509_REQ_free(ptr noundef %67)
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %163

68:                                               ; preds = %58
  br label %69

69:                                               ; preds = %68, %55, %52
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  %71 = icmp ne ptr %70, null
  br i1 %71, label %72, label %86

72:                                               ; preds = %69
  %73 = load i64, ptr %13, align 8, !tbaa !9
  %74 = icmp ne i64 %73, 0
  br i1 %74, label %75, label %86

75:                                               ; preds = %72
  %76 = load ptr, ptr %18, align 8, !tbaa !5
  %77 = load ptr, ptr %12, align 8, !tbaa !5
  %78 = load i64, ptr %13, align 8, !tbaa !9
  %79 = trunc i64 %78 to i32
  %80 = call i32 @X509_NAME_add_entry_by_txt(ptr noundef %76, ptr noundef @.str.19, i32 noundef 4097, ptr noundef %77, i32 noundef %79, i32 noundef -1, i32 noundef 0)
  store i32 %80, ptr %19, align 4, !tbaa !15
  %81 = load i32, ptr %19, align 4, !tbaa !15
  %82 = icmp ne i32 %81, 1
  br i1 %82, label %83, label %85

83:                                               ; preds = %75
  call void @openssl_log(ptr noundef @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 423)
  %84 = load ptr, ptr %16, align 8, !tbaa !5
  call void @X509_REQ_free(ptr noundef %84)
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %163

85:                                               ; preds = %75
  br label %86

86:                                               ; preds = %85, %72, %69
  %87 = load ptr, ptr %16, align 8, !tbaa !5
  %88 = load ptr, ptr %9, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.PeacemakrKey, ptr %88, i32 0, i32 1
  %90 = load ptr, ptr %89, align 8, !tbaa !16
  %91 = call i32 @X509_REQ_set_pubkey(ptr noundef %87, ptr noundef %90)
  store i32 %91, ptr %19, align 4, !tbaa !15
  %92 = load i32, ptr %19, align 4, !tbaa !15
  %93 = icmp ne i32 %92, 1
  br i1 %93, label %94, label %96

94:                                               ; preds = %86
  call void @openssl_log(ptr noundef @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 432)
  %95 = load ptr, ptr %16, align 8, !tbaa !5
  call void @X509_REQ_free(ptr noundef %95)
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %163

96:                                               ; preds = %86
  %97 = load ptr, ptr %16, align 8, !tbaa !5
  %98 = load ptr, ptr %9, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.PeacemakrKey, ptr %98, i32 0, i32 1
  %100 = load ptr, ptr %99, align 8, !tbaa !16
  %101 = call ptr @EVP_sha256()
  %102 = call i32 @X509_REQ_sign(ptr noundef %97, ptr noundef %100, ptr noundef %101)
  %103 = icmp sge i32 0, %102
  br i1 %103, label %104, label %106

104:                                              ; preds = %96
  call void @openssl_log(ptr noundef @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 439)
  %105 = load ptr, ptr %16, align 8, !tbaa !5
  call void @X509_REQ_free(ptr noundef %105)
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %163

106:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %107 = call ptr @BIO_s_secmem()
  %108 = call ptr @BIO_new(ptr noundef %107)
  store ptr %108, ptr %20, align 8, !tbaa !5
  %109 = load ptr, ptr %20, align 8, !tbaa !5
  %110 = icmp eq ptr %109, null
  br i1 %110, label %111, label %113

111:                                              ; preds = %106
  call void @openssl_log(ptr noundef @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 446)
  %112 = load ptr, ptr %16, align 8, !tbaa !5
  call void @X509_REQ_free(ptr noundef %112)
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %162

113:                                              ; preds = %106
  %114 = load ptr, ptr %20, align 8, !tbaa !5
  %115 = load ptr, ptr %16, align 8, !tbaa !5
  %116 = call i32 @PEM_write_bio_X509_REQ(ptr noundef %114, ptr noundef %115)
  store i32 %116, ptr %19, align 4, !tbaa !15
  %117 = load i32, ptr %19, align 4, !tbaa !15
  %118 = icmp ne i32 %117, 1
  br i1 %118, label %119, label %123

119:                                              ; preds = %113
  call void @openssl_log(ptr noundef @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 453)
  %120 = load ptr, ptr %16, align 8, !tbaa !5
  call void @X509_REQ_free(ptr noundef %120)
  %121 = load ptr, ptr %20, align 8, !tbaa !5
  %122 = call i32 @BIO_free(ptr noundef %121)
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %162

123:                                              ; preds = %113
  %124 = load ptr, ptr %16, align 8, !tbaa !5
  call void @X509_REQ_free(ptr noundef %124)
  %125 = load ptr, ptr %20, align 8, !tbaa !5
  %126 = call i64 @BIO_ctrl(ptr noundef %125, i32 noundef 2, i64 noundef 0, ptr noundef null)
  %127 = trunc i64 %126 to i32
  %128 = icmp ne i32 %127, 0
  br i1 %128, label %129, label %132

129:                                              ; preds = %123
  call void (ptr, i32, ptr, ...) @log_printf(ptr noundef @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 462, ptr noundef @.str.20)
  %130 = load ptr, ptr %20, align 8, !tbaa !5
  %131 = call i32 @BIO_free(ptr noundef %130)
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %162

132:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  store ptr null, ptr %21, align 8, !tbaa !5
  %133 = load ptr, ptr %20, align 8, !tbaa !5
  %134 = call i64 @BIO_ctrl(ptr noundef %133, i32 noundef 3, i64 noundef 0, ptr noundef %21)
  %135 = load ptr, ptr %15, align 8, !tbaa !5
  store i64 %134, ptr %135, align 8, !tbaa !9
  %136 = load ptr, ptr %21, align 8, !tbaa !5
  %137 = icmp eq ptr %136, null
  br i1 %137, label %138, label %141

138:                                              ; preds = %132
  call void (ptr, i32, ptr, ...) @log_printf(ptr noundef @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 470, ptr noundef @.str.21)
  %139 = load ptr, ptr %20, align 8, !tbaa !5
  %140 = call i32 @BIO_free(ptr noundef %139)
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %161

141:                                              ; preds = %132
  %142 = load ptr, ptr @peacemakr_global_calloc, align 8, !tbaa !5
  %143 = load ptr, ptr %15, align 8, !tbaa !5
  %144 = load i64, ptr %143, align 8, !tbaa !9
  %145 = call ptr %142(i64 noundef %144, i64 noundef 1)
  %146 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %145, ptr %146, align 8, !tbaa !5
  %147 = load ptr, ptr %14, align 8, !tbaa !5
  %148 = load ptr, ptr %147, align 8, !tbaa !5
  %149 = icmp eq ptr %148, null
  br i1 %149, label %150, label %153

150:                                              ; preds = %141
  call void (ptr, i32, ptr, ...) @log_printf(ptr noundef @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 478, ptr noundef @.str.22)
  %151 = load ptr, ptr %20, align 8, !tbaa !5
  %152 = call i32 @BIO_free(ptr noundef %151)
  store i1 false, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %161

153:                                              ; preds = %141
  %154 = load ptr, ptr %14, align 8, !tbaa !5
  %155 = load ptr, ptr %154, align 8, !tbaa !5
  %156 = load ptr, ptr %21, align 8, !tbaa !5
  %157 = load ptr, ptr %15, align 8, !tbaa !5
  %158 = load i64, ptr %157, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %155, ptr align 1 %156, i64 %158, i1 false)
  %159 = load ptr, ptr %20, align 8, !tbaa !5
  %160 = call i32 @BIO_free(ptr noundef %159)
  store i1 true, ptr %8, align 1
  store i32 1, ptr %17, align 4
  br label %161

161:                                              ; preds = %153, %150, %138
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  br label %162

162:                                              ; preds = %161, %129, %119, %111
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  br label %163

163:                                              ; preds = %162, %104, %94, %83, %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %164

164:                                              ; preds = %163, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  br label %165

165:                                              ; preds = %164, %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  br label %166

166:                                              ; preds = %165, %39, %32, %28, %24
  %167 = load i1, ptr %8, align 1
  ret i1 %167
}

declare ptr @X509_REQ_new() #0

declare ptr @X509_REQ_get_subject_name(ptr noundef) #0

declare void @X509_REQ_free(ptr noundef) #0

declare i32 @X509_NAME_add_entry_by_txt(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) #0

declare i32 @X509_REQ_set_pubkey(ptr noundef, ptr noundef) #0

declare i32 @X509_REQ_sign(ptr noundef, ptr noundef, ptr noundef) #0

declare ptr @EVP_sha256() #0

declare ptr @BIO_new(ptr noundef) #0

declare ptr @BIO_s_secmem() #0

declare i32 @PEM_write_bio_X509_REQ(ptr noundef, ptr noundef) #0

declare i32 @BIO_free(ptr noundef) #0

declare i64 @BIO_ctrl(ptr noundef, i32 noundef, i64 noundef, ptr noundef) #0

attributes #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 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 #4 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !14, i64 0}
!12 = !{!"PeacemakrKey", !13, i64 0, !7, i64 16, !6, i64 24}
!13 = !{!"", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12}
!14 = !{!"int", !7, i64 0}
!15 = !{!14, !14, i64 0}
!16 = !{!7, !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"

@__FUNCTION__.peacemakr_key_generate_csr = external hidden unnamed_addr constant [27 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [32 x i8], align 1
@peacemakr_global_calloc = external local_unnamed_addr global ptr, align 8
@.str.22 = external hidden unnamed_addr constant [46 x i8], align 1

declare void @log_printf(ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #0

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

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

declare void @openssl_log(ptr noundef, i32 noundef) local_unnamed_addr #0

; 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: nounwind uwtable
define dso_local noundef zeroext i1 @peacemakr_key_generate_csr(ptr noundef readonly %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, i64 noundef %4, ptr noundef writeonly %5, ptr noundef %6) local_unnamed_addr #3 {
  %8 = alloca ptr, align 8
  %9 = icmp eq ptr %0, null
  br i1 %9, label %10, label %11

10:                                               ; preds = %7
  tail call void (ptr, i32, ptr, ...) @log_printf(ptr noundef nonnull @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 385, ptr noundef nonnull @.str.15) #4
  br label %81

11:                                               ; preds = %7
  %12 = icmp eq ptr %5, null
  br i1 %12, label %13, label %14

13:                                               ; preds = %11
  tail call void (ptr, i32, ptr, ...) @log_printf(ptr noundef nonnull @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 386, ptr noundef nonnull @.str.16) #4
  br label %81

14:                                               ; preds = %11
  %15 = icmp eq ptr %6, null
  br i1 %15, label %16, label %17

16:                                               ; preds = %14
  tail call void (ptr, i32, ptr, ...) @log_printf(ptr noundef nonnull @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 387, ptr noundef nonnull @.str.17) #4
  br label %81

17:                                               ; preds = %14
  %18 = load i32, ptr %0, align 8, !tbaa !5
  %.not = icmp eq i32 %18, 1
  br i1 %.not, label %19, label %81

19:                                               ; preds = %17
  %20 = tail call ptr @X509_REQ_new() #4
  %21 = icmp eq ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %19
  tail call void @openssl_log(ptr noundef nonnull @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 395) #4
  br label %81

23:                                               ; preds = %19
  %24 = tail call ptr @X509_REQ_get_subject_name(ptr noundef nonnull %20) #4
  %25 = icmp eq ptr %24, null
  br i1 %25, label %26, label %27

26:                                               ; preds = %23
  tail call void @openssl_log(ptr noundef nonnull @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 401) #4
  tail call void @X509_REQ_free(ptr noundef nonnull %20) #4
  br label %81

27:                                               ; preds = %23
  %28 = icmp ne ptr %1, null
  %29 = icmp ne i64 %2, 0
  %or.cond = and i1 %28, %29
  br i1 %or.cond, label %30, label %34

30:                                               ; preds = %27
  %31 = trunc i64 %2 to i32
  %32 = tail call i32 @X509_NAME_add_entry_by_txt(ptr noundef nonnull %24, ptr noundef nonnull @.str.18, i32 noundef 4097, ptr noundef nonnull %1, i32 noundef %31, i32 noundef -1, i32 noundef 0) #4
  %.not63 = icmp eq i32 %32, 1
  br i1 %.not63, label %34, label %33

33:                                               ; preds = %30
  tail call void @openssl_log(ptr noundef nonnull @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 412) #4
  tail call void @X509_REQ_free(ptr noundef nonnull %20) #4
  br label %81

34:                                               ; preds = %30, %27
  %35 = icmp ne ptr %3, null
  %36 = icmp ne i64 %4, 0
  %or.cond3 = and i1 %35, %36
  br i1 %or.cond3, label %37, label %41

37:                                               ; preds = %34
  %38 = trunc i64 %4 to i32
  %39 = tail call i32 @X509_NAME_add_entry_by_txt(ptr noundef nonnull %24, ptr noundef nonnull @.str.19, i32 noundef 4097, ptr noundef nonnull %3, i32 noundef %38, i32 noundef -1, i32 noundef 0) #4
  %.not64 = icmp eq i32 %39, 1
  br i1 %.not64, label %41, label %40

40:                                               ; preds = %37
  tail call void @openssl_log(ptr noundef nonnull @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 423) #4
  tail call void @X509_REQ_free(ptr noundef nonnull %20) #4
  br label %81

41:                                               ; preds = %37, %34
  %42 = getelementptr inbounds i8, ptr %0, i64 16
  %43 = load ptr, ptr %42, align 8, !tbaa !12
  %44 = tail call i32 @X509_REQ_set_pubkey(ptr noundef nonnull %20, ptr noundef %43) #4
  %.not65 = icmp eq i32 %44, 1
  br i1 %.not65, label %46, label %45

45:                                               ; preds = %41
  tail call void @openssl_log(ptr noundef nonnull @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 432) #4
  tail call void @X509_REQ_free(ptr noundef nonnull %20) #4
  br label %81

46:                                               ; preds = %41
  %47 = load ptr, ptr %42, align 8, !tbaa !12
  %48 = tail call ptr @EVP_sha256() #4
  %49 = tail call i32 @X509_REQ_sign(ptr noundef nonnull %20, ptr noundef %47, ptr noundef %48) #4
  %50 = icmp slt i32 %49, 1
  br i1 %50, label %51, label %52

51:                                               ; preds = %46
  tail call void @openssl_log(ptr noundef nonnull @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 439) #4
  tail call void @X509_REQ_free(ptr noundef nonnull %20) #4
  br label %81

52:                                               ; preds = %46
  %53 = tail call ptr @BIO_s_secmem() #4
  %54 = tail call ptr @BIO_new(ptr noundef %53) #4
  %55 = icmp eq ptr %54, null
  br i1 %55, label %56, label %57

56:                                               ; preds = %52
  tail call void @openssl_log(ptr noundef nonnull @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 446) #4
  tail call void @X509_REQ_free(ptr noundef nonnull %20) #4
  br label %81

57:                                               ; preds = %52
  %58 = tail call i32 @PEM_write_bio_X509_REQ(ptr noundef nonnull %54, ptr noundef nonnull %20) #4
  %.not66 = icmp eq i32 %58, 1
  br i1 %.not66, label %61, label %59

59:                                               ; preds = %57
  tail call void @openssl_log(ptr noundef nonnull @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 453) #4
  tail call void @X509_REQ_free(ptr noundef nonnull %20) #4
  %60 = tail call i32 @BIO_free(ptr noundef nonnull %54) #4
  br label %81

61:                                               ; preds = %57
  tail call void @X509_REQ_free(ptr noundef nonnull %20) #4
  %62 = tail call i64 @BIO_ctrl(ptr noundef nonnull %54, i32 noundef 2, i64 noundef 0, ptr noundef null) #4
  %63 = and i64 %62, 4294967295
  %.not67 = icmp eq i64 %63, 0
  br i1 %.not67, label %66, label %64

64:                                               ; preds = %61
  tail call void (ptr, i32, ptr, ...) @log_printf(ptr noundef nonnull @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 462, ptr noundef nonnull @.str.20) #4
  %65 = tail call i32 @BIO_free(ptr noundef nonnull %54) #4
  br label %81

66:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  store ptr null, ptr %8, align 8, !tbaa !13
  %67 = call i64 @BIO_ctrl(ptr noundef nonnull %54, i32 noundef 3, i64 noundef 0, ptr noundef nonnull %8) #4
  store i64 %67, ptr %6, align 8, !tbaa !14
  %68 = load ptr, ptr %8, align 8, !tbaa !13
  %69 = icmp eq ptr %68, null
  br i1 %69, label %70, label %71

70:                                               ; preds = %66
  call void (ptr, i32, ptr, ...) @log_printf(ptr noundef nonnull @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 470, ptr noundef nonnull @.str.21) #4
  br label %79

71:                                               ; preds = %66
  %72 = load ptr, ptr @peacemakr_global_calloc, align 8, !tbaa !13
  %73 = call ptr %72(i64 noundef %67, i64 noundef 1) #4
  store ptr %73, ptr %5, align 8, !tbaa !13
  %74 = icmp eq ptr %73, null
  br i1 %74, label %75, label %76

75:                                               ; preds = %71
  call void (ptr, i32, ptr, ...) @log_printf(ptr noundef nonnull @__FUNCTION__.peacemakr_key_generate_csr, i32 noundef 478, ptr noundef nonnull @.str.22) #4
  br label %79

76:                                               ; preds = %71
  %77 = load ptr, ptr %8, align 8, !tbaa !13
  %78 = load i64, ptr %6, align 8, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %73, ptr align 1 %77, i64 %78, i1 false)
  br label %79

79:                                               ; preds = %76, %75, %70
  %.0 = phi i1 [ false, %70 ], [ false, %75 ], [ true, %76 ]
  %80 = call i32 @BIO_free(ptr noundef nonnull %54) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  br label %81

81:                                               ; preds = %22, %33, %40, %45, %51, %79, %64, %59, %56, %26, %17, %16, %13, %10
  %.5 = phi i1 [ false, %10 ], [ false, %13 ], [ false, %16 ], [ false, %17 ], [ false, %22 ], [ false, %26 ], [ false, %33 ], [ false, %40 ], [ false, %45 ], [ false, %51 ], [ false, %56 ], [ false, %59 ], [ false, %64 ], [ %.0, %79 ]
  ret i1 %.5
}

declare ptr @X509_REQ_new() local_unnamed_addr #0

declare ptr @X509_REQ_get_subject_name(ptr noundef) local_unnamed_addr #0

declare void @X509_REQ_free(ptr noundef) local_unnamed_addr #0

declare i32 @X509_NAME_add_entry_by_txt(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

declare i32 @X509_REQ_set_pubkey(ptr noundef, ptr noundef) local_unnamed_addr #0

declare i32 @X509_REQ_sign(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare ptr @EVP_sha256() local_unnamed_addr #0

declare ptr @BIO_new(ptr noundef) local_unnamed_addr #0

declare ptr @BIO_s_secmem() local_unnamed_addr #0

declare i32 @PEM_write_bio_X509_REQ(ptr noundef, ptr noundef) local_unnamed_addr #0

declare i32 @BIO_free(ptr noundef) local_unnamed_addr #0

declare i64 @BIO_ctrl(ptr noundef, i32 noundef, i64 noundef, ptr noundef) local_unnamed_addr #0

attributes #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 = { 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 #4 = { 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, !8, i64 0}
!6 = !{!"PeacemakrKey", !7, i64 0, !9, i64 16, !11, i64 24}
!7 = !{!"", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!9, !9, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !9, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass