; LLVM IR from facebook/hermes :: API/hermes_sandbox/external (hermes_sandbox_impl_opt_compiled_0)

; 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: nounwind uwtable
define dso_local double @w2c_hermes_acosh(ptr noundef %0, double noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %14 = load double, ptr %4, align 8, !tbaa !9
  store double %14, ptr %10, align 8, !tbaa !9
  %15 = load double, ptr %10, align 8, !tbaa !9
  %16 = call i64 @i64_reinterpret_f64(double noundef %15)
  store i64 %16, ptr %8, align 8, !tbaa !13
  store i64 52, ptr %9, align 8, !tbaa !13
  %17 = load i64, ptr %9, align 8, !tbaa !13
  %18 = and i64 %17, 63
  %19 = load i64, ptr %8, align 8, !tbaa !13
  %20 = lshr i64 %19, %18
  store i64 %20, ptr %8, align 8, !tbaa !13
  %21 = load i64, ptr %8, align 8, !tbaa !13
  %22 = trunc i64 %21 to i32
  store i32 %22, ptr %6, align 4, !tbaa !11
  store i32 2047, ptr %7, align 4, !tbaa !11
  %23 = load i32, ptr %7, align 4, !tbaa !11
  %24 = load i32, ptr %6, align 4, !tbaa !11
  %25 = and i32 %24, %23
  store i32 %25, ptr %6, align 4, !tbaa !11
  %26 = load i32, ptr %6, align 4, !tbaa !11
  store i32 %26, ptr %5, align 4, !tbaa !11
  store i32 1023, ptr %7, align 4, !tbaa !11
  %27 = load i32, ptr %6, align 4, !tbaa !11
  %28 = load i32, ptr %7, align 4, !tbaa !11
  %29 = icmp ule i32 %27, %28
  %30 = zext i1 %29 to i32
  store i32 %30, ptr %6, align 4, !tbaa !11
  %31 = load i32, ptr %6, align 4, !tbaa !11
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %60

33:                                               ; preds = %2
  %34 = load double, ptr %4, align 8, !tbaa !9
  store double %34, ptr %10, align 8, !tbaa !9
  store double -1.000000e+00, ptr %11, align 8, !tbaa !9
  %35 = load double, ptr %11, align 8, !tbaa !9
  %36 = load double, ptr %10, align 8, !tbaa !9
  %37 = fadd double %36, %35
  store double %37, ptr %10, align 8, !tbaa !9
  %38 = load double, ptr %10, align 8, !tbaa !9
  store double %38, ptr %4, align 8, !tbaa !9
  %39 = load double, ptr %4, align 8, !tbaa !9
  store double %39, ptr %11, align 8, !tbaa !9
  %40 = load double, ptr %4, align 8, !tbaa !9
  store double %40, ptr %12, align 8, !tbaa !9
  %41 = load double, ptr %12, align 8, !tbaa !9
  %42 = load double, ptr %11, align 8, !tbaa !9
  %43 = fmul double %42, %41
  store double %43, ptr %11, align 8, !tbaa !9
  %44 = load double, ptr %4, align 8, !tbaa !9
  store double %44, ptr %12, align 8, !tbaa !9
  %45 = load double, ptr %4, align 8, !tbaa !9
  store double %45, ptr %13, align 8, !tbaa !9
  %46 = load double, ptr %13, align 8, !tbaa !9
  %47 = load double, ptr %12, align 8, !tbaa !9
  %48 = fadd double %47, %46
  store double %48, ptr %12, align 8, !tbaa !9
  %49 = load double, ptr %12, align 8, !tbaa !9
  %50 = load double, ptr %11, align 8, !tbaa !9
  %51 = fadd double %50, %49
  store double %51, ptr %11, align 8, !tbaa !9
  %52 = load double, ptr %11, align 8, !tbaa !9
  %53 = call double @wasm_sqrt(double noundef %52)
  store double %53, ptr %11, align 8, !tbaa !9
  %54 = load double, ptr %11, align 8, !tbaa !9
  %55 = load double, ptr %10, align 8, !tbaa !9
  %56 = fadd double %55, %54
  store double %56, ptr %10, align 8, !tbaa !9
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = load double, ptr %10, align 8, !tbaa !9
  %59 = call double @w2c_hermes_log1p(ptr noundef %57, double noundef %58)
  store double %59, ptr %10, align 8, !tbaa !9
  br label %105

60:                                               ; preds = %2
  %61 = load i32, ptr %5, align 4, !tbaa !11
  store i32 %61, ptr %6, align 4, !tbaa !11
  store i32 1048, ptr %7, align 4, !tbaa !11
  %62 = load i32, ptr %6, align 4, !tbaa !11
  %63 = load i32, ptr %7, align 4, !tbaa !11
  %64 = icmp ule i32 %62, %63
  %65 = zext i1 %64 to i32
  store i32 %65, ptr %6, align 4, !tbaa !11
  %66 = load i32, ptr %6, align 4, !tbaa !11
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %68, label %97

68:                                               ; preds = %60
  %69 = load double, ptr %4, align 8, !tbaa !9
  store double %69, ptr %10, align 8, !tbaa !9
  %70 = load double, ptr %4, align 8, !tbaa !9
  store double %70, ptr %11, align 8, !tbaa !9
  %71 = load double, ptr %11, align 8, !tbaa !9
  %72 = load double, ptr %10, align 8, !tbaa !9
  %73 = fadd double %72, %71
  store double %73, ptr %10, align 8, !tbaa !9
  store double -1.000000e+00, ptr %11, align 8, !tbaa !9
  %74 = load double, ptr %4, align 8, !tbaa !9
  store double %74, ptr %12, align 8, !tbaa !9
  %75 = load double, ptr %4, align 8, !tbaa !9
  store double %75, ptr %13, align 8, !tbaa !9
  %76 = load double, ptr %13, align 8, !tbaa !9
  %77 = load double, ptr %12, align 8, !tbaa !9
  %78 = fmul double %77, %76
  store double %78, ptr %12, align 8, !tbaa !9
  store double -1.000000e+00, ptr %13, align 8, !tbaa !9
  %79 = load double, ptr %13, align 8, !tbaa !9
  %80 = load double, ptr %12, align 8, !tbaa !9
  %81 = fadd double %80, %79
  store double %81, ptr %12, align 8, !tbaa !9
  %82 = load double, ptr %12, align 8, !tbaa !9
  %83 = call double @wasm_sqrt(double noundef %82)
  store double %83, ptr %12, align 8, !tbaa !9
  %84 = load double, ptr %4, align 8, !tbaa !9
  store double %84, ptr %13, align 8, !tbaa !9
  %85 = load double, ptr %13, align 8, !tbaa !9
  %86 = load double, ptr %12, align 8, !tbaa !9
  %87 = fadd double %86, %85
  store double %87, ptr %12, align 8, !tbaa !9
  %88 = load double, ptr %12, align 8, !tbaa !9
  %89 = load double, ptr %11, align 8, !tbaa !9
  %90 = fdiv double %89, %88
  store double %90, ptr %11, align 8, !tbaa !9
  %91 = load double, ptr %11, align 8, !tbaa !9
  %92 = load double, ptr %10, align 8, !tbaa !9
  %93 = fadd double %92, %91
  store double %93, ptr %10, align 8, !tbaa !9
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  %95 = load double, ptr %10, align 8, !tbaa !9
  %96 = call double @w2c_hermes_log(ptr noundef %94, double noundef %95)
  store double %96, ptr %10, align 8, !tbaa !9
  br label %105

97:                                               ; preds = %60
  %98 = load double, ptr %4, align 8, !tbaa !9
  store double %98, ptr %10, align 8, !tbaa !9
  %99 = load ptr, ptr %3, align 8, !tbaa !5
  %100 = load double, ptr %10, align 8, !tbaa !9
  %101 = call double @w2c_hermes_log(ptr noundef %99, double noundef %100)
  store double %101, ptr %10, align 8, !tbaa !9
  store double 0x3FE62E42FEFA39EF, ptr %11, align 8, !tbaa !9
  %102 = load double, ptr %11, align 8, !tbaa !9
  %103 = load double, ptr %10, align 8, !tbaa !9
  %104 = fadd double %103, %102
  store double %104, ptr %10, align 8, !tbaa !9
  br label %105

105:                                              ; preds = %97, %68, %33
  %106 = load double, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  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
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret double %106
}

declare double @w2c_hermes_log(ptr noundef, double noundef) #1

declare double @w2c_hermes_log1p(ptr noundef, double 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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @i64_reinterpret_f64(double noundef) #3

; Function Attrs: nounwind uwtable
declare hidden double @wasm_sqrt(double noundef) #0

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 = { "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 = { inlinehint 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !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"

; Function Attrs: nounwind uwtable
define dso_local double @w2c_hermes_acosh(ptr noundef %0, double noundef %1) local_unnamed_addr #0 {
  %3 = tail call i64 @i64_reinterpret_f64(double noundef %1)
  %4 = lshr i64 %3, 52
  %5 = trunc nuw nsw i64 %4 to i32
  %6 = and i32 %5, 2047
  %7 = icmp ult i32 %6, 1024
  br i1 %7, label %8, label %16

8:                                                ; preds = %2
  %9 = fadd double %1, -1.000000e+00
  %10 = fmul double %9, %9
  %11 = fadd double %9, %9
  %12 = fadd double %10, %11
  %13 = tail call double @wasm_sqrt(double noundef %12)
  %14 = fadd double %9, %13
  %15 = tail call double @w2c_hermes_log1p(ptr noundef %0, double noundef %14) #3
  br label %30

16:                                               ; preds = %2
  %17 = icmp ult i32 %6, 1049
  br i1 %17, label %18, label %27

18:                                               ; preds = %16
  %19 = fadd double %1, %1
  %20 = fmul double %1, %1
  %21 = fadd double %20, -1.000000e+00
  %22 = tail call double @wasm_sqrt(double noundef %21)
  %23 = fadd double %22, %1
  %24 = fdiv double 1.000000e+00, %23
  %25 = fsub double %19, %24
  %26 = tail call double @w2c_hermes_log(ptr noundef %0, double noundef %25) #3
  br label %30

27:                                               ; preds = %16
  %28 = tail call double @w2c_hermes_log(ptr noundef %0, double noundef %1) #3
  %29 = fadd double %28, 0x3FE62E42FEFA39EF
  br label %30

30:                                               ; preds = %27, %18, %8
  %.0 = phi double [ %15, %8 ], [ %26, %18 ], [ %29, %27 ]
  ret double %.0
}

declare double @w2c_hermes_log(ptr noundef, double noundef) local_unnamed_addr #1

declare double @w2c_hermes_log1p(ptr noundef, double noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @i64_reinterpret_f64(double noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden double @wasm_sqrt(double noundef) local_unnamed_addr #0

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 = { "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 = { inlinehint 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 = { 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)"}


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