; LLVM IR from guanzhi/GmSSL :: src (sm4_cbc_sm3_hmac)

; 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_CBC_SM3_HMAC_CTX = type { %struct.SM4_CBC_CTX, %struct.SM3_HMAC_CTX, [32 x i8], i64 }
%struct.SM4_CBC_CTX = type { %struct.SM4_KEY, [16 x i8], [16 x i8], i64 }
%struct.SM4_KEY = type { [32 x i32] }
%struct.SM3_HMAC_CTX = type { %struct.SM3_CTX, [64 x i8] }
%struct.SM3_CTX = type { [8 x i32], i64, [64 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 [70 x i8], align 1
@__FUNCTION__.sm4_cbc_sm3_hmac_decrypt_update = external hidden unnamed_addr constant [32 x i8], align 1

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

declare void @sm3_hmac_update(ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @sm4_cbc_sm3_hmac_decrypt_update(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4) #2 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca [32 x i8], align 16
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i64 %2, ptr %9, align 8, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %26

17:                                               ; preds = %5
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %26

20:                                               ; preds = %17
  %21 = load ptr, ptr %10, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %26

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

26:                                               ; preds = %23, %20, %17, %5
  br label %27

27:                                               ; preds = %26
  %28 = load ptr, ptr @stderr, align 8, !tbaa !5
  %29 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 94, ptr noundef @__FUNCTION__.sm4_cbc_sm3_hmac_decrypt_update) #5
  br label %30

30:                                               ; preds = %27
  br label %31

31:                                               ; preds = %30
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %198

32:                                               ; preds = %23
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %33, i32 0, i32 3
  %35 = load i64, ptr %34, align 8, !tbaa !11
  %36 = icmp ugt i64 %35, 32
  br i1 %36, label %37, label %43

37:                                               ; preds = %32
  br label %38

38:                                               ; preds = %37
  %39 = load ptr, ptr @stderr, align 8, !tbaa !5
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 98, ptr noundef @__FUNCTION__.sm4_cbc_sm3_hmac_decrypt_update) #5
  br label %41

41:                                               ; preds = %38
  br label %42

42:                                               ; preds = %41
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %198

43:                                               ; preds = %32
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %44, i32 0, i32 3
  %46 = load i64, ptr %45, align 8, !tbaa !11
  %47 = icmp ult i64 %46, 32
  br i1 %47, label %48, label %93

48:                                               ; preds = %43
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %49, i32 0, i32 3
  %51 = load i64, ptr %50, align 8, !tbaa !11
  %52 = sub i64 32, %51
  store i64 %52, ptr %12, align 8, !tbaa !9
  %53 = load i64, ptr %9, align 8, !tbaa !9
  %54 = load i64, ptr %12, align 8, !tbaa !9
  %55 = icmp ule i64 %53, %54
  br i1 %55, label %56, label %71

56:                                               ; preds = %48
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %57, i32 0, i32 2
  %59 = getelementptr inbounds [32 x i8], ptr %58, i64 0, i64 0
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %60, i32 0, i32 3
  %62 = load i64, ptr %61, align 8, !tbaa !11
  %63 = getelementptr inbounds i8, ptr %59, i64 %62
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = load i64, ptr %9, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %63, ptr align 1 %64, i64 %65, i1 false)
  %66 = load i64, ptr %9, align 8, !tbaa !9
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %67, i32 0, i32 3
  %69 = load i64, ptr %68, align 8, !tbaa !11
  %70 = add i64 %69, %66
  store i64 %70, ptr %68, align 8, !tbaa !11
  store i32 1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %198

71:                                               ; preds = %48
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %72, i32 0, i32 2
  %74 = getelementptr inbounds [32 x i8], ptr %73, i64 0, i64 0
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %75, i32 0, i32 3
  %77 = load i64, ptr %76, align 8, !tbaa !11
  %78 = getelementptr inbounds i8, ptr %74, i64 %77
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  %80 = load i64, ptr %12, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %78, ptr align 1 %79, i64 %80, i1 false)
  %81 = load i64, ptr %12, align 8, !tbaa !9
  %82 = load ptr, ptr %7, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %82, i32 0, i32 3
  %84 = load i64, ptr %83, align 8, !tbaa !11
  %85 = add i64 %84, %81
  store i64 %85, ptr %83, align 8, !tbaa !11
  %86 = load i64, ptr %12, align 8, !tbaa !9
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  %88 = getelementptr inbounds i8, ptr %87, i64 %86
  store ptr %88, ptr %8, align 8, !tbaa !5
  %89 = load i64, ptr %12, align 8, !tbaa !9
  %90 = load i64, ptr %9, align 8, !tbaa !9
  %91 = sub i64 %90, %89
  store i64 %91, ptr %9, align 8, !tbaa !9
  br label %92

92:                                               ; preds = %71
  br label %93

93:                                               ; preds = %92, %43
  %94 = load i64, ptr %9, align 8, !tbaa !9
  %95 = icmp ule i64 %94, 32
  br i1 %95, label %96, label %141

96:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #5
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %97, i32 0, i32 1
  %99 = load ptr, ptr %7, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %99, i32 0, i32 2
  %101 = getelementptr inbounds [32 x i8], ptr %100, i64 0, i64 0
  %102 = load i64, ptr %9, align 8, !tbaa !9
  call void @sm3_hmac_update(ptr noundef %98, ptr noundef %101, i64 noundef %102)
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %103, i32 0, i32 0
  %105 = load ptr, ptr %7, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %105, i32 0, i32 2
  %107 = getelementptr inbounds [32 x i8], ptr %106, i64 0, i64 0
  %108 = load i64, ptr %9, align 8, !tbaa !9
  %109 = load ptr, ptr %10, align 8, !tbaa !5
  %110 = load ptr, ptr %11, align 8, !tbaa !5
  %111 = call i32 @sm4_cbc_decrypt_update(ptr noundef %104, ptr noundef %107, i64 noundef %108, ptr noundef %109, ptr noundef %110)
  %112 = icmp ne i32 %111, 1
  br i1 %112, label %113, label %119

113:                                              ; preds = %96
  br label %114

114:                                              ; preds = %113
  %115 = load ptr, ptr @stderr, align 8, !tbaa !5
  %116 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %115, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 120, ptr noundef @__FUNCTION__.sm4_cbc_sm3_hmac_decrypt_update) #5
  br label %117

117:                                              ; preds = %114
  br label %118

118:                                              ; preds = %117
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %138

119:                                              ; preds = %96
  %120 = load i64, ptr %9, align 8, !tbaa !9
  %121 = sub i64 32, %120
  store i64 %121, ptr %12, align 8, !tbaa !9
  %122 = getelementptr inbounds [32 x i8], ptr %14, i64 0, i64 0
  %123 = load ptr, ptr %7, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %123, i32 0, i32 2
  %125 = getelementptr inbounds [32 x i8], ptr %124, i64 0, i64 0
  %126 = load i64, ptr %9, align 8, !tbaa !9
  %127 = getelementptr inbounds i8, ptr %125, i64 %126
  %128 = load i64, ptr %12, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %122, ptr align 1 %127, i64 %128, i1 false)
  %129 = getelementptr inbounds [32 x i8], ptr %14, i64 0, i64 0
  %130 = load i64, ptr %12, align 8, !tbaa !9
  %131 = getelementptr inbounds i8, ptr %129, i64 %130
  %132 = load ptr, ptr %8, align 8, !tbaa !5
  %133 = load i64, ptr %9, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %131, ptr align 1 %132, i64 %133, i1 false)
  %134 = load ptr, ptr %7, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %134, i32 0, i32 2
  %136 = getelementptr inbounds [32 x i8], ptr %135, i64 0, i64 0
  %137 = getelementptr inbounds [32 x i8], ptr %14, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %136, ptr align 16 %137, i64 32, i1 false)
  store i32 0, ptr %13, align 4
  br label %138

138:                                              ; preds = %119, %118
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #5
  %139 = load i32, ptr %13, align 4
  switch i32 %139, label %198 [
    i32 0, label %140
  ]

140:                                              ; preds = %138
  br label %197

141:                                              ; preds = %93
  %142 = load ptr, ptr %7, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %142, i32 0, i32 1
  %144 = load ptr, ptr %7, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %144, i32 0, i32 2
  %146 = getelementptr inbounds [32 x i8], ptr %145, i64 0, i64 0
  call void @sm3_hmac_update(ptr noundef %143, ptr noundef %146, i64 noundef 32)
  %147 = load ptr, ptr %7, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %147, i32 0, i32 0
  %149 = load ptr, ptr %7, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %149, i32 0, i32 2
  %151 = getelementptr inbounds [32 x i8], ptr %150, i64 0, i64 0
  %152 = load ptr, ptr %10, align 8, !tbaa !5
  %153 = load ptr, ptr %11, align 8, !tbaa !5
  %154 = call i32 @sm4_cbc_decrypt_update(ptr noundef %148, ptr noundef %151, i64 noundef 32, ptr noundef %152, ptr noundef %153)
  %155 = icmp ne i32 %154, 1
  br i1 %155, label %156, label %162

156:                                              ; preds = %141
  br label %157

157:                                              ; preds = %156
  %158 = load ptr, ptr @stderr, align 8, !tbaa !5
  %159 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %158, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 130, ptr noundef @__FUNCTION__.sm4_cbc_sm3_hmac_decrypt_update) #5
  br label %160

160:                                              ; preds = %157
  br label %161

161:                                              ; preds = %160
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %198

162:                                              ; preds = %141
  %163 = load ptr, ptr %11, align 8, !tbaa !5
  %164 = load i64, ptr %163, align 8, !tbaa !9
  %165 = load ptr, ptr %10, align 8, !tbaa !5
  %166 = getelementptr inbounds i8, ptr %165, i64 %164
  store ptr %166, ptr %10, align 8, !tbaa !5
  %167 = load i64, ptr %9, align 8, !tbaa !9
  %168 = sub i64 %167, 32
  store i64 %168, ptr %9, align 8, !tbaa !9
  %169 = load ptr, ptr %7, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %169, i32 0, i32 1
  %171 = load ptr, ptr %8, align 8, !tbaa !5
  %172 = load i64, ptr %9, align 8, !tbaa !9
  call void @sm3_hmac_update(ptr noundef %170, ptr noundef %171, i64 noundef %172)
  %173 = load ptr, ptr %7, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %173, i32 0, i32 0
  %175 = load ptr, ptr %8, align 8, !tbaa !5
  %176 = load i64, ptr %9, align 8, !tbaa !9
  %177 = load ptr, ptr %10, align 8, !tbaa !5
  %178 = call i32 @sm4_cbc_decrypt_update(ptr noundef %174, ptr noundef %175, i64 noundef %176, ptr noundef %177, ptr noundef %12)
  %179 = icmp ne i32 %178, 1
  br i1 %179, label %180, label %186

180:                                              ; preds = %162
  br label %181

181:                                              ; preds = %180
  %182 = load ptr, ptr @stderr, align 8, !tbaa !5
  %183 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %182, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 138, ptr noundef @__FUNCTION__.sm4_cbc_sm3_hmac_decrypt_update) #5
  br label %184

184:                                              ; preds = %181
  br label %185

185:                                              ; preds = %184
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %198

186:                                              ; preds = %162
  %187 = load i64, ptr %12, align 8, !tbaa !9
  %188 = load ptr, ptr %11, align 8, !tbaa !5
  %189 = load i64, ptr %188, align 8, !tbaa !9
  %190 = add i64 %189, %187
  store i64 %190, ptr %188, align 8, !tbaa !9
  %191 = load ptr, ptr %7, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.SM4_CBC_SM3_HMAC_CTX, ptr %191, i32 0, i32 2
  %193 = getelementptr inbounds [32 x i8], ptr %192, i64 0, i64 0
  %194 = load ptr, ptr %8, align 8, !tbaa !5
  %195 = load i64, ptr %9, align 8, !tbaa !9
  %196 = getelementptr inbounds i8, ptr %194, i64 %195
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %193, ptr align 1 %196, i64 32, i1 false)
  br label %197

197:                                              ; preds = %186, %140
  store i32 1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %198

198:                                              ; preds = %197, %185, %161, %138, %56, %42, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  %199 = load i32, ptr %6, align 4
  ret i32 %199
}

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

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

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 376}
!12 = !{!"", !13, i64 0, !15, i64 168, !7, i64 344, !10, i64 376}
!13 = !{!"", !14, i64 0, !7, i64 128, !7, i64 144, !10, i64 160}
!14 = !{!"", !7, i64 0}
!15 = !{!"", !16, i64 0, !7, i64 112}
!16 = !{!"", !7, i64 0, !10, i64 32, !7, i64 40, !10, i64 104}


; 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 [70 x i8], align 1
@__FUNCTION__.sm4_cbc_sm3_hmac_decrypt_update = external hidden unnamed_addr constant [32 x i8], align 1

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

declare void @sm3_hmac_update(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 2) i32 @sm4_cbc_sm3_hmac_decrypt_update(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #2 {
  %6 = alloca i64, align 8
  %7 = alloca [32 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %8 = insertelement <4 x ptr> poison, ptr %0, i64 0
  %9 = insertelement <4 x ptr> %8, ptr %1, i64 1
  %10 = insertelement <4 x ptr> %9, ptr %3, i64 2
  %11 = insertelement <4 x ptr> %10, ptr %4, i64 3
  %12 = icmp eq <4 x ptr> %11, zeroinitializer
  %13 = bitcast <4 x i1> %12 to i4
  %14 = icmp eq i4 %13, 0
  br i1 %14, label %18, label %15

15:                                               ; preds = %5
  %16 = load ptr, ptr @stderr, align 8, !tbaa !5
  %17 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 94, ptr noundef nonnull @__FUNCTION__.sm4_cbc_sm3_hmac_decrypt_update) #6
  br label %70

18:                                               ; preds = %5
  %19 = getelementptr inbounds i8, ptr %0, i64 376
  %20 = load i64, ptr %19, align 8, !tbaa !9
  %21 = icmp ugt i64 %20, 32
  br i1 %21, label %22, label %25

22:                                               ; preds = %18
  %23 = load ptr, ptr @stderr, align 8, !tbaa !5
  %24 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 98, ptr noundef nonnull @__FUNCTION__.sm4_cbc_sm3_hmac_decrypt_update) #6
  br label %70

25:                                               ; preds = %18
  %.not = icmp eq i64 %20, 32
  br i1 %.not, label %38, label %26

26:                                               ; preds = %25
  %27 = sub nuw nsw i64 32, %20
  store i64 %27, ptr %6, align 8, !tbaa !16
  %.not72 = icmp ult i64 %27, %2
  %28 = getelementptr inbounds i8, ptr %0, i64 344
  %29 = getelementptr inbounds i8, ptr %28, i64 %20
  br i1 %.not72, label %33, label %30

30:                                               ; preds = %26
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %29, ptr nonnull align 1 %1, i64 %2, i1 false)
  %31 = load i64, ptr %19, align 8, !tbaa !9
  %32 = add i64 %31, %2
  store i64 %32, ptr %19, align 8, !tbaa !9
  br label %70

33:                                               ; preds = %26
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %29, ptr nonnull align 1 %1, i64 %27, i1 false)
  %34 = load i64, ptr %19, align 8, !tbaa !9
  %35 = add i64 %34, %27
  store i64 %35, ptr %19, align 8, !tbaa !9
  %36 = getelementptr inbounds i8, ptr %1, i64 %27
  %37 = sub i64 %2, %27
  br label %38

38:                                               ; preds = %33, %25
  %.063 = phi ptr [ %36, %33 ], [ %1, %25 ]
  %.062 = phi i64 [ %37, %33 ], [ %2, %25 ]
  %39 = icmp ult i64 %.062, 33
  br i1 %39, label %40, label %50

40:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #5
  %41 = getelementptr inbounds i8, ptr %0, i64 168
  %42 = getelementptr inbounds i8, ptr %0, i64 344
  tail call void @sm3_hmac_update(ptr noundef nonnull %41, ptr noundef nonnull %42, i64 noundef %.062) #5
  %43 = tail call i32 @sm4_cbc_decrypt_update(ptr noundef nonnull %0, ptr noundef nonnull %42, i64 noundef %.062, ptr noundef nonnull %3, ptr noundef nonnull %4) #5
  %.not75 = icmp eq i32 %43, 1
  br i1 %.not75, label %.thread, label %47

.thread:                                          ; preds = %40
  %44 = sub nuw nsw i64 32, %.062
  %45 = getelementptr inbounds i8, ptr %42, i64 %.062
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %7, ptr nonnull align 1 %45, i64 %44, i1 false)
  %46 = getelementptr inbounds i8, ptr %7, i64 %44
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %46, ptr align 1 %.063, i64 %.062, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %42, ptr noundef nonnull align 16 dereferenceable(32) %7, i64 32, i1 false)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #5
  br label %70

47:                                               ; preds = %40
  %48 = load ptr, ptr @stderr, align 8, !tbaa !5
  %49 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 120, ptr noundef nonnull @__FUNCTION__.sm4_cbc_sm3_hmac_decrypt_update) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #5
  br label %70

50:                                               ; preds = %38
  %51 = getelementptr inbounds i8, ptr %0, i64 168
  %52 = getelementptr inbounds i8, ptr %0, i64 344
  tail call void @sm3_hmac_update(ptr noundef nonnull %51, ptr noundef nonnull %52, i64 noundef 32) #5
  %53 = tail call i32 @sm4_cbc_decrypt_update(ptr noundef nonnull %0, ptr noundef nonnull %52, i64 noundef 32, ptr noundef nonnull %3, ptr noundef nonnull %4) #5
  %.not73 = icmp eq i32 %53, 1
  br i1 %.not73, label %57, label %54

54:                                               ; preds = %50
  %55 = load ptr, ptr @stderr, align 8, !tbaa !5
  %56 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 130, ptr noundef nonnull @__FUNCTION__.sm4_cbc_sm3_hmac_decrypt_update) #6
  br label %70

57:                                               ; preds = %50
  %58 = load i64, ptr %4, align 8, !tbaa !16
  %59 = getelementptr inbounds i8, ptr %3, i64 %58
  %60 = add i64 %.062, -32
  tail call void @sm3_hmac_update(ptr noundef nonnull %51, ptr noundef %.063, i64 noundef %60) #5
  %61 = call i32 @sm4_cbc_decrypt_update(ptr noundef nonnull %0, ptr noundef %.063, i64 noundef %60, ptr noundef nonnull %59, ptr noundef nonnull %6) #5
  %.not74 = icmp eq i32 %61, 1
  br i1 %.not74, label %65, label %62

62:                                               ; preds = %57
  %63 = load ptr, ptr @stderr, align 8, !tbaa !5
  %64 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %63, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 138, ptr noundef nonnull @__FUNCTION__.sm4_cbc_sm3_hmac_decrypt_update) #6
  br label %70

65:                                               ; preds = %57
  %66 = load i64, ptr %6, align 8, !tbaa !16
  %67 = load i64, ptr %4, align 8, !tbaa !16
  %68 = add i64 %67, %66
  store i64 %68, ptr %4, align 8, !tbaa !16
  %69 = getelementptr inbounds i8, ptr %.063, i64 %60
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %52, ptr noundef nonnull align 1 dereferenceable(32) %69, i64 32, i1 false)
  br label %70

70:                                               ; preds = %65, %.thread, %47, %62, %54, %30, %22, %15
  %.1 = phi i32 [ -1, %22 ], [ 1, %30 ], [ -1, %47 ], [ -1, %54 ], [ -1, %62 ], [ -1, %15 ], [ 1, %.thread ], [ 1, %65 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  ret i32 %.1
}

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

attributes #0 = { 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 #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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
attributes #6 = { 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 376}
!10 = !{!"", !11, i64 0, !14, i64 168, !7, i64 344, !13, i64 376}
!11 = !{!"", !12, i64 0, !7, i64 128, !7, i64 144, !13, i64 160}
!12 = !{!"", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"", !15, i64 0, !7, i64 112}
!15 = !{!"", !7, i64 0, !13, i64 32, !7, i64 40, !13, i64 104}
!16 = !{!13, !13, i64 0}


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