; 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_int64 = external hidden unnamed_addr constant [21 x i8], align 1

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

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

14:                                               ; preds = %11, %2
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 684, ptr noundef @__func__.OSSL_PARAM_get_int64)
  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 %108

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

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

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

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

37:                                               ; preds = %20
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = call i32 @general_get_int(ptr noundef %38, ptr noundef %39, i64 noundef 8)
  store i32 %40, ptr %3, align 4
  br label %108

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

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

50:                                               ; preds = %46
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.ossl_param_st, ptr %51, i32 0, i32 2
  %53 = load ptr, ptr %52, align 8, !tbaa !14
  %54 = load i32, ptr %53, align 4, !tbaa !15
  %55 = zext i32 %54 to i64
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %55, ptr %56, align 8, !tbaa !16
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %72

57:                                               ; preds = %46
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.ossl_param_st, ptr %58, i32 0, i32 2
  %60 = load ptr, ptr %59, align 8, !tbaa !14
  %61 = load i64, ptr %60, align 8, !tbaa !16
  store i64 %61, ptr %6, align 8, !tbaa !16
  %62 = load i64, ptr %6, align 8, !tbaa !16
  %63 = icmp ule i64 %62, 9223372036854775807
  br i1 %63, label %64, label %67

64:                                               ; preds = %57
  %65 = load i64, ptr %6, align 8, !tbaa !16
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %65, ptr %66, align 8, !tbaa !16
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %72

67:                                               ; preds = %57
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 714, ptr noundef @__func__.OSSL_PARAM_get_int64)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 126, ptr noundef null)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %72

68:                                               ; preds = %46
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = call i32 @general_get_int(ptr noundef %69, ptr noundef %70, i64 noundef 8)
  store i32 %71, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %72

72:                                               ; preds = %68, %67, %64, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %108

73:                                               ; preds = %41
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.ossl_param_st, ptr %74, i32 0, i32 1
  %76 = load i32, ptr %75, align 8, !tbaa !9
  %77 = icmp eq i32 %76, 3
  br i1 %77, label %78, label %105

78:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.ossl_param_st, ptr %79, i32 0, i32 3
  %81 = load i64, ptr %80, align 8, !tbaa !13
  switch i64 %81, label %103 [
    i64 8, label %82
  ]

82:                                               ; preds = %78
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.ossl_param_st, ptr %83, i32 0, i32 2
  %85 = load ptr, ptr %84, align 8, !tbaa !14
  %86 = load double, ptr %85, align 8, !tbaa !17
  store double %86, ptr %8, align 8, !tbaa !17
  %87 = load double, ptr %8, align 8, !tbaa !17
  %88 = fcmp oge double %87, 0xC3E0000000000000
  br i1 %88, label %89, label %102

89:                                               ; preds = %82
  %90 = load double, ptr %8, align 8, !tbaa !17
  %91 = fcmp olt double %90, 0x43E0000000000000
  br i1 %91, label %92, label %102

92:                                               ; preds = %89
  %93 = load double, ptr %8, align 8, !tbaa !17
  %94 = load double, ptr %8, align 8, !tbaa !17
  %95 = fptosi double %94 to i64
  %96 = sitofp i64 %95 to double
  %97 = fcmp oeq double %93, %96
  br i1 %97, label %98, label %102

98:                                               ; preds = %92
  %99 = load double, ptr %8, align 8, !tbaa !17
  %100 = fptosi double %99 to i64
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %100, ptr %101, align 8, !tbaa !16
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %104

102:                                              ; preds = %92, %89, %82
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 737, ptr noundef @__func__.OSSL_PARAM_get_int64)
  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 %7, align 4
  br label %104

103:                                              ; preds = %78
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 740, ptr noundef @__func__.OSSL_PARAM_get_int64)
  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 %7, align 4
  br label %104

104:                                              ; preds = %103, %102, %98
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %108

105:                                              ; preds = %73
  br label %106

106:                                              ; preds = %105
  br label %107

107:                                              ; preds = %106
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 744, ptr noundef @__func__.OSSL_PARAM_get_int64)
  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 %108

108:                                              ; preds = %107, %104, %72, %37, %31, %24, %14
  %109 = load i32, ptr %3, align 4
  ret i32 %109
}

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: nounwind uwtable
declare hidden i32 @general_get_int(ptr noundef, ptr noundef, i64 noundef) #0

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

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_int64 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @OSSL_PARAM_get_int64(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 684, ptr noundef nonnull @__func__.OSSL_PARAM_get_int64) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 786690, ptr noundef null) #2
  br label %57

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

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 = sext i32 %15 to i64
  store i64 %16, ptr %1, align 8, !tbaa !15
  br label %57

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 %57

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

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

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 = zext i32 %29 to i64
  store i64 %30, ptr %1, align 8, !tbaa !15
  br label %57

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

36:                                               ; preds = %31
  store i64 %34, ptr %1, align 8, !tbaa !15
  br label %57

37:                                               ; preds = %31
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 714, ptr noundef nonnull @__func__.OSSL_PARAM_get_int64) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 126, ptr noundef null) #2
  br label %57

38:                                               ; preds = %23
  %39 = tail call i32 @general_get_int(ptr noundef nonnull %0, ptr noundef nonnull %1, i64 noundef 8)
  br label %57

40:                                               ; preds = %6
  %41 = getelementptr inbounds i8, ptr %0, i64 24
  %42 = load i64, ptr %41, align 8, !tbaa !12
  %cond = icmp eq i64 %42, 8
  br i1 %cond, label %43, label %55

43:                                               ; preds = %40
  %44 = getelementptr inbounds i8, ptr %0, i64 16
  %45 = load ptr, ptr %44, align 8, !tbaa !13
  %46 = load double, ptr %45, align 8, !tbaa !16
  %47 = fcmp oge double %46, 0xC3E0000000000000
  %48 = fcmp olt double %46, 0x43E0000000000000
  %or.cond3 = and i1 %47, %48
  br i1 %or.cond3, label %49, label %54

49:                                               ; preds = %43
  %50 = fptosi double %46 to i64
  %51 = sitofp i64 %50 to double
  %52 = fcmp oeq double %46, %51
  br i1 %52, label %53, label %54

53:                                               ; preds = %49
  store i64 %50, ptr %1, align 8, !tbaa !15
  br label %57

54:                                               ; preds = %49, %43
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 737, ptr noundef nonnull @__func__.OSSL_PARAM_get_int64) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 123, ptr noundef null) #2
  br label %57

55:                                               ; preds = %40
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 740, ptr noundef nonnull @__func__.OSSL_PARAM_get_int64) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 130, ptr noundef null) #2
  br label %57

56:                                               ; preds = %6
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 744, ptr noundef nonnull @__func__.OSSL_PARAM_get_int64) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 129, ptr noundef null) #2
  br label %57

57:                                               ; preds = %53, %54, %55, %26, %36, %37, %38, %56, %21, %17, %12, %5
  %.2 = phi i32 [ 0, %5 ], [ %22, %21 ], [ 1, %17 ], [ 1, %12 ], [ 0, %56 ], [ %39, %38 ], [ 1, %36 ], [ 0, %37 ], [ 1, %26 ], [ 1, %53 ], [ 0, %54 ], [ 0, %55 ]
  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_int(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,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass