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

declare i32 @w2c_hermes_hermes0x3A0x3AIRBuilder0x3A0x3AcreateLoadPropertyInst0x28hermes0x3A0x3AValue0x2A0x2C0x20hermes0x3A0x3AValue0x2A0x29(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #2

declare i32 @w2c_hermes_hermes0x3A0x3AIRBuilder0x3A0x3AcreateLoadFrameInst0x28hermes0x3A0x3AVariable0x2A0x2C0x20hermes0x3A0x3AScopeCreationInst0x2A0x29(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @w2c_hermes_hermes0x3A0x3AIRBuilder0x3A0x3AcreateThrowIfEmptyInst0x28hermes0x3A0x3AValue0x2A0x29(ptr noundef, i32 noundef, i32 noundef) #3

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

25:                                               ; preds = %4
  %26 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %26, ptr %9, align 4, !tbaa !9
  store i32 4, ptr %10, align 4, !tbaa !9
  %27 = load i32, ptr %10, align 4, !tbaa !9
  %28 = load i32, ptr %9, align 4, !tbaa !9
  %29 = add i32 %28, %27
  store i32 %29, ptr %9, align 4, !tbaa !9
  %30 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %30, ptr %8, align 4, !tbaa !9
  %31 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %31, ptr %10, align 4, !tbaa !9
  %32 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %32, ptr %11, align 4, !tbaa !9
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.w2c_hermes, ptr %33, i32 0, i32 6
  %35 = load i32, ptr %11, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = add i64 %36, 88
  %38 = call i32 @i32_load(ptr noundef %34, i64 noundef %37)
  store i32 %38, ptr %11, align 4, !tbaa !9
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = load i32, ptr %9, align 4, !tbaa !9
  %41 = load i32, ptr %10, align 4, !tbaa !9
  %42 = load i32, ptr %11, align 4, !tbaa !9
  %43 = call i32 @w2c_hermes_hermes0x3A0x3AIRBuilder0x3A0x3AcreateLoadFrameInst0x28hermes0x3A0x3AVariable0x2A0x2C0x20hermes0x3A0x3AScopeCreationInst0x2A0x29(ptr noundef %39, i32 noundef %40, i32 noundef %41, i32 noundef %42)
  store i32 %43, ptr %9, align 4, !tbaa !9
  %44 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %44, ptr %6, align 4, !tbaa !9
  %45 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %45, ptr %9, align 4, !tbaa !9
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.w2c_hermes, ptr %46, i32 0, i32 6
  %48 = load i32, ptr %9, align 4, !tbaa !9
  %49 = zext i32 %48 to i64
  %50 = add i64 %49, 28
  %51 = call i32 @i32_load8_u(ptr noundef %47, i64 noundef %50)
  store i32 %51, ptr %9, align 4, !tbaa !9
  store i32 2, ptr %10, align 4, !tbaa !9
  %52 = load i32, ptr %9, align 4, !tbaa !9
  %53 = load i32, ptr %10, align 4, !tbaa !9
  %54 = icmp eq i32 %52, %53
  %55 = zext i1 %54 to i32
  store i32 %55, ptr %9, align 4, !tbaa !9
  %56 = load i32, ptr %9, align 4, !tbaa !9
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %59

58:                                               ; preds = %25
  br label %128

59:                                               ; preds = %25
  %60 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %60, ptr %9, align 4, !tbaa !9
  %61 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %61, ptr %10, align 4, !tbaa !9
  store i32 8, ptr %11, align 4, !tbaa !9
  %62 = load i32, ptr %11, align 4, !tbaa !9
  %63 = load i32, ptr %10, align 4, !tbaa !9
  %64 = add i32 %63, %62
  store i32 %64, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %11, align 4, !tbaa !9
  %65 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %65, ptr %12, align 4, !tbaa !9
  %66 = load i32, ptr %12, align 4, !tbaa !9
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %68, label %70

68:                                               ; preds = %59
  %69 = load i32, ptr %10, align 4, !tbaa !9
  br label %72

70:                                               ; preds = %59
  %71 = load i32, ptr %11, align 4, !tbaa !9
  br label %72

72:                                               ; preds = %70, %68
  %73 = phi i32 [ %69, %68 ], [ %71, %70 ]
  store i32 %73, ptr %10, align 4, !tbaa !9
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = load i32, ptr %9, align 4, !tbaa !9
  %76 = load i32, ptr %10, align 4, !tbaa !9
  %77 = call i32 @w2c_hermes_hermes0x3A0x3AIRBuilder0x3A0x3AcreateThrowIfEmptyInst0x28hermes0x3A0x3AValue0x2A0x29(ptr noundef %74, i32 noundef %75, i32 noundef %76)
  store i32 %77, ptr %9, align 4, !tbaa !9
  br label %130

78:                                               ; preds = %4
  %79 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %79, ptr %9, align 4, !tbaa !9
  store i32 4, ptr %10, align 4, !tbaa !9
  %80 = load i32, ptr %10, align 4, !tbaa !9
  %81 = load i32, ptr %9, align 4, !tbaa !9
  %82 = add i32 %81, %80
  store i32 %82, ptr %9, align 4, !tbaa !9
  %83 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %83, ptr %6, align 4, !tbaa !9
  %84 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %84, ptr %9, align 4, !tbaa !9
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.w2c_hermes, ptr %85, i32 0, i32 6
  %87 = load i32, ptr %9, align 4, !tbaa !9
  %88 = zext i32 %87 to i64
  %89 = add i64 %88, 36
  %90 = call i32 @i32_load8_u(ptr noundef %86, i64 noundef %89)
  store i32 %90, ptr %9, align 4, !tbaa !9
  %91 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %91, ptr %10, align 4, !tbaa !9
  %92 = load i32, ptr %10, align 4, !tbaa !9
  %93 = load i32, ptr %9, align 4, !tbaa !9
  %94 = or i32 %93, %92
  store i32 %94, ptr %9, align 4, !tbaa !9
  %95 = load i32, ptr %9, align 4, !tbaa !9
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %120

97:                                               ; preds = %78
  %98 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %98, ptr %9, align 4, !tbaa !9
  %99 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %99, ptr %10, align 4, !tbaa !9
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.w2c_hermes, ptr %100, i32 0, i32 6
  %102 = load i32, ptr %10, align 4, !tbaa !9
  %103 = zext i32 %102 to i64
  %104 = call i32 @i32_load(ptr noundef %101, i64 noundef %103)
  store i32 %104, ptr %10, align 4, !tbaa !9
  store i32 212, ptr %11, align 4, !tbaa !9
  %105 = load i32, ptr %11, align 4, !tbaa !9
  %106 = load i32, ptr %10, align 4, !tbaa !9
  %107 = add i32 %106, %105
  store i32 %107, ptr %10, align 4, !tbaa !9
  %108 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %108, ptr %11, align 4, !tbaa !9
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.w2c_hermes, ptr %109, i32 0, i32 6
  %111 = load i32, ptr %11, align 4, !tbaa !9
  %112 = zext i32 %111 to i64
  %113 = add i64 %112, 32
  %114 = call i32 @i32_load(ptr noundef %110, i64 noundef %113)
  store i32 %114, ptr %11, align 4, !tbaa !9
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = load i32, ptr %9, align 4, !tbaa !9
  %117 = load i32, ptr %10, align 4, !tbaa !9
  %118 = load i32, ptr %11, align 4, !tbaa !9
  %119 = call i32 @w2c_hermes_hermes0x3A0x3AIRBuilder0x3A0x3AcreateLoadPropertyInst0x28hermes0x3A0x3AValue0x2A0x2C0x20hermes0x3A0x3AValue0x2A0x29(ptr noundef %115, i32 noundef %116, i32 noundef %117, i32 noundef %118)
  store i32 %119, ptr %9, align 4, !tbaa !9
  br label %130

120:                                              ; preds = %78
  %121 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %121, ptr %9, align 4, !tbaa !9
  %122 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %122, ptr %10, align 4, !tbaa !9
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = load i32, ptr %9, align 4, !tbaa !9
  %125 = load i32, ptr %10, align 4, !tbaa !9
  %126 = call i32 @w2c_hermes_hermes0x3A0x3AIRBuilder0x3A0x3AcreateTryLoadGlobalPropertyInst0x28hermes0x3A0x3AGlobalObjectProperty0x2A0x29(ptr noundef %123, i32 noundef %124, i32 noundef %125)
  store i32 %126, ptr %9, align 4, !tbaa !9
  %127 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %127, ptr %6, align 4, !tbaa !9
  br label %128

128:                                              ; preds = %120, %58
  %129 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %129, ptr %9, align 4, !tbaa !9
  br label %130

130:                                              ; preds = %128, %97, %72
  %131 = load i32, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  ret i32 %131
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @w2c_hermes_hermes0x3A0x3AIRBuilder0x3A0x3AcreateTryLoadGlobalPropertyInst0x28hermes0x3A0x3AGlobalObjectProperty0x2A0x29(ptr noundef, i32 noundef, i32 noundef) #3

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}


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

declare i32 @w2c_hermes_hermes0x3A0x3AIRBuilder0x3A0x3AcreateLoadPropertyInst0x28hermes0x3A0x3AValue0x2A0x2C0x20hermes0x3A0x3AValue0x2A0x29(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

declare i32 @w2c_hermes_hermes0x3A0x3AIRBuilder0x3A0x3AcreateLoadFrameInst0x28hermes0x3A0x3AVariable0x2A0x2C0x20hermes0x3A0x3AScopeCreationInst0x2A0x29(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3Airgen0x3A0x3AESTreeIRGen0x3A0x3AemitLoad0x28hermes0x3A0x3AValue0x2A0x2C0x20bool0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #2 {
  %5 = getelementptr inbounds i8, ptr %0, i64 40
  %6 = zext i32 %2 to i64
  %7 = tail call i32 @i32_load8_u(ptr noundef nonnull %5, i64 noundef %6)
  %8 = icmp eq i32 %7, 124
  %9 = add i32 %1, 4
  br i1 %8, label %10, label %22

10:                                               ; preds = %4
  %11 = zext i32 %1 to i64
  %12 = add nuw nsw i64 %11, 88
  %13 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %12)
  %14 = tail call i32 @w2c_hermes_hermes0x3A0x3AIRBuilder0x3A0x3AcreateLoadFrameInst0x28hermes0x3A0x3AVariable0x2A0x2C0x20hermes0x3A0x3AScopeCreationInst0x2A0x29(ptr noundef %0, i32 noundef %9, i32 noundef %2, i32 noundef %13) #3
  %15 = add nuw nsw i64 %6, 28
  %16 = tail call i32 @i32_load8_u(ptr noundef nonnull %5, i64 noundef %15)
  %17 = icmp eq i32 %16, 2
  br i1 %17, label %35, label %18

18:                                               ; preds = %10
  %19 = add i32 %14, 8
  %.not68 = icmp eq i32 %14, 0
  %20 = select i1 %.not68, i32 0, i32 %19
  %21 = tail call i32 @w2c_hermes_hermes0x3A0x3AIRBuilder0x3A0x3AcreateThrowIfEmptyInst0x28hermes0x3A0x3AValue0x2A0x29(ptr noundef %0, i32 noundef %9, i32 noundef %20)
  br label %35

22:                                               ; preds = %4
  %23 = add nuw nsw i64 %6, 36
  %24 = tail call i32 @i32_load8_u(ptr noundef nonnull %5, i64 noundef %23)
  %25 = or i32 %24, %3
  %.not = icmp eq i32 %25, 0
  br i1 %.not, label %33, label %26

26:                                               ; preds = %22
  %27 = zext i32 %9 to i64
  %28 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %27)
  %29 = add i32 %28, 212
  %30 = add nuw nsw i64 %6, 32
  %31 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %30)
  %32 = tail call i32 @w2c_hermes_hermes0x3A0x3AIRBuilder0x3A0x3AcreateLoadPropertyInst0x28hermes0x3A0x3AValue0x2A0x2C0x20hermes0x3A0x3AValue0x2A0x29(ptr noundef %0, i32 noundef %9, i32 noundef %29, i32 noundef %31) #3
  br label %35

33:                                               ; preds = %22
  %34 = tail call i32 @w2c_hermes_hermes0x3A0x3AIRBuilder0x3A0x3AcreateTryLoadGlobalPropertyInst0x28hermes0x3A0x3AGlobalObjectProperty0x2A0x29(ptr noundef %0, i32 noundef %9, i32 noundef %2)
  br label %35

35:                                               ; preds = %33, %10, %26, %18
  %.067 = phi i32 [ %21, %18 ], [ %32, %26 ], [ %14, %10 ], [ %34, %33 ]
  ret i32 %.067
}

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

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


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