; LLVM IR from guanzhi/GmSSL :: src/sdf (sdf_lib)

; 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.sdf_method_st = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.sdf_vendor_st = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@sdf_method = external dso_local global ptr, align 8
@sdf_vendor = external dso_local global ptr, align 8
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [23 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [33 x i8], align 1
@__FUNCTION__.SDF_ExchangeDigitEnvelopeBaseOnECC = external hidden unnamed_addr constant [35 x i8], align 1

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

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

declare ptr @SDF_GetErrorReason(i32 noundef) #2

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

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

18:                                               ; preds = %6
  %19 = load ptr, ptr @sdf_method, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.sdf_method_st, ptr %19, i32 0, i32 26
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = icmp ne ptr %21, null
  br i1 %22, label %26, label %23

23:                                               ; preds = %18, %6
  %24 = load ptr, ptr @stderr, align 8, !tbaa !5
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 702, ptr noundef @__FUNCTION__.SDF_ExchangeDigitEnvelopeBaseOnECC, ptr noundef @.str.3) #4
  store i32 16777218, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %59

26:                                               ; preds = %18
  %27 = load ptr, ptr @sdf_vendor, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %40

29:                                               ; preds = %26
  %30 = load ptr, ptr @sdf_vendor, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.sdf_vendor_st, ptr %30, i32 0, i32 2
  %32 = load ptr, ptr %31, align 8, !tbaa !13
  %33 = load i32, ptr %10, align 4, !tbaa !9
  %34 = call i32 %32(i32 noundef %33)
  store i32 %34, ptr %10, align 4, !tbaa !9
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %39, label %36

36:                                               ; preds = %29
  %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 708, ptr noundef @__FUNCTION__.SDF_ExchangeDigitEnvelopeBaseOnECC, ptr noundef @.str.5) #4
  store i32 16777225, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %59

39:                                               ; preds = %29
  br label %40

40:                                               ; preds = %39, %26
  %41 = load ptr, ptr @sdf_method, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.sdf_method_st, ptr %41, i32 0, i32 26
  %43 = load ptr, ptr %42, align 8, !tbaa !11
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  %45 = load i32, ptr %9, align 4, !tbaa !9
  %46 = load i32, ptr %10, align 4, !tbaa !9
  %47 = load ptr, ptr %11, align 8, !tbaa !5
  %48 = load ptr, ptr %12, align 8, !tbaa !5
  %49 = load ptr, ptr %13, align 8, !tbaa !5
  %50 = call i32 %43(ptr noundef %44, i32 noundef %45, i32 noundef %46, ptr noundef %47, ptr noundef %48, ptr noundef %49)
  store i32 %50, ptr %14, align 4, !tbaa !9
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %52, label %58

52:                                               ; preds = %40
  %53 = load ptr, ptr @stderr, align 8, !tbaa !5
  %54 = load i32, ptr %14, align 4, !tbaa !9
  %55 = call ptr @SDF_GetErrorReason(i32 noundef %54)
  %56 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 720, ptr noundef @__FUNCTION__.SDF_ExchangeDigitEnvelopeBaseOnECC, ptr noundef %55) #4
  %57 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %57, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %59

58:                                               ; preds = %40
  store i32 0, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %59

59:                                               ; preds = %58, %52, %36, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  %60 = load i32, ptr %7, align 4
  ret i32 %60
}

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 = { nocallback nofree nosync 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 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 #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 208}
!12 = !{!"sdf_method_st", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !6, i64 392}
!13 = !{!14, !6, i64 16}
!14 = !{!"sdf_vendor_st", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}


; 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"

@sdf_method = external dso_local local_unnamed_addr global ptr, align 8
@sdf_vendor = external dso_local local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [23 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [33 x i8], align 1
@__FUNCTION__.SDF_ExchangeDigitEnvelopeBaseOnECC = external hidden unnamed_addr constant [35 x i8], align 1

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

declare ptr @SDF_GetErrorReason(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @SDF_ExchangeDigitEnvelopeBaseOnECC(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #2 {
  %7 = load ptr, ptr @sdf_method, align 8, !tbaa !5
  %.not = icmp eq ptr %7, null
  br i1 %.not, label %11, label %8

8:                                                ; preds = %6
  %9 = getelementptr inbounds i8, ptr %7, i64 208
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %.not14 = icmp eq ptr %10, null
  br i1 %.not14, label %11, label %14

11:                                               ; preds = %8, %6
  %12 = load ptr, ptr @stderr, align 8, !tbaa !5
  %13 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 702, ptr noundef nonnull @__FUNCTION__.SDF_ExchangeDigitEnvelopeBaseOnECC, ptr noundef nonnull @.str.3) #3
  br label %30

14:                                               ; preds = %8
  %15 = load ptr, ptr @sdf_vendor, align 8, !tbaa !5
  %.not15 = icmp eq ptr %15, null
  br i1 %.not15, label %23, label %16

16:                                               ; preds = %14
  %17 = getelementptr inbounds i8, ptr %15, i64 16
  %18 = load ptr, ptr %17, align 8, !tbaa !11
  %19 = tail call i32 %18(i32 noundef %2) #4
  %.not16 = icmp eq i32 %19, 0
  br i1 %.not16, label %20, label %._crit_edge

._crit_edge:                                      ; preds = %16
  %.pre = load ptr, ptr @sdf_method, align 8, !tbaa !5
  %.phi.trans.insert = getelementptr inbounds i8, ptr %.pre, i64 208
  %.pre18 = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !9
  br label %23

20:                                               ; preds = %16
  %21 = load ptr, ptr @stderr, align 8, !tbaa !5
  %22 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 708, ptr noundef nonnull @__FUNCTION__.SDF_ExchangeDigitEnvelopeBaseOnECC, ptr noundef nonnull @.str.5) #3
  br label %30

23:                                               ; preds = %._crit_edge, %14
  %24 = phi ptr [ %.pre18, %._crit_edge ], [ %10, %14 ]
  %.09 = phi i32 [ %19, %._crit_edge ], [ %2, %14 ]
  %25 = tail call i32 %24(ptr noundef %0, i32 noundef %1, i32 noundef %.09, ptr noundef %3, ptr noundef %4, ptr noundef %5) #4
  %.not17 = icmp eq i32 %25, 0
  br i1 %.not17, label %30, label %26

26:                                               ; preds = %23
  %27 = load ptr, ptr @stderr, align 8, !tbaa !5
  %28 = tail call ptr @SDF_GetErrorReason(i32 noundef %25) #4
  %29 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 720, ptr noundef nonnull @__FUNCTION__.SDF_ExchangeDigitEnvelopeBaseOnECC, ptr noundef %28) #3
  br label %30

30:                                               ; preds = %23, %26, %20, %11
  %.0 = phi i32 [ %25, %26 ], [ 16777225, %20 ], [ 16777218, %11 ], [ 0, %23 ]
  ret i32 %.0
}

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 = { cold nounwind }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 208}
!10 = !{!"sdf_method_st", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !6, i64 392}
!11 = !{!12, !6, i64 16}
!12 = !{!"sdf_vendor_st", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass