; LLVM IR from marcobambini/gravity :: src/compiler (gravity_optimizer)

; 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.gravity_function_t = type { ptr, %struct.gravity_gc_s, ptr, ptr, i16, i16, i16, i16, i32, %union.anon }
%struct.gravity_gc_s = type { i8, i8, ptr, ptr, ptr, ptr }
%union.anon = type { %struct.anon }
%struct.anon = type { %struct.gravity_value_r, %struct.gravity_value_r, %struct.gravity_value_r, i32, ptr, ptr, float, i8 }
%struct.gravity_value_r = type { i64, i64, ptr }
%struct.inst_t = type { i32, i32, i32, i32, i32, %union.anon.1, i32 }
%union.anon.1 = type { double }

; Function Attrs: nounwind uwtable
define dso_local ptr @gravity_optimizer(ptr noundef %0, i1 noundef zeroext %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i8, align 1
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i8, align 1
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i8, align 1
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca i8, align 1
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  %24 = zext i1 %1 to i8
  store i8 %24, ptr %5, align 1, !tbaa !9
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.gravity_function_t, ptr %25, i32 0, i32 9
  %27 = getelementptr inbounds %struct.anon, ptr %26, i32 0, i32 4
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = icmp eq ptr %28, null
  br i1 %29, label %30, label %32

30:                                               ; preds = %2
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %31, ptr %3, align 8
  br label %255

32:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.gravity_function_t, ptr %33, i32 0, i32 9
  %35 = getelementptr inbounds %struct.anon, ptr %34, i32 0, i32 4
  %36 = load ptr, ptr %35, align 8, !tbaa !11
  store ptr %36, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = call i32 @ircode_count(ptr noundef %37)
  store i32 %38, ptr %7, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #4
  store i8 1, ptr %8, align 1, !tbaa !9
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = call i32 @ircode_ntemps(ptr noundef %39)
  %41 = trunc i32 %40 to i16
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.gravity_function_t, ptr %42, i32 0, i32 6
  store i16 %41, ptr %43, align 4, !tbaa !14
  br label %44

44:                                               ; preds = %81, %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !12
  br label %45

45:                                               ; preds = %78, %44
  %46 = load i32, ptr %9, align 4, !tbaa !12
  %47 = load i32, ptr %7, align 4, !tbaa !12
  %48 = icmp ult i32 %46, %47
  br i1 %48, label %50, label %49

49:                                               ; preds = %45
  store i32 3, ptr %10, align 4
  br label %81

50:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = load i32, ptr %9, align 4, !tbaa !12
  %53 = call ptr @current_instruction(ptr noundef %51, i32 noundef %52)
  store ptr %53, ptr %11, align 8, !tbaa !5
  %54 = load ptr, ptr %11, align 8, !tbaa !5
  %55 = icmp ne ptr %54, null
  br i1 %55, label %56, label %74

56:                                               ; preds = %50
  %57 = load ptr, ptr %11, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.inst_t, ptr %57, i32 0, i32 0
  %59 = load i32, ptr %58, align 8, !tbaa !18
  %60 = icmp eq i32 %59, 37
  br i1 %60, label %61, label %74

61:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #4
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = load ptr, ptr %11, align 8, !tbaa !5
  %64 = load i32, ptr %9, align 4, !tbaa !12
  %65 = call zeroext i1 @optimize_neg_instruction(ptr noundef %62, ptr noundef %63, i32 noundef %64)
  %66 = zext i1 %65 to i8
  store i8 %66, ptr %12, align 1, !tbaa !9
  %67 = load i8, ptr %12, align 1, !tbaa !9, !range !20, !noundef !21
  %68 = trunc i8 %67 to i1
  br i1 %68, label %69, label %70

69:                                               ; preds = %61
  store i32 2, ptr %10, align 4
  br label %71

70:                                               ; preds = %61
  store i32 0, ptr %10, align 4
  br label %71

71:                                               ; preds = %70, %69
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #4
  %72 = load i32, ptr %10, align 4
  switch i32 %72, label %75 [
    i32 0, label %73
  ]

73:                                               ; preds = %71
  br label %74

74:                                               ; preds = %73, %56, %50
  store i32 0, ptr %10, align 4
  br label %75

75:                                               ; preds = %74, %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  %76 = load i32, ptr %10, align 4
  switch i32 %76, label %81 [
    i32 0, label %77
  ]

77:                                               ; preds = %75
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %9, align 4, !tbaa !12
  %80 = add i32 %79, 1
  store i32 %80, ptr %9, align 4, !tbaa !12
  br label %45, !llvm.loop !22

81:                                               ; preds = %75, %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  %82 = load i32, ptr %10, align 4
  switch i32 %82, label %257 [
    i32 3, label %83
    i32 2, label %44
  ]

83:                                               ; preds = %81
  br label %84

84:                                               ; preds = %126, %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !12
  br label %85

85:                                               ; preds = %123, %84
  %86 = load i32, ptr %13, align 4, !tbaa !12
  %87 = load i32, ptr %7, align 4, !tbaa !12
  %88 = icmp ult i32 %86, %87
  br i1 %88, label %90, label %89

89:                                               ; preds = %85
  store i32 7, ptr %10, align 4
  br label %126

90:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %91 = load ptr, ptr %6, align 8, !tbaa !5
  %92 = load i32, ptr %13, align 4, !tbaa !12
  %93 = call ptr @current_instruction(ptr noundef %91, i32 noundef %92)
  store ptr %93, ptr %14, align 8, !tbaa !5
  %94 = load ptr, ptr %14, align 8, !tbaa !5
  %95 = icmp ne ptr %94, null
  br i1 %95, label %96, label %119

96:                                               ; preds = %90
  %97 = load ptr, ptr %14, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.inst_t, ptr %97, i32 0, i32 0
  %99 = load i32, ptr %98, align 8, !tbaa !18
  %100 = icmp uge i32 %99, 20
  br i1 %100, label %101, label %119

101:                                              ; preds = %96
  %102 = load ptr, ptr %14, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.inst_t, ptr %102, i32 0, i32 0
  %104 = load i32, ptr %103, align 8, !tbaa !18
  %105 = icmp ule i32 %104, 24
  br i1 %105, label %106, label %119

106:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #4
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  %108 = load ptr, ptr %14, align 8, !tbaa !5
  %109 = load i32, ptr %13, align 4, !tbaa !12
  %110 = call zeroext i1 @optimize_math_instruction(ptr noundef %107, ptr noundef %108, i32 noundef %109)
  %111 = zext i1 %110 to i8
  store i8 %111, ptr %15, align 1, !tbaa !9
  %112 = load i8, ptr %15, align 1, !tbaa !9, !range !20, !noundef !21
  %113 = trunc i8 %112 to i1
  br i1 %113, label %114, label %115

114:                                              ; preds = %106
  store i32 6, ptr %10, align 4
  br label %116

115:                                              ; preds = %106
  store i32 0, ptr %10, align 4
  br label %116

116:                                              ; preds = %115, %114
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #4
  %117 = load i32, ptr %10, align 4
  switch i32 %117, label %120 [
    i32 0, label %118
  ]

118:                                              ; preds = %116
  br label %119

119:                                              ; preds = %118, %101, %96, %90
  store i32 0, ptr %10, align 4
  br label %120

120:                                              ; preds = %119, %116
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  %121 = load i32, ptr %10, align 4
  switch i32 %121, label %126 [
    i32 0, label %122
  ]

122:                                              ; preds = %120
  br label %123

123:                                              ; preds = %122
  %124 = load i32, ptr %13, align 4, !tbaa !12
  %125 = add i32 %124, 1
  store i32 %125, ptr %13, align 4, !tbaa !12
  br label %85, !llvm.loop !24

126:                                              ; preds = %120, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  %127 = load i32, ptr %10, align 4
  switch i32 %127, label %257 [
    i32 7, label %128
    i32 6, label %84
  ]

128:                                              ; preds = %126
  br label %129

129:                                              ; preds = %183, %128
  store i8 1, ptr %8, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %16, align 4, !tbaa !12
  br label %130

130:                                              ; preds = %180, %129
  %131 = load i32, ptr %16, align 4, !tbaa !12
  %132 = load i32, ptr %7, align 4, !tbaa !12
  %133 = icmp ult i32 %131, %132
  br i1 %133, label %135, label %134

134:                                              ; preds = %130
  store i32 11, ptr %10, align 4
  br label %183

135:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %136 = load ptr, ptr %6, align 8, !tbaa !5
  %137 = load i32, ptr %16, align 4, !tbaa !12
  %138 = call ptr @current_instruction(ptr noundef %136, i32 noundef %137)
  store ptr %138, ptr %17, align 8, !tbaa !5
  %139 = load ptr, ptr %17, align 8, !tbaa !5
  %140 = icmp ne ptr %139, null
  br i1 %140, label %141, label %152

141:                                              ; preds = %135
  %142 = load ptr, ptr %17, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.inst_t, ptr %142, i32 0, i32 1
  %144 = load i32, ptr %143, align 4, !tbaa !25
  %145 = icmp eq i32 %144, 7
  br i1 %145, label %146, label %152

146:                                              ; preds = %141
  %147 = load ptr, ptr %17, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.inst_t, ptr %147, i32 0, i32 2
  %149 = load i32, ptr %148, align 8, !tbaa !26
  %150 = icmp ne i32 %149, 0
  %151 = zext i1 %150 to i8
  store i8 %151, ptr %8, align 1, !tbaa !9
  br label %152

152:                                              ; preds = %146, %141, %135
  %153 = load i8, ptr %8, align 1, !tbaa !9, !range !20, !noundef !21
  %154 = trunc i8 %153 to i1
  br i1 %154, label %155, label %176

155:                                              ; preds = %152
  %156 = load ptr, ptr %17, align 8, !tbaa !5
  %157 = icmp ne ptr %156, null
  br i1 %157, label %158, label %176

158:                                              ; preds = %155
  %159 = load ptr, ptr %17, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.inst_t, ptr %159, i32 0, i32 0
  %161 = load i32, ptr %160, align 8, !tbaa !18
  %162 = icmp eq i32 %161, 12
  br i1 %162, label %163, label %176

163:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #4
  %164 = load ptr, ptr %6, align 8, !tbaa !5
  %165 = load ptr, ptr %17, align 8, !tbaa !5
  %166 = load i32, ptr %16, align 4, !tbaa !12
  %167 = call zeroext i1 @optimize_move_instruction(ptr noundef %164, ptr noundef %165, i32 noundef %166)
  %168 = zext i1 %167 to i8
  store i8 %168, ptr %18, align 1, !tbaa !9
  %169 = load i8, ptr %18, align 1, !tbaa !9, !range !20, !noundef !21
  %170 = trunc i8 %169 to i1
  br i1 %170, label %171, label %172

171:                                              ; preds = %163
  store i32 10, ptr %10, align 4
  br label %173

172:                                              ; preds = %163
  store i32 0, ptr %10, align 4
  br label %173

173:                                              ; preds = %172, %171
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #4
  %174 = load i32, ptr %10, align 4
  switch i32 %174, label %177 [
    i32 0, label %175
  ]

175:                                              ; preds = %173
  br label %176

176:                                              ; preds = %175, %158, %155, %152
  store i32 0, ptr %10, align 4
  br label %177

177:                                              ; preds = %176, %173
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  %178 = load i32, ptr %10, align 4
  switch i32 %178, label %183 [
    i32 0, label %179
  ]

179:                                              ; preds = %177
  br label %180

180:                                              ; preds = %179
  %181 = load i32, ptr %16, align 4, !tbaa !12
  %182 = add i32 %181, 1
  store i32 %182, ptr %16, align 4, !tbaa !12
  br label %130, !llvm.loop !27

183:                                              ; preds = %177, %134
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  %184 = load i32, ptr %10, align 4
  switch i32 %184, label %257 [
    i32 11, label %185
    i32 10, label %129
  ]

185:                                              ; preds = %183
  br label %186

186:                                              ; preds = %223, %185
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  store i32 0, ptr %19, align 4, !tbaa !12
  br label %187

187:                                              ; preds = %220, %186
  %188 = load i32, ptr %19, align 4, !tbaa !12
  %189 = load i32, ptr %7, align 4, !tbaa !12
  %190 = icmp ult i32 %188, %189
  br i1 %190, label %192, label %191

191:                                              ; preds = %187
  store i32 15, ptr %10, align 4
  br label %223

192:                                              ; preds = %187
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %193 = load ptr, ptr %6, align 8, !tbaa !5
  %194 = load i32, ptr %19, align 4, !tbaa !12
  %195 = call ptr @current_instruction(ptr noundef %193, i32 noundef %194)
  store ptr %195, ptr %20, align 8, !tbaa !5
  %196 = load ptr, ptr %20, align 8, !tbaa !5
  %197 = icmp ne ptr %196, null
  br i1 %197, label %198, label %216

198:                                              ; preds = %192
  %199 = load ptr, ptr %20, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.inst_t, ptr %199, i32 0, i32 0
  %201 = load i32, ptr %200, align 8, !tbaa !18
  %202 = icmp eq i32 %201, 3
  br i1 %202, label %203, label %216

203:                                              ; preds = %198
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #4
  %204 = load ptr, ptr %6, align 8, !tbaa !5
  %205 = load ptr, ptr %20, align 8, !tbaa !5
  %206 = load i32, ptr %19, align 4, !tbaa !12
  %207 = call zeroext i1 @optimize_return_instruction(ptr noundef %204, ptr noundef %205, i32 noundef %206)
  %208 = zext i1 %207 to i8
  store i8 %208, ptr %21, align 1, !tbaa !9
  %209 = load i8, ptr %21, align 1, !tbaa !9, !range !20, !noundef !21
  %210 = trunc i8 %209 to i1
  br i1 %210, label %211, label %212

211:                                              ; preds = %203
  store i32 14, ptr %10, align 4
  br label %213

212:                                              ; preds = %203
  store i32 0, ptr %10, align 4
  br label %213

213:                                              ; preds = %212, %211
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #4
  %214 = load i32, ptr %10, align 4
  switch i32 %214, label %217 [
    i32 0, label %215
  ]

215:                                              ; preds = %213
  br label %216

216:                                              ; preds = %215, %198, %192
  store i32 0, ptr %10, align 4
  br label %217

217:                                              ; preds = %216, %213
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  %218 = load i32, ptr %10, align 4
  switch i32 %218, label %223 [
    i32 0, label %219
  ]

219:                                              ; preds = %217
  br label %220

220:                                              ; preds = %219
  %221 = load i32, ptr %19, align 4, !tbaa !12
  %222 = add i32 %221, 1
  store i32 %222, ptr %19, align 4, !tbaa !12
  br label %187, !llvm.loop !28

223:                                              ; preds = %217, %191
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  %224 = load i32, ptr %10, align 4
  switch i32 %224, label %257 [
    i32 15, label %225
    i32 14, label %186
  ]

225:                                              ; preds = %223
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  store i32 0, ptr %22, align 4, !tbaa !12
  br label %226

226:                                              ; preds = %247, %225
  %227 = load i32, ptr %22, align 4, !tbaa !12
  %228 = load i32, ptr %7, align 4, !tbaa !12
  %229 = icmp ult i32 %227, %228
  br i1 %229, label %231, label %230

230:                                              ; preds = %226
  store i32 18, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  br label %250

231:                                              ; preds = %226
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  %232 = load ptr, ptr %6, align 8, !tbaa !5
  %233 = load i32, ptr %22, align 4, !tbaa !12
  %234 = call ptr @current_instruction(ptr noundef %232, i32 noundef %233)
  store ptr %234, ptr %23, align 8, !tbaa !5
  %235 = load ptr, ptr %23, align 8, !tbaa !5
  %236 = icmp ne ptr %235, null
  br i1 %236, label %237, label %246

237:                                              ; preds = %231
  %238 = load ptr, ptr %23, align 8, !tbaa !5
  %239 = getelementptr inbounds %struct.inst_t, ptr %238, i32 0, i32 0
  %240 = load i32, ptr %239, align 8, !tbaa !18
  %241 = icmp eq i32 %240, 10
  br i1 %241, label %242, label %246

242:                                              ; preds = %237
  %243 = load ptr, ptr %23, align 8, !tbaa !5
  %244 = load ptr, ptr %4, align 8, !tbaa !5
  %245 = call zeroext i1 @optimize_num_instruction(ptr noundef %243, ptr noundef %244)
  br label %246

246:                                              ; preds = %242, %237, %231
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  br label %247

247:                                              ; preds = %246
  %248 = load i32, ptr %22, align 4, !tbaa !12
  %249 = add i32 %248, 1
  store i32 %249, ptr %22, align 4, !tbaa !12
  br label %226, !llvm.loop !29

250:                                              ; preds = %230
  %251 = load ptr, ptr %4, align 8, !tbaa !5
  %252 = load i8, ptr %5, align 1, !tbaa !9, !range !20, !noundef !21
  %253 = trunc i8 %252 to i1
  call void @finalize_function(ptr noundef %251, i1 noundef zeroext %253)
  %254 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %254, ptr %3, align 8
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %255

255:                                              ; preds = %250, %30
  %256 = load ptr, ptr %3, align 8
  ret ptr %256

257:                                              ; preds = %223, %183, %126, %81
  unreachable
}

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

declare i32 @ircode_count(ptr noundef) #2

declare i32 @ircode_ntemps(ptr noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @current_instruction(ptr noundef, i32 noundef) #3

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @optimize_neg_instruction(ptr noundef, ptr noundef, i32 noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @optimize_math_instruction(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @optimize_move_instruction(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @optimize_return_instruction(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @optimize_num_instruction(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @finalize_function(ptr noundef, i1 noundef zeroext) #0

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = !{!"_Bool", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !17, i64 68}
!15 = !{!"", !6, i64 0, !16, i64 8, !6, i64 48, !6, i64 56, !17, i64 64, !17, i64 66, !17, i64 68, !17, i64 70, !13, i64 72, !7, i64 80}
!16 = !{!"gravity_gc_s", !10, i64 0, !10, i64 1, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!17 = !{!"short", !7, i64 0}
!18 = !{!19, !13, i64 0}
!19 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !7, i64 24, !13, i64 32}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}
!25 = !{!19, !13, i64 4}
!26 = !{!19, !13, i64 8}
!27 = distinct !{!27, !23}
!28 = distinct !{!28, !23}
!29 = distinct !{!29, !23}


; 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: nounwind uwtable
define dso_local noundef ptr @gravity_optimizer(ptr noundef returned %0, i1 noundef zeroext %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 160
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = icmp eq ptr %4, null
  br i1 %5, label %54, label %6

6:                                                ; preds = %2
  %7 = tail call i32 @ircode_count(ptr noundef nonnull %4) #3
  %8 = tail call i32 @ircode_ntemps(ptr noundef nonnull %4) #3
  %9 = trunc i32 %8 to i16
  %10 = getelementptr inbounds i8, ptr %0, i64 68
  store i16 %9, ptr %10, align 4, !tbaa !8
  %.not133147.not = icmp eq i32 %7, 0
  br i1 %.not133147.not, label %.critedge142._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %6, %.lr.ph.backedge
  %.089148 = phi i32 [ %.089148.be, %.lr.ph.backedge ], [ 0, %6 ]
  %11 = tail call ptr @current_instruction(ptr noundef nonnull %4, i32 noundef %.089148)
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %.thread, label %12

12:                                               ; preds = %.lr.ph
  %13 = load i32, ptr %11, align 8, !tbaa !15
  %14 = icmp eq i32 %13, 37
  br i1 %14, label %15, label %.thread

15:                                               ; preds = %12
  %16 = tail call zeroext i1 @optimize_neg_instruction(ptr noundef nonnull %4, ptr noundef nonnull %11, i32 noundef %.089148)
  br i1 %16, label %.lr.ph.backedge, label %.thread

.thread:                                          ; preds = %15, %12, %.lr.ph
  %17 = add nuw i32 %.089148, 1
  %exitcond.not = icmp eq i32 %17, %7
  br i1 %exitcond.not, label %.critedge, label %.lr.ph.backedge

.lr.ph.backedge:                                  ; preds = %.thread, %15
  %.089148.be = phi i32 [ %17, %.thread ], [ 0, %15 ]
  br label %.lr.ph, !llvm.loop !17

.critedge:                                        ; preds = %.thread, %.critedge.backedge
  %.093151 = phi i32 [ %.093151.be, %.critedge.backedge ], [ 0, %.thread ]
  %18 = tail call ptr @current_instruction(ptr noundef nonnull %4, i32 noundef %.093151)
  %.not102 = icmp eq ptr %18, null
  br i1 %.not102, label %.thread117, label %19

19:                                               ; preds = %.critedge
  %20 = load i32, ptr %18, align 8, !tbaa !15
  %21 = add i32 %20, -20
  %or.cond105 = icmp ult i32 %21, 5
  br i1 %or.cond105, label %22, label %.thread117

22:                                               ; preds = %19
  %23 = tail call zeroext i1 @optimize_math_instruction(ptr noundef nonnull %4, ptr noundef nonnull %18, i32 noundef %.093151)
  br i1 %23, label %.critedge.backedge, label %.thread117

.thread117:                                       ; preds = %22, %19, %.critedge
  %24 = add nuw i32 %.093151, 1
  %exitcond167.not = icmp eq i32 %24, %7
  br i1 %exitcond167.not, label %.critedge138, label %.critedge.backedge

.critedge.backedge:                               ; preds = %.thread117, %22
  %.093151.be = phi i32 [ %24, %.thread117 ], [ 0, %22 ]
  br label %.critedge, !llvm.loop !19

.critedge138:                                     ; preds = %.thread117, %.critedge138.backedge
  %.088155 = phi i1 [ %.088155.be, %.critedge138.backedge ], [ true, %.thread117 ]
  %.094154 = phi i32 [ %.094154.be, %.critedge138.backedge ], [ 0, %.thread117 ]
  %25 = tail call ptr @current_instruction(ptr noundef nonnull %4, i32 noundef %.094154)
  %.not162 = icmp eq ptr %25, null
  br i1 %.not162, label %.thread125, label %26

26:                                               ; preds = %.critedge138
  %27 = getelementptr inbounds i8, ptr %25, i64 4
  %28 = load i32, ptr %27, align 4, !tbaa !20
  %29 = icmp eq i32 %28, 7
  br i1 %29, label %30, label %33

30:                                               ; preds = %26
  %31 = getelementptr inbounds i8, ptr %25, i64 8
  %32 = load i32, ptr %31, align 8, !tbaa !21
  %.not171 = icmp eq i32 %32, 0
  br i1 %.not171, label %.thread125, label %34

33:                                               ; preds = %26
  br i1 %.088155, label %34, label %.thread125

34:                                               ; preds = %30, %33
  %35 = load i32, ptr %25, align 8, !tbaa !15
  %36 = icmp eq i32 %35, 12
  br i1 %36, label %37, label %.thread125

37:                                               ; preds = %34
  %38 = tail call zeroext i1 @optimize_move_instruction(ptr noundef nonnull %4, ptr noundef nonnull %25, i32 noundef %.094154)
  br i1 %38, label %.critedge138.backedge, label %.thread125

.thread125:                                       ; preds = %30, %37, %.critedge138, %33, %34
  %.1123129 = phi i1 [ false, %33 ], [ true, %34 ], [ %.088155, %.critedge138 ], [ true, %37 ], [ false, %30 ]
  %39 = add nuw i32 %.094154, 1
  %exitcond168.not = icmp eq i32 %39, %7
  br i1 %exitcond168.not, label %.critedge140, label %.critedge138.backedge

.critedge138.backedge:                            ; preds = %.thread125, %37
  %.088155.be = phi i1 [ %.1123129, %.thread125 ], [ true, %37 ]
  %.094154.be = phi i32 [ %39, %.thread125 ], [ 0, %37 ]
  br label %.critedge138, !llvm.loop !22

.critedge140:                                     ; preds = %.thread125, %.critedge140.backedge
  %.090158 = phi i32 [ %.090158.be, %.critedge140.backedge ], [ 0, %.thread125 ]
  %40 = tail call ptr @current_instruction(ptr noundef nonnull %4, i32 noundef %.090158)
  %.not103 = icmp eq ptr %40, null
  br i1 %.not103, label %.thread130, label %41

41:                                               ; preds = %.critedge140
  %42 = load i32, ptr %40, align 8, !tbaa !15
  %43 = icmp eq i32 %42, 3
  br i1 %43, label %44, label %.thread130

44:                                               ; preds = %41
  %45 = tail call zeroext i1 @optimize_return_instruction(ptr noundef nonnull %4, ptr noundef nonnull %40, i32 noundef %.090158)
  br i1 %45, label %.critedge140.backedge, label %.thread130

.thread130:                                       ; preds = %44, %41, %.critedge140
  %46 = add nuw i32 %.090158, 1
  %exitcond169.not = icmp eq i32 %46, %7
  br i1 %exitcond169.not, label %.lr.ph161, label %.critedge140.backedge

.critedge140.backedge:                            ; preds = %.thread130, %44
  %.090158.be = phi i32 [ %46, %.thread130 ], [ 0, %44 ]
  br label %.critedge140, !llvm.loop !23

.critedge142._crit_edge:                          ; preds = %.critedge142, %6
  tail call void @finalize_function(ptr noundef %0, i1 noundef zeroext %1)
  br label %54

.lr.ph161:                                        ; preds = %.thread130, %.critedge142
  %.087160 = phi i32 [ %53, %.critedge142 ], [ 0, %.thread130 ]
  %47 = tail call ptr @current_instruction(ptr noundef nonnull %4, i32 noundef %.087160)
  %.not104 = icmp eq ptr %47, null
  br i1 %.not104, label %.critedge142, label %48

48:                                               ; preds = %.lr.ph161
  %49 = load i32, ptr %47, align 8, !tbaa !15
  %50 = icmp eq i32 %49, 10
  br i1 %50, label %51, label %.critedge142

51:                                               ; preds = %48
  %52 = tail call zeroext i1 @optimize_num_instruction(ptr noundef nonnull %47, ptr noundef %0)
  br label %.critedge142

.critedge142:                                     ; preds = %51, %48, %.lr.ph161
  %53 = add nuw i32 %.087160, 1
  %exitcond170.not = icmp eq i32 %53, %7
  br i1 %exitcond170.not, label %.critedge142._crit_edge, label %.lr.ph161, !llvm.loop !24

54:                                               ; preds = %2, %.critedge142._crit_edge
  ret ptr %0
}

declare i32 @ircode_count(ptr noundef) local_unnamed_addr #1

declare i32 @ircode_ntemps(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @optimize_neg_instruction(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @optimize_math_instruction(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @optimize_move_instruction(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @optimize_return_instruction(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @optimize_num_instruction(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @finalize_function(ptr noundef, i1 noundef zeroext) local_unnamed_addr #0

attributes #0 = { 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 = { 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 #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !13, i64 68}
!9 = !{!"", !10, i64 0, !11, i64 8, !10, i64 48, !10, i64 56, !13, i64 64, !13, i64 66, !13, i64 68, !13, i64 70, !14, i64 72, !6, i64 80}
!10 = !{!"any pointer", !6, i64 0}
!11 = !{!"gravity_gc_s", !12, i64 0, !12, i64 1, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!12 = !{!"_Bool", !6, i64 0}
!13 = !{!"short", !6, i64 0}
!14 = !{!"int", !6, i64 0}
!15 = !{!16, !14, i64 0}
!16 = !{!"", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !6, i64 24, !14, i64 32}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = !{!16, !14, i64 4}
!21 = !{!16, !14, i64 8}
!22 = distinct !{!22, !18}
!23 = distinct !{!23, !18}
!24 = distinct !{!24, !18}


; Effective O3 passes: AggressiveInstCombinePass,ConstraintEliminationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass