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

@.str = external hidden unnamed_addr constant [18 x i8], align 1
@default_opt_level = external global i32, align 4

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

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

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

20:                                               ; preds = %17
  store i32 2, ptr %14, align 4, !tbaa !9
  %21 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 72, i32 noundef %21, ptr noundef null)
  br label %255

22:                                               ; preds = %17
  br label %23

23:                                               ; preds = %22
  br label %24

24:                                               ; preds = %23
  br label %25

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

28:                                               ; preds = %25
  store i32 2, ptr %14, align 4, !tbaa !9
  %29 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 73, i32 noundef %29, ptr noundef null)
  br label %255

30:                                               ; preds = %25
  br label %31

31:                                               ; preds = %30
  br label %32

32:                                               ; preds = %31
  br label %33

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

36:                                               ; preds = %33
  store i32 2, ptr %14, align 4, !tbaa !9
  %37 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 74, i32 noundef %37, ptr noundef null)
  br label %255

38:                                               ; preds = %33
  br label %39

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = icmp ne ptr %42, null
  br i1 %43, label %46, label %44

44:                                               ; preds = %41
  store i32 2, ptr %14, align 4, !tbaa !9
  %45 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 75, i32 noundef %45, ptr noundef null)
  br label %255

46:                                               ; preds = %41
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47
  br label %49

49:                                               ; preds = %48
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.EcCtx_st, ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !11
  %53 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %52, i32 0, i32 0
  %54 = load i32, ptr %53, align 8, !tbaa !14
  %55 = icmp eq i32 %54, 1
  br i1 %55, label %58, label %56

56:                                               ; preds = %49
  store i32 2, ptr %14, align 4, !tbaa !9
  %57 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 76, i32 noundef %57, ptr noundef null)
  br label %255

58:                                               ; preds = %49
  br label %59

59:                                               ; preds = %58
  br label %60

60:                                               ; preds = %59
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.EcCtx_st, ptr %61, i32 0, i32 0
  %63 = load ptr, ptr %62, align 8, !tbaa !11
  store ptr %63, ptr %11, align 8, !tbaa !5
  br label %64

64:                                               ; preds = %60
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  %66 = call ptr @wa_alloc_from_ba(ptr noundef %65)
  store ptr %66, ptr %10, align 8, !tbaa !5
  %67 = icmp eq ptr null, %66
  br i1 %67, label %68, label %70

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

70:                                               ; preds = %64
  br label %71

71:                                               ; preds = %70
  br label %72

72:                                               ; preds = %71
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = call zeroext i1 @int_is_zero(ptr noundef %73)
  br i1 %74, label %82, label %75

75:                                               ; preds = %72
  %76 = load ptr, ptr %10, align 8, !tbaa !5
  %77 = load ptr, ptr %11, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %77, i32 0, i32 2
  %79 = load ptr, ptr %78, align 8, !tbaa !17
  %80 = call i32 @int_cmp(ptr noundef %76, ptr noundef %79)
  %81 = icmp sge i32 %80, 0
  br i1 %81, label %82, label %87

82:                                               ; preds = %75, %72
  br label %83

83:                                               ; preds = %82
  store i32 6, ptr %14, align 4, !tbaa !9
  %84 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 84, i32 noundef %84, ptr noundef null)
  br label %255

85:                                               ; No predecessors!
  br label %86

86:                                               ; preds = %85
  br label %87

87:                                               ; preds = %86, %75
  %88 = load ptr, ptr %10, align 8, !tbaa !5
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.EcCtx_st, ptr %89, i32 0, i32 0
  %91 = load ptr, ptr %90, align 8, !tbaa !11
  %92 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %91, i32 0, i32 4
  %93 = load ptr, ptr %92, align 8, !tbaa !18
  %94 = getelementptr inbounds %struct.EC2m_st, ptr %93, i32 0, i32 3
  %95 = load i64, ptr %94, align 8, !tbaa !19
  call void @wa_change_len(ptr noundef %88, i64 noundef %95)
  br label %96

96:                                               ; preds = %87
  %97 = load ptr, ptr %11, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %97, i32 0, i32 4
  %99 = load ptr, ptr %98, align 8, !tbaa !18
  %100 = getelementptr inbounds %struct.EC2m_st, ptr %99, i32 0, i32 3
  %101 = load i64, ptr %100, align 8, !tbaa !19
  %102 = call ptr @ec_point_alloc(i64 noundef %101)
  store ptr %102, ptr %12, align 8, !tbaa !5
  %103 = icmp eq ptr null, %102
  br i1 %103, label %104, label %106

104:                                              ; preds = %96
  store i32 2, ptr %14, align 4, !tbaa !9
  %105 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 90, i32 noundef %105)
  br label %255

106:                                              ; preds = %96
  br label %107

107:                                              ; preds = %106
  br label %108

108:                                              ; preds = %107
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.EcCtx_st, ptr %109, i32 0, i32 0
  %111 = load ptr, ptr %110, align 8, !tbaa !11
  %112 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %111, i32 0, i32 10
  %113 = load ptr, ptr %112, align 8, !tbaa !21
  %114 = icmp eq ptr %113, null
  br i1 %114, label %115, label %137

115:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %116 = load i32, ptr @default_opt_level, align 4, !tbaa !9
  %117 = lshr i32 %116, 8
  %118 = and i32 %117, 15
  store i32 %118, ptr %15, align 4, !tbaa !9
  %119 = load i32, ptr %15, align 4, !tbaa !9
  %120 = icmp eq i32 %119, 0
  br i1 %120, label %121, label %122

121:                                              ; preds = %115
  store i32 5, ptr %15, align 4, !tbaa !9
  br label %122

122:                                              ; preds = %121, %115
  br label %123

123:                                              ; preds = %122
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = load i32, ptr %15, align 4, !tbaa !9
  %126 = call i32 @ec_set_sign_precomp(ptr noundef %124, i32 noundef 0, i32 noundef %125)
  store i32 %126, ptr %14, align 4, !tbaa !9
  %127 = load i32, ptr %14, align 4, !tbaa !9
  %128 = icmp ne i32 %127, 0
  br i1 %128, label %129, label %131

129:                                              ; preds = %123
  %130 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 97, i32 noundef %130)
  store i32 4, ptr %16, align 4
  br label %134

131:                                              ; preds = %123
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132
  store i32 0, ptr %16, align 4
  br label %134

134:                                              ; preds = %133, %129
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  %135 = load i32, ptr %16, align 4
  switch i32 %135, label %259 [
    i32 0, label %136
    i32 4, label %255
  ]

136:                                              ; preds = %134
  br label %137

137:                                              ; preds = %136, %108
  br label %138

138:                                              ; preds = %137
  %139 = load ptr, ptr %11, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %139, i32 0, i32 4
  %141 = load ptr, ptr %140, align 8, !tbaa !18
  %142 = load ptr, ptr %11, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %142, i32 0, i32 10
  %144 = load ptr, ptr %143, align 8, !tbaa !21
  %145 = load ptr, ptr %10, align 8, !tbaa !5
  %146 = load ptr, ptr %12, align 8, !tbaa !5
  %147 = call i32 @ec2m_dual_mul_opt(ptr noundef %141, ptr noundef %144, ptr noundef %145, ptr noundef null, ptr noundef null, ptr noundef %146)
  store i32 %147, ptr %14, align 4, !tbaa !9
  %148 = load i32, ptr %14, align 4, !tbaa !9
  %149 = icmp ne i32 %148, 0
  br i1 %149, label %150, label %152

150:                                              ; preds = %138
  %151 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 99, i32 noundef %151)
  br label %255

152:                                              ; preds = %138
  br label %153

153:                                              ; preds = %152
  br label %154

154:                                              ; preds = %153
  %155 = load ptr, ptr %12, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.ECPoint_st, ptr %155, i32 0, i32 0
  %157 = load ptr, ptr %156, align 8, !tbaa !22
  %158 = load ptr, ptr %12, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.ECPoint_st, ptr %158, i32 0, i32 1
  %160 = load ptr, ptr %159, align 8, !tbaa !24
  %161 = load ptr, ptr %12, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.ECPoint_st, ptr %161, i32 0, i32 1
  %163 = load ptr, ptr %162, align 8, !tbaa !24
  call void @gf2m_mod_add(ptr noundef %157, ptr noundef %160, ptr noundef %163)
  %164 = load ptr, ptr %11, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %164, i32 0, i32 5
  %166 = load i8, ptr %165, align 8, !tbaa !25, !range !26, !noundef !27
  %167 = trunc i8 %166 to i1
  br i1 %167, label %168, label %199

168:                                              ; preds = %154
  br label %169

169:                                              ; preds = %168
  %170 = load ptr, ptr %6, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.EcCtx_st, ptr %170, i32 0, i32 0
  %172 = load ptr, ptr %171, align 8, !tbaa !11
  %173 = load ptr, ptr %12, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.ECPoint_st, ptr %173, i32 0, i32 0
  %175 = load ptr, ptr %174, align 8, !tbaa !22
  %176 = call i32 @pb_to_onb(ptr noundef %172, ptr noundef %175)
  store i32 %176, ptr %14, align 4, !tbaa !9
  %177 = load i32, ptr %14, align 4, !tbaa !9
  %178 = icmp ne i32 %177, 0
  br i1 %178, label %179, label %181

179:                                              ; preds = %169
  %180 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 105, i32 noundef %180)
  br label %255

181:                                              ; preds = %169
  br label %182

182:                                              ; preds = %181
  br label %183

183:                                              ; preds = %182
  br label %184

184:                                              ; preds = %183
  %185 = load ptr, ptr %6, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.EcCtx_st, ptr %185, i32 0, i32 0
  %187 = load ptr, ptr %186, align 8, !tbaa !11
  %188 = load ptr, ptr %12, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.ECPoint_st, ptr %188, i32 0, i32 1
  %190 = load ptr, ptr %189, align 8, !tbaa !24
  %191 = call i32 @pb_to_onb(ptr noundef %187, ptr noundef %190)
  store i32 %191, ptr %14, align 4, !tbaa !9
  %192 = load i32, ptr %14, align 4, !tbaa !9
  %193 = icmp ne i32 %192, 0
  br i1 %193, label %194, label %196

194:                                              ; preds = %184
  %195 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 106, i32 noundef %195)
  br label %255

196:                                              ; preds = %184
  br label %197

197:                                              ; preds = %196
  br label %198

198:                                              ; preds = %197
  br label %199

199:                                              ; preds = %198, %154
  %200 = load ptr, ptr %6, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.EcCtx_st, ptr %200, i32 0, i32 0
  %202 = load ptr, ptr %201, align 8, !tbaa !11
  %203 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %202, i32 0, i32 6
  %204 = load i64, ptr %203, align 8, !tbaa !28
  %205 = add i64 %204, 7
  %206 = udiv i64 %205, 8
  store i64 %206, ptr %13, align 8, !tbaa !29
  br label %207

207:                                              ; preds = %199
  %208 = load ptr, ptr %12, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.ECPoint_st, ptr %208, i32 0, i32 0
  %210 = load ptr, ptr %209, align 8, !tbaa !22
  %211 = call ptr @wa_to_ba(ptr noundef %210)
  %212 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %211, ptr %212, align 8, !tbaa !5
  %213 = icmp eq ptr null, %211
  br i1 %213, label %214, label %216

214:                                              ; preds = %207
  store i32 2, ptr %14, align 4, !tbaa !9
  %215 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 111, i32 noundef %215)
  br label %255

216:                                              ; preds = %207
  br label %217

217:                                              ; preds = %216
  br label %218

218:                                              ; preds = %217
  br label %219

219:                                              ; preds = %218
  %220 = load ptr, ptr %12, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.ECPoint_st, ptr %220, i32 0, i32 1
  %222 = load ptr, ptr %221, align 8, !tbaa !24
  %223 = call ptr @wa_to_ba(ptr noundef %222)
  %224 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %223, ptr %224, align 8, !tbaa !5
  %225 = icmp eq ptr null, %223
  br i1 %225, label %226, label %228

226:                                              ; preds = %219
  store i32 2, ptr %14, align 4, !tbaa !9
  %227 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 112, i32 noundef %227)
  br label %255

228:                                              ; preds = %219
  br label %229

229:                                              ; preds = %228
  br label %230

230:                                              ; preds = %229
  br label %231

231:                                              ; preds = %230
  %232 = load ptr, ptr %8, align 8, !tbaa !5
  %233 = load ptr, ptr %232, align 8, !tbaa !5
  %234 = load i64, ptr %13, align 8, !tbaa !29
  %235 = call i32 @ba_change_len(ptr noundef %233, i64 noundef %234)
  store i32 %235, ptr %14, align 4, !tbaa !9
  %236 = load i32, ptr %14, align 4, !tbaa !9
  %237 = icmp ne i32 %236, 0
  br i1 %237, label %238, label %240

238:                                              ; preds = %231
  %239 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 114, i32 noundef %239)
  br label %255

240:                                              ; preds = %231
  br label %241

241:                                              ; preds = %240
  br label %242

242:                                              ; preds = %241
  br label %243

243:                                              ; preds = %242
  %244 = load ptr, ptr %9, align 8, !tbaa !5
  %245 = load ptr, ptr %244, align 8, !tbaa !5
  %246 = load i64, ptr %13, align 8, !tbaa !29
  %247 = call i32 @ba_change_len(ptr noundef %245, i64 noundef %246)
  store i32 %247, ptr %14, align 4, !tbaa !9
  %248 = load i32, ptr %14, align 4, !tbaa !9
  %249 = icmp ne i32 %248, 0
  br i1 %249, label %250, label %252

250:                                              ; preds = %243
  %251 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 115, i32 noundef %251)
  br label %255

252:                                              ; preds = %243
  br label %253

253:                                              ; preds = %252
  br label %254

254:                                              ; preds = %253
  br label %255

255:                                              ; preds = %254, %250, %238, %226, %214, %194, %179, %150, %134, %104, %83, %68, %56, %44, %36, %28, %20
  %256 = load ptr, ptr %12, align 8, !tbaa !5
  call void @ec_point_free(ptr noundef %256)
  %257 = load ptr, ptr %10, align 8, !tbaa !5
  call void @wa_free_private(ptr noundef %257)
  %258 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %258, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %259

259:                                              ; preds = %255, %134
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %260 = load i32, ptr %5, align 4
  ret i32 %260
}

declare ptr @wa_alloc_from_ba(ptr noundef) #1

declare zeroext i1 @int_is_zero(ptr noundef) #1

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

declare void @wa_change_len(ptr noundef, i64 noundef) #1

declare ptr @ec_point_alloc(i64 noundef) #1

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

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

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

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

declare ptr @wa_to_ba(ptr noundef) #1

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

declare void @ec_point_free(ptr noundef) #1

declare void @wa_free_private(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 = { 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 = !{!15, !6, i64 16}
!18 = !{!15, !6, i64 32}
!19 = !{!20, !16, i64 24}
!20 = !{!"EC2m_st", !6, i64 0, !16, i64 8, !6, i64 16, !16, i64 24}
!21 = !{!15, !6, i64 80}
!22 = !{!23, !6, i64 0}
!23 = !{!"ECPoint_st", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!23, !6, i64 8}
!25 = !{!15, !13, i64 40}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = !{!15, !16, i64 48}
!29 = !{!16, !16, 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
@default_opt_level = external local_unnamed_addr global i32, align 4

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

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

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

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

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

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

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

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

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

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

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

16:                                               ; preds = %12
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 76, i32 noundef 2, ptr noundef null) #2
  br label %99

17:                                               ; preds = %12
  %18 = tail call ptr @wa_alloc_from_ba(ptr noundef nonnull %1) #2
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %17
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 80, i32 noundef 2) #2
  br label %99

21:                                               ; preds = %17
  %22 = tail call zeroext i1 @int_is_zero(ptr noundef nonnull %18) #2
  br i1 %22, label %28, label %23

23:                                               ; preds = %21
  %24 = getelementptr inbounds i8, ptr %13, i64 16
  %25 = load ptr, ptr %24, align 8, !tbaa !15
  %26 = tail call i32 @int_cmp(ptr noundef nonnull %18, ptr noundef %25) #2
  %27 = icmp sgt i32 %26, -1
  br i1 %27, label %28, label %29

28:                                               ; preds = %21, %23
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 84, i32 noundef 6, ptr noundef null) #2
  br label %99

29:                                               ; preds = %23
  %30 = load ptr, ptr %0, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %30, i64 32
  %32 = load ptr, ptr %31, align 8, !tbaa !16
  %33 = getelementptr inbounds i8, ptr %32, i64 24
  %34 = load i64, ptr %33, align 8, !tbaa !17
  tail call void @wa_change_len(ptr noundef nonnull %18, i64 noundef %34) #2
  %35 = getelementptr inbounds i8, ptr %13, i64 32
  %36 = load ptr, ptr %35, align 8, !tbaa !16
  %37 = getelementptr inbounds i8, ptr %36, i64 24
  %38 = load i64, ptr %37, align 8, !tbaa !17
  %39 = tail call ptr @ec_point_alloc(i64 noundef %38) #2
  %40 = icmp eq ptr %39, null
  br i1 %40, label %41, label %42

41:                                               ; preds = %29
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 90, i32 noundef 2) #2
  br label %99

42:                                               ; preds = %29
  %43 = load ptr, ptr %0, align 8, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %43, i64 80
  %45 = load ptr, ptr %44, align 8, !tbaa !19
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %.thread

47:                                               ; preds = %42
  %48 = load i32, ptr @default_opt_level, align 4, !tbaa !20
  %49 = lshr i32 %48, 8
  %50 = and i32 %49, 15
  %51 = icmp eq i32 %50, 0
  %spec.store.select = select i1 %51, i32 5, i32 %50
  %52 = tail call i32 @ec_set_sign_precomp(ptr noundef nonnull %0, i32 noundef 0, i32 noundef %spec.store.select) #2
  %.not85 = icmp eq i32 %52, 0
  br i1 %.not85, label %.thread, label %53

53:                                               ; preds = %47
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 97, i32 noundef %52) #2
  br label %99

.thread:                                          ; preds = %47, %42
  %54 = load ptr, ptr %35, align 8, !tbaa !16
  %55 = getelementptr inbounds i8, ptr %13, i64 80
  %56 = load ptr, ptr %55, align 8, !tbaa !19
  %57 = tail call i32 @ec2m_dual_mul_opt(ptr noundef %54, ptr noundef %56, ptr noundef nonnull %18, ptr noundef null, ptr noundef null, ptr noundef nonnull %39) #2
  %.not86 = icmp eq i32 %57, 0
  br i1 %.not86, label %59, label %58

58:                                               ; preds = %.thread
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 99, i32 noundef %57) #2
  br label %99

59:                                               ; preds = %.thread
  %60 = load ptr, ptr %39, align 8, !tbaa !21
  %61 = getelementptr inbounds i8, ptr %39, i64 8
  %62 = load ptr, ptr %61, align 8, !tbaa !23
  tail call void @gf2m_mod_add(ptr noundef %60, ptr noundef %62, ptr noundef %62) #2
  %63 = getelementptr inbounds i8, ptr %13, i64 40
  %64 = load i8, ptr %63, align 8, !tbaa !24, !range !25, !noundef !26
  %65 = trunc nuw i8 %64 to i1
  br i1 %65, label %66, label %76

66:                                               ; preds = %59
  %67 = load ptr, ptr %0, align 8, !tbaa !5
  %68 = load ptr, ptr %39, align 8, !tbaa !21
  %69 = tail call i32 @pb_to_onb(ptr noundef %67, ptr noundef %68) #2
  %.not87 = icmp eq i32 %69, 0
  br i1 %.not87, label %71, label %70

70:                                               ; preds = %66
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 105, i32 noundef %69) #2
  br label %99

71:                                               ; preds = %66
  %72 = load ptr, ptr %0, align 8, !tbaa !5
  %73 = load ptr, ptr %61, align 8, !tbaa !23
  %74 = tail call i32 @pb_to_onb(ptr noundef %72, ptr noundef %73) #2
  %.not88 = icmp eq i32 %74, 0
  br i1 %.not88, label %76, label %75

75:                                               ; preds = %71
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 106, i32 noundef %74) #2
  br label %99

76:                                               ; preds = %71, %59
  %77 = load ptr, ptr %0, align 8, !tbaa !5
  %78 = getelementptr inbounds i8, ptr %77, i64 48
  %79 = load i64, ptr %78, align 8, !tbaa !27
  %80 = add i64 %79, 7
  %81 = lshr i64 %80, 3
  %82 = load ptr, ptr %39, align 8, !tbaa !21
  %83 = tail call ptr @wa_to_ba(ptr noundef %82) #2
  store ptr %83, ptr %2, align 8, !tbaa !28
  %84 = icmp eq ptr %83, null
  br i1 %84, label %85, label %86

85:                                               ; preds = %76
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 111, i32 noundef 2) #2
  br label %99

86:                                               ; preds = %76
  %87 = load ptr, ptr %61, align 8, !tbaa !23
  %88 = tail call ptr @wa_to_ba(ptr noundef %87) #2
  store ptr %88, ptr %3, align 8, !tbaa !28
  %89 = icmp eq ptr %88, null
  br i1 %89, label %90, label %91

90:                                               ; preds = %86
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 112, i32 noundef 2) #2
  br label %99

91:                                               ; preds = %86
  %92 = load ptr, ptr %2, align 8, !tbaa !28
  %93 = tail call i32 @ba_change_len(ptr noundef %92, i64 noundef %81) #2
  %.not89 = icmp eq i32 %93, 0
  br i1 %.not89, label %95, label %94

94:                                               ; preds = %91
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 114, i32 noundef %93) #2
  br label %99

95:                                               ; preds = %91
  %96 = load ptr, ptr %3, align 8, !tbaa !28
  %97 = tail call i32 @ba_change_len(ptr noundef %96, i64 noundef %81) #2
  %.not90 = icmp eq i32 %97, 0
  br i1 %.not90, label %99, label %98

98:                                               ; preds = %95
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 115, i32 noundef %97) #2
  br label %99

99:                                               ; preds = %53, %95, %98, %94, %90, %85, %75, %70, %58, %41, %28, %20, %16, %11, %9, %7, %5
  %.067 = phi ptr [ null, %20 ], [ null, %28 ], [ null, %41 ], [ %39, %53 ], [ %39, %58 ], [ %39, %70 ], [ %39, %75 ], [ %39, %85 ], [ %39, %90 ], [ %39, %94 ], [ %39, %98 ], [ %39, %95 ], [ null, %16 ], [ null, %11 ], [ null, %9 ], [ null, %7 ], [ null, %5 ]
  %.066 = phi ptr [ null, %20 ], [ %18, %28 ], [ %18, %41 ], [ %18, %53 ], [ %18, %58 ], [ %18, %70 ], [ %18, %75 ], [ %18, %85 ], [ %18, %90 ], [ %18, %94 ], [ %18, %98 ], [ %18, %95 ], [ null, %16 ], [ null, %11 ], [ null, %9 ], [ null, %7 ], [ null, %5 ]
  %.065 = phi i32 [ 2, %20 ], [ 6, %28 ], [ 2, %41 ], [ %52, %53 ], [ %57, %58 ], [ %69, %70 ], [ %74, %75 ], [ 2, %85 ], [ 2, %90 ], [ %93, %94 ], [ %97, %98 ], [ 0, %95 ], [ 2, %16 ], [ 2, %11 ], [ 2, %9 ], [ 2, %7 ], [ 2, %5 ]
  tail call void @ec_point_free(ptr noundef %.067) #2
  tail call void @wa_free_private(ptr noundef %.066) #2
  ret i32 %.065
}

declare ptr @wa_alloc_from_ba(ptr noundef) local_unnamed_addr #0

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

declare i32 @int_cmp(ptr noundef, ptr noundef) local_unnamed_addr #0

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

declare ptr @ec_point_alloc(i64 noundef) local_unnamed_addr #0

declare i32 @ec_set_sign_precomp(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

declare i32 @ec2m_dual_mul_opt(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @gf2m_mod_add(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare i32 @pb_to_onb(ptr noundef, ptr noundef) local_unnamed_addr #0

declare ptr @wa_to_ba(ptr noundef) local_unnamed_addr #0

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

declare void @ec_point_free(ptr noundef) local_unnamed_addr #0

declare void @wa_free_private(ptr 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 = { 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 = { 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 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}
!11 = !{!12, !13, i64 0}
!12 = !{!"EcParamsCtx_st", !13, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40, !14, i64 48, !7, i64 56, !7, i64 64, !13, i64 72, !7, i64 80}
!13 = !{!"int", !8, i64 0}
!14 = !{!"long", !8, i64 0}
!15 = !{!12, !7, i64 16}
!16 = !{!12, !7, i64 32}
!17 = !{!18, !14, i64 24}
!18 = !{!"EC2m_st", !7, i64 0, !14, i64 8, !7, i64 16, !14, i64 24}
!19 = !{!12, !7, i64 80}
!20 = !{!13, !13, i64 0}
!21 = !{!22, !7, i64 0}
!22 = !{!"ECPoint_st", !7, i64 0, !7, i64 8, !7, i64 16}
!23 = !{!22, !7, i64 8}
!24 = !{!12, !10, i64 40}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = !{!12, !14, i64 48}
!28 = !{!7, !7, i64 0}


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