; LLVM IR from cryptid-org/cryptid-native :: dependencies/gmp/src (mini-gmp)

; 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.__mpz_struct = type { i32, i32, ptr }
%struct.gmp_div_inverse = type { i32, i64, i64, i64 }

@gmp_free_func = external hidden global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [23 x i8], align 1
@__PRETTY_FUNCTION__.mpz_powm = external hidden unnamed_addr constant [96 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [53 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: nounwind uwtable
declare hidden i64 @mpn_normalized_size(ptr noundef, i64 noundef) #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @mpn_lshift(ptr noundef, ptr noundef, i64 noundef, i32 noundef) #1

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

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

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

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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @mpz_powm(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 [1 x %struct.__mpz_struct], align 16
  %10 = alloca [1 x %struct.__mpz_struct], align 16
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca %struct.gmp_div_inverse, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  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
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  store ptr null, ptr %16, align 8, !tbaa !5
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.__mpz_struct, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %25, align 4, !tbaa !9
  %27 = icmp sge i32 %26, 0
  br i1 %27, label %28, label %32

28:                                               ; preds = %4
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.__mpz_struct, ptr %29, i32 0, i32 1
  %31 = load i32, ptr %30, align 4, !tbaa !9
  br label %37

32:                                               ; preds = %4
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.__mpz_struct, ptr %33, i32 0, i32 1
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = sub nsw i32 0, %35
  br label %37

37:                                               ; preds = %32, %28
  %38 = phi i32 [ %31, %28 ], [ %36, %32 ]
  %39 = sext i32 %38 to i64
  store i64 %39, ptr %11, align 8, !tbaa !12
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.__mpz_struct, ptr %40, i32 0, i32 1
  %42 = load i32, ptr %41, align 4, !tbaa !9
  %43 = icmp sge i32 %42, 0
  br i1 %43, label %44, label %48

44:                                               ; preds = %37
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.__mpz_struct, ptr %45, i32 0, i32 1
  %47 = load i32, ptr %46, align 4, !tbaa !9
  br label %53

48:                                               ; preds = %37
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.__mpz_struct, ptr %49, i32 0, i32 1
  %51 = load i32, ptr %50, align 4, !tbaa !9
  %52 = sub nsw i32 0, %51
  br label %53

53:                                               ; preds = %48, %44
  %54 = phi i32 [ %47, %44 ], [ %52, %48 ]
  %55 = sext i32 %54 to i64
  store i64 %55, ptr %12, align 8, !tbaa !12
  %56 = load i64, ptr %12, align 8, !tbaa !12
  %57 = icmp eq i64 %56, 0
  br i1 %57, label %58, label %59

58:                                               ; preds = %53
  call void @gmp_die(ptr noundef @.str.13)
  br label %59

59:                                               ; preds = %58, %53
  %60 = load i64, ptr %11, align 8, !tbaa !12
  %61 = icmp eq i64 %60, 0
  br i1 %61, label %62, label %64

62:                                               ; preds = %59
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  call void @mpz_set_ui(ptr noundef %63, i64 noundef 1)
  store i32 1, ptr %17, align 4
  br label %268

64:                                               ; preds = %59
  %65 = load ptr, ptr %8, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.__mpz_struct, ptr %65, i32 0, i32 2
  %67 = load ptr, ptr %66, align 8, !tbaa !14
  store ptr %67, ptr %13, align 8, !tbaa !5
  %68 = load ptr, ptr %13, align 8, !tbaa !5
  %69 = load i64, ptr %12, align 8, !tbaa !12
  call void @mpn_div_qr_invert(ptr noundef %14, ptr noundef %68, i64 noundef %69)
  %70 = getelementptr inbounds %struct.gmp_div_inverse, ptr %14, i32 0, i32 0
  %71 = load i32, ptr %70, align 8, !tbaa !15
  store i32 %71, ptr %15, align 4, !tbaa !17
  %72 = load i32, ptr %15, align 4, !tbaa !17
  %73 = icmp ugt i32 %72, 0
  br i1 %73, label %74, label %92

74:                                               ; preds = %64
  %75 = getelementptr inbounds %struct.gmp_div_inverse, ptr %14, i32 0, i32 0
  store i32 0, ptr %75, align 8, !tbaa !15
  %76 = load i64, ptr %12, align 8, !tbaa !12
  %77 = call ptr @gmp_xalloc_limbs(i64 noundef %76)
  store ptr %77, ptr %16, align 8, !tbaa !5
  br label %78

78:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %79 = load ptr, ptr %16, align 8, !tbaa !5
  %80 = load ptr, ptr %13, align 8, !tbaa !5
  %81 = load i64, ptr %12, align 8, !tbaa !12
  %82 = load i32, ptr %15, align 4, !tbaa !17
  %83 = call i64 @mpn_lshift(ptr noundef %79, ptr noundef %80, i64 noundef %81, i32 noundef %82)
  store i64 %83, ptr %18, align 8, !tbaa !12
  %84 = load i64, ptr %18, align 8, !tbaa !12
  %85 = icmp eq i64 %84, 0
  br i1 %85, label %86, label %87

86:                                               ; preds = %78
  br label %88

87:                                               ; preds = %78
  call void @__assert_fail(ptr noundef @.str.12, ptr noundef @.str.1, i32 noundef 3155, ptr noundef @__PRETTY_FUNCTION__.mpz_powm) #4
  unreachable

88:                                               ; preds = %86
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  br label %89

89:                                               ; preds = %88
  br label %90

90:                                               ; preds = %89
  %91 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %91, ptr %13, align 8, !tbaa !5
  br label %92

92:                                               ; preds = %90, %64
  %93 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %10, i64 0, i64 0
  call void @mpz_init(ptr noundef %93)
  %94 = load ptr, ptr %7, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.__mpz_struct, ptr %94, i32 0, i32 1
  %96 = load i32, ptr %95, align 4, !tbaa !9
  %97 = icmp slt i32 %96, 0
  br i1 %97, label %98, label %106

98:                                               ; preds = %92
  %99 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %10, i64 0, i64 0
  %100 = load ptr, ptr %6, align 8, !tbaa !5
  %101 = load ptr, ptr %8, align 8, !tbaa !5
  %102 = call i32 @mpz_invert(ptr noundef %99, ptr noundef %100, ptr noundef %101)
  %103 = icmp ne i32 %102, 0
  br i1 %103, label %105, label %104

104:                                              ; preds = %98
  call void @gmp_die(ptr noundef @.str.14)
  br label %105

105:                                              ; preds = %104, %98
  br label %173

106:                                              ; preds = %92
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %107 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %10, i64 0, i64 0
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  call void @mpz_abs(ptr noundef %107, ptr noundef %108)
  %109 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %10, i64 0, i64 0
  %110 = getelementptr inbounds %struct.__mpz_struct, ptr %109, i32 0, i32 1
  %111 = load i32, ptr %110, align 4, !tbaa !9
  %112 = sext i32 %111 to i64
  store i64 %112, ptr %19, align 8, !tbaa !12
  %113 = load i64, ptr %19, align 8, !tbaa !12
  %114 = load i64, ptr %12, align 8, !tbaa !12
  %115 = icmp sge i64 %113, %114
  br i1 %115, label %116, label %127

116:                                              ; preds = %106
  %117 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %10, i64 0, i64 0
  %118 = getelementptr inbounds %struct.__mpz_struct, ptr %117, i32 0, i32 2
  %119 = load ptr, ptr %118, align 8, !tbaa !14
  %120 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %10, i64 0, i64 0
  %121 = getelementptr inbounds %struct.__mpz_struct, ptr %120, i32 0, i32 1
  %122 = load i32, ptr %121, align 4, !tbaa !9
  %123 = sext i32 %122 to i64
  %124 = load ptr, ptr %13, align 8, !tbaa !5
  %125 = load i64, ptr %12, align 8, !tbaa !12
  call void @mpn_div_qr_preinv(ptr noundef null, ptr noundef %119, i64 noundef %123, ptr noundef %124, i64 noundef %125, ptr noundef %14)
  %126 = load i64, ptr %12, align 8, !tbaa !12
  store i64 %126, ptr %19, align 8, !tbaa !12
  br label %127

127:                                              ; preds = %116, %106
  %128 = load ptr, ptr %6, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.__mpz_struct, ptr %128, i32 0, i32 1
  %130 = load i32, ptr %129, align 4, !tbaa !9
  %131 = icmp slt i32 %130, 0
  br i1 %131, label %132, label %164

132:                                              ; preds = %127
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  %133 = load i64, ptr %12, align 8, !tbaa !12
  %134 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %10, i64 0, i64 0
  %135 = getelementptr inbounds %struct.__mpz_struct, ptr %134, i32 0, i32 0
  %136 = load i32, ptr %135, align 16, !tbaa !18
  %137 = sext i32 %136 to i64
  %138 = icmp sgt i64 %133, %137
  br i1 %138, label %139, label %143

139:                                              ; preds = %132
  %140 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %10, i64 0, i64 0
  %141 = load i64, ptr %12, align 8, !tbaa !12
  %142 = call ptr @mpz_realloc(ptr noundef %140, i64 noundef %141)
  br label %147

143:                                              ; preds = %132
  %144 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %10, i64 0, i64 0
  %145 = getelementptr inbounds %struct.__mpz_struct, ptr %144, i32 0, i32 2
  %146 = load ptr, ptr %145, align 8, !tbaa !14
  br label %147

147:                                              ; preds = %143, %139
  %148 = phi ptr [ %142, %139 ], [ %146, %143 ]
  store ptr %148, ptr %20, align 8, !tbaa !5
  br label %149

149:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  %150 = load ptr, ptr %20, align 8, !tbaa !5
  %151 = load ptr, ptr %13, align 8, !tbaa !5
  %152 = load i64, ptr %12, align 8, !tbaa !12
  %153 = load ptr, ptr %20, align 8, !tbaa !5
  %154 = load i64, ptr %19, align 8, !tbaa !12
  %155 = call i64 @mpn_sub(ptr noundef %150, ptr noundef %151, i64 noundef %152, ptr noundef %153, i64 noundef %154)
  store i64 %155, ptr %21, align 8, !tbaa !12
  %156 = load i64, ptr %21, align 8, !tbaa !12
  %157 = icmp eq i64 %156, 0
  br i1 %157, label %158, label %159

158:                                              ; preds = %149
  br label %160

159:                                              ; preds = %149
  call void @__assert_fail(ptr noundef @.str.12, ptr noundef @.str.1, i32 noundef 3184, ptr noundef @__PRETTY_FUNCTION__.mpz_powm) #4
  unreachable

160:                                              ; preds = %158
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  br label %161

161:                                              ; preds = %160
  br label %162

162:                                              ; preds = %161
  %163 = load i64, ptr %12, align 8, !tbaa !12
  store i64 %163, ptr %19, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  br label %164

164:                                              ; preds = %162, %127
  %165 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %10, i64 0, i64 0
  %166 = getelementptr inbounds %struct.__mpz_struct, ptr %165, i32 0, i32 2
  %167 = load ptr, ptr %166, align 8, !tbaa !14
  %168 = load i64, ptr %19, align 8, !tbaa !12
  %169 = call i64 @mpn_normalized_size(ptr noundef %167, i64 noundef %168)
  %170 = trunc i64 %169 to i32
  %171 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %10, i64 0, i64 0
  %172 = getelementptr inbounds %struct.__mpz_struct, ptr %171, i32 0, i32 1
  store i32 %170, ptr %172, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  br label %173

173:                                              ; preds = %164, %105
  %174 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  call void @mpz_init_set_ui(ptr noundef %174, i64 noundef 1)
  br label %175

175:                                              ; preds = %229, %173
  %176 = load i64, ptr %11, align 8, !tbaa !12
  %177 = add nsw i64 %176, -1
  store i64 %177, ptr %11, align 8, !tbaa !12
  %178 = icmp sge i64 %177, 0
  br i1 %178, label %179, label %230

179:                                              ; preds = %175
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  %180 = load ptr, ptr %7, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.__mpz_struct, ptr %180, i32 0, i32 2
  %182 = load ptr, ptr %181, align 8, !tbaa !14
  %183 = load i64, ptr %11, align 8, !tbaa !12
  %184 = getelementptr inbounds i64, ptr %182, i64 %183
  %185 = load i64, ptr %184, align 8, !tbaa !12
  store i64 %185, ptr %22, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #3
  store i64 -9223372036854775808, ptr %23, align 8, !tbaa !12
  br label %186

186:                                              ; preds = %226, %179
  %187 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  %188 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  %189 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  call void @mpz_mul(ptr noundef %187, ptr noundef %188, ptr noundef %189)
  %190 = load i64, ptr %22, align 8, !tbaa !12
  %191 = load i64, ptr %23, align 8, !tbaa !12
  %192 = and i64 %190, %191
  %193 = icmp ne i64 %192, 0
  br i1 %193, label %194, label %198

194:                                              ; preds = %186
  %195 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  %196 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  %197 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %10, i64 0, i64 0
  call void @mpz_mul(ptr noundef %195, ptr noundef %196, ptr noundef %197)
  br label %198

198:                                              ; preds = %194, %186
  %199 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  %200 = getelementptr inbounds %struct.__mpz_struct, ptr %199, i32 0, i32 1
  %201 = load i32, ptr %200, align 4, !tbaa !9
  %202 = sext i32 %201 to i64
  %203 = load i64, ptr %12, align 8, !tbaa !12
  %204 = icmp sgt i64 %202, %203
  br i1 %204, label %205, label %223

205:                                              ; preds = %198
  %206 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  %207 = getelementptr inbounds %struct.__mpz_struct, ptr %206, i32 0, i32 2
  %208 = load ptr, ptr %207, align 8, !tbaa !14
  %209 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  %210 = getelementptr inbounds %struct.__mpz_struct, ptr %209, i32 0, i32 1
  %211 = load i32, ptr %210, align 4, !tbaa !9
  %212 = sext i32 %211 to i64
  %213 = load ptr, ptr %13, align 8, !tbaa !5
  %214 = load i64, ptr %12, align 8, !tbaa !12
  call void @mpn_div_qr_preinv(ptr noundef null, ptr noundef %208, i64 noundef %212, ptr noundef %213, i64 noundef %214, ptr noundef %14)
  %215 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  %216 = getelementptr inbounds %struct.__mpz_struct, ptr %215, i32 0, i32 2
  %217 = load ptr, ptr %216, align 8, !tbaa !14
  %218 = load i64, ptr %12, align 8, !tbaa !12
  %219 = call i64 @mpn_normalized_size(ptr noundef %217, i64 noundef %218)
  %220 = trunc i64 %219 to i32
  %221 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  %222 = getelementptr inbounds %struct.__mpz_struct, ptr %221, i32 0, i32 1
  store i32 %220, ptr %222, align 4, !tbaa !9
  br label %223

223:                                              ; preds = %205, %198
  %224 = load i64, ptr %23, align 8, !tbaa !12
  %225 = lshr i64 %224, 1
  store i64 %225, ptr %23, align 8, !tbaa !12
  br label %226

226:                                              ; preds = %223
  %227 = load i64, ptr %23, align 8, !tbaa !12
  %228 = icmp ugt i64 %227, 0
  br i1 %228, label %186, label %229, !llvm.loop !19

229:                                              ; preds = %226
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  br label %175, !llvm.loop !21

230:                                              ; preds = %175
  %231 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  %232 = getelementptr inbounds %struct.__mpz_struct, ptr %231, i32 0, i32 1
  %233 = load i32, ptr %232, align 4, !tbaa !9
  %234 = sext i32 %233 to i64
  %235 = load i64, ptr %12, align 8, !tbaa !12
  %236 = icmp sge i64 %234, %235
  br i1 %236, label %237, label %257

237:                                              ; preds = %230
  %238 = load i32, ptr %15, align 4, !tbaa !17
  %239 = getelementptr inbounds %struct.gmp_div_inverse, ptr %14, i32 0, i32 0
  store i32 %238, ptr %239, align 8, !tbaa !15
  %240 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  %241 = getelementptr inbounds %struct.__mpz_struct, ptr %240, i32 0, i32 2
  %242 = load ptr, ptr %241, align 8, !tbaa !14
  %243 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  %244 = getelementptr inbounds %struct.__mpz_struct, ptr %243, i32 0, i32 1
  %245 = load i32, ptr %244, align 4, !tbaa !9
  %246 = sext i32 %245 to i64
  %247 = load ptr, ptr %13, align 8, !tbaa !5
  %248 = load i64, ptr %12, align 8, !tbaa !12
  call void @mpn_div_qr_preinv(ptr noundef null, ptr noundef %242, i64 noundef %246, ptr noundef %247, i64 noundef %248, ptr noundef %14)
  %249 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  %250 = getelementptr inbounds %struct.__mpz_struct, ptr %249, i32 0, i32 2
  %251 = load ptr, ptr %250, align 8, !tbaa !14
  %252 = load i64, ptr %12, align 8, !tbaa !12
  %253 = call i64 @mpn_normalized_size(ptr noundef %251, i64 noundef %252)
  %254 = trunc i64 %253 to i32
  %255 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  %256 = getelementptr inbounds %struct.__mpz_struct, ptr %255, i32 0, i32 1
  store i32 %254, ptr %256, align 4, !tbaa !9
  br label %257

257:                                              ; preds = %237, %230
  %258 = load ptr, ptr %16, align 8, !tbaa !5
  %259 = icmp ne ptr %258, null
  br i1 %259, label %260, label %263

260:                                              ; preds = %257
  %261 = load ptr, ptr @gmp_free_func, align 8, !tbaa !5
  %262 = load ptr, ptr %16, align 8, !tbaa !5
  call void %261(ptr noundef %262, i64 noundef 0)
  br label %263

263:                                              ; preds = %260, %257
  %264 = load ptr, ptr %5, align 8, !tbaa !5
  %265 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  call void @mpz_swap(ptr noundef %264, ptr noundef %265)
  %266 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %9, i64 0, i64 0
  call void @mpz_clear(ptr noundef %266)
  %267 = getelementptr inbounds [1 x %struct.__mpz_struct], ptr %10, i64 0, i64 0
  call void @mpz_clear(ptr noundef %267)
  store i32 0, ptr %17, align 4
  br label %268

268:                                              ; preds = %263, %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #3
  %269 = load i32, ptr %17, align 4
  switch i32 %269, label %271 [
    i32 0, label %270
    i32 1, label %270
  ]

270:                                              ; preds = %268, %268
  ret void

271:                                              ; preds = %268
  unreachable
}

; Function Attrs: nounwind uwtable
declare hidden void @gmp_die(ptr noundef) #1

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

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

attributes #0 = { nocallback nofree nosync 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 = { 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 #3 = { nounwind }
attributes #4 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 4}
!10 = !{!"", !11, i64 0, !11, i64 4, !6, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!10, !6, i64 8}
!15 = !{!16, !11, i64 0}
!16 = !{!"gmp_div_inverse", !11, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!17 = !{!11, !11, i64 0}
!18 = !{!10, !11, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}


; 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.__mpz_struct = type { i32, i32, ptr }
%struct.gmp_div_inverse = type { i32, i64, i64, i64 }

@gmp_free_func = external hidden local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [23 x i8], align 1
@__PRETTY_FUNCTION__.mpz_powm = external hidden unnamed_addr constant [96 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [53 x i8], align 1

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @mpn_lshift(ptr noundef, ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare hidden ptr @gmp_xalloc_limbs(i64 noundef) local_unnamed_addr #1

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

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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @mpz_powm(ptr noundef %0, ptr noundef %1, ptr nocapture noundef readonly %2, ptr noundef %3) local_unnamed_addr #1 {
  %5 = alloca [1 x %struct.__mpz_struct], align 16
  %6 = alloca [1 x %struct.__mpz_struct], align 16
  %7 = alloca %struct.gmp_div_inverse, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #4
  %8 = getelementptr inbounds i8, ptr %2, i64 4
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %10 = tail call i32 @llvm.abs.i32(i32 %9, i1 true)
  %11 = zext nneg i32 %10 to i64
  %12 = getelementptr inbounds i8, ptr %3, i64 4
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = tail call i32 @llvm.abs.i32(i32 %13, i1 true)
  %15 = zext nneg i32 %14 to i64
  %16 = icmp eq i32 %13, 0
  br i1 %16, label %17, label %18

17:                                               ; preds = %4
  tail call void @gmp_die(ptr noundef nonnull @.str.13)
  br label %18

18:                                               ; preds = %17, %4
  %19 = icmp eq i32 %9, 0
  br i1 %19, label %20, label %21

20:                                               ; preds = %18
  tail call void @mpz_set_ui(ptr noundef %0, i64 noundef 1)
  br label %102

21:                                               ; preds = %18
  %22 = getelementptr inbounds i8, ptr %3, i64 8
  %23 = load ptr, ptr %22, align 8, !tbaa !11
  call void @mpn_div_qr_invert(ptr noundef nonnull %7, ptr noundef %23, i64 noundef %15)
  %24 = load i32, ptr %7, align 8, !tbaa !12
  %.not = icmp eq i32 %24, 0
  br i1 %.not, label %30, label %25

25:                                               ; preds = %21
  store i32 0, ptr %7, align 8, !tbaa !12
  %26 = call ptr @gmp_xalloc_limbs(i64 noundef %15)
  %27 = call i64 @mpn_lshift(ptr noundef %26, ptr noundef %23, i64 noundef %15, i32 noundef %24)
  %28 = icmp eq i64 %27, 0
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  call void @__assert_fail(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.1, i32 noundef 3155, ptr noundef nonnull @__PRETTY_FUNCTION__.mpz_powm) #5
  unreachable

30:                                               ; preds = %25, %21
  %.060 = phi ptr [ null, %21 ], [ %26, %25 ]
  %.059 = phi ptr [ %23, %21 ], [ %26, %25 ]
  call void @mpz_init(ptr noundef nonnull %6)
  %31 = load i32, ptr %8, align 4, !tbaa !5
  %32 = icmp slt i32 %31, 0
  br i1 %32, label %33, label %36

33:                                               ; preds = %30
  %34 = call i32 @mpz_invert(ptr noundef nonnull %6, ptr noundef %1, ptr noundef nonnull %3)
  %.not76 = icmp eq i32 %34, 0
  br i1 %.not76, label %35, label %65

35:                                               ; preds = %33
  call void @gmp_die(ptr noundef nonnull @.str.14)
  br label %65

36:                                               ; preds = %30
  call void @mpz_abs(ptr noundef nonnull %6, ptr noundef %1)
  %37 = getelementptr inbounds i8, ptr %6, i64 4
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %.not75 = icmp slt i32 %38, %14
  br i1 %.not75, label %43, label %40

40:                                               ; preds = %36
  %41 = getelementptr inbounds i8, ptr %6, i64 8
  %42 = load ptr, ptr %41, align 8, !tbaa !11
  call void @mpn_div_qr_preinv(ptr noundef null, ptr noundef %42, i64 noundef %39, ptr noundef %.059, i64 noundef %15, ptr noundef nonnull %7)
  br label %43

43:                                               ; preds = %40, %36
  %.061 = phi i64 [ %15, %40 ], [ %39, %36 ]
  %44 = getelementptr inbounds i8, ptr %1, i64 4
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = icmp slt i32 %45, 0
  br i1 %46, label %47, label %60

47:                                               ; preds = %43
  %48 = load i32, ptr %6, align 16, !tbaa !15
  %49 = icmp sgt i32 %14, %48
  br i1 %49, label %50, label %52

50:                                               ; preds = %47
  %51 = call ptr @mpz_realloc(ptr noundef nonnull %6, i64 noundef %15)
  br label %55

52:                                               ; preds = %47
  %53 = getelementptr inbounds i8, ptr %6, i64 8
  %54 = load ptr, ptr %53, align 8, !tbaa !11
  br label %55

55:                                               ; preds = %52, %50
  %56 = phi ptr [ %51, %50 ], [ %54, %52 ]
  %57 = call i64 @mpn_sub(ptr noundef %56, ptr noundef %.059, i64 noundef %15, ptr noundef %56, i64 noundef %.061)
  %58 = icmp eq i64 %57, 0
  br i1 %58, label %60, label %59

59:                                               ; preds = %55
  call void @__assert_fail(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.1, i32 noundef 3184, ptr noundef nonnull @__PRETTY_FUNCTION__.mpz_powm) #5
  unreachable

60:                                               ; preds = %55, %43
  %.1 = phi i64 [ %.061, %43 ], [ %15, %55 ]
  %61 = getelementptr inbounds i8, ptr %6, i64 8
  %62 = load ptr, ptr %61, align 8, !tbaa !11
  %63 = call i64 @mpn_normalized_size(ptr noundef %62, i64 noundef %.1)
  %64 = trunc i64 %63 to i32
  store i32 %64, ptr %37, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %33, %35, %60
  call void @mpz_init_set_ui(ptr noundef nonnull %5, i64 noundef 1)
  %66 = getelementptr inbounds i8, ptr %2, i64 8
  %67 = getelementptr inbounds i8, ptr %5, i64 4
  %68 = getelementptr inbounds i8, ptr %5, i64 8
  br label %69

69:                                               ; preds = %65, %89
  %.in = phi i64 [ %11, %65 ], [ %70, %89 ]
  %70 = add nsw i64 %.in, -1
  %71 = load ptr, ptr %66, align 8, !tbaa !11
  %72 = getelementptr inbounds i64, ptr %71, i64 %70
  %73 = load i64, ptr %72, align 8, !tbaa !16
  br label %74

74:                                               ; preds = %86, %69
  %.0 = phi i64 [ -9223372036854775808, %69 ], [ %88, %86 ]
  call void @mpz_mul(ptr noundef nonnull %5, ptr noundef nonnull %5, ptr noundef nonnull %5)
  %75 = and i64 %.0, %73
  %.not79 = icmp eq i64 %75, 0
  br i1 %.not79, label %77, label %76

76:                                               ; preds = %74
  call void @mpz_mul(ptr noundef nonnull %5, ptr noundef nonnull %5, ptr noundef nonnull %6)
  br label %77

77:                                               ; preds = %76, %74
  %78 = load i32, ptr %67, align 4, !tbaa !5
  %79 = icmp sgt i32 %78, %14
  br i1 %79, label %80, label %86

80:                                               ; preds = %77
  %81 = sext i32 %78 to i64
  %82 = load ptr, ptr %68, align 8, !tbaa !11
  call void @mpn_div_qr_preinv(ptr noundef null, ptr noundef %82, i64 noundef %81, ptr noundef %.059, i64 noundef %15, ptr noundef nonnull %7)
  %83 = load ptr, ptr %68, align 8, !tbaa !11
  %84 = call i64 @mpn_normalized_size(ptr noundef %83, i64 noundef %15)
  %85 = trunc i64 %84 to i32
  store i32 %85, ptr %67, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %80, %77
  %87 = phi i32 [ %85, %80 ], [ %78, %77 ]
  %88 = lshr i64 %.0, 1
  %.not80 = icmp ult i64 %.0, 2
  br i1 %.not80, label %89, label %74, !llvm.loop !17

89:                                               ; preds = %86
  %90 = icmp sgt i64 %.in, 1
  br i1 %90, label %69, label %91, !llvm.loop !19

91:                                               ; preds = %89
  %.not77 = icmp slt i32 %87, %14
  br i1 %.not77, label %98, label %92

92:                                               ; preds = %91
  store i32 %24, ptr %7, align 8, !tbaa !12
  %93 = load ptr, ptr %68, align 8, !tbaa !11
  %94 = sext i32 %87 to i64
  call void @mpn_div_qr_preinv(ptr noundef null, ptr noundef %93, i64 noundef %94, ptr noundef %.059, i64 noundef %15, ptr noundef nonnull %7)
  %95 = load ptr, ptr %68, align 8, !tbaa !11
  %96 = call i64 @mpn_normalized_size(ptr noundef %95, i64 noundef %15)
  %97 = trunc i64 %96 to i32
  store i32 %97, ptr %67, align 4, !tbaa !5
  br label %98

98:                                               ; preds = %92, %91
  %.not78 = icmp eq ptr %.060, null
  br i1 %.not78, label %101, label %99

99:                                               ; preds = %98
  %100 = load ptr, ptr @gmp_free_func, align 8, !tbaa !20
  call void %100(ptr noundef nonnull %.060, i64 noundef 0) #4
  br label %101

101:                                              ; preds = %99, %98
  call void @mpz_swap(ptr noundef %0, ptr noundef nonnull %5)
  call void @mpz_clear(ptr noundef nonnull %5)
  call void @mpz_clear(ptr noundef nonnull %6)
  br label %102

102:                                              ; preds = %101, %20
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #4
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden void @gmp_die(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @mpn_div_qr_invert(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @mpn_div_qr_preinv(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3

attributes #0 = { mustprogress nocallback nofree nosync 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 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
attributes #5 = { 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, !7, i64 4}
!6 = !{!"", !7, i64 0, !7, i64 4, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!13, !7, i64 0}
!13 = !{!"gmp_div_inverse", !7, i64 0, !14, i64 8, !14, i64 16, !14, i64 24}
!14 = !{!"long", !8, i64 0}
!15 = !{!6, !7, i64 0}
!16 = !{!14, !14, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = !{!10, !10, i64 0}


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