; LLVM IR from specinfo-ua/UAPKI :: library/uapkic/src (ec)

; 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.EcCtx_st = type { ptr, ptr, ptr, ptr, i8, i8 }

@.str = external hidden unnamed_addr constant [19 x i8], align 1

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

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

declare void @stacktrace_create(ptr noundef, i64 noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #2

declare void @stacktrace_add(ptr noundef, i64 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @ec_free(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden ptr @ec_params_alloc_binary(ptr noundef, i64 noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i1 noundef zeroext) #3

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

16:                                               ; preds = %6
  %17 = load ptr, ptr %9, align 8, !tbaa !9
  %18 = icmp ne ptr %17, null
  br i1 %18, label %21, label %19

19:                                               ; preds = %16
  store i32 2, ptr %13, align 4, !tbaa !11
  %20 = load i32, ptr %13, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 292, i32 noundef %20, ptr noundef null)
  br label %82

21:                                               ; preds = %16
  br label %22

22:                                               ; preds = %21
  br label %23

23:                                               ; preds = %22
  br label %24

24:                                               ; preds = %23
  %25 = load ptr, ptr %10, align 8, !tbaa !9
  %26 = icmp ne ptr %25, null
  br i1 %26, label %29, label %27

27:                                               ; preds = %24
  store i32 2, ptr %13, align 4, !tbaa !11
  %28 = load i32, ptr %13, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 293, i32 noundef %28, ptr noundef null)
  br label %82

29:                                               ; preds = %24
  br label %30

30:                                               ; preds = %29
  br label %31

31:                                               ; preds = %30
  br label %32

32:                                               ; preds = %31
  %33 = load ptr, ptr %11, align 8, !tbaa !9
  %34 = icmp ne ptr %33, null
  br i1 %34, label %37, label %35

35:                                               ; preds = %32
  store i32 2, ptr %13, align 4, !tbaa !11
  %36 = load i32, ptr %13, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 294, i32 noundef %36, ptr noundef null)
  br label %82

37:                                               ; preds = %32
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39
  %41 = load ptr, ptr %12, align 8, !tbaa !9
  %42 = icmp ne ptr %41, null
  br i1 %42, label %45, label %43

43:                                               ; preds = %40
  store i32 2, ptr %13, align 4, !tbaa !11
  %44 = load i32, ptr %13, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 295, i32 noundef %44, ptr noundef null)
  br label %82

45:                                               ; preds = %40
  br label %46

46:                                               ; preds = %45
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47
  %49 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 40) #5
  store ptr %49, ptr %14, align 8, !tbaa !9
  %50 = icmp eq ptr null, %49
  br i1 %50, label %51, label %53

51:                                               ; preds = %48
  store i32 1, ptr %13, align 4, !tbaa !11
  %52 = load i32, ptr %13, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 297, i32 noundef %52, ptr noundef null)
  br label %82

53:                                               ; preds = %48
  br label %54

54:                                               ; preds = %53
  br label %55

55:                                               ; preds = %54
  %56 = load i64, ptr %7, align 8, !tbaa !5
  %57 = call ptr @get_defaut_f_onb(i64 noundef %56)
  store ptr %57, ptr %15, align 8, !tbaa !9
  br label %58

58:                                               ; preds = %55
  %59 = load ptr, ptr %15, align 8, !tbaa !9
  %60 = icmp ne ptr %59, null
  br i1 %60, label %63, label %61

61:                                               ; preds = %58
  store i32 2, ptr %13, align 4, !tbaa !11
  %62 = load i32, ptr %13, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 300, i32 noundef %62, ptr noundef null)
  br label %82

63:                                               ; preds = %58
  br label %64

64:                                               ; preds = %63
  br label %65

65:                                               ; preds = %64
  br label %66

66:                                               ; preds = %65
  %67 = load ptr, ptr %15, align 8, !tbaa !9
  %68 = load i64, ptr %8, align 8, !tbaa !5
  %69 = load ptr, ptr %9, align 8, !tbaa !9
  %70 = load ptr, ptr %10, align 8, !tbaa !9
  %71 = load ptr, ptr %11, align 8, !tbaa !9
  %72 = load ptr, ptr %12, align 8, !tbaa !9
  %73 = call ptr @ec_params_alloc_binary(ptr noundef %67, i64 noundef 5, i64 noundef %68, ptr noundef %69, ptr noundef %70, ptr noundef %71, ptr noundef %72, i1 noundef zeroext true)
  %74 = load ptr, ptr %14, align 8, !tbaa !9
  %75 = getelementptr inbounds %struct.EcCtx_st, ptr %74, i32 0, i32 0
  store ptr %73, ptr %75, align 8, !tbaa !13
  %76 = icmp eq ptr null, %73
  br i1 %76, label %77, label %79

77:                                               ; preds = %66
  store i32 2, ptr %13, align 4, !tbaa !11
  %78 = load i32, ptr %13, align 4, !tbaa !11
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 302, i32 noundef %78)
  br label %82

79:                                               ; preds = %66
  br label %80

80:                                               ; preds = %79
  br label %81

81:                                               ; preds = %80
  br label %82

82:                                               ; preds = %81, %77, %61, %51, %43, %35, %27, %19
  %83 = load i32, ptr %13, align 4, !tbaa !11
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %87

85:                                               ; preds = %82
  %86 = load ptr, ptr %14, align 8, !tbaa !9
  call void @ec_free(ptr noundef %86)
  store ptr null, ptr %14, align 8, !tbaa !9
  br label %87

87:                                               ; preds = %85, %82
  %88 = load ptr, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  ret ptr %88
}

declare ptr @get_defaut_f_onb(i64 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 allocsize(0,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 #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 }
attributes #5 = { nounwind allocsize(0,1) }

!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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"EcCtx_st", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !15, i64 32, !15, i64 33}
!15 = !{!"_Bool", !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 [19 x i8], align 1

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare dso_local void @ec_free(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden ptr @ec_params_alloc_binary(ptr noundef, i64 noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @ec_alloc_binary_onb_new(i64 noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #2 {
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %7, label %8

7:                                                ; preds = %6
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 292, i32 noundef 2, ptr noundef null) #3
  br label %25

8:                                                ; preds = %6
  %.not30 = icmp eq ptr %3, null
  br i1 %.not30, label %9, label %10

9:                                                ; preds = %8
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 293, i32 noundef 2, ptr noundef null) #3
  br label %25

10:                                               ; preds = %8
  %.not31 = icmp eq ptr %4, null
  br i1 %.not31, label %11, label %12

11:                                               ; preds = %10
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 294, i32 noundef 2, ptr noundef null) #3
  br label %25

12:                                               ; preds = %10
  %.not32 = icmp eq ptr %5, null
  br i1 %.not32, label %13, label %14

13:                                               ; preds = %12
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 295, i32 noundef 2, ptr noundef null) #3
  br label %25

14:                                               ; preds = %12
  %15 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #4
  %16 = icmp eq ptr %15, null
  br i1 %16, label %17, label %18

17:                                               ; preds = %14
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 297, i32 noundef 1, ptr noundef null) #3
  br label %25

18:                                               ; preds = %14
  %19 = tail call ptr @get_defaut_f_onb(i64 noundef %0) #3
  %.not33 = icmp eq ptr %19, null
  br i1 %.not33, label %20, label %21

20:                                               ; preds = %18
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 300, i32 noundef 2, ptr noundef null) #3
  br label %25

21:                                               ; preds = %18
  %22 = tail call ptr @ec_params_alloc_binary(ptr noundef nonnull %19, i64 noundef 5, i64 noundef %1, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %5, i1 noundef zeroext true)
  store ptr %22, ptr %15, align 8, !tbaa !5
  %23 = icmp eq ptr %22, null
  br i1 %23, label %24, label %26

24:                                               ; preds = %21
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 302, i32 noundef 2) #3
  br label %25

25:                                               ; preds = %17, %24, %20, %13, %11, %9, %7
  %.022.ph = phi ptr [ null, %7 ], [ null, %9 ], [ null, %11 ], [ null, %13 ], [ %15, %20 ], [ %15, %24 ], [ null, %17 ]
  tail call void @ec_free(ptr noundef %.022.ph)
  br label %26

26:                                               ; preds = %21, %25
  %.1 = phi ptr [ null, %25 ], [ %15, %21 ]
  ret ptr %.1
}

declare ptr @get_defaut_f_onb(i64 noundef) local_unnamed_addr #0

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 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { nounwind }
attributes #4 = { nounwind allocsize(0,1) }

!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 0}
!6 = !{!"EcCtx_st", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !10, i64 33}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_Bool", !8, i64 0}


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