; 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_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 %128

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 %91

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 ptr, ptr %3, align 8, !tbaa !5
  %75 = load double, ptr %17, align 8, !tbaa !9
  %76 = call double @w2c_hermes_sqrt(ptr noundef %74, double noundef %75)
  store double %76, ptr %17, align 8, !tbaa !9
  %77 = load double, ptr %7, align 8, !tbaa !9
  store double %77, ptr %18, align 8, !tbaa !9
  %78 = load double, ptr %18, align 8, !tbaa !9
  %79 = load double, ptr %17, align 8, !tbaa !9
  %80 = fadd double %79, %78
  store double %80, ptr %17, align 8, !tbaa !9
  %81 = load double, ptr %17, align 8, !tbaa !9
  %82 = load double, ptr %16, align 8, !tbaa !9
  %83 = fdiv double %82, %81
  store double %83, ptr %16, align 8, !tbaa !9
  %84 = load double, ptr %16, align 8, !tbaa !9
  %85 = load double, ptr %15, align 8, !tbaa !9
  %86 = fadd double %85, %84
  store double %86, ptr %15, align 8, !tbaa !9
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = load double, ptr %15, align 8, !tbaa !9
  %89 = call double @w2c_hermes_log(ptr noundef %87, double noundef %88)
  store double %89, ptr %15, align 8, !tbaa !9
  %90 = load double, ptr %15, align 8, !tbaa !9
  store double %90, ptr %7, align 8, !tbaa !9
  br label %128

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

99:                                               ; preds = %91
  br label %128

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

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

142:                                              ; preds = %128
  %143 = load double, ptr %15, align 8, !tbaa !9
  br label %146

144:                                              ; preds = %128
  %145 = load double, ptr %16, align 8, !tbaa !9
  br label %146

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

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

; 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_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 @w2c_hermes_sqrt(ptr noundef %0, double noundef %17) #3
  %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 @w2c_hermes_sqrt(ptr noundef %0, double noundef %27) #3
  %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

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

; 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