; LLVM IR from openssl/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 [65 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 707, 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 %114

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

20:                                               ; preds = %15
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 712, 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 %114

21:                                               ; preds = %15
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.ossl_param_st, ptr %22, i32 0, i32 1
  %24 = load i32, ptr %23, align 8, !tbaa !13
  %25 = icmp eq i32 %24, 1
  br i1 %25, label %26, label %47

26:                                               ; preds = %21
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ossl_param_st, ptr %27, i32 0, i32 3
  %29 = load i64, ptr %28, align 8, !tbaa !14
  switch i64 %29, label %43 [
    i64 4, label %30
    i64 8, label %37
  ]

30:                                               ; preds = %26
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.ossl_param_st, ptr %31, i32 0, i32 2
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = load i32, ptr %33, align 4, !tbaa !15
  %35 = sext i32 %34 to i64
  %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 %114

37:                                               ; preds = %26
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.ossl_param_st, ptr %38, i32 0, i32 2
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  %41 = load i64, ptr %40, align 8, !tbaa !16
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %41, ptr %42, align 8, !tbaa !16
  store i32 1, ptr %3, align 4
  br label %114

43:                                               ; preds = %26
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = call i32 @general_get_int(ptr noundef %44, ptr noundef %45, i64 noundef 8)
  store i32 %46, ptr %3, align 4
  br label %114

47:                                               ; preds = %21
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.ossl_param_st, ptr %48, i32 0, i32 1
  %50 = load i32, ptr %49, align 8, !tbaa !13
  %51 = icmp eq i32 %50, 2
  br i1 %51, label %52, label %79

52:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.ossl_param_st, ptr %53, i32 0, i32 3
  %55 = load i64, ptr %54, align 8, !tbaa !14
  switch i64 %55, label %74 [
    i64 4, label %56
    i64 8, label %63
  ]

56:                                               ; preds = %52
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.ossl_param_st, ptr %57, i32 0, i32 2
  %59 = load ptr, ptr %58, align 8, !tbaa !9
  %60 = load i32, ptr %59, align 4, !tbaa !15
  %61 = zext i32 %60 to i64
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %61, ptr %62, align 8, !tbaa !16
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %78

63:                                               ; preds = %52
  %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 !9
  %67 = load i64, ptr %66, align 8, !tbaa !16
  store i64 %67, ptr %6, align 8, !tbaa !16
  %68 = load i64, ptr %6, align 8, !tbaa !16
  %69 = icmp ule i64 %68, 9223372036854775807
  br i1 %69, label %70, label %73

70:                                               ; preds = %63
  %71 = load i64, ptr %6, 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 %7, align 4
  br label %78

73:                                               ; preds = %63
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 742, 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 %78

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

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

79:                                               ; preds = %47
  %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 !13
  %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 %8) #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 !14
  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 !9
  %92 = load double, ptr %91, align 8, !tbaa !17
  store double %92, ptr %8, align 8, !tbaa !17
  %93 = load double, ptr %8, align 8, !tbaa !17
  %94 = fcmp oge double %93, 0xC3E0000000000000
  br i1 %94, label %95, label %108

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

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

104:                                              ; preds = %98
  %105 = load double, ptr %8, align 8, !tbaa !17
  %106 = fptosi 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 %7, align 4
  br label %110

108:                                              ; preds = %98, %95, %88
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 765, 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 %110

109:                                              ; preds = %84
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 768, 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 %110

110:                                              ; preds = %109, %108, %104
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #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 772, 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 %114

114:                                              ; preds = %113, %110, %78, %43, %37, %30, %20, %14
  %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: 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, !6, i64 16}
!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, !11, i64 8}
!14 = !{!10, !12, i64 24}
!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 [65 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 707, 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 %52

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %9 = icmp eq ptr %8, null
  br i1 %9, label %10, label %11

10:                                               ; preds = %6
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 712, 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 %52

11:                                               ; preds = %6
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  %13 = load i32, ptr %12, align 8, !tbaa !12
  switch i32 %13, label %51 [
    i32 1, label %14
    i32 2, label %24
    i32 3, label %37
  ]

14:                                               ; preds = %11
  %15 = getelementptr inbounds i8, ptr %0, i64 24
  %16 = load i64, ptr %15, align 8, !tbaa !13
  switch i64 %16, label %22 [
    i64 4, label %17
    i64 8, label %20
  ]

17:                                               ; preds = %14
  %18 = load i32, ptr %8, align 4, !tbaa !14
  %19 = sext i32 %18 to i64
  store i64 %19, ptr %1, align 8, !tbaa !15
  br label %52

20:                                               ; preds = %14
  %21 = load i64, ptr %8, align 8, !tbaa !15
  store i64 %21, ptr %1, align 8, !tbaa !15
  br label %52

22:                                               ; preds = %14
  %23 = tail call i32 @general_get_int(ptr noundef nonnull %0, ptr noundef nonnull %1, i64 noundef 8)
  br label %52

24:                                               ; preds = %11
  %25 = getelementptr inbounds i8, ptr %0, i64 24
  %26 = load i64, ptr %25, align 8, !tbaa !13
  switch i64 %26, label %35 [
    i64 4, label %27
    i64 8, label %30
  ]

27:                                               ; preds = %24
  %28 = load i32, ptr %8, align 4, !tbaa !14
  %29 = zext i32 %28 to i64
  store i64 %29, ptr %1, align 8, !tbaa !15
  br label %52

30:                                               ; preds = %24
  %31 = load i64, ptr %8, align 8, !tbaa !15
  %32 = icmp sgt i64 %31, -1
  br i1 %32, label %33, label %34

33:                                               ; preds = %30
  store i64 %31, ptr %1, align 8, !tbaa !15
  br label %52

34:                                               ; preds = %30
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 742, 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 %52

35:                                               ; preds = %24
  %36 = tail call i32 @general_get_int(ptr noundef nonnull %0, ptr noundef nonnull %1, i64 noundef 8)
  br label %52

37:                                               ; preds = %11
  %38 = getelementptr inbounds i8, ptr %0, i64 24
  %39 = load i64, ptr %38, align 8, !tbaa !13
  %cond = icmp eq i64 %39, 8
  br i1 %cond, label %40, label %50

40:                                               ; preds = %37
  %41 = load double, ptr %8, align 8, !tbaa !16
  %42 = fcmp oge double %41, 0xC3E0000000000000
  %43 = fcmp olt double %41, 0x43E0000000000000
  %or.cond3 = and i1 %42, %43
  br i1 %or.cond3, label %44, label %49

44:                                               ; preds = %40
  %45 = fptosi double %41 to i64
  %46 = sitofp i64 %45 to double
  %47 = fcmp oeq double %41, %46
  br i1 %47, label %48, label %49

48:                                               ; preds = %44
  store i64 %45, ptr %1, align 8, !tbaa !15
  br label %52

49:                                               ; preds = %44, %40
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 765, 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 %52

50:                                               ; preds = %37
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 768, 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 %52

51:                                               ; preds = %11
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 772, 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 %52

52:                                               ; preds = %48, %49, %50, %27, %33, %34, %35, %51, %22, %20, %17, %10, %5
  %.2 = phi i32 [ 0, %5 ], [ 0, %10 ], [ %23, %22 ], [ 1, %20 ], [ 1, %17 ], [ 0, %51 ], [ %36, %35 ], [ 1, %33 ], [ 0, %34 ], [ 1, %27 ], [ 1, %48 ], [ 0, %49 ], [ 0, %50 ]
  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, !7, i64 16}
!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, !10, i64 8}
!13 = !{!6, !11, i64 24}
!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