; LLVM IR from JessonYue/LeetCodeLearning :: Array/zhangjunwei/elf (parseElf)

; 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.Elf32_Ehdr = type { [16 x i8], i16, i16, i32, i32, i32, i32, i32, i16, i16, i16, i16, i16, i16 }
%struct.Elf32_Shdr = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.Elf32_Phdr = type { i32, i32, i32, i32, i32, i32, i32, i32 }

@.str.70 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [14 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local void @print_elf_header(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @print_sec_header(ptr noundef, i32 noundef, 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: nounwind uwtable
declare dso_local void @print_prog_header(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @print_symbol_table(ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @parse_elf(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i16, align 2
  %6 = alloca i32, align 4
  %7 = alloca i16, align 2
  %8 = alloca i16, align 2
  %9 = alloca i16, align 2
  %10 = alloca ptr, align 8
  %11 = alloca i16, align 2
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store ptr null, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 2, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 2, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 2, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 2, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 2, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = call noalias ptr @fopen(ptr noundef %23, ptr noundef @.str.70)
  store ptr %24, ptr %17, align 8, !tbaa !5
  %25 = load ptr, ptr %17, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %30

27:                                               ; preds = %1
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str.71, ptr noundef %28)
  store i32 1, ptr %18, align 4
  br label %269

30:                                               ; preds = %1
  %31 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 52) #7
  store ptr %31, ptr %3, align 8, !tbaa !5
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = load ptr, ptr %17, align 8, !tbaa !5
  %34 = call i64 @fread(ptr noundef %32, i64 noundef 1, i64 noundef 52, ptr noundef %33)
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  call void @print_elf_header(ptr noundef %35)
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.Elf32_Ehdr, ptr %36, i32 0, i32 12
  %38 = load i16, ptr %37, align 4, !tbaa !9
  store i16 %38, ptr %5, align 2, !tbaa !13
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.Elf32_Ehdr, ptr %39, i32 0, i32 6
  %41 = load i32, ptr %40, align 4, !tbaa !14
  store i32 %41, ptr %6, align 4, !tbaa !15
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.Elf32_Ehdr, ptr %42, i32 0, i32 11
  %44 = load i16, ptr %43, align 2, !tbaa !16
  store i16 %44, ptr %7, align 2, !tbaa !13
  %45 = load i16, ptr %5, align 2, !tbaa !13
  %46 = zext i16 %45 to i64
  %47 = mul i64 40, %46
  %48 = call noalias ptr @malloc(i64 noundef %47) #8
  store ptr %48, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %19, align 4, !tbaa !15
  br label %49

49:                                               ; preds = %95, %30
  %50 = load i32, ptr %19, align 4, !tbaa !15
  %51 = load i16, ptr %5, align 2, !tbaa !13
  %52 = zext i16 %51 to i32
  %53 = icmp slt i32 %50, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %49
  store i32 2, ptr %18, align 4
  br label %98

55:                                               ; preds = %49
  %56 = load ptr, ptr %17, align 8, !tbaa !5
  %57 = load i32, ptr %6, align 4, !tbaa !15
  %58 = load i32, ptr %19, align 4, !tbaa !15
  %59 = load i16, ptr %7, align 2, !tbaa !13
  %60 = zext i16 %59 to i32
  %61 = mul nsw i32 %58, %60
  %62 = add i32 %57, %61
  %63 = zext i32 %62 to i64
  %64 = call i32 @fseek(ptr noundef %56, i64 noundef %63, i32 noundef 0)
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %66, label %68

66:                                               ; preds = %55
  %67 = call i32 (ptr, ...) @printf(ptr noundef @.str.72)
  store i32 1, ptr %18, align 4
  br label %98

68:                                               ; preds = %55
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = load i32, ptr %19, align 4, !tbaa !15
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds %struct.Elf32_Shdr, ptr %69, i64 %71
  %73 = load ptr, ptr %17, align 8, !tbaa !5
  %74 = call i64 @fread(ptr noundef %72, i64 noundef 40, i64 noundef 1, ptr noundef %73)
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = load i32, ptr %19, align 4, !tbaa !15
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds %struct.Elf32_Shdr, ptr %75, i64 %77
  %79 = getelementptr inbounds %struct.Elf32_Shdr, ptr %78, i32 0, i32 1
  %80 = load i32, ptr %79, align 4, !tbaa !17
  %81 = icmp eq i32 %80, 2
  br i1 %81, label %82, label %84

82:                                               ; preds = %68
  %83 = load i32, ptr %19, align 4, !tbaa !15
  store i32 %83, ptr %13, align 4, !tbaa !15
  br label %84

84:                                               ; preds = %82, %68
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = load i32, ptr %19, align 4, !tbaa !15
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds %struct.Elf32_Shdr, ptr %85, i64 %87
  %89 = getelementptr inbounds %struct.Elf32_Shdr, ptr %88, i32 0, i32 1
  %90 = load i32, ptr %89, align 4, !tbaa !17
  %91 = icmp eq i32 %90, 3
  br i1 %91, label %92, label %94

92:                                               ; preds = %84
  %93 = load i32, ptr %19, align 4, !tbaa !15
  store i32 %93, ptr %16, align 4, !tbaa !15
  br label %94

94:                                               ; preds = %92, %84
  br label %95

95:                                               ; preds = %94
  %96 = load i32, ptr %19, align 4, !tbaa !15
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %19, align 4, !tbaa !15
  br label %49, !llvm.loop !19

98:                                               ; preds = %66, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  %99 = load i32, ptr %18, align 4
  switch i32 %99, label %269 [
    i32 2, label %100
  ]

100:                                              ; preds = %98
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.Elf32_Ehdr, ptr %101, i32 0, i32 13
  %103 = load i16, ptr %102, align 2, !tbaa !21
  store i16 %103, ptr %8, align 2, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  %105 = load i16, ptr %8, align 2, !tbaa !13
  %106 = zext i16 %105 to i64
  %107 = getelementptr inbounds %struct.Elf32_Shdr, ptr %104, i64 %106
  %108 = getelementptr inbounds %struct.Elf32_Shdr, ptr %107, i32 0, i32 5
  %109 = load i32, ptr %108, align 4, !tbaa !22
  store i32 %109, ptr %20, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %110 = load i32, ptr %20, align 4, !tbaa !15
  %111 = zext i32 %110 to i64
  %112 = mul i64 1, %111
  %113 = call noalias ptr @malloc(i64 noundef %112) #8
  store ptr %113, ptr %21, align 8, !tbaa !5
  %114 = load ptr, ptr %17, align 8, !tbaa !5
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = load i16, ptr %8, align 2, !tbaa !13
  %117 = zext i16 %116 to i64
  %118 = getelementptr inbounds %struct.Elf32_Shdr, ptr %115, i64 %117
  %119 = getelementptr inbounds %struct.Elf32_Shdr, ptr %118, i32 0, i32 4
  %120 = load i32, ptr %119, align 4, !tbaa !23
  %121 = zext i32 %120 to i64
  %122 = call i32 @fseek(ptr noundef %114, i64 noundef %121, i32 noundef 0)
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %126

124:                                              ; preds = %100
  %125 = call i32 (ptr, ...) @printf(ptr noundef @.str.72)
  store i32 1, ptr %18, align 4
  br label %268

126:                                              ; preds = %100
  %127 = load ptr, ptr %21, align 8, !tbaa !5
  %128 = load i32, ptr %20, align 4, !tbaa !15
  %129 = zext i32 %128 to i64
  %130 = load ptr, ptr %17, align 8, !tbaa !5
  %131 = call i64 @fread(ptr noundef %127, i64 noundef 1, i64 noundef %129, ptr noundef %130)
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = load i16, ptr %5, align 2, !tbaa !13
  %134 = zext i16 %133 to i32
  %135 = load ptr, ptr %21, align 8, !tbaa !5
  call void @print_sec_header(ptr noundef %132, i32 noundef %134, ptr noundef %135)
  %136 = load ptr, ptr %3, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.Elf32_Ehdr, ptr %136, i32 0, i32 10
  %138 = load i16, ptr %137, align 4, !tbaa !24
  store i16 %138, ptr %11, align 2, !tbaa !13
  %139 = load ptr, ptr %3, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.Elf32_Ehdr, ptr %139, i32 0, i32 9
  %141 = load i16, ptr %140, align 2, !tbaa !25
  store i16 %141, ptr %9, align 2, !tbaa !13
  %142 = load ptr, ptr %3, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.Elf32_Ehdr, ptr %142, i32 0, i32 5
  %144 = load i32, ptr %143, align 4, !tbaa !26
  store i32 %144, ptr %12, align 4, !tbaa !15
  %145 = load i16, ptr %11, align 2, !tbaa !13
  %146 = zext i16 %145 to i64
  %147 = mul i64 32, %146
  %148 = call noalias ptr @malloc(i64 noundef %147) #8
  store ptr %148, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 0, ptr %22, align 4, !tbaa !15
  br label %149

149:                                              ; preds = %175, %126
  %150 = load i32, ptr %22, align 4, !tbaa !15
  %151 = load i16, ptr %11, align 2, !tbaa !13
  %152 = zext i16 %151 to i32
  %153 = icmp slt i32 %150, %152
  br i1 %153, label %155, label %154

154:                                              ; preds = %149
  store i32 5, ptr %18, align 4
  br label %178

155:                                              ; preds = %149
  %156 = load ptr, ptr %17, align 8, !tbaa !5
  %157 = load i32, ptr %12, align 4, !tbaa !15
  %158 = load i32, ptr %22, align 4, !tbaa !15
  %159 = load i16, ptr %9, align 2, !tbaa !13
  %160 = zext i16 %159 to i32
  %161 = mul nsw i32 %158, %160
  %162 = add i32 %157, %161
  %163 = zext i32 %162 to i64
  %164 = call i32 @fseek(ptr noundef %156, i64 noundef %163, i32 noundef 0)
  %165 = icmp ne i32 %164, 0
  br i1 %165, label %166, label %168

166:                                              ; preds = %155
  %167 = call i32 (ptr, ...) @printf(ptr noundef @.str.72)
  store i32 1, ptr %18, align 4
  br label %178

168:                                              ; preds = %155
  %169 = load ptr, ptr %10, align 8, !tbaa !5
  %170 = load i32, ptr %22, align 4, !tbaa !15
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds %struct.Elf32_Phdr, ptr %169, i64 %171
  %173 = load ptr, ptr %17, align 8, !tbaa !5
  %174 = call i64 @fread(ptr noundef %172, i64 noundef 32, i64 noundef 1, ptr noundef %173)
  br label %175

175:                                              ; preds = %168
  %176 = load i32, ptr %22, align 4, !tbaa !15
  %177 = add nsw i32 %176, 1
  store i32 %177, ptr %22, align 4, !tbaa !15
  br label %149, !llvm.loop !27

178:                                              ; preds = %166, %154
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  %179 = load i32, ptr %18, align 4
  switch i32 %179, label %268 [
    i32 5, label %180
  ]

180:                                              ; preds = %178
  %181 = load ptr, ptr %10, align 8, !tbaa !5
  %182 = load i16, ptr %11, align 2, !tbaa !13
  %183 = zext i16 %182 to i32
  call void @print_prog_header(ptr noundef %181, i32 noundef %183)
  %184 = load ptr, ptr %4, align 8, !tbaa !5
  %185 = load i32, ptr %13, align 4, !tbaa !15
  %186 = zext i32 %185 to i64
  %187 = getelementptr inbounds %struct.Elf32_Shdr, ptr %184, i64 %186
  %188 = getelementptr inbounds %struct.Elf32_Shdr, ptr %187, i32 0, i32 5
  %189 = load i32, ptr %188, align 4, !tbaa !22
  %190 = zext i32 %189 to i64
  %191 = mul i64 1, %190
  %192 = call noalias ptr @malloc(i64 noundef %191) #8
  store ptr %192, ptr %14, align 8, !tbaa !5
  %193 = load ptr, ptr %17, align 8, !tbaa !5
  %194 = load ptr, ptr %4, align 8, !tbaa !5
  %195 = load i32, ptr %13, align 4, !tbaa !15
  %196 = zext i32 %195 to i64
  %197 = getelementptr inbounds %struct.Elf32_Shdr, ptr %194, i64 %196
  %198 = getelementptr inbounds %struct.Elf32_Shdr, ptr %197, i32 0, i32 4
  %199 = load i32, ptr %198, align 4, !tbaa !23
  %200 = zext i32 %199 to i64
  %201 = call i32 @fseek(ptr noundef %193, i64 noundef %200, i32 noundef 0)
  %202 = icmp ne i32 %201, 0
  br i1 %202, label %203, label %205

203:                                              ; preds = %180
  %204 = call i32 (ptr, ...) @printf(ptr noundef @.str.72)
  store i32 1, ptr %18, align 4
  br label %268

205:                                              ; preds = %180
  %206 = load ptr, ptr %14, align 8, !tbaa !5
  %207 = load ptr, ptr %4, align 8, !tbaa !5
  %208 = load i32, ptr %13, align 4, !tbaa !15
  %209 = zext i32 %208 to i64
  %210 = getelementptr inbounds %struct.Elf32_Shdr, ptr %207, i64 %209
  %211 = getelementptr inbounds %struct.Elf32_Shdr, ptr %210, i32 0, i32 5
  %212 = load i32, ptr %211, align 4, !tbaa !22
  %213 = zext i32 %212 to i64
  %214 = load ptr, ptr %17, align 8, !tbaa !5
  %215 = call i64 @fread(ptr noundef %206, i64 noundef 1, i64 noundef %213, ptr noundef %214)
  %216 = load ptr, ptr %4, align 8, !tbaa !5
  %217 = load i32, ptr %16, align 4, !tbaa !15
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds %struct.Elf32_Shdr, ptr %216, i64 %218
  %220 = getelementptr inbounds %struct.Elf32_Shdr, ptr %219, i32 0, i32 5
  %221 = load i32, ptr %220, align 4, !tbaa !22
  %222 = zext i32 %221 to i64
  %223 = mul i64 1, %222
  %224 = call noalias ptr @malloc(i64 noundef %223) #8
  store ptr %224, ptr %15, align 8, !tbaa !5
  %225 = load ptr, ptr %17, align 8, !tbaa !5
  %226 = load ptr, ptr %4, align 8, !tbaa !5
  %227 = load i32, ptr %16, align 4, !tbaa !15
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds %struct.Elf32_Shdr, ptr %226, i64 %228
  %230 = getelementptr inbounds %struct.Elf32_Shdr, ptr %229, i32 0, i32 4
  %231 = load i32, ptr %230, align 4, !tbaa !23
  %232 = zext i32 %231 to i64
  %233 = call i32 @fseek(ptr noundef %225, i64 noundef %232, i32 noundef 0)
  %234 = icmp ne i32 %233, 0
  br i1 %234, label %235, label %237

235:                                              ; preds = %205
  %236 = call i32 (ptr, ...) @printf(ptr noundef @.str.72)
  store i32 1, ptr %18, align 4
  br label %268

237:                                              ; preds = %205
  %238 = load ptr, ptr %15, align 8, !tbaa !5
  %239 = load ptr, ptr %4, align 8, !tbaa !5
  %240 = load i32, ptr %16, align 4, !tbaa !15
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds %struct.Elf32_Shdr, ptr %239, i64 %241
  %243 = getelementptr inbounds %struct.Elf32_Shdr, ptr %242, i32 0, i32 5
  %244 = load i32, ptr %243, align 4, !tbaa !22
  %245 = zext i32 %244 to i64
  %246 = load ptr, ptr %17, align 8, !tbaa !5
  %247 = call i64 @fread(ptr noundef %238, i64 noundef 1, i64 noundef %245, ptr noundef %246)
  %248 = load ptr, ptr %14, align 8, !tbaa !5
  %249 = load ptr, ptr %4, align 8, !tbaa !5
  %250 = load i32, ptr %13, align 4, !tbaa !15
  %251 = zext i32 %250 to i64
  %252 = getelementptr inbounds %struct.Elf32_Shdr, ptr %249, i64 %251
  %253 = getelementptr inbounds %struct.Elf32_Shdr, ptr %252, i32 0, i32 5
  %254 = load i32, ptr %253, align 4, !tbaa !22
  %255 = zext i32 %254 to i64
  %256 = mul i64 %255, 1
  %257 = udiv i64 %256, 16
  %258 = trunc i64 %257 to i32
  %259 = load ptr, ptr %15, align 8, !tbaa !5
  call void @print_symbol_table(ptr noundef %248, i32 noundef %258, ptr noundef %259)
  %260 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %260) #6
  %261 = load ptr, ptr %4, align 8, !tbaa !5
  call void @free(ptr noundef %261) #6
  %262 = load ptr, ptr %10, align 8, !tbaa !5
  call void @free(ptr noundef %262) #6
  %263 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %263) #6
  %264 = load ptr, ptr %21, align 8, !tbaa !5
  call void @free(ptr noundef %264) #6
  %265 = load ptr, ptr %15, align 8, !tbaa !5
  call void @free(ptr noundef %265) #6
  %266 = load ptr, ptr %17, align 8, !tbaa !5
  %267 = call i32 @fclose(ptr noundef %266)
  store i32 0, ptr %18, align 4
  br label %268

268:                                              ; preds = %237, %235, %203, %178, %124
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %269

269:                                              ; preds = %268, %98, %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 2, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 2, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 2, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 2, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 2, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  %270 = load i32, ptr %18, align 4
  switch i32 %270, label %272 [
    i32 0, label %271
    i32 1, label %271
  ]

271:                                              ; preds = %269, %269
  ret void

272:                                              ; preds = %269
  unreachable
}

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

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #3

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #4

declare i32 @fseek(ptr noundef, i64 noundef, i32 noundef) #0

; Function Attrs: nounwind
declare void @free(ptr noundef) #5

declare i32 @fclose(ptr noundef) #0

attributes #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 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind allocsize(0,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 #4 = { nounwind allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind "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 allocsize(0,1) }
attributes #8 = { nounwind allocsize(0) }

!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, !11, i64 48}
!10 = !{!"", !7, i64 0, !11, i64 16, !11, i64 18, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !11, i64 40, !11, i64 42, !11, i64 44, !11, i64 46, !11, i64 48, !11, i64 50}
!11 = !{!"short", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !12, i64 32}
!15 = !{!12, !12, i64 0}
!16 = !{!10, !11, i64 46}
!17 = !{!18, !12, i64 4}
!18 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!10, !11, i64 50}
!22 = !{!18, !12, i64 20}
!23 = !{!18, !12, i64 16}
!24 = !{!10, !11, i64 44}
!25 = !{!10, !11, i64 42}
!26 = !{!10, !12, i64 28}
!27 = distinct !{!27, !20}


; 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.Elf32_Shdr = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.Elf32_Phdr = type { i32, i32, i32, i32, i32, i32, i32, i32 }

@.str.70 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [14 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local void @print_elf_header(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @print_sec_header(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @print_prog_header(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @print_symbol_table(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @parse_elf(ptr noundef %0) local_unnamed_addr #1 {
  %2 = tail call noalias ptr @fopen(ptr noundef %0, ptr noundef nonnull @.str.70)
  %3 = icmp eq ptr %2, null
  br i1 %3, label %4, label %6

4:                                                ; preds = %1
  %5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.71, ptr noundef %0)
  br label %109

6:                                                ; preds = %1
  %7 = tail call noalias dereferenceable_or_null(52) ptr @calloc(i64 noundef 1, i64 noundef 52) #5
  %8 = tail call i64 @fread(ptr noundef %7, i64 noundef 1, i64 noundef 52, ptr noundef nonnull %2)
  tail call void @print_elf_header(ptr noundef %7)
  %9 = getelementptr inbounds i8, ptr %7, i64 48
  %10 = load i16, ptr %9, align 4, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %7, i64 32
  %12 = load i32, ptr %11, align 4, !tbaa !11
  %13 = getelementptr inbounds i8, ptr %7, i64 46
  %14 = load i16, ptr %13, align 2, !tbaa !12
  %15 = zext i16 %10 to i64
  %16 = mul nuw nsw i64 %15, 40
  %17 = tail call noalias ptr @malloc(i64 noundef %16) #6
  %18 = zext i16 %10 to i32
  %.not93106.not = icmp eq i16 %10, 0
  br i1 %.not93106.not, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %6
  %19 = zext i16 %14 to i64
  %wide.trip.count = zext i16 %10 to i64
  br label %20

20:                                               ; preds = %.lr.ph, %28
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %28 ]
  %.086109 = phi i32 [ undef, %.lr.ph ], [ %spec.select, %28 ]
  %.090107 = phi i32 [ undef, %.lr.ph ], [ %.191, %28 ]
  %21 = mul nuw nsw i64 %indvars.iv, %19
  %22 = trunc nuw nsw i64 %21 to i32
  %23 = add i32 %12, %22
  %24 = zext i32 %23 to i64
  %25 = tail call i32 @fseek(ptr noundef nonnull %2, i64 noundef %24, i32 noundef 0)
  %.not = icmp eq i32 %25, 0
  br i1 %.not, label %28, label %26

26:                                               ; preds = %20
  %27 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.72)
  br label %109

28:                                               ; preds = %20
  %29 = getelementptr inbounds %struct.Elf32_Shdr, ptr %17, i64 %indvars.iv
  %30 = tail call i64 @fread(ptr noundef %29, i64 noundef 40, i64 noundef 1, ptr noundef nonnull %2)
  %31 = getelementptr inbounds i8, ptr %29, i64 4
  %32 = load i32, ptr %31, align 4, !tbaa !13
  %33 = icmp eq i32 %32, 2
  %34 = trunc nuw nsw i64 %indvars.iv to i32
  %spec.select = select i1 %33, i32 %34, i32 %.086109
  %35 = icmp eq i32 %32, 3
  %.191 = select i1 %35, i32 %34, i32 %.090107
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.critedge.loopexit, label %20, !llvm.loop !15

.critedge.loopexit:                               ; preds = %28
  %36 = zext i32 %spec.select to i64
  %37 = sext i32 %.191 to i64
  br label %.critedge

.critedge:                                        ; preds = %.critedge.loopexit, %6
  %.090.lcssa = phi i64 [ 0, %6 ], [ %37, %.critedge.loopexit ]
  %.086.lcssa = phi i64 [ 0, %6 ], [ %36, %.critedge.loopexit ]
  %38 = getelementptr inbounds i8, ptr %7, i64 50
  %39 = load i16, ptr %38, align 2, !tbaa !17
  %40 = zext i16 %39 to i64
  %41 = getelementptr inbounds %struct.Elf32_Shdr, ptr %17, i64 %40
  %42 = getelementptr inbounds i8, ptr %41, i64 20
  %43 = load i32, ptr %42, align 4, !tbaa !18
  %44 = zext i32 %43 to i64
  %45 = tail call noalias ptr @malloc(i64 noundef %44) #6
  %46 = getelementptr inbounds i8, ptr %41, i64 16
  %47 = load i32, ptr %46, align 4, !tbaa !19
  %48 = zext i32 %47 to i64
  %49 = tail call i32 @fseek(ptr noundef nonnull %2, i64 noundef %48, i32 noundef 0)
  %.not94 = icmp eq i32 %49, 0
  br i1 %.not94, label %52, label %50

50:                                               ; preds = %.critedge
  %51 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.72)
  br label %109

52:                                               ; preds = %.critedge
  %53 = tail call i64 @fread(ptr noundef %45, i64 noundef 1, i64 noundef %44, ptr noundef nonnull %2)
  tail call void @print_sec_header(ptr noundef nonnull %17, i32 noundef %18, ptr noundef %45)
  %54 = getelementptr inbounds i8, ptr %7, i64 44
  %55 = load i16, ptr %54, align 4, !tbaa !20
  %56 = getelementptr inbounds i8, ptr %7, i64 42
  %57 = load i16, ptr %56, align 2, !tbaa !21
  %58 = getelementptr inbounds i8, ptr %7, i64 28
  %59 = load i32, ptr %58, align 4, !tbaa !22
  %60 = zext i16 %55 to i64
  %61 = shl nuw nsw i64 %60, 5
  %62 = tail call noalias ptr @malloc(i64 noundef %61) #6
  %63 = zext i16 %55 to i32
  %.not96112.not = icmp eq i16 %55, 0
  br i1 %.not96112.not, label %.critedge100, label %.lr.ph114

.lr.ph114:                                        ; preds = %52
  %64 = zext i16 %57 to i64
  %wide.trip.count120 = zext i16 %55 to i64
  br label %65

65:                                               ; preds = %.lr.ph114, %73
  %indvars.iv117 = phi i64 [ 0, %.lr.ph114 ], [ %indvars.iv.next118, %73 ]
  %66 = mul nuw nsw i64 %indvars.iv117, %64
  %67 = trunc nuw nsw i64 %66 to i32
  %68 = add i32 %59, %67
  %69 = zext i32 %68 to i64
  %70 = tail call i32 @fseek(ptr noundef nonnull %2, i64 noundef %69, i32 noundef 0)
  %.not95 = icmp eq i32 %70, 0
  br i1 %.not95, label %73, label %71

71:                                               ; preds = %65
  %72 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.72)
  br label %109

73:                                               ; preds = %65
  %74 = getelementptr inbounds %struct.Elf32_Phdr, ptr %62, i64 %indvars.iv117
  %75 = tail call i64 @fread(ptr noundef %74, i64 noundef 32, i64 noundef 1, ptr noundef nonnull %2)
  %indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
  %exitcond121.not = icmp eq i64 %indvars.iv.next118, %wide.trip.count120
  br i1 %exitcond121.not, label %.critedge100, label %65, !llvm.loop !23

.critedge100:                                     ; preds = %73, %52
  tail call void @print_prog_header(ptr noundef %62, i32 noundef %63)
  %76 = getelementptr inbounds %struct.Elf32_Shdr, ptr %17, i64 %.086.lcssa
  %77 = getelementptr inbounds i8, ptr %76, i64 20
  %78 = load i32, ptr %77, align 4, !tbaa !18
  %79 = zext i32 %78 to i64
  %80 = tail call noalias ptr @malloc(i64 noundef %79) #6
  %81 = getelementptr inbounds i8, ptr %76, i64 16
  %82 = load i32, ptr %81, align 4, !tbaa !19
  %83 = zext i32 %82 to i64
  %84 = tail call i32 @fseek(ptr noundef nonnull %2, i64 noundef %83, i32 noundef 0)
  %.not97 = icmp eq i32 %84, 0
  br i1 %.not97, label %87, label %85

85:                                               ; preds = %.critedge100
  %86 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.72)
  br label %109

87:                                               ; preds = %.critedge100
  %88 = load i32, ptr %77, align 4, !tbaa !18
  %89 = zext i32 %88 to i64
  %90 = tail call i64 @fread(ptr noundef %80, i64 noundef 1, i64 noundef %89, ptr noundef nonnull %2)
  %91 = getelementptr inbounds %struct.Elf32_Shdr, ptr %17, i64 %.090.lcssa
  %92 = getelementptr inbounds i8, ptr %91, i64 20
  %93 = load i32, ptr %92, align 4, !tbaa !18
  %94 = zext i32 %93 to i64
  %95 = tail call noalias ptr @malloc(i64 noundef %94) #6
  %96 = getelementptr inbounds i8, ptr %91, i64 16
  %97 = load i32, ptr %96, align 4, !tbaa !19
  %98 = zext i32 %97 to i64
  %99 = tail call i32 @fseek(ptr noundef nonnull %2, i64 noundef %98, i32 noundef 0)
  %.not98 = icmp eq i32 %99, 0
  br i1 %.not98, label %102, label %100

100:                                              ; preds = %87
  %101 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.72)
  br label %109

102:                                              ; preds = %87
  %103 = load i32, ptr %92, align 4, !tbaa !18
  %104 = zext i32 %103 to i64
  %105 = tail call i64 @fread(ptr noundef %95, i64 noundef 1, i64 noundef %104, ptr noundef nonnull %2)
  %106 = load i32, ptr %77, align 4, !tbaa !18
  %107 = lshr i32 %106, 4
  tail call void @print_symbol_table(ptr noundef %80, i32 noundef %107, ptr noundef %95)
  tail call void @free(ptr noundef %7) #7
  tail call void @free(ptr noundef nonnull %17) #7
  tail call void @free(ptr noundef %62) #7
  tail call void @free(ptr noundef %80) #7
  tail call void @free(ptr noundef %45) #7
  tail call void @free(ptr noundef %95) #7
  %108 = tail call i32 @fclose(ptr noundef nonnull %2)
  br label %109

109:                                              ; preds = %71, %26, %50, %85, %100, %102, %4
  ret void
}

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @fseek(ptr nocapture noundef, i64 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

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

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 allocsize(0,1) }
attributes #6 = { nounwind allocsize(0) }
attributes #7 = { 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, !9, i64 48}
!6 = !{!"", !7, i64 0, !9, i64 16, !9, i64 18, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !9, i64 40, !9, i64 42, !9, i64 44, !9, i64 46, !9, i64 48, !9, i64 50}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"short", !7, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!6, !10, i64 32}
!12 = !{!6, !9, i64 46}
!13 = !{!14, !10, i64 4}
!14 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!6, !9, i64 50}
!18 = !{!14, !10, i64 20}
!19 = !{!14, !10, i64 16}
!20 = !{!6, !9, i64 44}
!21 = !{!6, !9, i64 42}
!22 = !{!6, !10, i64 28}
!23 = distinct !{!23, !16}


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