; LLVM IR from openanolis/openssl :: crypto (params)

; 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.ossl_param_st = type { ptr, i32, ptr, i64, i64 }

@.str = external hidden unnamed_addr constant [68 x i8], align 1
@__func__.OSSL_PARAM_get_uint64 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @OSSL_PARAM_get_uint64(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = icmp eq ptr %10, null
  br i1 %11, label %15, label %12

12:                                               ; preds = %2
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %16

15:                                               ; preds = %12, %2
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 828, ptr noundef @__func__.OSSL_PARAM_get_uint64)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 786690, ptr noundef null)
  store i32 0, ptr %3, align 4
  br label %114

16:                                               ; preds = %12
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.ossl_param_st, ptr %17, i32 0, i32 1
  %19 = load i32, ptr %18, align 8, !tbaa !9
  %20 = icmp eq i32 %19, 2
  br i1 %20, label %21, label %42

21:                                               ; preds = %16
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.ossl_param_st, ptr %22, i32 0, i32 3
  %24 = load i64, ptr %23, align 8, !tbaa !13
  switch i64 %24, label %38 [
    i64 4, label %25
    i64 8, label %32
  ]

25:                                               ; preds = %21
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.ossl_param_st, ptr %26, i32 0, i32 2
  %28 = load ptr, ptr %27, align 8, !tbaa !14
  %29 = load i32, ptr %28, align 4, !tbaa !15
  %30 = zext i32 %29 to i64
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %30, ptr %31, align 8, !tbaa !16
  store i32 1, ptr %3, align 4
  br label %114

32:                                               ; preds = %21
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.ossl_param_st, ptr %33, i32 0, i32 2
  %35 = load ptr, ptr %34, align 8, !tbaa !14
  %36 = load i64, ptr %35, align 8, !tbaa !16
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %36, ptr %37, align 8, !tbaa !16
  store i32 1, ptr %3, align 4
  br label %114

38:                                               ; preds = %21
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = call i32 @general_get_uint(ptr noundef %39, ptr noundef %40, i64 noundef 8)
  store i32 %41, ptr %3, align 4
  br label %114

42:                                               ; preds = %16
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.ossl_param_st, ptr %43, i32 0, i32 1
  %45 = load i32, ptr %44, align 8, !tbaa !9
  %46 = icmp eq i32 %45, 1
  br i1 %46, label %47, label %79

47:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.ossl_param_st, ptr %48, i32 0, i32 3
  %50 = load i64, ptr %49, align 8, !tbaa !13
  switch i64 %50, label %74 [
    i64 4, label %51
    i64 8, label %63
  ]

51:                                               ; preds = %47
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.ossl_param_st, ptr %52, i32 0, i32 2
  %54 = load ptr, ptr %53, align 8, !tbaa !14
  %55 = load i32, ptr %54, align 4, !tbaa !15
  store i32 %55, ptr %6, align 4, !tbaa !15
  %56 = load i32, ptr %6, align 4, !tbaa !15
  %57 = icmp sge i32 %56, 0
  br i1 %57, label %58, label %62

58:                                               ; preds = %51
  %59 = load i32, ptr %6, align 4, !tbaa !15
  %60 = sext i32 %59 to i64
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %60, ptr %61, align 8, !tbaa !16
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %78

62:                                               ; preds = %51
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 856, ptr noundef @__func__.OSSL_PARAM_get_uint64)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 125, ptr noundef null)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %78

63:                                               ; preds = %47
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.ossl_param_st, ptr %64, i32 0, i32 2
  %66 = load ptr, ptr %65, align 8, !tbaa !14
  %67 = load i64, ptr %66, align 8, !tbaa !16
  store i64 %67, ptr %7, align 8, !tbaa !16
  %68 = load i64, ptr %7, align 8, !tbaa !16
  %69 = icmp sge i64 %68, 0
  br i1 %69, label %70, label %73

70:                                               ; preds = %63
  %71 = load i64, ptr %7, align 8, !tbaa !16
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %71, ptr %72, align 8, !tbaa !16
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %78

73:                                               ; preds = %63
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 864, ptr noundef @__func__.OSSL_PARAM_get_uint64)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 125, ptr noundef null)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %78

74:                                               ; preds = %47
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = call i32 @general_get_uint(ptr noundef %75, ptr noundef %76, i64 noundef 8)
  store i32 %77, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %78

78:                                               ; preds = %74, %73, %70, %62, %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %114

79:                                               ; preds = %42
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.ossl_param_st, ptr %80, i32 0, i32 1
  %82 = load i32, ptr %81, align 8, !tbaa !9
  %83 = icmp eq i32 %82, 3
  br i1 %83, label %84, label %111

84:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.ossl_param_st, ptr %85, i32 0, i32 3
  %87 = load i64, ptr %86, align 8, !tbaa !13
  switch i64 %87, label %109 [
    i64 8, label %88
  ]

88:                                               ; preds = %84
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.ossl_param_st, ptr %89, i32 0, i32 2
  %91 = load ptr, ptr %90, align 8, !tbaa !14
  %92 = load double, ptr %91, align 8, !tbaa !17
  store double %92, ptr %9, align 8, !tbaa !17
  %93 = load double, ptr %9, align 8, !tbaa !17
  %94 = fcmp oge double %93, 0.000000e+00
  br i1 %94, label %95, label %108

95:                                               ; preds = %88
  %96 = load double, ptr %9, align 8, !tbaa !17
  %97 = fcmp olt double %96, 0x43F0000000000000
  br i1 %97, label %98, label %108

98:                                               ; preds = %95
  %99 = load double, ptr %9, align 8, !tbaa !17
  %100 = load double, ptr %9, align 8, !tbaa !17
  %101 = fptoui double %100 to i64
  %102 = uitofp i64 %101 to double
  %103 = fcmp oeq double %99, %102
  br i1 %103, label %104, label %108

104:                                              ; preds = %98
  %105 = load double, ptr %9, align 8, !tbaa !17
  %106 = fptoui double %105 to i64
  %107 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %106, ptr %107, align 8, !tbaa !16
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %110

108:                                              ; preds = %98, %95, %88
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 887, ptr noundef @__func__.OSSL_PARAM_get_uint64)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 123, ptr noundef null)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %110

109:                                              ; preds = %84
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 890, ptr noundef @__func__.OSSL_PARAM_get_uint64)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 130, ptr noundef null)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %110

110:                                              ; preds = %109, %108, %104
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %114

111:                                              ; preds = %79
  br label %112

112:                                              ; preds = %111
  br label %113

113:                                              ; preds = %112
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 894, ptr noundef @__func__.OSSL_PARAM_get_uint64)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 129, ptr noundef null)
  store i32 0, ptr %3, align 4
  br label %114

114:                                              ; preds = %113, %110, %78, %38, %32, %25, %15
  %115 = load i32, ptr %3, align 4
  ret i32 %115
}

declare void @ERR_new() #1

declare void @ERR_set_debug(ptr noundef, i32 noundef, ptr noundef) #1

declare void @ERR_set_error(i32 noundef, i32 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

; Function Attrs: nounwind uwtable
declare hidden i32 @general_get_uint(ptr noundef, ptr noundef, i64 noundef) #0

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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, !11, i64 8}
!10 = !{!"ossl_param_st", !6, i64 0, !11, i64 8, !6, i64 16, !12, i64 24, !12, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!10, !12, i64 24}
!14 = !{!10, !6, i64 16}
!15 = !{!11, !11, i64 0}
!16 = !{!12, !12, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"double", !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"

@.str = external hidden unnamed_addr constant [68 x i8], align 1
@__func__.OSSL_PARAM_get_uint64 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @OSSL_PARAM_get_uint64(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = icmp eq ptr %1, null
  %4 = icmp eq ptr %0, null
  %or.cond = or i1 %4, %3
  br i1 %or.cond, label %5, label %6

5:                                                ; preds = %2
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 828, ptr noundef nonnull @__func__.OSSL_PARAM_get_uint64) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 786690, ptr noundef null) #2
  br label %60

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load i32, ptr %7, align 8, !tbaa !5
  switch i32 %8, label %59 [
    i32 2, label %9
    i32 1, label %23
    i32 3, label %43
  ]

9:                                                ; preds = %6
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  %11 = load i64, ptr %10, align 8, !tbaa !12
  switch i64 %11, label %21 [
    i64 4, label %12
    i64 8, label %17
  ]

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %14 = load ptr, ptr %13, align 8, !tbaa !13
  %15 = load i32, ptr %14, align 4, !tbaa !14
  %16 = zext i32 %15 to i64
  store i64 %16, ptr %1, align 8, !tbaa !15
  br label %60

17:                                               ; preds = %9
  %18 = getelementptr inbounds i8, ptr %0, i64 16
  %19 = load ptr, ptr %18, align 8, !tbaa !13
  %20 = load i64, ptr %19, align 8, !tbaa !15
  store i64 %20, ptr %1, align 8, !tbaa !15
  br label %60

21:                                               ; preds = %9
  %22 = tail call i32 @general_get_uint(ptr noundef nonnull %0, ptr noundef nonnull %1, i64 noundef 8)
  br label %60

23:                                               ; preds = %6
  %24 = getelementptr inbounds i8, ptr %0, i64 24
  %25 = load i64, ptr %24, align 8, !tbaa !12
  switch i64 %25, label %41 [
    i64 4, label %26
    i64 8, label %34
  ]

26:                                               ; preds = %23
  %27 = getelementptr inbounds i8, ptr %0, i64 16
  %28 = load ptr, ptr %27, align 8, !tbaa !13
  %29 = load i32, ptr %28, align 4, !tbaa !14
  %30 = icmp sgt i32 %29, -1
  br i1 %30, label %31, label %33

31:                                               ; preds = %26
  %32 = zext nneg i32 %29 to i64
  store i64 %32, ptr %1, align 8, !tbaa !15
  br label %60

33:                                               ; preds = %26
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 856, ptr noundef nonnull @__func__.OSSL_PARAM_get_uint64) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 125, ptr noundef null) #2
  br label %60

34:                                               ; preds = %23
  %35 = getelementptr inbounds i8, ptr %0, i64 16
  %36 = load ptr, ptr %35, align 8, !tbaa !13
  %37 = load i64, ptr %36, align 8, !tbaa !15
  %38 = icmp sgt i64 %37, -1
  br i1 %38, label %39, label %40

39:                                               ; preds = %34
  store i64 %37, ptr %1, align 8, !tbaa !15
  br label %60

40:                                               ; preds = %34
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 864, ptr noundef nonnull @__func__.OSSL_PARAM_get_uint64) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 125, ptr noundef null) #2
  br label %60

41:                                               ; preds = %23
  %42 = tail call i32 @general_get_uint(ptr noundef nonnull %0, ptr noundef nonnull %1, i64 noundef 8)
  br label %60

43:                                               ; preds = %6
  %44 = getelementptr inbounds i8, ptr %0, i64 24
  %45 = load i64, ptr %44, align 8, !tbaa !12
  %cond = icmp eq i64 %45, 8
  br i1 %cond, label %46, label %58

46:                                               ; preds = %43
  %47 = getelementptr inbounds i8, ptr %0, i64 16
  %48 = load ptr, ptr %47, align 8, !tbaa !13
  %49 = load double, ptr %48, align 8, !tbaa !16
  %50 = fcmp oge double %49, 0.000000e+00
  %51 = fcmp olt double %49, 0x43F0000000000000
  %or.cond3 = and i1 %50, %51
  br i1 %or.cond3, label %52, label %57

52:                                               ; preds = %46
  %53 = fptoui double %49 to i64
  %54 = uitofp i64 %53 to double
  %55 = fcmp oeq double %49, %54
  br i1 %55, label %56, label %57

56:                                               ; preds = %52
  store i64 %53, ptr %1, align 8, !tbaa !15
  br label %60

57:                                               ; preds = %52, %46
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 887, ptr noundef nonnull @__func__.OSSL_PARAM_get_uint64) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 123, ptr noundef null) #2
  br label %60

58:                                               ; preds = %43
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 890, ptr noundef nonnull @__func__.OSSL_PARAM_get_uint64) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 130, ptr noundef null) #2
  br label %60

59:                                               ; preds = %6
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 894, ptr noundef nonnull @__func__.OSSL_PARAM_get_uint64) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 129, ptr noundef null) #2
  br label %60

60:                                               ; preds = %56, %57, %58, %31, %33, %39, %40, %41, %59, %21, %17, %12, %5
  %.2 = phi i32 [ 0, %5 ], [ %22, %21 ], [ 1, %17 ], [ 1, %12 ], [ 0, %59 ], [ %42, %41 ], [ 1, %39 ], [ 0, %40 ], [ 1, %31 ], [ 0, %33 ], [ 1, %56 ], [ 0, %57 ], [ 0, %58 ]
  ret i32 %.2
}

declare void @ERR_new() local_unnamed_addr #1

declare void @ERR_set_debug(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare void @ERR_set_error(i32 noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @general_get_uint(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

attributes #0 = { 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 #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 }

!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, !10, i64 8}
!6 = !{!"ossl_param_st", !7, i64 0, !10, i64 8, !7, i64 16, !11, i64 24, !11, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!6, !11, i64 24}
!13 = !{!6, !7, i64 16}
!14 = !{!10, !10, i64 0}
!15 = !{!11, !11, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !8, i64 0}


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