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

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

%struct.w2c_hermes = type { ptr, ptr, ptr, i32, i32, i32, %struct.wasm_rt_memory_t, %struct.wasm_rt_funcref_table_t }
%struct.wasm_rt_memory_t = type { ptr, i64, i64, i64, i8 }
%struct.wasm_rt_funcref_table_t = type { ptr, i32, i32 }

; 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(none)
declare i64 @llvm.expect.i64(i64, i64) #1

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3ALiteralNumber0x3A0x3AasInt320x280x290x20const(ptr noundef %0, i32 noundef %1) #4 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %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 i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store double 0.000000e+00, ptr %5, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  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 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, 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
  %16 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %16, ptr %6, align 4, !tbaa !9
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.w2c_hermes, ptr %17, i32 0, i32 6
  %19 = load i32, ptr %6, align 4, !tbaa !9
  %20 = zext i32 %19 to i64
  %21 = add i64 %20, 32
  %22 = call double @f64_load(ptr noundef %18, i64 noundef %21)
  store double %22, ptr %13, align 8, !tbaa !11
  %23 = load double, ptr %13, align 8, !tbaa !11
  store double %23, ptr %5, align 8, !tbaa !11
  %24 = load double, ptr %5, align 8, !tbaa !11
  store double %24, ptr %14, align 8, !tbaa !11
  %25 = load double, ptr %13, align 8, !tbaa !11
  %26 = load double, ptr %14, align 8, !tbaa !11
  %27 = fcmp une double %25, %26
  %28 = zext i1 %27 to i32
  store i32 %28, ptr %6, align 4, !tbaa !9
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %32

31:                                               ; preds = %2
  br label %129

32:                                               ; preds = %2
  %33 = load double, ptr %5, align 8, !tbaa !11
  store double %33, ptr %13, align 8, !tbaa !11
  store double 0x41DFFFFFFFC00000, ptr %14, align 8, !tbaa !11
  %34 = load double, ptr %13, align 8, !tbaa !11
  %35 = load double, ptr %14, align 8, !tbaa !11
  %36 = fcmp ogt double %34, %35
  %37 = zext i1 %36 to i32
  store i32 %37, ptr %6, align 4, !tbaa !9
  %38 = load i32, ptr %6, align 4, !tbaa !9
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %41

40:                                               ; preds = %32
  br label %129

41:                                               ; preds = %32
  %42 = load double, ptr %5, align 8, !tbaa !11
  store double %42, ptr %13, align 8, !tbaa !11
  store double 0xC1E0000000000000, ptr %14, align 8, !tbaa !11
  %43 = load double, ptr %13, align 8, !tbaa !11
  %44 = load double, ptr %14, align 8, !tbaa !11
  %45 = fcmp olt double %43, %44
  %46 = zext i1 %45 to i32
  store i32 %46, ptr %6, align 4, !tbaa !9
  %47 = load i32, ptr %6, align 4, !tbaa !9
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %50

49:                                               ; preds = %41
  br label %129

50:                                               ; preds = %41
  %51 = load double, ptr %5, align 8, !tbaa !11
  store double %51, ptr %13, align 8, !tbaa !11
  %52 = load double, ptr %5, align 8, !tbaa !11
  store double %52, ptr %14, align 8, !tbaa !11
  %53 = load double, ptr %14, align 8, !tbaa !11
  %54 = call double @wasm_fabs(double noundef %53)
  store double %54, ptr %14, align 8, !tbaa !11
  store double 0x41E0000000000000, ptr %15, align 8, !tbaa !11
  %55 = load double, ptr %14, align 8, !tbaa !11
  %56 = load double, ptr %15, align 8, !tbaa !11
  %57 = fcmp olt double %55, %56
  %58 = zext i1 %57 to i32
  store i32 %58, ptr %7, align 4, !tbaa !9
  %59 = load i32, ptr %7, align 4, !tbaa !9
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %61, label %98

61:                                               ; preds = %50
  %62 = load double, ptr %5, align 8, !tbaa !11
  store double %62, ptr %14, align 8, !tbaa !11
  %63 = load double, ptr %14, align 8, !tbaa !11
  %64 = load double, ptr %14, align 8, !tbaa !11
  %65 = fcmp une double %63, %64
  %66 = xor i1 %65, true
  %67 = xor i1 %66, true
  %68 = zext i1 %67 to i32
  %69 = sext i32 %68 to i64
  %70 = call i64 @llvm.expect.i64(i64 %69, i64 0)
  %71 = icmp ne i64 %70, 0
  br i1 %71, label %72, label %74

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

73:                                               ; No predecessors!
  br label %96

74:                                               ; preds = %61
  %75 = load double, ptr %14, align 8, !tbaa !11
  %76 = fcmp ogt double %75, 0xC1E0000000200000
  br i1 %76, label %77, label %80

77:                                               ; preds = %74
  %78 = load double, ptr %14, align 8, !tbaa !11
  %79 = fcmp olt double %78, 0x41E0000000000000
  br label %80

80:                                               ; preds = %77, %74
  %81 = phi i1 [ false, %74 ], [ %79, %77 ]
  %82 = xor i1 %81, true
  %83 = xor i1 %82, true
  %84 = xor i1 %83, true
  %85 = zext i1 %84 to i32
  %86 = sext i32 %85 to i64
  %87 = call i64 @llvm.expect.i64(i64 %86, i64 0)
  %88 = icmp ne i64 %87, 0
  br i1 %88, label %89, label %91

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

90:                                               ; No predecessors!
  br label %94

91:                                               ; preds = %80
  %92 = load double, ptr %14, align 8, !tbaa !11
  %93 = fptosi double %92 to i32
  br label %94

94:                                               ; preds = %91, %90
  %95 = phi i32 [ 0, %90 ], [ %93, %91 ]
  br label %96

96:                                               ; preds = %94, %73
  %97 = phi i32 [ 0, %73 ], [ %95, %94 ]
  store i32 %97, ptr %7, align 4, !tbaa !9
  br label %99

98:                                               ; preds = %50
  store i32 -2147483648, ptr %7, align 4, !tbaa !9
  br label %99

99:                                               ; preds = %98, %96
  %100 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %100, ptr %4, align 4, !tbaa !9
  %101 = load i32, ptr %7, align 4, !tbaa !9
  %102 = sitofp i32 %101 to double
  store double %102, ptr %14, align 8, !tbaa !11
  %103 = load double, ptr %13, align 8, !tbaa !11
  %104 = load double, ptr %14, align 8, !tbaa !11
  %105 = fcmp une double %103, %104
  %106 = zext i1 %105 to i32
  store i32 %106, ptr %6, align 4, !tbaa !9
  %107 = load i32, ptr %6, align 4, !tbaa !9
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %109, label %110

109:                                              ; preds = %99
  br label %129

110:                                              ; preds = %99
  %111 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %111, ptr %6, align 4, !tbaa !9
  %112 = load i32, ptr %6, align 4, !tbaa !9
  %113 = icmp ne i32 %112, 0
  br i1 %113, label %114, label %115

114:                                              ; preds = %110
  br label %147

115:                                              ; preds = %110
  %116 = load double, ptr %5, align 8, !tbaa !11
  store double %116, ptr %13, align 8, !tbaa !11
  %117 = load double, ptr %13, align 8, !tbaa !11
  %118 = call i64 @i64_reinterpret_f64(double noundef %117)
  store i64 %118, ptr %11, align 8, !tbaa !13
  store i64 0, ptr %12, align 8, !tbaa !13
  %119 = load i64, ptr %11, align 8, !tbaa !13
  %120 = load i64, ptr %12, align 8, !tbaa !13
  %121 = icmp sge i64 %119, %120
  %122 = zext i1 %121 to i32
  %123 = sext i32 %122 to i64
  %124 = trunc i64 %123 to i32
  store i32 %124, ptr %6, align 4, !tbaa !9
  %125 = load i32, ptr %6, align 4, !tbaa !9
  %126 = icmp ne i32 %125, 0
  br i1 %126, label %127, label %128

127:                                              ; preds = %115
  br label %147

128:                                              ; preds = %115
  br label %129

129:                                              ; preds = %128, %109, %49, %40, %31
  store i32 0, ptr %6, align 4, !tbaa !9
  %130 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %130, ptr %4, align 4, !tbaa !9
  store i32 136575, ptr %7, align 4, !tbaa !9
  %131 = load i32, ptr %7, align 4, !tbaa !9
  %132 = load i32, ptr %6, align 4, !tbaa !9
  %133 = add i32 %132, %131
  store i32 %133, ptr %6, align 4, !tbaa !9
  %134 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %134, ptr %7, align 4, !tbaa !9
  store i32 85918, ptr %8, align 4, !tbaa !9
  %135 = load i32, ptr %8, align 4, !tbaa !9
  %136 = load i32, ptr %7, align 4, !tbaa !9
  %137 = add i32 %136, %135
  store i32 %137, ptr %7, align 4, !tbaa !9
  store i32 894, ptr %8, align 4, !tbaa !9
  %138 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %138, ptr %9, align 4, !tbaa !9
  store i32 111088, ptr %10, align 4, !tbaa !9
  %139 = load i32, ptr %10, align 4, !tbaa !9
  %140 = load i32, ptr %9, align 4, !tbaa !9
  %141 = add i32 %140, %139
  store i32 %141, ptr %9, align 4, !tbaa !9
  %142 = load ptr, ptr %3, align 8, !tbaa !5
  %143 = load i32, ptr %6, align 4, !tbaa !9
  %144 = load i32, ptr %7, align 4, !tbaa !9
  %145 = load i32, ptr %8, align 4, !tbaa !9
  %146 = load i32, ptr %9, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %142, i32 noundef %143, i32 noundef %144, i32 noundef %145, i32 noundef %146)
  call void @wasm_rt_trap(i32 noundef 5) #7
  unreachable

147:                                              ; preds = %127, %114
  %148 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %148, ptr %6, align 4, !tbaa !9
  %149 = load i32, ptr %6, align 4, !tbaa !9
  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 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, 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
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  ret i32 %149
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(none) }
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 = { "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 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !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: noreturn
declare void @wasm_rt_trap(i32 noundef) local_unnamed_addr #0

declare void @w2c_hermes_0x5F_assert_fail(ptr noundef, i32 noundef, i32 noundef, i32 noundef, 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 double @f64_load(ptr noundef, i64 noundef) local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3ALiteralNumber0x3A0x3AasInt320x280x290x20const(ptr noundef %0, i32 noundef %1) local_unnamed_addr #2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 40
  %4 = zext i32 %1 to i64
  %5 = add nuw nsw i64 %4, 32
  %6 = tail call double @f64_load(ptr noundef nonnull %3, i64 noundef %5)
  %7 = fcmp uno double %6, 0.000000e+00
  %8 = fcmp ogt double %6, 0x41DFFFFFFFC00000
  %or.cond = or i1 %7, %8
  %9 = fcmp olt double %6, 0xC1E0000000000000
  %or.cond58 = or i1 %9, %or.cond
  br i1 %or.cond58, label %26, label %10

10:                                               ; preds = %2
  %11 = tail call double @wasm_fabs(double noundef %6)
  %12 = fcmp olt double %11, 0x41E0000000000000
  br i1 %12, label %13, label %.thread

13:                                               ; preds = %10
  %14 = fcmp ule double %6, 0xC1E0000000200000
  %15 = fcmp uge double %6, 0x41E0000000000000
  %.not57 = or i1 %14, %15
  br i1 %.not57, label %16, label %17, !prof !5

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

17:                                               ; preds = %13
  %18 = fptosi double %6 to i32
  %19 = sitofp i32 %18 to double
  %20 = fcmp une double %6, %19
  br i1 %20, label %26, label %22

.thread:                                          ; preds = %10
  %21 = fcmp une double %6, 0xC1E0000000000000
  br i1 %21, label %26, label %.thread61

22:                                               ; preds = %17
  %.not = icmp eq i32 %18, 0
  br i1 %.not, label %23, label %.thread61

23:                                               ; preds = %22
  %24 = tail call i64 @i64_reinterpret_f64(double noundef %6)
  %25 = icmp sgt i64 %24, -1
  br i1 %25, label %.thread61, label %26

26:                                               ; preds = %.thread, %23, %17, %2
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 136575, i32 noundef 85918, i32 noundef 894, i32 noundef 111088) #5
  tail call void @wasm_rt_trap(i32 noundef 5) #4
  unreachable

.thread61:                                        ; preds = %.thread, %23, %22
  %.06064 = phi i32 [ 0, %23 ], [ %18, %22 ], [ -2147483648, %.thread ]
  ret i32 %.06064
}

attributes #0 = { 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 #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 = { 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: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LowerExpectIntrinsicPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass