; LLVM IR from zhenrong-wang/co2 :: co2_property_calc (deltlmd)

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

@Bc = external dso_local constant [6 x [3 x double]], align 16

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

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

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

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #2

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

7:                                                ; preds = %34, %2
  %8 = load i32, ptr %6, align 4, !tbaa !9
  %9 = icmp slt i32 %8, 6
  br i1 %9, label %10, label %37

10:                                               ; preds = %7
  %11 = load i32, ptr %6, align 4, !tbaa !9
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [6 x [3 x double]], ptr @Bc, i64 0, i64 %12
  %14 = getelementptr inbounds [3 x double], ptr %13, i64 0, i64 1
  %15 = load double, ptr %14, align 8, !tbaa !5
  %16 = load i32, ptr %6, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [6 x [3 x double]], ptr @Bc, i64 0, i64 %17
  %19 = getelementptr inbounds [3 x double], ptr %18, i64 0, i64 2
  %20 = load double, ptr %19, align 8, !tbaa !5
  %21 = load double, ptr %3, align 8, !tbaa !5
  %22 = fdiv double %21, 0x4073020D1B71758E
  %23 = call double @llvm.fmuladd.f64(double %20, double %22, double %15)
  %24 = load double, ptr %4, align 8, !tbaa !5
  %25 = fdiv double %24, 4.676000e+02
  %26 = load i32, ptr %6, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [6 x [3 x double]], ptr @Bc, i64 0, i64 %27
  %29 = getelementptr inbounds [3 x double], ptr %28, i64 0, i64 0
  %30 = load double, ptr %29, align 8, !tbaa !5
  %31 = call double @pow(double noundef %25, double noundef %30) #4
  %32 = load double, ptr %5, align 8, !tbaa !5
  %33 = call double @llvm.fmuladd.f64(double %23, double %31, double %32)
  store double %33, ptr %5, align 8, !tbaa !5
  br label %34

34:                                               ; preds = %10
  %35 = load i32, ptr %6, align 4, !tbaa !9
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %6, align 4, !tbaa !9
  br label %7, !llvm.loop !11

37:                                               ; preds = %7
  %38 = load double, ptr %5, align 8, !tbaa !5
  %39 = fmul double 1.000000e+03, %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret double %39
}

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

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

@Bc = external dso_local local_unnamed_addr constant [6 x [3 x double]], align 16

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
define dso_local double @deltlmd(double noundef %0, double noundef %1) local_unnamed_addr #2 {
  %3 = fdiv double %0, 0x4073020D1B71758E
  %4 = fdiv double %1, 4.676000e+02
  %5 = load double, ptr getelementptr inbounds (i8, ptr @Bc, i64 8), align 8, !tbaa !5
  %6 = load double, ptr getelementptr inbounds (i8, ptr @Bc, i64 16), align 16, !tbaa !5
  %7 = tail call double @llvm.fmuladd.f64(double %6, double %3, double %5)
  %8 = load double, ptr @Bc, align 16, !tbaa !5
  %9 = tail call double @pow(double noundef %4, double noundef %8) #3
  %10 = tail call double @llvm.fmuladd.f64(double %7, double %9, double 0.000000e+00)
  %11 = load double, ptr getelementptr inbounds (i8, ptr @Bc, i64 32), align 16, !tbaa !5
  %12 = load double, ptr getelementptr inbounds (i8, ptr @Bc, i64 40), align 8, !tbaa !5
  %13 = tail call double @llvm.fmuladd.f64(double %12, double %3, double %11)
  %14 = load double, ptr getelementptr inbounds (i8, ptr @Bc, i64 24), align 8, !tbaa !5
  %15 = tail call double @pow(double noundef %4, double noundef %14) #3
  %16 = tail call double @llvm.fmuladd.f64(double %13, double %15, double %10)
  %17 = load double, ptr getelementptr inbounds (i8, ptr @Bc, i64 56), align 8, !tbaa !5
  %18 = load double, ptr getelementptr inbounds (i8, ptr @Bc, i64 64), align 16, !tbaa !5
  %19 = tail call double @llvm.fmuladd.f64(double %18, double %3, double %17)
  %20 = load double, ptr getelementptr inbounds (i8, ptr @Bc, i64 48), align 16, !tbaa !5
  %21 = tail call double @pow(double noundef %4, double noundef %20) #3
  %22 = tail call double @llvm.fmuladd.f64(double %19, double %21, double %16)
  %23 = load double, ptr getelementptr inbounds (i8, ptr @Bc, i64 80), align 16, !tbaa !5
  %24 = load double, ptr getelementptr inbounds (i8, ptr @Bc, i64 88), align 8, !tbaa !5
  %25 = tail call double @llvm.fmuladd.f64(double %24, double %3, double %23)
  %26 = load double, ptr getelementptr inbounds (i8, ptr @Bc, i64 72), align 8, !tbaa !5
  %27 = tail call double @pow(double noundef %4, double noundef %26) #3
  %28 = tail call double @llvm.fmuladd.f64(double %25, double %27, double %22)
  %29 = load double, ptr getelementptr inbounds (i8, ptr @Bc, i64 104), align 8, !tbaa !5
  %30 = load double, ptr getelementptr inbounds (i8, ptr @Bc, i64 112), align 16, !tbaa !5
  %31 = tail call double @llvm.fmuladd.f64(double %30, double %3, double %29)
  %32 = load double, ptr getelementptr inbounds (i8, ptr @Bc, i64 96), align 16, !tbaa !5
  %33 = tail call double @pow(double noundef %4, double noundef %32) #3
  %34 = tail call double @llvm.fmuladd.f64(double %31, double %33, double %28)
  %35 = load double, ptr getelementptr inbounds (i8, ptr @Bc, i64 128), align 16, !tbaa !5
  %36 = load double, ptr getelementptr inbounds (i8, ptr @Bc, i64 136), align 8, !tbaa !5
  %37 = tail call double @llvm.fmuladd.f64(double %36, double %3, double %35)
  %38 = load double, ptr getelementptr inbounds (i8, ptr @Bc, i64 120), align 8, !tbaa !5
  %39 = tail call double @pow(double noundef %4, double noundef %38) #3
  %40 = tail call double @llvm.fmuladd.f64(double %37, double %39, double %34)
  %41 = fmul double %40, 1.000000e+03
  ret double %41
}

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass