; 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 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

declare i32 @w2c_hermes_memcmp(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_llvh0x3A0x3ADenseMapInfo0x3Cllvh0x3A0x3AStringRef0x3E0x3A0x3AisEqual0x28llvh0x3A0x3AStringRef0x2C0x20llvh0x3A0x3AStringRef0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i64 0, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store i64 0, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %16 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %16, ptr %10, align 4, !tbaa !9
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.w2c_hermes, ptr %17, i32 0, i32 6
  %19 = load i32, ptr %10, align 4, !tbaa !9
  %20 = zext i32 %19 to i64
  %21 = call i32 @i32_load(ptr noundef %18, i64 noundef %20)
  store i32 %21, ptr %10, align 4, !tbaa !9
  store i32 2, ptr %11, align 4, !tbaa !9
  %22 = load i32, ptr %11, align 4, !tbaa !9
  %23 = load i32, ptr %10, align 4, !tbaa !9
  %24 = add i32 %23, %22
  store i32 %24, ptr %10, align 4, !tbaa !9
  %25 = load i32, ptr %10, align 4, !tbaa !9
  switch i32 %25, label %28 [
    i32 0, label %26
    i32 1, label %27
  ]

26:                                               ; preds = %3
  br label %40

27:                                               ; preds = %3
  br label %29

28:                                               ; preds = %3
  br label %51

29:                                               ; preds = %27
  %30 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %30, ptr %10, align 4, !tbaa !9
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.w2c_hermes, ptr %31, i32 0, i32 6
  %33 = load i32, ptr %10, align 4, !tbaa !9
  %34 = zext i32 %33 to i64
  %35 = call i32 @i32_load(ptr noundef %32, i64 noundef %34)
  store i32 %35, ptr %10, align 4, !tbaa !9
  store i32 -1, ptr %11, align 4, !tbaa !9
  %36 = load i32, ptr %10, align 4, !tbaa !9
  %37 = load i32, ptr %11, align 4, !tbaa !9
  %38 = icmp eq i32 %36, %37
  %39 = zext i1 %38 to i32
  store i32 %39, ptr %10, align 4, !tbaa !9
  br label %114

40:                                               ; preds = %26
  %41 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %41, ptr %10, align 4, !tbaa !9
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.w2c_hermes, ptr %42, i32 0, i32 6
  %44 = load i32, ptr %10, align 4, !tbaa !9
  %45 = zext i32 %44 to i64
  %46 = call i32 @i32_load(ptr noundef %43, i64 noundef %45)
  store i32 %46, ptr %10, align 4, !tbaa !9
  store i32 -2, ptr %11, align 4, !tbaa !9
  %47 = load i32, ptr %10, align 4, !tbaa !9
  %48 = load i32, ptr %11, align 4, !tbaa !9
  %49 = icmp eq i32 %47, %48
  %50 = zext i1 %49 to i32
  store i32 %50, ptr %10, align 4, !tbaa !9
  br label %114

51:                                               ; preds = %28
  %52 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %52, ptr %10, align 4, !tbaa !9
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.w2c_hermes, ptr %53, i32 0, i32 6
  %55 = load i32, ptr %10, align 4, !tbaa !9
  %56 = zext i32 %55 to i64
  %57 = call i64 @i64_load(ptr noundef %54, i64 noundef %56)
  store i64 %57, ptr %13, align 8, !tbaa !11
  %58 = load i64, ptr %13, align 8, !tbaa !11
  store i64 %58, ptr %8, align 8, !tbaa !11
  store i64 32, ptr %14, align 8, !tbaa !11
  %59 = load i64, ptr %14, align 8, !tbaa !11
  %60 = and i64 %59, 63
  %61 = load i64, ptr %13, align 8, !tbaa !11
  %62 = lshr i64 %61, %60
  store i64 %62, ptr %13, align 8, !tbaa !11
  %63 = load i64, ptr %13, align 8, !tbaa !11
  %64 = trunc i64 %63 to i32
  store i32 %64, ptr %10, align 4, !tbaa !9
  %65 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %65, ptr %5, align 4, !tbaa !9
  %66 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %66, ptr %11, align 4, !tbaa !9
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.w2c_hermes, ptr %67, i32 0, i32 6
  %69 = load i32, ptr %11, align 4, !tbaa !9
  %70 = zext i32 %69 to i64
  %71 = call i64 @i64_load(ptr noundef %68, i64 noundef %70)
  store i64 %71, ptr %14, align 8, !tbaa !11
  %72 = load i64, ptr %14, align 8, !tbaa !11
  store i64 %72, ptr %9, align 8, !tbaa !11
  store i64 32, ptr %15, align 8, !tbaa !11
  %73 = load i64, ptr %15, align 8, !tbaa !11
  %74 = and i64 %73, 63
  %75 = load i64, ptr %14, align 8, !tbaa !11
  %76 = lshr i64 %75, %74
  store i64 %76, ptr %14, align 8, !tbaa !11
  %77 = load i64, ptr %14, align 8, !tbaa !11
  %78 = trunc i64 %77 to i32
  store i32 %78, ptr %11, align 4, !tbaa !9
  %79 = load i32, ptr %10, align 4, !tbaa !9
  %80 = load i32, ptr %11, align 4, !tbaa !9
  %81 = icmp eq i32 %79, %80
  %82 = zext i1 %81 to i32
  store i32 %82, ptr %10, align 4, !tbaa !9
  %83 = load i32, ptr %10, align 4, !tbaa !9
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %112

85:                                               ; preds = %51
  %86 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %86, ptr %10, align 4, !tbaa !9
  %87 = load i32, ptr %10, align 4, !tbaa !9
  %88 = icmp ne i32 %87, 0
  %89 = xor i1 %88, true
  %90 = zext i1 %89 to i32
  store i32 %90, ptr %10, align 4, !tbaa !9
  %91 = load i32, ptr %10, align 4, !tbaa !9
  %92 = icmp ne i32 %91, 0
  br i1 %92, label %93, label %94

93:                                               ; preds = %85
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %114

94:                                               ; preds = %85
  %95 = load i64, ptr %8, align 8, !tbaa !11
  store i64 %95, ptr %13, align 8, !tbaa !11
  %96 = load i64, ptr %13, align 8, !tbaa !11
  %97 = trunc i64 %96 to i32
  store i32 %97, ptr %10, align 4, !tbaa !9
  %98 = load i64, ptr %9, align 8, !tbaa !11
  store i64 %98, ptr %14, align 8, !tbaa !11
  %99 = load i64, ptr %14, align 8, !tbaa !11
  %100 = trunc i64 %99 to i32
  store i32 %100, ptr %11, align 4, !tbaa !9
  %101 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %101, ptr %12, align 4, !tbaa !9
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = load i32, ptr %10, align 4, !tbaa !9
  %104 = load i32, ptr %11, align 4, !tbaa !9
  %105 = load i32, ptr %12, align 4, !tbaa !9
  %106 = call i32 @w2c_hermes_memcmp(ptr noundef %102, i32 noundef %103, i32 noundef %104, i32 noundef %105)
  store i32 %106, ptr %10, align 4, !tbaa !9
  %107 = load i32, ptr %10, align 4, !tbaa !9
  %108 = icmp ne i32 %107, 0
  %109 = xor i1 %108, true
  %110 = zext i1 %109 to i32
  store i32 %110, ptr %10, align 4, !tbaa !9
  %111 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %111, ptr %7, align 4, !tbaa !9
  br label %112

112:                                              ; preds = %94, %51
  %113 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %113, ptr %10, align 4, !tbaa !9
  br label %114

114:                                              ; preds = %112, %93, %40, %29
  %115 = load i32, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret i32 %115
}

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

!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 i32 @i32_load(ptr noundef, i64 noundef) local_unnamed_addr #0

declare i32 @w2c_hermes_memcmp(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @w2c_hermes_llvh0x3A0x3ADenseMapInfo0x3Cllvh0x3A0x3AStringRef0x3E0x3A0x3AisEqual0x28llvh0x3A0x3AStringRef0x2C0x20llvh0x3A0x3AStringRef0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  %5 = zext i32 %2 to i64
  %6 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %5)
  %7 = zext i32 %1 to i64
  switch i32 %6, label %14 [
    i32 -2, label %11
    i32 -1, label %8
  ]

8:                                                ; preds = %3
  %9 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %7)
  %10 = icmp eq i32 %9, -1
  br label %26

11:                                               ; preds = %3
  %12 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %7)
  %13 = icmp eq i32 %12, -2
  br label %26

14:                                               ; preds = %3
  %15 = tail call i64 @i64_load(ptr noundef nonnull %4, i64 noundef %7)
  %16 = lshr i64 %15, 32
  %17 = trunc nuw i64 %16 to i32
  %18 = tail call i64 @i64_load(ptr noundef nonnull %4, i64 noundef %5)
  %19 = lshr i64 %18, 32
  %20 = icmp eq i64 %16, %19
  br i1 %20, label %21, label %26

21:                                               ; preds = %14
  %.not = icmp ult i64 %15, 4294967296
  br i1 %.not, label %26, label %22

22:                                               ; preds = %21
  %23 = trunc i64 %15 to i32
  %24 = trunc i64 %18 to i32
  %25 = tail call i32 @w2c_hermes_memcmp(ptr noundef %0, i32 noundef %23, i32 noundef %24, i32 noundef %17) #3
  %.not51 = icmp eq i32 %25, 0
  br label %26

26:                                               ; preds = %14, %22, %21, %11, %8
  %.049.shrunk = phi i1 [ %10, %8 ], [ %13, %11 ], [ true, %21 ], [ %.not51, %22 ], [ false, %14 ]
  %.049 = zext i1 %.049.shrunk to i32
  ret i32 %.049
}

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass