; LLVM IR from cryspen/libcrux :: sys/hacl/c/src/msvc (Hacl_Bignum)

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

@.str = external hidden unnamed_addr constant [70 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [83 x i8], align 1

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @Hacl_Bignum_Addition_bn_sub_eq_len_u64(i32 noundef, ptr noundef, ptr noundef, ptr noundef) #1

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

declare i32 @printf(ptr noundef, ...) #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #3

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

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

; Function Attrs: nounwind uwtable
define dso_local void @Hacl_Bignum_AlmostMontgomery_bn_almost_mont_reduction_u64(i32 noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4) #6 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i64, align 8
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i64, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i64, align 8
  %23 = alloca ptr, align 8
  %24 = alloca i64, align 8
  %25 = alloca ptr, align 8
  %26 = alloca i32, align 4
  %27 = alloca i64, align 8
  %28 = alloca ptr, align 8
  %29 = alloca i64, align 8
  %30 = alloca i64, align 8
  %31 = alloca ptr, align 8
  %32 = alloca i64, align 8
  %33 = alloca i64, align 8
  %34 = alloca ptr, align 8
  %35 = alloca i64, align 8
  %36 = alloca i64, align 8
  %37 = alloca i32, align 4
  %38 = alloca ptr, align 8
  %39 = alloca i64, align 8
  store i32 %0, ptr %6, align 4, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !9
  store i64 %2, ptr %8, align 8, !tbaa !11
  store ptr %3, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  store i64 0, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %186, %5
  %41 = load i32, ptr %12, align 4, !tbaa !5
  %42 = load i32, ptr %6, align 4, !tbaa !5
  %43 = icmp ult i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  store i32 2, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %189

45:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %46 = load i64, ptr %8, align 8, !tbaa !11
  %47 = load ptr, ptr %9, align 8, !tbaa !9
  %48 = load i32, ptr %12, align 4, !tbaa !5
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds i64, ptr %47, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !11
  %52 = mul i64 %46, %51
  store i64 %52, ptr %14, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %53 = load ptr, ptr %9, align 8, !tbaa !9
  %54 = load i32, ptr %12, align 4, !tbaa !5
  %55 = zext i32 %54 to i64
  %56 = getelementptr inbounds i64, ptr %53, i64 %55
  store ptr %56, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  store i64 0, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %134, %45
  %58 = load i32, ptr %17, align 4, !tbaa !5
  %59 = load i32, ptr %6, align 4, !tbaa !5
  %60 = udiv i32 %59, 4
  %61 = icmp ult i32 %58, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %57
  store i32 5, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %137

63:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %64 = load ptr, ptr %7, align 8, !tbaa !9
  %65 = load i32, ptr %17, align 4, !tbaa !5
  %66 = mul i32 4, %65
  %67 = zext i32 %66 to i64
  %68 = getelementptr inbounds i64, ptr %64, i64 %67
  %69 = load i64, ptr %68, align 8, !tbaa !11
  store i64 %69, ptr %18, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %70 = load ptr, ptr %15, align 8, !tbaa !9
  %71 = load i32, ptr %17, align 4, !tbaa !5
  %72 = mul i32 4, %71
  %73 = zext i32 %72 to i64
  %74 = getelementptr inbounds i64, ptr %70, i64 %73
  store ptr %74, ptr %19, align 8, !tbaa !9
  %75 = load i64, ptr %18, align 8, !tbaa !11
  %76 = load i64, ptr %14, align 8, !tbaa !11
  %77 = load i64, ptr %16, align 8, !tbaa !11
  %78 = load ptr, ptr %19, align 8, !tbaa !9
  %79 = call i64 @Hacl_Bignum_Base_mul_wide_add2_u64(i64 noundef %75, i64 noundef %76, i64 noundef %77, ptr noundef %78)
  store i64 %79, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %80 = load ptr, ptr %7, align 8, !tbaa !9
  %81 = load i32, ptr %17, align 4, !tbaa !5
  %82 = mul i32 4, %81
  %83 = add i32 %82, 1
  %84 = zext i32 %83 to i64
  %85 = getelementptr inbounds i64, ptr %80, i64 %84
  %86 = load i64, ptr %85, align 8, !tbaa !11
  store i64 %86, ptr %20, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %87 = load ptr, ptr %15, align 8, !tbaa !9
  %88 = load i32, ptr %17, align 4, !tbaa !5
  %89 = mul i32 4, %88
  %90 = zext i32 %89 to i64
  %91 = getelementptr inbounds i64, ptr %87, i64 %90
  %92 = getelementptr inbounds i64, ptr %91, i64 1
  store ptr %92, ptr %21, align 8, !tbaa !9
  %93 = load i64, ptr %20, align 8, !tbaa !11
  %94 = load i64, ptr %14, align 8, !tbaa !11
  %95 = load i64, ptr %16, align 8, !tbaa !11
  %96 = load ptr, ptr %21, align 8, !tbaa !9
  %97 = call i64 @Hacl_Bignum_Base_mul_wide_add2_u64(i64 noundef %93, i64 noundef %94, i64 noundef %95, ptr noundef %96)
  store i64 %97, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %98 = load ptr, ptr %7, align 8, !tbaa !9
  %99 = load i32, ptr %17, align 4, !tbaa !5
  %100 = mul i32 4, %99
  %101 = add i32 %100, 2
  %102 = zext i32 %101 to i64
  %103 = getelementptr inbounds i64, ptr %98, i64 %102
  %104 = load i64, ptr %103, align 8, !tbaa !11
  store i64 %104, ptr %22, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %105 = load ptr, ptr %15, align 8, !tbaa !9
  %106 = load i32, ptr %17, align 4, !tbaa !5
  %107 = mul i32 4, %106
  %108 = zext i32 %107 to i64
  %109 = getelementptr inbounds i64, ptr %105, i64 %108
  %110 = getelementptr inbounds i64, ptr %109, i64 2
  store ptr %110, ptr %23, align 8, !tbaa !9
  %111 = load i64, ptr %22, align 8, !tbaa !11
  %112 = load i64, ptr %14, align 8, !tbaa !11
  %113 = load i64, ptr %16, align 8, !tbaa !11
  %114 = load ptr, ptr %23, align 8, !tbaa !9
  %115 = call i64 @Hacl_Bignum_Base_mul_wide_add2_u64(i64 noundef %111, i64 noundef %112, i64 noundef %113, ptr noundef %114)
  store i64 %115, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %116 = load ptr, ptr %7, align 8, !tbaa !9
  %117 = load i32, ptr %17, align 4, !tbaa !5
  %118 = mul i32 4, %117
  %119 = add i32 %118, 3
  %120 = zext i32 %119 to i64
  %121 = getelementptr inbounds i64, ptr %116, i64 %120
  %122 = load i64, ptr %121, align 8, !tbaa !11
  store i64 %122, ptr %24, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %123 = load ptr, ptr %15, align 8, !tbaa !9
  %124 = load i32, ptr %17, align 4, !tbaa !5
  %125 = mul i32 4, %124
  %126 = zext i32 %125 to i64
  %127 = getelementptr inbounds i64, ptr %123, i64 %126
  %128 = getelementptr inbounds i64, ptr %127, i64 3
  store ptr %128, ptr %25, align 8, !tbaa !9
  %129 = load i64, ptr %24, align 8, !tbaa !11
  %130 = load i64, ptr %14, align 8, !tbaa !11
  %131 = load i64, ptr %16, align 8, !tbaa !11
  %132 = load ptr, ptr %25, align 8, !tbaa !9
  %133 = call i64 @Hacl_Bignum_Base_mul_wide_add2_u64(i64 noundef %129, i64 noundef %130, i64 noundef %131, ptr noundef %132)
  store i64 %133, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %134

134:                                              ; preds = %63
  %135 = load i32, ptr %17, align 4, !tbaa !5
  %136 = add i32 %135, 1
  store i32 %136, ptr %17, align 4, !tbaa !5
  br label %57, !llvm.loop !13

137:                                              ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #7
  %138 = load i32, ptr %6, align 4, !tbaa !5
  %139 = udiv i32 %138, 4
  %140 = mul i32 %139, 4
  store i32 %140, ptr %26, align 4, !tbaa !5
  br label %141

141:                                              ; preds = %161, %137
  %142 = load i32, ptr %26, align 4, !tbaa !5
  %143 = load i32, ptr %6, align 4, !tbaa !5
  %144 = icmp ult i32 %142, %143
  br i1 %144, label %146, label %145

145:                                              ; preds = %141
  store i32 8, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  br label %164

146:                                              ; preds = %141
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #7
  %147 = load ptr, ptr %7, align 8, !tbaa !9
  %148 = load i32, ptr %26, align 4, !tbaa !5
  %149 = zext i32 %148 to i64
  %150 = getelementptr inbounds i64, ptr %147, i64 %149
  %151 = load i64, ptr %150, align 8, !tbaa !11
  store i64 %151, ptr %27, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #7
  %152 = load ptr, ptr %15, align 8, !tbaa !9
  %153 = load i32, ptr %26, align 4, !tbaa !5
  %154 = zext i32 %153 to i64
  %155 = getelementptr inbounds i64, ptr %152, i64 %154
  store ptr %155, ptr %28, align 8, !tbaa !9
  %156 = load i64, ptr %27, align 8, !tbaa !11
  %157 = load i64, ptr %14, align 8, !tbaa !11
  %158 = load i64, ptr %16, align 8, !tbaa !11
  %159 = load ptr, ptr %28, align 8, !tbaa !9
  %160 = call i64 @Hacl_Bignum_Base_mul_wide_add2_u64(i64 noundef %156, i64 noundef %157, i64 noundef %158, ptr noundef %159)
  store i64 %160, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #7
  br label %161

161:                                              ; preds = %146
  %162 = load i32, ptr %26, align 4, !tbaa !5
  %163 = add i32 %162, 1
  store i32 %163, ptr %26, align 4, !tbaa !5
  br label %141, !llvm.loop !15

164:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #7
  %165 = load i64, ptr %16, align 8, !tbaa !11
  store i64 %165, ptr %29, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #7
  %166 = load i64, ptr %29, align 8, !tbaa !11
  store i64 %166, ptr %30, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #7
  %167 = load ptr, ptr %9, align 8, !tbaa !9
  %168 = load i32, ptr %6, align 4, !tbaa !5
  %169 = zext i32 %168 to i64
  %170 = getelementptr inbounds i64, ptr %167, i64 %169
  %171 = load i32, ptr %12, align 4, !tbaa !5
  %172 = zext i32 %171 to i64
  %173 = getelementptr inbounds i64, ptr %170, i64 %172
  store ptr %173, ptr %31, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #7
  %174 = load ptr, ptr %9, align 8, !tbaa !9
  %175 = load i32, ptr %6, align 4, !tbaa !5
  %176 = load i32, ptr %12, align 4, !tbaa !5
  %177 = add i32 %175, %176
  %178 = zext i32 %177 to i64
  %179 = getelementptr inbounds i64, ptr %174, i64 %178
  %180 = load i64, ptr %179, align 8, !tbaa !11
  store i64 %180, ptr %32, align 8, !tbaa !11
  %181 = load i64, ptr %11, align 8, !tbaa !11
  %182 = load i64, ptr %30, align 8, !tbaa !11
  %183 = load i64, ptr %32, align 8, !tbaa !11
  %184 = load ptr, ptr %31, align 8, !tbaa !9
  %185 = call i64 @Hacl_IntTypes_Intrinsics_add_carry_u64(i64 noundef %181, i64 noundef %182, i64 noundef %183, ptr noundef %184)
  store i64 %185, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %186

186:                                              ; preds = %164
  %187 = load i32, ptr %12, align 4, !tbaa !5
  %188 = add i32 %187, 1
  store i32 %188, ptr %12, align 4, !tbaa !5
  br label %40, !llvm.loop !16

189:                                              ; preds = %44
  %190 = load ptr, ptr %10, align 8, !tbaa !9
  %191 = load ptr, ptr %9, align 8, !tbaa !9
  %192 = load i32, ptr %6, align 4, !tbaa !5
  %193 = zext i32 %192 to i64
  %194 = getelementptr inbounds i64, ptr %191, i64 %193
  %195 = load i32, ptr %6, align 4, !tbaa !5
  %196 = load i32, ptr %6, align 4, !tbaa !5
  %197 = add i32 %195, %196
  %198 = load i32, ptr %6, align 4, !tbaa !5
  %199 = sub i32 %197, %198
  %200 = zext i32 %199 to i64
  %201 = mul i64 %200, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %190, ptr align 8 %194, i64 %201, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #7
  %202 = load i64, ptr %11, align 8, !tbaa !11
  store i64 %202, ptr %33, align 8, !tbaa !11
  br label %203

203:                                              ; preds = %189
  %204 = load i32, ptr %6, align 4, !tbaa !5
  %205 = zext i32 %204 to i64
  %206 = icmp ugt i64 %205, 2305843009213693951
  br i1 %206, label %207, label %209

207:                                              ; preds = %203
  %208 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 1344)
  call void @exit(i32 noundef 253) #8
  unreachable

209:                                              ; preds = %203
  br label %210

210:                                              ; preds = %209
  br label %211

211:                                              ; preds = %210
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #7
  %212 = load i32, ptr %6, align 4, !tbaa !5
  %213 = zext i32 %212 to i64
  %214 = mul i64 %213, 8
  %215 = alloca i8, i64 %214, align 16
  store ptr %215, ptr %34, align 8, !tbaa !9
  %216 = load ptr, ptr %34, align 8, !tbaa !9
  %217 = load i32, ptr %6, align 4, !tbaa !5
  %218 = zext i32 %217 to i64
  %219 = mul i64 %218, 8
  call void @llvm.memset.p0.i64(ptr align 8 %216, i8 0, i64 %219, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %35) #7
  %220 = load i32, ptr %6, align 4, !tbaa !5
  %221 = load ptr, ptr %10, align 8, !tbaa !9
  %222 = load ptr, ptr %7, align 8, !tbaa !9
  %223 = load ptr, ptr %34, align 8, !tbaa !9
  %224 = call i64 @Hacl_Bignum_Addition_bn_sub_eq_len_u64(i32 noundef %220, ptr noundef %221, ptr noundef %222, ptr noundef %223)
  store i64 %224, ptr %35, align 8, !tbaa !11
  %225 = load i64, ptr %35, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %36) #7
  %226 = load i64, ptr %33, align 8, !tbaa !11
  %227 = sub i64 0, %226
  store i64 %227, ptr %36, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %37) #7
  store i32 0, ptr %37, align 4, !tbaa !5
  br label %228

228:                                              ; preds = %256, %211
  %229 = load i32, ptr %37, align 4, !tbaa !5
  %230 = load i32, ptr %6, align 4, !tbaa !5
  %231 = icmp ult i32 %229, %230
  br i1 %231, label %233, label %232

232:                                              ; preds = %228
  store i32 13, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #7
  br label %259

233:                                              ; preds = %228
  call void @llvm.lifetime.start.p0(i64 8, ptr %38) #7
  %234 = load ptr, ptr %10, align 8, !tbaa !9
  store ptr %234, ptr %38, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %39) #7
  %235 = load i64, ptr %36, align 8, !tbaa !11
  %236 = load ptr, ptr %34, align 8, !tbaa !9
  %237 = load i32, ptr %37, align 4, !tbaa !5
  %238 = zext i32 %237 to i64
  %239 = getelementptr inbounds i64, ptr %236, i64 %238
  %240 = load i64, ptr %239, align 8, !tbaa !11
  %241 = and i64 %235, %240
  %242 = load i64, ptr %36, align 8, !tbaa !11
  %243 = xor i64 %242, -1
  %244 = load ptr, ptr %10, align 8, !tbaa !9
  %245 = load i32, ptr %37, align 4, !tbaa !5
  %246 = zext i32 %245 to i64
  %247 = getelementptr inbounds i64, ptr %244, i64 %246
  %248 = load i64, ptr %247, align 8, !tbaa !11
  %249 = and i64 %243, %248
  %250 = or i64 %241, %249
  store i64 %250, ptr %39, align 8, !tbaa !11
  %251 = load i64, ptr %39, align 8, !tbaa !11
  %252 = load ptr, ptr %38, align 8, !tbaa !9
  %253 = load i32, ptr %37, align 4, !tbaa !5
  %254 = zext i32 %253 to i64
  %255 = getelementptr inbounds i64, ptr %252, i64 %254
  store i64 %251, ptr %255, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %39) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %38) #7
  br label %256

256:                                              ; preds = %233
  %257 = load i32, ptr %37, align 4, !tbaa !5
  %258 = add i32 %257, 1
  store i32 %258, ptr %37, align 4, !tbaa !5
  br label %228, !llvm.loop !17

259:                                              ; preds = %232
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %35) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  ret void
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { nounwind }
attributes #8 = { 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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}


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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @Hacl_Bignum_Addition_bn_sub_eq_len_u64(i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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) #2

; Function Attrs: nounwind uwtable
define dso_local void @Hacl_Bignum_AlmostMontgomery_bn_almost_mont_reduction_u64(i32 noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #3 {
  %.not = icmp eq i32 %0, 0
  br i1 %.not, label %._crit_edge115, label %.lr.ph114

.lr.ph114:                                        ; preds = %5
  %.not128 = icmp ult i32 %0, 4
  %6 = and i32 %0, 3
  %.not129 = icmp eq i32 %6, 0
  %7 = zext i32 %0 to i64
  %8 = getelementptr inbounds i64, ptr %3, i64 %7
  br i1 %.not128, label %.lr.ph114.split, label %.lr.ph.us.preheader

.lr.ph.us.preheader:                              ; preds = %.lr.ph114
  %9 = lshr i32 %0, 2
  %10 = and i64 %7, 4294967292
  %wide.trip.count = zext nneg i32 %9 to i64
  br label %.lr.ph.us

.lr.ph.us:                                        ; preds = %.lr.ph.us.preheader, %._crit_edge109.us
  %indvars.iv141 = phi i64 [ 0, %.lr.ph.us.preheader ], [ %indvars.iv.next142, %._crit_edge109.us ]
  %.0112.us = phi i64 [ 0, %.lr.ph.us.preheader ], [ %20, %._crit_edge109.us ]
  %11 = getelementptr inbounds i64, ptr %3, i64 %indvars.iv141
  %12 = load i64, ptr %11, align 8, !tbaa !5
  %13 = mul i64 %12, %2
  br label %26

._crit_edge109.us:                                ; preds = %.lr.ph108.us, %._crit_edge.us
  %.1.lcssa.us = phi i64 [ %46, %._crit_edge.us ], [ %24, %.lr.ph108.us ]
  %14 = getelementptr inbounds i64, ptr %8, i64 %indvars.iv141
  %15 = trunc nuw i64 %indvars.iv141 to i32
  %16 = add i32 %15, %0
  %17 = zext i32 %16 to i64
  %18 = getelementptr inbounds i64, ptr %3, i64 %17
  %19 = load i64, ptr %18, align 8, !tbaa !5
  %20 = tail call i64 @Hacl_IntTypes_Intrinsics_add_carry_u64(i64 noundef %.0112.us, i64 noundef %.1.lcssa.us, i64 noundef %19, ptr noundef nonnull %14)
  %indvars.iv.next142 = add nuw nsw i64 %indvars.iv141, 1
  %exitcond145.not = icmp eq i64 %indvars.iv.next142, %7
  br i1 %exitcond145.not, label %._crit_edge115, label %.lr.ph.us, !llvm.loop !9

.lr.ph108.us:                                     ; preds = %._crit_edge.us, %.lr.ph108.us
  %indvars.iv139 = phi i64 [ %indvars.iv.next140, %.lr.ph108.us ], [ %10, %._crit_edge.us ]
  %.1106.us = phi i64 [ %24, %.lr.ph108.us ], [ %46, %._crit_edge.us ]
  %21 = getelementptr inbounds i64, ptr %1, i64 %indvars.iv139
  %22 = load i64, ptr %21, align 8, !tbaa !5
  %23 = getelementptr inbounds i64, ptr %11, i64 %indvars.iv139
  %24 = tail call i64 @Hacl_Bignum_Base_mul_wide_add2_u64(i64 noundef %22, i64 noundef %13, i64 noundef %.1106.us, ptr noundef nonnull %23)
  %indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1
  %25 = icmp ult i64 %indvars.iv.next140, %7
  br i1 %25, label %.lr.ph108.us, label %._crit_edge109.us, !llvm.loop !11

26:                                               ; preds = %.lr.ph.us, %26
  %indvars.iv = phi i64 [ 0, %.lr.ph.us ], [ %indvars.iv.next, %26 ]
  %.098104.us = phi i64 [ 0, %.lr.ph.us ], [ %46, %26 ]
  %27 = shl nuw i64 %indvars.iv, 2
  %28 = getelementptr inbounds i64, ptr %1, i64 %27
  %29 = load i64, ptr %28, align 8, !tbaa !5
  %30 = getelementptr inbounds i64, ptr %11, i64 %27
  %31 = tail call i64 @Hacl_Bignum_Base_mul_wide_add2_u64(i64 noundef %29, i64 noundef %13, i64 noundef %.098104.us, ptr noundef nonnull %30)
  %32 = or disjoint i64 %27, 1
  %33 = getelementptr inbounds i64, ptr %1, i64 %32
  %34 = load i64, ptr %33, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %30, i64 8
  %36 = tail call i64 @Hacl_Bignum_Base_mul_wide_add2_u64(i64 noundef %34, i64 noundef %13, i64 noundef %31, ptr noundef nonnull %35)
  %37 = or disjoint i64 %27, 2
  %38 = getelementptr inbounds i64, ptr %1, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %30, i64 16
  %41 = tail call i64 @Hacl_Bignum_Base_mul_wide_add2_u64(i64 noundef %39, i64 noundef %13, i64 noundef %36, ptr noundef nonnull %40)
  %42 = or disjoint i64 %27, 3
  %43 = getelementptr inbounds i64, ptr %1, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %30, i64 24
  %46 = tail call i64 @Hacl_Bignum_Base_mul_wide_add2_u64(i64 noundef %44, i64 noundef %13, i64 noundef %41, ptr noundef nonnull %45)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge.us, label %26, !llvm.loop !12

._crit_edge.us:                                   ; preds = %26
  br i1 %.not129, label %._crit_edge109.us, label %.lr.ph108.us

.lr.ph114.split:                                  ; preds = %.lr.ph114
  br i1 %.not129, label %.lr.ph114.split.split, label %.lr.ph108.us122

.lr.ph108.us122:                                  ; preds = %.lr.ph114.split, %._crit_edge109.us123
  %indvars.iv149 = phi i64 [ %indvars.iv.next150, %._crit_edge109.us123 ], [ 0, %.lr.ph114.split ]
  %.0112.us117 = phi i64 [ %61, %._crit_edge109.us123 ], [ 0, %.lr.ph114.split ]
  %47 = getelementptr inbounds i64, ptr %3, i64 %indvars.iv149
  %48 = load i64, ptr %47, align 8, !tbaa !5
  %49 = mul i64 %48, %2
  br label %50

50:                                               ; preds = %.lr.ph108.us122, %50
  %indvars.iv146 = phi i64 [ 0, %.lr.ph108.us122 ], [ %indvars.iv.next147, %50 ]
  %.1106.us120 = phi i64 [ 0, %.lr.ph108.us122 ], [ %54, %50 ]
  %51 = getelementptr inbounds i64, ptr %1, i64 %indvars.iv146
  %52 = load i64, ptr %51, align 8, !tbaa !5
  %53 = getelementptr inbounds i64, ptr %47, i64 %indvars.iv146
  %54 = tail call i64 @Hacl_Bignum_Base_mul_wide_add2_u64(i64 noundef %52, i64 noundef %49, i64 noundef %.1106.us120, ptr noundef nonnull %53)
  %indvars.iv.next147 = add nuw nsw i64 %indvars.iv146, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next147 to i32
  %exitcond148.not = icmp eq i32 %lftr.wideiv, %0
  br i1 %exitcond148.not, label %._crit_edge109.us123, label %50, !llvm.loop !11

._crit_edge109.us123:                             ; preds = %50
  %55 = getelementptr inbounds i64, ptr %8, i64 %indvars.iv149
  %56 = trunc nuw i64 %indvars.iv149 to i32
  %57 = add i32 %56, %0
  %58 = zext i32 %57 to i64
  %59 = getelementptr inbounds i64, ptr %3, i64 %58
  %60 = load i64, ptr %59, align 8, !tbaa !5
  %61 = tail call i64 @Hacl_IntTypes_Intrinsics_add_carry_u64(i64 noundef %.0112.us117, i64 noundef %54, i64 noundef %60, ptr noundef nonnull %55)
  %indvars.iv.next150 = add nuw nsw i64 %indvars.iv149, 1
  %exitcond153.not = icmp eq i64 %indvars.iv.next150, %7
  br i1 %exitcond153.not, label %._crit_edge115, label %.lr.ph108.us122, !llvm.loop !9

._crit_edge115:                                   ; preds = %._crit_edge109.us, %._crit_edge109.us123, %.lr.ph114.split.split, %5
  %.pre-phi = phi i64 [ 0, %5 ], [ %7, %.lr.ph114.split.split ], [ %7, %._crit_edge109.us123 ], [ %7, %._crit_edge109.us ]
  %.0.lcssa = phi i64 [ 0, %5 ], [ %83, %.lr.ph114.split.split ], [ %61, %._crit_edge109.us123 ], [ %20, %._crit_edge109.us ]
  %62 = getelementptr inbounds i64, ptr %3, i64 %.pre-phi
  %63 = shl nuw nsw i64 %.pre-phi, 3
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 8 %4, ptr align 8 %62, i64 %63, i1 false)
  %64 = alloca i8, i64 %63, align 16
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %64, i8 0, i64 %63, i1 false)
  %65 = call i64 @Hacl_Bignum_Addition_bn_sub_eq_len_u64(i32 noundef %0, ptr noundef %4, ptr noundef %1, ptr noundef nonnull %64)
  %66 = sub i64 0, %.0.lcssa
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %._crit_edge115
  %67 = add i64 %.0.lcssa, -1
  %min.iters.check = icmp ult i64 %.pre-phi, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph
  %indvars.iv159.ph = phi i64 [ 0, %.lr.ph ], [ %n.vec, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.vec = and i64 %.pre-phi, 4294967292
  %broadcast.splatinsert = insertelement <2 x i64> poison, i64 %66, i64 0
  %broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
  %broadcast.splatinsert181 = insertelement <2 x i64> poison, i64 %67, i64 0
  %broadcast.splat182 = shufflevector <2 x i64> %broadcast.splatinsert181, <2 x i64> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %68 = getelementptr inbounds i64, ptr %64, i64 %index
  %69 = getelementptr inbounds i8, ptr %68, i64 16
  %wide.load = load <2 x i64>, ptr %68, align 16, !tbaa !5
  %wide.load178 = load <2 x i64>, ptr %69, align 16, !tbaa !5
  %70 = and <2 x i64> %wide.load, %broadcast.splat
  %71 = and <2 x i64> %wide.load178, %broadcast.splat
  %72 = getelementptr inbounds i64, ptr %4, i64 %index
  %73 = getelementptr inbounds i8, ptr %72, i64 16
  %wide.load179 = load <2 x i64>, ptr %72, align 8, !tbaa !5
  %wide.load180 = load <2 x i64>, ptr %73, align 8, !tbaa !5
  %74 = and <2 x i64> %wide.load179, %broadcast.splat182
  %75 = and <2 x i64> %wide.load180, %broadcast.splat182
  %76 = or <2 x i64> %74, %70
  %77 = or <2 x i64> %75, %71
  store <2 x i64> %76, ptr %72, align 8, !tbaa !5
  store <2 x i64> %77, ptr %73, align 8, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %78 = icmp eq i64 %index.next, %n.vec
  br i1 %78, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %.pre-phi, %n.vec
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

.lr.ph114.split.split:                            ; preds = %.lr.ph114.split, %.lr.ph114.split.split
  %indvars.iv154 = phi i64 [ %indvars.iv.next155, %.lr.ph114.split.split ], [ 0, %.lr.ph114.split ]
  %.0112 = phi i64 [ %83, %.lr.ph114.split.split ], [ 0, %.lr.ph114.split ]
  %79 = getelementptr inbounds i64, ptr %8, i64 %indvars.iv154
  %80 = and i64 %indvars.iv154, 4294967295
  %81 = getelementptr inbounds i64, ptr %3, i64 %80
  %82 = load i64, ptr %81, align 8, !tbaa !5
  %83 = tail call i64 @Hacl_IntTypes_Intrinsics_add_carry_u64(i64 noundef %.0112, i64 noundef 0, i64 noundef %82, ptr noundef nonnull %79)
  %indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1
  %exitcond158.not = icmp eq i64 %indvars.iv.next155, %7
  br i1 %exitcond158.not, label %._crit_edge115, label %.lr.ph114.split.split, !llvm.loop !9

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %._crit_edge115
  ret void

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv159 = phi i64 [ %indvars.iv.next160, %scalar.ph ], [ %indvars.iv159.ph, %scalar.ph.preheader ]
  %84 = getelementptr inbounds i64, ptr %64, i64 %indvars.iv159
  %85 = load i64, ptr %84, align 8, !tbaa !5
  %86 = and i64 %85, %66
  %87 = getelementptr inbounds i64, ptr %4, i64 %indvars.iv159
  %88 = load i64, ptr %87, align 8, !tbaa !5
  %89 = and i64 %88, %67
  %90 = or i64 %89, %86
  store i64 %90, ptr %87, align 8, !tbaa !5
  %indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
  %exitcond163.not = icmp eq i64 %indvars.iv.next160, %.pre-phi
  br i1 %exitcond163.not, label %._crit_edge, label %scalar.ph, !llvm.loop !16
}

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

attributes #0 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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" }

!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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10, !15, !14}


; Effective O3 passes: ADCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass