; LLVM IR from haytham-hammioui/CS50x-2024 :: Week 5 Data Structures/Problem set 5/speller (speller)

; 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.rusage = type { %struct.timeval, %struct.timeval, %union.anon, %union.anon.0, %union.anon.1, %union.anon.2, %union.anon.3, %union.anon.4, %union.anon.5, %union.anon.6, %union.anon.7, %union.anon.8, %union.anon.9, %union.anon.10, %union.anon.11, %union.anon.12 }
%struct.timeval = type { i64, i64 }
%union.anon = type { i64 }
%union.anon.0 = type { i64 }
%union.anon.1 = type { i64 }
%union.anon.2 = type { i64 }
%union.anon.3 = type { i64 }
%union.anon.4 = type { i64 }
%union.anon.5 = type { i64 }
%union.anon.6 = type { i64 }
%union.anon.7 = type { i64 }
%union.anon.8 = type { i64 }
%union.anon.9 = type { i64 }
%union.anon.10 = type { i64 }
%union.anon.11 = type { i64 }
%union.anon.12 = type { i64 }

@.str = external hidden unnamed_addr constant [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [29 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca %struct.rusage, align 8
  %7 = alloca %struct.rusage, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i8, align 1
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca [46 x i8], align 16
  %21 = alloca i8, align 1
  %22 = alloca i8, align 1
  %23 = alloca i32, align 4
  %24 = alloca i8, align 1
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = icmp ne i32 %25, 2
  br i1 %26, label %27, label %32

27:                                               ; preds = %2
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = icmp ne i32 %28, 3
  br i1 %29, label %30, label %32

30:                                               ; preds = %27
  %31 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  store i32 1, ptr %3, align 4
  br label %242

32:                                               ; preds = %27, %2
  call void @llvm.lifetime.start.p0(i64 144, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 144, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store double 0.000000e+00, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store double 0.000000e+00, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store double 0.000000e+00, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store double 0.000000e+00, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = icmp eq i32 %33, 3
  br i1 %34, label %35, label %39

35:                                               ; preds = %32
  %36 = load ptr, ptr %5, align 8, !tbaa !9
  %37 = getelementptr inbounds ptr, ptr %36, i64 1
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  br label %40

39:                                               ; preds = %32
  br label %40

40:                                               ; preds = %39, %35
  %41 = phi ptr [ %38, %35 ], [ @.str.1, %39 ]
  store ptr %41, ptr %12, align 8, !tbaa !9
  %42 = call i32 @getrusage(i32 noundef 0, ptr noundef %6) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #5
  %43 = load ptr, ptr %12, align 8, !tbaa !9
  %44 = call zeroext i1 @load(ptr noundef %43)
  %45 = zext i1 %44 to i8
  store i8 %45, ptr %13, align 1, !tbaa !13
  %46 = call i32 @getrusage(i32 noundef 0, ptr noundef %7) #5
  %47 = load i8, ptr %13, align 1, !tbaa !13, !range !15, !noundef !16
  %48 = trunc i8 %47 to i1
  br i1 %48, label %52, label %49

49:                                               ; preds = %40
  %50 = load ptr, ptr %12, align 8, !tbaa !9
  %51 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %50)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %241

52:                                               ; preds = %40
  %53 = call double @calculate(ptr noundef %6, ptr noundef %7)
  store double %53, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = icmp eq i32 %54, 3
  br i1 %55, label %56, label %60

56:                                               ; preds = %52
  %57 = load ptr, ptr %5, align 8, !tbaa !9
  %58 = getelementptr inbounds ptr, ptr %57, i64 2
  %59 = load ptr, ptr %58, align 8, !tbaa !9
  br label %64

60:                                               ; preds = %52
  %61 = load ptr, ptr %5, align 8, !tbaa !9
  %62 = getelementptr inbounds ptr, ptr %61, i64 1
  %63 = load ptr, ptr %62, align 8, !tbaa !9
  br label %64

64:                                               ; preds = %60, %56
  %65 = phi ptr [ %59, %56 ], [ %63, %60 ]
  store ptr %65, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %66 = load ptr, ptr %15, align 8, !tbaa !9
  %67 = call noalias ptr @fopen(ptr noundef %66, ptr noundef @.str.3)
  store ptr %67, ptr %16, align 8, !tbaa !9
  %68 = load ptr, ptr %16, align 8, !tbaa !9
  %69 = icmp eq ptr %68, null
  br i1 %69, label %70, label %74

70:                                               ; preds = %64
  %71 = load ptr, ptr %15, align 8, !tbaa !9
  %72 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef %71)
  %73 = call zeroext i1 @unload()
  store i32 1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %240

74:                                               ; preds = %64
  %75 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 0, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  store i32 0, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 46, ptr %20) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #5
  br label %76

76:                                               ; preds = %187, %74
  %77 = load ptr, ptr %16, align 8, !tbaa !9
  %78 = call i64 @fread(ptr noundef %21, i64 noundef 1, i64 noundef 1, ptr noundef %77)
  %79 = icmp ne i64 %78, 0
  br i1 %79, label %80, label %188

80:                                               ; preds = %76
  %81 = call ptr @__ctype_b_loc() #6
  %82 = load ptr, ptr %81, align 8, !tbaa !9
  %83 = load i8, ptr %21, align 1, !tbaa !17
  %84 = sext i8 %83 to i32
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds i16, ptr %82, i64 %85
  %87 = load i16, ptr %86, align 2, !tbaa !18
  %88 = zext i16 %87 to i32
  %89 = and i32 %88, 1024
  %90 = icmp ne i32 %89, 0
  br i1 %90, label %98, label %91

91:                                               ; preds = %80
  %92 = load i8, ptr %21, align 1, !tbaa !17
  %93 = sext i8 %92 to i32
  %94 = icmp eq i32 %93, 39
  br i1 %94, label %95, label %128

95:                                               ; preds = %91
  %96 = load i32, ptr %17, align 4, !tbaa !5
  %97 = icmp sgt i32 %96, 0
  br i1 %97, label %98, label %128

98:                                               ; preds = %95, %80
  %99 = load i8, ptr %21, align 1, !tbaa !17
  %100 = load i32, ptr %17, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [46 x i8], ptr %20, i64 0, i64 %101
  store i8 %99, ptr %102, align 1, !tbaa !17
  %103 = load i32, ptr %17, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %17, align 4, !tbaa !5
  %105 = load i32, ptr %17, align 4, !tbaa !5
  %106 = icmp sgt i32 %105, 45
  br i1 %106, label %107, label %127

107:                                              ; preds = %98
  br label %108

108:                                              ; preds = %125, %107
  %109 = load ptr, ptr %16, align 8, !tbaa !9
  %110 = call i64 @fread(ptr noundef %21, i64 noundef 1, i64 noundef 1, ptr noundef %109)
  %111 = icmp ne i64 %110, 0
  br i1 %111, label %112, label %123

112:                                              ; preds = %108
  %113 = call ptr @__ctype_b_loc() #6
  %114 = load ptr, ptr %113, align 8, !tbaa !9
  %115 = load i8, ptr %21, align 1, !tbaa !17
  %116 = sext i8 %115 to i32
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds i16, ptr %114, i64 %117
  %119 = load i16, ptr %118, align 2, !tbaa !18
  %120 = zext i16 %119 to i32
  %121 = and i32 %120, 1024
  %122 = icmp ne i32 %121, 0
  br label %123

123:                                              ; preds = %112, %108
  %124 = phi i1 [ false, %108 ], [ %122, %112 ]
  br i1 %124, label %125, label %126

125:                                              ; preds = %123
  br label %108, !llvm.loop !20

126:                                              ; preds = %123
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %127

127:                                              ; preds = %126, %98
  br label %187

128:                                              ; preds = %95, %91
  %129 = call ptr @__ctype_b_loc() #6
  %130 = load ptr, ptr %129, align 8, !tbaa !9
  %131 = load i8, ptr %21, align 1, !tbaa !17
  %132 = sext i8 %131 to i32
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds i16, ptr %130, i64 %133
  %135 = load i16, ptr %134, align 2, !tbaa !18
  %136 = zext i16 %135 to i32
  %137 = and i32 %136, 2048
  %138 = icmp ne i32 %137, 0
  br i1 %138, label %139, label %159

139:                                              ; preds = %128
  br label %140

140:                                              ; preds = %157, %139
  %141 = load ptr, ptr %16, align 8, !tbaa !9
  %142 = call i64 @fread(ptr noundef %21, i64 noundef 1, i64 noundef 1, ptr noundef %141)
  %143 = icmp ne i64 %142, 0
  br i1 %143, label %144, label %155

144:                                              ; preds = %140
  %145 = call ptr @__ctype_b_loc() #6
  %146 = load ptr, ptr %145, align 8, !tbaa !9
  %147 = load i8, ptr %21, align 1, !tbaa !17
  %148 = sext i8 %147 to i32
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds i16, ptr %146, i64 %149
  %151 = load i16, ptr %150, align 2, !tbaa !18
  %152 = zext i16 %151 to i32
  %153 = and i32 %152, 8
  %154 = icmp ne i32 %153, 0
  br label %155

155:                                              ; preds = %144, %140
  %156 = phi i1 [ false, %140 ], [ %154, %144 ]
  br i1 %156, label %157, label %158

157:                                              ; preds = %155
  br label %140, !llvm.loop !22

158:                                              ; preds = %155
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %186

159:                                              ; preds = %128
  %160 = load i32, ptr %17, align 4, !tbaa !5
  %161 = icmp sgt i32 %160, 0
  br i1 %161, label %162, label %185

162:                                              ; preds = %159
  %163 = load i32, ptr %17, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [46 x i8], ptr %20, i64 0, i64 %164
  store i8 0, ptr %165, align 1, !tbaa !17
  %166 = load i32, ptr %19, align 4, !tbaa !5
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %19, align 4, !tbaa !5
  %168 = call i32 @getrusage(i32 noundef 0, ptr noundef %6) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %22) #5
  %169 = getelementptr inbounds [46 x i8], ptr %20, i64 0, i64 0
  %170 = call zeroext i1 @check(ptr noundef %169)
  %171 = xor i1 %170, true
  %172 = zext i1 %171 to i8
  store i8 %172, ptr %22, align 1, !tbaa !13
  %173 = call i32 @getrusage(i32 noundef 0, ptr noundef %7) #5
  %174 = call double @calculate(ptr noundef %6, ptr noundef %7)
  %175 = load double, ptr %9, align 8, !tbaa !11
  %176 = fadd double %175, %174
  store double %176, ptr %9, align 8, !tbaa !11
  %177 = load i8, ptr %22, align 1, !tbaa !13, !range !15, !noundef !16
  %178 = trunc i8 %177 to i1
  br i1 %178, label %179, label %184

179:                                              ; preds = %162
  %180 = getelementptr inbounds [46 x i8], ptr %20, i64 0, i64 0
  %181 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, ptr noundef %180)
  %182 = load i32, ptr %18, align 4, !tbaa !5
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %18, align 4, !tbaa !5
  br label %184

184:                                              ; preds = %179, %162
  store i32 0, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 1, ptr %22) #5
  br label %185

185:                                              ; preds = %184, %159
  br label %186

186:                                              ; preds = %185, %158
  br label %187

187:                                              ; preds = %186, %127
  br label %76, !llvm.loop !23

188:                                              ; preds = %76
  %189 = load ptr, ptr %16, align 8, !tbaa !9
  %190 = call i32 @ferror(ptr noundef %189) #5
  %191 = icmp ne i32 %190, 0
  br i1 %191, label %192, label %198

192:                                              ; preds = %188
  %193 = load ptr, ptr %16, align 8, !tbaa !9
  %194 = call i32 @fclose(ptr noundef %193)
  %195 = load ptr, ptr %15, align 8, !tbaa !9
  %196 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, ptr noundef %195)
  %197 = call zeroext i1 @unload()
  store i32 1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %239

198:                                              ; preds = %188
  %199 = load ptr, ptr %16, align 8, !tbaa !9
  %200 = call i32 @fclose(ptr noundef %199)
  %201 = call i32 @getrusage(i32 noundef 0, ptr noundef %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  %202 = call i32 @size()
  store i32 %202, ptr %23, align 4, !tbaa !5
  %203 = call i32 @getrusage(i32 noundef 0, ptr noundef %7) #5
  %204 = call double @calculate(ptr noundef %6, ptr noundef %7)
  store double %204, ptr %10, align 8, !tbaa !11
  %205 = call i32 @getrusage(i32 noundef 0, ptr noundef %6) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %24) #5
  %206 = call zeroext i1 @unload()
  %207 = zext i1 %206 to i8
  store i8 %207, ptr %24, align 1, !tbaa !13
  %208 = call i32 @getrusage(i32 noundef 0, ptr noundef %7) #5
  %209 = load i8, ptr %24, align 1, !tbaa !13, !range !15, !noundef !16
  %210 = trunc i8 %209 to i1
  br i1 %210, label %214, label %211

211:                                              ; preds = %198
  %212 = load ptr, ptr %12, align 8, !tbaa !9
  %213 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, ptr noundef %212)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %238

214:                                              ; preds = %198
  %215 = call double @calculate(ptr noundef %6, ptr noundef %7)
  store double %215, ptr %11, align 8, !tbaa !11
  %216 = load i32, ptr %18, align 4, !tbaa !5
  %217 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, i32 noundef %216)
  %218 = load i32, ptr %23, align 4, !tbaa !5
  %219 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, i32 noundef %218)
  %220 = load i32, ptr %19, align 4, !tbaa !5
  %221 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, i32 noundef %220)
  %222 = load double, ptr %8, align 8, !tbaa !11
  %223 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, double noundef %222)
  %224 = load double, ptr %9, align 8, !tbaa !11
  %225 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, double noundef %224)
  %226 = load double, ptr %10, align 8, !tbaa !11
  %227 = call i32 (ptr, ...) @printf(ptr noundef @.str.14, double noundef %226)
  %228 = load double, ptr %11, align 8, !tbaa !11
  %229 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, double noundef %228)
  %230 = load double, ptr %8, align 8, !tbaa !11
  %231 = load double, ptr %9, align 8, !tbaa !11
  %232 = fadd double %230, %231
  %233 = load double, ptr %10, align 8, !tbaa !11
  %234 = fadd double %232, %233
  %235 = load double, ptr %11, align 8, !tbaa !11
  %236 = fadd double %234, %235
  %237 = call i32 (ptr, ...) @printf(ptr noundef @.str.16, double noundef %236)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %238

238:                                              ; preds = %214, %211
  call void @llvm.lifetime.end.p0(i64 1, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  br label %239

239:                                              ; preds = %238, %192
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 46, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %240

240:                                              ; preds = %239, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %241

241:                                              ; preds = %240, %49
  call void @llvm.lifetime.end.p0(i64 1, 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 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 144, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 144, ptr %6) #5
  br label %242

242:                                              ; preds = %241, %30
  %243 = load i32, ptr %3, align 4
  ret i32 %243
}

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

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

; Function Attrs: nounwind
declare i32 @getrusage(i32 noundef, ptr noundef) #3

declare zeroext i1 @load(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local double @calculate(ptr noundef, ptr noundef) #0

declare noalias ptr @fopen(ptr noundef, ptr noundef) #1

declare zeroext i1 @unload() #1

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #1

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

declare zeroext i1 @check(ptr noundef) #1

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

; Function Attrs: nounwind
declare i32 @ferror(ptr noundef) #3

declare i32 @fclose(ptr noundef) #1

declare i32 @size() #1

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(none) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!7, !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"short", !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = distinct !{!23, !21}


; 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.rusage = type { %struct.timeval, %struct.timeval, %union.anon, %union.anon.0, %union.anon.1, %union.anon.2, %union.anon.3, %union.anon.4, %union.anon.5, %union.anon.6, %union.anon.7, %union.anon.8, %union.anon.9, %union.anon.10, %union.anon.11, %union.anon.12 }
%struct.timeval = type { i64, i64 }
%union.anon = type { i64 }
%union.anon.0 = type { i64 }
%union.anon.1 = type { i64 }
%union.anon.2 = type { i64 }
%union.anon.3 = type { i64 }
%union.anon.4 = type { i64 }
%union.anon.5 = type { i64 }
%union.anon.6 = type { i64 }
%union.anon.7 = type { i64 }
%union.anon.8 = type { i64 }
%union.anon.9 = type { i64 }
%union.anon.10 = type { i64 }
%union.anon.11 = type { i64 }
%union.anon.12 = type { i64 }

@.str = external hidden unnamed_addr constant [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [29 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca %struct.rusage, align 8
  %4 = alloca %struct.rusage, align 8
  %5 = alloca [46 x i8], align 16
  %6 = alloca i8, align 1
  %7 = add i32 %0, -4
  %or.cond = icmp ult i32 %7, -2
  br i1 %or.cond, label %8, label %10

8:                                                ; preds = %2
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  br label %112

10:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %4) #7
  %11 = icmp eq i32 %0, 3
  br i1 %11, label %12, label %15

12:                                               ; preds = %10
  %13 = getelementptr inbounds i8, ptr %1, i64 8
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %10, %12
  %16 = phi ptr [ %14, %12 ], [ @.str.1, %10 ]
  %17 = call i32 @getrusage(i32 noundef 0, ptr noundef nonnull %3) #7
  %18 = call zeroext i1 @load(ptr noundef %16) #7
  %19 = call i32 @getrusage(i32 noundef 0, ptr noundef nonnull %4) #7
  br i1 %18, label %22, label %20

20:                                               ; preds = %15
  %21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef %16)
  br label %111

22:                                               ; preds = %15
  %23 = call double @calculate(ptr noundef nonnull %3, ptr noundef nonnull %4)
  %.in.v = select i1 %11, i64 16, i64 8
  %.in = getelementptr inbounds i8, ptr %1, i64 %.in.v
  %24 = load ptr, ptr %.in, align 8, !tbaa !5
  %25 = call noalias ptr @fopen(ptr noundef %24, ptr noundef nonnull @.str.3)
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %30

27:                                               ; preds = %22
  %28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef %24)
  %29 = call zeroext i1 @unload() #7
  br label %111

30:                                               ; preds = %22
  %31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  call void @llvm.lifetime.start.p0(i64 46, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #7
  %32 = call i64 @fread(ptr noundef nonnull %6, i64 noundef 1, i64 noundef 1, ptr noundef nonnull %25)
  %.not68 = icmp eq i64 %32, 0
  br i1 %.not68, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %30
  %33 = tail call ptr @__ctype_b_loc() #8
  br label %34

34:                                               ; preds = %.lr.ph, %.critedge
  %.04872 = phi double [ 0.000000e+00, %.lr.ph ], [ %.149, %.critedge ]
  %.05071 = phi i32 [ 0, %.lr.ph ], [ %.151, %.critedge ]
  %.05270 = phi i32 [ 0, %.lr.ph ], [ %.254, %.critedge ]
  %.05569 = phi i32 [ 0, %.lr.ph ], [ %.156, %.critedge ]
  %35 = load ptr, ptr %33, align 8, !tbaa !5
  %36 = load i8, ptr %6, align 1, !tbaa !9
  %37 = sext i8 %36 to i64
  %38 = getelementptr inbounds i16, ptr %35, i64 %37
  %39 = load i16, ptr %38, align 2, !tbaa !10
  %40 = zext i16 %39 to i32
  %41 = and i32 %40, 1024
  %.not60 = icmp eq i32 %41, 0
  br i1 %.not60, label %42, label %45

42:                                               ; preds = %34
  %43 = icmp eq i8 %36, 39
  %44 = icmp sgt i32 %.05569, 0
  %or.cond3 = select i1 %43, i1 %44, i1 false
  br i1 %or.cond3, label %45, label %58

45:                                               ; preds = %42, %34
  %46 = sext i32 %.05569 to i64
  %47 = getelementptr inbounds [46 x i8], ptr %5, i64 0, i64 %46
  store i8 %36, ptr %47, align 1, !tbaa !9
  %48 = add nsw i32 %.05569, 1
  %49 = icmp sgt i32 %.05569, 44
  br i1 %49, label %.preheader, label %.critedge

.preheader:                                       ; preds = %45, %51
  %50 = call i64 @fread(ptr noundef nonnull %6, i64 noundef 1, i64 noundef 1, ptr noundef nonnull %25)
  %.not64 = icmp eq i64 %50, 0
  br i1 %.not64, label %.critedge, label %51

51:                                               ; preds = %.preheader
  %52 = load ptr, ptr %33, align 8, !tbaa !5
  %53 = load i8, ptr %6, align 1, !tbaa !9
  %54 = sext i8 %53 to i64
  %55 = getelementptr inbounds i16, ptr %52, i64 %54
  %56 = load i16, ptr %55, align 2, !tbaa !10
  %57 = and i16 %56, 1024
  %.not65 = icmp eq i16 %57, 0
  br i1 %.not65, label %.critedge, label %.preheader, !llvm.loop !12

58:                                               ; preds = %42
  %59 = and i32 %40, 2048
  %.not61 = icmp eq i32 %59, 0
  br i1 %.not61, label %68, label %.preheader66

.preheader66:                                     ; preds = %58, %61
  %60 = call i64 @fread(ptr noundef nonnull %6, i64 noundef 1, i64 noundef 1, ptr noundef nonnull %25)
  %.not62 = icmp eq i64 %60, 0
  br i1 %.not62, label %.critedge, label %61

61:                                               ; preds = %.preheader66
  %62 = load ptr, ptr %33, align 8, !tbaa !5
  %63 = load i8, ptr %6, align 1, !tbaa !9
  %64 = sext i8 %63 to i64
  %65 = getelementptr inbounds i16, ptr %62, i64 %64
  %66 = load i16, ptr %65, align 2, !tbaa !10
  %67 = and i16 %66, 8
  %.not63 = icmp eq i16 %67, 0
  br i1 %.not63, label %.critedge, label %.preheader66, !llvm.loop !14

68:                                               ; preds = %58
  br i1 %44, label %69, label %.critedge

69:                                               ; preds = %68
  %70 = zext nneg i32 %.05569 to i64
  %71 = getelementptr inbounds [46 x i8], ptr %5, i64 0, i64 %70
  store i8 0, ptr %71, align 1, !tbaa !9
  %72 = add nsw i32 %.05071, 1
  %73 = call i32 @getrusage(i32 noundef 0, ptr noundef nonnull %3) #7
  %74 = call zeroext i1 @check(ptr noundef nonnull %5) #7
  %75 = call i32 @getrusage(i32 noundef 0, ptr noundef nonnull %4) #7
  %76 = call double @calculate(ptr noundef nonnull %3, ptr noundef nonnull %4)
  %77 = fadd double %.04872, %76
  br i1 %74, label %.critedge, label %78

78:                                               ; preds = %69
  %79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, ptr noundef nonnull %5)
  %80 = add nsw i32 %.05270, 1
  br label %.critedge

.critedge:                                        ; preds = %61, %.preheader66, %51, %.preheader, %69, %78, %68, %45
  %.156 = phi i32 [ %48, %45 ], [ %.05569, %68 ], [ 0, %78 ], [ 0, %69 ], [ 0, %.preheader ], [ 0, %51 ], [ 0, %.preheader66 ], [ 0, %61 ]
  %.254 = phi i32 [ %.05270, %45 ], [ %.05270, %68 ], [ %80, %78 ], [ %.05270, %69 ], [ %.05270, %.preheader ], [ %.05270, %51 ], [ %.05270, %.preheader66 ], [ %.05270, %61 ]
  %.151 = phi i32 [ %.05071, %45 ], [ %.05071, %68 ], [ %72, %78 ], [ %72, %69 ], [ %.05071, %.preheader ], [ %.05071, %51 ], [ %.05071, %.preheader66 ], [ %.05071, %61 ]
  %.149 = phi double [ %.04872, %45 ], [ %.04872, %68 ], [ %77, %78 ], [ %77, %69 ], [ %.04872, %.preheader ], [ %.04872, %51 ], [ %.04872, %.preheader66 ], [ %.04872, %61 ]
  %81 = call i64 @fread(ptr noundef nonnull %6, i64 noundef 1, i64 noundef 1, ptr noundef nonnull %25)
  %.not = icmp eq i64 %81, 0
  br i1 %.not, label %._crit_edge, label %34, !llvm.loop !15

._crit_edge:                                      ; preds = %.critedge, %30
  %.052.lcssa = phi i32 [ 0, %30 ], [ %.254, %.critedge ]
  %.050.lcssa = phi i32 [ 0, %30 ], [ %.151, %.critedge ]
  %.048.lcssa = phi double [ 0.000000e+00, %30 ], [ %.149, %.critedge ]
  %82 = call i32 @ferror(ptr noundef nonnull %25) #7
  %.not59 = icmp eq i32 %82, 0
  %83 = call i32 @fclose(ptr noundef nonnull %25)
  br i1 %.not59, label %87, label %84

84:                                               ; preds = %._crit_edge
  %85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, ptr noundef %24)
  %86 = call zeroext i1 @unload() #7
  br label %110

87:                                               ; preds = %._crit_edge
  %88 = call i32 @getrusage(i32 noundef 0, ptr noundef nonnull %3) #7
  %89 = call i32 @size() #7
  %90 = call i32 @getrusage(i32 noundef 0, ptr noundef nonnull %4) #7
  %91 = call double @calculate(ptr noundef nonnull %3, ptr noundef nonnull %4)
  %92 = call i32 @getrusage(i32 noundef 0, ptr noundef nonnull %3) #7
  %93 = call zeroext i1 @unload() #7
  %94 = call i32 @getrusage(i32 noundef 0, ptr noundef nonnull %4) #7
  br i1 %93, label %97, label %95

95:                                               ; preds = %87
  %96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef %16)
  br label %110

97:                                               ; preds = %87
  %98 = call double @calculate(ptr noundef nonnull %3, ptr noundef nonnull %4)
  %99 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i32 noundef %.052.lcssa)
  %100 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, i32 noundef %89)
  %101 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, i32 noundef %.050.lcssa)
  %102 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, double noundef %23)
  %103 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, double noundef %.048.lcssa)
  %104 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14, double noundef %91)
  %105 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, double noundef %98)
  %106 = fadd double %23, %.048.lcssa
  %107 = fadd double %106, %91
  %108 = fadd double %107, %98
  %109 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16, double noundef %108)
  br label %110

110:                                              ; preds = %95, %97, %84
  %.1 = phi i32 [ 1, %84 ], [ 0, %97 ], [ 1, %95 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 46, ptr nonnull %5) #7
  br label %111

111:                                              ; preds = %27, %110, %20
  %.3 = phi i32 [ 1, %20 ], [ 1, %27 ], [ %.1, %110 ]
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %3) #7
  br label %112

112:                                              ; preds = %111, %8
  %.4 = phi i32 [ 1, %8 ], [ %.3, %111 ]
  ret i32 %.4
}

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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

; Function Attrs: nounwind
declare i32 @getrusage(i32 noundef, ptr noundef) local_unnamed_addr #3

declare zeroext i1 @load(ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare dso_local double @calculate(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #1

declare zeroext i1 @unload() local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #1

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

declare zeroext i1 @check(ptr noundef) local_unnamed_addr #4

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

; Function Attrs: nofree nounwind memory(read)
declare noundef i32 @ferror(ptr nocapture noundef) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #1

declare i32 @size() local_unnamed_addr #4

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

!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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}


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