; LLVM IR from freddiev4/dailyprogrammerchallenges :: Hard Challenges/Challenge 0104 Hard - (Stack Attack)/solutions (solution)

; 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.Operators = type { i8, i32, i32, ptr }
%struct.Token = type { i32, %union.Data_type }
%union.Data_type = type { double }

@operators = external dso_local global [5 x %struct.Operators], align 16

; Function Attrs: nounwind uwtable
declare dso_local void @stack_push(ptr noundef, i8 noundef signext) #0

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

; 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 dso_local signext i8 @stack_pop(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @stack_size(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @deque_push(ptr noundef, i32, i64) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @getOperatorID(i8 noundef signext) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @isAnOperator(i8 noundef signext) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @isFloat(i8 noundef signext) #0

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() #2

; Function Attrs: nounwind uwtable
define dso_local void @eval_expr(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca [255 x i8], align 16
  %8 = alloca %struct.Token, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i8, align 1
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i8, align 1
  %18 = alloca i8, align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 255, ptr %7) #6
  call void @llvm.memset.p0.i64(ptr align 16 %7, i8 0, i64 255, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %226, %3
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = load i32, ptr %12, align 4, !tbaa !9
  %22 = zext i32 %21 to i64
  %23 = getelementptr inbounds i8, ptr %20, i64 %22
  %24 = load i8, ptr %23, align 1, !tbaa !11
  %25 = sext i8 %24 to i32
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %28, label %27

27:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %229

28:                                               ; preds = %19
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = load i32, ptr %12, align 4, !tbaa !9
  %31 = zext i32 %30 to i64
  %32 = getelementptr inbounds i8, ptr %29, i64 %31
  %33 = load i8, ptr %32, align 1, !tbaa !11
  %34 = call i32 @isAnOperator(i8 noundef signext %33)
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %36, label %115

36:                                               ; preds = %28
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = load ptr, ptr %37, align 8, !tbaa !5
  %39 = call i32 @stack_size(ptr noundef %38)
  store i32 %39, ptr %11, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %107, %36
  %41 = load i32, ptr %11, align 4, !tbaa !9
  %42 = add nsw i32 %41, -1
  store i32 %42, ptr %11, align 4, !tbaa !9
  %43 = icmp ne i32 %41, 0
  br i1 %43, label %44, label %108

44:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #6
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = call signext i8 @stack_pop(ptr noundef %45)
  store i8 %46, ptr %14, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %47 = load i8, ptr %14, align 1, !tbaa !11
  %48 = call i32 @getOperatorID(i8 noundef signext %47)
  store i32 %48, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = load i32, ptr %12, align 4, !tbaa !9
  %51 = zext i32 %50 to i64
  %52 = getelementptr inbounds i8, ptr %49, i64 %51
  %53 = load i8, ptr %52, align 1, !tbaa !11
  %54 = call i32 @getOperatorID(i8 noundef signext %53)
  store i32 %54, ptr %16, align 4, !tbaa !9
  %55 = load i32, ptr %16, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [5 x %struct.Operators], ptr @operators, i64 0, i64 %56
  %58 = getelementptr inbounds %struct.Operators, ptr %57, i32 0, i32 2
  %59 = load i32, ptr %58, align 8, !tbaa !12
  %60 = icmp eq i32 %59, 1
  br i1 %60, label %61, label %73

61:                                               ; preds = %44
  %62 = load i32, ptr %16, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [5 x %struct.Operators], ptr @operators, i64 0, i64 %63
  %65 = getelementptr inbounds %struct.Operators, ptr %64, i32 0, i32 1
  %66 = load i32, ptr %65, align 4, !tbaa !14
  %67 = load i32, ptr %15, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [5 x %struct.Operators], ptr @operators, i64 0, i64 %68
  %70 = getelementptr inbounds %struct.Operators, ptr %69, i32 0, i32 1
  %71 = load i32, ptr %70, align 4, !tbaa !14
  %72 = icmp sle i32 %66, %71
  br i1 %72, label %92, label %73

73:                                               ; preds = %61, %44
  %74 = load i32, ptr %16, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [5 x %struct.Operators], ptr @operators, i64 0, i64 %75
  %77 = getelementptr inbounds %struct.Operators, ptr %76, i32 0, i32 2
  %78 = load i32, ptr %77, align 8, !tbaa !12
  %79 = icmp eq i32 %78, 2
  br i1 %79, label %80, label %101

80:                                               ; preds = %73
  %81 = load i32, ptr %16, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [5 x %struct.Operators], ptr @operators, i64 0, i64 %82
  %84 = getelementptr inbounds %struct.Operators, ptr %83, i32 0, i32 1
  %85 = load i32, ptr %84, align 4, !tbaa !14
  %86 = load i32, ptr %15, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [5 x %struct.Operators], ptr @operators, i64 0, i64 %87
  %89 = getelementptr inbounds %struct.Operators, ptr %88, i32 0, i32 1
  %90 = load i32, ptr %89, align 4, !tbaa !14
  %91 = icmp slt i32 %85, %90
  br i1 %91, label %92, label %101

92:                                               ; preds = %80, %61
  %93 = getelementptr inbounds %struct.Token, ptr %8, i32 0, i32 0
  store i32 1, ptr %93, align 8, !tbaa !15
  %94 = load i32, ptr %15, align 4, !tbaa !9
  %95 = getelementptr inbounds %struct.Token, ptr %8, i32 0, i32 1
  store i32 %94, ptr %95, align 8, !tbaa !11
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds { i32, i64 }, ptr %8, i32 0, i32 0
  %98 = load i32, ptr %97, align 8
  %99 = getelementptr inbounds { i32, i64 }, ptr %8, i32 0, i32 1
  %100 = load i64, ptr %99, align 8
  call void @deque_push(ptr noundef %96, i32 %98, i64 %100)
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %101

101:                                              ; preds = %92, %80, %73
  %102 = load i32, ptr %10, align 4, !tbaa !9
  %103 = icmp ne i32 %102, 0
  br i1 %103, label %107, label %104

104:                                              ; preds = %101
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  %106 = load i8, ptr %14, align 1, !tbaa !11
  call void @stack_push(ptr noundef %105, i8 noundef signext %106)
  br label %107

107:                                              ; preds = %104, %101
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #6
  br label %40, !llvm.loop !17

108:                                              ; preds = %40
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = load ptr, ptr %4, align 8, !tbaa !5
  %111 = load i32, ptr %12, align 4, !tbaa !9
  %112 = zext i32 %111 to i64
  %113 = getelementptr inbounds i8, ptr %110, i64 %112
  %114 = load i8, ptr %113, align 1, !tbaa !11
  call void @stack_push(ptr noundef %109, i8 noundef signext %114)
  br label %225

115:                                              ; preds = %28
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = load i32, ptr %12, align 4, !tbaa !9
  %118 = zext i32 %117 to i64
  %119 = getelementptr inbounds i8, ptr %116, i64 %118
  %120 = load i8, ptr %119, align 1, !tbaa !11
  %121 = sext i8 %120 to i32
  %122 = icmp eq i32 %121, 40
  br i1 %122, label %123, label %130

123:                                              ; preds = %115
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  %126 = load i32, ptr %12, align 4, !tbaa !9
  %127 = zext i32 %126 to i64
  %128 = getelementptr inbounds i8, ptr %125, i64 %127
  %129 = load i8, ptr %128, align 1, !tbaa !11
  call void @stack_push(ptr noundef %124, i8 noundef signext %129)
  br label %224

130:                                              ; preds = %115
  %131 = load ptr, ptr %4, align 8, !tbaa !5
  %132 = load i32, ptr %12, align 4, !tbaa !9
  %133 = zext i32 %132 to i64
  %134 = getelementptr inbounds i8, ptr %131, i64 %133
  %135 = load i8, ptr %134, align 1, !tbaa !11
  %136 = sext i8 %135 to i32
  %137 = icmp eq i32 %136, 41
  br i1 %137, label %138, label %160

138:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #6
  br label %139

139:                                              ; preds = %158, %138
  %140 = load ptr, ptr %6, align 8, !tbaa !5
  %141 = call signext i8 @stack_pop(ptr noundef %140)
  store i8 %141, ptr %17, align 1, !tbaa !11
  %142 = sext i8 %141 to i32
  %143 = icmp ne i32 %142, 40
  br i1 %143, label %144, label %159

144:                                              ; preds = %139
  %145 = load i8, ptr %17, align 1, !tbaa !11
  %146 = call i32 @isAnOperator(i8 noundef signext %145)
  %147 = icmp ne i32 %146, 0
  br i1 %147, label %148, label %158

148:                                              ; preds = %144
  %149 = getelementptr inbounds %struct.Token, ptr %8, i32 0, i32 0
  store i32 1, ptr %149, align 8, !tbaa !15
  %150 = load i8, ptr %17, align 1, !tbaa !11
  %151 = call i32 @getOperatorID(i8 noundef signext %150)
  %152 = getelementptr inbounds %struct.Token, ptr %8, i32 0, i32 1
  store i32 %151, ptr %152, align 8, !tbaa !11
  %153 = load ptr, ptr %5, align 8, !tbaa !5
  %154 = getelementptr inbounds { i32, i64 }, ptr %8, i32 0, i32 0
  %155 = load i32, ptr %154, align 8
  %156 = getelementptr inbounds { i32, i64 }, ptr %8, i32 0, i32 1
  %157 = load i64, ptr %156, align 8
  call void @deque_push(ptr noundef %153, i32 %155, i64 %157)
  br label %158

158:                                              ; preds = %148, %144
  br label %139, !llvm.loop !19

159:                                              ; preds = %139
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #6
  br label %223

160:                                              ; preds = %130
  %161 = load ptr, ptr %4, align 8, !tbaa !5
  %162 = load i32, ptr %12, align 4, !tbaa !9
  %163 = zext i32 %162 to i64
  %164 = getelementptr inbounds i8, ptr %161, i64 %163
  %165 = load i8, ptr %164, align 1, !tbaa !11
  %166 = call i32 @isFloat(i8 noundef signext %165)
  %167 = icmp ne i32 %166, 0
  br i1 %167, label %168, label %179

168:                                              ; preds = %160
  %169 = load ptr, ptr %4, align 8, !tbaa !5
  %170 = load i32, ptr %12, align 4, !tbaa !9
  %171 = zext i32 %170 to i64
  %172 = getelementptr inbounds i8, ptr %169, i64 %171
  %173 = load i8, ptr %172, align 1, !tbaa !11
  %174 = load i32, ptr %13, align 4, !tbaa !9
  %175 = zext i32 %174 to i64
  %176 = getelementptr inbounds [255 x i8], ptr %7, i64 0, i64 %175
  store i8 %173, ptr %176, align 1, !tbaa !11
  %177 = load i32, ptr %13, align 4, !tbaa !9
  %178 = add i32 %177, 1
  store i32 %178, ptr %13, align 4, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %222

179:                                              ; preds = %160
  %180 = call ptr @__ctype_b_loc() #7
  %181 = load ptr, ptr %180, align 8, !tbaa !5
  %182 = load ptr, ptr %4, align 8, !tbaa !5
  %183 = load i32, ptr %12, align 4, !tbaa !9
  %184 = zext i32 %183 to i64
  %185 = getelementptr inbounds i8, ptr %182, i64 %184
  %186 = load i8, ptr %185, align 1, !tbaa !11
  %187 = sext i8 %186 to i32
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds i16, ptr %181, i64 %188
  %190 = load i16, ptr %189, align 2, !tbaa !20
  %191 = zext i16 %190 to i32
  %192 = and i32 %191, 1
  %193 = icmp ne i32 %192, 0
  br i1 %193, label %201, label %194

194:                                              ; preds = %179
  %195 = load i32, ptr %12, align 4, !tbaa !9
  %196 = zext i32 %195 to i64
  %197 = load ptr, ptr %4, align 8, !tbaa !5
  %198 = call i64 @strlen(ptr noundef %197) #8
  %199 = sub i64 %198, 1
  %200 = icmp eq i64 %196, %199
  br i1 %200, label %201, label %221

201:                                              ; preds = %194, %179
  %202 = load i32, ptr %9, align 4, !tbaa !9
  %203 = icmp ne i32 %202, 0
  br i1 %203, label %220, label %204

204:                                              ; preds = %201
  %205 = load i32, ptr %13, align 4, !tbaa !9
  %206 = icmp ugt i32 %205, 0
  br i1 %206, label %207, label %220

207:                                              ; preds = %204
  %208 = getelementptr inbounds %struct.Token, ptr %8, i32 0, i32 0
  store i32 2, ptr %208, align 8, !tbaa !15
  %209 = getelementptr inbounds [255 x i8], ptr %7, i64 0, i64 0
  %210 = call double @atof(ptr noundef %209) #8
  %211 = getelementptr inbounds %struct.Token, ptr %8, i32 0, i32 1
  store double %210, ptr %211, align 8, !tbaa !11
  %212 = load ptr, ptr %5, align 8, !tbaa !5
  %213 = getelementptr inbounds { i32, i64 }, ptr %8, i32 0, i32 0
  %214 = load i32, ptr %213, align 8
  %215 = getelementptr inbounds { i32, i64 }, ptr %8, i32 0, i32 1
  %216 = load i64, ptr %215, align 8
  call void @deque_push(ptr noundef %212, i32 %214, i64 %216)
  %217 = getelementptr inbounds [255 x i8], ptr %7, i64 0, i64 0
  %218 = load i32, ptr %13, align 4, !tbaa !9
  %219 = zext i32 %218 to i64
  call void @llvm.memset.p0.i64(ptr align 16 %217, i8 0, i64 %219, i1 false)
  store i32 0, ptr %13, align 4, !tbaa !9
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %220

220:                                              ; preds = %207, %204, %201
  br label %221

221:                                              ; preds = %220, %194
  br label %222

222:                                              ; preds = %221, %168
  br label %223

223:                                              ; preds = %222, %159
  br label %224

224:                                              ; preds = %223, %123
  br label %225

225:                                              ; preds = %224, %108
  br label %226

226:                                              ; preds = %225
  %227 = load i32, ptr %12, align 4, !tbaa !9
  %228 = add i32 %227, 1
  store i32 %228, ptr %12, align 4, !tbaa !9
  br label %19, !llvm.loop !22

229:                                              ; preds = %27
  %230 = load ptr, ptr %6, align 8, !tbaa !5
  %231 = load ptr, ptr %230, align 8, !tbaa !5
  %232 = call i32 @stack_size(ptr noundef %231)
  store i32 %232, ptr %11, align 4, !tbaa !9
  br label %233

233:                                              ; preds = %253, %229
  %234 = load i32, ptr %11, align 4, !tbaa !9
  %235 = add nsw i32 %234, -1
  store i32 %235, ptr %11, align 4, !tbaa !9
  %236 = icmp ne i32 %234, 0
  br i1 %236, label %237, label %254

237:                                              ; preds = %233
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #6
  %238 = load ptr, ptr %6, align 8, !tbaa !5
  %239 = call signext i8 @stack_pop(ptr noundef %238)
  store i8 %239, ptr %18, align 1, !tbaa !11
  %240 = load i8, ptr %18, align 1, !tbaa !11
  %241 = call i32 @isAnOperator(i8 noundef signext %240)
  %242 = icmp ne i32 %241, 0
  br i1 %242, label %243, label %253

243:                                              ; preds = %237
  %244 = getelementptr inbounds %struct.Token, ptr %8, i32 0, i32 0
  store i32 1, ptr %244, align 8, !tbaa !15
  %245 = load i8, ptr %18, align 1, !tbaa !11
  %246 = call i32 @getOperatorID(i8 noundef signext %245)
  %247 = getelementptr inbounds %struct.Token, ptr %8, i32 0, i32 1
  store i32 %246, ptr %247, align 8, !tbaa !11
  %248 = load ptr, ptr %5, align 8, !tbaa !5
  %249 = getelementptr inbounds { i32, i64 }, ptr %8, i32 0, i32 0
  %250 = load i32, ptr %249, align 8
  %251 = getelementptr inbounds { i32, i64 }, ptr %8, i32 0, i32 1
  %252 = load i64, ptr %251, align 8
  call void @deque_push(ptr noundef %248, i32 %250, i64 %252)
  br label %253

253:                                              ; preds = %243, %237
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #6
  br label %233, !llvm.loop !23

254:                                              ; preds = %233
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 255, ptr %7) #6
  ret void
}

; 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 willreturn memory(read)
declare i64 @strlen(ptr noundef) #4

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare double @atof(ptr noundef nonnull) #5

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 = { nounwind willreturn memory(none) "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 willreturn memory(read) "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 = { inlinehint nounwind willreturn memory(read) 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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(none) }
attributes #8 = { nounwind willreturn memory(read) }

!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 = !{!7, !7, i64 0}
!12 = !{!13, !10, i64 8}
!13 = !{!"Operators", !7, i64 0, !10, i64 4, !10, i64 8, !6, i64 16}
!14 = !{!13, !10, i64 4}
!15 = !{!16, !10, i64 0}
!16 = !{!"Token", !10, i64 0, !7, i64 8}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = !{!21, !21, i64 0}
!21 = !{!"short", !7, i64 0}
!22 = distinct !{!22, !18}
!23 = distinct !{!23, !18}


; 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.Operators = type { i8, i32, i32, ptr }

@operators = external dso_local local_unnamed_addr global [5 x %struct.Operators], align 16

; Function Attrs: nounwind uwtable
declare dso_local void @stack_push(ptr noundef, i8 noundef signext) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @stack_pop(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @stack_size(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @deque_push(ptr noundef, i32, i64) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @getOperatorID(i8 noundef signext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @isAnOperator(i8 noundef signext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @isFloat(i8 noundef signext) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @eval_expr(ptr nocapture noundef readonly %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = alloca [255 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 255, ptr nonnull %4) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(255) %4, i8 0, i64 255, i1 false)
  %5 = load i8, ptr %0, align 1, !tbaa !5
  %.not100 = icmp eq i8 %5, 0
  br i1 %.not100, label %._crit_edge107, label %.lr.ph106

._crit_edge107:                                   ; preds = %.loopexit, %3
  %.sroa.1037.0.lcssa = phi double [ undef, %3 ], [ %.sroa.1037.5, %.loopexit ]
  %6 = load ptr, ptr %2, align 8, !tbaa !8
  %7 = tail call i32 @stack_size(ptr noundef %6)
  %.not79109 = icmp eq i32 %7, 0
  br i1 %.not79109, label %._crit_edge113, label %.lr.ph112

.lr.ph106:                                        ; preds = %3, %.loopexit
  %8 = phi i8 [ %83, %.loopexit ], [ %5, %3 ]
  %9 = phi ptr [ %82, %.loopexit ], [ %0, %3 ]
  %10 = phi i64 [ %81, %.loopexit ], [ 0, %3 ]
  %.sroa.1037.0104 = phi double [ %.sroa.1037.5, %.loopexit ], [ undef, %3 ]
  %.0103 = phi i32 [ %.1, %.loopexit ], [ 0, %3 ]
  %.075102 = phi i32 [ %.176, %.loopexit ], [ 0, %3 ]
  %.077101 = phi i32 [ %80, %.loopexit ], [ 0, %3 ]
  %11 = tail call i32 @isAnOperator(i8 noundef signext %8)
  %.not81 = icmp eq i32 %11, 0
  br i1 %.not81, label %42, label %12

12:                                               ; preds = %.lr.ph106
  %13 = load ptr, ptr %2, align 8, !tbaa !8
  %14 = tail call i32 @stack_size(ptr noundef %13)
  %.not8694 = icmp eq i32 %14, 0
  br i1 %.not8694, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %12, %40
  %.in = phi i32 [ %15, %40 ], [ %14, %12 ]
  %.sroa.1037.195 = phi double [ %.sroa.1037.292, %40 ], [ %.sroa.1037.0104, %12 ]
  %15 = add nsw i32 %.in, -1
  %16 = tail call signext i8 @stack_pop(ptr noundef nonnull %2)
  %17 = tail call i32 @getOperatorID(i8 noundef signext %16)
  %18 = load i8, ptr %9, align 1, !tbaa !5
  %19 = tail call i32 @getOperatorID(i8 noundef signext %18)
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [5 x %struct.Operators], ptr @operators, i64 0, i64 %20
  %22 = getelementptr inbounds i8, ptr %21, i64 8
  %23 = load i32, ptr %22, align 8, !tbaa !10
  switch i32 %23, label %.thread [
    i32 1, label %24
    i32 2, label %30
  ]

24:                                               ; preds = %.lr.ph
  %25 = getelementptr inbounds i8, ptr %21, i64 4
  %26 = load i32, ptr %25, align 4, !tbaa !13
  %27 = sext i32 %17 to i64
  %28 = getelementptr inbounds [5 x %struct.Operators], ptr @operators, i64 0, i64 %27, i32 1
  %29 = load i32, ptr %28, align 4, !tbaa !13
  %.not87 = icmp sgt i32 %26, %29
  br i1 %.not87, label %.thread, label %37

30:                                               ; preds = %.lr.ph
  %31 = getelementptr inbounds i8, ptr %21, i64 4
  %32 = load i32, ptr %31, align 4, !tbaa !13
  %33 = sext i32 %17 to i64
  %34 = getelementptr inbounds [5 x %struct.Operators], ptr @operators, i64 0, i64 %33, i32 1
  %35 = load i32, ptr %34, align 4, !tbaa !13
  %36 = icmp slt i32 %32, %35
  br i1 %36, label %37, label %.thread

37:                                               ; preds = %24, %30
  %38 = bitcast double %.sroa.1037.195 to i64
  %.sroa.1037.8.insert.ext = zext i32 %17 to i64
  %.sroa.1037.8.insert.mask = and i64 %38, -4294967296
  %.sroa.1037.8.insert.insert = or disjoint i64 %.sroa.1037.8.insert.mask, %.sroa.1037.8.insert.ext
  %39 = bitcast i64 %.sroa.1037.8.insert.insert to double
  tail call void @deque_push(ptr noundef %1, i32 1, i64 %.sroa.1037.8.insert.insert)
  br label %40

.thread:                                          ; preds = %.lr.ph, %24, %30
  tail call void @stack_push(ptr noundef nonnull %2, i8 noundef signext %16)
  br label %40

40:                                               ; preds = %37, %.thread
  %.sroa.1037.292 = phi double [ %.sroa.1037.195, %.thread ], [ %39, %37 ]
  %.not86 = icmp eq i32 %15, 0
  br i1 %.not86, label %._crit_edge, label %.lr.ph, !llvm.loop !14

._crit_edge:                                      ; preds = %40, %12
  %.sroa.1037.1.lcssa = phi double [ %.sroa.1037.0104, %12 ], [ %.sroa.1037.292, %40 ]
  %41 = load i8, ptr %9, align 1, !tbaa !5
  tail call void @stack_push(ptr noundef nonnull %2, i8 noundef signext %41)
  br label %.loopexit

42:                                               ; preds = %.lr.ph106
  %43 = load i8, ptr %9, align 1, !tbaa !5
  switch i8 %43, label %54 [
    i8 40, label %45
    i8 41, label %.preheader
  ]

.preheader:                                       ; preds = %42
  %44 = tail call signext i8 @stack_pop(ptr noundef %2)
  %.not8496 = icmp eq i8 %44, 40
  br i1 %.not8496, label %.loopexit, label %.lr.ph98

45:                                               ; preds = %42
  tail call void @stack_push(ptr noundef %2, i8 noundef signext 40)
  br label %.loopexit

.lr.ph98:                                         ; preds = %.preheader, %52
  %46 = phi i8 [ %53, %52 ], [ %44, %.preheader ]
  %.sroa.1037.397 = phi double [ %.sroa.1037.4, %52 ], [ %.sroa.1037.0104, %.preheader ]
  %47 = tail call i32 @isAnOperator(i8 noundef signext %46)
  %.not85 = icmp eq i32 %47, 0
  br i1 %.not85, label %52, label %48

48:                                               ; preds = %.lr.ph98
  %49 = tail call i32 @getOperatorID(i8 noundef signext %46)
  %50 = bitcast double %.sroa.1037.397 to i64
  %.sroa.1037.8.insert.ext42 = zext i32 %49 to i64
  %.sroa.1037.8.insert.mask43 = and i64 %50, -4294967296
  %.sroa.1037.8.insert.insert44 = or disjoint i64 %.sroa.1037.8.insert.mask43, %.sroa.1037.8.insert.ext42
  %51 = bitcast i64 %.sroa.1037.8.insert.insert44 to double
  tail call void @deque_push(ptr noundef %1, i32 1, i64 %.sroa.1037.8.insert.insert44)
  br label %52

52:                                               ; preds = %48, %.lr.ph98
  %.sroa.1037.4 = phi double [ %51, %48 ], [ %.sroa.1037.397, %.lr.ph98 ]
  %53 = tail call signext i8 @stack_pop(ptr noundef %2)
  %.not84 = icmp eq i8 %53, 40
  br i1 %.not84, label %.loopexit, label %.lr.ph98, !llvm.loop !16

54:                                               ; preds = %42
  %55 = tail call i32 @isFloat(i8 noundef signext %43)
  %.not82 = icmp eq i32 %55, 0
  br i1 %.not82, label %61, label %56

56:                                               ; preds = %54
  %57 = load i8, ptr %9, align 1, !tbaa !5
  %58 = zext i32 %.075102 to i64
  %59 = getelementptr inbounds [255 x i8], ptr %4, i64 0, i64 %58
  store i8 %57, ptr %59, align 1, !tbaa !5
  %60 = add i32 %.075102, 1
  br label %.loopexit

61:                                               ; preds = %54
  %62 = tail call ptr @__ctype_b_loc() #7
  %63 = load ptr, ptr %62, align 8, !tbaa !8
  %64 = load i8, ptr %9, align 1, !tbaa !5
  %65 = sext i8 %64 to i64
  %66 = getelementptr inbounds i16, ptr %63, i64 %65
  %67 = load i16, ptr %66, align 2, !tbaa !17
  %68 = and i16 %67, 1
  %.not83 = icmp eq i16 %68, 0
  br i1 %.not83, label %69, label %73

69:                                               ; preds = %61
  %70 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #8
  %71 = add i64 %70, -1
  %72 = icmp eq i64 %71, %10
  br i1 %72, label %73, label %.loopexit

73:                                               ; preds = %69, %61
  %74 = icmp eq i32 %.0103, 0
  %75 = icmp ne i32 %.075102, 0
  %or.cond = select i1 %74, i1 %75, i1 false
  br i1 %or.cond, label %76, label %.loopexit

76:                                               ; preds = %73
  %77 = call double @atof(ptr noundef %4) #8
  %78 = bitcast double %77 to i64
  tail call void @deque_push(ptr noundef %1, i32 2, i64 %78)
  %79 = zext i32 %.075102 to i64
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %4, i8 0, i64 %79, i1 false)
  br label %.loopexit

.loopexit:                                        ; preds = %52, %.preheader, %._crit_edge, %69, %76, %73, %56, %45
  %.176 = phi i32 [ %.075102, %._crit_edge ], [ %.075102, %45 ], [ %60, %56 ], [ 0, %76 ], [ %.075102, %73 ], [ %.075102, %69 ], [ %.075102, %.preheader ], [ %.075102, %52 ]
  %.1 = phi i32 [ %.0103, %._crit_edge ], [ %.0103, %45 ], [ 0, %56 ], [ 1, %76 ], [ %.0103, %73 ], [ %.0103, %69 ], [ %.0103, %.preheader ], [ %.0103, %52 ]
  %.sroa.1037.5 = phi double [ %.sroa.1037.1.lcssa, %._crit_edge ], [ %.sroa.1037.0104, %45 ], [ %.sroa.1037.0104, %56 ], [ %77, %76 ], [ %.sroa.1037.0104, %73 ], [ %.sroa.1037.0104, %69 ], [ %.sroa.1037.0104, %.preheader ], [ %.sroa.1037.4, %52 ]
  %80 = add i32 %.077101, 1
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds i8, ptr %0, i64 %81
  %83 = load i8, ptr %82, align 1, !tbaa !5
  %.not = icmp eq i8 %83, 0
  br i1 %.not, label %._crit_edge107, label %.lr.ph106, !llvm.loop !19

.lr.ph112:                                        ; preds = %._crit_edge107, %91
  %.in114 = phi i32 [ %84, %91 ], [ %7, %._crit_edge107 ]
  %.sroa.1037.6110 = phi double [ %.sroa.1037.7, %91 ], [ %.sroa.1037.0.lcssa, %._crit_edge107 ]
  %84 = add nsw i32 %.in114, -1
  %85 = tail call signext i8 @stack_pop(ptr noundef nonnull %2)
  %86 = tail call i32 @isAnOperator(i8 noundef signext %85)
  %.not80 = icmp eq i32 %86, 0
  br i1 %.not80, label %91, label %87

87:                                               ; preds = %.lr.ph112
  %88 = tail call i32 @getOperatorID(i8 noundef signext %85)
  %89 = bitcast double %.sroa.1037.6110 to i64
  %.sroa.1037.8.insert.ext46 = zext i32 %88 to i64
  %.sroa.1037.8.insert.mask47 = and i64 %89, -4294967296
  %.sroa.1037.8.insert.insert48 = or disjoint i64 %.sroa.1037.8.insert.mask47, %.sroa.1037.8.insert.ext46
  %90 = bitcast i64 %.sroa.1037.8.insert.insert48 to double
  tail call void @deque_push(ptr noundef %1, i32 1, i64 %.sroa.1037.8.insert.insert48)
  br label %91

91:                                               ; preds = %87, %.lr.ph112
  %.sroa.1037.7 = phi double [ %90, %87 ], [ %.sroa.1037.6110, %.lr.ph112 ]
  %.not79 = icmp eq i32 %84, 0
  br i1 %.not79, label %._crit_edge113, label %.lr.ph112, !llvm.loop !20

._crit_edge113:                                   ; preds = %91, %._crit_edge107
  call void @llvm.lifetime.end.p0(i64 255, ptr nonnull %4) #6
  ret void
}

; 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: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare double @atof(ptr nocapture noundef nonnull) local_unnamed_addr #5

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

!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, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !12, i64 8}
!11 = !{!"Operators", !6, i64 0, !12, i64 4, !12, i64 8, !9, i64 16}
!12 = !{!"int", !6, i64 0}
!13 = !{!11, !12, i64 4}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = !{!18, !18, i64 0}
!18 = !{!"short", !6, i64 0}
!19 = distinct !{!19, !15}
!20 = distinct !{!20, !15}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass