; LLVM IR from ohler55/agoo :: ext/agoo (gqleval)

; 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._agooErr = type { i32, [256 x i8] }
%struct._agooReq = type { i32, ptr, i32, ptr, %struct._agooStr, %struct._agooStr, %struct._agooStr, %struct._agooStr, %struct._agooStr, [46 x i8], ptr, ptr, i64, [8 x i8] }
%struct._agooStr = type { ptr, i32 }
%struct._gqlDoc = type { ptr, ptr, ptr, ptr, %struct._gqlFuncs, ptr, ptr, ptr }
%struct._gqlFuncs = type { ptr, ptr }
%struct._gqlOp = type { ptr, ptr, ptr, ptr, ptr, i32 }
%struct._agooRes = type { ptr, ptr, ptr, %union.pthread_mutex_t, i8, i32, i8, i8, i8 }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }

@gql_doc_eval_func = external dso_local global ptr, align 8
@indent_str = external hidden constant [7 x i8], align 1
@query_str = external hidden constant [6 x i8], align 1
@subscription_str = external hidden constant [13 x i8], align 1
@operation_name_str = external hidden constant [14 x i8], align 1
@variables_str = external hidden constant [10 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [38 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

declare i32 @agoo_err_set(ptr noundef, i32 noundef, ptr noundef, ...) #1

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
define dso_local void @gql_eval_get_hook(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct._agooErr, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %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 ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca %struct._agooErr, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 260, ptr %3) #5
  call void @llvm.memset.p0.i64(ptr align 4 %3, i8 0, i64 260, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store ptr null, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store ptr null, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 81, ptr %14, align 4, !tbaa !9
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = call ptr @agoo_req_query_value(ptr noundef %22, ptr noundef @indent_str, i32 noundef 6, ptr noundef %7)
  store ptr %23, ptr %4, align 8, !tbaa !5
  %24 = icmp ne ptr null, %23
  br i1 %24, label %25, label %29

25:                                               ; preds = %1
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = call i64 @strtol(ptr noundef %26, ptr noundef null, i32 noundef 10) #5
  %28 = trunc i64 %27 to i32
  store i32 %28, ptr %10, align 4, !tbaa !9
  br label %29

29:                                               ; preds = %25, %1
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = call ptr @agoo_req_query_value(ptr noundef %30, ptr noundef @query_str, i32 noundef 5, ptr noundef %7)
  store ptr %31, ptr %4, align 8, !tbaa !5
  %32 = icmp eq ptr null, %31
  br i1 %32, label %33, label %42

33:                                               ; preds = %29
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = call ptr @agoo_req_query_value(ptr noundef %34, ptr noundef @subscription_str, i32 noundef 12, ptr noundef %7)
  store ptr %35, ptr %4, align 8, !tbaa !5
  %36 = icmp eq ptr null, %35
  br i1 %36, label %37, label %41

37:                                               ; preds = %33
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct._agooReq, ptr %38, i32 0, i32 1
  %40 = load ptr, ptr %39, align 8, !tbaa !11
  call void @err_resp(ptr noundef %40, ptr noundef %3, i32 noundef 500)
  store i32 1, ptr %15, align 4
  br label %180

41:                                               ; preds = %33
  store i32 83, ptr %14, align 4, !tbaa !9
  br label %42

42:                                               ; preds = %41, %29
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = call ptr @agoo_req_query_value(ptr noundef %43, ptr noundef @operation_name_str, i32 noundef 13, ptr noundef %8)
  store ptr %44, ptr %5, align 8, !tbaa !5
  %45 = load ptr, ptr %2, align 8, !tbaa !5
  %46 = call ptr @agoo_req_query_value(ptr noundef %45, ptr noundef @variables_str, i32 noundef 9, ptr noundef %9)
  store ptr %46, ptr %6, align 8, !tbaa !5
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = icmp ne ptr null, %47
  br i1 %48, label %49, label %63

49:                                               ; preds = %42
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = load i32, ptr %9, align 4, !tbaa !9
  %52 = call ptr @parse_query_vars(ptr noundef %3, ptr noundef %50, i32 noundef %51)
  store ptr %52, ptr %13, align 8, !tbaa !5
  %53 = icmp eq ptr null, %52
  br i1 %53, label %54, label %62

54:                                               ; preds = %49
  %55 = getelementptr inbounds %struct._agooErr, ptr %3, i32 0, i32 0
  %56 = load i32, ptr %55, align 4, !tbaa !15
  %57 = icmp ne i32 0, %56
  br i1 %57, label %58, label %62

58:                                               ; preds = %54
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct._agooReq, ptr %59, i32 0, i32 1
  %61 = load ptr, ptr %60, align 8, !tbaa !11
  call void @err_resp(ptr noundef %61, ptr noundef %3, i32 noundef 400)
  store i32 1, ptr %15, align 4
  br label %180

62:                                               ; preds = %54, %49
  br label %63

63:                                               ; preds = %62, %42
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = load i32, ptr %7, align 4, !tbaa !9
  %66 = call i32 @agoo_req_query_decode(ptr noundef %64, i32 noundef %65)
  store i32 %66, ptr %7, align 4, !tbaa !9
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = load i32, ptr %7, align 4, !tbaa !9
  %69 = load ptr, ptr %13, align 8, !tbaa !5
  %70 = load i32, ptr %14, align 4, !tbaa !9
  %71 = call ptr @sdl_parse_doc(ptr noundef %3, ptr noundef %67, i32 noundef %68, ptr noundef %69, i32 noundef %70)
  store ptr %71, ptr %11, align 8, !tbaa !5
  %72 = icmp eq ptr null, %71
  br i1 %72, label %73, label %77

73:                                               ; preds = %63
  %74 = load ptr, ptr %2, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct._agooReq, ptr %74, i32 0, i32 1
  %76 = load ptr, ptr %75, align 8, !tbaa !11
  call void @err_resp(ptr noundef %76, ptr noundef %3, i32 noundef 500)
  store i32 1, ptr %15, align 4
  br label %180

77:                                               ; preds = %63
  %78 = load ptr, ptr %11, align 8, !tbaa !5
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = load i32, ptr %8, align 4, !tbaa !9
  call void @set_doc_op(ptr noundef %78, ptr noundef %79, i32 noundef %80)
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = load ptr, ptr %11, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct._gqlDoc, ptr %82, i32 0, i32 5
  store ptr %81, ptr %83, align 8, !tbaa !17
  %84 = load ptr, ptr @gql_doc_eval_func, align 8, !tbaa !5
  %85 = icmp eq ptr null, %84
  br i1 %85, label %86, label %89

86:                                               ; preds = %77
  %87 = load ptr, ptr %11, align 8, !tbaa !5
  %88 = call ptr @gql_doc_eval(ptr noundef %3, ptr noundef %87)
  store ptr %88, ptr %12, align 8, !tbaa !5
  br label %93

89:                                               ; preds = %77
  %90 = load ptr, ptr @gql_doc_eval_func, align 8, !tbaa !5
  %91 = load ptr, ptr %11, align 8, !tbaa !5
  %92 = call ptr %90(ptr noundef %3, ptr noundef %91)
  store ptr %92, ptr %12, align 8, !tbaa !5
  br label %93

93:                                               ; preds = %89, %86
  %94 = load ptr, ptr %12, align 8, !tbaa !5
  %95 = icmp eq ptr null, %94
  br i1 %95, label %96, label %111

96:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 500, ptr %16, align 4, !tbaa !9
  %97 = getelementptr inbounds %struct._agooErr, ptr %3, i32 0, i32 0
  %98 = load i32, ptr %97, align 4, !tbaa !15
  %99 = icmp slt i32 %98, 0
  br i1 %99, label %100, label %104

100:                                              ; preds = %96
  %101 = getelementptr inbounds %struct._agooErr, ptr %3, i32 0, i32 0
  %102 = load i32, ptr %101, align 4, !tbaa !15
  %103 = sub nsw i32 0, %102
  store i32 %103, ptr %16, align 4, !tbaa !9
  br label %104

104:                                              ; preds = %100, %96
  %105 = getelementptr inbounds %struct._agooErr, ptr %3, i32 0, i32 0
  store i32 313, ptr %105, align 4, !tbaa !15
  %106 = load ptr, ptr %11, align 8, !tbaa !5
  call void @gql_doc_destroy(ptr noundef %106)
  %107 = load ptr, ptr %2, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct._agooReq, ptr %107, i32 0, i32 1
  %109 = load ptr, ptr %108, align 8, !tbaa !11
  %110 = load i32, ptr %16, align 4, !tbaa !9
  call void @err_resp(ptr noundef %109, ptr noundef %3, i32 noundef %110)
  store i32 1, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %180

111:                                              ; preds = %93
  %112 = load ptr, ptr %11, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct._gqlDoc, ptr %112, i32 0, i32 3
  %114 = load ptr, ptr %113, align 8, !tbaa !20
  %115 = getelementptr inbounds %struct._gqlOp, ptr %114, i32 0, i32 5
  %116 = load i32, ptr %115, align 8, !tbaa !21
  %117 = icmp eq i32 83, %116
  br i1 %117, label %118, label %175

118:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 200, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %119 = load ptr, ptr %2, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct._agooReq, ptr %119, i32 0, i32 1
  %121 = load ptr, ptr %120, align 8, !tbaa !11
  %122 = getelementptr inbounds %struct._agooRes, ptr %121, i32 0, i32 5
  %123 = load i32, ptr %122, align 4, !tbaa !23
  switch i32 %123, label %125 [
    i32 87, label %124
    i32 83, label %131
  ]

124:                                              ; preds = %118
  store i32 101, ptr %17, align 4, !tbaa !9
  br label %131

125:                                              ; preds = %118
  %126 = load ptr, ptr %11, align 8, !tbaa !5
  call void @gql_doc_destroy(ptr noundef %126)
  %127 = call i32 (ptr, i32, ptr, ...) @agoo_err_set(ptr noundef %3, i32 noundef 307, ptr noundef @.str.12)
  %128 = load ptr, ptr %2, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct._agooReq, ptr %128, i32 0, i32 1
  %130 = load ptr, ptr %129, align 8, !tbaa !11
  call void @err_resp(ptr noundef %130, ptr noundef %3, i32 noundef 426)
  store i32 1, ptr %15, align 4
  br label %174

131:                                              ; preds = %124, %118
  %132 = load ptr, ptr %12, align 8, !tbaa !5
  %133 = call ptr @gql_object_get(ptr noundef %132, ptr noundef @.str.13)
  store ptr %133, ptr %18, align 8, !tbaa !5
  %134 = icmp eq ptr null, %133
  br i1 %134, label %135, label %141

135:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 260, ptr %21) #5
  %136 = call i32 (ptr, i32, ptr, ...) @agoo_err_set(ptr noundef %21, i32 noundef 312, ptr noundef @.str.14)
  %137 = load ptr, ptr %2, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct._agooReq, ptr %137, i32 0, i32 1
  %139 = load ptr, ptr %138, align 8, !tbaa !11
  call void @err_resp(ptr noundef %139, ptr noundef %21, i32 noundef 400)
  %140 = load ptr, ptr %11, align 8, !tbaa !5
  call void @gql_doc_destroy(ptr noundef %140)
  store i32 1, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 260, ptr %21) #5
  br label %174

141:                                              ; preds = %131
  %142 = load ptr, ptr %18, align 8, !tbaa !5
  %143 = call ptr @gql_string_get(ptr noundef %142)
  store ptr %143, ptr %19, align 8, !tbaa !5
  %144 = load ptr, ptr %2, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct._agooReq, ptr %144, i32 0, i32 1
  %146 = load ptr, ptr %145, align 8, !tbaa !11
  %147 = getelementptr inbounds %struct._agooRes, ptr %146, i32 0, i32 5
  %148 = load i32, ptr %147, align 4, !tbaa !23
  %149 = icmp eq i32 87, %148
  br i1 %149, label %150, label %151

150:                                              ; preds = %141
  store i32 101, ptr %17, align 4, !tbaa !9
  br label %151

151:                                              ; preds = %150, %141
  %152 = load ptr, ptr %11, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct._gqlDoc, ptr %152, i32 0, i32 3
  %154 = load ptr, ptr %153, align 8, !tbaa !20
  %155 = getelementptr inbounds %struct._gqlOp, ptr %154, i32 0, i32 5
  store i32 81, ptr %155, align 8, !tbaa !21
  %156 = load ptr, ptr %2, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct._agooReq, ptr %156, i32 0, i32 1
  %158 = load ptr, ptr %157, align 8, !tbaa !11
  %159 = getelementptr inbounds %struct._agooRes, ptr %158, i32 0, i32 1
  %160 = load ptr, ptr %159, align 8, !tbaa !26
  %161 = load ptr, ptr %19, align 8, !tbaa !5
  %162 = load ptr, ptr %11, align 8, !tbaa !5
  %163 = call ptr @gql_sub_create(ptr noundef %3, ptr noundef %160, ptr noundef %161, ptr noundef %162)
  store ptr %163, ptr %20, align 8, !tbaa !5
  %164 = icmp eq ptr null, %163
  br i1 %164, label %165, label %169

165:                                              ; preds = %151
  %166 = load ptr, ptr %2, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct._agooReq, ptr %166, i32 0, i32 1
  %168 = load ptr, ptr %167, align 8, !tbaa !11
  call void @err_resp(ptr noundef %168, ptr noundef %3, i32 noundef 400)
  store i32 1, ptr %15, align 4
  br label %174

169:                                              ; preds = %151
  %170 = load ptr, ptr %20, align 8, !tbaa !5
  call void @agoo_server_add_gsub(ptr noundef %170)
  %171 = load ptr, ptr %2, align 8, !tbaa !5
  %172 = load i32, ptr %17, align 4, !tbaa !9
  %173 = load i32, ptr %10, align 4, !tbaa !9
  call void @value_resp(ptr noundef %171, ptr noundef null, i32 noundef %172, i32 noundef %173)
  store i32 1, ptr %15, align 4
  br label %174

174:                                              ; preds = %169, %165, %135, %125
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %180

175:                                              ; preds = %111
  %176 = load ptr, ptr %11, align 8, !tbaa !5
  call void @gql_doc_destroy(ptr noundef %176)
  %177 = load ptr, ptr %2, align 8, !tbaa !5
  %178 = load ptr, ptr %12, align 8, !tbaa !5
  %179 = load i32, ptr %10, align 4, !tbaa !9
  call void @value_resp(ptr noundef %177, ptr noundef %178, i32 noundef 200, i32 noundef %179)
  store i32 0, ptr %15, align 4
  br label %180

180:                                              ; preds = %175, %174, %104, %73, %58, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 260, ptr %3) #5
  %181 = load i32, ptr %15, align 4
  switch i32 %181, label %183 [
    i32 0, label %182
    i32 1, label %182
  ]

182:                                              ; preds = %180, %180
  ret void

183:                                              ; preds = %180
  unreachable
}

declare ptr @agoo_req_query_value(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind
declare i64 @strtol(ptr noundef, ptr noundef, i32 noundef) #4

; Function Attrs: nounwind uwtable
declare hidden void @err_resp(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden ptr @parse_query_vars(ptr noundef, ptr noundef, i32 noundef) #2

declare i32 @agoo_req_query_decode(ptr noundef, i32 noundef) #1

declare ptr @sdl_parse_doc(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @set_doc_op(ptr noundef, ptr noundef, i32 noundef) #2

declare void @gql_doc_destroy(ptr noundef) #1

declare ptr @gql_object_get(ptr noundef, ptr noundef) #1

declare ptr @gql_string_get(ptr noundef) #1

declare ptr @gql_sub_create(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare void @agoo_server_add_gsub(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @value_resp(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind "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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"_agooReq", !10, i64 0, !6, i64 8, !10, i64 16, !6, i64 24, !13, i64 32, !13, i64 48, !13, i64 64, !13, i64 80, !13, i64 96, !7, i64 112, !6, i64 160, !6, i64 168, !14, i64 176, !7, i64 184}
!13 = !{!"_agooStr", !6, i64 0, !10, i64 8}
!14 = !{!"long", !7, i64 0}
!15 = !{!16, !10, i64 0}
!16 = !{!"_agooErr", !10, i64 0, !7, i64 4}
!17 = !{!18, !6, i64 48}
!18 = !{!"_gqlDoc", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !19, i64 32, !6, i64 48, !6, i64 56, !6, i64 64}
!19 = !{!"_gqlFuncs", !6, i64 0, !6, i64 8}
!20 = !{!18, !6, i64 24}
!21 = !{!22, !10, i64 40}
!22 = !{!"_gqlOp", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !10, i64 40}
!23 = !{!24, !10, i64 68}
!24 = !{!"_agooRes", !6, i64 0, !6, i64 8, !6, i64 16, !7, i64 24, !25, i64 64, !10, i64 68, !25, i64 72, !25, i64 73, !25, i64 74}
!25 = !{!"_Bool", !7, i64 0}
!26 = !{!24, !6, i64 8}


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

%struct._agooErr = type { i32, [256 x i8] }

@gql_doc_eval_func = external dso_local local_unnamed_addr global ptr, align 8
@indent_str = external hidden constant [7 x i8], align 1
@query_str = external hidden constant [6 x i8], align 1
@subscription_str = external hidden constant [13 x i8], align 1
@operation_name_str = external hidden constant [14 x i8], align 1
@variables_str = external hidden constant [10 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [38 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

declare i32 @agoo_err_set(ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @gql_doc_eval(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
define dso_local void @gql_eval_get_hook(ptr noundef %0) local_unnamed_addr #2 {
  %2 = alloca %struct._agooErr, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %struct._agooErr, align 4
  call void @llvm.lifetime.start.p0(i64 260, ptr nonnull %2) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(260) %2, i8 0, i64 260, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %7 = call ptr @agoo_req_query_value(ptr noundef %0, ptr noundef nonnull @indent_str, i32 noundef 6, ptr noundef nonnull %3) #5
  %.not = icmp eq ptr %7, null
  br i1 %.not, label %11, label %8

8:                                                ; preds = %1
  %9 = call i64 @strtol(ptr nocapture noundef nonnull %7, ptr noundef null, i32 noundef 10) #5
  %10 = trunc i64 %9 to i32
  br label %11

11:                                               ; preds = %8, %1
  %.053 = phi i32 [ %10, %8 ], [ 0, %1 ]
  %12 = call ptr @agoo_req_query_value(ptr noundef %0, ptr noundef nonnull @query_str, i32 noundef 5, ptr noundef nonnull %3) #5
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %20

14:                                               ; preds = %11
  %15 = call ptr @agoo_req_query_value(ptr noundef %0, ptr noundef nonnull @subscription_str, i32 noundef 12, ptr noundef nonnull %3) #5
  %16 = icmp eq ptr %15, null
  br i1 %16, label %17, label %20

17:                                               ; preds = %14
  %18 = getelementptr inbounds i8, ptr %0, i64 8
  %19 = load ptr, ptr %18, align 8, !tbaa !5
  call void @err_resp(ptr noundef %19, ptr noundef nonnull %2, i32 noundef 500)
  br label %94

20:                                               ; preds = %14, %11
  %.050 = phi i32 [ 81, %11 ], [ 83, %14 ]
  %.0 = phi ptr [ %12, %11 ], [ %15, %14 ]
  %21 = call ptr @agoo_req_query_value(ptr noundef %0, ptr noundef nonnull @operation_name_str, i32 noundef 13, ptr noundef nonnull %4) #5
  %22 = call ptr @agoo_req_query_value(ptr noundef %0, ptr noundef nonnull @variables_str, i32 noundef 9, ptr noundef nonnull %5) #5
  %.not63 = icmp eq ptr %22, null
  br i1 %.not63, label %32, label %23

23:                                               ; preds = %20
  %24 = load i32, ptr %5, align 4, !tbaa !13
  %25 = call ptr @parse_query_vars(ptr noundef nonnull %2, ptr noundef nonnull %22, i32 noundef %24)
  %26 = icmp eq ptr %25, null
  %27 = load i32, ptr %2, align 4
  %28 = icmp ne i32 %27, 0
  %or.cond = select i1 %26, i1 %28, i1 false
  br i1 %or.cond, label %29, label %32

29:                                               ; preds = %23
  %30 = getelementptr inbounds i8, ptr %0, i64 8
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  call void @err_resp(ptr noundef %31, ptr noundef nonnull %2, i32 noundef 400)
  br label %94

32:                                               ; preds = %23, %20
  %.051 = phi ptr [ %25, %23 ], [ null, %20 ]
  %33 = load i32, ptr %3, align 4, !tbaa !13
  %34 = call i32 @agoo_req_query_decode(ptr noundef nonnull %.0, i32 noundef %33) #5
  store i32 %34, ptr %3, align 4, !tbaa !13
  %35 = call ptr @sdl_parse_doc(ptr noundef nonnull %2, ptr noundef nonnull %.0, i32 noundef %34, ptr noundef %.051, i32 noundef %.050) #5
  %36 = icmp eq ptr %35, null
  br i1 %36, label %37, label %40

37:                                               ; preds = %32
  %38 = getelementptr inbounds i8, ptr %0, i64 8
  %39 = load ptr, ptr %38, align 8, !tbaa !5
  call void @err_resp(ptr noundef %39, ptr noundef nonnull %2, i32 noundef 500)
  br label %94

40:                                               ; preds = %32
  %41 = load i32, ptr %4, align 4, !tbaa !13
  call void @set_doc_op(ptr noundef nonnull %35, ptr noundef %21, i32 noundef %41)
  %42 = getelementptr inbounds i8, ptr %35, i64 48
  store ptr %0, ptr %42, align 8, !tbaa !14
  %43 = load ptr, ptr @gql_doc_eval_func, align 8, !tbaa !17
  %44 = icmp eq ptr %43, null
  br i1 %44, label %45, label %47

45:                                               ; preds = %40
  %46 = call ptr @gql_doc_eval(ptr noundef nonnull %2, ptr noundef nonnull %35)
  br label %49

47:                                               ; preds = %40
  %48 = call ptr %43(ptr noundef nonnull %2, ptr noundef nonnull %35) #5
  br label %49

49:                                               ; preds = %47, %45
  %.052 = phi ptr [ %46, %45 ], [ %48, %47 ]
  %50 = icmp eq ptr %.052, null
  br i1 %50, label %51, label %57

51:                                               ; preds = %49
  %52 = load i32, ptr %2, align 4, !tbaa !18
  %53 = icmp slt i32 %52, 0
  %54 = sub nsw i32 0, %52
  %spec.select = select i1 %53, i32 %54, i32 500
  store i32 313, ptr %2, align 4, !tbaa !18
  call void @gql_doc_destroy(ptr noundef nonnull %35) #5
  %55 = getelementptr inbounds i8, ptr %0, i64 8
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  call void @err_resp(ptr noundef %56, ptr noundef nonnull %2, i32 noundef %spec.select)
  br label %94

57:                                               ; preds = %49
  %58 = getelementptr inbounds i8, ptr %35, i64 24
  %59 = load ptr, ptr %58, align 8, !tbaa !20
  %60 = getelementptr inbounds i8, ptr %59, i64 40
  %61 = load i32, ptr %60, align 8, !tbaa !21
  %62 = icmp eq i32 %61, 83
  br i1 %62, label %63, label %93

63:                                               ; preds = %57
  %64 = getelementptr inbounds i8, ptr %0, i64 8
  %65 = load ptr, ptr %64, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %65, i64 68
  %67 = load i32, ptr %66, align 4, !tbaa !23
  switch i32 %67, label %69 [
    i32 87, label %68
    i32 83, label %72
  ]

68:                                               ; preds = %63
  br label %72

69:                                               ; preds = %63
  call void @gql_doc_destroy(ptr noundef nonnull %35) #5
  %70 = call i32 (ptr, i32, ptr, ...) @agoo_err_set(ptr noundef nonnull %2, i32 noundef 307, ptr noundef nonnull @.str.12) #5
  %71 = load ptr, ptr %64, align 8, !tbaa !5
  call void @err_resp(ptr noundef %71, ptr noundef nonnull %2, i32 noundef 426)
  br label %94

72:                                               ; preds = %68, %63
  %.048 = phi i32 [ 200, %63 ], [ 101, %68 ]
  %73 = call ptr @gql_object_get(ptr noundef nonnull %.052, ptr noundef nonnull @.str.13) #5
  %74 = icmp eq ptr %73, null
  br i1 %74, label %75, label %78

75:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 260, ptr nonnull %6) #5
  %76 = call i32 (ptr, i32, ptr, ...) @agoo_err_set(ptr noundef nonnull %6, i32 noundef 312, ptr noundef nonnull @.str.14) #5
  %77 = load ptr, ptr %64, align 8, !tbaa !5
  call void @err_resp(ptr noundef %77, ptr noundef nonnull %6, i32 noundef 400)
  call void @gql_doc_destroy(ptr noundef nonnull %35) #5
  call void @llvm.lifetime.end.p0(i64 260, ptr nonnull %6) #5
  br label %94

78:                                               ; preds = %72
  %79 = call ptr @gql_string_get(ptr noundef nonnull %73) #5
  %80 = load ptr, ptr %64, align 8, !tbaa !5
  %81 = getelementptr inbounds i8, ptr %80, i64 68
  %82 = load i32, ptr %81, align 4, !tbaa !23
  %83 = load ptr, ptr %58, align 8, !tbaa !20
  %84 = getelementptr inbounds i8, ptr %83, i64 40
  store i32 81, ptr %84, align 8, !tbaa !21
  %85 = getelementptr inbounds i8, ptr %80, i64 8
  %86 = load ptr, ptr %85, align 8, !tbaa !26
  %87 = call ptr @gql_sub_create(ptr noundef nonnull %2, ptr noundef %86, ptr noundef %79, ptr noundef nonnull %35) #5
  %88 = icmp eq ptr %87, null
  br i1 %88, label %89, label %91

89:                                               ; preds = %78
  %90 = load ptr, ptr %64, align 8, !tbaa !5
  call void @err_resp(ptr noundef %90, ptr noundef nonnull %2, i32 noundef 400)
  br label %94

91:                                               ; preds = %78
  %92 = icmp eq i32 %82, 87
  %spec.select64 = select i1 %92, i32 101, i32 %.048
  call void @agoo_server_add_gsub(ptr noundef nonnull %87) #5
  call void @value_resp(ptr noundef nonnull %0, ptr noundef null, i32 noundef %spec.select64, i32 noundef %.053)
  br label %94

93:                                               ; preds = %57
  call void @gql_doc_destroy(ptr noundef nonnull %35) #5
  call void @value_resp(ptr noundef %0, ptr noundef nonnull %.052, i32 noundef 200, i32 noundef %.053)
  br label %94

94:                                               ; preds = %69, %75, %89, %91, %93, %51, %37, %29, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 260, ptr nonnull %2) #5
  ret void
}

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

; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare hidden void @err_resp(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden ptr @parse_query_vars(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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

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

; Function Attrs: nounwind uwtable
declare hidden void @set_doc_op(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @gql_doc_destroy(ptr noundef) local_unnamed_addr #1

declare ptr @gql_object_get(ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @gql_string_get(ptr noundef) local_unnamed_addr #1

declare ptr @gql_sub_create(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @agoo_server_add_gsub(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @value_resp(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { mustprogress nofree nounwind willreturn "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, !10, i64 8}
!6 = !{!"_agooReq", !7, i64 0, !10, i64 8, !7, i64 16, !10, i64 24, !11, i64 32, !11, i64 48, !11, i64 64, !11, i64 80, !11, i64 96, !8, i64 112, !10, i64 160, !10, i64 168, !12, i64 176, !8, i64 184}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_agooStr", !10, i64 0, !7, i64 8}
!12 = !{!"long", !8, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !10, i64 48}
!15 = !{!"_gqlDoc", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !16, i64 32, !10, i64 48, !10, i64 56, !10, i64 64}
!16 = !{!"_gqlFuncs", !10, i64 0, !10, i64 8}
!17 = !{!10, !10, i64 0}
!18 = !{!19, !7, i64 0}
!19 = !{!"_agooErr", !7, i64 0, !8, i64 4}
!20 = !{!15, !10, i64 24}
!21 = !{!22, !7, i64 40}
!22 = !{!"_gqlOp", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !7, i64 40}
!23 = !{!24, !7, i64 68}
!24 = !{!"_agooRes", !10, i64 0, !10, i64 8, !10, i64 16, !8, i64 24, !25, i64 64, !7, i64 68, !25, i64 72, !25, i64 73, !25, i64 74}
!25 = !{!"_Bool", !8, i64 0}
!26 = !{!24, !10, i64 8}


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