; LLVM IR from gost-engine/engine :: gost_omac_acpkm (omac_acpkm_imit_ctrl)

; 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.ossl_param_st = type { ptr, i32, ptr, i64, i64 }
%struct.omac_acpkm_ctx = type { ptr, i64, ptr, i32 }
%struct.gost_mac_key = type { i32, [32 x i8], i16 }
%struct.CMAC_ACPKM_CTX_st = type { ptr, ptr, [48 x i8], [32 x i8], [32 x i8], i32, i32, i32 }

@.str = external hidden unnamed_addr constant [70 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1

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

declare ptr @EVP_MD_CTX_get0_md_data(ptr noundef) #1

declare void @ERR_GOST_error(i32 noundef, i32 noundef, ptr noundef, i32 noundef) #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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @omac_acpkm_imit_ctrl(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) #3 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i64, align 8
  %18 = alloca [2 x %struct.ossl_param_st], align 16
  %19 = alloca %struct.ossl_param_st, align 8
  %20 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  %21 = load i32, ptr %7, align 4, !tbaa !9
  switch i32 %21, label %200 [
    i32 4099, label %22
    i32 4100, label %24
    i32 32, label %99
    i32 3, label %166
  ]

22:                                               ; preds = %4
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 32, ptr %23, align 4, !tbaa !9
  store i32 1, ptr %5, align 4
  br label %201

24:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = call ptr @EVP_MD_CTX_get0_md_data(ptr noundef %25)
  store ptr %26, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = call ptr @EVP_MD_CTX_md(ptr noundef %27)
  store ptr %28, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !9
  %29 = load ptr, ptr %10, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.omac_acpkm_ctx, ptr %29, i32 0, i32 2
  %31 = load ptr, ptr %30, align 8, !tbaa !11
  %32 = icmp eq ptr %31, null
  br i1 %32, label %33, label %45

33:                                               ; preds = %24
  %34 = load ptr, ptr %11, align 8, !tbaa !5
  %35 = call i32 @EVP_MD_is_a(ptr noundef %34, ptr noundef @.str.1)
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %41, label %37

37:                                               ; preds = %33
  %38 = load ptr, ptr %11, align 8, !tbaa !5
  %39 = call i32 @EVP_MD_is_a(ptr noundef %38, ptr noundef @.str.2)
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %44

41:                                               ; preds = %37, %33
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.omac_acpkm_ctx, ptr %42, i32 0, i32 2
  store ptr @.str.3, ptr %43, align 8, !tbaa !11
  br label %44

44:                                               ; preds = %41, %37
  br label %45

45:                                               ; preds = %44, %24
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.omac_acpkm_ctx, ptr %46, i32 0, i32 2
  %48 = load ptr, ptr %47, align 8, !tbaa !11
  %49 = call ptr @EVP_get_cipherbyname(ptr noundef %48)
  store ptr %49, ptr %12, align 8, !tbaa !5
  %50 = icmp eq ptr %49, null
  br i1 %50, label %51, label %58

51:                                               ; preds = %45
  %52 = load ptr, ptr %10, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.omac_acpkm_ctx, ptr %52, i32 0, i32 2
  %54 = load ptr, ptr %53, align 8, !tbaa !11
  %55 = call ptr @EVP_CIPHER_fetch(ptr noundef null, ptr noundef %54, ptr noundef null)
  store ptr %55, ptr %12, align 8, !tbaa !5
  %56 = icmp eq ptr %55, null
  br i1 %56, label %57, label %58

57:                                               ; preds = %51
  call void @ERR_GOST_error(i32 noundef 144, i32 noundef 103, ptr noundef @.str, i32 noundef 440)
  br label %58

58:                                               ; preds = %57, %51, %45
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = call ptr @EVP_MD_CTX_md(ptr noundef %59)
  %61 = call ptr @EVP_MD_meth_get_init(ptr noundef %60)
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = call i32 %61(ptr noundef %62)
  %64 = icmp sle i32 %63, 0
  br i1 %64, label %65, label %66

65:                                               ; preds = %58
  call void @ERR_GOST_error(i32 noundef 144, i32 noundef 121, ptr noundef @.str, i32 noundef 443)
  br label %95

66:                                               ; preds = %58
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  call void @EVP_MD_CTX_set_flags(ptr noundef %67, i32 noundef 256)
  %68 = load ptr, ptr %10, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.omac_acpkm_ctx, ptr %68, i32 0, i32 3
  %70 = load i32, ptr %69, align 8, !tbaa !14
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %73

72:                                               ; preds = %66
  call void @ERR_GOST_error(i32 noundef 144, i32 noundef 132, ptr noundef @.str, i32 noundef 448)
  br label %95

73:                                               ; preds = %66
  %74 = load i32, ptr %8, align 4, !tbaa !9
  %75 = icmp eq i32 %74, 0
  br i1 %75, label %76, label %85

76:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %77, ptr %14, align 8, !tbaa !5
  %78 = load ptr, ptr %10, align 8, !tbaa !5
  %79 = load ptr, ptr %12, align 8, !tbaa !5
  %80 = load ptr, ptr %14, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.gost_mac_key, ptr %80, i32 0, i32 1
  %82 = getelementptr inbounds [32 x i8], ptr %81, i64 0, i64 0
  %83 = call i32 @omac_acpkm_key(ptr noundef %78, ptr noundef %79, ptr noundef %82, i64 noundef 32)
  store i32 %83, ptr %13, align 4, !tbaa !9
  store i32 3, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  %84 = load i32, ptr %15, align 4
  switch i32 %84, label %98 [
    i32 3, label %95
  ]

85:                                               ; preds = %73
  %86 = load i32, ptr %8, align 4, !tbaa !9
  %87 = icmp eq i32 %86, 32
  br i1 %87, label %88, label %93

88:                                               ; preds = %85
  %89 = load ptr, ptr %10, align 8, !tbaa !5
  %90 = load ptr, ptr %12, align 8, !tbaa !5
  %91 = load ptr, ptr %9, align 8, !tbaa !5
  %92 = call i32 @omac_acpkm_key(ptr noundef %89, ptr noundef %90, ptr noundef %91, i64 noundef 32)
  store i32 %92, ptr %13, align 4, !tbaa !9
  br label %95

93:                                               ; preds = %85
  br label %94

94:                                               ; preds = %93
  call void @ERR_GOST_error(i32 noundef 144, i32 noundef 115, ptr noundef @.str, i32 noundef 459)
  br label %95

95:                                               ; preds = %94, %88, %76, %72, %65
  %96 = load ptr, ptr %12, align 8, !tbaa !5
  call void @EVP_CIPHER_free(ptr noundef %96)
  %97 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %97, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %98

98:                                               ; preds = %95, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %201

99:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %100 = load ptr, ptr %6, align 8, !tbaa !5
  %101 = call ptr @EVP_MD_CTX_get0_md_data(ptr noundef %100)
  store ptr %101, ptr %16, align 8, !tbaa !5
  %102 = load i32, ptr %8, align 4, !tbaa !9
  %103 = icmp ne i32 %102, 0
  br i1 %103, label %104, label %111

104:                                              ; preds = %99
  %105 = load i32, ptr %8, align 4, !tbaa !9
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  %107 = call ptr @EVP_MD_CTX_md(ptr noundef %106)
  %108 = call i32 @EVP_MD_get_block_size(ptr noundef %107)
  %109 = srem i32 %105, %108
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %111, label %112

111:                                              ; preds = %104, %99
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %165

112:                                              ; preds = %104
  %113 = load i32, ptr %8, align 4, !tbaa !9
  %114 = load ptr, ptr %16, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.omac_acpkm_ctx, ptr %114, i32 0, i32 0
  %116 = load ptr, ptr %115, align 8, !tbaa !15
  %117 = getelementptr inbounds %struct.CMAC_ACPKM_CTX_st, ptr %116, i32 0, i32 6
  store i32 %113, ptr %117, align 4, !tbaa !16
  %118 = load ptr, ptr %9, align 8, !tbaa !5
  %119 = icmp ne ptr %118, null
  br i1 %119, label %120, label %164

120:                                              ; preds = %112
  %121 = load ptr, ptr %9, align 8, !tbaa !5
  %122 = load i32, ptr %121, align 4, !tbaa !9
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %164

124:                                              ; preds = %120
  %125 = load ptr, ptr %16, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.omac_acpkm_ctx, ptr %125, i32 0, i32 0
  %127 = load ptr, ptr %126, align 8, !tbaa !15
  %128 = getelementptr inbounds %struct.CMAC_ACPKM_CTX_st, ptr %127, i32 0, i32 1
  %129 = load ptr, ptr %128, align 8, !tbaa !18
  %130 = call ptr @EVP_CIPHER_CTX_cipher(ptr noundef %129)
  %131 = call ptr @EVP_CIPHER_get0_provider(ptr noundef %130)
  %132 = icmp eq ptr %131, null
  br i1 %132, label %133, label %145

133:                                              ; preds = %124
  %134 = load ptr, ptr %16, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.omac_acpkm_ctx, ptr %134, i32 0, i32 0
  %136 = load ptr, ptr %135, align 8, !tbaa !15
  %137 = getelementptr inbounds %struct.CMAC_ACPKM_CTX_st, ptr %136, i32 0, i32 1
  %138 = load ptr, ptr %137, align 8, !tbaa !18
  %139 = load ptr, ptr %9, align 8, !tbaa !5
  %140 = load i32, ptr %139, align 4, !tbaa !9
  %141 = call i32 @EVP_CIPHER_CTX_ctrl(ptr noundef %138, i32 noundef 32, i32 noundef %140, ptr noundef null)
  %142 = icmp ne i32 %141, 0
  br i1 %142, label %144, label %143

143:                                              ; preds = %133
  store i32 0, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %165

144:                                              ; preds = %133
  br label %163

145:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %146 = load ptr, ptr %9, align 8, !tbaa !5
  %147 = load i32, ptr %146, align 4, !tbaa !9
  %148 = sext i32 %147 to i64
  store i64 %148, ptr %17, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 80, ptr %18) #5
  call void @llvm.memset.p0.i64(ptr align 16 %18, i8 0, i64 80, i1 false)
  %149 = getelementptr inbounds [2 x %struct.ossl_param_st], ptr %18, i64 0, i64 0
  call void @llvm.lifetime.start.p0(i64 40, ptr %19) #5
  call void @OSSL_PARAM_construct_size_t(ptr dead_on_unwind writable sret(%struct.ossl_param_st) align 8 %19, ptr noundef @.str.4, ptr noundef %17)
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %149, ptr align 8 %19, i64 40, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 40, ptr %19) #5
  %150 = load ptr, ptr %16, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.omac_acpkm_ctx, ptr %150, i32 0, i32 0
  %152 = load ptr, ptr %151, align 8, !tbaa !15
  %153 = getelementptr inbounds %struct.CMAC_ACPKM_CTX_st, ptr %152, i32 0, i32 1
  %154 = load ptr, ptr %153, align 8, !tbaa !18
  %155 = getelementptr inbounds [2 x %struct.ossl_param_st], ptr %18, i64 0, i64 0
  %156 = call i32 @EVP_CIPHER_CTX_set_params(ptr noundef %154, ptr noundef %155)
  %157 = icmp ne i32 %156, 0
  br i1 %157, label %159, label %158

158:                                              ; preds = %145
  store i32 0, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %160

159:                                              ; preds = %145
  store i32 0, ptr %15, align 4
  br label %160

160:                                              ; preds = %159, %158
  call void @llvm.lifetime.end.p0(i64 80, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  %161 = load i32, ptr %15, align 4
  switch i32 %161, label %165 [
    i32 0, label %162
  ]

162:                                              ; preds = %160
  br label %163

163:                                              ; preds = %162, %144
  br label %164

164:                                              ; preds = %163, %120, %112
  store i32 1, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %165

165:                                              ; preds = %164, %160, %143, %111
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %201

166:                                              ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %167 = load ptr, ptr %6, align 8, !tbaa !5
  %168 = call ptr @EVP_MD_CTX_get0_md_data(ptr noundef %167)
  store ptr %168, ptr %20, align 8, !tbaa !5
  %169 = load ptr, ptr %20, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.omac_acpkm_ctx, ptr %169, i32 0, i32 2
  %171 = load ptr, ptr %170, align 8, !tbaa !11
  %172 = call i32 @OBJ_txt2nid(ptr noundef %171)
  switch i32 %172, label %197 [
    i32 1015, label %173
    i32 1190, label %185
  ]

173:                                              ; preds = %166
  %174 = load i32, ptr %8, align 4, !tbaa !9
  %175 = icmp slt i32 %174, 1
  br i1 %175, label %179, label %176

176:                                              ; preds = %173
  %177 = load i32, ptr %8, align 4, !tbaa !9
  %178 = icmp sgt i32 %177, 16
  br i1 %178, label %179, label %180

179:                                              ; preds = %176, %173
  call void @ERR_GOST_error(i32 noundef 144, i32 noundef 117, ptr noundef @.str, i32 noundef 494)
  store i32 0, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %199

180:                                              ; preds = %176
  %181 = load i32, ptr %8, align 4, !tbaa !9
  %182 = sext i32 %181 to i64
  %183 = load ptr, ptr %20, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.omac_acpkm_ctx, ptr %183, i32 0, i32 1
  store i64 %182, ptr %184, align 8, !tbaa !21
  br label %198

185:                                              ; preds = %166
  %186 = load i32, ptr %8, align 4, !tbaa !9
  %187 = icmp slt i32 %186, 1
  br i1 %187, label %191, label %188

188:                                              ; preds = %185
  %189 = load i32, ptr %8, align 4, !tbaa !9
  %190 = icmp sgt i32 %189, 8
  br i1 %190, label %191, label %192

191:                                              ; preds = %188, %185
  call void @ERR_GOST_error(i32 noundef 144, i32 noundef 117, ptr noundef @.str, i32 noundef 501)
  store i32 0, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %199

192:                                              ; preds = %188
  %193 = load i32, ptr %8, align 4, !tbaa !9
  %194 = sext i32 %193 to i64
  %195 = load ptr, ptr %20, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.omac_acpkm_ctx, ptr %195, i32 0, i32 1
  store i64 %194, ptr %196, align 8, !tbaa !21
  br label %198

197:                                              ; preds = %166
  store i32 0, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %199

198:                                              ; preds = %192, %180
  store i32 1, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %199

199:                                              ; preds = %198, %197, %191, %179
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  br label %201

200:                                              ; preds = %4
  store i32 0, ptr %5, align 4
  br label %201

201:                                              ; preds = %200, %199, %165, %98, %22
  %202 = load i32, ptr %5, align 4
  ret i32 %202
}

declare ptr @EVP_MD_CTX_md(ptr noundef) #1

declare i32 @EVP_MD_is_a(ptr noundef, ptr noundef) #1

declare ptr @EVP_get_cipherbyname(ptr noundef) #1

declare ptr @EVP_CIPHER_fetch(ptr noundef, ptr noundef, ptr noundef) #1

declare ptr @EVP_MD_meth_get_init(ptr noundef) #1

declare void @EVP_MD_CTX_set_flags(ptr noundef, i32 noundef) #1

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

declare void @EVP_CIPHER_free(ptr noundef) #1

declare i32 @EVP_MD_get_block_size(ptr noundef) #1

declare ptr @EVP_CIPHER_get0_provider(ptr noundef) #1

declare ptr @EVP_CIPHER_CTX_cipher(ptr noundef) #1

declare i32 @EVP_CIPHER_CTX_ctrl(ptr noundef, i32 noundef, i32 noundef, ptr noundef) #1

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

declare void @OSSL_PARAM_construct_size_t(ptr dead_on_unwind writable sret(%struct.ossl_param_st) align 8, ptr noundef, ptr noundef) #1

declare i32 @EVP_CIPHER_CTX_set_params(ptr noundef, ptr noundef) #1

declare i32 @OBJ_txt2nid(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 16}
!12 = !{!"omac_acpkm_ctx", !6, i64 0, !13, i64 8, !6, i64 16, !10, i64 24}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !10, i64 24}
!15 = !{!12, !6, i64 0}
!16 = !{!17, !10, i64 132}
!17 = !{!"CMAC_ACPKM_CTX_st", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 64, !7, i64 96, !10, i64 128, !10, i64 132, !10, i64 136}
!18 = !{!17, !6, i64 8}
!19 = !{!13, !13, i64 0}
!20 = !{i64 0, i64 8, !5, i64 8, i64 4, !9, i64 16, i64 8, !5, i64 24, i64 8, !19, i64 32, i64 8, !19}
!21 = !{!12, !13, i64 8}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.ossl_param_st = type { ptr, i32, ptr, i64, i64 }

@.str = external hidden unnamed_addr constant [70 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1

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

declare ptr @EVP_MD_CTX_get0_md_data(ptr noundef) local_unnamed_addr #1

declare void @ERR_GOST_error(i32 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @omac_acpkm_imit_ctrl(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) local_unnamed_addr #2 {
  %5 = alloca i64, align 8
  %6 = alloca [2 x %struct.ossl_param_st], align 16
  switch i32 %1, label %94 [
    i32 4099, label %7
    i32 4100, label %8
    i32 32, label %46
    i32 3, label %77
  ]

7:                                                ; preds = %4
  store i32 32, ptr %3, align 4, !tbaa !5
  br label %94

8:                                                ; preds = %4
  %9 = tail call ptr @EVP_MD_CTX_get0_md_data(ptr noundef %0) #4
  %10 = tail call ptr @EVP_MD_CTX_md(ptr noundef %0) #4
  %11 = getelementptr inbounds i8, ptr %9, i64 16
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %19

14:                                               ; preds = %8
  %15 = tail call i32 @EVP_MD_is_a(ptr noundef %10, ptr noundef nonnull @.str.1) #4
  %.not69 = icmp eq i32 %15, 0
  br i1 %.not69, label %16, label %18

16:                                               ; preds = %14
  %17 = tail call i32 @EVP_MD_is_a(ptr noundef %10, ptr noundef nonnull @.str.2) #4
  %.not70 = icmp eq i32 %17, 0
  br i1 %.not70, label %._crit_edge, label %18

._crit_edge:                                      ; preds = %16
  %.pre = load ptr, ptr %11, align 8, !tbaa !9
  br label %19

18:                                               ; preds = %16, %14
  store ptr @.str.3, ptr %11, align 8, !tbaa !9
  br label %19

19:                                               ; preds = %._crit_edge, %18, %8
  %20 = phi ptr [ %.pre, %._crit_edge ], [ @.str.3, %18 ], [ %12, %8 ]
  %21 = tail call ptr @EVP_get_cipherbyname(ptr noundef %20) #4
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %28

23:                                               ; preds = %19
  %24 = load ptr, ptr %11, align 8, !tbaa !9
  %25 = tail call ptr @EVP_CIPHER_fetch(ptr noundef null, ptr noundef %24, ptr noundef null) #4
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %28

27:                                               ; preds = %23
  tail call void @ERR_GOST_error(i32 noundef 144, i32 noundef 103, ptr noundef nonnull @.str, i32 noundef 440) #4
  br label %28

28:                                               ; preds = %27, %23, %19
  %.054 = phi ptr [ null, %27 ], [ %25, %23 ], [ %21, %19 ]
  %29 = tail call ptr @EVP_MD_CTX_md(ptr noundef %0) #4
  %30 = tail call ptr @EVP_MD_meth_get_init(ptr noundef %29) #4
  %31 = tail call i32 %30(ptr noundef %0) #4
  %32 = icmp slt i32 %31, 1
  br i1 %32, label %33, label %34

33:                                               ; preds = %28
  tail call void @ERR_GOST_error(i32 noundef 144, i32 noundef 121, ptr noundef nonnull @.str, i32 noundef 443) #4
  br label %45

34:                                               ; preds = %28
  tail call void @EVP_MD_CTX_set_flags(ptr noundef %0, i32 noundef 256) #4
  %35 = getelementptr inbounds i8, ptr %9, i64 24
  %36 = load i32, ptr %35, align 8, !tbaa !13
  %.not71 = icmp eq i32 %36, 0
  br i1 %.not71, label %38, label %37

37:                                               ; preds = %34
  tail call void @ERR_GOST_error(i32 noundef 144, i32 noundef 132, ptr noundef nonnull @.str, i32 noundef 448) #4
  br label %45

38:                                               ; preds = %34
  switch i32 %2, label %44 [
    i32 0, label %39
    i32 32, label %42
  ]

39:                                               ; preds = %38
  %40 = getelementptr inbounds i8, ptr %3, i64 4
  %41 = tail call i32 @omac_acpkm_key(ptr noundef nonnull %9, ptr noundef %.054, ptr noundef nonnull %40, i64 noundef 32)
  br label %45

42:                                               ; preds = %38
  %43 = tail call i32 @omac_acpkm_key(ptr noundef nonnull %9, ptr noundef %.054, ptr noundef %3, i64 noundef 32)
  br label %45

44:                                               ; preds = %38
  tail call void @ERR_GOST_error(i32 noundef 144, i32 noundef 115, ptr noundef nonnull @.str, i32 noundef 459) #4
  br label %45

45:                                               ; preds = %39, %44, %42, %37, %33
  %.056 = phi i32 [ 0, %33 ], [ 0, %37 ], [ %41, %39 ], [ %43, %42 ], [ 0, %44 ]
  tail call void @EVP_CIPHER_free(ptr noundef %.054) #4
  br label %94

46:                                               ; preds = %4
  %47 = tail call ptr @EVP_MD_CTX_get0_md_data(ptr noundef %0) #4
  %.not = icmp eq i32 %2, 0
  br i1 %.not, label %94, label %48

48:                                               ; preds = %46
  %49 = tail call ptr @EVP_MD_CTX_md(ptr noundef %0) #4
  %50 = tail call i32 @EVP_MD_get_block_size(ptr noundef %49) #4
  %51 = srem i32 %2, %50
  %.not64 = icmp eq i32 %51, 0
  br i1 %.not64, label %52, label %94

52:                                               ; preds = %48
  %53 = load ptr, ptr %47, align 8, !tbaa !14
  %54 = getelementptr inbounds i8, ptr %53, i64 132
  store i32 %2, ptr %54, align 4, !tbaa !15
  %.not65 = icmp eq ptr %3, null
  br i1 %.not65, label %76, label %55

55:                                               ; preds = %52
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %.not66 = icmp eq i32 %56, 0
  br i1 %.not66, label %76, label %57

57:                                               ; preds = %55
  %58 = getelementptr inbounds i8, ptr %53, i64 8
  %59 = load ptr, ptr %58, align 8, !tbaa !17
  %60 = tail call ptr @EVP_CIPHER_CTX_cipher(ptr noundef %59) #4
  %61 = tail call ptr @EVP_CIPHER_get0_provider(ptr noundef %60) #4
  %62 = icmp eq ptr %61, null
  br i1 %62, label %63, label %69

63:                                               ; preds = %57
  %64 = load ptr, ptr %47, align 8, !tbaa !14
  %65 = getelementptr inbounds i8, ptr %64, i64 8
  %66 = load ptr, ptr %65, align 8, !tbaa !17
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = tail call i32 @EVP_CIPHER_CTX_ctrl(ptr noundef %66, i32 noundef 32, i32 noundef %67, ptr noundef null) #4
  %.not68 = icmp eq i32 %68, 0
  br i1 %.not68, label %94, label %76

69:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  store i64 %71, ptr %5, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %6) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(80) %6, i8 0, i64 80, i1 false)
  call void @OSSL_PARAM_construct_size_t(ptr dead_on_unwind nonnull writable sret(%struct.ossl_param_st) align 8 %6, ptr noundef nonnull @.str.4, ptr noundef nonnull %5) #4
  %72 = load ptr, ptr %47, align 8, !tbaa !14
  %73 = getelementptr inbounds i8, ptr %72, i64 8
  %74 = load ptr, ptr %73, align 8, !tbaa !17
  %75 = call i32 @EVP_CIPHER_CTX_set_params(ptr noundef %74, ptr noundef nonnull %6) #4
  %.not67.not = icmp eq i32 %75, 0
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  br i1 %.not67.not, label %94, label %76

76:                                               ; preds = %63, %69, %55, %52
  br label %94

77:                                               ; preds = %4
  %78 = tail call ptr @EVP_MD_CTX_get0_md_data(ptr noundef %0) #4
  %79 = getelementptr inbounds i8, ptr %78, i64 16
  %80 = load ptr, ptr %79, align 8, !tbaa !9
  %81 = tail call i32 @OBJ_txt2nid(ptr noundef %80) #4
  switch i32 %81, label %94 [
    i32 1015, label %82
    i32 1190, label %88
  ]

82:                                               ; preds = %77
  %83 = add i32 %2, -17
  %or.cond = icmp ult i32 %83, -16
  br i1 %or.cond, label %84, label %85

84:                                               ; preds = %82
  tail call void @ERR_GOST_error(i32 noundef 144, i32 noundef 117, ptr noundef nonnull @.str, i32 noundef 494) #4
  br label %94

85:                                               ; preds = %82
  %86 = zext nneg i32 %2 to i64
  %87 = getelementptr inbounds i8, ptr %78, i64 8
  store i64 %86, ptr %87, align 8, !tbaa !19
  br label %94

88:                                               ; preds = %77
  %89 = add i32 %2, -9
  %or.cond4 = icmp ult i32 %89, -8
  br i1 %or.cond4, label %90, label %91

90:                                               ; preds = %88
  tail call void @ERR_GOST_error(i32 noundef 144, i32 noundef 117, ptr noundef nonnull @.str, i32 noundef 501) #4
  br label %94

91:                                               ; preds = %88
  %92 = zext nneg i32 %2 to i64
  %93 = getelementptr inbounds i8, ptr %78, i64 8
  store i64 %92, ptr %93, align 8, !tbaa !19
  br label %94

94:                                               ; preds = %4, %84, %90, %77, %91, %85, %76, %69, %48, %46, %63, %45, %7
  %.4 = phi i32 [ %.056, %45 ], [ 1, %7 ], [ 1, %76 ], [ 0, %69 ], [ -1, %48 ], [ -1, %46 ], [ 0, %63 ], [ 0, %90 ], [ 0, %84 ], [ 0, %77 ], [ 1, %91 ], [ 1, %85 ], [ 0, %4 ]
  ret i32 %.4
}

declare ptr @EVP_MD_CTX_md(ptr noundef) local_unnamed_addr #1

declare i32 @EVP_MD_is_a(ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @EVP_get_cipherbyname(ptr noundef) local_unnamed_addr #1

declare ptr @EVP_CIPHER_fetch(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @EVP_MD_meth_get_init(ptr noundef) local_unnamed_addr #1

declare void @EVP_MD_CTX_set_flags(ptr noundef, i32 noundef) local_unnamed_addr #1

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

declare void @EVP_CIPHER_free(ptr noundef) local_unnamed_addr #1

declare i32 @EVP_MD_get_block_size(ptr noundef) local_unnamed_addr #1

declare ptr @EVP_CIPHER_get0_provider(ptr noundef) local_unnamed_addr #1

declare ptr @EVP_CIPHER_CTX_cipher(ptr noundef) local_unnamed_addr #1

declare i32 @EVP_CIPHER_CTX_ctrl(ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

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

declare void @OSSL_PARAM_construct_size_t(ptr dead_on_unwind writable sret(%struct.ossl_param_st) align 8, ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @EVP_CIPHER_CTX_set_params(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @OBJ_txt2nid(ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 #2 = { 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 16}
!10 = !{!"omac_acpkm_ctx", !11, i64 0, !12, i64 8, !11, i64 16, !6, i64 24}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!10, !6, i64 24}
!14 = !{!10, !11, i64 0}
!15 = !{!16, !6, i64 132}
!16 = !{!"CMAC_ACPKM_CTX_st", !11, i64 0, !11, i64 8, !7, i64 16, !7, i64 64, !7, i64 96, !6, i64 128, !6, i64 132, !6, i64 136}
!17 = !{!16, !11, i64 8}
!18 = !{!12, !12, i64 0}
!19 = !{!10, !12, i64 8}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass