; LLVM IR from Tiramisu-Compiler/tiramisu :: 3rdParty/isl/imath (gmp_compat)

; 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 = type { i32, ptr, i32, i32, i8 }

@MP_OK = external constant i32, align 4
@.str.2 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [48 x i8], align 1
@__PRETTY_FUNCTION__.impz_fdiv_r = external hidden unnamed_addr constant [41 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [61 x i8], align 1

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

declare void @mp_int_clear(ptr noundef) #1

declare i32 @mp_int_init(ptr noundef) #1

declare i32 @mp_int_mul(ptr noundef, ptr noundef, ptr noundef) #1

declare i32 @mp_int_sub(ptr noundef, ptr noundef, ptr noundef) #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @impz_fdiv_r(ptr noundef %0, ptr noundef %1, ptr noundef %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %struct.mpz, align 8
  %8 = alloca %struct.mpz, align 8
  %9 = alloca %struct.mpz, align 8
  %10 = alloca %struct.mpz, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store ptr %7, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store ptr %8, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store ptr %9, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  store ptr %10, ptr %14, align 8, !tbaa !5
  %15 = load ptr, ptr %11, align 8, !tbaa !5
  %16 = call i32 @mp_int_init(ptr noundef %15)
  %17 = load i32, ptr @MP_OK, align 4, !tbaa !9
  %18 = icmp eq i32 %16, %17
  br i1 %18, label %19, label %21

19:                                               ; preds = %3
  br i1 true, label %20, label %21

20:                                               ; preds = %19
  br label %22

21:                                               ; preds = %19, %3
  call void @__assert_fail(ptr noundef @.str.43, ptr noundef @.str.2, i32 noundef 634, ptr noundef @__PRETTY_FUNCTION__.impz_fdiv_r) #5
  unreachable

22:                                               ; preds = %20
  %23 = load ptr, ptr %12, align 8, !tbaa !5
  %24 = call i32 @mp_int_init(ptr noundef %23)
  %25 = load i32, ptr @MP_OK, align 4, !tbaa !9
  %26 = icmp eq i32 %24, %25
  br i1 %26, label %27, label %29

27:                                               ; preds = %22
  br i1 true, label %28, label %29

28:                                               ; preds = %27
  br label %30

29:                                               ; preds = %27, %22
  call void @__assert_fail(ptr noundef @.str.44, ptr noundef @.str.2, i32 noundef 635, ptr noundef @__PRETTY_FUNCTION__.impz_fdiv_r) #5
  unreachable

30:                                               ; preds = %28
  %31 = load ptr, ptr %13, align 8, !tbaa !5
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = call i32 @mp_int_init_copy(ptr noundef %31, ptr noundef %32)
  %34 = load i32, ptr @MP_OK, align 4, !tbaa !9
  %35 = icmp eq i32 %33, %34
  br i1 %35, label %36, label %38

36:                                               ; preds = %30
  br i1 true, label %37, label %38

37:                                               ; preds = %36
  br label %39

38:                                               ; preds = %36, %30
  call void @__assert_fail(ptr noundef @.str.45, ptr noundef @.str.2, i32 noundef 637, ptr noundef @__PRETTY_FUNCTION__.impz_fdiv_r) #5
  unreachable

39:                                               ; preds = %37
  %40 = load ptr, ptr %14, align 8, !tbaa !5
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = call i32 @mp_int_init_copy(ptr noundef %40, ptr noundef %41)
  %43 = load i32, ptr @MP_OK, align 4, !tbaa !9
  %44 = icmp eq i32 %42, %43
  br i1 %44, label %45, label %47

45:                                               ; preds = %39
  br i1 true, label %46, label %47

46:                                               ; preds = %45
  br label %48

47:                                               ; preds = %45, %39
  call void @__assert_fail(ptr noundef @.str.46, ptr noundef @.str.2, i32 noundef 638, ptr noundef @__PRETTY_FUNCTION__.impz_fdiv_r) #5
  unreachable

48:                                               ; preds = %46
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  call void @impz_fdiv_q(ptr noundef %49, ptr noundef %50, ptr noundef %51)
  %52 = load ptr, ptr %11, align 8, !tbaa !5
  %53 = load ptr, ptr %13, align 8, !tbaa !5
  %54 = load ptr, ptr %12, align 8, !tbaa !5
  %55 = call i32 @mp_int_mul(ptr noundef %52, ptr noundef %53, ptr noundef %54)
  %56 = load ptr, ptr %14, align 8, !tbaa !5
  %57 = load ptr, ptr %12, align 8, !tbaa !5
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = call i32 @mp_int_sub(ptr noundef %56, ptr noundef %57, ptr noundef %58)
  %60 = load ptr, ptr %11, align 8, !tbaa !5
  call void @mp_int_clear(ptr noundef %60)
  %61 = load ptr, ptr %12, align 8, !tbaa !5
  call void @mp_int_clear(ptr noundef %61)
  %62 = load ptr, ptr %13, align 8, !tbaa !5
  call void @mp_int_clear(ptr noundef %62)
  %63 = load ptr, ptr %14, align 8, !tbaa !5
  call void @mp_int_clear(ptr noundef %63)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #4
  ret void
}

declare i32 @mp_int_init_copy(ptr noundef, ptr noundef) #1

attributes #0 = { 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 #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


; 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 = type { i32, ptr, i32, i32, i8 }

@MP_OK = external local_unnamed_addr constant i32, align 4
@.str.2 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [48 x i8], align 1
@__PRETTY_FUNCTION__.impz_fdiv_r = external hidden unnamed_addr constant [41 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [61 x i8], align 1

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

declare void @mp_int_clear(ptr noundef) local_unnamed_addr #1

declare i32 @mp_int_init(ptr noundef) local_unnamed_addr #1

declare i32 @mp_int_mul(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @mp_int_sub(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @impz_fdiv_r(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #3 {
  %4 = alloca %struct.mpz, align 8
  %5 = alloca %struct.mpz, align 8
  %6 = alloca %struct.mpz, align 8
  %7 = alloca %struct.mpz, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #4
  %8 = call i32 @mp_int_init(ptr noundef nonnull %4) #4
  %9 = load i32, ptr @MP_OK, align 4, !tbaa !5
  %10 = icmp eq i32 %8, %9
  br i1 %10, label %12, label %11

11:                                               ; preds = %3
  call void @__assert_fail(ptr noundef nonnull @.str.43, ptr noundef nonnull @.str.2, i32 noundef 634, ptr noundef nonnull @__PRETTY_FUNCTION__.impz_fdiv_r) #5
  unreachable

12:                                               ; preds = %3
  %13 = call i32 @mp_int_init(ptr noundef nonnull %5) #4
  %14 = icmp eq i32 %13, %8
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  call void @__assert_fail(ptr noundef nonnull @.str.44, ptr noundef nonnull @.str.2, i32 noundef 635, ptr noundef nonnull @__PRETTY_FUNCTION__.impz_fdiv_r) #5
  unreachable

16:                                               ; preds = %12
  %17 = call i32 @mp_int_init_copy(ptr noundef nonnull %6, ptr noundef %2) #4
  %18 = icmp eq i32 %17, %8
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  call void @__assert_fail(ptr noundef nonnull @.str.45, ptr noundef nonnull @.str.2, i32 noundef 637, ptr noundef nonnull @__PRETTY_FUNCTION__.impz_fdiv_r) #5
  unreachable

20:                                               ; preds = %16
  %21 = call i32 @mp_int_init_copy(ptr noundef nonnull %7, ptr noundef %1) #4
  %22 = icmp eq i32 %21, %8
  br i1 %22, label %24, label %23

23:                                               ; preds = %20
  call void @__assert_fail(ptr noundef nonnull @.str.46, ptr noundef nonnull @.str.2, i32 noundef 638, ptr noundef nonnull @__PRETTY_FUNCTION__.impz_fdiv_r) #5
  unreachable

24:                                               ; preds = %20
  call void @impz_fdiv_q(ptr noundef nonnull %4, ptr noundef %1, ptr noundef %2)
  %25 = call i32 @mp_int_mul(ptr noundef nonnull %4, ptr noundef nonnull %6, ptr noundef nonnull %5) #4
  %26 = call i32 @mp_int_sub(ptr noundef nonnull %7, ptr noundef nonnull %5, ptr noundef %0) #4
  call void @mp_int_clear(ptr noundef nonnull %4) #4
  call void @mp_int_clear(ptr noundef nonnull %5) #4
  call void @mp_int_clear(ptr noundef nonnull %6) #4
  call void @mp_int_clear(ptr noundef nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  ret void
}

declare i32 @mp_int_init_copy(ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { 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 #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass