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

38:                                               ; preds = %2
  store double 1.000000e+00, ptr %12, align 8, !tbaa !9
  %39 = load double, ptr %12, align 8, !tbaa !9
  store double %39, ptr %4, align 8, !tbaa !9
  %40 = load i32, ptr %5, align 4, !tbaa !11
  store i32 %40, ptr %8, align 4, !tbaa !11
  store i32 1045430272, ptr %9, align 4, !tbaa !11
  %41 = load i32, ptr %8, align 4, !tbaa !11
  %42 = load i32, ptr %9, align 4, !tbaa !11
  %43 = icmp ult i32 %41, %42
  %44 = zext i1 %43 to i32
  store i32 %44, ptr %8, align 4, !tbaa !11
  %45 = load i32, ptr %8, align 4, !tbaa !11
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %38
  br label %103

48:                                               ; preds = %38
  %49 = load double, ptr %6, align 8, !tbaa !9
  store double %49, ptr %12, align 8, !tbaa !9
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = load double, ptr %12, align 8, !tbaa !9
  %52 = call double @w2c_hermes_expm1(ptr noundef %50, double noundef %51)
  store double %52, ptr %12, align 8, !tbaa !9
  %53 = load double, ptr %12, align 8, !tbaa !9
  store double %53, ptr %4, align 8, !tbaa !9
  %54 = load double, ptr %4, align 8, !tbaa !9
  store double %54, ptr %13, align 8, !tbaa !9
  %55 = load double, ptr %13, align 8, !tbaa !9
  %56 = load double, ptr %12, align 8, !tbaa !9
  %57 = fmul double %56, %55
  store double %57, ptr %12, align 8, !tbaa !9
  %58 = load double, ptr %4, align 8, !tbaa !9
  store double %58, ptr %13, align 8, !tbaa !9
  store double 1.000000e+00, ptr %14, align 8, !tbaa !9
  %59 = load double, ptr %14, align 8, !tbaa !9
  %60 = load double, ptr %13, align 8, !tbaa !9
  %61 = fadd double %60, %59
  store double %61, ptr %13, align 8, !tbaa !9
  %62 = load double, ptr %13, align 8, !tbaa !9
  store double %62, ptr %4, align 8, !tbaa !9
  %63 = load double, ptr %4, align 8, !tbaa !9
  store double %63, ptr %14, align 8, !tbaa !9
  %64 = load double, ptr %14, align 8, !tbaa !9
  %65 = load double, ptr %13, align 8, !tbaa !9
  %66 = fadd double %65, %64
  store double %66, ptr %13, align 8, !tbaa !9
  %67 = load double, ptr %13, align 8, !tbaa !9
  %68 = load double, ptr %12, align 8, !tbaa !9
  %69 = fdiv double %68, %67
  store double %69, ptr %12, align 8, !tbaa !9
  store double 1.000000e+00, ptr %13, align 8, !tbaa !9
  %70 = load double, ptr %13, align 8, !tbaa !9
  %71 = load double, ptr %12, align 8, !tbaa !9
  %72 = fadd double %71, %70
  store double %72, ptr %12, align 8, !tbaa !9
  br label %105

73:                                               ; preds = %2
  %74 = load i32, ptr %5, align 4, !tbaa !11
  store i32 %74, ptr %7, align 4, !tbaa !11
  store i32 1082535489, ptr %8, align 4, !tbaa !11
  %75 = load i32, ptr %7, align 4, !tbaa !11
  %76 = load i32, ptr %8, align 4, !tbaa !11
  %77 = icmp ule i32 %75, %76
  %78 = zext i1 %77 to i32
  store i32 %78, ptr %7, align 4, !tbaa !11
  %79 = load i32, ptr %7, align 4, !tbaa !11
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %97

81:                                               ; preds = %73
  %82 = load double, ptr %6, align 8, !tbaa !9
  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_exp(ptr noundef %83, double noundef %84)
  store double %85, ptr %12, align 8, !tbaa !9
  %86 = load double, ptr %12, align 8, !tbaa !9
  store double %86, ptr %4, align 8, !tbaa !9
  store double 1.000000e+00, ptr %13, align 8, !tbaa !9
  %87 = load double, ptr %4, align 8, !tbaa !9
  store double %87, ptr %14, align 8, !tbaa !9
  %88 = load double, ptr %14, align 8, !tbaa !9
  %89 = load double, ptr %13, align 8, !tbaa !9
  %90 = fdiv double %89, %88
  store double %90, ptr %13, align 8, !tbaa !9
  %91 = load double, ptr %13, align 8, !tbaa !9
  %92 = load double, ptr %12, align 8, !tbaa !9
  %93 = fadd double %92, %91
  store double %93, ptr %12, align 8, !tbaa !9
  store double 5.000000e-01, ptr %13, align 8, !tbaa !9
  %94 = load double, ptr %13, align 8, !tbaa !9
  %95 = load double, ptr %12, align 8, !tbaa !9
  %96 = fmul double %95, %94
  store double %96, ptr %12, align 8, !tbaa !9
  br label %105

97:                                               ; preds = %73
  %98 = load double, ptr %6, align 8, !tbaa !9
  store double %98, ptr %12, align 8, !tbaa !9
  store double 1.000000e+00, ptr %13, align 8, !tbaa !9
  %99 = load ptr, ptr %3, align 8, !tbaa !5
  %100 = load double, ptr %12, align 8, !tbaa !9
  %101 = load double, ptr %13, align 8, !tbaa !9
  %102 = call double @w2c_hermes_0x5F_expo2(ptr noundef %99, double noundef %100, double noundef %101)
  store double %102, ptr %12, align 8, !tbaa !9
  br label %103

103:                                              ; preds = %97, %47
  %104 = load double, ptr %12, align 8, !tbaa !9
  store double %104, ptr %4, align 8, !tbaa !9
  br label %105

105:                                              ; preds = %103, %81, %48
  %106 = load double, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret double %106
}

; Function Attrs: nounwind uwtable
declare dso_local double @w2c_hermes_exp(ptr noundef, double noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local double @w2c_hermes_expm1(ptr noundef, double noundef) #0

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local double @w2c_hermes_0x5F_expo2(ptr noundef, double noundef, 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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)"}
!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_cosh(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, 32
  %6 = trunc nuw i64 %5 to i32
  %7 = and i32 %6, 2147483647
  %8 = icmp ult i32 %7, 1072049730
  br i1 %8, label %9, label %18

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

11:                                               ; preds = %9
  %12 = tail call double @w2c_hermes_expm1(ptr noundef %0, double noundef %3)
  %13 = fmul double %12, %12
  %14 = fadd double %12, 1.000000e+00
  %15 = fadd double %14, %14
  %16 = fdiv double %13, %15
  %17 = fadd double %16, 1.000000e+00
  br label %27

18:                                               ; preds = %2
  %19 = icmp ult i32 %7, 1082535490
  br i1 %19, label %20, label %25

20:                                               ; preds = %18
  %21 = tail call double @w2c_hermes_exp(ptr noundef %0, double noundef %3)
  %22 = fdiv double 1.000000e+00, %21
  %23 = fadd double %21, %22
  %24 = fmul double %23, 5.000000e-01
  br label %27

25:                                               ; preds = %18
  %26 = tail call double @w2c_hermes_0x5F_expo2(ptr noundef %0, double noundef %3, double noundef 1.000000e+00)
  br label %27

27:                                               ; preds = %25, %9, %20, %11
  %.1 = phi double [ %17, %11 ], [ %24, %20 ], [ 1.000000e+00, %9 ], [ %26, %25 ]
  ret double %.1
}

; Function Attrs: nounwind uwtable
declare dso_local double @w2c_hermes_exp(ptr noundef, double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local double @w2c_hermes_expm1(ptr noundef, double noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local double @w2c_hermes_0x5F_expo2(ptr noundef, double noundef, 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 = { 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" }

!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,SROAPass,SimplifyCFGPass,TailCallElimPass