; LLVM IR from facebook/hermes :: API/hermes_sandbox/external (hermes_sandbox_impl_opt_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: inlinehint nounwind uwtable
declare hidden i32 @i32_load(ptr noundef, i64 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @i32_store(ptr noundef, i64 noundef, i32 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: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3AStackOverflowGuard0x3A0x3AisStackOverflowingSlowPath0x280x29(ptr noundef %0, i32 noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %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
  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 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !9
  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 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.w2c_hermes, ptr %12, i32 0, i32 3
  %14 = load i32, ptr %13, align 8, !tbaa !11
  store i32 %14, ptr %8, align 4, !tbaa !9
  store i32 16, ptr %9, align 4, !tbaa !9
  %15 = load i32, ptr %9, align 4, !tbaa !9
  %16 = load i32, ptr %8, align 4, !tbaa !9
  %17 = sub i32 %16, %15
  store i32 %17, ptr %8, align 4, !tbaa !9
  %18 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %18, ptr %5, align 4, !tbaa !9
  %19 = load i32, ptr %8, align 4, !tbaa !9
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.w2c_hermes, ptr %20, i32 0, i32 3
  store i32 %19, ptr %21, align 8, !tbaa !11
  %22 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %22, ptr %8, align 4, !tbaa !9
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.w2c_hermes, ptr %23, i32 0, i32 6
  %25 = load i32, ptr %8, align 4, !tbaa !9
  %26 = zext i32 %25 to i64
  %27 = add i64 %26, 8
  %28 = call i32 @i32_load(ptr noundef %24, i64 noundef %27)
  store i32 %28, ptr %8, align 4, !tbaa !9
  %29 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %29, ptr %6, align 4, !tbaa !9
  %30 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %30, ptr %8, align 4, !tbaa !9
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.w2c_hermes, ptr %31, i32 0, i32 5
  %33 = load i32, ptr %32, align 8, !tbaa !17
  store i32 %33, ptr %9, align 4, !tbaa !9
  %34 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %34, ptr %7, align 4, !tbaa !9
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.w2c_hermes, ptr %35, i32 0, i32 6
  %37 = load i32, ptr %8, align 4, !tbaa !9
  %38 = zext i32 %37 to i64
  %39 = add i64 %38, 8
  %40 = load i32, ptr %9, align 4, !tbaa !9
  call void @i32_store(ptr noundef %36, i64 noundef %39, i32 noundef %40)
  %41 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %41, ptr %8, align 4, !tbaa !9
  %42 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %42, ptr %9, align 4, !tbaa !9
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.w2c_hermes, ptr %43, i32 0, i32 4
  %45 = load i32, ptr %44, align 4, !tbaa !18
  store i32 %45, ptr %10, align 4, !tbaa !9
  %46 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %46, ptr %11, align 4, !tbaa !9
  %47 = load i32, ptr %11, align 4, !tbaa !9
  %48 = load i32, ptr %10, align 4, !tbaa !9
  %49 = add i32 %48, %47
  store i32 %49, ptr %10, align 4, !tbaa !9
  %50 = load i32, ptr %10, align 4, !tbaa !9
  %51 = load i32, ptr %9, align 4, !tbaa !9
  %52 = sub i32 %51, %50
  store i32 %52, ptr %9, align 4, !tbaa !9
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.w2c_hermes, ptr %53, i32 0, i32 6
  %55 = load i32, ptr %8, align 4, !tbaa !9
  %56 = zext i32 %55 to i64
  %57 = add i64 %56, 12
  %58 = load i32, ptr %9, align 4, !tbaa !9
  call void @i32_store(ptr noundef %54, i64 noundef %57, i32 noundef %58)
  %59 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %59, ptr %8, align 4, !tbaa !9
  %60 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %60, ptr %9, align 4, !tbaa !9
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.w2c_hermes, ptr %61, i32 0, i32 6
  %63 = load i32, ptr %9, align 4, !tbaa !9
  %64 = zext i32 %63 to i64
  %65 = add i64 %64, 8
  %66 = call i32 @i32_load(ptr noundef %62, i64 noundef %65)
  store i32 %66, ptr %9, align 4, !tbaa !9
  %67 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %67, ptr %6, align 4, !tbaa !9
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.w2c_hermes, ptr %68, i32 0, i32 6
  %70 = load i32, ptr %8, align 4, !tbaa !9
  %71 = zext i32 %70 to i64
  %72 = load i32, ptr %9, align 4, !tbaa !9
  call void @i32_store(ptr noundef %69, i64 noundef %71, i32 noundef %72)
  %73 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %73, ptr %8, align 4, !tbaa !9
  %74 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %74, ptr %9, align 4, !tbaa !9
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.w2c_hermes, ptr %75, i32 0, i32 6
  %77 = load i32, ptr %9, align 4, !tbaa !9
  %78 = zext i32 %77 to i64
  %79 = add i64 %78, 12
  %80 = call i32 @i32_load(ptr noundef %76, i64 noundef %79)
  store i32 %80, ptr %9, align 4, !tbaa !9
  %81 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %81, ptr %4, align 4, !tbaa !9
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.w2c_hermes, ptr %82, i32 0, i32 6
  %84 = load i32, ptr %8, align 4, !tbaa !9
  %85 = zext i32 %84 to i64
  %86 = add i64 %85, 4
  %87 = load i32, ptr %9, align 4, !tbaa !9
  call void @i32_store(ptr noundef %83, i64 noundef %86, i32 noundef %87)
  %88 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %88, ptr %8, align 4, !tbaa !9
  store i32 16, ptr %9, align 4, !tbaa !9
  %89 = load i32, ptr %9, align 4, !tbaa !9
  %90 = load i32, ptr %8, align 4, !tbaa !9
  %91 = add i32 %90, %89
  store i32 %91, ptr %8, align 4, !tbaa !9
  %92 = load i32, ptr %8, align 4, !tbaa !9
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.w2c_hermes, ptr %93, i32 0, i32 3
  store i32 %92, ptr %94, align 8, !tbaa !11
  %95 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %95, ptr %8, align 4, !tbaa !9
  %96 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %96, ptr %9, align 4, !tbaa !9
  %97 = load i32, ptr %9, align 4, !tbaa !9
  %98 = load i32, ptr %8, align 4, !tbaa !9
  %99 = sub i32 %98, %97
  store i32 %99, ptr %8, align 4, !tbaa !9
  %100 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %100, ptr %9, align 4, !tbaa !9
  %101 = load i32, ptr %8, align 4, !tbaa !9
  %102 = load i32, ptr %9, align 4, !tbaa !9
  %103 = icmp ugt i32 %101, %102
  %104 = zext i1 %103 to i32
  store i32 %104, ptr %8, align 4, !tbaa !9
  %105 = load i32, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, 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 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret i32 %105
}

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 = { 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, !10, i64 24}
!12 = !{!"w2c_hermes", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !13, i64 40, !16, i64 80}
!13 = !{!"", !6, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !15, i64 32}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{!"", !6, i64 0, !10, i64 8, !10, i64 12}
!17 = !{!12, !10, i64 32}
!18 = !{!12, !10, i64 28}


; 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 i32 @i32_load(ptr noundef, i64 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @w2c_hermes_hermes0x3A0x3AStackOverflowGuard0x3A0x3AisStackOverflowingSlowPath0x280x29(ptr noundef %0, i32 noundef %1) local_unnamed_addr #1 {
  %3 = getelementptr inbounds i8, ptr %0, i64 24
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = add i32 %4, -16
  store i32 %5, ptr %3, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 40
  %7 = zext i32 %1 to i64
  %8 = add nuw nsw i64 %7, 8
  %9 = tail call i32 @i32_load(ptr noundef nonnull %6, i64 noundef %8)
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  %11 = load i32, ptr %10, align 8, !tbaa !15
  %12 = zext i32 %5 to i64
  %13 = add nuw nsw i64 %12, 8
  tail call void @i32_store(ptr noundef nonnull %6, i64 noundef %13, i32 noundef %11)
  %14 = getelementptr inbounds i8, ptr %0, i64 28
  %15 = load i32, ptr %14, align 4, !tbaa !16
  %16 = add i32 %9, %15
  %17 = sub i32 %11, %16
  %18 = add nuw nsw i64 %12, 12
  tail call void @i32_store(ptr noundef nonnull %6, i64 noundef %18, i32 noundef %17)
  %19 = tail call i32 @i32_load(ptr noundef nonnull %6, i64 noundef %13)
  tail call void @i32_store(ptr noundef nonnull %6, i64 noundef %7, i32 noundef %19)
  %20 = tail call i32 @i32_load(ptr noundef nonnull %6, i64 noundef %18)
  %21 = add nuw nsw i64 %7, 4
  tail call void @i32_store(ptr noundef nonnull %6, i64 noundef %21, i32 noundef %20)
  store i32 %4, ptr %3, align 8, !tbaa !5
  %22 = sub i32 %19, %5
  %23 = icmp ugt i32 %22, %20
  %24 = zext i1 %23 to i32
  ret i32 %24
}

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

!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}
!15 = !{!6, !10, i64 32}
!16 = !{!6, !10, i64 28}


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