; LLVM IR from facebook/hermes :: API/hermes_sandbox/external (hermes_sandbox_impl_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 %61

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 ptr, ptr %3, align 8, !tbaa !5
  %53 = load double, ptr %11, align 8, !tbaa !9
  %54 = call double @w2c_hermes_sqrt(ptr noundef %52, double noundef %53)
  store double %54, ptr %11, align 8, !tbaa !9
  %55 = load double, ptr %11, align 8, !tbaa !9
  %56 = load double, ptr %10, align 8, !tbaa !9
  %57 = fadd double %56, %55
  store double %57, ptr %10, align 8, !tbaa !9
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = load double, ptr %10, align 8, !tbaa !9
  %60 = call double @w2c_hermes_log1p(ptr noundef %58, double noundef %59)
  store double %60, ptr %10, align 8, !tbaa !9
  br label %107

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

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

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

107:                                              ; preds = %99, %69, %33
  %108 = 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 %108
}

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

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

declare double @w2c_hermes_sqrt(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

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 @w2c_hermes_sqrt(ptr noundef %0, double noundef %12) #3
  %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 @w2c_hermes_sqrt(ptr noundef %0, double noundef %21) #3
  %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

declare double @w2c_hermes_sqrt(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

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