; LLVM IR from guanzhi/GmSSL :: tests (sm9test)

; 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.SM9_ENC_MASTER_KEY = type { %struct.SM9_Z256_POINT, [4 x i64] }
%struct.SM9_Z256_POINT = type { [4 x i64], [4 x i64], [4 x i64] }
%struct.SM9_ENC_KEY = type { %struct.SM9_Z256_POINT, %struct.SM9_Z256_TWIST_POINT }
%struct.SM9_Z256_TWIST_POINT = type { [2 x [4 x i64]], [2 x [4 x i64]], [2 x [4 x i64]] }

@.str.12 = external hidden unnamed_addr constant [9 x i8], align 1
@stderr = external global ptr, align 8
@.str.14 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.66 = external hidden unnamed_addr constant [260 x i8], align 1
@__const.test_sm9_z256_exchange.idA = external hidden unnamed_addr constant [5 x i8], align 1
@__const.test_sm9_z256_exchange.idB = external hidden unnamed_addr constant [3 x i8], align 1
@.str.76 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.77 = external hidden unnamed_addr constant [260 x i8], align 1
@.str.78 = external hidden unnamed_addr constant [36 x i8], align 1
@__FUNCTION__.test_sm9_z256_exchange = external hidden unnamed_addr constant [23 x i8], align 1
@.str.79 = external hidden unnamed_addr constant [20 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: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

declare i32 @sm9_z256_from_hex(ptr noundef, ptr noundef) #2

declare i32 @printf(ptr noundef, ...) #2

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

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

declare void @sm9_z256_point_mul_generator(ptr noundef, ptr noundef) #2

declare void @sm9_z256_twist_point_from_hex(ptr noundef, ptr noundef) #2

declare i32 @sm9_z256_twist_point_equ(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @test_sm9_z256_exchange() #4 {
  %1 = alloca i32, align 4
  %2 = alloca %struct.SM9_ENC_MASTER_KEY, align 8
  %3 = alloca %struct.SM9_ENC_KEY, align 8
  %4 = alloca %struct.SM9_ENC_KEY, align 8
  %5 = alloca %struct.SM9_Z256_TWIST_POINT, align 8
  %6 = alloca %struct.SM9_Z256_POINT, align 8
  %7 = alloca %struct.SM9_Z256_POINT, align 8
  %8 = alloca [4 x i64], align 16
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca [5 x i8], align 1
  %12 = alloca [3 x i8], align 1
  %13 = alloca i64, align 8
  %14 = alloca [200 x i8], align 16
  %15 = alloca [200 x i8], align 16
  %16 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 128, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 288, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 288, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 192, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 96, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 96, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store i64 1, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 5, ptr %11) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %11, ptr align 1 @__const.test_sm9_z256_exchange.idA, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 3, ptr %12) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %12, ptr align 1 @__const.test_sm9_z256_exchange.idB, i64 3, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store i64 16, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 200, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 200, ptr %15) #5
  %17 = getelementptr inbounds %struct.SM9_ENC_MASTER_KEY, ptr %2, i32 0, i32 1
  %18 = getelementptr inbounds [4 x i64], ptr %17, i64 0, i64 0
  %19 = call i32 @sm9_z256_from_hex(ptr noundef %18, ptr noundef @.str.76)
  %20 = getelementptr inbounds %struct.SM9_ENC_MASTER_KEY, ptr %2, i32 0, i32 0
  %21 = getelementptr inbounds %struct.SM9_ENC_MASTER_KEY, ptr %2, i32 0, i32 1
  %22 = getelementptr inbounds [4 x i64], ptr %21, i64 0, i64 0
  call void @sm9_z256_point_mul_generator(ptr noundef %20, ptr noundef %22)
  %23 = getelementptr inbounds [5 x i8], ptr %11, i64 0, i64 0
  %24 = call i32 @sm9_exch_master_key_extract_key(ptr noundef %2, ptr noundef %23, i64 noundef 5, ptr noundef %3)
  %25 = icmp slt i32 %24, 0
  br i1 %25, label %26, label %27

26:                                               ; preds = %0
  br label %105

27:                                               ; preds = %0
  %28 = load i64, ptr %10, align 8, !tbaa !5
  %29 = add i64 %28, 1
  store i64 %29, ptr %10, align 8, !tbaa !5
  %30 = getelementptr inbounds [3 x i8], ptr %12, i64 0, i64 0
  %31 = call i32 @sm9_exch_master_key_extract_key(ptr noundef %2, ptr noundef %30, i64 noundef 3, ptr noundef %4)
  %32 = icmp slt i32 %31, 0
  br i1 %32, label %33, label %34

33:                                               ; preds = %27
  br label %105

34:                                               ; preds = %27
  %35 = load i64, ptr %10, align 8, !tbaa !5
  %36 = add i64 %35, 1
  store i64 %36, ptr %10, align 8, !tbaa !5
  call void @sm9_z256_twist_point_from_hex(ptr noundef %5, ptr noundef @.str.77)
  %37 = getelementptr inbounds %struct.SM9_ENC_KEY, ptr %3, i32 0, i32 1
  %38 = call i32 @sm9_z256_twist_point_equ(ptr noundef %37, ptr noundef %5)
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %41, label %40

40:                                               ; preds = %34
  br label %105

41:                                               ; preds = %34
  %42 = load i64, ptr %10, align 8, !tbaa !5
  %43 = add i64 %42, 1
  store i64 %43, ptr %10, align 8, !tbaa !5
  call void @sm9_z256_twist_point_from_hex(ptr noundef %5, ptr noundef @.str.66)
  %44 = getelementptr inbounds %struct.SM9_ENC_KEY, ptr %4, i32 0, i32 1
  %45 = call i32 @sm9_z256_twist_point_equ(ptr noundef %44, ptr noundef %5)
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %48, label %47

47:                                               ; preds = %41
  br label %105

48:                                               ; preds = %41
  %49 = load i64, ptr %10, align 8, !tbaa !5
  %50 = add i64 %49, 1
  store i64 %50, ptr %10, align 8, !tbaa !5
  %51 = getelementptr inbounds [3 x i8], ptr %12, i64 0, i64 0
  %52 = getelementptr inbounds [4 x i64], ptr %8, i64 0, i64 0
  %53 = call i32 @sm9_exch_step_1A(ptr noundef %2, ptr noundef %51, i64 noundef 3, ptr noundef %6, ptr noundef %52)
  %54 = icmp slt i32 %53, 0
  br i1 %54, label %55, label %56

55:                                               ; preds = %48
  br label %105

56:                                               ; preds = %48
  %57 = load i64, ptr %10, align 8, !tbaa !5
  %58 = add i64 %57, 1
  store i64 %58, ptr %10, align 8, !tbaa !5
  %59 = getelementptr inbounds [5 x i8], ptr %11, i64 0, i64 0
  %60 = getelementptr inbounds [3 x i8], ptr %12, i64 0, i64 0
  %61 = getelementptr inbounds [200 x i8], ptr %15, i64 0, i64 0
  %62 = load i64, ptr %13, align 8, !tbaa !5
  %63 = call i32 @sm9_exch_step_1B(ptr noundef %2, ptr noundef %59, i64 noundef 5, ptr noundef %60, i64 noundef 3, ptr noundef %4, ptr noundef %6, ptr noundef %7, ptr noundef %61, i64 noundef %62)
  %64 = icmp slt i32 %63, 0
  br i1 %64, label %65, label %66

65:                                               ; preds = %56
  br label %105

66:                                               ; preds = %56
  %67 = load i64, ptr %10, align 8, !tbaa !5
  %68 = add i64 %67, 1
  store i64 %68, ptr %10, align 8, !tbaa !5
  %69 = getelementptr inbounds [5 x i8], ptr %11, i64 0, i64 0
  %70 = getelementptr inbounds [3 x i8], ptr %12, i64 0, i64 0
  %71 = getelementptr inbounds [4 x i64], ptr %8, i64 0, i64 0
  %72 = getelementptr inbounds [200 x i8], ptr %14, i64 0, i64 0
  %73 = load i64, ptr %13, align 8, !tbaa !5
  %74 = call i32 @sm9_exch_step_2A(ptr noundef %2, ptr noundef %69, i64 noundef 5, ptr noundef %70, i64 noundef 3, ptr noundef %3, ptr noundef %71, ptr noundef %6, ptr noundef %7, ptr noundef %72, i64 noundef %73)
  %75 = icmp slt i32 %74, 0
  br i1 %75, label %76, label %77

76:                                               ; preds = %66
  br label %105

77:                                               ; preds = %66
  %78 = load i64, ptr %10, align 8, !tbaa !5
  %79 = add i64 %78, 1
  store i64 %79, ptr %10, align 8, !tbaa !5
  store i64 0, ptr %9, align 8, !tbaa !5
  br label %80

80:                                               ; preds = %98, %77
  %81 = load i64, ptr %9, align 8, !tbaa !5
  %82 = load i64, ptr %13, align 8, !tbaa !5
  %83 = icmp ult i64 %81, %82
  br i1 %83, label %84, label %101

84:                                               ; preds = %80
  %85 = load i64, ptr %9, align 8, !tbaa !5
  %86 = getelementptr inbounds [200 x i8], ptr %14, i64 0, i64 %85
  %87 = load i8, ptr %86, align 1, !tbaa !9
  %88 = zext i8 %87 to i32
  %89 = load i64, ptr %9, align 8, !tbaa !5
  %90 = getelementptr inbounds [200 x i8], ptr %15, i64 0, i64 %89
  %91 = load i8, ptr %90, align 1, !tbaa !9
  %92 = zext i8 %91 to i32
  %93 = icmp ne i32 %88, %92
  br i1 %93, label %94, label %97

94:                                               ; preds = %84
  %95 = load i64, ptr %9, align 8, !tbaa !5
  %96 = call i32 (ptr, ...) @printf(ptr noundef @.str.78, i64 noundef %95)
  br label %105

97:                                               ; preds = %84
  br label %98

98:                                               ; preds = %97
  %99 = load i64, ptr %9, align 8, !tbaa !5
  %100 = add i64 %99, 1
  store i64 %100, ptr %9, align 8, !tbaa !5
  br label %80, !llvm.loop !10

101:                                              ; preds = %80
  %102 = load i64, ptr %10, align 8, !tbaa !5
  %103 = add i64 %102, 1
  store i64 %103, ptr %10, align 8, !tbaa !5
  %104 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, ptr noundef @__FUNCTION__.test_sm9_z256_exchange)
  store i32 1, ptr %1, align 4
  store i32 1, ptr %16, align 4
  br label %113

105:                                              ; preds = %94, %76, %65, %55, %47, %40, %33, %26
  %106 = load i64, ptr %10, align 8, !tbaa !5
  %107 = call i32 (ptr, ...) @printf(ptr noundef @.str.79, ptr noundef @__FUNCTION__.test_sm9_z256_exchange, i64 noundef %106)
  br label %108

108:                                              ; preds = %105
  %109 = load ptr, ptr @stderr, align 8, !tbaa !12
  %110 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %109, ptr noundef @.str.14, ptr noundef @.str.15, i32 noundef 831, ptr noundef @__FUNCTION__.test_sm9_z256_exchange) #5
  br label %111

111:                                              ; preds = %108
  br label %112

112:                                              ; preds = %111
  store i32 -1, ptr %1, align 4
  store i32 1, ptr %16, align 4
  br label %113

113:                                              ; preds = %112, %101
  call void @llvm.lifetime.end.p0(i64 200, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 200, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 3, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 5, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 96, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 96, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 192, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 288, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 288, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 128, ptr %2) #5
  %114 = load i32, ptr %1, align 4
  ret i32 %114
}

declare i32 @sm9_exch_master_key_extract_key(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #2

declare i32 @sm9_exch_step_1A(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #2

declare i32 @sm9_exch_step_1B(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) #2

declare i32 @sm9_exch_step_2A(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = !{!"long", !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 = !{!"any pointer", !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"

%struct.SM9_ENC_MASTER_KEY = type { %struct.SM9_Z256_POINT, [4 x i64] }
%struct.SM9_Z256_POINT = type { [4 x i64], [4 x i64], [4 x i64] }
%struct.SM9_ENC_KEY = type { %struct.SM9_Z256_POINT, %struct.SM9_Z256_TWIST_POINT }
%struct.SM9_Z256_TWIST_POINT = type { [2 x [4 x i64]], [2 x [4 x i64]], [2 x [4 x i64]] }

@.str.12 = external hidden unnamed_addr constant [9 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.14 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.66 = external hidden unnamed_addr constant [260 x i8], align 1
@__const.test_sm9_z256_exchange.idA = external hidden unnamed_addr constant [5 x i8], align 1
@__const.test_sm9_z256_exchange.idB = external hidden unnamed_addr constant [3 x i8], align 1
@.str.76 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.77 = external hidden unnamed_addr constant [260 x i8], align 1
@.str.78 = external hidden unnamed_addr constant [36 x i8], align 1
@__FUNCTION__.test_sm9_z256_exchange = external hidden unnamed_addr constant [23 x i8], align 1
@.str.79 = external hidden unnamed_addr constant [20 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: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

declare i32 @sm9_z256_from_hex(ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

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

declare void @sm9_z256_point_mul_generator(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @sm9_z256_twist_point_from_hex(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @sm9_z256_twist_point_equ(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 2) i32 @test_sm9_z256_exchange() local_unnamed_addr #4 {
  %1 = alloca %struct.SM9_ENC_MASTER_KEY, align 8
  %2 = alloca %struct.SM9_ENC_KEY, align 8
  %3 = alloca %struct.SM9_ENC_KEY, align 8
  %4 = alloca %struct.SM9_Z256_TWIST_POINT, align 8
  %5 = alloca %struct.SM9_Z256_POINT, align 8
  %6 = alloca %struct.SM9_Z256_POINT, align 8
  %7 = alloca [4 x i64], align 16
  %8 = alloca [5 x i8], align 1
  %9 = alloca [3 x i8], align 1
  %10 = alloca [200 x i8], align 16
  %11 = alloca [200 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 192, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %8) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %8, ptr noundef nonnull align 1 dereferenceable(5) @__const.test_sm9_z256_exchange.idA, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %9) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(3) %9, ptr noundef nonnull align 1 dereferenceable(3) @__const.test_sm9_z256_exchange.idB, i64 3, i1 false)
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %11) #5
  %12 = getelementptr inbounds i8, ptr %1, i64 96
  %13 = call i32 @sm9_z256_from_hex(ptr noundef nonnull %12, ptr noundef nonnull @.str.76) #5
  call void @sm9_z256_point_mul_generator(ptr noundef nonnull %1, ptr noundef nonnull %12) #5
  %14 = call i32 @sm9_exch_master_key_extract_key(ptr noundef nonnull %1, ptr noundef nonnull %8, i64 noundef 5, ptr noundef nonnull %2) #5
  %15 = icmp slt i32 %14, 0
  br i1 %15, label %100, label %16

16:                                               ; preds = %0
  %17 = call i32 @sm9_exch_master_key_extract_key(ptr noundef nonnull %1, ptr noundef nonnull %9, i64 noundef 3, ptr noundef nonnull %3) #5
  %18 = icmp slt i32 %17, 0
  br i1 %18, label %100, label %19

19:                                               ; preds = %16
  call void @sm9_z256_twist_point_from_hex(ptr noundef nonnull %4, ptr noundef nonnull @.str.77) #5
  %20 = getelementptr inbounds i8, ptr %2, i64 96
  %21 = call i32 @sm9_z256_twist_point_equ(ptr noundef nonnull %20, ptr noundef nonnull %4) #5
  %.not = icmp eq i32 %21, 0
  br i1 %.not, label %100, label %22

22:                                               ; preds = %19
  call void @sm9_z256_twist_point_from_hex(ptr noundef nonnull %4, ptr noundef nonnull @.str.66) #5
  %23 = getelementptr inbounds i8, ptr %3, i64 96
  %24 = call i32 @sm9_z256_twist_point_equ(ptr noundef nonnull %23, ptr noundef nonnull %4) #5
  %.not20 = icmp eq i32 %24, 0
  br i1 %.not20, label %100, label %25

25:                                               ; preds = %22
  %26 = call i32 @sm9_exch_step_1A(ptr noundef nonnull %1, ptr noundef nonnull %9, i64 noundef 3, ptr noundef nonnull %5, ptr noundef nonnull %7) #5
  %27 = icmp slt i32 %26, 0
  br i1 %27, label %100, label %28

28:                                               ; preds = %25
  %29 = call i32 @sm9_exch_step_1B(ptr noundef nonnull %1, ptr noundef nonnull %8, i64 noundef 5, ptr noundef nonnull %9, i64 noundef 3, ptr noundef nonnull %3, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %11, i64 noundef 16) #5
  %30 = icmp slt i32 %29, 0
  br i1 %30, label %100, label %31

31:                                               ; preds = %28
  %32 = call i32 @sm9_exch_step_2A(ptr noundef nonnull %1, ptr noundef nonnull %8, i64 noundef 5, ptr noundef nonnull %9, i64 noundef 3, ptr noundef nonnull %2, ptr noundef nonnull %7, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %10, i64 noundef 16) #5
  %33 = icmp slt i32 %32, 0
  br i1 %33, label %100, label %.preheader.preheader

.preheader.preheader:                             ; preds = %31
  %34 = load i8, ptr %10, align 16, !tbaa !5
  %35 = load i8, ptr %11, align 16, !tbaa !5
  %.not21 = icmp eq i8 %34, %35
  br i1 %.not21, label %.preheader.1, label %36

36:                                               ; preds = %.preheader.15, %.preheader.14, %.preheader.13, %.preheader.12, %.preheader.11, %.preheader.10, %.preheader.9, %.preheader.8, %.preheader.7, %.preheader.6, %.preheader.5, %.preheader.4, %.preheader.3, %.preheader.2, %.preheader.1, %.preheader.preheader
  %.01923.lcssa = phi i64 [ 0, %.preheader.preheader ], [ 1, %.preheader.1 ], [ 2, %.preheader.2 ], [ 3, %.preheader.3 ], [ 4, %.preheader.4 ], [ 5, %.preheader.5 ], [ 6, %.preheader.6 ], [ 7, %.preheader.7 ], [ 8, %.preheader.8 ], [ 9, %.preheader.9 ], [ 10, %.preheader.10 ], [ 11, %.preheader.11 ], [ 12, %.preheader.12 ], [ 13, %.preheader.13 ], [ 14, %.preheader.14 ], [ 15, %.preheader.15 ]
  %37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.78, i64 noundef %.01923.lcssa)
  br label %100

.preheader.1:                                     ; preds = %.preheader.preheader
  %38 = getelementptr inbounds i8, ptr %10, i64 1
  %39 = load i8, ptr %38, align 1, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %11, i64 1
  %41 = load i8, ptr %40, align 1, !tbaa !5
  %.not21.1 = icmp eq i8 %39, %41
  br i1 %.not21.1, label %.preheader.2, label %36

.preheader.2:                                     ; preds = %.preheader.1
  %42 = getelementptr inbounds i8, ptr %10, i64 2
  %43 = load i8, ptr %42, align 2, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %11, i64 2
  %45 = load i8, ptr %44, align 2, !tbaa !5
  %.not21.2 = icmp eq i8 %43, %45
  br i1 %.not21.2, label %.preheader.3, label %36

.preheader.3:                                     ; preds = %.preheader.2
  %46 = getelementptr inbounds i8, ptr %10, i64 3
  %47 = load i8, ptr %46, align 1, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %11, i64 3
  %49 = load i8, ptr %48, align 1, !tbaa !5
  %.not21.3 = icmp eq i8 %47, %49
  br i1 %.not21.3, label %.preheader.4, label %36

.preheader.4:                                     ; preds = %.preheader.3
  %50 = getelementptr inbounds i8, ptr %10, i64 4
  %51 = load i8, ptr %50, align 4, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %11, i64 4
  %53 = load i8, ptr %52, align 4, !tbaa !5
  %.not21.4 = icmp eq i8 %51, %53
  br i1 %.not21.4, label %.preheader.5, label %36

.preheader.5:                                     ; preds = %.preheader.4
  %54 = getelementptr inbounds i8, ptr %10, i64 5
  %55 = load i8, ptr %54, align 1, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %11, i64 5
  %57 = load i8, ptr %56, align 1, !tbaa !5
  %.not21.5 = icmp eq i8 %55, %57
  br i1 %.not21.5, label %.preheader.6, label %36

.preheader.6:                                     ; preds = %.preheader.5
  %58 = getelementptr inbounds i8, ptr %10, i64 6
  %59 = load i8, ptr %58, align 2, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %11, i64 6
  %61 = load i8, ptr %60, align 2, !tbaa !5
  %.not21.6 = icmp eq i8 %59, %61
  br i1 %.not21.6, label %.preheader.7, label %36

.preheader.7:                                     ; preds = %.preheader.6
  %62 = getelementptr inbounds i8, ptr %10, i64 7
  %63 = load i8, ptr %62, align 1, !tbaa !5
  %64 = getelementptr inbounds i8, ptr %11, i64 7
  %65 = load i8, ptr %64, align 1, !tbaa !5
  %.not21.7 = icmp eq i8 %63, %65
  br i1 %.not21.7, label %.preheader.8, label %36

.preheader.8:                                     ; preds = %.preheader.7
  %66 = getelementptr inbounds i8, ptr %10, i64 8
  %67 = load i8, ptr %66, align 8, !tbaa !5
  %68 = getelementptr inbounds i8, ptr %11, i64 8
  %69 = load i8, ptr %68, align 8, !tbaa !5
  %.not21.8 = icmp eq i8 %67, %69
  br i1 %.not21.8, label %.preheader.9, label %36

.preheader.9:                                     ; preds = %.preheader.8
  %70 = getelementptr inbounds i8, ptr %10, i64 9
  %71 = load i8, ptr %70, align 1, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %11, i64 9
  %73 = load i8, ptr %72, align 1, !tbaa !5
  %.not21.9 = icmp eq i8 %71, %73
  br i1 %.not21.9, label %.preheader.10, label %36

.preheader.10:                                    ; preds = %.preheader.9
  %74 = getelementptr inbounds i8, ptr %10, i64 10
  %75 = load i8, ptr %74, align 2, !tbaa !5
  %76 = getelementptr inbounds i8, ptr %11, i64 10
  %77 = load i8, ptr %76, align 2, !tbaa !5
  %.not21.10 = icmp eq i8 %75, %77
  br i1 %.not21.10, label %.preheader.11, label %36

.preheader.11:                                    ; preds = %.preheader.10
  %78 = getelementptr inbounds i8, ptr %10, i64 11
  %79 = load i8, ptr %78, align 1, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %11, i64 11
  %81 = load i8, ptr %80, align 1, !tbaa !5
  %.not21.11 = icmp eq i8 %79, %81
  br i1 %.not21.11, label %.preheader.12, label %36

.preheader.12:                                    ; preds = %.preheader.11
  %82 = getelementptr inbounds i8, ptr %10, i64 12
  %83 = load i8, ptr %82, align 4, !tbaa !5
  %84 = getelementptr inbounds i8, ptr %11, i64 12
  %85 = load i8, ptr %84, align 4, !tbaa !5
  %.not21.12 = icmp eq i8 %83, %85
  br i1 %.not21.12, label %.preheader.13, label %36

.preheader.13:                                    ; preds = %.preheader.12
  %86 = getelementptr inbounds i8, ptr %10, i64 13
  %87 = load i8, ptr %86, align 1, !tbaa !5
  %88 = getelementptr inbounds i8, ptr %11, i64 13
  %89 = load i8, ptr %88, align 1, !tbaa !5
  %.not21.13 = icmp eq i8 %87, %89
  br i1 %.not21.13, label %.preheader.14, label %36

.preheader.14:                                    ; preds = %.preheader.13
  %90 = getelementptr inbounds i8, ptr %10, i64 14
  %91 = load i8, ptr %90, align 2, !tbaa !5
  %92 = getelementptr inbounds i8, ptr %11, i64 14
  %93 = load i8, ptr %92, align 2, !tbaa !5
  %.not21.14 = icmp eq i8 %91, %93
  br i1 %.not21.14, label %.preheader.15, label %36

.preheader.15:                                    ; preds = %.preheader.14
  %94 = getelementptr inbounds i8, ptr %10, i64 15
  %95 = load i8, ptr %94, align 1, !tbaa !5
  %96 = getelementptr inbounds i8, ptr %11, i64 15
  %97 = load i8, ptr %96, align 1, !tbaa !5
  %.not21.15 = icmp eq i8 %95, %97
  br i1 %.not21.15, label %98, label %36

98:                                               ; preds = %.preheader.15
  %99 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, ptr noundef nonnull @__FUNCTION__.test_sm9_z256_exchange)
  br label %104

100:                                              ; preds = %31, %28, %25, %22, %19, %16, %0, %36
  %.018 = phi i64 [ 1, %0 ], [ 2, %16 ], [ 5, %25 ], [ 6, %28 ], [ 7, %31 ], [ 8, %36 ], [ 4, %22 ], [ 3, %19 ]
  %101 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.79, ptr noundef nonnull @__FUNCTION__.test_sm9_z256_exchange, i64 noundef %.018)
  %102 = load ptr, ptr @stderr, align 8, !tbaa !8
  %103 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %102, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.15, i32 noundef 831, ptr noundef nonnull @__FUNCTION__.test_sm9_z256_exchange) #6
  br label %104

104:                                              ; preds = %100, %98
  %.0 = phi i32 [ -1, %100 ], [ 1, %98 ]
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 192, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %1) #5
  ret i32 %.0
}

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

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 "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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass