; LLVM IR from facebook/hermes :: API/hermes_sandbox/external (hermes_sandbox_impl_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: noreturn
declare void @wasm_rt_trap(i32 noundef) #1

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

; 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_hermes0x3A0x3ATerminatorInst0x3A0x3AgetNumSuccessors0x280x290x20const(ptr noundef %0, i32 noundef %1) #3 {
  %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
  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
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %6, align 4, !tbaa !9
  %9 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %9, ptr %5, align 4, !tbaa !9
  %10 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %10, ptr %6, align 4, !tbaa !9
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.w2c_hermes, ptr %11, i32 0, i32 6
  %13 = load i32, ptr %6, align 4, !tbaa !9
  %14 = zext i32 %13 to i64
  %15 = add i64 %14, 8
  %16 = call i32 @i32_load8_u(ptr noundef %12, i64 noundef %15)
  store i32 %16, ptr %6, align 4, !tbaa !9
  store i32 77, ptr %7, align 4, !tbaa !9
  %17 = load i32, ptr %7, align 4, !tbaa !9
  %18 = load i32, ptr %6, align 4, !tbaa !9
  %19 = sub i32 %18, %17
  store i32 %19, ptr %6, align 4, !tbaa !9
  %20 = load i32, ptr %6, align 4, !tbaa !9
  switch i32 %20, label %33 [
    i32 0, label %21
    i32 1, label %22
    i32 2, label %23
    i32 3, label %24
    i32 4, label %25
    i32 5, label %26
    i32 6, label %27
    i32 7, label %28
    i32 8, label %29
    i32 9, label %30
    i32 10, label %31
    i32 11, label %32
  ]

21:                                               ; preds = %2
  br label %80

22:                                               ; preds = %2
  br label %77

23:                                               ; preds = %2
  br label %77

24:                                               ; preds = %2
  br label %34

25:                                               ; preds = %2
  br label %78

26:                                               ; preds = %2
  br label %78

27:                                               ; preds = %2
  br label %78

28:                                               ; preds = %2
  br label %78

29:                                               ; preds = %2
  br label %78

30:                                               ; preds = %2
  br label %78

31:                                               ; preds = %2
  br label %49

32:                                               ; preds = %2
  br label %80

33:                                               ; preds = %2
  br label %64

34:                                               ; preds = %24
  %35 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %35, ptr %6, align 4, !tbaa !9
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = call i32 @w2c_hermes_hermes0x3A0x3AInstruction0x3A0x3AgetNumOperands0x280x290x20const(ptr noundef %36, i32 noundef %37)
  store i32 %38, ptr %6, align 4, !tbaa !9
  store i32 2, ptr %7, align 4, !tbaa !9
  %39 = load i32, ptr %7, align 4, !tbaa !9
  %40 = load i32, ptr %6, align 4, !tbaa !9
  %41 = sub i32 %40, %39
  store i32 %41, ptr %6, align 4, !tbaa !9
  store i32 1, ptr %7, align 4, !tbaa !9
  %42 = load i32, ptr %7, align 4, !tbaa !9
  %43 = and i32 %42, 31
  %44 = load i32, ptr %6, align 4, !tbaa !9
  %45 = lshr i32 %44, %43
  store i32 %45, ptr %6, align 4, !tbaa !9
  store i32 1, ptr %7, align 4, !tbaa !9
  %46 = load i32, ptr %7, align 4, !tbaa !9
  %47 = load i32, ptr %6, align 4, !tbaa !9
  %48 = add i32 %47, %46
  store i32 %48, ptr %6, align 4, !tbaa !9
  br label %82

49:                                               ; preds = %31
  %50 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %50, ptr %6, align 4, !tbaa !9
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = load i32, ptr %6, align 4, !tbaa !9
  %53 = call i32 @w2c_hermes_hermes0x3A0x3AInstruction0x3A0x3AgetNumOperands0x280x290x20const(ptr noundef %51, i32 noundef %52)
  store i32 %53, ptr %6, align 4, !tbaa !9
  store i32 4, ptr %7, align 4, !tbaa !9
  %54 = load i32, ptr %7, align 4, !tbaa !9
  %55 = load i32, ptr %6, align 4, !tbaa !9
  %56 = sub i32 %55, %54
  store i32 %56, ptr %6, align 4, !tbaa !9
  store i32 1, ptr %7, align 4, !tbaa !9
  %57 = load i32, ptr %7, align 4, !tbaa !9
  %58 = and i32 %57, 31
  %59 = load i32, ptr %6, align 4, !tbaa !9
  %60 = lshr i32 %59, %58
  store i32 %60, ptr %6, align 4, !tbaa !9
  store i32 1, ptr %7, align 4, !tbaa !9
  %61 = load i32, ptr %7, align 4, !tbaa !9
  %62 = load i32, ptr %6, align 4, !tbaa !9
  %63 = add i32 %62, %61
  store i32 %63, ptr %6, align 4, !tbaa !9
  br label %82

64:                                               ; preds = %33
  store i32 0, ptr %6, align 4, !tbaa !9
  %65 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %65, ptr %4, align 4, !tbaa !9
  store i32 208202, ptr %7, align 4, !tbaa !9
  %66 = load i32, ptr %7, align 4, !tbaa !9
  %67 = load i32, ptr %6, align 4, !tbaa !9
  %68 = add i32 %67, %66
  store i32 %68, ptr %6, align 4, !tbaa !9
  %69 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %69, ptr %7, align 4, !tbaa !9
  store i32 55652, ptr %8, align 4, !tbaa !9
  %70 = load i32, ptr %8, align 4, !tbaa !9
  %71 = load i32, ptr %7, align 4, !tbaa !9
  %72 = add i32 %71, %70
  store i32 %72, ptr %7, align 4, !tbaa !9
  store i32 29, ptr %8, align 4, !tbaa !9
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = load i32, ptr %6, align 4, !tbaa !9
  %75 = load i32, ptr %7, align 4, !tbaa !9
  %76 = load i32, ptr %8, align 4, !tbaa !9
  call void @w2c_hermes_llvh0x3A0x3Allvm_unreachable_internal0x28char0x20const0x2A0x2C0x20char0x20const0x2A0x2C0x20unsigned0x20int0x29(ptr noundef %73, i32 noundef %74, i32 noundef %75, i32 noundef %76)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

77:                                               ; preds = %23, %22
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %82

78:                                               ; preds = %30, %29, %28, %27, %26, %25
  store i32 2, ptr %6, align 4, !tbaa !9
  %79 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %79, ptr %5, align 4, !tbaa !9
  br label %80

80:                                               ; preds = %78, %32, %21
  %81 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %81, ptr %6, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %80, %77, %49, %34
  %83 = load i32, ptr %6, align 4, !tbaa !9
  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 i32 %83
}

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

declare void @w2c_hermes_llvh0x3A0x3Allvm_unreachable_internal0x28char0x20const0x2A0x2C0x20char0x20const0x2A0x2C0x20unsigned0x20int0x29(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = { "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: noreturn
declare void @wasm_rt_trap(i32 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, -2147483647) i32 @w2c_hermes_hermes0x3A0x3ATerminatorInst0x3A0x3AgetNumSuccessors0x280x290x20const(ptr noundef %0, i32 noundef %1) local_unnamed_addr #2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 40
  %4 = zext i32 %1 to i64
  %5 = add nuw nsw i64 %4, 8
  %6 = tail call i32 @i32_load8_u(ptr noundef nonnull %3, i64 noundef %5)
  switch i32 %6, label %17 [
    i32 77, label %19
    i32 78, label %20
    i32 79, label %20
    i32 80, label %7
    i32 81, label %18
    i32 82, label %18
    i32 83, label %18
    i32 84, label %18
    i32 85, label %18
    i32 86, label %18
    i32 87, label %12
    i32 88, label %19
  ]

7:                                                ; preds = %2
  %8 = tail call i32 @w2c_hermes_hermes0x3A0x3AInstruction0x3A0x3AgetNumOperands0x280x290x20const(ptr noundef %0, i32 noundef %1)
  %9 = add i32 %8, -2
  %10 = lshr i32 %9, 1
  %11 = add nuw i32 %10, 1
  br label %20

12:                                               ; preds = %2
  %13 = tail call i32 @w2c_hermes_hermes0x3A0x3AInstruction0x3A0x3AgetNumOperands0x280x290x20const(ptr noundef %0, i32 noundef %1)
  %14 = add i32 %13, -4
  %15 = lshr i32 %14, 1
  %16 = add nuw i32 %15, 1
  br label %20

17:                                               ; preds = %2
  tail call void @w2c_hermes_llvh0x3A0x3Allvm_unreachable_internal0x28char0x20const0x2A0x2C0x20char0x20const0x2A0x2C0x20unsigned0x20int0x29(ptr noundef %0, i32 noundef 208202, i32 noundef 55652, i32 noundef 29) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable

18:                                               ; preds = %2, %2, %2, %2, %2, %2
  br label %20

19:                                               ; preds = %2, %2
  br label %20

20:                                               ; preds = %18, %2, %2, %19, %12, %7
  %.0 = phi i32 [ %16, %12 ], [ %11, %7 ], [ 0, %2 ], [ 0, %2 ], [ 2, %18 ], [ 1, %19 ]
  ret i32 %.0
}

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

declare void @w2c_hermes_llvh0x3A0x3Allvm_unreachable_internal0x28char0x20const0x2A0x2C0x20char0x20const0x2A0x2C0x20unsigned0x20int0x29(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

attributes #0 = { 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 #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 = { "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: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass