; LLVM IR from facebook/hermes :: API/hermes_sandbox/external (hermes_sandbox_impl_opt_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: inlinehint nounwind uwtable
declare hidden void @i64_store(ptr noundef, i64 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 i64 @i64_load(ptr noundef, i64 noundef) #1

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

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

33:                                               ; preds = %5
  store i64 -1688849860263936, ptr %15, align 8, !tbaa !11
  %34 = load i64, ptr %15, align 8, !tbaa !11
  store i64 %34, ptr %12, align 8, !tbaa !11
  br label %71

35:                                               ; preds = %5
  %36 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %36, ptr %13, align 4, !tbaa !9
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.w2c_hermes, ptr %37, i32 0, i32 6
  %39 = load i32, ptr %13, align 4, !tbaa !9
  %40 = zext i32 %39 to i64
  %41 = call i32 @i32_load(ptr noundef %38, i64 noundef %40)
  store i32 %41, ptr %13, align 4, !tbaa !9
  %42 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %42, ptr %9, align 4, !tbaa !9
  store i32 8, ptr %14, align 4, !tbaa !9
  %43 = load i32, ptr %14, align 4, !tbaa !9
  %44 = load i32, ptr %13, align 4, !tbaa !9
  %45 = sub i32 %44, %43
  store i32 %45, ptr %13, 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 %13, 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 %15, align 8, !tbaa !11
  %51 = load i64, ptr %15, align 8, !tbaa !11
  store i64 %51, ptr %12, align 8, !tbaa !11
  %52 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %52, ptr %13, align 4, !tbaa !9
  store i32 1, ptr %14, align 4, !tbaa !9
  %53 = load i32, ptr %13, align 4, !tbaa !9
  %54 = load i32, ptr %14, align 4, !tbaa !9
  %55 = icmp eq i32 %53, %54
  %56 = zext i1 %55 to i32
  store i32 %56, ptr %13, align 4, !tbaa !9
  %57 = load i32, ptr %13, align 4, !tbaa !9
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %59, label %60

59:                                               ; preds = %35
  br label %71

60:                                               ; preds = %35
  %61 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %61, ptr %13, align 4, !tbaa !9
  store i32 16, ptr %14, align 4, !tbaa !9
  %62 = load i32, ptr %14, align 4, !tbaa !9
  %63 = load i32, ptr %13, align 4, !tbaa !9
  %64 = sub i32 %63, %62
  store i32 %64, ptr %13, align 4, !tbaa !9
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.w2c_hermes, ptr %65, i32 0, i32 6
  %67 = load i32, ptr %13, align 4, !tbaa !9
  %68 = zext i32 %67 to i64
  %69 = call i64 @i64_load(ptr noundef %66, i64 noundef %68)
  store i64 %69, ptr %15, align 8, !tbaa !11
  %70 = load i64, ptr %15, align 8, !tbaa !11
  store i64 %70, ptr %11, align 8, !tbaa !11
  br label %71

71:                                               ; preds = %60, %59, %33
  %72 = load i64, ptr %12, align 8, !tbaa !11
  store i64 %72, ptr %15, align 8, !tbaa !11
  %73 = load i64, ptr %11, align 8, !tbaa !11
  store i64 %73, ptr %16, align 8, !tbaa !11
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = load i64, ptr %15, align 8, !tbaa !11
  %76 = load i64, ptr %16, align 8, !tbaa !11
  %77 = call i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AisSameValue0x28hermes0x3A0x3Avm0x3A0x3AHermesValue0x2C0x20hermes0x3A0x3Avm0x3A0x3AHermesValue0x29(ptr noundef %74, i64 noundef %75, i64 noundef %76)
  store i32 %77, ptr %13, align 4, !tbaa !9
  %78 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %78, ptr %8, align 4, !tbaa !9
  %79 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %79, ptr %13, align 4, !tbaa !9
  store i32 1, ptr %14, align 4, !tbaa !9
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.w2c_hermes, ptr %80, i32 0, i32 6
  %82 = load i32, ptr %13, align 4, !tbaa !9
  %83 = zext i32 %82 to i64
  %84 = load i32, ptr %14, align 4, !tbaa !9
  call void @i32_store(ptr noundef %81, i64 noundef %83, i32 noundef %84)
  %85 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %85, ptr %13, align 4, !tbaa !9
  %86 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %86, ptr %14, align 4, !tbaa !9
  %87 = load i32, ptr %14, align 4, !tbaa !9
  %88 = zext i32 %87 to i64
  store i64 %88, ptr %16, align 8, !tbaa !11
  store i64 -1407374883553280, ptr %17, align 8, !tbaa !11
  %89 = load i64, ptr %17, align 8, !tbaa !11
  %90 = load i64, ptr %16, align 8, !tbaa !11
  %91 = or i64 %90, %89
  store i64 %91, ptr %16, align 8, !tbaa !11
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.w2c_hermes, ptr %92, i32 0, i32 6
  %94 = load i32, ptr %13, align 4, !tbaa !9
  %95 = zext i32 %94 to i64
  %96 = add i64 %95, 8
  %97 = load i64, ptr %16, align 8, !tbaa !11
  call void @i64_store(ptr noundef %93, i64 noundef %96, i64 noundef %97)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  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 = { 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)"}
!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: 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: inlinehint nounwind uwtable
declare hidden void @i64_store(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AisSameValue0x28hermes0x3A0x3Avm0x3A0x3AHermesValue0x2C0x20hermes0x3A0x3Avm0x3A0x3AHermesValue0x29(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AobjectIs0x28void0x2A0x2C0x20hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3ANativeArgs0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #1 {
  %6 = getelementptr inbounds i8, ptr %0, i64 40
  %7 = zext i32 %4 to i64
  %8 = add nuw nsw i64 %7, 4
  %9 = tail call i32 @i32_load(ptr noundef nonnull %6, i64 noundef %8)
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %20, label %10

10:                                               ; preds = %5
  %11 = tail call i32 @i32_load(ptr noundef nonnull %6, i64 noundef %7)
  %12 = add i32 %11, -8
  %13 = zext i32 %12 to i64
  %14 = tail call i64 @i64_load(ptr noundef nonnull %6, i64 noundef %13)
  %15 = icmp eq i32 %9, 1
  br i1 %15, label %20, label %16

16:                                               ; preds = %10
  %17 = add i32 %11, -16
  %18 = zext i32 %17 to i64
  %19 = tail call i64 @i64_load(ptr noundef nonnull %6, i64 noundef %18)
  br label %20

20:                                               ; preds = %5, %10, %16
  %.044 = phi i64 [ -1688849860263936, %10 ], [ %19, %16 ], [ -1688849860263936, %5 ]
  %.0 = phi i64 [ %14, %10 ], [ %14, %16 ], [ -1688849860263936, %5 ]
  %21 = tail call i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AisSameValue0x28hermes0x3A0x3Avm0x3A0x3AHermesValue0x2C0x20hermes0x3A0x3Avm0x3A0x3AHermesValue0x29(ptr noundef %0, i64 noundef %.0, i64 noundef %.044)
  %22 = zext i32 %1 to i64
  tail call void @i32_store(ptr noundef nonnull %6, i64 noundef %22, i32 noundef 1)
  %23 = zext i32 %21 to i64
  %24 = or disjoint i64 %23, -1407374883553280
  %25 = add nuw nsw i64 %22, 8
  tail call void @i64_store(ptr noundef nonnull %6, i64 noundef %25, i64 noundef %24)
  ret void
}

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 = { 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" }

!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