; LLVM IR from guanzhi/GmSSL :: src (sm4_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.SM4_GCM_CTX = type { %struct.SM4_CTR_CTX, %struct.GHASH_CTX, [16 x i8], i64, [16 x i8], i64, i64 }
%struct.SM4_CTR_CTX = type { %struct.SM4_KEY, [16 x i8], [16 x i8], i64 }
%struct.SM4_KEY = type { [32 x i32] }
%struct.GHASH_CTX = type { [2 x i64], [2 x i64], i64, i64, [16 x i8], i64 }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [61 x i8], align 1
@__FUNCTION__.sm4_gcm_encrypt_init = external hidden unnamed_addr constant [21 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

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

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

declare void @sm4_encrypt(ptr noundef, ptr noundef, ptr noundef) #3

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

declare void @ghash(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @ctr32_incr(ptr noundef) #5

; 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 @sm4_gcm_encrypt_init(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, i64 noundef %4, ptr noundef %5, i64 noundef %6, i64 noundef %7) #5 {
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca [16 x i8], align 16
  %19 = alloca [16 x i8], align 16
  %20 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store i64 %2, ptr %12, align 8, !tbaa !9
  store ptr %3, ptr %13, align 8, !tbaa !5
  store i64 %4, ptr %14, align 8, !tbaa !9
  store ptr %5, ptr %15, align 8, !tbaa !5
  store i64 %6, ptr %16, align 8, !tbaa !9
  store i64 %7, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #6
  call void @llvm.memset.p0.i64(ptr align 16 %18, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #6
  %21 = load ptr, ptr %10, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %35

23:                                               ; preds = %8
  %24 = load ptr, ptr %11, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %26, label %35

26:                                               ; preds = %23
  %27 = load ptr, ptr %13, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %35

29:                                               ; preds = %26
  %30 = load ptr, ptr %15, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %41, label %32

32:                                               ; preds = %29
  %33 = load i64, ptr %16, align 8, !tbaa !9
  %34 = icmp ne i64 %33, 0
  br i1 %34, label %35, label %41

35:                                               ; preds = %32, %26, %23, %8
  br label %36

36:                                               ; preds = %35
  %37 = load ptr, ptr @stderr, align 8, !tbaa !5
  %38 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %37, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 125, ptr noundef @__FUNCTION__.sm4_gcm_encrypt_init) #6
  br label %39

39:                                               ; preds = %36
  br label %40

40:                                               ; preds = %39
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %20, align 4
  br label %132

41:                                               ; preds = %32, %29
  %42 = load i64, ptr %12, align 8, !tbaa !9
  %43 = icmp ne i64 %42, 16
  br i1 %43, label %44, label %50

44:                                               ; preds = %41
  br label %45

45:                                               ; preds = %44
  %46 = load ptr, ptr @stderr, align 8, !tbaa !5
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 129, ptr noundef @__FUNCTION__.sm4_gcm_encrypt_init) #6
  br label %48

48:                                               ; preds = %45
  br label %49

49:                                               ; preds = %48
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %20, align 4
  br label %132

50:                                               ; preds = %41
  %51 = load i64, ptr %14, align 8, !tbaa !9
  %52 = icmp ult i64 %51, 1
  br i1 %52, label %56, label %53

53:                                               ; preds = %50
  %54 = load i64, ptr %14, align 8, !tbaa !9
  %55 = icmp ugt i64 %54, 64
  br i1 %55, label %56, label %62

56:                                               ; preds = %53, %50
  br label %57

57:                                               ; preds = %56
  %58 = load ptr, ptr @stderr, align 8, !tbaa !5
  %59 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %58, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 133, ptr noundef @__FUNCTION__.sm4_gcm_encrypt_init) #6
  br label %60

60:                                               ; preds = %57
  br label %61

61:                                               ; preds = %60
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %20, align 4
  br label %132

62:                                               ; preds = %53
  %63 = load i64, ptr %17, align 8, !tbaa !9
  %64 = icmp ult i64 %63, 12
  br i1 %64, label %68, label %65

65:                                               ; preds = %62
  %66 = load i64, ptr %17, align 8, !tbaa !9
  %67 = icmp ugt i64 %66, 16
  br i1 %67, label %68, label %74

68:                                               ; preds = %65, %62
  br label %69

69:                                               ; preds = %68
  %70 = load ptr, ptr @stderr, align 8, !tbaa !5
  %71 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %70, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 137, ptr noundef @__FUNCTION__.sm4_gcm_encrypt_init) #6
  br label %72

72:                                               ; preds = %69
  br label %73

73:                                               ; preds = %72
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %20, align 4
  br label %132

74:                                               ; preds = %65
  %75 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %75, i8 0, i64 296, i1 false)
  %76 = load i64, ptr %17, align 8, !tbaa !9
  %77 = load ptr, ptr %10, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.SM4_GCM_CTX, ptr %77, i32 0, i32 3
  store i64 %76, ptr %78, align 8, !tbaa !11
  %79 = load ptr, ptr %10, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.SM4_GCM_CTX, ptr %79, i32 0, i32 0
  %81 = load ptr, ptr %11, align 8, !tbaa !5
  %82 = getelementptr inbounds [16 x i8], ptr %18, i64 0, i64 0
  %83 = call i32 @sm4_ctr32_encrypt_init(ptr noundef %80, ptr noundef %81, ptr noundef %82)
  %84 = icmp ne i32 %83, 1
  br i1 %84, label %85, label %91

85:                                               ; preds = %74
  br label %86

86:                                               ; preds = %85
  %87 = load ptr, ptr @stderr, align 8, !tbaa !5
  %88 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %87, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 145, ptr noundef @__FUNCTION__.sm4_gcm_encrypt_init) #6
  br label %89

89:                                               ; preds = %86
  br label %90

90:                                               ; preds = %89
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %20, align 4
  br label %132

91:                                               ; preds = %74
  %92 = load ptr, ptr %10, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.SM4_GCM_CTX, ptr %92, i32 0, i32 0
  %94 = getelementptr inbounds %struct.SM4_CTR_CTX, ptr %93, i32 0, i32 0
  %95 = getelementptr inbounds [16 x i8], ptr %18, i64 0, i64 0
  %96 = getelementptr inbounds [16 x i8], ptr %18, i64 0, i64 0
  call void @sm4_encrypt(ptr noundef %94, ptr noundef %95, ptr noundef %96)
  %97 = load ptr, ptr %10, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.SM4_GCM_CTX, ptr %97, i32 0, i32 1
  %99 = getelementptr inbounds [16 x i8], ptr %18, i64 0, i64 0
  %100 = load ptr, ptr %15, align 8, !tbaa !5
  %101 = load i64, ptr %16, align 8, !tbaa !9
  call void @ghash_init(ptr noundef %98, ptr noundef %99, ptr noundef %100, i64 noundef %101)
  %102 = load i64, ptr %14, align 8, !tbaa !9
  %103 = icmp eq i64 %102, 12
  br i1 %103, label %104, label %111

104:                                              ; preds = %91
  %105 = getelementptr inbounds [16 x i8], ptr %19, i64 0, i64 0
  %106 = load ptr, ptr %13, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %105, ptr align 1 %106, i64 12, i1 false)
  %107 = getelementptr inbounds [16 x i8], ptr %19, i64 0, i64 14
  store i8 0, ptr %107, align 2, !tbaa !16
  %108 = getelementptr inbounds [16 x i8], ptr %19, i64 0, i64 13
  store i8 0, ptr %108, align 1, !tbaa !16
  %109 = getelementptr inbounds [16 x i8], ptr %19, i64 0, i64 12
  store i8 0, ptr %109, align 4, !tbaa !16
  %110 = getelementptr inbounds [16 x i8], ptr %19, i64 0, i64 15
  store i8 1, ptr %110, align 1, !tbaa !16
  br label %116

111:                                              ; preds = %91
  %112 = getelementptr inbounds [16 x i8], ptr %18, i64 0, i64 0
  %113 = load ptr, ptr %13, align 8, !tbaa !5
  %114 = load i64, ptr %14, align 8, !tbaa !9
  %115 = getelementptr inbounds [16 x i8], ptr %19, i64 0, i64 0
  call void @ghash(ptr noundef %112, ptr noundef null, i64 noundef 0, ptr noundef %113, i64 noundef %114, ptr noundef %115)
  br label %116

116:                                              ; preds = %111, %104
  %117 = load ptr, ptr %10, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.SM4_GCM_CTX, ptr %117, i32 0, i32 0
  %119 = getelementptr inbounds %struct.SM4_CTR_CTX, ptr %118, i32 0, i32 0
  %120 = getelementptr inbounds [16 x i8], ptr %19, i64 0, i64 0
  %121 = load ptr, ptr %10, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.SM4_GCM_CTX, ptr %121, i32 0, i32 2
  %123 = getelementptr inbounds [16 x i8], ptr %122, i64 0, i64 0
  call void @sm4_encrypt(ptr noundef %119, ptr noundef %120, ptr noundef %123)
  %124 = getelementptr inbounds [16 x i8], ptr %19, i64 0, i64 0
  call void @ctr32_incr(ptr noundef %124)
  %125 = load ptr, ptr %10, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.SM4_GCM_CTX, ptr %125, i32 0, i32 0
  %127 = getelementptr inbounds %struct.SM4_CTR_CTX, ptr %126, i32 0, i32 1
  %128 = getelementptr inbounds [16 x i8], ptr %127, i64 0, i64 0
  %129 = getelementptr inbounds [16 x i8], ptr %19, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %128, ptr align 16 %129, i64 16, i1 false)
  %130 = getelementptr inbounds [16 x i8], ptr %18, i64 0, i64 0
  call void @gmssl_secure_clear(ptr noundef %130, i64 noundef 16)
  %131 = getelementptr inbounds [16 x i8], ptr %19, i64 0, i64 0
  call void @gmssl_secure_clear(ptr noundef %131, i64 noundef 16)
  store i32 1, ptr %9, align 4
  store i32 1, ptr %20, align 4
  br label %132

132:                                              ; preds = %116, %90, %73, %61, %49, %40
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #6
  %133 = load i32, ptr %9, align 4
  ret i32 %133
}

declare i32 @sm4_ctr32_encrypt_init(ptr noundef, ptr noundef, ptr noundef) #3

declare void @ghash_init(ptr noundef, ptr noundef, ptr noundef, i64 noundef) #3

declare void @gmssl_secure_clear(ptr noundef, i64 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "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: readwrite) }
attributes #5 = { 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 #6 = { 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, !10, i64 256}
!12 = !{!"", !13, i64 0, !15, i64 168, !7, i64 240, !10, i64 256, !7, i64 264, !10, i64 280, !10, i64 288}
!13 = !{!"", !14, i64 0, !7, i64 128, !7, i64 144, !10, i64 160}
!14 = !{!"", !7, i64 0}
!15 = !{!"", !7, i64 0, !7, i64 16, !10, i64 32, !10, i64 40, !7, i64 48, !10, i64 64}
!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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [61 x i8], align 1
@__FUNCTION__.sm4_gcm_encrypt_init = external hidden unnamed_addr constant [21 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

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

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

declare void @sm4_encrypt(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

declare void @ghash(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @ctr32_incr(ptr noundef) local_unnamed_addr #5

; 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 range(i32 -1, 2) i32 @sm4_gcm_encrypt_init(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, i64 noundef %4, ptr noundef %5, i64 noundef %6, i64 noundef %7) local_unnamed_addr #5 {
  %9 = alloca [16 x i8], align 16
  %10 = alloca [16 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %9, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #6
  %11 = icmp ne ptr %0, null
  %12 = icmp ne ptr %1, null
  %or.cond = and i1 %11, %12
  %13 = icmp ne ptr %3, null
  %or.cond3 = and i1 %or.cond, %13
  br i1 %or.cond3, label %14, label %17

14:                                               ; preds = %8
  %15 = icmp eq ptr %5, null
  %16 = icmp ne i64 %6, 0
  %or.cond5 = and i1 %15, %16
  br i1 %or.cond5, label %17, label %20

17:                                               ; preds = %8, %14
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 125, ptr noundef nonnull @__FUNCTION__.sm4_gcm_encrypt_init) #7
  br label %49

20:                                               ; preds = %14
  %.not = icmp eq i64 %2, 16
  br i1 %.not, label %24, label %21

21:                                               ; preds = %20
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 129, ptr noundef nonnull @__FUNCTION__.sm4_gcm_encrypt_init) #7
  br label %49

24:                                               ; preds = %20
  %25 = add i64 %4, -65
  %or.cond7 = icmp ult i64 %25, -64
  br i1 %or.cond7, label %26, label %29

26:                                               ; preds = %24
  %27 = load ptr, ptr @stderr, align 8, !tbaa !5
  %28 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 133, ptr noundef nonnull @__FUNCTION__.sm4_gcm_encrypt_init) #7
  br label %49

29:                                               ; preds = %24
  %30 = add i64 %7, -17
  %or.cond9 = icmp ult i64 %30, -5
  br i1 %or.cond9, label %31, label %34

31:                                               ; preds = %29
  %32 = load ptr, ptr @stderr, align 8, !tbaa !5
  %33 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 137, ptr noundef nonnull @__FUNCTION__.sm4_gcm_encrypt_init) #7
  br label %49

34:                                               ; preds = %29
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(296) %0, i8 0, i64 296, i1 false)
  %35 = getelementptr inbounds i8, ptr %0, i64 256
  store i64 %7, ptr %35, align 8, !tbaa !9
  %36 = call i32 @sm4_ctr32_encrypt_init(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %9) #6
  %.not40 = icmp eq i32 %36, 1
  br i1 %.not40, label %40, label %37

37:                                               ; preds = %34
  %38 = load ptr, ptr @stderr, align 8, !tbaa !5
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 145, ptr noundef nonnull @__FUNCTION__.sm4_gcm_encrypt_init) #7
  br label %49

40:                                               ; preds = %34
  call void @sm4_encrypt(ptr noundef nonnull %0, ptr noundef nonnull %9, ptr noundef nonnull %9) #6
  %41 = getelementptr inbounds i8, ptr %0, i64 168
  call void @ghash_init(ptr noundef nonnull %41, ptr noundef nonnull %9, ptr noundef %5, i64 noundef %6) #6
  %42 = icmp eq i64 %4, 12
  br i1 %42, label %43, label %45

43:                                               ; preds = %40
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) %10, ptr noundef nonnull align 1 dereferenceable(12) %3, i64 12, i1 false)
  %44 = getelementptr inbounds i8, ptr %10, i64 12
  store <4 x i8> <i8 0, i8 0, i8 0, i8 1>, ptr %44, align 4, !tbaa !15
  br label %46

45:                                               ; preds = %40
  call void @ghash(ptr noundef nonnull %9, ptr noundef null, i64 noundef 0, ptr noundef nonnull %3, i64 noundef %4, ptr noundef nonnull %10) #6
  br label %46

46:                                               ; preds = %45, %43
  %47 = getelementptr inbounds i8, ptr %0, i64 240
  call void @sm4_encrypt(ptr noundef nonnull %0, ptr noundef nonnull %10, ptr noundef nonnull %47) #6
  call void @ctr32_incr(ptr noundef nonnull %10)
  %48 = getelementptr inbounds i8, ptr %0, i64 128
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %48, ptr noundef nonnull align 16 dereferenceable(16) %10, i64 16, i1 false)
  call void @gmssl_secure_clear(ptr noundef nonnull %9, i64 noundef 16) #6
  call void @gmssl_secure_clear(ptr noundef nonnull %10, i64 noundef 16) #6
  br label %49

49:                                               ; preds = %46, %37, %31, %26, %21, %17
  %.0 = phi i32 [ -1, %17 ], [ -1, %21 ], [ -1, %26 ], [ -1, %31 ], [ -1, %37 ], [ 1, %46 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #6
  ret i32 %.0
}

declare i32 @sm4_ctr32_encrypt_init(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @ghash_init(ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

declare void @gmssl_secure_clear(ptr noundef, i64 noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { nounwind }
attributes #7 = { cold 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, !13, i64 256}
!10 = !{!"", !11, i64 0, !14, i64 168, !7, i64 240, !13, i64 256, !7, i64 264, !13, i64 280, !13, i64 288}
!11 = !{!"", !12, i64 0, !7, i64 128, !7, i64 144, !13, i64 160}
!12 = !{!"", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"", !7, i64 0, !7, i64 16, !13, i64 32, !13, i64 40, !7, i64 48, !13, i64 64}
!15 = !{!7, !7, i64 0}


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