; LLVM IR from facebook/hermes :: API/hermes_sandbox/external (hermes_sandbox_impl_compiled_3)

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare void @w2c_hermes_0x5F_assert_fail(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: noreturn
declare void @wasm_rt_trap(i32 noundef) #2

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #4

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AIdentifierTable0x3A0x3AgetStringPrim0x28hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3ASymbolID0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #5 {
  %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
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = 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) #6
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %16 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %16, ptr %11, align 4, !tbaa !9
  store i32 268435455, ptr %12, align 4, !tbaa !9
  %17 = load i32, ptr %12, align 4, !tbaa !9
  %18 = load i32, ptr %11, align 4, !tbaa !9
  %19 = and i32 %18, %17
  store i32 %19, ptr %11, align 4, !tbaa !9
  %20 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %20, ptr %10, align 4, !tbaa !9
  %21 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %21, ptr %12, align 4, !tbaa !9
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.w2c_hermes, ptr %22, i32 0, i32 6
  %24 = load i32, ptr %12, align 4, !tbaa !9
  %25 = zext i32 %24 to i64
  %26 = add i64 %25, 4
  %27 = call i32 @i32_load(ptr noundef %23, i64 noundef %26)
  store i32 %27, ptr %12, align 4, !tbaa !9
  %28 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %28, ptr %13, align 4, !tbaa !9
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.w2c_hermes, ptr %29, i32 0, i32 6
  %31 = load i32, ptr %13, align 4, !tbaa !9
  %32 = zext i32 %31 to i64
  %33 = call i32 @i32_load(ptr noundef %30, i64 noundef %32)
  store i32 %33, ptr %13, align 4, !tbaa !9
  %34 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %34, ptr %9, align 4, !tbaa !9
  %35 = load i32, ptr %13, align 4, !tbaa !9
  %36 = load i32, ptr %12, align 4, !tbaa !9
  %37 = sub i32 %36, %35
  store i32 %37, ptr %12, align 4, !tbaa !9
  store i32 12, ptr %13, align 4, !tbaa !9
  %38 = load i32, ptr %13, align 4, !tbaa !9
  %39 = icmp eq i32 %38, 0
  %40 = xor i1 %39, true
  %41 = xor i1 %40, true
  %42 = zext i1 %41 to i32
  %43 = sext i32 %42 to i64
  %44 = call i64 @llvm.expect.i64(i64 %43, i64 0)
  %45 = icmp ne i64 %44, 0
  br i1 %45, label %46, label %48

46:                                               ; preds = %4
  call void @wasm_rt_trap(i32 noundef 3) #7
  unreachable

47:                                               ; No predecessors!
  br label %70

48:                                               ; preds = %4
  %49 = load i32, ptr %12, align 4, !tbaa !9
  %50 = icmp eq i32 %49, -2147483648
  br i1 %50, label %51, label %54

51:                                               ; preds = %48
  %52 = load i32, ptr %13, align 4, !tbaa !9
  %53 = icmp eq i32 %52, -1
  br label %54

54:                                               ; preds = %51, %48
  %55 = phi i1 [ false, %48 ], [ %53, %51 ]
  %56 = xor i1 %55, true
  %57 = xor i1 %56, true
  %58 = zext i1 %57 to i32
  %59 = sext i32 %58 to i64
  %60 = call i64 @llvm.expect.i64(i64 %59, i64 0)
  %61 = icmp ne i64 %60, 0
  br i1 %61, label %62, label %64

62:                                               ; preds = %54
  call void @wasm_rt_trap(i32 noundef 2) #7
  unreachable

63:                                               ; No predecessors!
  br label %68

64:                                               ; preds = %54
  %65 = load i32, ptr %12, align 4, !tbaa !9
  %66 = load i32, ptr %13, align 4, !tbaa !9
  %67 = sdiv i32 %65, %66
  br label %68

68:                                               ; preds = %64, %63
  %69 = phi i32 [ 0, %63 ], [ %67, %64 ]
  br label %70

70:                                               ; preds = %68, %47
  %71 = phi i32 [ 0, %47 ], [ %69, %68 ]
  store i32 %71, ptr %12, align 4, !tbaa !9
  %72 = load i32, ptr %11, align 4, !tbaa !9
  %73 = load i32, ptr %12, align 4, !tbaa !9
  %74 = icmp ult i32 %72, %73
  %75 = zext i1 %74 to i32
  store i32 %75, ptr %11, align 4, !tbaa !9
  %76 = load i32, ptr %11, align 4, !tbaa !9
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %124

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

96:                                               ; preds = %78
  %97 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %97, ptr %11, align 4, !tbaa !9
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.w2c_hermes, ptr %98, i32 0, i32 6
  %100 = load i32, ptr %11, align 4, !tbaa !9
  %101 = zext i32 %100 to i64
  %102 = add i64 %101, 4
  %103 = call i32 @i32_load(ptr noundef %99, i64 noundef %102)
  store i32 %103, ptr %11, align 4, !tbaa !9
  store i32 -9, ptr %12, align 4, !tbaa !9
  %104 = load i32, ptr %11, align 4, !tbaa !9
  %105 = load i32, ptr %12, align 4, !tbaa !9
  %106 = icmp ugt i32 %104, %105
  %107 = zext i1 %106 to i32
  store i32 %107, ptr %11, align 4, !tbaa !9
  %108 = load i32, ptr %11, align 4, !tbaa !9
  %109 = icmp ne i32 %108, 0
  br i1 %109, label %110, label %111

110:                                              ; preds = %96
  br label %122

111:                                              ; preds = %96
  br label %112

112:                                              ; preds = %111, %78
  %113 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %113, ptr %11, align 4, !tbaa !9
  %114 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %114, ptr %12, align 4, !tbaa !9
  %115 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %115, ptr %13, align 4, !tbaa !9
  %116 = load ptr, ptr %5, align 8, !tbaa !5
  %117 = load i32, ptr %11, align 4, !tbaa !9
  %118 = load i32, ptr %12, align 4, !tbaa !9
  %119 = load i32, ptr %13, align 4, !tbaa !9
  %120 = call i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AIdentifierTable0x3A0x3AmaterializeLazyIdentifier0x28hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3ASymbolID0x29(ptr noundef %116, i32 noundef %117, i32 noundef %118, i32 noundef %119)
  store i32 %120, ptr %11, align 4, !tbaa !9
  %121 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %121, ptr %9, align 4, !tbaa !9
  br label %122

122:                                              ; preds = %112, %110
  %123 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %123, ptr %11, align 4, !tbaa !9
  br label %142

124:                                              ; preds = %70
  store i32 0, ptr %11, align 4, !tbaa !9
  %125 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %125, ptr %6, align 4, !tbaa !9
  store i32 174646, ptr %12, align 4, !tbaa !9
  %126 = load i32, ptr %12, align 4, !tbaa !9
  %127 = load i32, ptr %11, align 4, !tbaa !9
  %128 = add i32 %127, %126
  store i32 %128, ptr %11, align 4, !tbaa !9
  %129 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %129, ptr %12, align 4, !tbaa !9
  store i32 84702, ptr %13, align 4, !tbaa !9
  %130 = load i32, ptr %13, align 4, !tbaa !9
  %131 = load i32, ptr %12, align 4, !tbaa !9
  %132 = add i32 %131, %130
  store i32 %132, ptr %12, align 4, !tbaa !9
  store i32 417, ptr %13, align 4, !tbaa !9
  %133 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %133, ptr %14, align 4, !tbaa !9
  store i32 17576, ptr %15, align 4, !tbaa !9
  %134 = load i32, ptr %15, align 4, !tbaa !9
  %135 = load i32, ptr %14, align 4, !tbaa !9
  %136 = add i32 %135, %134
  store i32 %136, ptr %14, align 4, !tbaa !9
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = load i32, ptr %11, align 4, !tbaa !9
  %139 = load i32, ptr %12, align 4, !tbaa !9
  %140 = load i32, ptr %13, align 4, !tbaa !9
  %141 = load i32, ptr %14, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %137, i32 noundef %138, i32 noundef %139, i32 noundef %140, i32 noundef %141)
  call void @wasm_rt_trap(i32 noundef 5) #7
  unreachable

142:                                              ; preds = %122
  %143 = load i32, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  ret i32 %143
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 #4 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #5 = { 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 #6 = { nounwind }
attributes #7 = { 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"

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

; Function Attrs: noreturn
declare void @wasm_rt_trap(i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AIdentifierTable0x3A0x3AgetStringPrim0x28hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3ASymbolID0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #3 {
  %5 = and i32 %3, 268435455
  %6 = getelementptr inbounds i8, ptr %0, i64 40
  %7 = zext i32 %1 to i64
  %8 = add nuw nsw i64 %7, 4
  %9 = tail call i32 @i32_load(ptr noundef nonnull %6, i64 noundef %8)
  %10 = tail call i32 @i32_load(ptr noundef nonnull %6, i64 noundef %7)
  %11 = sub i32 %9, %10
  %12 = sdiv i32 %11, 12
  %13 = icmp ult i32 %5, %12
  br i1 %13, label %14, label %26

14:                                               ; preds = %4
  %15 = mul nuw i32 %5, 12
  %16 = add i32 %10, %15
  %17 = zext i32 %16 to i64
  %18 = tail call i32 @i32_load(ptr noundef nonnull %6, i64 noundef %17)
  %.not = icmp eq i32 %18, 0
  br i1 %.not, label %23, label %19

19:                                               ; preds = %14
  %20 = add nuw nsw i64 %17, 4
  %21 = tail call i32 @i32_load(ptr noundef nonnull %6, i64 noundef %20)
  %22 = icmp ugt i32 %21, -9
  br i1 %22, label %25, label %23

23:                                               ; preds = %19, %14
  %24 = tail call i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AIdentifierTable0x3A0x3AmaterializeLazyIdentifier0x28hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3ASymbolID0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3)
  br label %25

25:                                               ; preds = %19, %23
  %.0 = phi i32 [ %18, %19 ], [ %24, %23 ]
  ret i32 %.0

26:                                               ; preds = %4
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 174646, i32 noundef 84702, i32 noundef 417, i32 noundef 17576) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable
}

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

attributes #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 = { 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 = { 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,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass,TailCallElimPass