; LLVM IR from facebook/hermes :: API/hermes_sandbox/external (hermes_sandbox_impl_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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

32:                                               ; preds = %2
  %33 = load i32, ptr %7, align 4, !tbaa !9
  br label %36

34:                                               ; preds = %2
  %35 = load i32, ptr %8, align 4, !tbaa !9
  br label %36

36:                                               ; preds = %34, %32
  %37 = phi i32 [ %33, %32 ], [ %35, %34 ]
  store i32 %37, ptr %7, align 4, !tbaa !9
  %38 = load i32, ptr %7, align 4, !tbaa !9
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %41

40:                                               ; preds = %36
  br label %96

41:                                               ; preds = %36
  %42 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %42, ptr %7, align 4, !tbaa !9
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = icmp ne i32 %43, 0
  %45 = xor i1 %44, true
  %46 = zext i1 %45 to i32
  store i32 %46, ptr %7, align 4, !tbaa !9
  %47 = load i32, ptr %7, align 4, !tbaa !9
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %50

49:                                               ; preds = %41
  br label %104

50:                                               ; preds = %41
  %51 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %51, ptr %7, align 4, !tbaa !9
  store i32 -2, ptr %8, align 4, !tbaa !9
  %52 = load i32, ptr %8, align 4, !tbaa !9
  %53 = load i32, ptr %7, align 4, !tbaa !9
  %54 = and i32 %53, %52
  store i32 %54, ptr %7, align 4, !tbaa !9
  %55 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %55, ptr %5, align 4, !tbaa !9
  br label %56

56:                                               ; preds = %94, %86, %76, %50
  %57 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %57, ptr %7, align 4, !tbaa !9
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.w2c_hermes, ptr %58, i32 0, i32 6
  %60 = load i32, ptr %7, align 4, !tbaa !9
  %61 = zext i32 %60 to i64
  %62 = add i64 %61, 4
  %63 = call i32 @i32_load(ptr noundef %59, i64 noundef %62)
  store i32 %63, ptr %7, align 4, !tbaa !9
  %64 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %64, ptr %6, align 4, !tbaa !9
  %65 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %65, ptr %7, align 4, !tbaa !9
  store i32 4, ptr %8, align 4, !tbaa !9
  %66 = load i32, ptr %8, align 4, !tbaa !9
  %67 = load i32, ptr %7, align 4, !tbaa !9
  %68 = add i32 %67, %66
  store i32 %68, ptr %7, align 4, !tbaa !9
  %69 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %69, ptr %5, align 4, !tbaa !9
  %70 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %70, ptr %7, align 4, !tbaa !9
  store i32 1, ptr %8, align 4, !tbaa !9
  %71 = load i32, ptr %8, align 4, !tbaa !9
  %72 = load i32, ptr %7, align 4, !tbaa !9
  %73 = add i32 %72, %71
  store i32 %73, ptr %7, align 4, !tbaa !9
  %74 = load i32, ptr %7, align 4, !tbaa !9
  switch i32 %74, label %77 [
    i32 0, label %75
    i32 1, label %76
  ]

75:                                               ; preds = %56
  br label %96

76:                                               ; preds = %56
  br label %56

77:                                               ; preds = %56
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %79, ptr %7, align 4, !tbaa !9
  %80 = load i32, ptr %7, align 4, !tbaa !9
  %81 = icmp ne i32 %80, 0
  %82 = xor i1 %81, true
  %83 = zext i1 %82 to i32
  store i32 %83, ptr %7, align 4, !tbaa !9
  %84 = load i32, ptr %7, align 4, !tbaa !9
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %86, label %87

86:                                               ; preds = %78
  br label %56

87:                                               ; preds = %78
  %88 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %88, ptr %7, align 4, !tbaa !9
  store i32 1, ptr %8, align 4, !tbaa !9
  %89 = load i32, ptr %8, align 4, !tbaa !9
  %90 = load i32, ptr %7, align 4, !tbaa !9
  %91 = and i32 %90, %89
  store i32 %91, ptr %7, align 4, !tbaa !9
  %92 = load i32, ptr %7, align 4, !tbaa !9
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %94, label %95

94:                                               ; preds = %87
  br label %56

95:                                               ; preds = %87
  br label %96

96:                                               ; preds = %95, %75, %40
  %97 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %97, ptr %7, align 4, !tbaa !9
  %98 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %98, ptr %8, align 4, !tbaa !9
  %99 = load ptr, ptr %3, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.w2c_hermes, ptr %99, i32 0, i32 6
  %101 = load i32, ptr %7, align 4, !tbaa !9
  %102 = zext i32 %101 to i64
  %103 = load i32, ptr %8, align 4, !tbaa !9
  call void @i32_store(ptr noundef %100, i64 noundef %102, i32 noundef %103)
  br label %122

104:                                              ; preds = %49
  store i32 0, ptr %7, align 4, !tbaa !9
  %105 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %105, ptr %5, align 4, !tbaa !9
  store i32 146932, ptr %8, align 4, !tbaa !9
  %106 = load i32, ptr %8, align 4, !tbaa !9
  %107 = load i32, ptr %7, align 4, !tbaa !9
  %108 = add i32 %107, %106
  store i32 %108, ptr %7, align 4, !tbaa !9
  %109 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %109, ptr %8, align 4, !tbaa !9
  store i32 55075, ptr %9, align 4, !tbaa !9
  %110 = load i32, ptr %9, align 4, !tbaa !9
  %111 = load i32, ptr %8, align 4, !tbaa !9
  %112 = add i32 %111, %110
  store i32 %112, ptr %8, align 4, !tbaa !9
  store i32 203, ptr %9, align 4, !tbaa !9
  %113 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %113, ptr %10, align 4, !tbaa !9
  store i32 45996, ptr %11, align 4, !tbaa !9
  %114 = load i32, ptr %11, align 4, !tbaa !9
  %115 = load i32, ptr %10, align 4, !tbaa !9
  %116 = add i32 %115, %114
  store i32 %116, ptr %10, align 4, !tbaa !9
  %117 = load ptr, ptr %3, align 8, !tbaa !5
  %118 = load i32, ptr %7, align 4, !tbaa !9
  %119 = load i32, ptr %8, align 4, !tbaa !9
  %120 = load i32, ptr %9, align 4, !tbaa !9
  %121 = load i32, ptr %10, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %117, i32 noundef %118, i32 noundef %119, i32 noundef %120, i32 noundef %121)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

122:                                              ; preds = %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  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 = { 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 = { nounwind }
attributes #6 = { 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}


; 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: noreturn
declare void @wasm_rt_trap(i32 noundef) local_unnamed_addr #1

declare void @w2c_hermes_0x5F_assert_fail(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_llvh0x3A0x3AFoldingSetIteratorImpl0x3A0x3Aadvance0x280x29(ptr noundef %0, i32 noundef %1) local_unnamed_addr #3 {
  %3 = getelementptr inbounds i8, ptr %0, i64 40
  %4 = zext i32 %1 to i64
  %5 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %4)
  %6 = zext i32 %5 to i64
  %7 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %6)
  %8 = and i32 %7, 1
  %.not = icmp ne i32 %8, 0
  %.not6061 = icmp eq i32 %7, 0
  %.not60 = or i1 %.not6061, %.not
  br i1 %.not60, label %9, label %.loopexit

9:                                                ; preds = %2
  br i1 %.not, label %10, label %18

10:                                               ; preds = %9
  %11 = and i32 %7, -2
  br label %.backedge

.backedge:                                        ; preds = %.backedge.backedge, %10
  %.0 = phi i32 [ %11, %10 ], [ %15, %.backedge.backedge ]
  %12 = zext i32 %.0 to i64
  %13 = add nuw nsw i64 %12, 4
  %14 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %13)
  %15 = add i32 %.0, 4
  switch i32 %14, label %16 [
    i32 -1, label %.loopexit
    i32 0, label %.backedge.backedge
  ]

.backedge.backedge:                               ; preds = %.backedge, %16
  br label %.backedge

16:                                               ; preds = %.backedge
  %17 = and i32 %14, 1
  %.not63 = icmp eq i32 %17, 0
  br i1 %.not63, label %.loopexit, label %.backedge.backedge

.loopexit:                                        ; preds = %16, %.backedge, %2
  %.059 = phi i32 [ %7, %2 ], [ %14, %.backedge ], [ %14, %16 ]
  tail call void @i32_store(ptr noundef nonnull %3, i64 noundef %4, i32 noundef %.059)
  ret void

18:                                               ; preds = %9
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 146932, i32 noundef 55075, i32 noundef 203, i32 noundef 45996) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable
}

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 = { 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 #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 }
attributes #5 = { noreturn 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: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass