; LLVM IR from SanLiWuXun/2phase-LBM-DNS :: LBMDNS (main)

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

@tmax = external dso_local global i32, align 4
@w = external dso_local global [9 x double], align 16
@e_x = external dso_local global [9 x i32], align 16
@f = external dso_local global [201 x [801 x [9 x double]]], align 16
@.str.9 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10EsDataReadv() #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z8EsInterpdd(double noundef, double noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z15SetLBMParameterv() #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z4initv() #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z7Calc_IBv() #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z9evolutionv() #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z12ParticleMovev() #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13writefile_gasi(i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z18writefile_particlei(i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  store i32 0, ptr %1, align 4
  call void @_Z10EsDataReadv()
  call void @_Z15SetLBMParameterv()
  call void @_Z4initv()
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %6

6:                                                ; preds = %21, %0
  %7 = load i32, ptr %2, align 4, !tbaa !5
  %8 = load i32, ptr @tmax, align 4, !tbaa !5
  %9 = icmp sle i32 %7, %8
  br i1 %9, label %11, label %10

10:                                               ; preds = %6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %24

11:                                               ; preds = %6
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, i32 noundef %12)
  call void @_Z7Calc_IBv()
  call void @_Z9evolutionv()
  call void @_Z12ParticleMovev()
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = srem i32 %14, 10
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %20

17:                                               ; preds = %11
  %18 = load i32, ptr %2, align 4, !tbaa !5
  call void @_Z13writefile_gasi(i32 noundef %18)
  %19 = load i32, ptr %2, align 4, !tbaa !5
  call void @_Z18writefile_particlei(i32 noundef %19)
  br label %20

20:                                               ; preds = %17, %11
  br label %21

21:                                               ; preds = %20
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = add nsw i32 %22, 1
  store i32 %23, ptr %2, align 4, !tbaa !5
  br label %6, !llvm.loop !9

24:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store double 4.900000e-01, ptr %3, align 8, !tbaa !11
  store double 8.400000e-01, ptr %4, align 8, !tbaa !11
  %25 = load double, ptr %3, align 8, !tbaa !11
  %26 = load double, ptr %4, align 8, !tbaa !11
  %27 = call noundef double @_Z8EsInterpdd(double noundef %25, double noundef %26)
  store double %27, ptr %5, align 8, !tbaa !11
  %28 = load double, ptr %3, align 8, !tbaa !11
  %29 = load double, ptr %4, align 8, !tbaa !11
  %30 = load double, ptr %5, align 8, !tbaa !11
  %31 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, double noundef %28, double noundef %29, double noundef %30)
  %32 = load double, ptr getelementptr inbounds ([9 x double], ptr @w, i64 0, i64 1), align 8, !tbaa !11
  %33 = load i32, ptr getelementptr inbounds ([9 x i32], ptr @e_x, i64 0, i64 6), align 8, !tbaa !5
  %34 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, double noundef %32, i32 noundef %33)
  %35 = load double, ptr getelementptr inbounds ([9 x double], ptr getelementptr inbounds ([801 x [9 x double]], ptr getelementptr inbounds ([201 x [801 x [9 x double]]], ptr @f, i64 0, i64 100), i64 0, i64 400), i64 0, i64 5), align 8, !tbaa !11
  %36 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, double noundef %35)
  %37 = call i32 @getchar()
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  ret i32 1
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @getchar() #5

attributes #0 = { mustprogress 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 = { mustprogress 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 #3 = { mustprogress norecurse 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 = { "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 #5 = { inlinehint mustprogress 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 #6 = { 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++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !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"

@tmax = external dso_local local_unnamed_addr global i32, align 4
@w = external dso_local local_unnamed_addr global [9 x double], align 16
@e_x = external dso_local local_unnamed_addr global [9 x i32], align 16
@f = external dso_local local_unnamed_addr global [201 x [801 x [9 x double]]], align 16
@.str.9 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10EsDataReadv() local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z8EsInterpdd(double noundef, double noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z15SetLBMParameterv() local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z4initv() local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z7Calc_IBv() local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z9evolutionv() local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z12ParticleMovev() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13writefile_gasi(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z18writefile_particlei(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  tail call void @_Z10EsDataReadv()
  tail call void @_Z15SetLBMParameterv()
  tail call void @_Z4initv()
  %1 = load i32, ptr @tmax, align 4, !tbaa !5
  %.not10 = icmp slt i32 %1, 0
  br i1 %.not10, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %14, %0
  %2 = tail call noundef double @_Z8EsInterpdd(double noundef 4.900000e-01, double noundef 8.400000e-01)
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, double noundef 4.900000e-01, double noundef 8.400000e-01, double noundef %2)
  %4 = load double, ptr getelementptr inbounds (i8, ptr @w, i64 8), align 8, !tbaa !9
  %5 = load i32, ptr getelementptr inbounds (i8, ptr @e_x, i64 24), align 8, !tbaa !5
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, double noundef %4, i32 noundef %5)
  %7 = load double, ptr getelementptr inbounds (i8, ptr @f, i64 5796040), align 8, !tbaa !9
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, double noundef %7)
  %9 = tail call i32 @getchar()
  ret i32 1

.lr.ph:                                           ; preds = %0, %14
  %.011 = phi i32 [ %15, %14 ], [ 0, %0 ]
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i32 noundef %.011)
  tail call void @_Z7Calc_IBv()
  tail call void @_Z9evolutionv()
  tail call void @_Z12ParticleMovev()
  %11 = urem i32 %.011, 10
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %13, label %14

13:                                               ; preds = %.lr.ph
  tail call void @_Z13writefile_gasi(i32 noundef %.011)
  tail call void @_Z18writefile_particlei(i32 noundef %.011)
  br label %14

14:                                               ; preds = %.lr.ph, %13
  %15 = add nuw nsw i32 %.011, 1
  %16 = load i32, ptr @tmax, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.011, %16
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11
}

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

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @getchar() local_unnamed_addr #4

attributes #0 = { mustprogress 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 = { mustprogress 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 = { mustprogress norecurse 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 #3 = { 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 #4 = { inlinehint mustprogress 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" }

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass