; LLVM IR from VAR-solutions/Algorithms :: Numerical Methods/secant_method/C (gaussseidel)

; 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 [22 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @main() #0 {
  %1 = alloca double, align 8
  %2 = alloca double, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  store double 0.000000e+00, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  store double 0.000000e+00, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  store double 0.000000e+00, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  %8 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %9 = load double, ptr %1, align 8, !tbaa !5
  %10 = load double, ptr %2, align 8, !tbaa !5
  %11 = load double, ptr %3, align 8, !tbaa !5
  %12 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %9, double noundef %10, double noundef %11)
  br label %13

13:                                               ; preds = %63, %0
  %14 = load double, ptr %2, align 8, !tbaa !5
  %15 = call double @llvm.fmuladd.f64(double -2.000000e+01, double %14, double 1.700000e+01)
  %16 = load double, ptr %3, align 8, !tbaa !5
  %17 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %16, double %15)
  %18 = fdiv double %17, 2.000000e+01
  store double %18, ptr %4, align 8, !tbaa !5
  %19 = load double, ptr %4, align 8, !tbaa !5
  %20 = call double @llvm.fmuladd.f64(double -3.000000e+00, double %19, double -1.800000e+01)
  %21 = load double, ptr %3, align 8, !tbaa !5
  %22 = fadd double %20, %21
  %23 = fdiv double %22, 2.000000e+01
  store double %23, ptr %5, align 8, !tbaa !5
  %24 = load double, ptr %4, align 8, !tbaa !5
  %25 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %24, double 2.500000e+01)
  %26 = load double, ptr %5, align 8, !tbaa !5
  %27 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %26, double %25)
  %28 = fdiv double %27, 2.000000e+01
  store double %28, ptr %6, align 8, !tbaa !5
  %29 = load double, ptr %4, align 8, !tbaa !5
  %30 = load double, ptr %1, align 8, !tbaa !5
  %31 = fsub double %29, %30
  %32 = call double @llvm.fabs.f64(double %31)
  %33 = fcmp olt double %32, 1.000000e-04
  br i1 %33, label %34, label %54

34:                                               ; preds = %13
  %35 = load double, ptr %5, align 8, !tbaa !5
  %36 = load double, ptr %2, align 8, !tbaa !5
  %37 = fsub double %35, %36
  %38 = call double @llvm.fabs.f64(double %37)
  %39 = fcmp olt double %38, 1.000000e-04
  br i1 %39, label %40, label %54

40:                                               ; preds = %34
  %41 = load double, ptr %6, align 8, !tbaa !5
  %42 = load double, ptr %3, align 8, !tbaa !5
  %43 = fsub double %41, %42
  %44 = call double @llvm.fabs.f64(double %43)
  %45 = fcmp olt double %44, 1.000000e-04
  br i1 %45, label %46, label %54

46:                                               ; preds = %40
  %47 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %48 = load double, ptr %4, align 8, !tbaa !5
  %49 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, double noundef %48)
  %50 = load double, ptr %5, align 8, !tbaa !5
  %51 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, double noundef %50)
  %52 = load double, ptr %6, align 8, !tbaa !5
  %53 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, double noundef %52)
  store i32 1, ptr %7, align 4, !tbaa !9
  br label %62

54:                                               ; preds = %40, %34, %13
  %55 = load double, ptr %4, align 8, !tbaa !5
  store double %55, ptr %1, align 8, !tbaa !5
  %56 = load double, ptr %5, align 8, !tbaa !5
  store double %56, ptr %2, align 8, !tbaa !5
  %57 = load double, ptr %6, align 8, !tbaa !5
  store double %57, ptr %3, align 8, !tbaa !5
  %58 = load double, ptr %1, align 8, !tbaa !5
  %59 = load double, ptr %2, align 8, !tbaa !5
  %60 = load double, ptr %3, align 8, !tbaa !5
  %61 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %58, double noundef %59, double noundef %60)
  br label %62

62:                                               ; preds = %54, %46
  br label %63

63:                                               ; preds = %62
  %64 = load i32, ptr %7, align 4, !tbaa !9
  %65 = icmp ne i32 %64, 1
  br i1 %65, label %13, label %66, !llvm.loop !11

66:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret void
}

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #3

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

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; 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"

@.str = external hidden unnamed_addr constant [22 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local void @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00)
  br label %3

3:                                                ; preds = %24, %0
  %.028 = phi double [ 0.000000e+00, %0 ], [ %12, %24 ]
  %.026 = phi double [ 0.000000e+00, %0 ], [ %9, %24 ]
  %.024 = phi double [ 0.000000e+00, %0 ], [ %6, %24 ]
  %4 = tail call double @llvm.fmuladd.f64(double %.026, double -2.000000e+01, double 1.700000e+01)
  %5 = tail call double @llvm.fmuladd.f64(double %.028, double 2.000000e+00, double %4)
  %6 = fdiv double %5, 2.000000e+01
  %7 = tail call double @llvm.fmuladd.f64(double %6, double -3.000000e+00, double -1.800000e+01)
  %8 = fadd double %.028, %7
  %9 = fdiv double %8, 2.000000e+01
  %10 = tail call double @llvm.fmuladd.f64(double %6, double -2.000000e+00, double 2.500000e+01)
  %11 = tail call double @llvm.fmuladd.f64(double %9, double 3.000000e+00, double %10)
  %12 = fdiv double %11, 2.000000e+01
  %13 = fsub double %6, %.024
  %14 = tail call double @llvm.fabs.f64(double %13)
  %15 = fcmp olt double %14, 1.000000e-04
  br i1 %15, label %16, label %24

16:                                               ; preds = %3
  %17 = fsub double %9, %.026
  %18 = tail call double @llvm.fabs.f64(double %17)
  %19 = fcmp olt double %18, 1.000000e-04
  br i1 %19, label %20, label %24

20:                                               ; preds = %16
  %21 = fsub double %12, %.028
  %22 = tail call double @llvm.fabs.f64(double %21)
  %23 = fcmp olt double %22, 1.000000e-04
  br i1 %23, label %26, label %24

24:                                               ; preds = %3, %16, %20
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %6, double noundef %9, double noundef %12)
  br label %3, !llvm.loop !5

26:                                               ; preds = %20
  %27 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %6)
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, double noundef %9)
  %30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, double noundef %12)
  ret void
}

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #2

attributes #0 = { nofree 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 = { nofree 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 #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass