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

15:                                               ; preds = %6
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = icmp ne ptr %16, null
  br i1 %17, label %20, label %18

18:                                               ; preds = %15
  store i32 2, ptr %14, align 4, !tbaa !9
  %19 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 146, i32 noundef %19, ptr noundef null)
  br label %95

20:                                               ; preds = %15
  br label %21

21:                                               ; preds = %20
  br label %22

22:                                               ; preds = %21
  br label %23

23:                                               ; preds = %22
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %28, label %26

26:                                               ; preds = %23
  store i32 2, ptr %14, align 4, !tbaa !9
  %27 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 147, i32 noundef %27, ptr noundef null)
  br label %95

28:                                               ; preds = %23
  br label %29

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %29
  br label %31

31:                                               ; preds = %30
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = icmp ne ptr %32, null
  br i1 %33, label %36, label %34

34:                                               ; preds = %31
  store i32 2, ptr %14, align 4, !tbaa !9
  %35 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 148, i32 noundef %35, ptr noundef null)
  br label %95

36:                                               ; preds = %31
  br label %37

37:                                               ; preds = %36
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = icmp ne ptr %40, null
  br i1 %41, label %44, label %42

42:                                               ; preds = %39
  store i32 2, ptr %14, align 4, !tbaa !9
  %43 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 149, i32 noundef %43, ptr noundef null)
  br label %95

44:                                               ; preds = %39
  br label %45

45:                                               ; preds = %44
  br label %46

46:                                               ; preds = %45
  br label %47

47:                                               ; preds = %46
  %48 = load ptr, ptr %11, align 8, !tbaa !5
  %49 = icmp ne ptr %48, null
  br i1 %49, label %52, label %50

50:                                               ; preds = %47
  store i32 2, ptr %14, align 4, !tbaa !9
  %51 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 150, i32 noundef %51, ptr noundef null)
  br label %95

52:                                               ; preds = %47
  br label %53

53:                                               ; preds = %52
  br label %54

54:                                               ; preds = %53
  br label %55

55:                                               ; preds = %54
  %56 = load ptr, ptr %12, align 8, !tbaa !5
  %57 = icmp ne ptr %56, null
  br i1 %57, label %60, label %58

58:                                               ; preds = %55
  store i32 2, ptr %14, align 4, !tbaa !9
  %59 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 151, i32 noundef %59, ptr noundef null)
  br label %95

60:                                               ; preds = %55
  br label %61

61:                                               ; preds = %60
  br label %62

62:                                               ; preds = %61
  br label %63

63:                                               ; preds = %62
  %64 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 40) #5
  store ptr %64, ptr %13, align 8, !tbaa !5
  %65 = icmp eq ptr null, %64
  br i1 %65, label %66, label %68

66:                                               ; preds = %63
  store i32 1, ptr %14, align 4, !tbaa !9
  %67 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 153, i32 noundef %67, ptr noundef null)
  br label %95

68:                                               ; preds = %63
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  br label %71

71:                                               ; preds = %70
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  %75 = load ptr, ptr %10, align 8, !tbaa !5
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  %77 = load ptr, ptr %12, align 8, !tbaa !5
  %78 = call ptr @ec_params_alloc_prime(ptr noundef %72, ptr noundef %73, ptr noundef %74, ptr noundef %75, ptr noundef %76, ptr noundef %77)
  %79 = load ptr, ptr %13, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.EcCtx_st, ptr %79, i32 0, i32 0
  store ptr %78, ptr %80, align 8, !tbaa !11
  %81 = icmp eq ptr null, %78
  br i1 %81, label %82, label %84

82:                                               ; preds = %71
  store i32 2, ptr %14, align 4, !tbaa !9
  %83 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 154, i32 noundef %83)
  br label %95

84:                                               ; preds = %71
  br label %85

85:                                               ; preds = %84
  br label %86

86:                                               ; preds = %85
  %87 = load ptr, ptr %13, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.EcCtx_st, ptr %87, i32 0, i32 1
  store ptr null, ptr %88, align 8, !tbaa !14
  %89 = load ptr, ptr %13, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.EcCtx_st, ptr %89, i32 0, i32 2
  store ptr null, ptr %90, align 8, !tbaa !15
  %91 = load ptr, ptr %13, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.EcCtx_st, ptr %91, i32 0, i32 4
  store i8 0, ptr %92, align 8, !tbaa !16
  %93 = load ptr, ptr %13, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.EcCtx_st, ptr %93, i32 0, i32 5
  store i8 0, ptr %94, align 1, !tbaa !17
  br label %95

95:                                               ; preds = %86, %82, %66, %58, %50, %42, %34, %26, %18
  %96 = load i32, ptr %14, align 4, !tbaa !9
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %98, label %100

98:                                               ; preds = %95
  %99 = load ptr, ptr %13, align 8, !tbaa !5
  call void @ec_free(ptr noundef %99)
  store ptr null, ptr %13, align 8, !tbaa !5
  br label %100

100:                                              ; preds = %98, %95
  %101 = load ptr, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  ret ptr %101
}

; 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) #2

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

; Function Attrs: nounwind uwtable
declare hidden ptr @ec_params_alloc_prime(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"EcCtx_st", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !13, i64 33}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!12, !6, i64 8}
!15 = !{!12, !6, i64 16}
!16 = !{!12, !13, i64 32}
!17 = !{!12, !13, i64 33}


; 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

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

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

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

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

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

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

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

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

14:                                               ; preds = %12
  %.not39 = icmp eq ptr %4, null
  br i1 %.not39, label %15, label %16

15:                                               ; preds = %14
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 150, i32 noundef 2, ptr noundef null) #3
  br label %26

16:                                               ; preds = %14
  %.not40 = icmp eq ptr %5, null
  br i1 %.not40, label %17, label %18

17:                                               ; preds = %16
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 151, i32 noundef 2, ptr noundef null) #3
  br label %26

18:                                               ; preds = %16
  %19 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #4
  %20 = icmp eq ptr %19, null
  br i1 %20, label %21, label %22

21:                                               ; preds = %18
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 153, i32 noundef 1, ptr noundef null) #3
  br label %26

22:                                               ; preds = %18
  %23 = tail call ptr @ec_params_alloc_prime(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %5)
  store ptr %23, ptr %19, align 8, !tbaa !5
  %24 = icmp eq ptr %23, null
  br i1 %24, label %25, label %27

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

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

27:                                               ; preds = %22, %26
  %.1 = phi ptr [ null, %26 ], [ %19, %22 ]
  ret ptr %.1
}

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

; 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 #2

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @ec_free(ptr 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 = { 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 #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: DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass