; 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
@__PRETTY_FUNCTION__.impz_cdiv_q = external hidden unnamed_addr constant [41 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.40 = 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

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

declare i32 @mp_int_compare_zero(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_div(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @impz_cdiv_q(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 ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  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 8, ptr %8) #4
  store ptr %7, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %13 = load ptr, ptr %8, align 8, !tbaa !5
  %14 = call i32 @mp_int_init(ptr noundef %13)
  %15 = load i32, ptr @MP_OK, align 4, !tbaa !9
  %16 = icmp eq i32 %14, %15
  br i1 %16, label %17, label %19

17:                                               ; preds = %3
  br i1 true, label %18, label %19

18:                                               ; preds = %17
  br label %20

19:                                               ; preds = %17, %3
  call void @__assert_fail(ptr noundef @.str.19, ptr noundef @.str.2, i32 noundef 565, ptr noundef @__PRETTY_FUNCTION__.impz_cdiv_q) #5
  unreachable

20:                                               ; preds = %18
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = call i32 @mp_int_compare_zero(ptr noundef %21)
  store i32 %22, ptr %11, align 4, !tbaa !9
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = call i32 @mp_int_compare_zero(ptr noundef %23)
  store i32 %24, ptr %12, align 4, !tbaa !9
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = call i32 @mp_int_div(ptr noundef %25, ptr noundef %26, ptr noundef %27, ptr noundef %28)
  %30 = load i32, ptr @MP_OK, align 4, !tbaa !9
  %31 = icmp eq i32 %29, %30
  br i1 %31, label %32, label %34

32:                                               ; preds = %20
  br i1 true, label %33, label %34

33:                                               ; preds = %32
  br label %35

34:                                               ; preds = %32, %20
  call void @__assert_fail(ptr noundef @.str.38, ptr noundef @.str.2, i32 noundef 572, ptr noundef @__PRETTY_FUNCTION__.impz_cdiv_q) #5
  unreachable

35:                                               ; preds = %33
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = call i32 @mp_int_compare_zero(ptr noundef %36)
  store i32 %37, ptr %9, align 4, !tbaa !9
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = call i32 @mp_int_compare_zero(ptr noundef %38)
  store i32 %39, ptr %10, align 4, !tbaa !9
  %40 = load i32, ptr %9, align 4, !tbaa !9
  %41 = icmp sgt i32 %40, 0
  br i1 %41, label %42, label %56

42:                                               ; preds = %35
  %43 = load i32, ptr %10, align 4, !tbaa !9
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %55

45:                                               ; preds = %42
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = call i32 @mp_int_add_value(ptr noundef %46, i64 noundef 1, ptr noundef %47)
  %49 = load i32, ptr @MP_OK, align 4, !tbaa !9
  %50 = icmp eq i32 %48, %49
  br i1 %50, label %51, label %53

51:                                               ; preds = %45
  br i1 true, label %52, label %53

52:                                               ; preds = %51
  br label %54

53:                                               ; preds = %51, %45
  call void @__assert_fail(ptr noundef @.str.39, ptr noundef @.str.2, i32 noundef 579, ptr noundef @__PRETTY_FUNCTION__.impz_cdiv_q) #5
  unreachable

54:                                               ; preds = %52
  br label %55

55:                                               ; preds = %54, %42
  br label %86

56:                                               ; preds = %35
  %57 = load i32, ptr %9, align 4, !tbaa !9
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %85

59:                                               ; preds = %56
  %60 = load i32, ptr %10, align 4, !tbaa !9
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %62, label %84

62:                                               ; preds = %59
  %63 = load i32, ptr %11, align 4, !tbaa !9
  %64 = icmp sgt i32 %63, 0
  br i1 %64, label %65, label %68

65:                                               ; preds = %62
  %66 = load i32, ptr %12, align 4, !tbaa !9
  %67 = icmp sgt i32 %66, 0
  br i1 %67, label %74, label %68

68:                                               ; preds = %65, %62
  %69 = load i32, ptr %11, align 4, !tbaa !9
  %70 = icmp slt i32 %69, 0
  br i1 %70, label %71, label %83

71:                                               ; preds = %68
  %72 = load i32, ptr %12, align 4, !tbaa !9
  %73 = icmp slt i32 %72, 0
  br i1 %73, label %74, label %83

74:                                               ; preds = %71, %65
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = call i32 @mp_int_set_value(ptr noundef %75, i64 noundef 1)
  %77 = load i32, ptr @MP_OK, align 4, !tbaa !9
  %78 = icmp eq i32 %76, %77
  br i1 %78, label %79, label %81

79:                                               ; preds = %74
  br i1 true, label %80, label %81

80:                                               ; preds = %79
  br label %82

81:                                               ; preds = %79, %74
  call void @__assert_fail(ptr noundef @.str.40, ptr noundef @.str.2, i32 noundef 585, ptr noundef @__PRETTY_FUNCTION__.impz_cdiv_q) #5
  unreachable

82:                                               ; preds = %80
  br label %83

83:                                               ; preds = %82, %71, %68
  br label %84

84:                                               ; preds = %83, %59
  br label %85

85:                                               ; preds = %84, %56
  br label %86

86:                                               ; preds = %85, %55
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  call void @mp_int_clear(ptr noundef %87)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, 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 void
}

declare i32 @mp_int_add_value(ptr noundef, i64 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.19 = external hidden unnamed_addr constant [48 x i8], align 1
@__PRETTY_FUNCTION__.impz_cdiv_q = external hidden unnamed_addr constant [41 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.40 = 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

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

declare i32 @mp_int_compare_zero(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_div(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

8:                                                ; preds = %3
  call void @__assert_fail(ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.2, i32 noundef 565, ptr noundef nonnull @__PRETTY_FUNCTION__.impz_cdiv_q) #5
  unreachable

9:                                                ; preds = %3
  %10 = call i32 @mp_int_compare_zero(ptr noundef %1) #4
  %11 = call i32 @mp_int_compare_zero(ptr noundef %2) #4
  %12 = call i32 @mp_int_div(ptr noundef %1, ptr noundef %2, ptr noundef %0, ptr noundef nonnull %4) #4
  %13 = icmp eq i32 %12, %5
  br i1 %13, label %15, label %14

14:                                               ; preds = %9
  call void @__assert_fail(ptr noundef nonnull @.str.38, ptr noundef nonnull @.str.2, i32 noundef 572, ptr noundef nonnull @__PRETTY_FUNCTION__.impz_cdiv_q) #5
  unreachable

15:                                               ; preds = %9
  %16 = call i32 @mp_int_compare_zero(ptr noundef %0) #4
  %17 = call i32 @mp_int_compare_zero(ptr noundef nonnull %4) #4
  %18 = icmp sgt i32 %16, 0
  br i1 %18, label %19, label %24

19:                                               ; preds = %15
  %.not = icmp eq i32 %17, 0
  br i1 %.not, label %37, label %20

20:                                               ; preds = %19
  %21 = call i32 @mp_int_add_value(ptr noundef %0, i64 noundef 1, ptr noundef %0) #4
  %22 = icmp eq i32 %21, %5
  br i1 %22, label %37, label %23

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

24:                                               ; preds = %15
  %25 = icmp eq i32 %16, 0
  %26 = icmp ne i32 %17, 0
  %or.cond5 = select i1 %25, i1 %26, i1 false
  br i1 %or.cond5, label %27, label %37

27:                                               ; preds = %24
  %28 = icmp sgt i32 %10, 0
  %29 = icmp sgt i32 %11, 0
  %or.cond = select i1 %28, i1 %29, i1 false
  br i1 %or.cond, label %33, label %30

30:                                               ; preds = %27
  %31 = icmp slt i32 %10, 0
  %32 = icmp slt i32 %11, 0
  %or.cond3 = select i1 %31, i1 %32, i1 false
  br i1 %or.cond3, label %33, label %37

33:                                               ; preds = %30, %27
  %34 = call i32 @mp_int_set_value(ptr noundef %0, i64 noundef 1) #4
  %35 = icmp eq i32 %34, %5
  br i1 %35, label %37, label %36

36:                                               ; preds = %33
  call void @__assert_fail(ptr noundef nonnull @.str.40, ptr noundef nonnull @.str.2, i32 noundef 585, ptr noundef nonnull @__PRETTY_FUNCTION__.impz_cdiv_q) #5
  unreachable

37:                                               ; preds = %24, %30, %33, %19, %20
  call void @mp_int_clear(ptr noundef nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  ret void
}

declare i32 @mp_int_add_value(ptr noundef, i64 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