; LLVM IR from tangjz/acm-icpc :: uvalive/6135.ll (Z3asrdddd)

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

; 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: mustprogress nounwind uwtable
declare dso_local noundef double @_Z7simpsondd(double noundef, double noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_Z3asrdddd(double noundef %0, double noundef %1, double noundef %2, double noundef %3) #2 {
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca i32, align 4
  store double %0, ptr %6, align 8, !tbaa !5
  store double %1, ptr %7, align 8, !tbaa !5
  store double %2, ptr %8, align 8, !tbaa !5
  store double %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %14 = load double, ptr %6, align 8, !tbaa !5
  %15 = load double, ptr %7, align 8, !tbaa !5
  %16 = load double, ptr %6, align 8, !tbaa !5
  %17 = fsub double %15, %16
  %18 = fdiv double %17, 2.000000e+00
  %19 = fadd double %14, %18
  store double %19, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %20 = load double, ptr %6, align 8, !tbaa !5
  %21 = load double, ptr %10, align 8, !tbaa !5
  %22 = call noundef double @_Z7simpsondd(double noundef %20, double noundef %21)
  store double %22, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %23 = load double, ptr %10, align 8, !tbaa !5
  %24 = load double, ptr %7, align 8, !tbaa !5
  %25 = call noundef double @_Z7simpsondd(double noundef %23, double noundef %24)
  store double %25, ptr %12, align 8, !tbaa !5
  %26 = load double, ptr %11, align 8, !tbaa !5
  %27 = load double, ptr %12, align 8, !tbaa !5
  %28 = fadd double %26, %27
  %29 = load double, ptr %9, align 8, !tbaa !5
  %30 = fsub double %28, %29
  %31 = call double @llvm.fabs.f64(double %30)
  %32 = load double, ptr %8, align 8, !tbaa !5
  %33 = fmul double 1.500000e+01, %32
  %34 = fcmp ole double %31, %33
  br i1 %34, label %35, label %46

35:                                               ; preds = %4
  %36 = load double, ptr %11, align 8, !tbaa !5
  %37 = load double, ptr %12, align 8, !tbaa !5
  %38 = fadd double %36, %37
  %39 = load double, ptr %11, align 8, !tbaa !5
  %40 = load double, ptr %12, align 8, !tbaa !5
  %41 = fadd double %39, %40
  %42 = load double, ptr %9, align 8, !tbaa !5
  %43 = fsub double %41, %42
  %44 = fdiv double %43, 1.500000e+01
  %45 = fadd double %38, %44
  store double %45, ptr %5, align 8
  store i32 1, ptr %13, align 4
  br label %60

46:                                               ; preds = %4
  %47 = load double, ptr %6, align 8, !tbaa !5
  %48 = load double, ptr %10, align 8, !tbaa !5
  %49 = load double, ptr %8, align 8, !tbaa !5
  %50 = fdiv double %49, 2.000000e+00
  %51 = load double, ptr %11, align 8, !tbaa !5
  %52 = call noundef double @_Z3asrdddd(double noundef %47, double noundef %48, double noundef %50, double noundef %51)
  %53 = load double, ptr %10, align 8, !tbaa !5
  %54 = load double, ptr %7, align 8, !tbaa !5
  %55 = load double, ptr %8, align 8, !tbaa !5
  %56 = fdiv double %55, 2.000000e+00
  %57 = load double, ptr %12, align 8, !tbaa !5
  %58 = call noundef double @_Z3asrdddd(double noundef %53, double noundef %54, double noundef %56, double noundef %57)
  %59 = fadd double %52, %58
  store double %59, ptr %5, align 8
  store i32 1, ptr %13, align 4
  br label %60

60:                                               ; preds = %46, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %61 = load double, ptr %5, align 8
  ret double %61
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = { 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++ TBAA"}


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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_Z3asrdddd(double noundef %0, double noundef %1, double noundef %2, double noundef %3) local_unnamed_addr #0 {
  %5 = fsub double %1, %0
  %6 = fmul double %5, 5.000000e-01
  %7 = fadd double %6, %0
  %8 = tail call noundef double @_Z7simpsondd(double noundef %0, double noundef %7)
  %9 = tail call noundef double @_Z7simpsondd(double noundef %7, double noundef %1)
  %10 = fadd double %8, %9
  %11 = fsub double %10, %3
  %12 = tail call double @llvm.fabs.f64(double %11)
  %13 = fmul double %2, 1.500000e+01
  %14 = fcmp ugt double %12, %13
  br i1 %14, label %17, label %common.ret

common.ret:                                       ; preds = %4
  %15 = fdiv double %11, 1.500000e+01
  %16 = fadd double %10, %15
  br label %common.ret25

common.ret25:                                     ; preds = %17, %common.ret
  %common.ret25.op = phi double [ %16, %common.ret ], [ %21, %17 ]
  ret double %common.ret25.op

17:                                               ; preds = %4
  %18 = fmul double %2, 5.000000e-01
  %19 = tail call noundef double @_Z3asrdddd(double noundef %0, double noundef %7, double noundef %18, double noundef %8)
  %20 = tail call noundef double @_Z3asrdddd(double noundef %7, double noundef %1, double noundef %18, double noundef %9)
  %21 = fadd double %19, %20
  br label %common.ret25
}

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

attributes #0 = { 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 #1 = { 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)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass