; LLVM IR from xtruan/FlipBIP :: lib/crypto (ecdsa)

; 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.bignum256 = type { [9 x i32] }
%struct.jacobian_curve_point = type { %struct.bignum256, %struct.bignum256, %struct.bignum256 }
%struct.curve_point = type { %struct.bignum256, %struct.bignum256 }
%struct.ecdsa_curve = type { %struct.bignum256, %struct.curve_point, %struct.bignum256, %struct.bignum256, i32, %struct.bignum256 }

@.str.1 = external hidden unnamed_addr constant [67 x i8], align 1
@point_multiply.a = external hidden global %struct.bignum256, align 4
@point_multiply.jres = external hidden global %struct.jacobian_curve_point, align 4
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1
@__PRETTY_FUNCTION__.point_multiply = external hidden unnamed_addr constant [95 x i8], align 1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

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

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

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

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

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

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

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

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

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

; Function Attrs: nounwind uwtable
define dso_local i32 @point_multiply(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #1 {
  %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 i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca [8 x %struct.curve_point], align 16
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = 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
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.ecdsa_curve, ptr %25, i32 0, i32 2
  %27 = call i32 @bn_is_less(ptr noundef %24, ptr noundef %26)
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %30, label %29

29:                                               ; preds = %4
  store i32 1, ptr %5, align 4
  br label %229

30:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.bignum256, ptr %31, i32 0, i32 0
  %33 = getelementptr inbounds [9 x i32], ptr %32, i64 0, i64 0
  %34 = load i32, ptr %33, align 4, !tbaa !9
  %35 = and i32 %34, 1
  %36 = sub i32 %35, 1
  store i32 %36, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 0, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 576, ptr %19) #6
  call void @llvm.memset.p0.i64(ptr align 16 %19, i8 0, i64 576, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.ecdsa_curve, ptr %37, i32 0, i32 0
  store ptr %38, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 1, ptr %21, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 0, ptr %22, align 4, !tbaa !9
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %77, %30
  %40 = load i32, ptr %11, align 4, !tbaa !9
  %41 = icmp slt i32 %40, 8
  br i1 %41, label %42, label %80

42:                                               ; preds = %39
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.bignum256, ptr %43, i32 0, i32 0
  %45 = load i32, ptr %11, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [9 x i32], ptr %44, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !9
  %49 = load i32, ptr %22, align 4, !tbaa !9
  %50 = or i32 %49, %48
  store i32 %50, ptr %22, align 4, !tbaa !9
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.bignum256, ptr %51, i32 0, i32 0
  %53 = load i32, ptr %11, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [9 x i32], ptr %52, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = add i32 536870911, %56
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.ecdsa_curve, ptr %58, i32 0, i32 2
  %60 = getelementptr inbounds %struct.bignum256, ptr %59, i32 0, i32 0
  %61 = load i32, ptr %11, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [9 x i32], ptr %60, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !9
  %65 = load i32, ptr %15, align 4, !tbaa !9
  %66 = and i32 %64, %65
  %67 = sub i32 %57, %66
  %68 = load i32, ptr %21, align 4, !tbaa !9
  %69 = add i32 %68, %67
  store i32 %69, ptr %21, align 4, !tbaa !9
  %70 = load i32, ptr %21, align 4, !tbaa !9
  %71 = and i32 %70, 536870911
  %72 = load i32, ptr %11, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [9 x i32], ptr @point_multiply.a, i64 0, i64 %73
  store i32 %71, ptr %74, align 4, !tbaa !9
  %75 = load i32, ptr %21, align 4, !tbaa !9
  %76 = lshr i32 %75, 29
  store i32 %76, ptr %21, align 4, !tbaa !9
  br label %77

77:                                               ; preds = %42
  %78 = load i32, ptr %11, align 4, !tbaa !9
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %11, align 4, !tbaa !9
  br label %39, !llvm.loop !11

80:                                               ; preds = %39
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.bignum256, ptr %81, i32 0, i32 0
  %83 = load i32, ptr %11, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [9 x i32], ptr %82, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !9
  %87 = load i32, ptr %22, align 4, !tbaa !9
  %88 = or i32 %87, %86
  store i32 %88, ptr %22, align 4, !tbaa !9
  %89 = load i32, ptr %21, align 4, !tbaa !9
  %90 = add i32 %89, 16777215
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.bignum256, ptr %91, i32 0, i32 0
  %93 = load i32, ptr %11, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [9 x i32], ptr %92, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !9
  %97 = add i32 %90, %96
  %98 = load ptr, ptr %6, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.ecdsa_curve, ptr %98, i32 0, i32 2
  %100 = getelementptr inbounds %struct.bignum256, ptr %99, i32 0, i32 0
  %101 = load i32, ptr %11, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [9 x i32], ptr %100, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !9
  %105 = load i32, ptr %15, align 4, !tbaa !9
  %106 = and i32 %104, %105
  %107 = sub i32 %97, %106
  %108 = load i32, ptr %11, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [9 x i32], ptr @point_multiply.a, i64 0, i64 %109
  store i32 %107, ptr %110, align 4, !tbaa !9
  %111 = load i32, ptr @point_multiply.a, align 4, !tbaa !9
  %112 = and i32 %111, 1
  %113 = icmp ne i32 %112, 0
  br i1 %113, label %114, label %115

114:                                              ; preds = %80
  br label %116

115:                                              ; preds = %80
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 443, ptr noundef @__PRETTY_FUNCTION__.point_multiply) #7
  unreachable

116:                                              ; preds = %114
  %117 = load i32, ptr %22, align 4, !tbaa !9
  %118 = icmp ne i32 %117, 0
  br i1 %118, label %121, label %119

119:                                              ; preds = %116
  %120 = load ptr, ptr %9, align 8, !tbaa !5
  call void @point_set_infinity(ptr noundef %120)
  store i32 1, ptr %5, align 4
  store i32 1, ptr %23, align 4
  br label %228

121:                                              ; preds = %116
  %122 = getelementptr inbounds [8 x %struct.curve_point], ptr %19, i64 0, i64 7
  %123 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %122, ptr align 4 %123, i64 72, i1 false), !tbaa.struct !13
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = getelementptr inbounds [8 x %struct.curve_point], ptr %19, i64 0, i64 7
  call void @point_double(ptr noundef %124, ptr noundef %125)
  %126 = getelementptr inbounds [8 x %struct.curve_point], ptr %19, i64 0, i64 0
  %127 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %126, ptr align 4 %127, i64 72, i1 false), !tbaa.struct !13
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %128

128:                                              ; preds = %144, %121
  %129 = load i32, ptr %10, align 4, !tbaa !9
  %130 = icmp slt i32 %129, 8
  br i1 %130, label %131, label %147

131:                                              ; preds = %128
  %132 = load i32, ptr %10, align 4, !tbaa !9
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [8 x %struct.curve_point], ptr %19, i64 0, i64 %133
  %135 = getelementptr inbounds [8 x %struct.curve_point], ptr %19, i64 0, i64 7
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %134, ptr align 8 %135, i64 72, i1 false), !tbaa.struct !13
  %136 = load ptr, ptr %6, align 8, !tbaa !5
  %137 = load i32, ptr %10, align 4, !tbaa !9
  %138 = sub nsw i32 %137, 1
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [8 x %struct.curve_point], ptr %19, i64 0, i64 %139
  %141 = load i32, ptr %10, align 4, !tbaa !9
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [8 x %struct.curve_point], ptr %19, i64 0, i64 %142
  call void @point_add(ptr noundef %136, ptr noundef %140, ptr noundef %143)
  br label %144

144:                                              ; preds = %131
  %145 = load i32, ptr %10, align 4, !tbaa !9
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %10, align 4, !tbaa !9
  br label %128, !llvm.loop !15

147:                                              ; preds = %128
  store ptr getelementptr inbounds ([9 x i32], ptr @point_multiply.a, i64 0, i64 8), ptr %12, align 8, !tbaa !5
  %148 = load ptr, ptr %12, align 8, !tbaa !5
  %149 = load i32, ptr %148, align 4, !tbaa !9
  store i32 %149, ptr %13, align 4, !tbaa !9
  store i32 20, ptr %14, align 4, !tbaa !9
  %150 = load i32, ptr %13, align 4, !tbaa !9
  %151 = load i32, ptr %14, align 4, !tbaa !9
  %152 = lshr i32 %150, %151
  store i32 %152, ptr %16, align 4, !tbaa !9
  %153 = load i32, ptr %16, align 4, !tbaa !9
  %154 = lshr i32 %153, 4
  %155 = sub i32 %154, 1
  store i32 %155, ptr %17, align 4, !tbaa !9
  %156 = load i32, ptr %17, align 4, !tbaa !9
  %157 = load i32, ptr %16, align 4, !tbaa !9
  %158 = xor i32 %157, %156
  store i32 %158, ptr %16, align 4, !tbaa !9
  %159 = load i32, ptr %16, align 4, !tbaa !9
  %160 = and i32 %159, 15
  store i32 %160, ptr %16, align 4, !tbaa !9
  %161 = load i32, ptr %16, align 4, !tbaa !9
  %162 = lshr i32 %161, 1
  %163 = zext i32 %162 to i64
  %164 = getelementptr inbounds [8 x %struct.curve_point], ptr %19, i64 0, i64 %163
  %165 = load ptr, ptr %20, align 8, !tbaa !5
  call void @curve_to_jacobian(ptr noundef %164, ptr noundef @point_multiply.jres, ptr noundef %165)
  store i32 62, ptr %10, align 4, !tbaa !9
  br label %166

166:                                              ; preds = %219, %147
  %167 = load i32, ptr %10, align 4, !tbaa !9
  %168 = icmp sge i32 %167, 0
  br i1 %168, label %169, label %222

169:                                              ; preds = %166
  %170 = load ptr, ptr %6, align 8, !tbaa !5
  call void @point_jacobian_double(ptr noundef @point_multiply.jres, ptr noundef %170)
  %171 = load ptr, ptr %6, align 8, !tbaa !5
  call void @point_jacobian_double(ptr noundef @point_multiply.jres, ptr noundef %171)
  %172 = load ptr, ptr %6, align 8, !tbaa !5
  call void @point_jacobian_double(ptr noundef @point_multiply.jres, ptr noundef %172)
  %173 = load ptr, ptr %6, align 8, !tbaa !5
  call void @point_jacobian_double(ptr noundef @point_multiply.jres, ptr noundef %173)
  %174 = load i32, ptr %14, align 4, !tbaa !9
  %175 = sub nsw i32 %174, 4
  store i32 %175, ptr %14, align 4, !tbaa !9
  %176 = load i32, ptr %14, align 4, !tbaa !9
  %177 = icmp slt i32 %176, 0
  br i1 %177, label %178, label %193

178:                                              ; preds = %169
  %179 = load i32, ptr %13, align 4, !tbaa !9
  %180 = load i32, ptr %14, align 4, !tbaa !9
  %181 = sub nsw i32 0, %180
  %182 = shl i32 %179, %181
  store i32 %182, ptr %16, align 4, !tbaa !9
  %183 = load ptr, ptr %12, align 8, !tbaa !5
  %184 = getelementptr inbounds i32, ptr %183, i32 -1
  store ptr %184, ptr %12, align 8, !tbaa !5
  %185 = load i32, ptr %184, align 4, !tbaa !9
  store i32 %185, ptr %13, align 4, !tbaa !9
  %186 = load i32, ptr %14, align 4, !tbaa !9
  %187 = add nsw i32 %186, 29
  store i32 %187, ptr %14, align 4, !tbaa !9
  %188 = load i32, ptr %13, align 4, !tbaa !9
  %189 = load i32, ptr %14, align 4, !tbaa !9
  %190 = lshr i32 %188, %189
  %191 = load i32, ptr %16, align 4, !tbaa !9
  %192 = or i32 %191, %190
  store i32 %192, ptr %16, align 4, !tbaa !9
  br label %197

193:                                              ; preds = %169
  %194 = load i32, ptr %13, align 4, !tbaa !9
  %195 = load i32, ptr %14, align 4, !tbaa !9
  %196 = lshr i32 %194, %195
  store i32 %196, ptr %16, align 4, !tbaa !9
  br label %197

197:                                              ; preds = %193, %178
  %198 = load i32, ptr %16, align 4, !tbaa !9
  %199 = and i32 %198, 31
  store i32 %199, ptr %16, align 4, !tbaa !9
  %200 = load i32, ptr %16, align 4, !tbaa !9
  %201 = lshr i32 %200, 4
  %202 = sub i32 %201, 1
  store i32 %202, ptr %18, align 4, !tbaa !9
  %203 = load i32, ptr %18, align 4, !tbaa !9
  %204 = load i32, ptr %16, align 4, !tbaa !9
  %205 = xor i32 %204, %203
  store i32 %205, ptr %16, align 4, !tbaa !9
  %206 = load i32, ptr %16, align 4, !tbaa !9
  %207 = and i32 %206, 15
  store i32 %207, ptr %16, align 4, !tbaa !9
  %208 = load i32, ptr %17, align 4, !tbaa !9
  %209 = load i32, ptr %18, align 4, !tbaa !9
  %210 = xor i32 %208, %209
  %211 = and i32 %210, 1
  %212 = load ptr, ptr %20, align 8, !tbaa !5
  call void @bn_cnegate(i32 noundef %211, ptr noundef getelementptr inbounds (%struct.jacobian_curve_point, ptr @point_multiply.jres, i32 0, i32 2), ptr noundef %212)
  %213 = load i32, ptr %16, align 4, !tbaa !9
  %214 = lshr i32 %213, 1
  %215 = zext i32 %214 to i64
  %216 = getelementptr inbounds [8 x %struct.curve_point], ptr %19, i64 0, i64 %215
  %217 = load ptr, ptr %6, align 8, !tbaa !5
  call void @point_jacobian_add(ptr noundef %216, ptr noundef @point_multiply.jres, ptr noundef %217)
  %218 = load i32, ptr %18, align 4, !tbaa !9
  store i32 %218, ptr %17, align 4, !tbaa !9
  br label %219

219:                                              ; preds = %197
  %220 = load i32, ptr %10, align 4, !tbaa !9
  %221 = add nsw i32 %220, -1
  store i32 %221, ptr %10, align 4, !tbaa !9
  br label %166, !llvm.loop !16

222:                                              ; preds = %166
  %223 = load i32, ptr %17, align 4, !tbaa !9
  %224 = and i32 %223, 1
  %225 = load ptr, ptr %20, align 8, !tbaa !5
  call void @bn_cnegate(i32 noundef %224, ptr noundef getelementptr inbounds (%struct.jacobian_curve_point, ptr @point_multiply.jres, i32 0, i32 2), ptr noundef %225)
  %226 = load ptr, ptr %9, align 8, !tbaa !5
  %227 = load ptr, ptr %20, align 8, !tbaa !5
  call void @jacobian_to_curve(ptr noundef @point_multiply.jres, ptr noundef %226, ptr noundef %227)
  call void @memzero(ptr noundef @point_multiply.a, i64 noundef 36)
  call void @memzero(ptr noundef @point_multiply.jres, i64 noundef 108)
  store i32 0, ptr %5, align 4
  store i32 1, ptr %23, align 4
  br label %228

228:                                              ; preds = %222, %119
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 576, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %229

229:                                              ; preds = %228, %29
  %230 = load i32, ptr %5, align 4
  ret i32 %230
}

declare i32 @bn_is_less(ptr noundef, ptr noundef) #5

declare void @bn_cnegate(i32 noundef, ptr noundef, ptr noundef) #5

declare void @memzero(ptr noundef, i64 noundef) #5

attributes #0 = { nocallback nofree 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { noreturn nounwind "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 #5 = { "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 #6 = { nounwind }
attributes #7 = { noreturn 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{i64 0, i64 36, !14, i64 36, i64 36, !14}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}


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

%struct.bignum256 = type { [9 x i32] }
%struct.jacobian_curve_point = type { %struct.bignum256, %struct.bignum256, %struct.bignum256 }
%struct.curve_point = type { %struct.bignum256, %struct.bignum256 }

@.str.1 = external hidden unnamed_addr constant [67 x i8], align 1
@point_multiply.a = external hidden global %struct.bignum256, align 4
@point_multiply.jres = external hidden global %struct.jacobian_curve_point, align 4
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1
@__PRETTY_FUNCTION__.point_multiply = external hidden unnamed_addr constant [95 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @point_set_infinity(ptr 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) #2

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

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @point_multiply(ptr noundef %0, ptr noundef %1, ptr nocapture noundef readonly %2, ptr noundef %3) local_unnamed_addr #1 {
  %5 = alloca [8 x %struct.curve_point], align 16
  %6 = getelementptr inbounds i8, ptr %0, i64 108
  %7 = tail call i32 @bn_is_less(ptr noundef %1, ptr noundef nonnull %6) #6
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %153, label %8

8:                                                ; preds = %4
  %9 = load i32, ptr %1, align 4, !tbaa !5
  %10 = and i32 %9, 1
  %11 = add nsw i32 %10, -1
  call void @llvm.lifetime.start.p0(i64 576, ptr nonnull %5) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(576) %5, i8 0, i64 512, i1 false)
  %12 = load i32, ptr %6, align 4, !tbaa !5
  %13 = and i32 %12, %11
  %14 = add i32 %9, 536870912
  %15 = sub i32 %14, %13
  %16 = and i32 %15, 536870911
  store i32 %16, ptr @point_multiply.a, align 4, !tbaa !5
  %17 = lshr i32 %15, 29
  %18 = getelementptr inbounds i8, ptr %1, i64 4
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %0, i64 112
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = and i32 %21, %11
  %23 = add nuw nsw i32 %17, 536870911
  %24 = add i32 %23, %19
  %25 = sub i32 %24, %22
  %26 = and i32 %25, 536870911
  store i32 %26, ptr getelementptr inbounds (i8, ptr @point_multiply.a, i64 4), align 4, !tbaa !5
  %27 = lshr i32 %25, 29
  %28 = getelementptr inbounds i8, ptr %1, i64 8
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %0, i64 116
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = and i32 %31, %11
  %33 = add nuw nsw i32 %27, 536870911
  %34 = add i32 %33, %29
  %35 = sub i32 %34, %32
  %36 = and i32 %35, 536870911
  store i32 %36, ptr getelementptr inbounds (i8, ptr @point_multiply.a, i64 8), align 4, !tbaa !5
  %37 = lshr i32 %35, 29
  %38 = getelementptr inbounds i8, ptr %1, i64 12
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %0, i64 120
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = and i32 %41, %11
  %43 = add nuw nsw i32 %37, 536870911
  %44 = add i32 %43, %39
  %45 = sub i32 %44, %42
  %46 = and i32 %45, 536870911
  store i32 %46, ptr getelementptr inbounds (i8, ptr @point_multiply.a, i64 12), align 4, !tbaa !5
  %47 = lshr i32 %45, 29
  %48 = getelementptr inbounds i8, ptr %1, i64 16
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = getelementptr inbounds i8, ptr %0, i64 124
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = and i32 %51, %11
  %53 = add nuw nsw i32 %47, 536870911
  %54 = add i32 %53, %49
  %55 = sub i32 %54, %52
  %56 = and i32 %55, 536870911
  store i32 %56, ptr getelementptr inbounds (i8, ptr @point_multiply.a, i64 16), align 4, !tbaa !5
  %57 = lshr i32 %55, 29
  %58 = getelementptr inbounds i8, ptr %1, i64 20
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %0, i64 128
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = and i32 %61, %11
  %63 = add nuw nsw i32 %57, 536870911
  %64 = add i32 %63, %59
  %65 = sub i32 %64, %62
  %66 = and i32 %65, 536870911
  store i32 %66, ptr getelementptr inbounds (i8, ptr @point_multiply.a, i64 20), align 4, !tbaa !5
  %67 = lshr i32 %65, 29
  %68 = getelementptr inbounds i8, ptr %1, i64 24
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = getelementptr inbounds i8, ptr %0, i64 132
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = and i32 %71, %11
  %73 = add nuw nsw i32 %67, 536870911
  %74 = add i32 %73, %69
  %75 = sub i32 %74, %72
  %76 = and i32 %75, 536870911
  store i32 %76, ptr getelementptr inbounds (i8, ptr @point_multiply.a, i64 24), align 4, !tbaa !5
  %77 = lshr i32 %75, 29
  %78 = getelementptr inbounds i8, ptr %1, i64 28
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %0, i64 136
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = and i32 %81, %11
  %83 = add nuw nsw i32 %77, 536870911
  %84 = add i32 %83, %79
  %85 = sub i32 %84, %82
  %86 = and i32 %85, 536870911
  store i32 %86, ptr getelementptr inbounds (i8, ptr @point_multiply.a, i64 28), align 4, !tbaa !5
  %87 = lshr i32 %85, 29
  %88 = getelementptr inbounds i8, ptr %1, i64 32
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = add nuw nsw i32 %87, 16777215
  %91 = add i32 %90, %89
  %92 = getelementptr inbounds i8, ptr %0, i64 140
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = and i32 %93, %11
  %95 = sub i32 %91, %94
  store i32 %95, ptr getelementptr inbounds (i8, ptr @point_multiply.a, i64 32), align 4, !tbaa !5
  %96 = and i32 %15, 1
  %.not95 = icmp eq i32 %96, 0
  br i1 %.not95, label %97, label %98

97:                                               ; preds = %8
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 443, ptr noundef nonnull @__PRETTY_FUNCTION__.point_multiply) #7
  unreachable

98:                                               ; preds = %8
  %99 = or i32 %19, %9
  %100 = or i32 %29, %99
  %101 = or i32 %39, %100
  %102 = or i32 %49, %101
  %103 = or i32 %59, %102
  %104 = or i32 %69, %103
  %105 = or i32 %79, %104
  %106 = or i32 %89, %105
  %.not96 = icmp eq i32 %106, 0
  br i1 %.not96, label %107, label %108

107:                                              ; preds = %98
  tail call void @point_set_infinity(ptr noundef %3)
  br label %152

108:                                              ; preds = %98
  %109 = getelementptr inbounds i8, ptr %5, i64 504
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %109, ptr noundef nonnull align 4 dereferenceable(72) %2, i64 72, i1 false), !tbaa.struct !9
  call void @point_double(ptr noundef nonnull %0, ptr noundef nonnull %109)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(72) %5, ptr noundef nonnull align 4 dereferenceable(72) %2, i64 72, i1 false), !tbaa.struct !9
  %110 = getelementptr inbounds i8, ptr %5, i64 72
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %110, ptr noundef nonnull align 8 dereferenceable(72) %109, i64 72, i1 false), !tbaa.struct !9
  call void @point_add(ptr noundef nonnull %0, ptr noundef nonnull %5, ptr noundef nonnull %110)
  %111 = getelementptr inbounds i8, ptr %5, i64 144
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(72) %111, ptr noundef nonnull align 8 dereferenceable(72) %109, i64 72, i1 false), !tbaa.struct !9
  call void @point_add(ptr noundef nonnull %0, ptr noundef nonnull %110, ptr noundef nonnull %111)
  %112 = getelementptr inbounds i8, ptr %5, i64 216
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %112, ptr noundef nonnull align 8 dereferenceable(72) %109, i64 72, i1 false), !tbaa.struct !9
  call void @point_add(ptr noundef nonnull %0, ptr noundef nonnull %111, ptr noundef nonnull %112)
  %113 = getelementptr inbounds i8, ptr %5, i64 288
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(72) %113, ptr noundef nonnull align 8 dereferenceable(72) %109, i64 72, i1 false), !tbaa.struct !9
  call void @point_add(ptr noundef nonnull %0, ptr noundef nonnull %112, ptr noundef nonnull %113)
  %114 = getelementptr inbounds i8, ptr %5, i64 360
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %114, ptr noundef nonnull align 8 dereferenceable(72) %109, i64 72, i1 false), !tbaa.struct !9
  call void @point_add(ptr noundef nonnull %0, ptr noundef nonnull %113, ptr noundef nonnull %114)
  %115 = getelementptr inbounds i8, ptr %5, i64 432
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(72) %115, ptr noundef nonnull align 8 dereferenceable(72) %109, i64 72, i1 false), !tbaa.struct !9
  call void @point_add(ptr noundef nonnull %0, ptr noundef nonnull %114, ptr noundef nonnull %115)
  call void @point_add(ptr noundef nonnull %0, ptr noundef nonnull %115, ptr noundef nonnull %109)
  %116 = load i32, ptr getelementptr inbounds (i8, ptr @point_multiply.a, i64 32), align 4, !tbaa !5
  %117 = lshr i32 %116, 24
  %118 = add nsw i32 %117, -1
  %119 = lshr i32 %116, 21
  %120 = lshr i32 %118, 1
  %121 = xor i32 %120, %119
  %122 = and i32 %121, 7
  %123 = zext nneg i32 %122 to i64
  %124 = getelementptr inbounds [8 x %struct.curve_point], ptr %5, i64 0, i64 %123
  call void @curve_to_jacobian(ptr noundef nonnull %124, ptr noundef nonnull @point_multiply.jres, ptr noundef nonnull %0)
  br label %125

125:                                              ; preds = %108, %138
  %.082106 = phi i32 [ %118, %108 ], [ %141, %138 ]
  %.185105 = phi i32 [ 62, %108 ], [ %149, %138 ]
  %.086104 = phi i32 [ 20, %108 ], [ %.187, %138 ]
  %.088103 = phi i32 [ %116, %108 ], [ %.189, %138 ]
  %.090102 = phi ptr [ getelementptr inbounds (i8, ptr @point_multiply.a, i64 32), %108 ], [ %.191, %138 ]
  call void @point_jacobian_double(ptr noundef nonnull @point_multiply.jres, ptr noundef %0)
  call void @point_jacobian_double(ptr noundef nonnull @point_multiply.jres, ptr noundef %0)
  call void @point_jacobian_double(ptr noundef nonnull @point_multiply.jres, ptr noundef %0)
  call void @point_jacobian_double(ptr noundef nonnull @point_multiply.jres, ptr noundef %0)
  %126 = icmp slt i32 %.086104, 4
  br i1 %126, label %127, label %135

127:                                              ; preds = %125
  %128 = sub nsw i32 4, %.086104
  %129 = shl i32 %.088103, %128
  %130 = getelementptr inbounds i8, ptr %.090102, i64 -4
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %132 = add nsw i32 %.086104, 25
  %133 = lshr i32 %131, %132
  %134 = or i32 %133, %129
  br label %138

135:                                              ; preds = %125
  %136 = add nsw i32 %.086104, -4
  %137 = lshr i32 %.088103, %136
  br label %138

138:                                              ; preds = %135, %127
  %.191 = phi ptr [ %130, %127 ], [ %.090102, %135 ]
  %.189 = phi i32 [ %131, %127 ], [ %.088103, %135 ]
  %.187 = phi i32 [ %132, %127 ], [ %136, %135 ]
  %.083 = phi i32 [ %134, %127 ], [ %137, %135 ]
  %139 = lshr i32 %.083, 4
  %140 = and i32 %139, 1
  %141 = add nsw i32 %140, -1
  %142 = xor i32 %141, %.083
  %143 = xor i32 %141, %.082106
  %144 = and i32 %143, 1
  call void @bn_cnegate(i32 noundef %144, ptr noundef nonnull getelementptr inbounds (i8, ptr @point_multiply.jres, i64 72), ptr noundef %0) #6
  %145 = lshr i32 %142, 1
  %146 = and i32 %145, 7
  %147 = zext nneg i32 %146 to i64
  %148 = getelementptr inbounds [8 x %struct.curve_point], ptr %5, i64 0, i64 %147
  call void @point_jacobian_add(ptr noundef nonnull %148, ptr noundef nonnull @point_multiply.jres, ptr noundef %0)
  %149 = add nsw i32 %.185105, -1
  %.not112 = icmp eq i32 %.185105, 0
  br i1 %.not112, label %150, label %125, !llvm.loop !11

150:                                              ; preds = %138
  %151 = and i32 %141, 1
  call void @bn_cnegate(i32 noundef %151, ptr noundef nonnull getelementptr inbounds (i8, ptr @point_multiply.jres, i64 72), ptr noundef %0) #6
  call void @jacobian_to_curve(ptr noundef nonnull @point_multiply.jres, ptr noundef %3, ptr noundef %0)
  call void @memzero(ptr noundef nonnull @point_multiply.a, i64 noundef 36) #6
  call void @memzero(ptr noundef nonnull @point_multiply.jres, i64 noundef 108) #6
  br label %152

152:                                              ; preds = %150, %107
  %.081 = phi i32 [ 0, %150 ], [ 1, %107 ]
  call void @llvm.lifetime.end.p0(i64 576, ptr nonnull %5) #6
  br label %153

153:                                              ; preds = %4, %152
  %.1 = phi i32 [ %.081, %152 ], [ 1, %4 ]
  ret i32 %.1
}

declare i32 @bn_is_less(ptr noundef, ptr noundef) local_unnamed_addr #5

declare void @bn_cnegate(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

declare void @memzero(ptr noundef, i64 noundef) local_unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { noreturn nounwind "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 #5 = { "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 #6 = { nounwind }
attributes #7 = { noreturn 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i64 0, i64 36, !10, i64 36, i64 36, !10}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass