; LLVM IR from square/subzero :: core/trezor-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, [64 x [8 x %struct.curve_point]] }

@.str.1 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [29 x i8], align 1
@__PRETTY_FUNCTION__.point_multiply = external hidden unnamed_addr constant [96 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.5 = external hidden unnamed_addr constant [20 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: 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 @conditional_negate(i32 noundef, ptr noundef, ptr noundef) #1

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

; 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: nounwind uwtable
declare dso_local void @point_jacobian_double(ptr noundef, ptr noundef) #1

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

28:                                               ; preds = %4
  br label %30

29:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 425, ptr noundef @__PRETTY_FUNCTION__.point_multiply) #5
  unreachable

30:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %31 = load ptr, ptr %6, 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 %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 576, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.ecdsa_curve, ptr %37, i32 0, i32 0
  store ptr %38, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 1, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 0, ptr %21, align 4, !tbaa !9
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %39

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

42:                                               ; preds = %39
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.bignum256, ptr %43, i32 0, i32 0
  %45 = load i32, ptr %10, 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 %21, align 4, !tbaa !9
  %50 = or i32 %49, %48
  store i32 %50, ptr %21, align 4, !tbaa !9
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.bignum256, ptr %51, i32 0, i32 0
  %53 = load i32, ptr %10, 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 1073741823, %56
  %58 = load ptr, ptr %5, 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 %10, 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 %14, align 4, !tbaa !9
  %66 = and i32 %64, %65
  %67 = sub i32 %57, %66
  %68 = load i32, ptr %20, align 4, !tbaa !9
  %69 = add i32 %68, %67
  store i32 %69, ptr %20, align 4, !tbaa !9
  %70 = load i32, ptr %20, align 4, !tbaa !9
  %71 = and i32 %70, 1073741823
  %72 = load i32, ptr %10, 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 %20, align 4, !tbaa !9
  %76 = lshr i32 %75, 30
  store i32 %76, ptr %20, align 4, !tbaa !9
  br label %77

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

80:                                               ; preds = %39
  %81 = load ptr, ptr %6, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.bignum256, ptr %81, i32 0, i32 0
  %83 = load i32, ptr %10, 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 %21, align 4, !tbaa !9
  %88 = or i32 %87, %86
  store i32 %88, ptr %21, align 4, !tbaa !9
  %89 = load i32, ptr %20, align 4, !tbaa !9
  %90 = add i32 %89, 65535
  %91 = load ptr, ptr %6, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.bignum256, ptr %91, i32 0, i32 0
  %93 = load i32, ptr %10, 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 %5, 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 %10, 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 %14, align 4, !tbaa !9
  %106 = and i32 %104, %105
  %107 = sub i32 %97, %106
  %108 = load i32, ptr %10, 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.5, ptr noundef @.str.1, i32 noundef 452, ptr noundef @__PRETTY_FUNCTION__.point_multiply) #5
  unreachable

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

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

121:                                              ; preds = %116
  %122 = getelementptr inbounds [8 x %struct.curve_point], ptr %18, i64 0, i64 7
  %123 = load ptr, ptr %7, 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 %5, align 8, !tbaa !5
  %125 = getelementptr inbounds [8 x %struct.curve_point], ptr %18, i64 0, i64 7
  call void @point_double(ptr noundef %124, ptr noundef %125)
  %126 = getelementptr inbounds [8 x %struct.curve_point], ptr %18, i64 0, i64 0
  %127 = load ptr, ptr %7, 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 %9, align 4, !tbaa !9
  br label %128

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

131:                                              ; preds = %128
  %132 = load i32, ptr %9, align 4, !tbaa !9
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [8 x %struct.curve_point], ptr %18, i64 0, i64 %133
  %135 = getelementptr inbounds [8 x %struct.curve_point], ptr %18, 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 %5, align 8, !tbaa !5
  %137 = load i32, ptr %9, 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 %18, i64 0, i64 %139
  %141 = load i32, ptr %9, align 4, !tbaa !9
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [8 x %struct.curve_point], ptr %18, 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 %9, align 4, !tbaa !9
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %9, 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 %11, align 8, !tbaa !5
  %148 = load ptr, ptr %11, align 8, !tbaa !5
  %149 = load i32, ptr %148, align 4, !tbaa !9
  store i32 %149, ptr %12, align 4, !tbaa !9
  store i32 12, ptr %13, align 4, !tbaa !9
  %150 = load i32, ptr %12, align 4, !tbaa !9
  %151 = load i32, ptr %13, align 4, !tbaa !9
  %152 = lshr i32 %150, %151
  store i32 %152, ptr %15, align 4, !tbaa !9
  %153 = load i32, ptr %15, align 4, !tbaa !9
  %154 = lshr i32 %153, 4
  %155 = sub i32 %154, 1
  store i32 %155, ptr %16, align 4, !tbaa !9
  %156 = load i32, ptr %16, align 4, !tbaa !9
  %157 = load i32, ptr %15, align 4, !tbaa !9
  %158 = xor i32 %157, %156
  store i32 %158, ptr %15, align 4, !tbaa !9
  %159 = load i32, ptr %15, align 4, !tbaa !9
  %160 = and i32 %159, 15
  store i32 %160, ptr %15, align 4, !tbaa !9
  %161 = load i32, ptr %15, align 4, !tbaa !9
  %162 = lshr i32 %161, 1
  %163 = zext i32 %162 to i64
  %164 = getelementptr inbounds [8 x %struct.curve_point], ptr %18, i64 0, i64 %163
  %165 = load ptr, ptr %19, align 8, !tbaa !5
  call void @curve_to_jacobian(ptr noundef %164, ptr noundef @point_multiply.jres, ptr noundef %165)
  store i32 62, ptr %9, align 4, !tbaa !9
  br label %166

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

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

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

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

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

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

221:                                              ; preds = %166
  %222 = load i32, ptr %16, align 4, !tbaa !9
  %223 = load ptr, ptr %19, align 8, !tbaa !5
  call void @conditional_negate(i32 noundef %222, ptr noundef getelementptr inbounds (%struct.jacobian_curve_point, ptr @point_multiply.jres, i32 0, i32 2), ptr noundef %223)
  %224 = load ptr, ptr %8, align 8, !tbaa !5
  %225 = load ptr, ptr %19, align 8, !tbaa !5
  call void @jacobian_to_curve(ptr noundef @point_multiply.jres, ptr noundef %224, ptr noundef %225)
  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 %22, align 4
  br label %226

226:                                              ; preds = %221, %119
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 576, 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 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  %227 = load i32, ptr %22, align 4
  switch i32 %227, label %229 [
    i32 0, label %228
    i32 1, label %228
  ]

228:                                              ; preds = %226, %226
  ret void

229:                                              ; preds = %226
  unreachable
}

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

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

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 = { 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 #4 = { "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 = { noreturn nounwind }
attributes #6 = { 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 [75 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [29 x i8], align 1
@__PRETTY_FUNCTION__.point_multiply = external hidden unnamed_addr constant [96 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.5 = external hidden unnamed_addr constant [20 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: 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 @conditional_negate(i32 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 #3

; 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: nounwind uwtable
declare dso_local void @point_jacobian_double(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @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) #5
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %8, label %9

8:                                                ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 425, ptr noundef nonnull @__PRETTY_FUNCTION__.point_multiply) #6
  unreachable

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

98:                                               ; preds = %9
  tail call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 452, ptr noundef nonnull @__PRETTY_FUNCTION__.point_multiply) #6
  unreachable

99:                                               ; preds = %9
  %100 = or i32 %20, %10
  %101 = or i32 %30, %100
  %102 = or i32 %40, %101
  %103 = or i32 %50, %102
  %104 = or i32 %60, %103
  %105 = or i32 %70, %104
  %106 = or i32 %80, %105
  %107 = or i32 %90, %106
  %.not93 = icmp eq i32 %107, 0
  br i1 %.not93, label %108, label %109

108:                                              ; preds = %99
  tail call void @point_set_infinity(ptr noundef %3)
  br label %151

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

126:                                              ; preds = %109, %139
  %.1103 = phi i32 [ 62, %109 ], [ %149, %139 ]
  %.082102 = phi i32 [ %119, %109 ], [ %142, %139 ]
  %.084101 = phi ptr [ getelementptr inbounds (i8, ptr @point_multiply.a, i64 32), %109 ], [ %.185, %139 ]
  %.086100 = phi i32 [ 12, %109 ], [ %.187, %139 ]
  %.08899 = phi i32 [ %117, %109 ], [ %.189, %139 ]
  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)
  %127 = icmp slt i32 %.086100, 4
  br i1 %127, label %128, label %136

128:                                              ; preds = %126
  %129 = sub nsw i32 4, %.086100
  %130 = shl i32 %.08899, %129
  %131 = getelementptr inbounds i8, ptr %.084101, i64 -4
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = add nsw i32 %.086100, 26
  %134 = lshr i32 %132, %133
  %135 = or i32 %134, %130
  br label %139

136:                                              ; preds = %126
  %137 = add nsw i32 %.086100, -4
  %138 = lshr i32 %.08899, %137
  br label %139

139:                                              ; preds = %136, %128
  %.189 = phi i32 [ %132, %128 ], [ %.08899, %136 ]
  %.187 = phi i32 [ %133, %128 ], [ %137, %136 ]
  %.185 = phi ptr [ %131, %128 ], [ %.084101, %136 ]
  %.083 = phi i32 [ %135, %128 ], [ %138, %136 ]
  %140 = lshr i32 %.083, 4
  %141 = and i32 %140, 1
  %142 = add nsw i32 %141, -1
  %143 = xor i32 %142, %.083
  %144 = xor i32 %142, %.082102
  call void @conditional_negate(i32 noundef %144, ptr noundef nonnull getelementptr inbounds (i8, ptr @point_multiply.jres, i64 72), ptr noundef %0)
  %145 = lshr i32 %143, 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 %.1103, -1
  %.not109 = icmp eq i32 %.1103, 0
  br i1 %.not109, label %150, label %126, !llvm.loop !11

150:                                              ; preds = %139
  call void @conditional_negate(i32 noundef %142, ptr noundef nonnull getelementptr inbounds (i8, ptr @point_multiply.jres, i64 72), ptr noundef %0)
  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) #5
  call void @memzero(ptr noundef nonnull @point_multiply.jres, i64 noundef 108) #5
  br label %151

151:                                              ; preds = %150, %108
  call void @llvm.lifetime.end.p0(i64 576, ptr nonnull %5) #5
  ret void
}

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

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

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 = { 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 #4 = { "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 = { nounwind }
attributes #6 = { 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,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass