; LLVM IR from intel/intel-ipsec-mb :: test/imb-provider (prov_sw_gcm)

; 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.prov_gcm_ctx_st = type { %struct.gcm_key_data, %struct.gcm_context_data, i32, i32, ptr, i32, ptr, ptr, i32, ptr, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, i32, i64, i64, i64, i64, i64, i64, i8, [16 x i8], ptr, ptr, [48 x i8] }
%struct.gcm_key_data = type { [240 x i8], %union.anon }
%union.anon = type { %struct.anon.1 }
%struct.anon.1 = type { [1024 x i8] }
%struct.gcm_context_data = type { [16 x i8], i64, i64, [16 x i8], [16 x i8], [16 x i8], i64 }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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) #1

; 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
declare dso_local i32 @PROV_AES_CIPHER_CTX_encrypting(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @aes_gcm_tls_cipher(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, i32 noundef) #2

declare i32 @prov_aes_gcm_ctx_get_nid(ptr noundef) #3

declare void @prov_imb_aes_gcm_enc_update(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) #3

declare void @prov_imb_aes_gcm_enc_finalize(i32 noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) #3

declare void @prov_imb_aes_gcm_dec_update(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) #3

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

; Function Attrs: nounwind uwtable
define dso_local i32 @vaesgcm_ciphers_do_cipher(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i64 noundef %4) #2 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i64 %4, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %18, 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 !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  store ptr null, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  store ptr null, ptr %16, align 8, !tbaa !5
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = icmp eq ptr %19, null
  br i1 %20, label %21, label %22

21:                                               ; preds = %5
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %200

22:                                               ; preds = %5
  %23 = load ptr, ptr %12, align 8, !tbaa !5
  %24 = icmp eq ptr %23, null
  br i1 %24, label %25, label %26

25:                                               ; preds = %22
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %200

26:                                               ; preds = %22
  %27 = load ptr, ptr %12, align 8, !tbaa !5
  %28 = call i32 @PROV_AES_CIPHER_CTX_encrypting(ptr noundef %27)
  store i32 %28, ptr %13, align 4, !tbaa !11
  %29 = load ptr, ptr %12, align 8, !tbaa !5
  %30 = call i32 @prov_aes_gcm_ctx_get_nid(ptr noundef %29)
  store i32 %30, ptr %14, align 4, !tbaa !11
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %31, i32 0, i32 0
  store ptr %32, ptr %15, align 8, !tbaa !5
  %33 = load i32, ptr %14, align 4, !tbaa !11
  %34 = call i32 @prov_check_gcm_nid(i32 noundef %33)
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %37, label %36

36:                                               ; preds = %26
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %200

37:                                               ; preds = %26
  %38 = load ptr, ptr %12, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %38, i32 0, i32 11
  %40 = load i32, ptr %39, align 4, !tbaa !13
  %41 = icmp sge i32 %40, 0
  br i1 %41, label %42, label %50

42:                                               ; preds = %37
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = load i64, ptr %11, align 8, !tbaa !9
  %48 = load i32, ptr %13, align 4, !tbaa !11
  %49 = call i32 @aes_gcm_tls_cipher(ptr noundef %43, ptr noundef %44, ptr noundef %45, ptr noundef %46, i64 noundef %47, i32 noundef %48)
  store i32 %49, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %200

50:                                               ; preds = %37
  %51 = load ptr, ptr %12, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %51, i32 0, i32 1
  store ptr %52, ptr %16, align 8, !tbaa !5
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = icmp eq ptr %53, null
  br i1 %54, label %55, label %73

55:                                               ; preds = %50
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = icmp ne ptr %56, null
  br i1 %57, label %58, label %73

58:                                               ; preds = %55
  %59 = load i32, ptr %14, align 4, !tbaa !11
  %60 = load ptr, ptr %15, align 8, !tbaa !5
  %61 = load ptr, ptr %16, align 8, !tbaa !5
  %62 = load ptr, ptr %12, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %62, i32 0, i32 18
  %64 = load ptr, ptr %63, align 8, !tbaa !17
  %65 = load ptr, ptr %12, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %65, i32 0, i32 13
  %67 = load i32, ptr %66, align 4, !tbaa !18
  %68 = sext i32 %67 to i64
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  %70 = load i64, ptr %11, align 8, !tbaa !9
  call void @prov_imb_aes_gcm_init_var_iv(i32 noundef %59, ptr noundef %60, ptr noundef %61, ptr noundef %64, i64 noundef %68, ptr noundef %69, i64 noundef %70)
  %71 = load i64, ptr %11, align 8, !tbaa !9
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 %71, ptr %72, align 8, !tbaa !9
  store i32 1, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %200

73:                                               ; preds = %55, %50
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = icmp eq ptr %74, null
  br i1 %75, label %76, label %179

76:                                               ; preds = %73
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = icmp ne ptr %77, null
  br i1 %78, label %79, label %179

79:                                               ; preds = %76
  %80 = load i32, ptr %13, align 4, !tbaa !11
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %122

82:                                               ; preds = %79
  %83 = load ptr, ptr %12, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %83, i32 0, i32 6
  %85 = load ptr, ptr %84, align 32, !tbaa !19
  %86 = icmp eq ptr %85, null
  br i1 %86, label %92, label %87

87:                                               ; preds = %82
  %88 = load ptr, ptr %12, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %88, i32 0, i32 12
  %90 = load i32, ptr %89, align 8, !tbaa !20
  %91 = icmp sle i32 %90, 0
  br i1 %91, label %92, label %93

92:                                               ; preds = %87, %82
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %200

93:                                               ; preds = %87
  %94 = load ptr, ptr %12, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %94, i32 0, i32 15
  %96 = load i32, ptr %95, align 4, !tbaa !21
  %97 = icmp ult i32 %96, 1
  br i1 %97, label %98, label %109

98:                                               ; preds = %93
  %99 = load i32, ptr %14, align 4, !tbaa !11
  %100 = load ptr, ptr %15, align 8, !tbaa !5
  %101 = load ptr, ptr %16, align 8, !tbaa !5
  %102 = load ptr, ptr %12, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %102, i32 0, i32 6
  %104 = load ptr, ptr %103, align 32, !tbaa !19
  %105 = load ptr, ptr %12, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %105, i32 0, i32 12
  %107 = load i32, ptr %106, align 8, !tbaa !20
  %108 = sext i32 %107 to i64
  call void @prov_imb_aes_gcm_enc_finalize(i32 noundef %99, ptr noundef %100, ptr noundef %101, ptr noundef %104, i64 noundef %108)
  br label %109

109:                                              ; preds = %98, %93
  %110 = load ptr, ptr %12, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %110, i32 0, i32 15
  store i32 1, ptr %111, align 4, !tbaa !21
  %112 = load ptr, ptr %12, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %112, i32 0, i32 27
  %114 = getelementptr inbounds [16 x i8], ptr %113, i64 0, i64 0
  %115 = load ptr, ptr %12, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %115, i32 0, i32 6
  %117 = load ptr, ptr %116, align 32, !tbaa !19
  %118 = load ptr, ptr %12, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %118, i32 0, i32 12
  %120 = load i32, ptr %119, align 8, !tbaa !20
  %121 = sext i32 %120 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %114, ptr align 1 %117, i64 %121, i1 false)
  br label %178

122:                                              ; preds = %79
  %123 = load ptr, ptr %12, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %123, i32 0, i32 12
  %125 = load i32, ptr %124, align 8, !tbaa !20
  %126 = icmp slt i32 %125, 0
  br i1 %126, label %132, label %127

127:                                              ; preds = %122
  %128 = load ptr, ptr %12, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %128, i32 0, i32 7
  %130 = load ptr, ptr %129, align 8, !tbaa !22
  %131 = icmp eq ptr %130, null
  br i1 %131, label %132, label %133

132:                                              ; preds = %127, %122
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %200

133:                                              ; preds = %127
  %134 = load ptr, ptr %12, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %134, i32 0, i32 8
  %136 = load i32, ptr %135, align 16, !tbaa !23
  %137 = icmp ult i32 %136, 1
  br i1 %137, label %138, label %157

138:                                              ; preds = %133
  %139 = load i32, ptr %14, align 4, !tbaa !11
  %140 = load ptr, ptr %15, align 8, !tbaa !5
  %141 = load ptr, ptr %16, align 8, !tbaa !5
  %142 = load ptr, ptr %8, align 8, !tbaa !5
  %143 = load ptr, ptr %12, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %143, i32 0, i32 12
  %145 = load i32, ptr %144, align 8, !tbaa !20
  %146 = sext i32 %145 to i64
  call void @prov_imb_aes_gcm_dec_finalize(i32 noundef %139, ptr noundef %140, ptr noundef %141, ptr noundef %142, i64 noundef %146)
  %147 = load ptr, ptr %12, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %147, i32 0, i32 7
  %149 = load ptr, ptr %148, align 8, !tbaa !22
  %150 = load ptr, ptr %8, align 8, !tbaa !5
  %151 = load ptr, ptr %12, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %151, i32 0, i32 12
  %153 = load i32, ptr %152, align 8, !tbaa !20
  %154 = sext i32 %153 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %149, ptr align 1 %150, i64 %154, i1 false)
  %155 = load ptr, ptr %12, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %155, i32 0, i32 8
  store i32 1, ptr %156, align 16, !tbaa !23
  br label %157

157:                                              ; preds = %138, %133
  %158 = load ptr, ptr %12, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %158, i32 0, i32 15
  %160 = load i32, ptr %159, align 4, !tbaa !21
  %161 = icmp ne i32 %160, 0
  br i1 %161, label %162, label %177

162:                                              ; preds = %157
  %163 = load ptr, ptr %12, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %163, i32 0, i32 7
  %165 = load ptr, ptr %164, align 8, !tbaa !22
  %166 = load ptr, ptr %12, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %166, i32 0, i32 6
  %168 = load ptr, ptr %167, align 32, !tbaa !19
  %169 = load ptr, ptr %12, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.prov_gcm_ctx_st, ptr %169, i32 0, i32 12
  %171 = load i32, ptr %170, align 8, !tbaa !20
  %172 = sext i32 %171 to i64
  %173 = call i32 @memcmp(ptr noundef %165, ptr noundef %168, i64 noundef %172) #6
  %174 = icmp eq i32 %173, 0
  br i1 %174, label %175, label %176

175:                                              ; preds = %162
  store i32 0, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %200

176:                                              ; preds = %162
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %200

177:                                              ; preds = %157
  br label %178

178:                                              ; preds = %177, %109
  br label %197

179:                                              ; preds = %76, %73
  %180 = load i32, ptr %13, align 4, !tbaa !11
  %181 = icmp ne i32 %180, 0
  br i1 %181, label %182, label %189

182:                                              ; preds = %179
  %183 = load i32, ptr %14, align 4, !tbaa !11
  %184 = load ptr, ptr %15, align 8, !tbaa !5
  %185 = load ptr, ptr %16, align 8, !tbaa !5
  %186 = load ptr, ptr %8, align 8, !tbaa !5
  %187 = load ptr, ptr %10, align 8, !tbaa !5
  %188 = load i64, ptr %11, align 8, !tbaa !9
  call void @prov_imb_aes_gcm_enc_update(i32 noundef %183, ptr noundef %184, ptr noundef %185, ptr noundef %186, ptr noundef %187, i64 noundef %188)
  br label %196

189:                                              ; preds = %179
  %190 = load i32, ptr %14, align 4, !tbaa !11
  %191 = load ptr, ptr %15, align 8, !tbaa !5
  %192 = load ptr, ptr %16, align 8, !tbaa !5
  %193 = load ptr, ptr %8, align 8, !tbaa !5
  %194 = load ptr, ptr %10, align 8, !tbaa !5
  %195 = load i64, ptr %11, align 8, !tbaa !9
  call void @prov_imb_aes_gcm_dec_update(i32 noundef %190, ptr noundef %191, ptr noundef %192, ptr noundef %193, ptr noundef %194, i64 noundef %195)
  br label %196

196:                                              ; preds = %189, %182
  br label %197

197:                                              ; preds = %196, %178
  %198 = load i64, ptr %11, align 8, !tbaa !9
  %199 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 %198, ptr %199, align 8, !tbaa !9
  store i32 1, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %200

200:                                              ; preds = %197, %176, %175, %132, %92, %58, %42, %36, %25, %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  %201 = load i32, ptr %6, align 4
  ret i32 %201
}

; Function Attrs: nounwind uwtable
declare hidden i32 @prov_check_gcm_nid(i32 noundef) #2

declare void @prov_imb_aes_gcm_init_var_iv(i32 noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef) #3

declare void @prov_imb_aes_gcm_dec_finalize(i32 noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) #3

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

!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 = !{!14, !12, i64 1412}
!14 = !{!"prov_gcm_ctx_st", !15, i64 0, !16, i64 1264, !12, i64 1352, !12, i64 1356, !6, i64 1360, !12, i64 1368, !6, i64 1376, !6, i64 1384, !12, i64 1392, !6, i64 1400, !12, i64 1408, !12, i64 1412, !12, i64 1416, !12, i64 1420, !12, i64 1424, !12, i64 1428, !12, i64 1432, !6, i64 1440, !6, i64 1448, !12, i64 1456, !10, i64 1464, !10, i64 1472, !10, i64 1480, !10, i64 1488, !10, i64 1496, !10, i64 1504, !12, i64 1512, !12, i64 1512, !12, i64 1512, !7, i64 1513, !6, i64 1536, !6, i64 1544}
!15 = !{!"gcm_key_data", !7, i64 0, !7, i64 240}
!16 = !{!"gcm_context_data", !7, i64 0, !10, i64 16, !10, i64 24, !7, i64 32, !7, i64 48, !7, i64 64, !10, i64 80}
!17 = !{!14, !6, i64 1448}
!18 = !{!14, !12, i64 1420}
!19 = !{!14, !6, i64 1376}
!20 = !{!14, !12, i64 1416}
!21 = !{!14, !12, i64 1428}
!22 = !{!14, !6, i64 1384}
!23 = !{!14, !12, i64 1392}


; 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 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) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @PROV_AES_CIPHER_CTX_encrypting(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @aes_gcm_tls_cipher(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

declare i32 @prov_aes_gcm_ctx_get_nid(ptr noundef) local_unnamed_addr #2

declare void @prov_imb_aes_gcm_enc_update(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare void @prov_imb_aes_gcm_enc_finalize(i32 noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare void @prov_imb_aes_gcm_dec_update(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local i32 @vaesgcm_ciphers_do_cipher(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i64 noundef %4) local_unnamed_addr #1 {
  %6 = icmp eq ptr %0, null
  br i1 %6, label %81, label %7

7:                                                ; preds = %5
  %8 = tail call i32 @PROV_AES_CIPHER_CTX_encrypting(ptr noundef nonnull %0)
  %9 = tail call i32 @prov_aes_gcm_ctx_get_nid(ptr noundef nonnull %0) #4
  %10 = tail call i32 @prov_check_gcm_nid(i32 noundef %9)
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %81, label %11

11:                                               ; preds = %7
  %12 = getelementptr inbounds i8, ptr %0, i64 1412
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, -1
  br i1 %14, label %15, label %17

15:                                               ; preds = %11
  %16 = tail call i32 @aes_gcm_tls_cipher(ptr noundef nonnull %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i64 noundef %4, i32 noundef %8)
  br label %81

17:                                               ; preds = %11
  %18 = getelementptr inbounds i8, ptr %0, i64 1264
  %19 = icmp eq ptr %1, null
  %20 = icmp ne ptr %3, null
  %or.cond = and i1 %19, %20
  br i1 %or.cond, label %21, label %27

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %0, i64 1448
  %23 = load ptr, ptr %22, align 8, !tbaa !14
  %24 = getelementptr inbounds i8, ptr %0, i64 1420
  %25 = load i32, ptr %24, align 4, !tbaa !15
  %26 = sext i32 %25 to i64
  tail call void @prov_imb_aes_gcm_init_var_iv(i32 noundef %9, ptr noundef nonnull %0, ptr noundef nonnull %18, ptr noundef %23, i64 noundef %26, ptr noundef nonnull %3, i64 noundef %4) #4
  store i64 %4, ptr %2, align 8, !tbaa !16
  br label %81

27:                                               ; preds = %17
  %28 = icmp eq ptr %3, null
  %29 = icmp ne ptr %1, null
  %or.cond3 = and i1 %29, %28
  %.not82 = icmp eq i32 %8, 0
  br i1 %or.cond3, label %30, label %77

30:                                               ; preds = %27
  br i1 %.not82, label %50, label %31

31:                                               ; preds = %30
  %32 = getelementptr inbounds i8, ptr %0, i64 1376
  %33 = load ptr, ptr %32, align 32, !tbaa !17
  %34 = icmp eq ptr %33, null
  br i1 %34, label %81, label %35

35:                                               ; preds = %31
  %36 = getelementptr inbounds i8, ptr %0, i64 1416
  %37 = load i32, ptr %36, align 8, !tbaa !18
  %38 = icmp slt i32 %37, 1
  br i1 %38, label %81, label %39

39:                                               ; preds = %35
  %40 = getelementptr inbounds i8, ptr %0, i64 1428
  %41 = load i32, ptr %40, align 4, !tbaa !19
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %45

43:                                               ; preds = %39
  %44 = zext nneg i32 %37 to i64
  tail call void @prov_imb_aes_gcm_enc_finalize(i32 noundef %9, ptr noundef nonnull %0, ptr noundef nonnull %18, ptr noundef nonnull %33, i64 noundef %44) #4
  %.pre = load ptr, ptr %32, align 32, !tbaa !17
  %.pre84 = load i32, ptr %36, align 8, !tbaa !18
  br label %45

45:                                               ; preds = %43, %39
  %46 = phi i32 [ %.pre84, %43 ], [ %37, %39 ]
  %47 = phi ptr [ %.pre, %43 ], [ %33, %39 ]
  store i32 1, ptr %40, align 4, !tbaa !19
  %48 = getelementptr inbounds i8, ptr %0, i64 1513
  %49 = sext i32 %46 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %48, ptr align 1 %47, i64 %49, i1 false)
  br label %80

50:                                               ; preds = %30
  %51 = getelementptr inbounds i8, ptr %0, i64 1416
  %52 = load i32, ptr %51, align 8, !tbaa !18
  %53 = icmp slt i32 %52, 0
  br i1 %53, label %81, label %54

54:                                               ; preds = %50
  %55 = getelementptr inbounds i8, ptr %0, i64 1384
  %56 = load ptr, ptr %55, align 8, !tbaa !20
  %57 = icmp eq ptr %56, null
  br i1 %57, label %81, label %58

58:                                               ; preds = %54
  %59 = getelementptr inbounds i8, ptr %0, i64 1392
  %60 = load i32, ptr %59, align 16, !tbaa !21
  %61 = icmp eq i32 %60, 0
  br i1 %61, label %62, label %67

62:                                               ; preds = %58
  %63 = zext nneg i32 %52 to i64
  tail call void @prov_imb_aes_gcm_dec_finalize(i32 noundef %9, ptr noundef nonnull %0, ptr noundef nonnull %18, ptr noundef nonnull %1, i64 noundef %63) #4
  %64 = load ptr, ptr %55, align 8, !tbaa !20
  %65 = load i32, ptr %51, align 8, !tbaa !18
  %66 = sext i32 %65 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %64, ptr nonnull align 1 %1, i64 %66, i1 false)
  store i32 1, ptr %59, align 16, !tbaa !21
  br label %67

67:                                               ; preds = %62, %58
  %68 = getelementptr inbounds i8, ptr %0, i64 1428
  %69 = load i32, ptr %68, align 4, !tbaa !19
  %.not83 = icmp eq i32 %69, 0
  br i1 %.not83, label %80, label %70

70:                                               ; preds = %67
  %71 = load ptr, ptr %55, align 8, !tbaa !20
  %72 = getelementptr inbounds i8, ptr %0, i64 1376
  %73 = load ptr, ptr %72, align 32, !tbaa !17
  %74 = load i32, ptr %51, align 8, !tbaa !18
  %75 = sext i32 %74 to i64
  %bcmp = tail call i32 @bcmp(ptr %71, ptr %73, i64 %75)
  %76 = icmp ne i32 %bcmp, 0
  %. = sext i1 %76 to i32
  br label %81

77:                                               ; preds = %27
  br i1 %.not82, label %79, label %78

78:                                               ; preds = %77
  tail call void @prov_imb_aes_gcm_enc_update(i32 noundef %9, ptr noundef nonnull %0, ptr noundef nonnull %18, ptr noundef %1, ptr noundef %3, i64 noundef %4) #4
  br label %80

79:                                               ; preds = %77
  tail call void @prov_imb_aes_gcm_dec_update(i32 noundef %9, ptr noundef nonnull %0, ptr noundef nonnull %18, ptr noundef %1, ptr noundef %3, i64 noundef %4) #4
  br label %80

80:                                               ; preds = %78, %79, %45, %67
  store i64 %4, ptr %2, align 8, !tbaa !16
  br label %81

81:                                               ; preds = %70, %50, %54, %31, %35, %7, %5, %80, %21, %15
  %.0 = phi i32 [ %16, %15 ], [ 1, %21 ], [ 1, %80 ], [ -1, %5 ], [ -1, %7 ], [ -1, %35 ], [ -1, %31 ], [ -1, %54 ], [ -1, %50 ], [ %., %70 ]
  ret i32 %.0
}

; Function Attrs: nounwind uwtable
declare hidden i32 @prov_check_gcm_nid(i32 noundef) local_unnamed_addr #1

declare void @prov_imb_aes_gcm_init_var_iv(i32 noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare void @prov_imb_aes_gcm_dec_finalize(i32 noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

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

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind willreturn memory(argmem: read) }
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, !12, i64 1412}
!6 = !{!"prov_gcm_ctx_st", !7, i64 0, !10, i64 1264, !12, i64 1352, !12, i64 1356, !13, i64 1360, !12, i64 1368, !13, i64 1376, !13, i64 1384, !12, i64 1392, !13, i64 1400, !12, i64 1408, !12, i64 1412, !12, i64 1416, !12, i64 1420, !12, i64 1424, !12, i64 1428, !12, i64 1432, !13, i64 1440, !13, i64 1448, !12, i64 1456, !11, i64 1464, !11, i64 1472, !11, i64 1480, !11, i64 1488, !11, i64 1496, !11, i64 1504, !12, i64 1512, !12, i64 1512, !12, i64 1512, !8, i64 1513, !13, i64 1536, !13, i64 1544}
!7 = !{!"gcm_key_data", !8, i64 0, !8, i64 240}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"gcm_context_data", !8, i64 0, !11, i64 16, !11, i64 24, !8, i64 32, !8, i64 48, !8, i64 64, !11, i64 80}
!11 = !{!"long", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!6, !13, i64 1448}
!15 = !{!6, !12, i64 1420}
!16 = !{!11, !11, i64 0}
!17 = !{!6, !13, i64 1376}
!18 = !{!6, !12, i64 1416}
!19 = !{!6, !12, i64 1428}
!20 = !{!6, !13, i64 1384}
!21 = !{!6, !12, i64 1392}


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