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

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

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

30:                                               ; preds = %5
  br label %74

31:                                               ; preds = %5
  %32 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %32, ptr %13, align 4, !tbaa !9
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.w2c_hermes, ptr %33, i32 0, i32 6
  %35 = load i32, ptr %13, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = call i32 @i32_load(ptr noundef %34, i64 noundef %36)
  store i32 %37, ptr %13, align 4, !tbaa !9
  store i32 8, ptr %14, align 4, !tbaa !9
  %38 = load i32, ptr %14, align 4, !tbaa !9
  %39 = load i32, ptr %13, align 4, !tbaa !9
  %40 = sub i32 %39, %38
  store i32 %40, ptr %13, align 4, !tbaa !9
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.w2c_hermes, ptr %41, i32 0, i32 6
  %43 = load i32, ptr %13, align 4, !tbaa !9
  %44 = zext i32 %43 to i64
  %45 = call i64 @i64_load(ptr noundef %42, i64 noundef %44)
  store i64 %45, ptr %15, align 8, !tbaa !11
  %46 = load i64, ptr %15, align 8, !tbaa !11
  store i64 %46, ptr %11, align 8, !tbaa !11
  store i64 -844424930131968, ptr %16, align 8, !tbaa !11
  %47 = load i64, ptr %15, align 8, !tbaa !11
  %48 = load i64, ptr %16, align 8, !tbaa !11
  %49 = icmp ult i64 %47, %48
  %50 = zext i1 %49 to i32
  store i32 %50, ptr %13, align 4, !tbaa !9
  %51 = load i32, ptr %13, align 4, !tbaa !9
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %54

53:                                               ; preds = %31
  br label %74

54:                                               ; preds = %31
  %55 = load i64, ptr %11, align 8, !tbaa !11
  store i64 %55, ptr %15, align 8, !tbaa !11
  %56 = load i64, ptr %15, align 8, !tbaa !11
  %57 = trunc i64 %56 to i32
  store i32 %57, ptr %13, align 4, !tbaa !9
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.w2c_hermes, ptr %58, i32 0, i32 6
  %60 = load i32, ptr %13, align 4, !tbaa !9
  %61 = zext i32 %60 to i64
  %62 = call i32 @i32_load(ptr noundef %59, i64 noundef %61)
  store i32 %62, ptr %13, align 4, !tbaa !9
  store i32 436207616, ptr %14, align 4, !tbaa !9
  %63 = load i32, ptr %14, align 4, !tbaa !9
  %64 = load i32, ptr %13, align 4, !tbaa !9
  %65 = sub i32 %64, %63
  store i32 %65, ptr %13, align 4, !tbaa !9
  store i32 855638016, ptr %14, align 4, !tbaa !9
  %66 = load i32, ptr %13, align 4, !tbaa !9
  %67 = load i32, ptr %14, align 4, !tbaa !9
  %68 = icmp ult i32 %66, %67
  %69 = zext i1 %68 to i32
  store i32 %69, ptr %13, align 4, !tbaa !9
  %70 = load i32, ptr %13, align 4, !tbaa !9
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %73

72:                                               ; preds = %54
  br label %81

73:                                               ; preds = %54
  br label %74

74:                                               ; preds = %73, %53, %30
  store i32 67200, ptr %13, align 4, !tbaa !9
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.w2c_hermes, ptr %75, i32 0, i32 6
  %77 = load i32, ptr %13, align 4, !tbaa !9
  %78 = zext i32 %77 to i64
  %79 = call i64 @i64_load(ptr noundef %76, i64 noundef %78)
  store i64 %79, ptr %15, align 8, !tbaa !11
  %80 = load i64, ptr %15, align 8, !tbaa !11
  store i64 %80, ptr %11, align 8, !tbaa !11
  br label %81

81:                                               ; preds = %74, %72
  store i64 -1407374883553280, ptr %15, align 8, !tbaa !11
  %82 = load i64, ptr %15, align 8, !tbaa !11
  store i64 %82, ptr %12, align 8, !tbaa !11
  %83 = load i64, ptr %11, align 8, !tbaa !11
  store i64 %83, ptr %15, align 8, !tbaa !11
  store i64 -844424930131968, ptr %16, align 8, !tbaa !11
  %84 = load i64, ptr %15, align 8, !tbaa !11
  %85 = load i64, ptr %16, align 8, !tbaa !11
  %86 = icmp ult i64 %84, %85
  %87 = zext i1 %86 to i32
  store i32 %87, ptr %13, align 4, !tbaa !9
  %88 = load i32, ptr %13, align 4, !tbaa !9
  %89 = icmp ne i32 %88, 0
  br i1 %89, label %90, label %91

90:                                               ; preds = %81
  br label %124

91:                                               ; preds = %81
  %92 = load i64, ptr %11, align 8, !tbaa !11
  store i64 %92, ptr %15, align 8, !tbaa !11
  store i64 4294967295, ptr %16, align 8, !tbaa !11
  %93 = load i64, ptr %16, align 8, !tbaa !11
  %94 = load i64, ptr %15, align 8, !tbaa !11
  %95 = and i64 %94, %93
  store i64 %95, ptr %15, align 8, !tbaa !11
  %96 = load i64, ptr %15, align 8, !tbaa !11
  %97 = icmp ne i64 %96, 0
  %98 = xor i1 %97, true
  %99 = zext i1 %98 to i32
  store i32 %99, ptr %13, align 4, !tbaa !9
  %100 = load i32, ptr %13, align 4, !tbaa !9
  %101 = icmp ne i32 %100, 0
  br i1 %101, label %102, label %103

102:                                              ; preds = %91
  br label %124

103:                                              ; preds = %91
  %104 = load i64, ptr %11, align 8, !tbaa !11
  store i64 %104, ptr %15, align 8, !tbaa !11
  %105 = load i64, ptr %15, align 8, !tbaa !11
  %106 = trunc i64 %105 to i32
  store i32 %106, ptr %13, align 4, !tbaa !9
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.w2c_hermes, ptr %107, i32 0, i32 6
  %109 = load i32, ptr %13, align 4, !tbaa !9
  %110 = zext i32 %109 to i64
  %111 = add i64 %110, 4
  %112 = call i64 @i64_load32_u(ptr noundef %108, i64 noundef %111)
  store i64 %112, ptr %15, align 8, !tbaa !11
  store i64 7, ptr %16, align 8, !tbaa !11
  %113 = load i64, ptr %16, align 8, !tbaa !11
  %114 = and i64 %113, 63
  %115 = load i64, ptr %15, align 8, !tbaa !11
  %116 = lshr i64 %115, %114
  store i64 %116, ptr %15, align 8, !tbaa !11
  store i64 1, ptr %16, align 8, !tbaa !11
  %117 = load i64, ptr %16, align 8, !tbaa !11
  %118 = load i64, ptr %15, align 8, !tbaa !11
  %119 = and i64 %118, %117
  store i64 %119, ptr %15, align 8, !tbaa !11
  store i64 -1407374883553280, ptr %16, align 8, !tbaa !11
  %120 = load i64, ptr %16, align 8, !tbaa !11
  %121 = load i64, ptr %15, align 8, !tbaa !11
  %122 = or i64 %121, %120
  store i64 %122, ptr %15, align 8, !tbaa !11
  %123 = load i64, ptr %15, align 8, !tbaa !11
  store i64 %123, ptr %12, align 8, !tbaa !11
  br label %124

124:                                              ; preds = %103, %102, %90
  %125 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %125, ptr %13, align 4, !tbaa !9
  %126 = load i64, ptr %12, align 8, !tbaa !11
  store i64 %126, ptr %16, align 8, !tbaa !11
  %127 = load ptr, ptr %6, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.w2c_hermes, ptr %127, i32 0, i32 6
  %129 = load i32, ptr %13, align 4, !tbaa !9
  %130 = zext i32 %129 to i64
  %131 = add i64 %130, 8
  %132 = load i64, ptr %16, align 8, !tbaa !11
  call void @i64_store(ptr noundef %128, i64 noundef %131, i64 noundef %132)
  %133 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %133, ptr %13, align 4, !tbaa !9
  store i32 1, ptr %14, align 4, !tbaa !9
  %134 = load ptr, ptr %6, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.w2c_hermes, ptr %134, i32 0, i32 6
  %136 = load i32, ptr %13, align 4, !tbaa !9
  %137 = zext i32 %136 to i64
  %138 = load i32, ptr %14, align 4, !tbaa !9
  call void @i32_store(ptr noundef %135, i64 noundef %137, i32 noundef %138)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, 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
  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 = { 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, !12, i64 0}
!12 = !{!"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: 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 i64 @i64_load(ptr noundef, i64 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AhermesInternalIsProxy0x28void0x2A0x2C0x20hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3ANativeArgs0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #1 {
  %6 = getelementptr inbounds i8, ptr %0, i64 40
  %7 = zext i32 %4 to i64
  %8 = add nuw nsw i64 %7, 4
  %9 = tail call i32 @i32_load(ptr noundef nonnull %6, i64 noundef %8)
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %21, label %10

10:                                               ; preds = %5
  %11 = tail call i32 @i32_load(ptr noundef nonnull %6, i64 noundef %7)
  %12 = add i32 %11, -8
  %13 = zext i32 %12 to i64
  %14 = tail call i64 @i64_load(ptr noundef nonnull %6, i64 noundef %13)
  %15 = icmp ult i64 %14, -844424930131968
  br i1 %15, label %21, label %16

16:                                               ; preds = %10
  %17 = and i64 %14, 4294967295
  %18 = tail call i32 @i32_load(ptr noundef nonnull %6, i64 noundef %17)
  %19 = add i32 %18, -436207616
  %20 = icmp ult i32 %19, 855638016
  br i1 %20, label %24, label %21

21:                                               ; preds = %16, %10, %5
  %22 = tail call i64 @i64_load(ptr noundef nonnull %6, i64 noundef 67200)
  %.pre = and i64 %22, 4294967295
  %23 = icmp ult i64 %22, -844424930131968
  br label %24

24:                                               ; preds = %16, %21
  %.pre-phi = phi i64 [ %17, %16 ], [ %.pre, %21 ]
  %.057 = phi i1 [ false, %16 ], [ %23, %21 ]
  %.not59 = icmp eq i64 %.pre-phi, 0
  %or.cond = or i1 %.057, %.not59
  br i1 %or.cond, label %31, label %25

25:                                               ; preds = %24
  %26 = add nuw nsw i64 %.pre-phi, 4
  %27 = tail call i64 @i64_load32_u(ptr noundef nonnull %6, i64 noundef %26)
  %28 = lshr i64 %27, 7
  %29 = and i64 %28, 1
  %30 = or disjoint i64 %29, -1407374883553280
  br label %31

31:                                               ; preds = %24, %25
  %.0 = phi i64 [ -1407374883553280, %24 ], [ %30, %25 ]
  %32 = zext i32 %1 to i64
  %33 = add nuw nsw i64 %32, 8
  tail call void @i64_store(ptr noundef nonnull %6, i64 noundef %33, i64 noundef %.0)
  tail call void @i32_store(ptr noundef nonnull %6, i64 noundef %32, i32 noundef 1)
  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 = { 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,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass