; 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_atanh(ptr noundef %0, double noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca double, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = 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 8, ptr %6) #4
  store i64 0, ptr %6, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store double 0.000000e+00, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %19 = load double, ptr %4, align 8, !tbaa !9
  store double %19, ptr %15, align 8, !tbaa !9
  %20 = load double, ptr %15, align 8, !tbaa !9
  %21 = call double @wasm_fabs(double noundef %20)
  store double %21, ptr %15, align 8, !tbaa !9
  %22 = load double, ptr %15, align 8, !tbaa !9
  store double %22, ptr %7, align 8, !tbaa !9
  %23 = load double, ptr %4, align 8, !tbaa !9
  store double %23, ptr %15, align 8, !tbaa !9
  %24 = load double, ptr %15, align 8, !tbaa !9
  %25 = call i64 @i64_reinterpret_f64(double noundef %24)
  store i64 %25, ptr %11, align 8, !tbaa !13
  %26 = load i64, ptr %11, align 8, !tbaa !13
  store i64 %26, ptr %6, align 8, !tbaa !13
  store i64 52, ptr %12, align 8, !tbaa !13
  %27 = load i64, ptr %12, align 8, !tbaa !13
  %28 = and i64 %27, 63
  %29 = load i64, ptr %11, align 8, !tbaa !13
  %30 = lshr i64 %29, %28
  store i64 %30, ptr %11, align 8, !tbaa !13
  %31 = load i64, ptr %11, align 8, !tbaa !13
  %32 = trunc i64 %31 to i32
  store i32 %32, ptr %8, align 4, !tbaa !11
  store i32 2047, ptr %9, align 4, !tbaa !11
  %33 = load i32, ptr %9, align 4, !tbaa !11
  %34 = load i32, ptr %8, align 4, !tbaa !11
  %35 = and i32 %34, %33
  store i32 %35, ptr %8, align 4, !tbaa !11
  %36 = load i32, ptr %8, align 4, !tbaa !11
  store i32 %36, ptr %5, align 4, !tbaa !11
  store i32 1021, ptr %9, align 4, !tbaa !11
  %37 = load i32, ptr %8, align 4, !tbaa !11
  %38 = load i32, ptr %9, align 4, !tbaa !11
  %39 = icmp ule i32 %37, %38
  %40 = zext i1 %39 to i32
  store i32 %40, ptr %8, align 4, !tbaa !11
  %41 = load i32, ptr %8, align 4, !tbaa !11
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %74

43:                                               ; preds = %2
  %44 = load i32, ptr %5, align 4, !tbaa !11
  store i32 %44, ptr %8, align 4, !tbaa !11
  store i32 991, ptr %9, align 4, !tbaa !11
  %45 = load i32, ptr %8, align 4, !tbaa !11
  %46 = load i32, ptr %9, align 4, !tbaa !11
  %47 = icmp ult i32 %45, %46
  %48 = zext i1 %47 to i32
  store i32 %48, ptr %8, align 4, !tbaa !11
  %49 = load i32, ptr %8, align 4, !tbaa !11
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %51, label %52

51:                                               ; preds = %43
  br label %97

52:                                               ; preds = %43
  %53 = load double, ptr %7, align 8, !tbaa !9
  store double %53, ptr %15, align 8, !tbaa !9
  %54 = load double, ptr %7, align 8, !tbaa !9
  store double %54, ptr %16, align 8, !tbaa !9
  %55 = load double, ptr %16, align 8, !tbaa !9
  %56 = load double, ptr %15, align 8, !tbaa !9
  %57 = fadd double %56, %55
  store double %57, ptr %15, align 8, !tbaa !9
  %58 = load double, ptr %15, align 8, !tbaa !9
  store double %58, ptr %4, align 8, !tbaa !9
  %59 = load double, ptr %4, align 8, !tbaa !9
  store double %59, ptr %16, align 8, !tbaa !9
  %60 = load double, ptr %7, align 8, !tbaa !9
  store double %60, ptr %17, align 8, !tbaa !9
  %61 = load double, ptr %17, align 8, !tbaa !9
  %62 = load double, ptr %16, align 8, !tbaa !9
  %63 = fmul double %62, %61
  store double %63, ptr %16, align 8, !tbaa !9
  store double 1.000000e+00, ptr %17, align 8, !tbaa !9
  %64 = load double, ptr %7, align 8, !tbaa !9
  store double %64, ptr %18, align 8, !tbaa !9
  %65 = load double, ptr %18, align 8, !tbaa !9
  %66 = load double, ptr %17, align 8, !tbaa !9
  %67 = fsub double %66, %65
  store double %67, ptr %17, align 8, !tbaa !9
  %68 = load double, ptr %17, align 8, !tbaa !9
  %69 = load double, ptr %16, align 8, !tbaa !9
  %70 = fdiv double %69, %68
  store double %70, ptr %16, align 8, !tbaa !9
  %71 = load double, ptr %16, align 8, !tbaa !9
  %72 = load double, ptr %15, align 8, !tbaa !9
  %73 = fadd double %72, %71
  store double %73, ptr %15, align 8, !tbaa !9
  br label %88

74:                                               ; preds = %2
  %75 = load double, ptr %7, align 8, !tbaa !9
  store double %75, ptr %15, align 8, !tbaa !9
  store double 1.000000e+00, ptr %16, align 8, !tbaa !9
  %76 = load double, ptr %7, align 8, !tbaa !9
  store double %76, ptr %17, align 8, !tbaa !9
  %77 = load double, ptr %17, align 8, !tbaa !9
  %78 = load double, ptr %16, align 8, !tbaa !9
  %79 = fsub double %78, %77
  store double %79, ptr %16, align 8, !tbaa !9
  %80 = load double, ptr %16, align 8, !tbaa !9
  %81 = load double, ptr %15, align 8, !tbaa !9
  %82 = fdiv double %81, %80
  store double %82, ptr %15, align 8, !tbaa !9
  %83 = load double, ptr %15, align 8, !tbaa !9
  store double %83, ptr %7, align 8, !tbaa !9
  %84 = load double, ptr %7, align 8, !tbaa !9
  store double %84, ptr %16, align 8, !tbaa !9
  %85 = load double, ptr %16, align 8, !tbaa !9
  %86 = load double, ptr %15, align 8, !tbaa !9
  %87 = fadd double %86, %85
  store double %87, ptr %15, align 8, !tbaa !9
  br label %88

88:                                               ; preds = %74, %52
  %89 = load double, ptr %15, align 8, !tbaa !9
  store double %89, ptr %7, align 8, !tbaa !9
  %90 = load ptr, ptr %3, align 8, !tbaa !5
  %91 = load double, ptr %15, align 8, !tbaa !9
  %92 = call double @w2c_hermes_log1p(ptr noundef %90, double noundef %91)
  store double %92, ptr %15, align 8, !tbaa !9
  store double 5.000000e-01, ptr %16, align 8, !tbaa !9
  %93 = load double, ptr %16, align 8, !tbaa !9
  %94 = load double, ptr %15, align 8, !tbaa !9
  %95 = fmul double %94, %93
  store double %95, ptr %15, align 8, !tbaa !9
  %96 = load double, ptr %15, align 8, !tbaa !9
  store double %96, ptr %7, align 8, !tbaa !9
  br label %97

97:                                               ; preds = %88, %51
  %98 = load double, ptr %7, align 8, !tbaa !9
  store double %98, ptr %15, align 8, !tbaa !9
  %99 = load double, ptr %15, align 8, !tbaa !9
  %100 = fneg double %99
  store double %100, ptr %15, align 8, !tbaa !9
  %101 = load double, ptr %7, align 8, !tbaa !9
  store double %101, ptr %16, align 8, !tbaa !9
  %102 = load i64, ptr %6, align 8, !tbaa !13
  store i64 %102, ptr %13, align 8, !tbaa !13
  store i64 0, ptr %14, align 8, !tbaa !13
  %103 = load i64, ptr %13, align 8, !tbaa !13
  %104 = load i64, ptr %14, align 8, !tbaa !13
  %105 = icmp slt i64 %103, %104
  %106 = zext i1 %105 to i32
  %107 = sext i32 %106 to i64
  %108 = trunc i64 %107 to i32
  store i32 %108, ptr %10, align 4, !tbaa !11
  %109 = load i32, ptr %10, align 4, !tbaa !11
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %111, label %113

111:                                              ; preds = %97
  %112 = load double, ptr %15, align 8, !tbaa !9
  br label %115

113:                                              ; preds = %97
  %114 = load double, ptr %16, align 8, !tbaa !9
  br label %115

115:                                              ; preds = %113, %111
  %116 = phi double [ %112, %111 ], [ %114, %113 ]
  store double %116, ptr %15, align 8, !tbaa !9
  %117 = load double, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  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 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret double %117
}

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_fabs(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_atanh(ptr noundef %0, double noundef %1) local_unnamed_addr #0 {
  %3 = tail call double @wasm_fabs(double noundef %1)
  %4 = tail call i64 @i64_reinterpret_f64(double noundef %1)
  %5 = lshr i64 %4, 52
  %6 = trunc nuw nsw i64 %5 to i32
  %7 = and i32 %6, 2047
  %8 = icmp ult i32 %7, 1022
  br i1 %8, label %9, label %17

9:                                                ; preds = %2
  %10 = icmp ult i32 %7, 991
  br i1 %10, label %24, label %11

11:                                               ; preds = %9
  %12 = fadd double %3, %3
  %13 = fmul double %3, %12
  %14 = fsub double 1.000000e+00, %3
  %15 = fdiv double %13, %14
  %16 = fadd double %12, %15
  br label %21

17:                                               ; preds = %2
  %18 = fsub double 1.000000e+00, %3
  %19 = fdiv double %3, %18
  %20 = fadd double %19, %19
  br label %21

21:                                               ; preds = %17, %11
  %.0 = phi double [ %16, %11 ], [ %20, %17 ]
  %22 = tail call double @w2c_hermes_log1p(ptr noundef %0, double noundef %.0) #3
  %23 = fmul double %22, 5.000000e-01
  br label %24

24:                                               ; preds = %9, %21
  %.060 = phi double [ %3, %9 ], [ %23, %21 ]
  %25 = fneg double %.060
  %26 = icmp slt i64 %4, 0
  %27 = select i1 %26, double %25, double %.060
  ret double %27
}

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_fabs(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,SimplifyCFGPass,TailCallElimPass