; 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_asinh(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 1049, 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 uge 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 %52

43:                                               ; preds = %2
  %44 = load double, ptr %7, align 8, !tbaa !9
  store double %44, ptr %15, align 8, !tbaa !9
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = load double, ptr %15, align 8, !tbaa !9
  %47 = call double @w2c_hermes_log(ptr noundef %45, double noundef %46)
  store double %47, ptr %15, align 8, !tbaa !9
  store double 0x3FE62E42FEFA39EF, ptr %16, align 8, !tbaa !9
  %48 = load double, ptr %16, align 8, !tbaa !9
  %49 = load double, ptr %15, align 8, !tbaa !9
  %50 = fadd double %49, %48
  store double %50, ptr %15, align 8, !tbaa !9
  %51 = load double, ptr %15, align 8, !tbaa !9
  store double %51, ptr %7, align 8, !tbaa !9
  br label %126

52:                                               ; preds = %2
  %53 = load i32, ptr %5, align 4, !tbaa !11
  store i32 %53, ptr %8, align 4, !tbaa !11
  store i32 1024, ptr %9, align 4, !tbaa !11
  %54 = load i32, ptr %8, align 4, !tbaa !11
  %55 = load i32, ptr %9, align 4, !tbaa !11
  %56 = icmp uge i32 %54, %55
  %57 = zext i1 %56 to i32
  store i32 %57, ptr %8, align 4, !tbaa !11
  %58 = load i32, ptr %8, align 4, !tbaa !11
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %90

60:                                               ; preds = %52
  %61 = load double, ptr %7, align 8, !tbaa !9
  store double %61, ptr %15, align 8, !tbaa !9
  %62 = load double, ptr %7, align 8, !tbaa !9
  store double %62, ptr %16, align 8, !tbaa !9
  %63 = load double, ptr %16, align 8, !tbaa !9
  %64 = load double, ptr %15, align 8, !tbaa !9
  %65 = fadd double %64, %63
  store double %65, ptr %15, align 8, !tbaa !9
  store double 1.000000e+00, ptr %16, align 8, !tbaa !9
  %66 = load double, ptr %7, align 8, !tbaa !9
  store double %66, ptr %17, align 8, !tbaa !9
  %67 = load double, ptr %7, align 8, !tbaa !9
  store double %67, ptr %18, align 8, !tbaa !9
  %68 = load double, ptr %18, align 8, !tbaa !9
  %69 = load double, ptr %17, align 8, !tbaa !9
  %70 = fmul double %69, %68
  store double %70, ptr %17, align 8, !tbaa !9
  store double 1.000000e+00, ptr %18, align 8, !tbaa !9
  %71 = load double, ptr %18, align 8, !tbaa !9
  %72 = load double, ptr %17, align 8, !tbaa !9
  %73 = fadd double %72, %71
  store double %73, ptr %17, align 8, !tbaa !9
  %74 = load double, ptr %17, align 8, !tbaa !9
  %75 = call double @wasm_sqrt(double noundef %74)
  store double %75, ptr %17, align 8, !tbaa !9
  %76 = load double, ptr %7, align 8, !tbaa !9
  store double %76, ptr %18, align 8, !tbaa !9
  %77 = load double, ptr %18, align 8, !tbaa !9
  %78 = load double, ptr %17, align 8, !tbaa !9
  %79 = fadd double %78, %77
  store double %79, ptr %17, align 8, !tbaa !9
  %80 = load double, ptr %17, align 8, !tbaa !9
  %81 = load double, ptr %16, align 8, !tbaa !9
  %82 = fdiv double %81, %80
  store double %82, ptr %16, align 8, !tbaa !9
  %83 = load double, ptr %16, align 8, !tbaa !9
  %84 = load double, ptr %15, align 8, !tbaa !9
  %85 = fadd double %84, %83
  store double %85, ptr %15, align 8, !tbaa !9
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = load double, ptr %15, align 8, !tbaa !9
  %88 = call double @w2c_hermes_log(ptr noundef %86, double noundef %87)
  store double %88, ptr %15, align 8, !tbaa !9
  %89 = load double, ptr %15, align 8, !tbaa !9
  store double %89, ptr %7, align 8, !tbaa !9
  br label %126

90:                                               ; preds = %52
  %91 = load i32, ptr %5, align 4, !tbaa !11
  store i32 %91, ptr %8, align 4, !tbaa !11
  store i32 997, ptr %9, align 4, !tbaa !11
  %92 = load i32, ptr %8, align 4, !tbaa !11
  %93 = load i32, ptr %9, align 4, !tbaa !11
  %94 = icmp ult i32 %92, %93
  %95 = zext i1 %94 to i32
  store i32 %95, ptr %8, align 4, !tbaa !11
  %96 = load i32, ptr %8, align 4, !tbaa !11
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %98, label %99

98:                                               ; preds = %90
  br label %126

99:                                               ; preds = %90
  %100 = load double, ptr %7, align 8, !tbaa !9
  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 double, ptr %16, align 8, !tbaa !9
  %103 = load double, ptr %15, align 8, !tbaa !9
  %104 = fmul double %103, %102
  store double %104, ptr %15, align 8, !tbaa !9
  %105 = load double, ptr %15, align 8, !tbaa !9
  store double %105, ptr %4, align 8, !tbaa !9
  %106 = load double, ptr %4, align 8, !tbaa !9
  store double %106, ptr %16, align 8, !tbaa !9
  store double 1.000000e+00, ptr %17, align 8, !tbaa !9
  %107 = load double, ptr %17, align 8, !tbaa !9
  %108 = load double, ptr %16, align 8, !tbaa !9
  %109 = fadd double %108, %107
  store double %109, ptr %16, align 8, !tbaa !9
  %110 = load double, ptr %16, align 8, !tbaa !9
  %111 = call double @wasm_sqrt(double noundef %110)
  store double %111, ptr %16, align 8, !tbaa !9
  store double 1.000000e+00, ptr %17, align 8, !tbaa !9
  %112 = load double, ptr %17, align 8, !tbaa !9
  %113 = load double, ptr %16, align 8, !tbaa !9
  %114 = fadd double %113, %112
  store double %114, ptr %16, align 8, !tbaa !9
  %115 = load double, ptr %16, align 8, !tbaa !9
  %116 = load double, ptr %15, align 8, !tbaa !9
  %117 = fdiv double %116, %115
  store double %117, ptr %15, align 8, !tbaa !9
  %118 = load double, ptr %7, align 8, !tbaa !9
  store double %118, ptr %16, align 8, !tbaa !9
  %119 = load double, ptr %16, align 8, !tbaa !9
  %120 = load double, ptr %15, align 8, !tbaa !9
  %121 = fadd double %120, %119
  store double %121, ptr %15, align 8, !tbaa !9
  %122 = load ptr, ptr %3, align 8, !tbaa !5
  %123 = load double, ptr %15, align 8, !tbaa !9
  %124 = call double @w2c_hermes_log1p(ptr noundef %122, double noundef %123)
  store double %124, ptr %15, align 8, !tbaa !9
  %125 = load double, ptr %15, align 8, !tbaa !9
  store double %125, ptr %7, align 8, !tbaa !9
  br label %126

126:                                              ; preds = %99, %98, %60, %43
  %127 = load double, ptr %7, align 8, !tbaa !9
  store double %127, ptr %15, align 8, !tbaa !9
  %128 = load double, ptr %15, align 8, !tbaa !9
  %129 = fneg double %128
  store double %129, ptr %15, align 8, !tbaa !9
  %130 = load double, ptr %7, align 8, !tbaa !9
  store double %130, ptr %16, align 8, !tbaa !9
  %131 = load i64, ptr %6, align 8, !tbaa !13
  store i64 %131, ptr %13, align 8, !tbaa !13
  store i64 0, ptr %14, align 8, !tbaa !13
  %132 = load i64, ptr %13, align 8, !tbaa !13
  %133 = load i64, ptr %14, align 8, !tbaa !13
  %134 = icmp slt i64 %132, %133
  %135 = zext i1 %134 to i32
  %136 = sext i32 %135 to i64
  %137 = trunc i64 %136 to i32
  store i32 %137, ptr %10, align 4, !tbaa !11
  %138 = load i32, ptr %10, align 4, !tbaa !11
  %139 = icmp ne i32 %138, 0
  br i1 %139, label %140, label %142

140:                                              ; preds = %126
  %141 = load double, ptr %15, align 8, !tbaa !9
  br label %144

142:                                              ; preds = %126
  %143 = load double, ptr %16, align 8, !tbaa !9
  br label %144

144:                                              ; preds = %142, %140
  %145 = phi double [ %141, %140 ], [ %143, %142 ]
  store double %145, ptr %15, align 8, !tbaa !9
  %146 = 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 %146
}

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_fabs(double noundef) #0

; 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_asinh(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 ugt i32 %7, 1048
  br i1 %8, label %9, label %12

9:                                                ; preds = %2
  %10 = tail call double @w2c_hermes_log(ptr noundef %0, double noundef %3) #3
  %11 = fadd double %10, 0x3FE62E42FEFA39EF
  br label %33

12:                                               ; preds = %2
  %13 = icmp ugt i32 %7, 1023
  br i1 %13, label %14, label %23

14:                                               ; preds = %12
  %15 = fadd double %3, %3
  %16 = fmul double %3, %3
  %17 = fadd double %16, 1.000000e+00
  %18 = tail call double @wasm_sqrt(double noundef %17)
  %19 = fadd double %3, %18
  %20 = fdiv double 1.000000e+00, %19
  %21 = fadd double %15, %20
  %22 = tail call double @w2c_hermes_log(ptr noundef %0, double noundef %21) #3
  br label %33

23:                                               ; preds = %12
  %24 = icmp ult i32 %7, 997
  br i1 %24, label %33, label %25

25:                                               ; preds = %23
  %26 = fmul double %3, %3
  %27 = fadd double %26, 1.000000e+00
  %28 = tail call double @wasm_sqrt(double noundef %27)
  %29 = fadd double %28, 1.000000e+00
  %30 = fdiv double %26, %29
  %31 = fadd double %3, %30
  %32 = tail call double @w2c_hermes_log1p(ptr noundef %0, double noundef %31) #3
  br label %33

33:                                               ; preds = %23, %25, %14, %9
  %.0 = phi double [ %11, %9 ], [ %22, %14 ], [ %3, %23 ], [ %32, %25 ]
  %34 = fneg double %.0
  %35 = icmp slt i64 %4, 0
  %36 = select i1 %35, double %34, double %.0
  ret double %36
}

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_fabs(double noundef) local_unnamed_addr #0

; 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,SimplifyCFGPass,TailCallElimPass