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

; 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

declare void @w2c_hermes_0x5F_assert_fail(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: noreturn
declare void @wasm_rt_trap(i32 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #3

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3ABoxedDouble0x3A0x3Acreate0x28double0x2C0x20hermes0x3A0x3Avm0x3A0x3ARuntime0x260x29(ptr noundef, double noundef, i32 noundef) #4

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AHermesValue320x3A0x3AencodeNumberValue0x28double0x2C0x20hermes0x3A0x3Avm0x3A0x3ARuntime0x260x29(ptr noundef %0, double noundef %1, i32 noundef %2) #4 {
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %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
  store ptr %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %18 = load double, ptr %5, align 8, !tbaa !9
  store double %18, ptr %15, align 8, !tbaa !9
  %19 = load double, ptr %15, align 8, !tbaa !9
  %20 = call i64 @i64_reinterpret_f64(double noundef %19)
  store i64 %20, ptr %13, align 8, !tbaa !13
  %21 = load double, ptr %5, align 8, !tbaa !9
  store double %21, ptr %16, align 8, !tbaa !9
  %22 = load double, ptr %16, align 8, !tbaa !9
  %23 = call double @wasm_fabs(double noundef %22)
  store double %23, ptr %16, align 8, !tbaa !9
  store double 0x41E0000000000000, ptr %17, align 8, !tbaa !9
  %24 = load double, ptr %16, align 8, !tbaa !9
  %25 = load double, ptr %17, align 8, !tbaa !9
  %26 = fcmp olt double %24, %25
  %27 = zext i1 %26 to i32
  store i32 %27, ptr %9, align 4, !tbaa !11
  %28 = load i32, ptr %9, align 4, !tbaa !11
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %67

30:                                               ; preds = %3
  %31 = load double, ptr %5, align 8, !tbaa !9
  store double %31, ptr %16, align 8, !tbaa !9
  %32 = load double, ptr %16, align 8, !tbaa !9
  %33 = load double, ptr %16, align 8, !tbaa !9
  %34 = fcmp une double %32, %33
  %35 = xor i1 %34, true
  %36 = xor i1 %35, true
  %37 = zext i1 %36 to i32
  %38 = sext i32 %37 to i64
  %39 = call i64 @llvm.expect.i64(i64 %38, i64 0)
  %40 = icmp ne i64 %39, 0
  br i1 %40, label %41, label %43

41:                                               ; preds = %30
  call void @wasm_rt_trap(i32 noundef 4) #7
  unreachable

42:                                               ; No predecessors!
  br label %65

43:                                               ; preds = %30
  %44 = load double, ptr %16, align 8, !tbaa !9
  %45 = fcmp ogt double %44, 0xC1E0000000200000
  br i1 %45, label %46, label %49

46:                                               ; preds = %43
  %47 = load double, ptr %16, align 8, !tbaa !9
  %48 = fcmp olt double %47, 0x41E0000000000000
  br label %49

49:                                               ; preds = %46, %43
  %50 = phi i1 [ false, %43 ], [ %48, %46 ]
  %51 = xor i1 %50, true
  %52 = xor i1 %51, true
  %53 = xor i1 %52, true
  %54 = zext i1 %53 to i32
  %55 = sext i32 %54 to i64
  %56 = call i64 @llvm.expect.i64(i64 %55, i64 0)
  %57 = icmp ne i64 %56, 0
  br i1 %57, label %58, label %60

58:                                               ; preds = %49
  call void @wasm_rt_trap(i32 noundef 2) #7
  unreachable

59:                                               ; No predecessors!
  br label %63

60:                                               ; preds = %49
  %61 = load double, ptr %16, align 8, !tbaa !9
  %62 = fptosi double %61 to i32
  br label %63

63:                                               ; preds = %60, %59
  %64 = phi i32 [ 0, %59 ], [ %62, %60 ]
  br label %65

65:                                               ; preds = %63, %42
  %66 = phi i32 [ 0, %42 ], [ %64, %63 ]
  store i32 %66, ptr %9, align 4, !tbaa !11
  br label %68

67:                                               ; preds = %3
  store i32 -2147483648, ptr %9, align 4, !tbaa !11
  br label %68

68:                                               ; preds = %67, %65
  %69 = load i32, ptr %9, align 4, !tbaa !11
  store i32 %69, ptr %7, align 4, !tbaa !11
  store i32 3, ptr %10, align 4, !tbaa !11
  %70 = load i32, ptr %10, align 4, !tbaa !11
  %71 = and i32 %70, 31
  %72 = load i32, ptr %9, align 4, !tbaa !11
  %73 = shl i32 %72, %71
  store i32 %73, ptr %9, align 4, !tbaa !11
  %74 = load i32, ptr %9, align 4, !tbaa !11
  store i32 %74, ptr %7, align 4, !tbaa !11
  store i32 3, ptr %10, align 4, !tbaa !11
  %75 = load i32, ptr %9, align 4, !tbaa !11
  %76 = load i32, ptr %10, align 4, !tbaa !11
  %77 = and i32 %76, 31
  %78 = ashr i32 %75, %77
  store i32 %78, ptr %9, align 4, !tbaa !11
  %79 = load i32, ptr %9, align 4, !tbaa !11
  %80 = sitofp i32 %79 to double
  store double %80, ptr %16, align 8, !tbaa !9
  %81 = load double, ptr %16, align 8, !tbaa !9
  %82 = call i64 @i64_reinterpret_f64(double noundef %81)
  store i64 %82, ptr %14, align 8, !tbaa !13
  %83 = load i64, ptr %13, align 8, !tbaa !13
  %84 = load i64, ptr %14, align 8, !tbaa !13
  %85 = icmp eq i64 %83, %84
  %86 = zext i1 %85 to i32
  store i32 %86, ptr %8, align 4, !tbaa !11
  %87 = load i32, ptr %8, align 4, !tbaa !11
  %88 = icmp ne i32 %87, 0
  br i1 %88, label %89, label %94

89:                                               ; preds = %68
  %90 = load i32, ptr %7, align 4, !tbaa !11
  store i32 %90, ptr %8, align 4, !tbaa !11
  store i32 4, ptr %9, align 4, !tbaa !11
  %91 = load i32, ptr %9, align 4, !tbaa !11
  %92 = load i32, ptr %8, align 4, !tbaa !11
  %93 = or i32 %92, %91
  store i32 %93, ptr %8, align 4, !tbaa !11
  br label %134

94:                                               ; preds = %68
  %95 = load double, ptr %5, align 8, !tbaa !9
  store double %95, ptr %15, align 8, !tbaa !9
  %96 = load i32, ptr %6, align 4, !tbaa !11
  store i32 %96, ptr %9, align 4, !tbaa !11
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = load double, ptr %15, align 8, !tbaa !9
  %99 = load i32, ptr %9, align 4, !tbaa !11
  %100 = call i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3ABoxedDouble0x3A0x3Acreate0x28double0x2C0x20hermes0x3A0x3Avm0x3A0x3ARuntime0x260x29(ptr noundef %97, double noundef %98, i32 noundef %99)
  store i32 %100, ptr %8, align 4, !tbaa !11
  %101 = load i32, ptr %8, align 4, !tbaa !11
  store i32 %101, ptr %7, align 4, !tbaa !11
  store i32 7, ptr %9, align 4, !tbaa !11
  %102 = load i32, ptr %9, align 4, !tbaa !11
  %103 = load i32, ptr %8, align 4, !tbaa !11
  %104 = and i32 %103, %102
  store i32 %104, ptr %8, align 4, !tbaa !11
  %105 = load i32, ptr %8, align 4, !tbaa !11
  %106 = icmp ne i32 %105, 0
  %107 = xor i1 %106, true
  %108 = zext i1 %107 to i32
  store i32 %108, ptr %8, align 4, !tbaa !11
  %109 = load i32, ptr %8, align 4, !tbaa !11
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %111, label %116

111:                                              ; preds = %94
  %112 = load i32, ptr %7, align 4, !tbaa !11
  store i32 %112, ptr %8, align 4, !tbaa !11
  store i32 3, ptr %9, align 4, !tbaa !11
  %113 = load i32, ptr %9, align 4, !tbaa !11
  %114 = load i32, ptr %8, align 4, !tbaa !11
  %115 = or i32 %114, %113
  store i32 %115, ptr %8, align 4, !tbaa !11
  br label %134

116:                                              ; preds = %94
  store i32 0, ptr %8, align 4, !tbaa !11
  %117 = load i32, ptr %8, align 4, !tbaa !11
  store i32 %117, ptr %7, align 4, !tbaa !11
  store i32 133350, ptr %9, align 4, !tbaa !11
  %118 = load i32, ptr %9, align 4, !tbaa !11
  %119 = load i32, ptr %8, align 4, !tbaa !11
  %120 = add i32 %119, %118
  store i32 %120, ptr %8, align 4, !tbaa !11
  %121 = load i32, ptr %7, align 4, !tbaa !11
  store i32 %121, ptr %9, align 4, !tbaa !11
  store i32 83268, ptr %10, align 4, !tbaa !11
  %122 = load i32, ptr %10, align 4, !tbaa !11
  %123 = load i32, ptr %9, align 4, !tbaa !11
  %124 = add i32 %123, %122
  store i32 %124, ptr %9, align 4, !tbaa !11
  store i32 297, ptr %10, align 4, !tbaa !11
  %125 = load i32, ptr %7, align 4, !tbaa !11
  store i32 %125, ptr %11, align 4, !tbaa !11
  store i32 49792, ptr %12, align 4, !tbaa !11
  %126 = load i32, ptr %12, align 4, !tbaa !11
  %127 = load i32, ptr %11, align 4, !tbaa !11
  %128 = add i32 %127, %126
  store i32 %128, ptr %11, align 4, !tbaa !11
  %129 = load ptr, ptr %4, align 8, !tbaa !5
  %130 = load i32, ptr %8, align 4, !tbaa !11
  %131 = load i32, ptr %9, align 4, !tbaa !11
  %132 = load i32, ptr %10, align 4, !tbaa !11
  %133 = load i32, ptr %11, align 4, !tbaa !11
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %129, i32 noundef %130, i32 noundef %131, i32 noundef %132, i32 noundef %133)
  call void @wasm_rt_trap(i32 noundef 5) #7
  unreachable

134:                                              ; preds = %111, %89
  %135 = load i32, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  ret i32 %135
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { noreturn "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 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #4 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn }

!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"

declare void @w2c_hermes_0x5F_assert_fail(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: noreturn
declare void @wasm_rt_trap(i32 noundef) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3ABoxedDouble0x3A0x3Acreate0x28double0x2C0x20hermes0x3A0x3Avm0x3A0x3ARuntime0x260x29(ptr noundef, double noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local range(i32 3, 0) i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AHermesValue320x3A0x3AencodeNumberValue0x28double0x2C0x20hermes0x3A0x3Avm0x3A0x3ARuntime0x260x29(ptr noundef %0, double noundef %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = tail call i64 @i64_reinterpret_f64(double noundef %1)
  %5 = tail call double @wasm_fabs(double noundef %1)
  %6 = fcmp olt double %5, 0x41E0000000000000
  br i1 %6, label %7, label %17

7:                                                ; preds = %3
  %8 = fcmp uno double %1, 0.000000e+00
  br i1 %8, label %9, label %10, !prof !5

9:                                                ; preds = %7
  tail call void @wasm_rt_trap(i32 noundef 4) #4
  unreachable

10:                                               ; preds = %7
  %11 = fcmp ule double %1, 0xC1E0000000200000
  %12 = fcmp uge double %1, 0x41E0000000000000
  %.not56 = or i1 %11, %12
  br i1 %.not56, label %13, label %14, !prof !5

13:                                               ; preds = %10
  tail call void @wasm_rt_trap(i32 noundef 2) #4
  unreachable

14:                                               ; preds = %10
  %15 = fptosi double %1 to i32
  %16 = shl i32 %15, 3
  br label %17

17:                                               ; preds = %3, %14
  %.054 = phi i32 [ %16, %14 ], [ 0, %3 ]
  %18 = ashr exact i32 %.054, 3
  %19 = sitofp i32 %18 to double
  %20 = tail call i64 @i64_reinterpret_f64(double noundef %19)
  %21 = icmp eq i64 %4, %20
  br i1 %21, label %22, label %24

22:                                               ; preds = %17
  %23 = or disjoint i32 %.054, 4
  br label %30

24:                                               ; preds = %17
  %25 = tail call i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3ABoxedDouble0x3A0x3Acreate0x28double0x2C0x20hermes0x3A0x3Avm0x3A0x3ARuntime0x260x29(ptr noundef %0, double noundef %1, i32 noundef %2)
  %26 = and i32 %25, 7
  %.not = icmp eq i32 %26, 0
  br i1 %.not, label %27, label %29

27:                                               ; preds = %24
  %28 = or disjoint i32 %25, 3
  br label %30

29:                                               ; preds = %24
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 133350, i32 noundef 83268, i32 noundef 297, i32 noundef 49792) #5
  tail call void @wasm_rt_trap(i32 noundef 5) #4
  unreachable

30:                                               ; preds = %27, %22
  %.0 = phi i32 [ %23, %22 ], [ %28, %27 ]
  ret i32 %.0
}

attributes #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 = { noreturn "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 = { 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 = { noreturn nounwind }
attributes #5 = { 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 = !{!"branch_weights", !"expected", i32 1, i32 2000}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass,TailCallElimPass