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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @i64_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_strlen(ptr noundef, i32 noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3AUnaryOperatorInst0x3A0x3AparseOperator0x28llvh0x3A0x3AStringRef0x29(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
  %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
  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) #4
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, 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 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !9
  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
  %15 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %15, ptr %10, align 4, !tbaa !9
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.w2c_hermes, ptr %16, i32 0, i32 6
  %18 = load i32, ptr %10, align 4, !tbaa !9
  %19 = zext i32 %18 to i64
  %20 = call i64 @i64_load(ptr noundef %17, i64 noundef %19)
  store i64 %20, ptr %13, align 8, !tbaa !11
  %21 = load i64, ptr %13, align 8, !tbaa !11
  store i64 %21, ptr %9, align 8, !tbaa !11
  store i64 32, ptr %14, align 8, !tbaa !11
  %22 = load i64, ptr %14, align 8, !tbaa !11
  %23 = and i64 %22, 63
  %24 = load i64, ptr %13, align 8, !tbaa !11
  %25 = lshr i64 %24, %23
  store i64 %25, ptr %13, align 8, !tbaa !11
  %26 = load i64, ptr %13, align 8, !tbaa !11
  %27 = trunc i64 %26 to i32
  store i32 %27, ptr %10, align 4, !tbaa !9
  %28 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %28, ptr %5, align 4, !tbaa !9
  %29 = load i64, ptr %9, align 8, !tbaa !11
  store i64 %29, ptr %13, align 8, !tbaa !11
  %30 = load i64, ptr %13, align 8, !tbaa !11
  %31 = trunc i64 %30 to i32
  store i32 %31, ptr %10, align 4, !tbaa !9
  %32 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %32, ptr %7, align 4, !tbaa !9
  store i32 0, ptr %10, align 4, !tbaa !9
  %33 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %33, ptr %4, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %102, %2
  %35 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %35, ptr %10, align 4, !tbaa !9
  store i32 2, ptr %11, align 4, !tbaa !9
  %36 = load i32, ptr %11, align 4, !tbaa !9
  %37 = and i32 %36, 31
  %38 = load i32, ptr %10, align 4, !tbaa !9
  %39 = shl i32 %38, %37
  store i32 %39, ptr %10, align 4, !tbaa !9
  store i32 111216, ptr %11, align 4, !tbaa !9
  %40 = load i32, ptr %11, align 4, !tbaa !9
  %41 = load i32, ptr %10, align 4, !tbaa !9
  %42 = add i32 %41, %40
  store i32 %42, ptr %10, align 4, !tbaa !9
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.w2c_hermes, ptr %43, i32 0, i32 6
  %45 = load i32, ptr %10, align 4, !tbaa !9
  %46 = zext i32 %45 to i64
  %47 = call i32 @i32_load(ptr noundef %44, i64 noundef %46)
  store i32 %47, ptr %10, align 4, !tbaa !9
  %48 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %48, ptr %6, align 4, !tbaa !9
  %49 = load i32, ptr %10, align 4, !tbaa !9
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %51, label %56

51:                                               ; preds = %34
  %52 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %52, ptr %10, align 4, !tbaa !9
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = load i32, ptr %10, align 4, !tbaa !9
  %55 = call i32 @w2c_hermes_strlen(ptr noundef %53, i32 noundef %54)
  store i32 %55, ptr %10, align 4, !tbaa !9
  br label %57

56:                                               ; preds = %34
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %57

57:                                               ; preds = %56, %51
  %58 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %58, ptr %11, align 4, !tbaa !9
  %59 = load i32, ptr %10, align 4, !tbaa !9
  %60 = load i32, ptr %11, align 4, !tbaa !9
  %61 = icmp ne i32 %59, %60
  %62 = zext i1 %61 to i32
  store i32 %62, ptr %10, align 4, !tbaa !9
  %63 = load i32, ptr %10, align 4, !tbaa !9
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %66

65:                                               ; preds = %57
  br label %90

66:                                               ; preds = %57
  %67 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %67, ptr %10, align 4, !tbaa !9
  %68 = load i32, ptr %10, align 4, !tbaa !9
  %69 = icmp ne i32 %68, 0
  %70 = xor i1 %69, true
  %71 = zext i1 %70 to i32
  store i32 %71, ptr %10, align 4, !tbaa !9
  %72 = load i32, ptr %10, align 4, !tbaa !9
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %74, label %76

74:                                               ; preds = %66
  %75 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %75, ptr %10, align 4, !tbaa !9
  br label %104

76:                                               ; preds = %66
  %77 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %77, ptr %10, align 4, !tbaa !9
  %78 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %78, ptr %11, align 4, !tbaa !9
  %79 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %79, ptr %12, align 4, !tbaa !9
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = load i32, ptr %10, align 4, !tbaa !9
  %82 = load i32, ptr %11, align 4, !tbaa !9
  %83 = load i32, ptr %12, align 4, !tbaa !9
  %84 = call i32 @w2c_hermes_memcmp(ptr noundef %80, i32 noundef %81, i32 noundef %82, i32 noundef %83)
  store i32 %84, ptr %10, align 4, !tbaa !9
  %85 = load i32, ptr %10, align 4, !tbaa !9
  %86 = icmp ne i32 %85, 0
  br i1 %86, label %87, label %88

87:                                               ; preds = %76
  br label %90

88:                                               ; preds = %76
  %89 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %89, ptr %10, align 4, !tbaa !9
  br label %104

90:                                               ; preds = %87, %65
  %91 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %91, ptr %10, align 4, !tbaa !9
  store i32 1, ptr %11, align 4, !tbaa !9
  %92 = load i32, ptr %11, align 4, !tbaa !9
  %93 = load i32, ptr %10, align 4, !tbaa !9
  %94 = add i32 %93, %92
  store i32 %94, ptr %10, align 4, !tbaa !9
  %95 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %95, ptr %4, align 4, !tbaa !9
  store i32 26, ptr %11, align 4, !tbaa !9
  %96 = load i32, ptr %10, align 4, !tbaa !9
  %97 = load i32, ptr %11, align 4, !tbaa !9
  %98 = icmp ne i32 %96, %97
  %99 = zext i1 %98 to i32
  store i32 %99, ptr %10, align 4, !tbaa !9
  %100 = load i32, ptr %10, align 4, !tbaa !9
  %101 = icmp ne i32 %100, 0
  br i1 %101, label %102, label %103

102:                                              ; preds = %90
  br label %34

103:                                              ; preds = %90
  store i32 26, ptr %10, align 4, !tbaa !9
  br label %104

104:                                              ; preds = %103, %88, %74
  %105 = load i32, ptr %10, align 4, !tbaa !9
  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 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret i32 %105
}

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3AUnaryOperatorInst0x3A0x3AparseOperator0x28llvh0x3A0x3AStringRef0x29(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 = tail call i64 @i64_load(ptr noundef nonnull %3, i64 noundef %4)
  %.fr = freeze i64 %5
  %6 = lshr i64 %.fr, 32
  %7 = trunc nuw i64 %6 to i32
  %8 = trunc i64 %.fr to i32
  %.not53 = icmp ult i64 %.fr, 4294967296
  br i1 %.not53, label %.split.us, label %.split

.split.us:                                        ; preds = %2, %15
  %indvars.iv62 = phi i64 [ %indvars.iv.next63, %15 ], [ 0, %2 ]
  %9 = shl i64 %indvars.iv62, 2
  %10 = add nuw nsw i64 %9, 111216
  %11 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %10)
  %.not.us = icmp eq i32 %11, 0
  br i1 %.not.us, label %14, label %12

12:                                               ; preds = %.split.us
  %13 = tail call i32 @w2c_hermes_strlen(ptr noundef %0, i32 noundef %11) #3
  br label %14

14:                                               ; preds = %12, %.split.us
  %.048.us = phi i32 [ %13, %12 ], [ 0, %.split.us ]
  %.not52.us = icmp eq i32 %.048.us, %7
  br i1 %.not52.us, label %.split57.us.loopexit.split.loop.exit69, label %15

15:                                               ; preds = %14
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %.not55.us = icmp eq i64 %indvars.iv.next63, 26
  br i1 %.not55.us, label %.split57.us, label %.split.us

.split:                                           ; preds = %2, %24
  %indvars.iv = phi i64 [ %indvars.iv.next, %24 ], [ 0, %2 ]
  %16 = shl i64 %indvars.iv, 2
  %17 = add nuw nsw i64 %16, 111216
  %18 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %17)
  %.not = icmp eq i32 %18, 0
  br i1 %.not, label %21, label %19

19:                                               ; preds = %.split
  %20 = tail call i32 @w2c_hermes_strlen(ptr noundef %0, i32 noundef %18) #3
  br label %21

21:                                               ; preds = %.split, %19
  %.048 = phi i32 [ %20, %19 ], [ 0, %.split ]
  %.not52 = icmp eq i32 %.048, %7
  br i1 %.not52, label %22, label %24

22:                                               ; preds = %21
  %23 = tail call i32 @w2c_hermes_memcmp(ptr noundef %0, i32 noundef %8, i32 noundef %18, i32 noundef %7) #3
  %.not54 = icmp eq i32 %23, 0
  br i1 %.not54, label %.split57.us.loopexit65.split.loop.exit67, label %24

24:                                               ; preds = %22, %21
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %.not55 = icmp eq i64 %indvars.iv.next, 26
  br i1 %.not55, label %.split57.us, label %.split

.split57.us.loopexit.split.loop.exit69:           ; preds = %14
  %25 = trunc nuw nsw i64 %indvars.iv62 to i32
  br label %.split57.us

.split57.us.loopexit65.split.loop.exit67:         ; preds = %22
  %26 = trunc nuw nsw i64 %indvars.iv to i32
  br label %.split57.us

.split57.us:                                      ; preds = %24, %15, %.split57.us.loopexit65.split.loop.exit67, %.split57.us.loopexit.split.loop.exit69
  %.us-phi = phi i32 [ %25, %.split57.us.loopexit.split.loop.exit69 ], [ %26, %.split57.us.loopexit65.split.loop.exit67 ], [ 26, %15 ], [ 26, %24 ]
  ret i32 %.us-phi
}

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,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass