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

; 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: inlinehint nounwind uwtable
declare hidden void @i32_store(ptr noundef, i64 noundef, i32 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @i32_load(ptr noundef, i64 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @i64_store(ptr noundef, i64 noundef, i64 noundef) #1

; 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 double @f64_load(ptr noundef, i64 noundef) #1

declare void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AtoNumber_RJS0x28hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3AHandle0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue0x3E0x29(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AisNaN0x28void0x2A0x2C0x20hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3ANativeArgs0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) #3 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca double, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  store i32 %4, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store double 0.000000e+00, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 4, 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.w2c_hermes, ptr %21, i32 0, i32 3
  %23 = load i32, ptr %22, align 8, !tbaa !13
  store i32 %23, ptr %12, align 4, !tbaa !9
  store i32 16, ptr %13, align 4, !tbaa !9
  %24 = load i32, ptr %13, align 4, !tbaa !9
  %25 = load i32, ptr %12, align 4, !tbaa !9
  %26 = sub i32 %25, %24
  store i32 %26, ptr %12, align 4, !tbaa !9
  %27 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %27, ptr %8, align 4, !tbaa !9
  %28 = load i32, ptr %12, align 4, !tbaa !9
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.w2c_hermes, ptr %29, i32 0, i32 3
  store i32 %28, ptr %30, align 8, !tbaa !13
  %31 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %31, ptr %12, align 4, !tbaa !9
  %32 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %32, ptr %13, align 4, !tbaa !9
  %33 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %33, ptr %14, align 4, !tbaa !9
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.w2c_hermes, ptr %34, i32 0, i32 6
  %36 = load i32, ptr %14, align 4, !tbaa !9
  %37 = zext i32 %36 to i64
  %38 = call i32 @i32_load(ptr noundef %35, i64 noundef %37)
  store i32 %38, ptr %14, align 4, !tbaa !9
  store i32 8, ptr %15, align 4, !tbaa !9
  %39 = load i32, ptr %15, align 4, !tbaa !9
  %40 = load i32, ptr %14, align 4, !tbaa !9
  %41 = sub i32 %40, %39
  store i32 %41, ptr %14, align 4, !tbaa !9
  store i32 67208, ptr %15, align 4, !tbaa !9
  %42 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %42, ptr %16, align 4, !tbaa !9
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.w2c_hermes, ptr %43, i32 0, i32 6
  %45 = load i32, ptr %16, align 4, !tbaa !9
  %46 = zext i32 %45 to i64
  %47 = add i64 %46, 4
  %48 = call i32 @i32_load(ptr noundef %44, i64 noundef %47)
  store i32 %48, ptr %16, align 4, !tbaa !9
  %49 = load i32, ptr %16, align 4, !tbaa !9
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %51, label %53

51:                                               ; preds = %5
  %52 = load i32, ptr %14, align 4, !tbaa !9
  br label %55

53:                                               ; preds = %5
  %54 = load i32, ptr %15, align 4, !tbaa !9
  br label %55

55:                                               ; preds = %53, %51
  %56 = phi i32 [ %52, %51 ], [ %54, %53 ]
  store i32 %56, ptr %14, align 4, !tbaa !9
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = load i32, ptr %12, align 4, !tbaa !9
  %59 = load i32, ptr %13, align 4, !tbaa !9
  %60 = load i32, ptr %14, align 4, !tbaa !9
  call void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AtoNumber_RJS0x28hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3AHandle0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue0x3E0x29(ptr noundef %57, i32 noundef %58, i32 noundef %59, i32 noundef %60)
  %61 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %61, ptr %12, align 4, !tbaa !9
  %62 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %62, ptr %13, align 4, !tbaa !9
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.w2c_hermes, ptr %63, i32 0, i32 6
  %65 = load i32, ptr %13, align 4, !tbaa !9
  %66 = zext i32 %65 to i64
  %67 = call i32 @i32_load(ptr noundef %64, i64 noundef %66)
  store i32 %67, ptr %13, align 4, !tbaa !9
  %68 = load i32, ptr %13, align 4, !tbaa !9
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %70, label %96

70:                                               ; preds = %55
  %71 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %71, ptr %13, align 4, !tbaa !9
  %72 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %72, ptr %14, align 4, !tbaa !9
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.w2c_hermes, ptr %73, i32 0, i32 6
  %75 = load i32, ptr %14, align 4, !tbaa !9
  %76 = zext i32 %75 to i64
  %77 = add i64 %76, 8
  %78 = call double @f64_load(ptr noundef %74, i64 noundef %77)
  store double %78, ptr %19, align 8, !tbaa !11
  %79 = load double, ptr %19, align 8, !tbaa !11
  store double %79, ptr %11, align 8, !tbaa !11
  %80 = load double, ptr %11, align 8, !tbaa !11
  store double %80, ptr %20, align 8, !tbaa !11
  %81 = load double, ptr %19, align 8, !tbaa !11
  %82 = load double, ptr %20, align 8, !tbaa !11
  %83 = fcmp une double %81, %82
  %84 = zext i1 %83 to i32
  store i32 %84, ptr %14, align 4, !tbaa !9
  %85 = load i32, ptr %14, align 4, !tbaa !9
  %86 = zext i32 %85 to i64
  store i64 %86, ptr %17, align 8, !tbaa !19
  store i64 -1407374883553280, ptr %18, align 8, !tbaa !19
  %87 = load i64, ptr %18, align 8, !tbaa !19
  %88 = load i64, ptr %17, align 8, !tbaa !19
  %89 = or i64 %88, %87
  store i64 %89, ptr %17, align 8, !tbaa !19
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.w2c_hermes, ptr %90, i32 0, i32 6
  %92 = load i32, ptr %13, align 4, !tbaa !9
  %93 = zext i32 %92 to i64
  %94 = add i64 %93, 8
  %95 = load i64, ptr %17, align 8, !tbaa !19
  call void @i64_store(ptr noundef %91, i64 noundef %94, i64 noundef %95)
  store i32 1, ptr %13, align 4, !tbaa !9
  br label %97

96:                                               ; preds = %55
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %97

97:                                               ; preds = %96, %70
  %98 = load ptr, ptr %6, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.w2c_hermes, ptr %98, i32 0, i32 6
  %100 = load i32, ptr %12, align 4, !tbaa !9
  %101 = zext i32 %100 to i64
  %102 = load i32, ptr %13, align 4, !tbaa !9
  call void @i32_store(ptr noundef %99, i64 noundef %101, i32 noundef %102)
  %103 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %103, ptr %12, align 4, !tbaa !9
  store i32 16, ptr %13, align 4, !tbaa !9
  %104 = load i32, ptr %13, align 4, !tbaa !9
  %105 = load i32, ptr %12, align 4, !tbaa !9
  %106 = add i32 %105, %104
  store i32 %106, ptr %12, align 4, !tbaa !9
  %107 = load i32, ptr %12, align 4, !tbaa !9
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.w2c_hermes, ptr %108, i32 0, i32 3
  store i32 %107, ptr %109, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  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 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  ret void
}

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 = { "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 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !10, i64 24}
!14 = !{!"w2c_hermes", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !15, i64 40, !18, i64 80}
!15 = !{!"", !6, i64 0, !16, i64 8, !16, i64 16, !16, i64 24, !17, i64 32}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_Bool", !7, i64 0}
!18 = !{!"", !6, i64 0, !10, i64 8, !10, i64 12}
!19 = !{!16, !16, 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 void @i32_store(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @i32_load(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @i64_store(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #0

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

declare void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AtoNumber_RJS0x28hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3AHandle0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue0x3E0x29(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AisNaN0x28void0x2A0x2C0x20hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3ANativeArgs0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #2 {
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = add i32 %7, -16
  store i32 %8, ptr %6, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  %10 = zext i32 %4 to i64
  %11 = tail call i32 @i32_load(ptr noundef nonnull %9, i64 noundef %10)
  %12 = add i32 %11, -8
  %13 = add nuw nsw i64 %10, 4
  %14 = tail call i32 @i32_load(ptr noundef nonnull %9, i64 noundef %13)
  %.not = icmp eq i32 %14, 0
  %15 = select i1 %.not, i32 67208, i32 %12
  tail call void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AtoNumber_RJS0x28hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3AHandle0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue0x3E0x29(ptr noundef %0, i32 noundef %8, i32 noundef %3, i32 noundef %15) #3
  %16 = zext i32 %8 to i64
  %17 = tail call i32 @i32_load(ptr noundef nonnull %9, i64 noundef %16)
  %.not49 = icmp eq i32 %17, 0
  br i1 %.not49, label %._crit_edge, label %18

._crit_edge:                                      ; preds = %5
  %.pre = zext i32 %1 to i64
  br label %26

18:                                               ; preds = %5
  %19 = add nuw nsw i64 %16, 8
  %20 = tail call double @f64_load(ptr noundef nonnull %9, i64 noundef %19)
  %21 = fcmp uno double %20, 0.000000e+00
  %22 = zext i1 %21 to i64
  %23 = or disjoint i64 %22, -1407374883553280
  %24 = zext i32 %1 to i64
  %25 = add nuw nsw i64 %24, 8
  tail call void @i64_store(ptr noundef nonnull %9, i64 noundef %25, i64 noundef %23)
  br label %26

26:                                               ; preds = %._crit_edge, %18
  %.pre-phi = phi i64 [ %.pre, %._crit_edge ], [ %24, %18 ]
  %.0 = phi i32 [ 0, %._crit_edge ], [ 1, %18 ]
  tail call void @i32_store(ptr noundef nonnull %9, i64 noundef %.pre-phi, i32 noundef %.0)
  store i32 %7, ptr %6, align 8, !tbaa !5
  ret void
}

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 = { "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 = { 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, !10, i64 24}
!6 = !{!"w2c_hermes", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !11, i64 40, !14, i64 80}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"", !7, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !13, i64 32}
!12 = !{!"long", !8, i64 0}
!13 = !{!"_Bool", !8, i64 0}
!14 = !{!"", !7, i64 0, !10, i64 8, !10, i64 12}


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