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

; 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.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 [57 x i8], align 1
@__FUNCTION__.tls_cbc_decrypt = external hidden unnamed_addr constant [16 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [34 x i8], align 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) #0

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @tls_cbc_decrypt(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, i64 noundef %5, ptr noundef %6, ptr noundef %7) #4 {
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca %struct.SM3_HMAC_CTX, align 8
  %19 = alloca [16 x i8], align 16
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca [5 x i8], align 1
  %23 = alloca i32, align 4
  %24 = alloca [32 x i8], align 16
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store ptr %2, ptr %12, align 8, !tbaa !5
  store ptr %3, ptr %13, align 8, !tbaa !5
  store ptr %4, ptr %14, align 8, !tbaa !5
  store i64 %5, ptr %15, align 8, !tbaa !9
  store ptr %6, ptr %16, align 8, !tbaa !5
  store ptr %7, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 176, ptr %18) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.start.p0(i64 5, ptr %22) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr %24) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  %27 = load ptr, ptr %10, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %50

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

32:                                               ; preds = %29
  %33 = load ptr, ptr %12, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %35, label %50

35:                                               ; preds = %32
  %36 = load ptr, ptr %13, align 8, !tbaa !5
  %37 = icmp ne ptr %36, null
  br i1 %37, label %38, label %50

38:                                               ; preds = %35
  %39 = load ptr, ptr %14, align 8, !tbaa !5
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %50

41:                                               ; preds = %38
  %42 = load i64, ptr %15, align 8, !tbaa !9
  %43 = icmp ne i64 %42, 0
  br i1 %43, label %44, label %50

44:                                               ; preds = %41
  %45 = load ptr, ptr %16, align 8, !tbaa !5
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %50

47:                                               ; preds = %44
  %48 = load ptr, ptr %17, align 8, !tbaa !5
  %49 = icmp ne ptr %48, null
  br i1 %49, label %56, label %50

50:                                               ; preds = %47, %44, %41, %38, %35, %32, %29, %8
  br label %51

51:                                               ; preds = %50
  %52 = load ptr, ptr @stderr, align 8, !tbaa !5
  %53 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %52, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 338, ptr noundef @__FUNCTION__.tls_cbc_decrypt) #5
  br label %54

54:                                               ; preds = %51
  br label %55

55:                                               ; preds = %54
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %26, align 4
  br label %183

56:                                               ; preds = %47
  %57 = load i64, ptr %15, align 8, !tbaa !9
  %58 = urem i64 %57, 16
  %59 = icmp ne i64 %58, 0
  br i1 %59, label %66, label %60

60:                                               ; preds = %56
  %61 = load i64, ptr %15, align 8, !tbaa !9
  %62 = icmp ult i64 %61, 64
  br i1 %62, label %66, label %63

63:                                               ; preds = %60
  %64 = load i64, ptr %15, align 8, !tbaa !9
  %65 = icmp ugt i64 %64, 16688
  br i1 %65, label %66, label %73

66:                                               ; preds = %63, %60, %56
  br label %67

67:                                               ; preds = %66
  %68 = load ptr, ptr @stderr, align 8, !tbaa !5
  %69 = load i64, ptr %15, align 8, !tbaa !9
  %70 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 344, ptr noundef @__FUNCTION__.tls_cbc_decrypt, i64 noundef %69) #5
  br label %71

71:                                               ; preds = %67
  br label %72

72:                                               ; preds = %71
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %26, align 4
  br label %183

73:                                               ; preds = %63
  %74 = getelementptr inbounds [16 x i8], ptr %19, i64 0, i64 0
  %75 = load ptr, ptr %14, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %74, ptr align 1 %75, i64 16, i1 false)
  %76 = load ptr, ptr %14, align 8, !tbaa !5
  %77 = getelementptr inbounds i8, ptr %76, i64 16
  store ptr %77, ptr %14, align 8, !tbaa !5
  %78 = load i64, ptr %15, align 8, !tbaa !9
  %79 = sub i64 %78, 16
  store i64 %79, ptr %15, align 8, !tbaa !9
  %80 = load ptr, ptr %11, align 8, !tbaa !5
  %81 = getelementptr inbounds [16 x i8], ptr %19, i64 0, i64 0
  %82 = load ptr, ptr %14, align 8, !tbaa !5
  %83 = load i64, ptr %15, align 8, !tbaa !9
  %84 = udiv i64 %83, 16
  %85 = load ptr, ptr %16, align 8, !tbaa !5
  call void @sm4_cbc_decrypt_blocks(ptr noundef %80, ptr noundef %81, ptr noundef %82, i64 noundef %84, ptr noundef %85)
  %86 = load ptr, ptr %16, align 8, !tbaa !5
  %87 = load i64, ptr %15, align 8, !tbaa !9
  %88 = sub i64 %87, 1
  %89 = getelementptr inbounds i8, ptr %86, i64 %88
  %90 = load i8, ptr %89, align 1, !tbaa !11
  %91 = zext i8 %90 to i32
  store i32 %91, ptr %23, align 4, !tbaa !12
  %92 = load ptr, ptr %16, align 8, !tbaa !5
  %93 = load i64, ptr %15, align 8, !tbaa !9
  %94 = getelementptr inbounds i8, ptr %92, i64 %93
  %95 = load i32, ptr %23, align 4, !tbaa !12
  %96 = sext i32 %95 to i64
  %97 = sub i64 0, %96
  %98 = getelementptr inbounds i8, ptr %94, i64 %97
  %99 = getelementptr inbounds i8, ptr %98, i64 -1
  store ptr %99, ptr %20, align 8, !tbaa !5
  %100 = load ptr, ptr %20, align 8, !tbaa !5
  %101 = load ptr, ptr %16, align 8, !tbaa !5
  %102 = getelementptr inbounds i8, ptr %101, i64 32
  %103 = icmp ult ptr %100, %102
  br i1 %103, label %104, label %110

104:                                              ; preds = %73
  br label %105

105:                                              ; preds = %104
  %106 = load ptr, ptr @stderr, align 8, !tbaa !5
  %107 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %106, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 357, ptr noundef @__FUNCTION__.tls_cbc_decrypt) #5
  br label %108

108:                                              ; preds = %105
  br label %109

109:                                              ; preds = %108
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %26, align 4
  br label %183

110:                                              ; preds = %73
  store i32 0, ptr %25, align 4, !tbaa !12
  br label %111

111:                                              ; preds = %131, %110
  %112 = load i32, ptr %25, align 4, !tbaa !12
  %113 = load i32, ptr %23, align 4, !tbaa !12
  %114 = icmp slt i32 %112, %113
  br i1 %114, label %115, label %134

115:                                              ; preds = %111
  %116 = load ptr, ptr %20, align 8, !tbaa !5
  %117 = load i32, ptr %25, align 4, !tbaa !12
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds i8, ptr %116, i64 %118
  %120 = load i8, ptr %119, align 1, !tbaa !11
  %121 = zext i8 %120 to i32
  %122 = load i32, ptr %23, align 4, !tbaa !12
  %123 = icmp ne i32 %121, %122
  br i1 %123, label %124, label %130

124:                                              ; preds = %115
  br label %125

125:                                              ; preds = %124
  %126 = load ptr, ptr @stderr, align 8, !tbaa !5
  %127 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %126, ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 362, ptr noundef @__FUNCTION__.tls_cbc_decrypt, ptr noundef @.str.5) #5
  br label %128

128:                                              ; preds = %125
  br label %129

129:                                              ; preds = %128
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %26, align 4
  br label %183

130:                                              ; preds = %115
  br label %131

131:                                              ; preds = %130
  %132 = load i32, ptr %25, align 4, !tbaa !12
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %25, align 4, !tbaa !12
  br label %111, !llvm.loop !14

134:                                              ; preds = %111
  %135 = load i64, ptr %15, align 8, !tbaa !9
  %136 = sub i64 %135, 32
  %137 = load i32, ptr %23, align 4, !tbaa !12
  %138 = sext i32 %137 to i64
  %139 = sub i64 %136, %138
  %140 = sub i64 %139, 1
  %141 = load ptr, ptr %17, align 8, !tbaa !5
  store i64 %140, ptr %141, align 8, !tbaa !9
  %142 = load ptr, ptr %13, align 8, !tbaa !5
  %143 = getelementptr inbounds i8, ptr %142, i64 0
  %144 = load i8, ptr %143, align 1, !tbaa !11
  %145 = getelementptr inbounds [5 x i8], ptr %22, i64 0, i64 0
  store i8 %144, ptr %145, align 1, !tbaa !11
  %146 = load ptr, ptr %13, align 8, !tbaa !5
  %147 = getelementptr inbounds i8, ptr %146, i64 1
  %148 = load i8, ptr %147, align 1, !tbaa !11
  %149 = getelementptr inbounds [5 x i8], ptr %22, i64 0, i64 1
  store i8 %148, ptr %149, align 1, !tbaa !11
  %150 = load ptr, ptr %13, align 8, !tbaa !5
  %151 = getelementptr inbounds i8, ptr %150, i64 2
  %152 = load i8, ptr %151, align 1, !tbaa !11
  %153 = getelementptr inbounds [5 x i8], ptr %22, i64 0, i64 2
  store i8 %152, ptr %153, align 1, !tbaa !11
  %154 = load ptr, ptr %17, align 8, !tbaa !5
  %155 = load i64, ptr %154, align 8, !tbaa !9
  %156 = lshr i64 %155, 8
  %157 = trunc i64 %156 to i8
  %158 = getelementptr inbounds [5 x i8], ptr %22, i64 0, i64 3
  store i8 %157, ptr %158, align 1, !tbaa !11
  %159 = load ptr, ptr %17, align 8, !tbaa !5
  %160 = load i64, ptr %159, align 8, !tbaa !9
  %161 = trunc i64 %160 to i8
  %162 = getelementptr inbounds [5 x i8], ptr %22, i64 0, i64 4
  store i8 %161, ptr %162, align 1, !tbaa !11
  %163 = load ptr, ptr %20, align 8, !tbaa !5
  %164 = getelementptr inbounds i8, ptr %163, i64 -32
  store ptr %164, ptr %21, align 8, !tbaa !5
  %165 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 8 %165, i64 176, i1 false)
  %166 = load ptr, ptr %12, align 8, !tbaa !5
  call void @sm3_hmac_update(ptr noundef %18, ptr noundef %166, i64 noundef 8)
  %167 = getelementptr inbounds [5 x i8], ptr %22, i64 0, i64 0
  call void @sm3_hmac_update(ptr noundef %18, ptr noundef %167, i64 noundef 5)
  %168 = load ptr, ptr %16, align 8, !tbaa !5
  %169 = load ptr, ptr %17, align 8, !tbaa !5
  %170 = load i64, ptr %169, align 8, !tbaa !9
  call void @sm3_hmac_update(ptr noundef %18, ptr noundef %168, i64 noundef %170)
  %171 = getelementptr inbounds [32 x i8], ptr %24, i64 0, i64 0
  call void @sm3_hmac_finish(ptr noundef %18, ptr noundef %171)
  %172 = load ptr, ptr %21, align 8, !tbaa !5
  %173 = getelementptr inbounds [32 x i8], ptr %24, i64 0, i64 0
  %174 = call i32 @gmssl_secure_memcmp(ptr noundef %172, ptr noundef %173, i64 noundef 32)
  %175 = icmp ne i32 %174, 0
  br i1 %175, label %176, label %182

176:                                              ; preds = %134
  br label %177

177:                                              ; preds = %176
  %178 = load ptr, ptr @stderr, align 8, !tbaa !5
  %179 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %178, ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 382, ptr noundef @__FUNCTION__.tls_cbc_decrypt, ptr noundef @.str.6) #5
  br label %180

180:                                              ; preds = %177
  br label %181

181:                                              ; preds = %180
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %26, align 4
  br label %183

182:                                              ; preds = %134
  store i32 1, ptr %9, align 4
  store i32 1, ptr %26, align 4
  br label %183

183:                                              ; preds = %182, %181, %129, %109, %72, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 5, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 176, ptr %18) #5
  %184 = load i32, ptr %9, align 4
  ret i32 %184
}

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

declare i32 @gmssl_secure_memcmp(ptr noundef, ptr noundef, i64 noundef) #3

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #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 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; 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.SM3_HMAC_CTX = type { %struct.SM3_CTX, [64 x i8] }
%struct.SM3_CTX = type { [8 x i32], i64, [64 x i8], i64 }

@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 [57 x i8], align 1
@__FUNCTION__.tls_cbc_decrypt = external hidden unnamed_addr constant [16 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [34 x i8], align 1

; 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: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 2) i32 @tls_cbc_decrypt(ptr noundef readonly %0, ptr noundef %1, ptr noundef %2, ptr noundef readonly %3, ptr noundef %4, i64 noundef %5, ptr noundef %6, ptr noundef %7) local_unnamed_addr #4 {
  %9 = alloca %struct.SM3_HMAC_CTX, align 8
  %10 = alloca [16 x i8], align 16
  %11 = alloca [5 x i8], align 1
  %12 = alloca [32 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 176, ptr nonnull %9) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %11) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %12) #5
  %13 = insertelement <4 x ptr> poison, ptr %0, i64 0
  %14 = insertelement <4 x ptr> %13, ptr %1, i64 1
  %15 = insertelement <4 x ptr> %14, ptr %2, i64 2
  %16 = insertelement <4 x ptr> %15, ptr %3, i64 3
  %17 = icmp ne ptr %4, null
  %18 = icmp ne i64 %5, 0
  %19 = icmp ne ptr %6, null
  %20 = icmp ne ptr %7, null
  %21 = icmp eq <4 x ptr> %16, zeroinitializer
  %22 = bitcast <4 x i1> %21 to i4
  %23 = icmp eq i4 %22, 0
  %op.rdx = and i1 %23, %17
  %op.rdx75 = and i1 %19, %20
  %op.rdx76 = and i1 %op.rdx, %op.rdx75
  %op.rdx77 = and i1 %op.rdx76, %18
  br i1 %op.rdx77, label %27, label %24

24:                                               ; preds = %8
  %25 = load ptr, ptr @stderr, align 8, !tbaa !5
  %26 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 338, ptr noundef nonnull @__FUNCTION__.tls_cbc_decrypt) #6
  br label %75

27:                                               ; preds = %8
  %28 = and i64 %5, 15
  %29 = icmp ne i64 %28, 0
  %30 = add i64 %5, -16689
  %31 = icmp ult i64 %30, -16625
  %or.cond17 = or i1 %29, %31
  br i1 %or.cond17, label %32, label %35

32:                                               ; preds = %27
  %33 = load ptr, ptr @stderr, align 8, !tbaa !5
  %34 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 344, ptr noundef nonnull @__FUNCTION__.tls_cbc_decrypt, i64 noundef %5) #6
  br label %75

35:                                               ; preds = %27
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %10, ptr noundef nonnull align 1 dereferenceable(16) %4, i64 16, i1 false)
  %36 = getelementptr inbounds i8, ptr %4, i64 16
  %37 = add nsw i64 %5, -16
  %38 = lshr exact i64 %37, 4
  call void @sm4_cbc_decrypt_blocks(ptr noundef nonnull %1, ptr noundef nonnull %10, ptr noundef nonnull %36, i64 noundef %38, ptr noundef nonnull %6) #5
  %39 = getelementptr i8, ptr %6, i64 %5
  %40 = getelementptr i8, ptr %39, i64 -17
  %41 = load i8, ptr %40, align 1, !tbaa !9
  %42 = zext i8 %41 to i64
  %.add = sub nsw i64 %37, %42
  %43 = getelementptr i8, ptr %6, i64 %.add
  %.ptr70 = getelementptr i8, ptr %43, i64 -1
  %44 = icmp slt i64 %.add, 33
  br i1 %44, label %45, label %.preheader

.preheader:                                       ; preds = %35
  %.not73 = icmp eq i8 %41, 0
  br i1 %.not73, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %wide.trip.count = zext i8 %41 to i64
  br label %.lr.ph

45:                                               ; preds = %35
  %46 = load ptr, ptr @stderr, align 8, !tbaa !5
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 357, ptr noundef nonnull @__FUNCTION__.tls_cbc_decrypt) #6
  br label %75

48:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !10

.lr.ph:                                           ; preds = %.lr.ph.preheader, %48
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %48 ]
  %49 = getelementptr inbounds i8, ptr %.ptr70, i64 %indvars.iv
  %50 = load i8, ptr %49, align 1, !tbaa !9
  %.not71 = icmp eq i8 %50, %41
  br i1 %.not71, label %48, label %51

51:                                               ; preds = %.lr.ph
  %52 = load ptr, ptr @stderr, align 8, !tbaa !5
  %53 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %52, ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 362, ptr noundef nonnull @__FUNCTION__.tls_cbc_decrypt, ptr noundef nonnull @.str.5) #6
  br label %75

._crit_edge:                                      ; preds = %48, %.preheader
  %54 = add nsw i64 %5, -48
  %55 = xor i64 %42, -1
  %56 = add nsw i64 %54, %55
  store i64 %56, ptr %7, align 8, !tbaa !12
  %57 = load i8, ptr %3, align 1, !tbaa !9
  store i8 %57, ptr %11, align 1, !tbaa !9
  %58 = getelementptr inbounds i8, ptr %3, i64 1
  %59 = load i8, ptr %58, align 1, !tbaa !9
  %60 = getelementptr inbounds i8, ptr %11, i64 1
  store i8 %59, ptr %60, align 1, !tbaa !9
  %61 = getelementptr inbounds i8, ptr %3, i64 2
  %62 = load i8, ptr %61, align 1, !tbaa !9
  %63 = getelementptr inbounds i8, ptr %11, i64 2
  store i8 %62, ptr %63, align 1, !tbaa !9
  %64 = lshr i64 %56, 8
  %65 = trunc i64 %64 to i8
  %66 = getelementptr inbounds i8, ptr %11, i64 3
  store i8 %65, ptr %66, align 1, !tbaa !9
  %67 = trunc i64 %56 to i8
  %68 = getelementptr inbounds i8, ptr %11, i64 4
  store i8 %67, ptr %68, align 1, !tbaa !9
  %69 = getelementptr i8, ptr %43, i64 -33
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(176) %9, ptr noundef nonnull align 8 dereferenceable(176) %0, i64 176, i1 false)
  call void @sm3_hmac_update(ptr noundef nonnull %9, ptr noundef nonnull %2, i64 noundef 8) #5
  call void @sm3_hmac_update(ptr noundef nonnull %9, ptr noundef nonnull %11, i64 noundef 5) #5
  %70 = load i64, ptr %7, align 8, !tbaa !12
  call void @sm3_hmac_update(ptr noundef nonnull %9, ptr noundef nonnull %6, i64 noundef %70) #5
  call void @sm3_hmac_finish(ptr noundef nonnull %9, ptr noundef nonnull %12) #5
  %71 = call i32 @gmssl_secure_memcmp(ptr noundef %69, ptr noundef nonnull %12, i64 noundef 32) #5
  %.not = icmp eq i32 %71, 0
  br i1 %.not, label %75, label %72

72:                                               ; preds = %._crit_edge
  %73 = load ptr, ptr @stderr, align 8, !tbaa !5
  %74 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %73, ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 382, ptr noundef nonnull @__FUNCTION__.tls_cbc_decrypt, ptr noundef nonnull @.str.6) #6
  br label %75

75:                                               ; preds = %._crit_edge, %72, %51, %45, %32, %24
  %.063 = phi i32 [ -1, %32 ], [ -1, %45 ], [ -1, %51 ], [ -1, %72 ], [ -1, %24 ], [ 1, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #5
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 176, ptr nonnull %9) #5
  ret i32 %.063
}

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

declare i32 @gmssl_secure_memcmp(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SCCPPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass