; 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: 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) #1

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

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

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

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

30:                                               ; preds = %5
  %31 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %31, ptr %16, align 4, !tbaa !9
  %32 = load i32, ptr %16, align 4, !tbaa !9
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %34, label %125

34:                                               ; preds = %30
  br label %35

35:                                               ; preds = %123, %34
  %36 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %36, ptr %16, align 4, !tbaa !9
  %37 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %37, ptr %17, align 4, !tbaa !9
  store i32 3, ptr %18, align 4, !tbaa !9
  %38 = load i32, ptr %18, align 4, !tbaa !9
  %39 = and i32 %38, 31
  %40 = load i32, ptr %17, align 4, !tbaa !9
  %41 = shl i32 %40, %39
  store i32 %41, ptr %17, align 4, !tbaa !9
  %42 = load i32, ptr %17, align 4, !tbaa !9
  store i32 %42, ptr %12, align 4, !tbaa !9
  %43 = load i32, ptr %17, align 4, !tbaa !9
  %44 = load i32, ptr %16, align 4, !tbaa !9
  %45 = add i32 %44, %43
  store i32 %45, ptr %16, align 4, !tbaa !9
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.w2c_hermes, ptr %46, i32 0, i32 6
  %48 = load i32, ptr %16, align 4, !tbaa !9
  %49 = zext i32 %48 to i64
  %50 = call i64 @i64_load(ptr noundef %47, i64 noundef %49)
  store i64 %50, ptr %21, align 8, !tbaa !11
  %51 = load i64, ptr %21, align 8, !tbaa !11
  store i64 %51, ptr %14, align 8, !tbaa !11
  %52 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %52, ptr %16, align 4, !tbaa !9
  %53 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %53, ptr %17, align 4, !tbaa !9
  %54 = load i32, ptr %17, align 4, !tbaa !9
  %55 = load i32, ptr %16, align 4, !tbaa !9
  %56 = add i32 %55, %54
  store i32 %56, ptr %16, align 4, !tbaa !9
  %57 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %57, ptr %12, 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 %16, align 4, !tbaa !9
  %61 = zext i32 %60 to i64
  %62 = call i64 @i64_load(ptr noundef %59, i64 noundef %61)
  store i64 %62, ptr %21, align 8, !tbaa !11
  %63 = load i64, ptr %21, align 8, !tbaa !11
  store i64 %63, ptr %15, align 8, !tbaa !11
  %64 = load i64, ptr %9, align 8, !tbaa !11
  store i64 %64, ptr %21, align 8, !tbaa !11
  store i64 0, ptr %22, align 8, !tbaa !11
  %65 = load i64, ptr %21, align 8, !tbaa !11
  %66 = load i64, ptr %22, align 8, !tbaa !11
  %67 = icmp ne i64 %65, %66
  %68 = zext i1 %67 to i32
  store i32 %68, ptr %16, align 4, !tbaa !9
  %69 = load i32, ptr %16, align 4, !tbaa !9
  %70 = icmp ne i32 %69, 0
  br i1 %70, label %71, label %86

71:                                               ; preds = %35
  %72 = load i64, ptr %14, align 8, !tbaa !11
  store i64 %72, ptr %21, align 8, !tbaa !11
  %73 = load i64, ptr %15, align 8, !tbaa !11
  store i64 %73, ptr %22, align 8, !tbaa !11
  %74 = load i64, ptr %22, align 8, !tbaa !11
  %75 = load i64, ptr %21, align 8, !tbaa !11
  %76 = add i64 %75, %74
  store i64 %76, ptr %21, align 8, !tbaa !11
  store i64 1, ptr %22, align 8, !tbaa !11
  %77 = load i64, ptr %22, align 8, !tbaa !11
  %78 = load i64, ptr %21, align 8, !tbaa !11
  %79 = add i64 %78, %77
  store i64 %79, ptr %21, align 8, !tbaa !11
  %80 = load i64, ptr %21, align 8, !tbaa !11
  store i64 %80, ptr %9, align 8, !tbaa !11
  %81 = load i64, ptr %15, align 8, !tbaa !11
  store i64 %81, ptr %22, align 8, !tbaa !11
  %82 = load i64, ptr %21, align 8, !tbaa !11
  %83 = load i64, ptr %22, align 8, !tbaa !11
  %84 = icmp ule i64 %82, %83
  %85 = zext i1 %84 to i32
  store i32 %85, ptr %16, align 4, !tbaa !9
  br label %98

86:                                               ; preds = %35
  %87 = load i64, ptr %14, align 8, !tbaa !11
  store i64 %87, ptr %21, align 8, !tbaa !11
  %88 = load i64, ptr %15, align 8, !tbaa !11
  store i64 %88, ptr %22, align 8, !tbaa !11
  %89 = load i64, ptr %22, align 8, !tbaa !11
  %90 = load i64, ptr %21, align 8, !tbaa !11
  %91 = add i64 %90, %89
  store i64 %91, ptr %21, align 8, !tbaa !11
  %92 = load i64, ptr %21, align 8, !tbaa !11
  store i64 %92, ptr %9, align 8, !tbaa !11
  %93 = load i64, ptr %14, align 8, !tbaa !11
  store i64 %93, ptr %22, align 8, !tbaa !11
  %94 = load i64, ptr %21, align 8, !tbaa !11
  %95 = load i64, ptr %22, align 8, !tbaa !11
  %96 = icmp ult i64 %94, %95
  %97 = zext i1 %96 to i32
  store i32 %97, ptr %16, align 4, !tbaa !9
  br label %98

98:                                               ; preds = %86, %71
  %99 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %99, ptr %13, align 4, !tbaa !9
  %100 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %100, ptr %16, align 4, !tbaa !9
  %101 = load i64, ptr %9, align 8, !tbaa !11
  store i64 %101, ptr %22, align 8, !tbaa !11
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.w2c_hermes, ptr %102, i32 0, i32 6
  %104 = load i32, ptr %16, align 4, !tbaa !9
  %105 = zext i32 %104 to i64
  %106 = load i64, ptr %22, align 8, !tbaa !11
  call void @i64_store(ptr noundef %103, i64 noundef %105, i64 noundef %106)
  %107 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %107, ptr %16, align 4, !tbaa !9
  %108 = load i32, ptr %16, align 4, !tbaa !9
  %109 = zext i32 %108 to i64
  store i64 %109, ptr %21, align 8, !tbaa !11
  %110 = load i64, ptr %21, align 8, !tbaa !11
  store i64 %110, ptr %9, align 8, !tbaa !11
  %111 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %111, ptr %16, align 4, !tbaa !9
  store i32 1, ptr %17, align 4, !tbaa !9
  %112 = load i32, ptr %17, align 4, !tbaa !9
  %113 = load i32, ptr %16, align 4, !tbaa !9
  %114 = add i32 %113, %112
  store i32 %114, ptr %16, align 4, !tbaa !9
  %115 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %115, ptr %11, align 4, !tbaa !9
  %116 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %116, ptr %17, align 4, !tbaa !9
  %117 = load i32, ptr %16, align 4, !tbaa !9
  %118 = load i32, ptr %17, align 4, !tbaa !9
  %119 = icmp ne i32 %117, %118
  %120 = zext i1 %119 to i32
  store i32 %120, ptr %16, align 4, !tbaa !9
  %121 = load i32, ptr %16, align 4, !tbaa !9
  %122 = icmp ne i32 %121, 0
  br i1 %122, label %123, label %124

123:                                              ; preds = %98
  br label %35

124:                                              ; preds = %98
  br label %125

125:                                              ; preds = %124, %30
  %126 = load i64, ptr %9, align 8, !tbaa !11
  store i64 %126, ptr %21, align 8, !tbaa !11
  br label %144

127:                                              ; preds = %5
  store i32 0, ptr %16, align 4, !tbaa !9
  store i32 111287, ptr %17, align 4, !tbaa !9
  %128 = load i32, ptr %17, align 4, !tbaa !9
  %129 = load i32, ptr %16, align 4, !tbaa !9
  %130 = add i32 %129, %128
  store i32 %130, ptr %16, align 4, !tbaa !9
  %131 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %131, ptr %17, align 4, !tbaa !9
  store i32 54858, ptr %18, align 4, !tbaa !9
  %132 = load i32, ptr %18, align 4, !tbaa !9
  %133 = load i32, ptr %17, align 4, !tbaa !9
  %134 = add i32 %133, %132
  store i32 %134, ptr %17, align 4, !tbaa !9
  store i32 2288, ptr %18, align 4, !tbaa !9
  %135 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %135, ptr %19, align 4, !tbaa !9
  store i32 106738, ptr %20, align 4, !tbaa !9
  %136 = load i32, ptr %20, align 4, !tbaa !9
  %137 = load i32, ptr %19, align 4, !tbaa !9
  %138 = add i32 %137, %136
  store i32 %138, ptr %19, align 4, !tbaa !9
  %139 = load ptr, ptr %6, align 8, !tbaa !5
  %140 = load i32, ptr %16, align 4, !tbaa !9
  %141 = load i32, ptr %17, align 4, !tbaa !9
  %142 = load i32, ptr %18, align 4, !tbaa !9
  %143 = load i32, ptr %19, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %139, i32 noundef %140, i32 noundef %141, i32 noundef %142, i32 noundef %143)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

144:                                              ; preds = %125
  %145 = load i64, ptr %21, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  ret i64 %145
}

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 = { "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 = { 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}
!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: noreturn
declare void @wasm_rt_trap(i32 noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i64 0, 2) i64 @w2c_hermes_llvh0x3A0x3AAPInt0x3A0x3AtcAdd0x28unsigned0x20long0x20long0x2A0x2C0x20unsigned0x20long0x20long0x20const0x2A0x2C0x20unsigned0x20long0x20long0x2C0x20unsigned0x20int0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2, i64 noundef %3, i32 noundef %4) local_unnamed_addr #3 {
  %6 = icmp ult i64 %3, 2
  br i1 %6, label %7, label %24

7:                                                ; preds = %5
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %7
  %8 = getelementptr inbounds i8, ptr %0, i64 40
  %9 = zext i32 %4 to i64
  br label %10

10:                                               ; preds = %.preheader, %10
  %indvars.iv = phi i64 [ 0, %.preheader ], [ %indvars.iv.next, %10 ]
  %.0 = phi i64 [ %3, %.preheader ], [ %23, %10 ]
  %11 = trunc nuw i64 %indvars.iv to i32
  %12 = shl i32 %11, 3
  %13 = add i32 %12, %2
  %14 = zext i32 %13 to i64
  %15 = tail call i64 @i64_load(ptr noundef nonnull %8, i64 noundef %14)
  %16 = add i32 %12, %1
  %17 = zext i32 %16 to i64
  %18 = tail call i64 @i64_load(ptr noundef nonnull %8, i64 noundef %17)
  %.not81 = icmp eq i64 %.0, 0
  %19 = add i64 %18, %15
  %20 = add i64 %19, 1
  %21 = icmp ule i64 %20, %18
  %22 = icmp ult i64 %19, %15
  %.078.in = select i1 %.not81, i1 %22, i1 %21
  %.1 = select i1 %.not81, i64 %19, i64 %20
  tail call void @i64_store(ptr noundef nonnull %8, i64 noundef %17, i64 noundef %.1)
  %23 = zext i1 %.078.in to i64
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %.not82 = icmp eq i64 %indvars.iv.next, %9
  br i1 %.not82, label %.loopexit, label %10

.loopexit:                                        ; preds = %10, %7
  %.2 = phi i64 [ %3, %7 ], [ %23, %10 ]
  ret i64 %.2

24:                                               ; preds = %5
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 111287, i32 noundef 54858, i32 noundef 2288, i32 noundef 106738) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable
}

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 = { "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,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass