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

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: nounwind uwtable
define dso_local double @w2c_hermes_tanh(ptr noundef %0, double noundef %1) #2 {
  %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 9223372032559808512, ptr %12, align 8, !tbaa !13
  %27 = load i64, ptr %12, align 8, !tbaa !13
  %28 = load i64, ptr %11, align 8, !tbaa !13
  %29 = and i64 %28, %27
  store i64 %29, ptr %11, align 8, !tbaa !13
  store i64 32, ptr %12, align 8, !tbaa !13
  %30 = load i64, ptr %12, align 8, !tbaa !13
  %31 = and i64 %30, 63
  %32 = load i64, ptr %11, align 8, !tbaa !13
  %33 = lshr i64 %32, %31
  store i64 %33, ptr %11, align 8, !tbaa !13
  %34 = load i64, ptr %11, align 8, !tbaa !13
  %35 = trunc i64 %34 to i32
  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 1071748075, 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 %79

43:                                               ; preds = %2
  %44 = load i32, ptr %5, align 4, !tbaa !11
  store i32 %44, ptr %8, align 4, !tbaa !11
  store i32 1077149697, 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 uge 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 %60

51:                                               ; preds = %43
  store double -0.000000e+00, ptr %15, align 8, !tbaa !9
  %52 = load double, ptr %7, align 8, !tbaa !9
  store double %52, ptr %16, align 8, !tbaa !9
  %53 = load double, ptr %16, align 8, !tbaa !9
  %54 = load double, ptr %15, align 8, !tbaa !9
  %55 = fdiv double %54, %53
  store double %55, ptr %15, align 8, !tbaa !9
  store double 1.000000e+00, ptr %16, align 8, !tbaa !9
  %56 = load double, ptr %16, align 8, !tbaa !9
  %57 = load double, ptr %15, align 8, !tbaa !9
  %58 = fadd double %57, %56
  store double %58, ptr %15, align 8, !tbaa !9
  %59 = load double, ptr %15, align 8, !tbaa !9
  store double %59, ptr %7, align 8, !tbaa !9
  br label %133

60:                                               ; preds = %43
  store double 1.000000e+00, ptr %15, align 8, !tbaa !9
  store double 2.000000e+00, ptr %16, align 8, !tbaa !9
  %61 = load double, ptr %7, align 8, !tbaa !9
  store double %61, ptr %17, align 8, !tbaa !9
  %62 = load double, ptr %7, align 8, !tbaa !9
  store double %62, ptr %18, align 8, !tbaa !9
  %63 = load double, ptr %18, align 8, !tbaa !9
  %64 = load double, ptr %17, align 8, !tbaa !9
  %65 = fadd double %64, %63
  store double %65, ptr %17, align 8, !tbaa !9
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = load double, ptr %17, align 8, !tbaa !9
  %68 = call double @w2c_hermes_expm1(ptr noundef %66, double noundef %67)
  store double %68, ptr %17, align 8, !tbaa !9
  store double 2.000000e+00, ptr %18, align 8, !tbaa !9
  %69 = load double, ptr %18, align 8, !tbaa !9
  %70 = load double, ptr %17, align 8, !tbaa !9
  %71 = fadd double %70, %69
  store double %71, ptr %17, align 8, !tbaa !9
  %72 = load double, ptr %17, align 8, !tbaa !9
  %73 = load double, ptr %16, align 8, !tbaa !9
  %74 = fdiv double %73, %72
  store double %74, ptr %16, align 8, !tbaa !9
  %75 = load double, ptr %16, align 8, !tbaa !9
  %76 = load double, ptr %15, align 8, !tbaa !9
  %77 = fsub double %76, %75
  store double %77, ptr %15, align 8, !tbaa !9
  %78 = load double, ptr %15, align 8, !tbaa !9
  store double %78, ptr %7, align 8, !tbaa !9
  br label %133

79:                                               ; preds = %2
  %80 = load i32, ptr %5, align 4, !tbaa !11
  store i32 %80, ptr %8, align 4, !tbaa !11
  store i32 1070618799, ptr %9, align 4, !tbaa !11
  %81 = load i32, ptr %8, align 4, !tbaa !11
  %82 = load i32, ptr %9, align 4, !tbaa !11
  %83 = icmp uge i32 %81, %82
  %84 = zext i1 %83 to i32
  store i32 %84, ptr %8, align 4, !tbaa !11
  %85 = load i32, ptr %8, align 4, !tbaa !11
  %86 = icmp ne i32 %85, 0
  br i1 %86, label %87, label %105

87:                                               ; preds = %79
  %88 = load double, ptr %7, align 8, !tbaa !9
  store double %88, ptr %15, align 8, !tbaa !9
  %89 = load double, ptr %7, align 8, !tbaa !9
  store double %89, ptr %16, align 8, !tbaa !9
  %90 = load double, ptr %16, align 8, !tbaa !9
  %91 = load double, ptr %15, align 8, !tbaa !9
  %92 = fadd double %91, %90
  store double %92, ptr %15, align 8, !tbaa !9
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = load double, ptr %15, align 8, !tbaa !9
  %95 = call double @w2c_hermes_expm1(ptr noundef %93, double noundef %94)
  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
  %97 = load double, ptr %7, align 8, !tbaa !9
  store double %97, ptr %16, align 8, !tbaa !9
  store double 2.000000e+00, ptr %17, align 8, !tbaa !9
  %98 = load double, ptr %17, align 8, !tbaa !9
  %99 = load double, ptr %16, align 8, !tbaa !9
  %100 = fadd double %99, %98
  store double %100, ptr %16, align 8, !tbaa !9
  %101 = load double, ptr %16, align 8, !tbaa !9
  %102 = load double, ptr %15, align 8, !tbaa !9
  %103 = fdiv double %102, %101
  store double %103, ptr %15, align 8, !tbaa !9
  %104 = load double, ptr %15, align 8, !tbaa !9
  store double %104, ptr %7, align 8, !tbaa !9
  br label %133

105:                                              ; preds = %79
  %106 = load i32, ptr %5, align 4, !tbaa !11
  store i32 %106, ptr %8, align 4, !tbaa !11
  store i32 1048576, ptr %9, align 4, !tbaa !11
  %107 = load i32, ptr %8, align 4, !tbaa !11
  %108 = load i32, ptr %9, align 4, !tbaa !11
  %109 = icmp ult i32 %107, %108
  %110 = zext i1 %109 to i32
  store i32 %110, ptr %8, align 4, !tbaa !11
  %111 = load i32, ptr %8, align 4, !tbaa !11
  %112 = icmp ne i32 %111, 0
  br i1 %112, label %113, label %114

113:                                              ; preds = %105
  br label %133

114:                                              ; preds = %105
  %115 = load double, ptr %7, align 8, !tbaa !9
  store double %115, ptr %15, align 8, !tbaa !9
  store double -2.000000e+00, ptr %16, align 8, !tbaa !9
  %116 = load double, ptr %16, align 8, !tbaa !9
  %117 = load double, ptr %15, align 8, !tbaa !9
  %118 = fmul double %117, %116
  store double %118, ptr %15, align 8, !tbaa !9
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = load double, ptr %15, align 8, !tbaa !9
  %121 = call double @w2c_hermes_expm1(ptr noundef %119, double noundef %120)
  store double %121, ptr %15, align 8, !tbaa !9
  %122 = load double, ptr %15, align 8, !tbaa !9
  store double %122, ptr %7, align 8, !tbaa !9
  %123 = load double, ptr %15, align 8, !tbaa !9
  %124 = fneg double %123
  store double %124, ptr %15, align 8, !tbaa !9
  %125 = load double, ptr %7, align 8, !tbaa !9
  store double %125, ptr %16, align 8, !tbaa !9
  store double 2.000000e+00, ptr %17, align 8, !tbaa !9
  %126 = load double, ptr %17, align 8, !tbaa !9
  %127 = load double, ptr %16, align 8, !tbaa !9
  %128 = fadd double %127, %126
  store double %128, ptr %16, align 8, !tbaa !9
  %129 = load double, ptr %16, align 8, !tbaa !9
  %130 = load double, ptr %15, align 8, !tbaa !9
  %131 = fdiv double %130, %129
  store double %131, ptr %15, align 8, !tbaa !9
  %132 = load double, ptr %15, align 8, !tbaa !9
  store double %132, ptr %7, align 8, !tbaa !9
  br label %133

133:                                              ; preds = %114, %113, %87, %60, %51
  %134 = load double, ptr %7, align 8, !tbaa !9
  store double %134, ptr %15, align 8, !tbaa !9
  %135 = load double, ptr %15, align 8, !tbaa !9
  %136 = fneg double %135
  store double %136, ptr %15, align 8, !tbaa !9
  %137 = load double, ptr %7, align 8, !tbaa !9
  store double %137, ptr %16, align 8, !tbaa !9
  %138 = load i64, ptr %6, align 8, !tbaa !13
  store i64 %138, ptr %13, align 8, !tbaa !13
  store i64 0, ptr %14, align 8, !tbaa !13
  %139 = load i64, ptr %13, align 8, !tbaa !13
  %140 = load i64, ptr %14, align 8, !tbaa !13
  %141 = icmp slt i64 %139, %140
  %142 = zext i1 %141 to i32
  %143 = sext i32 %142 to i64
  %144 = trunc i64 %143 to i32
  store i32 %144, ptr %10, align 4, !tbaa !11
  %145 = load i32, ptr %10, align 4, !tbaa !11
  %146 = icmp ne i32 %145, 0
  br i1 %146, label %147, label %149

147:                                              ; preds = %133
  %148 = load double, ptr %15, align 8, !tbaa !9
  br label %151

149:                                              ; preds = %133
  %150 = load double, ptr %16, align 8, !tbaa !9
  br label %151

151:                                              ; preds = %149, %147
  %152 = phi double [ %148, %147 ], [ %150, %149 ]
  store double %152, ptr %15, align 8, !tbaa !9
  %153 = 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 %153
}

; Function Attrs: nounwind uwtable
declare hidden double @wasm_fabs(double noundef) #2

declare double @w2c_hermes_expm1(ptr noundef, double noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { "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: inlinehint nounwind uwtable
declare hidden i64 @i64_reinterpret_f64(double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local double @w2c_hermes_tanh(ptr noundef %0, double noundef %1) local_unnamed_addr #1 {
  %3 = tail call double @wasm_fabs(double noundef %1)
  %4 = tail call i64 @i64_reinterpret_f64(double noundef %1)
  %5 = lshr i64 %4, 32
  %6 = trunc nuw i64 %5 to i32
  %7 = and i32 %6, 2147483647
  %8 = icmp ugt i32 %7, 1071748074
  br i1 %8, label %9, label %20

9:                                                ; preds = %2
  %10 = icmp ugt i32 %7, 1077149696
  br i1 %10, label %11, label %14

11:                                               ; preds = %9
  %12 = fdiv double 0.000000e+00, %3
  %13 = fsub double 1.000000e+00, %12
  br label %35

14:                                               ; preds = %9
  %15 = fadd double %3, %3
  %16 = tail call double @w2c_hermes_expm1(ptr noundef %0, double noundef %15) #3
  %17 = fadd double %16, 2.000000e+00
  %18 = fdiv double 2.000000e+00, %17
  %19 = fsub double 1.000000e+00, %18
  br label %35

20:                                               ; preds = %2
  %21 = icmp ugt i32 %7, 1070618798
  br i1 %21, label %22, label %27

22:                                               ; preds = %20
  %23 = fadd double %3, %3
  %24 = tail call double @w2c_hermes_expm1(ptr noundef %0, double noundef %23) #3
  %25 = fadd double %24, 2.000000e+00
  %26 = fdiv double %24, %25
  br label %35

27:                                               ; preds = %20
  %28 = icmp ult i32 %7, 1048576
  br i1 %28, label %35, label %29

29:                                               ; preds = %27
  %30 = fmul double %3, -2.000000e+00
  %31 = tail call double @w2c_hermes_expm1(ptr noundef %0, double noundef %30) #3
  %32 = fneg double %31
  %33 = fadd double %31, 2.000000e+00
  %34 = fdiv double %32, %33
  br label %35

35:                                               ; preds = %27, %29, %22, %14, %11
  %.0 = phi double [ %13, %11 ], [ %19, %14 ], [ %26, %22 ], [ %3, %27 ], [ %34, %29 ]
  %36 = fneg double %.0
  %37 = icmp slt i64 %4, 0
  %38 = select i1 %37, double %36, double %.0
  ret double %38
}

; Function Attrs: nounwind uwtable
declare hidden double @wasm_fabs(double noundef) local_unnamed_addr #1

declare double @w2c_hermes_expm1(ptr noundef, double noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { 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 #2 = { "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