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

declare void @ERR_new() #0

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

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

; 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
declare hidden i32 @real_shift() #2

; Function Attrs: nounwind uwtable
define dso_local i32 @OSSL_PARAM_get_double(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %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 1136, ptr noundef @__func__.OSSL_PARAM_get_double)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 786690, ptr noundef null)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, 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, 3
  br i1 %19, label %20, label %31

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 %30 [
    i64 8, label %24
  ]

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 double, ptr %27, align 8, !tbaa !15
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  store double %28, ptr %29, align 8, !tbaa !15
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %108

30:                                               ; preds = %20
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 1146, ptr noundef @__func__.OSSL_PARAM_get_double)
  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 %108

31:                                               ; preds = %15
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ossl_param_st, ptr %32, i32 0, i32 1
  %34 = load i32, ptr %33, align 8, !tbaa !9
  %35 = icmp eq i32 %34, 2
  br i1 %35, label %36, label %63

36:                                               ; preds = %31
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.ossl_param_st, ptr %37, i32 0, i32 3
  %39 = load i64, ptr %38, align 8, !tbaa !13
  switch i64 %39, label %62 [
    i64 4, label %40
    i64 8, label %47
  ]

40:                                               ; preds = %36
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.ossl_param_st, ptr %41, i32 0, i32 2
  %43 = load ptr, ptr %42, align 8, !tbaa !14
  %44 = load i32, ptr %43, align 4, !tbaa !17
  %45 = uitofp i32 %44 to double
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  store double %45, ptr %46, align 8, !tbaa !15
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %108

47:                                               ; preds = %36
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.ossl_param_st, ptr %48, i32 0, i32 2
  %50 = load ptr, ptr %49, align 8, !tbaa !14
  %51 = load i64, ptr %50, align 8, !tbaa !18
  store i64 %51, ptr %7, align 8, !tbaa !18
  %52 = load i64, ptr %7, align 8, !tbaa !18
  %53 = call i32 @real_shift()
  %54 = zext i32 %53 to i64
  %55 = lshr i64 %52, %54
  %56 = icmp eq i64 %55, 0
  br i1 %56, label %57, label %61

57:                                               ; preds = %47
  %58 = load i64, ptr %7, align 8, !tbaa !18
  %59 = uitofp i64 %58 to double
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  store double %59, ptr %60, align 8, !tbaa !15
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %108

61:                                               ; preds = %47
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 1159, ptr noundef @__func__.OSSL_PARAM_get_double)
  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 %108

62:                                               ; preds = %36
  br label %106

63:                                               ; preds = %31
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.ossl_param_st, ptr %64, i32 0, i32 1
  %66 = load i32, ptr %65, align 8, !tbaa !9
  %67 = icmp eq i32 %66, 1
  br i1 %67, label %68, label %105

68:                                               ; preds = %63
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.ossl_param_st, ptr %69, i32 0, i32 3
  %71 = load i64, ptr %70, align 8, !tbaa !13
  switch i64 %71, label %104 [
    i64 4, label %72
    i64 8, label %79
  ]

72:                                               ; preds = %68
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.ossl_param_st, ptr %73, i32 0, i32 2
  %75 = load ptr, ptr %74, align 8, !tbaa !14
  %76 = load i32, ptr %75, align 4, !tbaa !17
  %77 = sitofp i32 %76 to double
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  store double %77, ptr %78, align 8, !tbaa !15
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %108

79:                                               ; preds = %68
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.ossl_param_st, ptr %80, i32 0, i32 2
  %82 = load ptr, ptr %81, align 8, !tbaa !14
  %83 = load i64, ptr %82, align 8, !tbaa !18
  store i64 %83, ptr %6, align 8, !tbaa !18
  %84 = load i64, ptr %6, align 8, !tbaa !18
  %85 = icmp slt i64 %84, 0
  br i1 %85, label %86, label %89

86:                                               ; preds = %79
  %87 = load i64, ptr %6, align 8, !tbaa !18
  %88 = sub nsw i64 0, %87
  br label %91

89:                                               ; preds = %79
  %90 = load i64, ptr %6, align 8, !tbaa !18
  br label %91

91:                                               ; preds = %89, %86
  %92 = phi i64 [ %88, %86 ], [ %90, %89 ]
  store i64 %92, ptr %7, align 8, !tbaa !18
  %93 = load i64, ptr %7, align 8, !tbaa !18
  %94 = call i32 @real_shift()
  %95 = zext i32 %94 to i64
  %96 = lshr i64 %93, %95
  %97 = icmp eq i64 %96, 0
  br i1 %97, label %98, label %103

98:                                               ; preds = %91
  %99 = load i64, ptr %6, align 8, !tbaa !18
  %100 = sitofp i64 %99 to double
  %101 = fadd double 0.000000e+00, %100
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  store double %101, ptr %102, align 8, !tbaa !15
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %108

103:                                              ; preds = %91
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 1174, ptr noundef @__func__.OSSL_PARAM_get_double)
  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 %108

104:                                              ; preds = %68
  br label %105

105:                                              ; preds = %104, %63
  br label %106

106:                                              ; preds = %105, %62
  br label %107

107:                                              ; preds = %106
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 1178, ptr noundef @__func__.OSSL_PARAM_get_double)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 129, ptr noundef null)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %108

108:                                              ; preds = %107, %103, %98, %72, %61, %57, %40, %30, %24, %14
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %109 = load i32, ptr %3, align 4
  ret i32 %109
}

attributes #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!16, !16, i64 0}
!16 = !{!"double", !7, i64 0}
!17 = !{!11, !11, i64 0}
!18 = !{!12, !12, 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_double = external hidden unnamed_addr constant [22 x i8], align 1

declare void @ERR_new() local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @real_shift() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @OSSL_PARAM_get_double(ptr noundef readonly %0, ptr noundef writeonly %1) local_unnamed_addr #1 {
  %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() #3
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 1136, ptr noundef nonnull @__func__.OSSL_PARAM_get_double) #3
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 786690, ptr noundef null) #3
  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 3, label %9
    i32 2, label %17
    i32 1, label %36
  ]

9:                                                ; preds = %6
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  %11 = load i64, ptr %10, align 8, !tbaa !12
  %cond = icmp eq i64 %11, 8
  br i1 %cond, label %12, label %16

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %14 = load ptr, ptr %13, align 8, !tbaa !13
  %15 = load double, ptr %14, align 8, !tbaa !14
  store double %15, ptr %1, align 8, !tbaa !14
  br label %57

16:                                               ; preds = %9
  tail call void @ERR_new() #3
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 1146, ptr noundef nonnull @__func__.OSSL_PARAM_get_double) #3
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 130, ptr noundef null) #3
  br label %57

17:                                               ; preds = %6
  %18 = getelementptr inbounds i8, ptr %0, i64 24
  %19 = load i64, ptr %18, align 8, !tbaa !12
  switch i64 %19, label %56 [
    i64 4, label %20
    i64 8, label %25
  ]

20:                                               ; preds = %17
  %21 = getelementptr inbounds i8, ptr %0, i64 16
  %22 = load ptr, ptr %21, align 8, !tbaa !13
  %23 = load i32, ptr %22, align 4, !tbaa !16
  %24 = uitofp i32 %23 to double
  store double %24, ptr %1, align 8, !tbaa !14
  br label %57

25:                                               ; preds = %17
  %26 = getelementptr inbounds i8, ptr %0, i64 16
  %27 = load ptr, ptr %26, align 8, !tbaa !13
  %28 = load i64, ptr %27, align 8, !tbaa !17
  %29 = tail call i32 @real_shift()
  %30 = zext nneg i32 %29 to i64
  %31 = lshr i64 %28, %30
  %32 = icmp eq i64 %31, 0
  br i1 %32, label %33, label %35

33:                                               ; preds = %25
  %34 = uitofp i64 %28 to double
  store double %34, ptr %1, align 8, !tbaa !14
  br label %57

35:                                               ; preds = %25
  tail call void @ERR_new() #3
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 1159, ptr noundef nonnull @__func__.OSSL_PARAM_get_double) #3
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 123, ptr noundef null) #3
  br label %57

36:                                               ; preds = %6
  %37 = getelementptr inbounds i8, ptr %0, i64 24
  %38 = load i64, ptr %37, align 8, !tbaa !12
  switch i64 %38, label %56 [
    i64 4, label %39
    i64 8, label %44
  ]

39:                                               ; preds = %36
  %40 = getelementptr inbounds i8, ptr %0, i64 16
  %41 = load ptr, ptr %40, align 8, !tbaa !13
  %42 = load i32, ptr %41, align 4, !tbaa !16
  %43 = sitofp i32 %42 to double
  store double %43, ptr %1, align 8, !tbaa !14
  br label %57

44:                                               ; preds = %36
  %45 = getelementptr inbounds i8, ptr %0, i64 16
  %46 = load ptr, ptr %45, align 8, !tbaa !13
  %47 = load i64, ptr %46, align 8, !tbaa !17
  %48 = tail call i64 @llvm.abs.i64(i64 %47, i1 true)
  %49 = tail call i32 @real_shift()
  %50 = zext nneg i32 %49 to i64
  %51 = lshr i64 %48, %50
  %52 = icmp eq i64 %51, 0
  br i1 %52, label %53, label %55

53:                                               ; preds = %44
  %54 = sitofp i64 %47 to double
  store double %54, ptr %1, align 8, !tbaa !14
  br label %57

55:                                               ; preds = %44
  tail call void @ERR_new() #3
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 1174, ptr noundef nonnull @__func__.OSSL_PARAM_get_double) #3
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 123, ptr noundef null) #3
  br label %57

56:                                               ; preds = %6, %17, %36
  tail call void @ERR_new() #3
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 1178, ptr noundef nonnull @__func__.OSSL_PARAM_get_double) #3
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 15, i32 noundef 129, ptr noundef null) #3
  br label %57

57:                                               ; preds = %56, %55, %53, %39, %35, %33, %20, %16, %12, %5
  %.0 = phi i32 [ 0, %5 ], [ 1, %12 ], [ 0, %16 ], [ 0, %56 ], [ 1, %33 ], [ 0, %35 ], [ 1, %20 ], [ 1, %53 ], [ 0, %55 ], [ 1, %39 ]
  ret i32 %.0
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #2

attributes #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 = { 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 #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !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 = !{!15, !15, i64 0}
!15 = !{!"double", !8, i64 0}
!16 = !{!10, !10, i64 0}
!17 = !{!11, !11, i64 0}


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