; 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.19 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [61 x i8], align 1
@__PRETTY_FUNCTION__.impz_fdiv_q_ui = external hidden unnamed_addr constant [60 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [56 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

; 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

declare i32 @mp_int_init_uvalue(ptr noundef, i64 noundef) #1

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @impz_fdiv_q_ui(ptr noundef %0, ptr noundef %1, i64 noundef %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca %struct.mpz, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %struct.mpz, align 8
  %10 = alloca ptr, align 8
  %11 = alloca %struct.mpz, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store ptr %7, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  store ptr %9, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store ptr %11, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %14 = load ptr, ptr %8, align 8, !tbaa !5
  %15 = load i64, ptr %6, align 8, !tbaa !9
  %16 = call i32 @mp_int_init_uvalue(ptr noundef %14, i64 noundef %15)
  %17 = load i32, ptr @MP_OK, align 4, !tbaa !11
  %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.24, ptr noundef @.str.2, i32 noundef 669, ptr noundef @__PRETTY_FUNCTION__.impz_fdiv_q_ui) #5
  unreachable

22:                                               ; preds = %20
  %23 = load ptr, ptr %10, align 8, !tbaa !5
  %24 = call i32 @mp_int_init(ptr noundef %23)
  %25 = load i32, ptr @MP_OK, align 4, !tbaa !11
  %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.19, ptr noundef @.str.2, i32 noundef 670, ptr noundef @__PRETTY_FUNCTION__.impz_fdiv_q_ui) #5
  unreachable

30:                                               ; preds = %28
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  %32 = load ptr, ptr %5, 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 !11
  %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.46, ptr noundef @.str.2, i32 noundef 672, ptr noundef @__PRETTY_FUNCTION__.impz_fdiv_q_ui) #5
  unreachable

39:                                               ; preds = %37
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  call void @impz_fdiv_q(ptr noundef %40, ptr noundef %41, ptr noundef %42)
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = load ptr, ptr %12, align 8, !tbaa !5
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  call void @impz_fdiv_r(ptr noundef %43, ptr noundef %44, ptr noundef %45)
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = call i32 @mp_int_to_uint(ptr noundef %46, ptr noundef %13)
  %48 = load i32, ptr @MP_OK, align 4, !tbaa !11
  %49 = icmp eq i32 %47, %48
  br i1 %49, label %50, label %52

50:                                               ; preds = %39
  br i1 true, label %51, label %52

51:                                               ; preds = %50
  br label %53

52:                                               ; preds = %50, %39
  call void @__assert_fail(ptr noundef @.str.47, ptr noundef @.str.2, i32 noundef 677, ptr noundef @__PRETTY_FUNCTION__.impz_fdiv_q_ui) #5
  unreachable

53:                                               ; preds = %51
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  call void @mp_int_clear(ptr noundef %54)
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  call void @mp_int_clear(ptr noundef %55)
  %56 = load ptr, ptr %12, align 8, !tbaa !5
  call void @mp_int_clear(ptr noundef %56)
  %57 = load i64, ptr %13, align 8, !tbaa !9
  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 32, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #4
  ret i64 %57
}

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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"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.19 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [61 x i8], align 1
@__PRETTY_FUNCTION__.impz_fdiv_q_ui = external hidden unnamed_addr constant [60 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [56 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

; 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

declare i32 @mp_int_init_uvalue(ptr noundef, i64 noundef) local_unnamed_addr #1

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

; 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
declare dso_local void @impz_fdiv_r(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
define dso_local i64 @impz_fdiv_q_ui(ptr noundef %0, ptr noundef %1, i64 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 i64, 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 8, ptr nonnull %7) #4
  %8 = call i32 @mp_int_init_uvalue(ptr noundef nonnull %4, i64 noundef %2) #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.24, ptr noundef nonnull @.str.2, i32 noundef 669, ptr noundef nonnull @__PRETTY_FUNCTION__.impz_fdiv_q_ui) #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.19, ptr noundef nonnull @.str.2, i32 noundef 670, ptr noundef nonnull @__PRETTY_FUNCTION__.impz_fdiv_q_ui) #5
  unreachable

16:                                               ; preds = %12
  %17 = call i32 @mp_int_init_copy(ptr noundef nonnull %6, ptr noundef %1) #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.46, ptr noundef nonnull @.str.2, i32 noundef 672, ptr noundef nonnull @__PRETTY_FUNCTION__.impz_fdiv_q_ui) #5
  unreachable

20:                                               ; preds = %16
  call void @impz_fdiv_q(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %4)
  call void @impz_fdiv_r(ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %4)
  %21 = call i32 @mp_int_to_uint(ptr noundef nonnull %5, ptr noundef nonnull %7) #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.47, ptr noundef nonnull @.str.2, i32 noundef 677, ptr noundef nonnull @__PRETTY_FUNCTION__.impz_fdiv_q_ui) #5
  unreachable

24:                                               ; preds = %20
  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
  %25 = load i64, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, 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 i64 %25
}

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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}


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