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

; 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 }
%struct.EcParamsCtx_st = type { i32, ptr, ptr, ptr, ptr, i8, i64, ptr, ptr, i32, ptr }
%struct.ByteArray_st = type { ptr, i64 }
%struct.ECPoint_st = type { ptr, ptr, ptr }
%struct.EC2m_st = type { ptr, i64, ptr, i64 }

@.str = external hidden unnamed_addr constant [18 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

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

declare ptr @ba_alloc_by_len(i64 noundef) #1

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

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

declare zeroext i1 @int_is_zero(ptr noundef) #1

declare i32 @ba_change_len(ptr noundef, i64 noundef) #1

declare void @ec_point_free(ptr noundef) #1

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

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

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

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 %6, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %28, label %26

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

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 %7, align 8, !tbaa !5
  %33 = icmp ne ptr %32, null
  br i1 %33, label %36, label %34

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

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 %8, align 8, !tbaa !5
  %41 = icmp ne ptr %40, null
  br i1 %41, label %44, label %42

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

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 %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.EcCtx_st, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !11
  %51 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %50, i32 0, i32 0
  %52 = load i32, ptr %51, align 8, !tbaa !14
  %53 = icmp eq i32 %52, 1
  br i1 %53, label %56, label %54

54:                                               ; preds = %47
  store i32 2, ptr %9, align 4, !tbaa !9
  %55 = load i32, ptr %9, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 138, i32 noundef %55, ptr noundef null)
  br label %220

56:                                               ; preds = %47
  br label %57

57:                                               ; preds = %56
  br label %58

58:                                               ; preds = %57
  br label %59

59:                                               ; preds = %58
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.ByteArray_st, ptr %60, i32 0, i32 0
  %62 = load ptr, ptr %61, align 8, !tbaa !17
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.ByteArray_st, ptr %63, i32 0, i32 1
  %65 = load i64, ptr %64, align 8, !tbaa !19
  %66 = call ptr @ba_alloc_from_uint8_be(ptr noundef %62, i64 noundef %65)
  store ptr %66, ptr %13, align 8, !tbaa !5
  %67 = icmp eq ptr null, %66
  br i1 %67, label %68, label %70

68:                                               ; preds = %59
  store i32 2, ptr %9, align 4, !tbaa !9
  %69 = load i32, ptr %9, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 140, i32 noundef %69)
  br label %220

70:                                               ; preds = %59
  br label %71

71:                                               ; preds = %70
  br label %72

72:                                               ; preds = %71
  br label %73

73:                                               ; preds = %72
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.ByteArray_st, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !17
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.ByteArray_st, ptr %77, i32 0, i32 1
  %79 = load i64, ptr %78, align 8, !tbaa !19
  %80 = call ptr @ba_alloc_from_uint8_be(ptr noundef %76, i64 noundef %79)
  store ptr %80, ptr %14, align 8, !tbaa !5
  %81 = icmp eq ptr null, %80
  br i1 %81, label %82, label %84

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

84:                                               ; preds = %73
  br label %85

85:                                               ; preds = %84
  br label %86

86:                                               ; preds = %85
  br label %87

87:                                               ; preds = %86
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.EcCtx_st, ptr %88, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8, !tbaa !11
  %91 = load ptr, ptr %13, align 8, !tbaa !5
  %92 = load ptr, ptr %14, align 8, !tbaa !5
  %93 = call i32 @public_key_to_ec_point(ptr noundef %90, ptr noundef %91, ptr noundef %92, ptr noundef %12)
  store i32 %93, ptr %9, align 4, !tbaa !9
  %94 = load i32, ptr %9, align 4, !tbaa !9
  %95 = icmp ne i32 %94, 0
  br i1 %95, label %96, label %98

96:                                               ; preds = %87
  %97 = load i32, ptr %9, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 142, i32 noundef %97)
  br label %220

98:                                               ; preds = %87
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.EcCtx_st, ptr %101, i32 0, i32 0
  %103 = load ptr, ptr %102, align 8, !tbaa !11
  %104 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %103, i32 0, i32 6
  %105 = load i64, ptr %104, align 8, !tbaa !20
  %106 = add i64 %105, 7
  %107 = udiv i64 %106, 8
  store i64 %107, ptr %11, align 8, !tbaa !21
  %108 = load ptr, ptr %12, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.ECPoint_st, ptr %108, i32 0, i32 0
  %110 = load ptr, ptr %109, align 8, !tbaa !22
  %111 = call zeroext i1 @int_is_zero(ptr noundef %110)
  br i1 %111, label %112, label %130

112:                                              ; preds = %100
  br label %113

113:                                              ; preds = %112
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.ByteArray_st, ptr %114, i32 0, i32 1
  %116 = load i64, ptr %115, align 8, !tbaa !19
  %117 = call ptr @ba_alloc_by_len(i64 noundef %116)
  %118 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %117, ptr %118, align 8, !tbaa !5
  %119 = icmp eq ptr null, %117
  br i1 %119, label %120, label %122

120:                                              ; preds = %113
  store i32 2, ptr %9, align 4, !tbaa !9
  %121 = load i32, ptr %9, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 146, i32 noundef %121)
  br label %220

122:                                              ; preds = %113
  br label %123

123:                                              ; preds = %122
  br label %124

124:                                              ; preds = %123
  %125 = load ptr, ptr %8, align 8, !tbaa !5
  %126 = load ptr, ptr %125, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.ByteArray_st, ptr %126, i32 0, i32 0
  %128 = load ptr, ptr %127, align 8, !tbaa !17
  %129 = load i64, ptr %11, align 8, !tbaa !21
  call void @llvm.memset.p0.i64(ptr align 1 %128, i8 0, i64 %129, i1 false)
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %220

130:                                              ; preds = %100
  br label %131

131:                                              ; preds = %130
  %132 = load ptr, ptr %6, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.ByteArray_st, ptr %132, i32 0, i32 0
  %134 = load ptr, ptr %133, align 8, !tbaa !17
  %135 = load ptr, ptr %6, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.ByteArray_st, ptr %135, i32 0, i32 1
  %137 = load i64, ptr %136, align 8, !tbaa !19
  %138 = call ptr @ba_alloc_from_uint8(ptr noundef %134, i64 noundef %137)
  %139 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %138, ptr %139, align 8, !tbaa !5
  %140 = icmp eq ptr null, %138
  br i1 %140, label %141, label %143

141:                                              ; preds = %131
  store i32 2, ptr %9, align 4, !tbaa !9
  %142 = load i32, ptr %9, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 152, i32 noundef %142)
  br label %220

143:                                              ; preds = %131
  br label %144

144:                                              ; preds = %143
  br label %145

145:                                              ; preds = %144
  %146 = load ptr, ptr %5, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.EcCtx_st, ptr %146, i32 0, i32 0
  %148 = load ptr, ptr %147, align 8, !tbaa !11
  %149 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %148, i32 0, i32 4
  %150 = load ptr, ptr %149, align 8, !tbaa !24
  %151 = getelementptr inbounds %struct.EC2m_st, ptr %150, i32 0, i32 0
  %152 = load ptr, ptr %151, align 8, !tbaa !25
  %153 = load ptr, ptr %12, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.ECPoint_st, ptr %153, i32 0, i32 0
  %155 = load ptr, ptr %154, align 8, !tbaa !22
  %156 = load ptr, ptr %12, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.ECPoint_st, ptr %156, i32 0, i32 0
  %158 = load ptr, ptr %157, align 8, !tbaa !22
  call void @gf2m_mod_inv(ptr noundef %152, ptr noundef %155, ptr noundef %158)
  %159 = load ptr, ptr %5, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.EcCtx_st, ptr %159, i32 0, i32 0
  %161 = load ptr, ptr %160, align 8, !tbaa !11
  %162 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %161, i32 0, i32 4
  %163 = load ptr, ptr %162, align 8, !tbaa !24
  %164 = getelementptr inbounds %struct.EC2m_st, ptr %163, i32 0, i32 0
  %165 = load ptr, ptr %164, align 8, !tbaa !25
  %166 = load ptr, ptr %12, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.ECPoint_st, ptr %166, i32 0, i32 0
  %168 = load ptr, ptr %167, align 8, !tbaa !22
  %169 = load ptr, ptr %12, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.ECPoint_st, ptr %169, i32 0, i32 1
  %171 = load ptr, ptr %170, align 8, !tbaa !27
  %172 = load ptr, ptr %12, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.ECPoint_st, ptr %172, i32 0, i32 1
  %174 = load ptr, ptr %173, align 8, !tbaa !27
  call void @gf2m_mod_mul(ptr noundef %165, ptr noundef %168, ptr noundef %171, ptr noundef %174)
  %175 = load ptr, ptr %5, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.EcCtx_st, ptr %175, i32 0, i32 0
  %177 = load ptr, ptr %176, align 8, !tbaa !11
  %178 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %177, i32 0, i32 4
  %179 = load ptr, ptr %178, align 8, !tbaa !24
  %180 = getelementptr inbounds %struct.EC2m_st, ptr %179, i32 0, i32 0
  %181 = load ptr, ptr %180, align 8, !tbaa !25
  %182 = load ptr, ptr %12, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.ECPoint_st, ptr %182, i32 0, i32 1
  %184 = load ptr, ptr %183, align 8, !tbaa !27
  %185 = call i32 @gf2m_mod_trace(ptr noundef %181, ptr noundef %184)
  store i32 %185, ptr %10, align 4, !tbaa !9
  %186 = load ptr, ptr %8, align 8, !tbaa !5
  %187 = load ptr, ptr %186, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.ByteArray_st, ptr %187, i32 0, i32 0
  %189 = load ptr, ptr %188, align 8, !tbaa !17
  %190 = getelementptr inbounds i8, ptr %189, i64 0
  %191 = load i8, ptr %190, align 1, !tbaa !28
  %192 = zext i8 %191 to i32
  %193 = load i32, ptr %10, align 4, !tbaa !9
  %194 = xor i32 %192, %193
  %195 = and i32 %194, 1
  %196 = icmp ne i32 %195, 0
  br i1 %196, label %197, label %207

197:                                              ; preds = %145
  %198 = load ptr, ptr %8, align 8, !tbaa !5
  %199 = load ptr, ptr %198, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.ByteArray_st, ptr %199, i32 0, i32 0
  %201 = load ptr, ptr %200, align 8, !tbaa !17
  %202 = getelementptr inbounds i8, ptr %201, i64 0
  %203 = load i8, ptr %202, align 1, !tbaa !28
  %204 = zext i8 %203 to i32
  %205 = xor i32 %204, 1
  %206 = trunc i32 %205 to i8
  store i8 %206, ptr %202, align 1, !tbaa !28
  br label %207

207:                                              ; preds = %197, %145
  br label %208

208:                                              ; preds = %207
  %209 = load ptr, ptr %8, align 8, !tbaa !5
  %210 = load ptr, ptr %209, align 8, !tbaa !5
  %211 = load i64, ptr %11, align 8, !tbaa !21
  %212 = call i32 @ba_change_len(ptr noundef %210, i64 noundef %211)
  store i32 %212, ptr %9, align 4, !tbaa !9
  %213 = load i32, ptr %9, align 4, !tbaa !9
  %214 = icmp ne i32 %213, 0
  br i1 %214, label %215, label %217

215:                                              ; preds = %208
  %216 = load i32, ptr %9, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 162, i32 noundef %216)
  br label %220

217:                                              ; preds = %208
  br label %218

218:                                              ; preds = %217
  br label %219

219:                                              ; preds = %218
  br label %220

220:                                              ; preds = %219, %215, %141, %124, %120, %96, %82, %68, %54, %42, %34, %26, %18
  %221 = load ptr, ptr %13, align 8, !tbaa !5
  call void @ba_free(ptr noundef %221)
  %222 = load ptr, ptr %14, align 8, !tbaa !5
  call void @ba_free(ptr noundef %222)
  %223 = load ptr, ptr %12, align 8, !tbaa !5
  call void @ec_point_free(ptr noundef %223)
  %224 = load i32, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  ret i32 %224
}

declare ptr @ba_alloc_from_uint8_be(ptr noundef, i64 noundef) #1

declare i32 @public_key_to_ec_point(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

declare ptr @ba_alloc_from_uint8(ptr noundef, i64 noundef) #1

declare void @gf2m_mod_inv(ptr noundef, ptr noundef, ptr noundef) #1

declare void @gf2m_mod_mul(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare i32 @gf2m_mod_trace(ptr noundef, ptr noundef) #1

declare void @ba_free(ptr 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 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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, !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 = !{!15, !10, i64 0}
!15 = !{!"EcParamsCtx_st", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !16, i64 48, !6, i64 56, !6, i64 64, !10, i64 72, !6, i64 80}
!16 = !{!"long", !7, i64 0}
!17 = !{!18, !6, i64 0}
!18 = !{!"ByteArray_st", !6, i64 0, !16, i64 8}
!19 = !{!18, !16, i64 8}
!20 = !{!15, !16, i64 48}
!21 = !{!16, !16, i64 0}
!22 = !{!23, !6, i64 0}
!23 = !{!"ECPoint_st", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!15, !6, i64 32}
!25 = !{!26, !6, i64 0}
!26 = !{!"EC2m_st", !6, i64 0, !16, i64 8, !6, i64 16, !16, i64 24}
!27 = !{!23, !6, i64 8}
!28 = !{!7, !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 [18 x i8], align 1

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

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

declare ptr @ba_alloc_by_len(i64 noundef) local_unnamed_addr #1

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

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

declare zeroext i1 @int_is_zero(ptr noundef) local_unnamed_addr #1

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

declare void @ec_point_free(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @dstu4145_compress_pubkey(ptr noundef readonly %0, ptr noundef readonly %1, ptr noundef readonly %2, ptr noundef %3) local_unnamed_addr #2 {
  %5 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  store ptr null, ptr %5, align 8, !tbaa !5
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %6, label %7

6:                                                ; preds = %4
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 134, i32 noundef 2, ptr noundef null) #4
  br label %93

7:                                                ; preds = %4
  %.not56 = icmp eq ptr %1, null
  br i1 %.not56, label %8, label %9

8:                                                ; preds = %7
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 135, i32 noundef 2, ptr noundef null) #4
  br label %93

9:                                                ; preds = %7
  %.not57 = icmp eq ptr %2, null
  br i1 %.not57, label %10, label %11

10:                                               ; preds = %9
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 136, i32 noundef 2, ptr noundef null) #4
  br label %93

11:                                               ; preds = %9
  %.not58 = icmp eq ptr %3, null
  br i1 %.not58, label %12, label %13

12:                                               ; preds = %11
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 137, i32 noundef 2, ptr noundef null) #4
  br label %93

13:                                               ; preds = %11
  %14 = load ptr, ptr %0, align 8, !tbaa !9
  %15 = load i32, ptr %14, align 8, !tbaa !12
  %16 = icmp eq i32 %15, 1
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 138, i32 noundef 2, ptr noundef null) #4
  br label %93

18:                                               ; preds = %13
  %19 = load ptr, ptr %1, align 8, !tbaa !16
  %20 = getelementptr inbounds i8, ptr %1, i64 8
  %21 = load i64, ptr %20, align 8, !tbaa !18
  %22 = tail call ptr @ba_alloc_from_uint8_be(ptr noundef %19, i64 noundef %21) #4
  %23 = icmp eq ptr %22, null
  br i1 %23, label %24, label %25

24:                                               ; preds = %18
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 140, i32 noundef 2) #4
  br label %93

25:                                               ; preds = %18
  %26 = load ptr, ptr %2, align 8, !tbaa !16
  %27 = getelementptr inbounds i8, ptr %2, i64 8
  %28 = load i64, ptr %27, align 8, !tbaa !18
  %29 = tail call ptr @ba_alloc_from_uint8_be(ptr noundef %26, i64 noundef %28) #4
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %32

31:                                               ; preds = %25
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 141, i32 noundef 2) #4
  br label %93

32:                                               ; preds = %25
  %33 = load ptr, ptr %0, align 8, !tbaa !9
  %34 = call i32 @public_key_to_ec_point(ptr noundef %33, ptr noundef nonnull %22, ptr noundef nonnull %29, ptr noundef nonnull %5) #4
  %.not59 = icmp eq i32 %34, 0
  br i1 %.not59, label %36, label %35

35:                                               ; preds = %32
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 142, i32 noundef %34) #4
  br label %93

36:                                               ; preds = %32
  %37 = load ptr, ptr %0, align 8, !tbaa !9
  %38 = getelementptr inbounds i8, ptr %37, i64 48
  %39 = load i64, ptr %38, align 8, !tbaa !19
  %40 = add i64 %39, 7
  %41 = lshr i64 %40, 3
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = load ptr, ptr %42, align 8, !tbaa !20
  %44 = call zeroext i1 @int_is_zero(ptr noundef %43) #4
  br i1 %44, label %45, label %52

45:                                               ; preds = %36
  %46 = load i64, ptr %20, align 8, !tbaa !18
  %47 = call ptr @ba_alloc_by_len(i64 noundef %46) #4
  store ptr %47, ptr %3, align 8, !tbaa !5
  %48 = icmp eq ptr %47, null
  br i1 %48, label %49, label %50

49:                                               ; preds = %45
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 146, i32 noundef 2) #4
  br label %93

50:                                               ; preds = %45
  %51 = load ptr, ptr %47, align 8, !tbaa !16
  call void @llvm.memset.p0.i64(ptr align 1 %51, i8 0, i64 %41, i1 false)
  br label %93

52:                                               ; preds = %36
  %53 = load ptr, ptr %1, align 8, !tbaa !16
  %54 = load i64, ptr %20, align 8, !tbaa !18
  %55 = call ptr @ba_alloc_from_uint8(ptr noundef %53, i64 noundef %54) #4
  store ptr %55, ptr %3, align 8, !tbaa !5
  %56 = icmp eq ptr %55, null
  br i1 %56, label %57, label %58

57:                                               ; preds = %52
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 152, i32 noundef 2) #4
  br label %93

58:                                               ; preds = %52
  %59 = load ptr, ptr %0, align 8, !tbaa !9
  %60 = getelementptr inbounds i8, ptr %59, i64 32
  %61 = load ptr, ptr %60, align 8, !tbaa !22
  %62 = load ptr, ptr %61, align 8, !tbaa !23
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = load ptr, ptr %63, align 8, !tbaa !20
  call void @gf2m_mod_inv(ptr noundef %62, ptr noundef %64, ptr noundef %64) #4
  %65 = load ptr, ptr %0, align 8, !tbaa !9
  %66 = getelementptr inbounds i8, ptr %65, i64 32
  %67 = load ptr, ptr %66, align 8, !tbaa !22
  %68 = load ptr, ptr %67, align 8, !tbaa !23
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = load ptr, ptr %69, align 8, !tbaa !20
  %71 = getelementptr inbounds i8, ptr %69, i64 8
  %72 = load ptr, ptr %71, align 8, !tbaa !25
  call void @gf2m_mod_mul(ptr noundef %68, ptr noundef %70, ptr noundef %72, ptr noundef %72) #4
  %73 = load ptr, ptr %0, align 8, !tbaa !9
  %74 = getelementptr inbounds i8, ptr %73, i64 32
  %75 = load ptr, ptr %74, align 8, !tbaa !22
  %76 = load ptr, ptr %75, align 8, !tbaa !23
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds i8, ptr %77, i64 8
  %79 = load ptr, ptr %78, align 8, !tbaa !25
  %80 = call i32 @gf2m_mod_trace(ptr noundef %76, ptr noundef %79) #4
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = load ptr, ptr %81, align 8, !tbaa !16
  %83 = load i8, ptr %82, align 1, !tbaa !26
  %84 = zext i8 %83 to i32
  %85 = xor i32 %80, %84
  %86 = and i32 %85, 1
  %.not60 = icmp eq i32 %86, 0
  br i1 %.not60, label %89, label %87

87:                                               ; preds = %58
  %88 = xor i8 %83, 1
  store i8 %88, ptr %82, align 1, !tbaa !26
  %.pre = load ptr, ptr %3, align 8, !tbaa !5
  br label %89

89:                                               ; preds = %58, %87
  %90 = phi ptr [ %81, %58 ], [ %.pre, %87 ]
  %91 = call i32 @ba_change_len(ptr noundef %90, i64 noundef %41) #4
  %.not61 = icmp eq i32 %91, 0
  br i1 %.not61, label %93, label %92

92:                                               ; preds = %89
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 162, i32 noundef %91) #4
  br label %93

93:                                               ; preds = %89, %92, %57, %50, %49, %35, %31, %24, %17, %12, %10, %8, %6
  %.044 = phi i32 [ 2, %24 ], [ 2, %31 ], [ %34, %35 ], [ 2, %49 ], [ 0, %50 ], [ 2, %57 ], [ %91, %92 ], [ 0, %89 ], [ 2, %17 ], [ 2, %12 ], [ 2, %10 ], [ 2, %8 ], [ 2, %6 ]
  %.043 = phi ptr [ null, %24 ], [ %22, %31 ], [ %22, %35 ], [ %22, %49 ], [ %22, %50 ], [ %22, %57 ], [ %22, %92 ], [ %22, %89 ], [ null, %17 ], [ null, %12 ], [ null, %10 ], [ null, %8 ], [ null, %6 ]
  %.0 = phi ptr [ null, %24 ], [ null, %31 ], [ %29, %35 ], [ %29, %49 ], [ %29, %50 ], [ %29, %57 ], [ %29, %92 ], [ %29, %89 ], [ null, %17 ], [ null, %12 ], [ null, %10 ], [ null, %8 ], [ null, %6 ]
  call void @ba_free(ptr noundef %.043) #4
  call void @ba_free(ptr noundef %.0) #4
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  call void @ec_point_free(ptr noundef %94) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  ret i32 %.044
}

declare ptr @ba_alloc_from_uint8_be(ptr noundef, i64 noundef) local_unnamed_addr #1

declare i32 @public_key_to_ec_point(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

declare ptr @ba_alloc_from_uint8(ptr noundef, i64 noundef) local_unnamed_addr #1

declare void @gf2m_mod_inv(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @gf2m_mod_mul(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @gf2m_mod_trace(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @ba_free(ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress 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 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 0}
!10 = !{!"EcCtx_st", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !11, i64 33}
!11 = !{!"_Bool", !7, i64 0}
!12 = !{!13, !14, i64 0}
!13 = !{!"EcParamsCtx_st", !14, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !15, i64 48, !6, i64 56, !6, i64 64, !14, i64 72, !6, i64 80}
!14 = !{!"int", !7, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!17, !6, i64 0}
!17 = !{!"ByteArray_st", !6, i64 0, !15, i64 8}
!18 = !{!17, !15, i64 8}
!19 = !{!13, !15, i64 48}
!20 = !{!21, !6, i64 0}
!21 = !{!"ECPoint_st", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!13, !6, i64 32}
!23 = !{!24, !6, i64 0}
!24 = !{!"EC2m_st", !6, i64 0, !15, i64 8, !6, i64 16, !15, i64 24}
!25 = !{!21, !6, i64 8}
!26 = !{!7, !7, i64 0}


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