; LLVM IR from cashapp/zipline :: zipline/native/Context.ll (ZN7Context12toJavaObjectEP7JNIEnv_RK7JSValueb)

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

%union.jvalue = type { i64 }
%struct.JSValue = type { %union.JSValueUnion, i64 }
%union.JSValueUnion = type { double }
%class.Context = type { ptr, i32, ptr, ptr, ptr, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::vector", %"class.std::unordered_map" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<InboundCallChannel *, std::allocator<InboundCallChannel *>>::_Vector_impl" }
%"struct.std::_Vector_base<InboundCallChannel *, std::allocator<InboundCallChannel *>>::_Vector_impl" = type { %"struct.std::_Vector_base<InboundCallChannel *, std::allocator<InboundCallChannel *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<InboundCallChannel *, std::allocator<InboundCallChannel *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [32 x i8], align 1

; 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7Context16throwJsExceptionEP7JNIEnv_RK7JSValue(ptr noundef nonnull align 8 dereferenceable(280), ptr noundef, ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

declare void @_Z19throwJsExceptionFmtP7JNIEnv_PK7ContextPKcz(ptr noundef, ptr noundef, ptr noundef, ...) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN7Context12toJavaObjectEP7JNIEnv_RK7JSValueb(ptr noundef nonnull align 8 dereferenceable(280) %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(16) %2, i1 noundef zeroext %3) #2 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca ptr, align 8
  %10 = alloca %union.jvalue, align 8
  %11 = alloca %union.jvalue, align 8
  %12 = alloca %union.jvalue, align 8
  %13 = alloca %struct.JSValue, align 8
  %14 = alloca %struct.JSValue, align 8
  %15 = alloca %struct.JSValue, align 8
  %16 = alloca i32, align 4
  %17 = alloca %struct.JSValue, align 8
  %18 = alloca i32, align 4
  %19 = alloca %struct.JSValue, align 8
  %20 = alloca %struct.JSValue, align 8
  %21 = alloca ptr, align 8
  %22 = alloca %struct.JSValue, align 8
  %23 = alloca ptr, align 8
  %24 = alloca %struct.JSValue, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %25 = zext i1 %3 to i8
  store i8 %25, ptr %8, align 1, !tbaa !9
  %26 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.JSValue, ptr %27, i32 0, i32 1
  %29 = load i64, ptr %28, align 8, !tbaa !11
  %30 = trunc i64 %29 to i32
  switch i32 %30, label %155 [
    i32 6, label %31
    i32 -7, label %34
    i32 1, label %38
    i32 0, label %49
    i32 7, label %60
    i32 2, label %70
    i32 3, label %70
    i32 -1, label %71
  ]

31:                                               ; preds = %4
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZNK7Context16throwJsExceptionEP7JNIEnv_RK7JSValue(ptr noundef nonnull align 8 dereferenceable(280) %26, ptr noundef %32, ptr noundef nonnull align 8 dereferenceable(16) %33)
  store ptr null, ptr %9, align 8, !tbaa !5
  br label %173

34:                                               ; preds = %4
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = call noundef ptr @_ZNK7Context12toJavaStringEP7JNIEnv_RK7JSValue(ptr noundef nonnull align 8 dereferenceable(280) %26, ptr noundef %35, ptr noundef nonnull align 8 dereferenceable(16) %36)
  store ptr %37, ptr %9, align 8, !tbaa !5
  br label %173

38:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.JSValue, ptr %39, i32 0, i32 0
  %41 = load i32, ptr %40, align 8, !tbaa !14
  %42 = trunc i32 %41 to i8
  store i8 %42, ptr %10, align 8, !tbaa !14
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = getelementptr inbounds %class.Context, ptr %26, i32 0, i32 9
  %45 = load ptr, ptr %44, align 8, !tbaa !15
  %46 = getelementptr inbounds %class.Context, ptr %26, i32 0, i32 17
  %47 = load ptr, ptr %46, align 8, !tbaa !27
  %48 = call noundef ptr @_ZN7JNIEnv_23CallStaticObjectMethodAEP7_jclassP10_jmethodIDPK6jvalue(ptr noundef nonnull align 8 dereferenceable(8) %43, ptr noundef %45, ptr noundef %47, ptr noundef %10)
  store ptr %48, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %173

49:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.JSValue, ptr %50, i32 0, i32 0
  %52 = load i32, ptr %51, align 8, !tbaa !14
  %53 = sext i32 %52 to i64
  store i64 %53, ptr %11, align 8, !tbaa !14
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds %class.Context, ptr %26, i32 0, i32 10
  %56 = load ptr, ptr %55, align 8, !tbaa !28
  %57 = getelementptr inbounds %class.Context, ptr %26, i32 0, i32 18
  %58 = load ptr, ptr %57, align 8, !tbaa !29
  %59 = call noundef ptr @_ZN7JNIEnv_23CallStaticObjectMethodAEP7_jclassP10_jmethodIDPK6jvalue(ptr noundef nonnull align 8 dereferenceable(8) %54, ptr noundef %56, ptr noundef %58, ptr noundef %11)
  store ptr %59, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %173

60:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.JSValue, ptr %61, i32 0, i32 0
  %63 = load double, ptr %62, align 8, !tbaa !14
  store double %63, ptr %12, align 8, !tbaa !14
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds %class.Context, ptr %26, i32 0, i32 11
  %66 = load ptr, ptr %65, align 8, !tbaa !30
  %67 = getelementptr inbounds %class.Context, ptr %26, i32 0, i32 19
  %68 = load ptr, ptr %67, align 8, !tbaa !31
  %69 = call noundef ptr @_ZN7JNIEnv_23CallStaticObjectMethodAEP7_jclassP10_jmethodIDPK6jvalue(ptr noundef nonnull align 8 dereferenceable(8) %64, ptr noundef %66, ptr noundef %68, ptr noundef %12)
  store ptr %69, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %173

70:                                               ; preds = %4, %4
  store ptr null, ptr %9, align 8, !tbaa !5
  br label %173

71:                                               ; preds = %4
  %72 = getelementptr inbounds %class.Context, ptr %26, i32 0, i32 3
  %73 = load ptr, ptr %72, align 8, !tbaa !32
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %13, ptr align 8 %74, i64 16, i1 false), !tbaa.struct !33
  %75 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 0
  %76 = load i64, ptr %75, align 8
  %77 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 1
  %78 = load i64, ptr %77, align 8
  %79 = call i32 @JS_IsArray(ptr noundef %73, i64 %76, i64 %78)
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %154

81:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #5
  %82 = getelementptr inbounds %class.Context, ptr %26, i32 0, i32 3
  %83 = load ptr, ptr %82, align 8, !tbaa !32
  %84 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 %84, i64 16, i1 false), !tbaa.struct !33
  %85 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %86 = load i64, ptr %85, align 8
  %87 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %88 = load i64, ptr %87, align 8
  %89 = call { i64, i64 } @JS_GetPropertyStr(ptr noundef %83, i64 %86, i64 %88, ptr noundef @.str)
  %90 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 0
  %91 = extractvalue { i64, i64 } %89, 0
  store i64 %91, ptr %90, align 8
  %92 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 1
  %93 = extractvalue { i64, i64 } %89, 1
  store i64 %93, ptr %92, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %94 = getelementptr inbounds %struct.JSValue, ptr %14, i32 0, i32 0
  %95 = load i32, ptr %94, align 8, !tbaa !14
  store i32 %95, ptr %16, align 4, !tbaa !35
  %96 = getelementptr inbounds %class.Context, ptr %26, i32 0, i32 3
  %97 = load ptr, ptr %96, align 8, !tbaa !32
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %17, ptr align 8 %14, i64 16, i1 false), !tbaa.struct !33
  %98 = getelementptr inbounds { i64, i64 }, ptr %17, i32 0, i32 0
  %99 = load i64, ptr %98, align 8
  %100 = getelementptr inbounds { i64, i64 }, ptr %17, i32 0, i32 1
  %101 = load i64, ptr %100, align 8
  call void @_ZL12JS_FreeValueP9JSContext7JSValue(ptr noundef %97, i64 %99, i64 %101)
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = load i32, ptr %16, align 4, !tbaa !35
  %104 = getelementptr inbounds %class.Context, ptr %26, i32 0, i32 12
  %105 = load ptr, ptr %104, align 8, !tbaa !36
  %106 = call noundef ptr @_ZN7JNIEnv_14NewObjectArrayEiP7_jclassP8_jobject(ptr noundef nonnull align 8 dereferenceable(8) %102, i32 noundef %103, ptr noundef %105, ptr noundef null)
  store ptr %106, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !35
  br label %107

107:                                              ; preds = %150, %81
  %108 = load i32, ptr %18, align 4, !tbaa !35
  %109 = load i32, ptr %16, align 4, !tbaa !35
  %110 = icmp slt i32 %108, %109
  br i1 %110, label %111, label %116

111:                                              ; preds = %107
  %112 = load ptr, ptr %6, align 8, !tbaa !5
  %113 = call noundef zeroext i8 @_ZN7JNIEnv_14ExceptionCheckEv(ptr noundef nonnull align 8 dereferenceable(8) %112)
  %114 = icmp ne i8 %113, 0
  %115 = xor i1 %114, true
  br label %116

116:                                              ; preds = %111, %107
  %117 = phi i1 [ false, %107 ], [ %115, %111 ]
  br i1 %117, label %119, label %118

118:                                              ; preds = %116
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %153

119:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #5
  %120 = getelementptr inbounds %class.Context, ptr %26, i32 0, i32 3
  %121 = load ptr, ptr %120, align 8, !tbaa !32
  %122 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 %122, i64 16, i1 false), !tbaa.struct !33
  %123 = load i32, ptr %18, align 4, !tbaa !35
  %124 = getelementptr inbounds { i64, i64 }, ptr %20, i32 0, i32 0
  %125 = load i64, ptr %124, align 8
  %126 = getelementptr inbounds { i64, i64 }, ptr %20, i32 0, i32 1
  %127 = load i64, ptr %126, align 8
  %128 = call { i64, i64 } @JS_GetPropertyUint32(ptr noundef %121, i64 %125, i64 %127, i32 noundef %123)
  %129 = getelementptr inbounds { i64, i64 }, ptr %19, i32 0, i32 0
  %130 = extractvalue { i64, i64 } %128, 0
  store i64 %130, ptr %129, align 8
  %131 = getelementptr inbounds { i64, i64 }, ptr %19, i32 0, i32 1
  %132 = extractvalue { i64, i64 } %128, 1
  store i64 %132, ptr %131, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %133 = load ptr, ptr %6, align 8, !tbaa !5
  %134 = call noundef ptr @_ZN7Context12toJavaObjectEP7JNIEnv_RK7JSValueb(ptr noundef nonnull align 8 dereferenceable(280) %26, ptr noundef %133, ptr noundef nonnull align 8 dereferenceable(16) %19, i1 noundef zeroext true)
  store ptr %134, ptr %21, align 8, !tbaa !5
  %135 = load ptr, ptr %6, align 8, !tbaa !5
  %136 = call noundef zeroext i8 @_ZN7JNIEnv_14ExceptionCheckEv(ptr noundef nonnull align 8 dereferenceable(8) %135)
  %137 = icmp ne i8 %136, 0
  br i1 %137, label %143, label %138

138:                                              ; preds = %119
  %139 = load ptr, ptr %6, align 8, !tbaa !5
  %140 = load ptr, ptr %9, align 8, !tbaa !5
  %141 = load i32, ptr %18, align 4, !tbaa !35
  %142 = load ptr, ptr %21, align 8, !tbaa !5
  call void @_ZN7JNIEnv_21SetObjectArrayElementEP13_jobjectArrayiP8_jobject(ptr noundef nonnull align 8 dereferenceable(8) %139, ptr noundef %140, i32 noundef %141, ptr noundef %142)
  br label %143

143:                                              ; preds = %138, %119
  %144 = getelementptr inbounds %class.Context, ptr %26, i32 0, i32 3
  %145 = load ptr, ptr %144, align 8, !tbaa !32
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %22, ptr align 8 %19, i64 16, i1 false), !tbaa.struct !33
  %146 = getelementptr inbounds { i64, i64 }, ptr %22, i32 0, i32 0
  %147 = load i64, ptr %146, align 8
  %148 = getelementptr inbounds { i64, i64 }, ptr %22, i32 0, i32 1
  %149 = load i64, ptr %148, align 8
  call void @_ZL12JS_FreeValueP9JSContext7JSValue(ptr noundef %145, i64 %147, i64 %149)
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #5
  br label %150

150:                                              ; preds = %143
  %151 = load i32, ptr %18, align 4, !tbaa !35
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %18, align 4, !tbaa !35
  br label %107, !llvm.loop !37

153:                                              ; preds = %118
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #5
  br label %173

154:                                              ; preds = %71
  br label %155

155:                                              ; preds = %154, %4
  %156 = load i8, ptr %8, align 1, !tbaa !9, !range !39, !noundef !40
  %157 = trunc i8 %156 to i1
  br i1 %157, label %158, label %172

158:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  %159 = getelementptr inbounds %class.Context, ptr %26, i32 0, i32 3
  %160 = load ptr, ptr %159, align 8, !tbaa !32
  %161 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %24, ptr align 8 %161, i64 16, i1 false), !tbaa.struct !33
  %162 = getelementptr inbounds { i64, i64 }, ptr %24, i32 0, i32 0
  %163 = load i64, ptr %162, align 8
  %164 = getelementptr inbounds { i64, i64 }, ptr %24, i32 0, i32 1
  %165 = load i64, ptr %164, align 8
  %166 = call noundef ptr @_ZL12JS_ToCStringP9JSContext7JSValue(ptr noundef %160, i64 %163, i64 %165)
  store ptr %166, ptr %23, align 8, !tbaa !5
  %167 = load ptr, ptr %6, align 8, !tbaa !5
  %168 = load ptr, ptr %23, align 8, !tbaa !5
  call void (ptr, ptr, ptr, ...) @_Z19throwJsExceptionFmtP7JNIEnv_PK7ContextPKcz(ptr noundef %167, ptr noundef %26, ptr noundef @.str.34, ptr noundef %168)
  %169 = getelementptr inbounds %class.Context, ptr %26, i32 0, i32 3
  %170 = load ptr, ptr %169, align 8, !tbaa !32
  %171 = load ptr, ptr %23, align 8, !tbaa !5
  call void @JS_FreeCString(ptr noundef %170, ptr noundef %171)
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  br label %172

172:                                              ; preds = %158, %155
  store ptr null, ptr %9, align 8, !tbaa !5
  br label %173

173:                                              ; preds = %172, %153, %70, %60, %49, %38, %34, %31
  %174 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  ret ptr %174
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZL12JS_FreeValueP9JSContext7JSValue(ptr noundef, i64, i64) #4

declare { i64, i64 } @JS_GetPropertyStr(ptr noundef, i64, i64, ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i8 @_ZN7JNIEnv_14ExceptionCheckEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK7Context12toJavaStringEP7JNIEnv_RK7JSValue(ptr noundef nonnull align 8 dereferenceable(280), ptr noundef, ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7JNIEnv_23CallStaticObjectMethodAEP7_jclassP10_jmethodIDPK6jvalue(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, ptr noundef, ptr noundef) #2 align 2

declare i32 @JS_IsArray(ptr noundef, i64, i64) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7JNIEnv_14NewObjectArrayEiP7_jclassP8_jobject(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef, ptr noundef, ptr noundef) #2 align 2

declare { i64, i64 } @JS_GetPropertyUint32(ptr noundef, i64, i64, i32 noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7JNIEnv_21SetObjectArrayElementEP13_jobjectArrayiP8_jobject(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i32 noundef, ptr noundef) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef ptr @_ZL12JS_ToCStringP9JSContext7JSValue(ptr noundef, i64, i64) #4

declare void @JS_FreeCString(ptr noundef, ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress 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 = { "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 = { inlinehint mustprogress 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 }

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !13, i64 8}
!12 = !{!"_ZTS7JSValue", !7, i64 0, !13, i64 8}
!13 = !{!"long", !7, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !6, i64 56}
!16 = !{!"_ZTS7Context", !6, i64 0, !17, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !17, i64 40, !17, i64 44, !17, i64 48, !17, i64 52, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !18, i64 200, !22, i64 224}
!17 = !{!"int", !7, i64 0}
!18 = !{!"_ZTSSt6vectorIP18InboundCallChannelSaIS1_EE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIP18InboundCallChannelSaIS1_EE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIP18InboundCallChannelSaIS1_EE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIP18InboundCallChannelSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!"_ZTSSt13unordered_mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP7_jclassSt4hashIS5_ESt8equal_toIS5_ESaISt4pairIKS5_S7_EEE", !23, i64 0}
!23 = !{!"_ZTSSt10_HashtableINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P7_jclassESaISA_ENSt8__detail10_Select1stESt8equal_toIS5_ESt4hashIS5_ENSC_18_Mod_range_hashingENSC_20_Default_ranged_hashENSC_20_Prime_rehash_policyENSC_17_Hashtable_traitsILb1ELb0ELb1EEEE", !6, i64 0, !13, i64 8, !24, i64 16, !13, i64 24, !25, i64 32, !6, i64 48}
!24 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!25 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !26, i64 0, !13, i64 8}
!26 = !{!"float", !7, i64 0}
!27 = !{!16, !6, i64 120}
!28 = !{!16, !6, i64 64}
!29 = !{!16, !6, i64 128}
!30 = !{!16, !6, i64 72}
!31 = !{!16, !6, i64 136}
!32 = !{!16, !6, i64 24}
!33 = !{i64 0, i64 8, !14, i64 8, i64 8, !34}
!34 = !{!13, !13, i64 0}
!35 = !{!17, !17, i64 0}
!36 = !{!16, !6, i64 80}
!37 = distinct !{!37, !38}
!38 = !{!"llvm.loop.mustprogress"}
!39 = !{i8 0, i8 2}
!40 = !{}


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

%union.jvalue = type { i64 }
%struct.JSValue = type { %union.JSValueUnion, i64 }
%union.JSValueUnion = type { double }

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7Context16throwJsExceptionEP7JNIEnv_RK7JSValue(ptr noundef nonnull align 8 dereferenceable(280), ptr noundef, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

declare void @_Z19throwJsExceptionFmtP7JNIEnv_PK7ContextPKcz(ptr noundef, ptr noundef, ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN7Context12toJavaObjectEP7JNIEnv_RK7JSValueb(ptr noundef nonnull align 8 dereferenceable(280) %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(16) %2, i1 noundef zeroext %3) local_unnamed_addr #1 align 2 {
  %5 = alloca %union.jvalue, align 8
  %6 = alloca %union.jvalue, align 8
  %7 = alloca %union.jvalue, align 8
  %8 = alloca %struct.JSValue, align 8
  %9 = getelementptr inbounds i8, ptr %2, i64 8
  %10 = load i64, ptr %9, align 8, !tbaa !5
  %11 = trunc i64 %10 to i32
  switch i32 %11, label %66 [
    i32 6, label %12
    i32 -7, label %13
    i32 1, label %15
    i32 0, label %23
    i32 7, label %31
    i32 2, label %.critedge
    i32 3, label %.critedge
    i32 -1, label %38
  ]

12:                                               ; preds = %4
  tail call void @_ZNK7Context16throwJsExceptionEP7JNIEnv_RK7JSValue(ptr noundef nonnull align 8 dereferenceable(280) %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(16) %2)
  br label %.critedge

13:                                               ; preds = %4
  %14 = tail call noundef ptr @_ZNK7Context12toJavaStringEP7JNIEnv_RK7JSValue(ptr noundef nonnull align 8 dereferenceable(280) %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(16) %2)
  br label %.critedge

15:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %16 = load i32, ptr %2, align 8, !tbaa !9
  %17 = trunc i32 %16 to i8
  store i8 %17, ptr %5, align 8, !tbaa !9
  %18 = getelementptr inbounds i8, ptr %0, i64 56
  %19 = load ptr, ptr %18, align 8, !tbaa !10
  %20 = getelementptr inbounds i8, ptr %0, i64 120
  %21 = load ptr, ptr %20, align 8, !tbaa !23
  %22 = call noundef ptr @_ZN7JNIEnv_23CallStaticObjectMethodAEP7_jclassP10_jmethodIDPK6jvalue(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %19, ptr noundef %21, ptr noundef nonnull %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  br label %.critedge

23:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %24 = load i32, ptr %2, align 8, !tbaa !9
  %25 = sext i32 %24 to i64
  store i64 %25, ptr %6, align 8, !tbaa !9
  %26 = getelementptr inbounds i8, ptr %0, i64 64
  %27 = load ptr, ptr %26, align 8, !tbaa !24
  %28 = getelementptr inbounds i8, ptr %0, i64 128
  %29 = load ptr, ptr %28, align 8, !tbaa !25
  %30 = call noundef ptr @_ZN7JNIEnv_23CallStaticObjectMethodAEP7_jclassP10_jmethodIDPK6jvalue(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %27, ptr noundef %29, ptr noundef nonnull %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  br label %.critedge

31:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %32 = load double, ptr %2, align 8, !tbaa !9
  store double %32, ptr %7, align 8, !tbaa !9
  %33 = getelementptr inbounds i8, ptr %0, i64 72
  %34 = load ptr, ptr %33, align 8, !tbaa !26
  %35 = getelementptr inbounds i8, ptr %0, i64 136
  %36 = load ptr, ptr %35, align 8, !tbaa !27
  %37 = call noundef ptr @_ZN7JNIEnv_23CallStaticObjectMethodAEP7_jclassP10_jmethodIDPK6jvalue(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %34, ptr noundef %36, ptr noundef nonnull %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  br label %.critedge

38:                                               ; preds = %4
  %39 = getelementptr inbounds i8, ptr %0, i64 24
  %40 = load ptr, ptr %39, align 8, !tbaa !28
  %.sroa.018.0.copyload = load i64, ptr %2, align 8, !tbaa !9
  %41 = tail call i32 @JS_IsArray(ptr noundef %40, i64 %.sroa.018.0.copyload, i64 %10)
  %.not = icmp eq i32 %41, 0
  br i1 %.not, label %66, label %42

42:                                               ; preds = %38
  %43 = load ptr, ptr %39, align 8, !tbaa !28
  %.sroa.014.0.copyload = load i64, ptr %2, align 8, !tbaa !9
  %.sroa.215.0.copyload = load i64, ptr %9, align 8, !tbaa !5
  %44 = tail call { i64, i64 } @JS_GetPropertyStr(ptr noundef %43, i64 %.sroa.014.0.copyload, i64 %.sroa.215.0.copyload, ptr noundef nonnull @.str)
  %45 = extractvalue { i64, i64 } %44, 0
  %46 = extractvalue { i64, i64 } %44, 1
  %.sroa.016.0.extract.trunc = trunc i64 %45 to i32
  %47 = load ptr, ptr %39, align 8, !tbaa !28
  tail call void @_ZL12JS_FreeValueP9JSContext7JSValue(ptr noundef %47, i64 %45, i64 %46)
  %48 = getelementptr inbounds i8, ptr %0, i64 80
  %49 = load ptr, ptr %48, align 8, !tbaa !29
  %50 = tail call noundef ptr @_ZN7JNIEnv_14NewObjectArrayEiP7_jclassP8_jobject(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef %.sroa.016.0.extract.trunc, ptr noundef %49, ptr noundef null)
  %51 = icmp sgt i32 %.sroa.016.0.extract.trunc, 0
  br i1 %51, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %42
  %52 = getelementptr inbounds i8, ptr %8, i64 8
  br label %53

53:                                               ; preds = %.lr.ph, %63
  %.04548 = phi i32 [ 0, %.lr.ph ], [ %65, %63 ]
  %54 = call noundef zeroext i8 @_ZN7JNIEnv_14ExceptionCheckEv(ptr noundef nonnull align 8 dereferenceable(8) %1)
  %.not46 = icmp eq i8 %54, 0
  br i1 %.not46, label %55, label %.critedge

55:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #4
  %56 = load ptr, ptr %39, align 8, !tbaa !28
  %.sroa.05.0.copyload = load i64, ptr %2, align 8, !tbaa !9
  %.sroa.26.0.copyload = load i64, ptr %9, align 8, !tbaa !5
  %57 = call { i64, i64 } @JS_GetPropertyUint32(ptr noundef %56, i64 %.sroa.05.0.copyload, i64 %.sroa.26.0.copyload, i32 noundef %.04548)
  %58 = extractvalue { i64, i64 } %57, 0
  store i64 %58, ptr %8, align 8
  %59 = extractvalue { i64, i64 } %57, 1
  store i64 %59, ptr %52, align 8
  %60 = call noundef ptr @_ZN7Context12toJavaObjectEP7JNIEnv_RK7JSValueb(ptr noundef nonnull align 8 dereferenceable(280) %0, ptr noundef nonnull %1, ptr noundef nonnull align 8 dereferenceable(16) %8, i1 noundef zeroext true)
  %61 = call noundef zeroext i8 @_ZN7JNIEnv_14ExceptionCheckEv(ptr noundef nonnull align 8 dereferenceable(8) %1)
  %.not47 = icmp eq i8 %61, 0
  br i1 %.not47, label %62, label %63

62:                                               ; preds = %55
  call void @_ZN7JNIEnv_21SetObjectArrayElementEP13_jobjectArrayiP8_jobject(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %50, i32 noundef %.04548, ptr noundef %60)
  br label %63

63:                                               ; preds = %62, %55
  %64 = load ptr, ptr %39, align 8, !tbaa !28
  %.sroa.02.0.copyload = load i64, ptr %8, align 8, !tbaa !9
  %.sroa.23.0.copyload = load i64, ptr %52, align 8, !tbaa !5
  call void @_ZL12JS_FreeValueP9JSContext7JSValue(ptr noundef %64, i64 %.sroa.02.0.copyload, i64 %.sroa.23.0.copyload)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #4
  %65 = add nuw nsw i32 %.04548, 1
  %exitcond.not = icmp eq i32 %65, %.sroa.016.0.extract.trunc
  br i1 %exitcond.not, label %.critedge, label %53, !llvm.loop !30

66:                                               ; preds = %38, %4
  br i1 %3, label %67, label %.critedge

67:                                               ; preds = %66
  %68 = getelementptr inbounds i8, ptr %0, i64 24
  %69 = load ptr, ptr %68, align 8, !tbaa !28
  %.sroa.0.0.copyload = load i64, ptr %2, align 8, !tbaa !9
  %.sroa.2.0.copyload = load i64, ptr %9, align 8, !tbaa !5
  %70 = tail call noundef ptr @_ZL12JS_ToCStringP9JSContext7JSValue(ptr noundef %69, i64 %.sroa.0.0.copyload, i64 %.sroa.2.0.copyload)
  tail call void (ptr, ptr, ptr, ...) @_Z19throwJsExceptionFmtP7JNIEnv_PK7ContextPKcz(ptr noundef %1, ptr noundef nonnull %0, ptr noundef nonnull @.str.34, ptr noundef %70)
  %71 = load ptr, ptr %68, align 8, !tbaa !28
  tail call void @JS_FreeCString(ptr noundef %71, ptr noundef %70)
  br label %.critedge

.critedge:                                        ; preds = %63, %53, %42, %66, %67, %4, %4, %31, %23, %15, %13, %12
  %.0 = phi ptr [ %37, %31 ], [ %30, %23 ], [ %22, %15 ], [ %14, %13 ], [ null, %12 ], [ null, %4 ], [ null, %4 ], [ null, %67 ], [ null, %66 ], [ %50, %42 ], [ %50, %53 ], [ %50, %63 ]
  ret ptr %.0
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZL12JS_FreeValueP9JSContext7JSValue(ptr noundef, i64, i64) local_unnamed_addr #3

declare { i64, i64 } @JS_GetPropertyStr(ptr noundef, i64, i64, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i8 @_ZN7JNIEnv_14ExceptionCheckEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK7Context12toJavaStringEP7JNIEnv_RK7JSValue(ptr noundef nonnull align 8 dereferenceable(280), ptr noundef, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7JNIEnv_23CallStaticObjectMethodAEP7_jclassP10_jmethodIDPK6jvalue(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1 align 2

declare i32 @JS_IsArray(ptr noundef, i64, i64) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7JNIEnv_14NewObjectArrayEiP7_jclassP8_jobject(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #1 align 2

declare { i64, i64 } @JS_GetPropertyUint32(ptr noundef, i64, i64, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7JNIEnv_21SetObjectArrayElementEP13_jobjectArrayiP8_jobject(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef ptr @_ZL12JS_ToCStringP9JSContext7JSValue(ptr noundef, i64, i64) local_unnamed_addr #3

declare void @JS_FreeCString(ptr noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { inlinehint mustprogress 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !12, i64 56}
!11 = !{!"_ZTS7Context", !12, i64 0, !13, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !12, i64 152, !12, i64 160, !12, i64 168, !12, i64 176, !12, i64 184, !12, i64 192, !14, i64 200, !18, i64 224}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSSt6vectorIP18InboundCallChannelSaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIP18InboundCallChannelSaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIP18InboundCallChannelSaIS1_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIP18InboundCallChannelSaIS1_EE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!18 = !{!"_ZTSSt13unordered_mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP7_jclassSt4hashIS5_ESt8equal_toIS5_ESaISt4pairIKS5_S7_EEE", !19, i64 0}
!19 = !{!"_ZTSSt10_HashtableINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P7_jclassESaISA_ENSt8__detail10_Select1stESt8equal_toIS5_ESt4hashIS5_ENSC_18_Mod_range_hashingENSC_20_Default_ranged_hashENSC_20_Prime_rehash_policyENSC_17_Hashtable_traitsILb1ELb0ELb1EEEE", !12, i64 0, !6, i64 8, !20, i64 16, !6, i64 24, !21, i64 32, !12, i64 48}
!20 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !12, i64 0}
!21 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !22, i64 0, !6, i64 8}
!22 = !{!"float", !7, i64 0}
!23 = !{!11, !12, i64 120}
!24 = !{!11, !12, i64 64}
!25 = !{!11, !12, i64 128}
!26 = !{!11, !12, i64 72}
!27 = !{!11, !12, i64 136}
!28 = !{!11, !12, i64 24}
!29 = !{!11, !12, i64 80}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass