; LLVM IR from cryspen/libcrux :: sys/hacl/c/src (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 [78 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: inlinehint nounwind uwtable
declare hidden i32 @Hacl_Bignum_Addition_bn_sub_eq_len_u32(i32 noundef, ptr noundef, ptr noundef, ptr noundef) #1

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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) #6

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

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

45:                                               ; preds = %41
  store i32 2, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %190

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

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

63:                                               ; preds = %58
  store i32 5, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %138

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

135:                                              ; preds = %64
  %136 = load i32, ptr %17, align 4, !tbaa !5
  %137 = add i32 %136, 1
  store i32 %137, ptr %17, align 4, !tbaa !5
  br label %58, !llvm.loop !11

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

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

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

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

162:                                              ; preds = %147
  %163 = load i32, ptr %26, align 4, !tbaa !5
  %164 = add i32 %163, 1
  store i32 %164, ptr %26, align 4, !tbaa !5
  br label %142, !llvm.loop !13

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

187:                                              ; preds = %165
  %188 = load i32, ptr %12, align 4, !tbaa !5
  %189 = add i32 %188, 1
  store i32 %189, ptr %12, align 4, !tbaa !5
  br label %41, !llvm.loop !14

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

204:                                              ; preds = %190
  %205 = load i32, ptr %6, align 4, !tbaa !5
  %206 = zext i32 %205 to i64
  %207 = icmp ugt i64 %206, 4611686018427387903
  br i1 %207, label %208, label %210

208:                                              ; preds = %204
  %209 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 1247)
  call void @exit(i32 noundef 253) #9
  unreachable

210:                                              ; preds = %204
  br label %211

211:                                              ; preds = %210
  br label %212

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

227:                                              ; preds = %254, %212
  %228 = load i32, ptr %38, align 4, !tbaa !5
  %229 = load i32, ptr %6, align 4, !tbaa !5
  %230 = icmp ult i32 %228, %229
  br i1 %230, label %232, label %231

231:                                              ; preds = %227
  store i32 13, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %38) #8
  br label %257

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

254:                                              ; preds = %232
  %255 = load i32, ptr %38, align 4, !tbaa !5
  %256 = add i32 %255, 1
  store i32 %256, ptr %38, align 4, !tbaa !5
  br label %227, !llvm.loop !15

257:                                              ; preds = %231
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #8
  %258 = load ptr, ptr %34, align 8
  call void @llvm.stackrestore.p0(ptr %258)
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  ret void
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @Hacl_Bignum_Base_mul_wide_add2_u32(i32 noundef, i32 noundef, i32 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 nosync nounwind willreturn }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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 #8 = { nounwind }
attributes #9 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !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"

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @Hacl_IntTypes_Intrinsics_add_carry_u32(i32 noundef, i32 noundef, i32 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_u32(i32 noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #3 {
  %.not = icmp eq i32 %0, 0
  br i1 %.not, label %._crit_edge113, label %.lr.ph112

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

.lr.ph.us.preheader:                              ; preds = %.lr.ph112
  %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_edge107.us
  %indvars.iv139 = phi i64 [ 0, %.lr.ph.us.preheader ], [ %indvars.iv.next140, %._crit_edge107.us ]
  %.0110.us = phi i32 [ 0, %.lr.ph.us.preheader ], [ %20, %._crit_edge107.us ]
  %11 = getelementptr inbounds i32, ptr %3, i64 %indvars.iv139
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = mul i32 %12, %2
  br label %26

._crit_edge107.us:                                ; preds = %.lr.ph106.us, %._crit_edge.us
  %.1.lcssa.us = phi i32 [ %46, %._crit_edge.us ], [ %24, %.lr.ph106.us ]
  %14 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv139
  %15 = trunc nuw i64 %indvars.iv139 to i32
  %16 = add i32 %15, %0
  %17 = zext i32 %16 to i64
  %18 = getelementptr inbounds i32, ptr %3, i64 %17
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = tail call i32 @Hacl_IntTypes_Intrinsics_add_carry_u32(i32 noundef %.0110.us, i32 noundef %.1.lcssa.us, i32 noundef %19, ptr noundef nonnull %14)
  %indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1
  %exitcond143.not = icmp eq i64 %indvars.iv.next140, %7
  br i1 %exitcond143.not, label %._crit_edge113, label %.lr.ph.us, !llvm.loop !9

.lr.ph106.us:                                     ; preds = %._crit_edge.us, %.lr.ph106.us
  %indvars.iv137 = phi i64 [ %indvars.iv.next138, %.lr.ph106.us ], [ %10, %._crit_edge.us ]
  %.1104.us = phi i32 [ %24, %.lr.ph106.us ], [ %46, %._crit_edge.us ]
  %21 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv137
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = getelementptr inbounds i32, ptr %11, i64 %indvars.iv137
  %24 = tail call i32 @Hacl_Bignum_Base_mul_wide_add2_u32(i32 noundef %22, i32 noundef %13, i32 noundef %.1104.us, ptr noundef nonnull %23)
  %indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1
  %25 = icmp ult i64 %indvars.iv.next138, %7
  br i1 %25, label %.lr.ph106.us, label %._crit_edge107.us, !llvm.loop !11

26:                                               ; preds = %.lr.ph.us, %26
  %indvars.iv = phi i64 [ 0, %.lr.ph.us ], [ %indvars.iv.next, %26 ]
  %.096102.us = phi i32 [ 0, %.lr.ph.us ], [ %46, %26 ]
  %27 = shl nuw i64 %indvars.iv, 2
  %28 = getelementptr inbounds i32, ptr %1, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = getelementptr inbounds i32, ptr %11, i64 %27
  %31 = tail call i32 @Hacl_Bignum_Base_mul_wide_add2_u32(i32 noundef %29, i32 noundef %13, i32 noundef %.096102.us, ptr noundef nonnull %30)
  %32 = or disjoint i64 %27, 1
  %33 = getelementptr inbounds i32, ptr %1, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %30, i64 4
  %36 = tail call i32 @Hacl_Bignum_Base_mul_wide_add2_u32(i32 noundef %34, i32 noundef %13, i32 noundef %31, ptr noundef nonnull %35)
  %37 = or disjoint i64 %27, 2
  %38 = getelementptr inbounds i32, ptr %1, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %30, i64 8
  %41 = tail call i32 @Hacl_Bignum_Base_mul_wide_add2_u32(i32 noundef %39, i32 noundef %13, i32 noundef %36, ptr noundef nonnull %40)
  %42 = or disjoint i64 %27, 3
  %43 = getelementptr inbounds i32, ptr %1, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %30, i64 12
  %46 = tail call i32 @Hacl_Bignum_Base_mul_wide_add2_u32(i32 noundef %44, i32 noundef %13, i32 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 %.not127, label %._crit_edge107.us, label %.lr.ph106.us

.lr.ph112.split:                                  ; preds = %.lr.ph112
  br i1 %.not127, label %.lr.ph112.split.split, label %.lr.ph106.us120

.lr.ph106.us120:                                  ; preds = %.lr.ph112.split, %._crit_edge107.us121
  %indvars.iv147 = phi i64 [ %indvars.iv.next148, %._crit_edge107.us121 ], [ 0, %.lr.ph112.split ]
  %.0110.us115 = phi i32 [ %61, %._crit_edge107.us121 ], [ 0, %.lr.ph112.split ]
  %47 = getelementptr inbounds i32, ptr %3, i64 %indvars.iv147
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = mul i32 %48, %2
  br label %50

50:                                               ; preds = %.lr.ph106.us120, %50
  %indvars.iv144 = phi i64 [ 0, %.lr.ph106.us120 ], [ %indvars.iv.next145, %50 ]
  %.1104.us118 = phi i32 [ 0, %.lr.ph106.us120 ], [ %54, %50 ]
  %51 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv144
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = getelementptr inbounds i32, ptr %47, i64 %indvars.iv144
  %54 = tail call i32 @Hacl_Bignum_Base_mul_wide_add2_u32(i32 noundef %52, i32 noundef %49, i32 noundef %.1104.us118, ptr noundef nonnull %53)
  %indvars.iv.next145 = add nuw nsw i64 %indvars.iv144, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next145 to i32
  %exitcond146.not = icmp eq i32 %lftr.wideiv, %0
  br i1 %exitcond146.not, label %._crit_edge107.us121, label %50, !llvm.loop !11

._crit_edge107.us121:                             ; preds = %50
  %55 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv147
  %56 = trunc nuw i64 %indvars.iv147 to i32
  %57 = add i32 %56, %0
  %58 = zext i32 %57 to i64
  %59 = getelementptr inbounds i32, ptr %3, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = tail call i32 @Hacl_IntTypes_Intrinsics_add_carry_u32(i32 noundef %.0110.us115, i32 noundef %54, i32 noundef %60, ptr noundef nonnull %55)
  %indvars.iv.next148 = add nuw nsw i64 %indvars.iv147, 1
  %exitcond151.not = icmp eq i64 %indvars.iv.next148, %7
  br i1 %exitcond151.not, label %._crit_edge113, label %.lr.ph106.us120, !llvm.loop !9

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

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

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph
  %indvars.iv157.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, 4294967288
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %66, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert179 = insertelement <4 x i32> poison, i32 %67, i64 0
  %broadcast.splat180 = shufflevector <4 x i32> %broadcast.splatinsert179, <4 x i32> poison, <4 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 i32, ptr %64, i64 %index
  %69 = getelementptr inbounds i8, ptr %68, i64 16
  %wide.load = load <4 x i32>, ptr %68, align 16, !tbaa !5
  %wide.load176 = load <4 x i32>, ptr %69, align 16, !tbaa !5
  %70 = and <4 x i32> %wide.load, %broadcast.splat
  %71 = and <4 x i32> %wide.load176, %broadcast.splat
  %72 = getelementptr inbounds i32, ptr %4, i64 %index
  %73 = getelementptr inbounds i8, ptr %72, i64 16
  %wide.load177 = load <4 x i32>, ptr %72, align 4, !tbaa !5
  %wide.load178 = load <4 x i32>, ptr %73, align 4, !tbaa !5
  %74 = and <4 x i32> %wide.load177, %broadcast.splat180
  %75 = and <4 x i32> %wide.load178, %broadcast.splat180
  %76 = or <4 x i32> %74, %70
  %77 = or <4 x i32> %75, %71
  store <4 x i32> %76, ptr %72, align 4, !tbaa !5
  store <4 x i32> %77, ptr %73, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %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.ph112.split.split:                            ; preds = %.lr.ph112.split, %.lr.ph112.split.split
  %indvars.iv152 = phi i64 [ %indvars.iv.next153, %.lr.ph112.split.split ], [ 0, %.lr.ph112.split ]
  %.0110 = phi i32 [ %83, %.lr.ph112.split.split ], [ 0, %.lr.ph112.split ]
  %79 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv152
  %80 = and i64 %indvars.iv152, 4294967295
  %81 = getelementptr inbounds i32, ptr %3, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = tail call i32 @Hacl_IntTypes_Intrinsics_add_carry_u32(i32 noundef %.0110, i32 noundef 0, i32 noundef %82, ptr noundef nonnull %79)
  %indvars.iv.next153 = add nuw nsw i64 %indvars.iv152, 1
  %exitcond156.not = icmp eq i64 %indvars.iv.next153, %7
  br i1 %exitcond156.not, label %._crit_edge113, label %.lr.ph112.split.split, !llvm.loop !9

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @Hacl_Bignum_Base_mul_wide_add2_u32(i32 noundef, i32 noundef, i32 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 = !{!"int", !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