; LLVM IR from JessonYue/LeetCodeLearning :: Array/yangxin/第五周练习6_28-7_4/elf解析 (elf)

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

@.str.273 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.274 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.275 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.276 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.277 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.278 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.279 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @printElfMagicNumber(ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare dso_local void @printEI_CLASS(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printEI_DATA(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printEI_VERSION(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printEI_OSABI(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printEI_ABIVERSION(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printEI_PAD(ptr noundef) #0

; 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 @printE_type(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printE_machine(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printE_version(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printE_entry(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printE_phoff(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printE_shoff(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printE_flags(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printE_ehsize(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printE_phentsize(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printE_phnum(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printE_shentsize(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printE_shnum(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printE_shstrndx(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @printElf64_Shdr(i32 noundef, ptr noundef byval(%struct.Elf64_Shdr) align 8, ptr noundef) #0

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca %struct.Elf64_Shdr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store ptr @.str.273, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = call noalias ptr @fopen(ptr noundef %12, ptr noundef @.str.274)
  store ptr %13, ptr %3, align 8, !tbaa !5
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = icmp eq ptr %14, null
  br i1 %15, label %16, label %18

16:                                               ; preds = %0
  %17 = call i32 (ptr, ...) @printf(ptr noundef @.str.275)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %124

18:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 64, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = call noalias ptr @malloc(i64 noundef %20) #8
  store ptr %21, ptr %6, align 8, !tbaa !5
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = load i32, ptr %5, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = call i64 @fread(ptr noundef %22, i64 noundef %24, i64 noundef 1, ptr noundef %25)
  %27 = call i32 (ptr, ...) @printf(ptr noundef @.str.276)
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printElfMagicNumber(ptr noundef %28)
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printEI_CLASS(ptr noundef %29)
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printEI_DATA(ptr noundef %30)
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printEI_VERSION(ptr noundef %31)
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printEI_OSABI(ptr noundef %32)
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printEI_ABIVERSION(ptr noundef %33)
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printEI_PAD(ptr noundef %34)
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printE_type(ptr noundef %35)
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printE_machine(ptr noundef %36)
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printE_version(ptr noundef %37)
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printE_entry(ptr noundef %38)
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printE_phoff(ptr noundef %39)
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printE_shoff(ptr noundef %40)
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printE_flags(ptr noundef %41)
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printE_ehsize(ptr noundef %42)
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printE_phentsize(ptr noundef %43)
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printE_phnum(ptr noundef %44)
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printE_shentsize(ptr noundef %45)
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printE_shnum(ptr noundef %46)
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  call void @printE_shstrndx(ptr noundef %47)
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.Elf64_Ehdr, ptr %48, i32 0, i32 12
  %50 = load i16, ptr %49, align 4, !tbaa !11
  %51 = zext i16 %50 to i32
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str.277, i32 noundef %51)
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.Elf64_Ehdr, ptr %53, i32 0, i32 12
  %55 = load i16, ptr %54, align 4, !tbaa !11
  %56 = zext i16 %55 to i64
  %57 = call ptr @llvm.stacksave.p0()
  store ptr %57, ptr %7, align 8
  %58 = alloca %struct.Elf64_Shdr, i64 %56, align 16
  store i64 %56, ptr %8, align 8
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.Elf64_Ehdr, ptr %60, i32 0, i32 6
  %62 = load i64, ptr %61, align 8, !tbaa !15
  %63 = call i32 @fseek(ptr noundef %59, i64 noundef %62, i32 noundef 0)
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.Elf64_Ehdr, ptr %64, i32 0, i32 11
  %66 = load i16, ptr %65, align 2, !tbaa !16
  %67 = zext i16 %66 to i64
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.Elf64_Ehdr, ptr %68, i32 0, i32 12
  %70 = load i16, ptr %69, align 4, !tbaa !11
  %71 = zext i16 %70 to i64
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = call i64 @fread(ptr noundef %58, i64 noundef %67, i64 noundef %71, ptr noundef %72)
  call void @llvm.lifetime.start.p0(i64 64, ptr %9) #7
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.Elf64_Ehdr, ptr %74, i32 0, i32 13
  %76 = load i16, ptr %75, align 2, !tbaa !17
  %77 = zext i16 %76 to i64
  %78 = getelementptr inbounds %struct.Elf64_Shdr, ptr %58, i64 %77
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 16 %78, i64 64, i1 false), !tbaa.struct !18
  %79 = getelementptr inbounds %struct.Elf64_Shdr, ptr %9, i32 0, i32 5
  %80 = load i64, ptr %79, align 8, !tbaa !20
  %81 = alloca i8, i64 %80, align 16
  store i64 %80, ptr %10, align 8
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.Elf64_Shdr, ptr %9, i32 0, i32 4
  %84 = load i64, ptr %83, align 8, !tbaa !22
  %85 = call i32 @fseek(ptr noundef %82, i64 noundef %84, i32 noundef 0)
  %86 = getelementptr inbounds %struct.Elf64_Shdr, ptr %9, i32 0, i32 5
  %87 = load i64, ptr %86, align 8, !tbaa !20
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = call i64 @fread(ptr noundef %81, i64 noundef %87, i64 noundef 1, ptr noundef %88)
  %90 = call i32 (ptr, ...) @printf(ptr noundef @.str.278)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %91

91:                                               ; preds = %104, %18
  %92 = load i32, ptr %11, align 4, !tbaa !9
  %93 = load ptr, ptr %6, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.Elf64_Ehdr, ptr %93, i32 0, i32 12
  %95 = load i16, ptr %94, align 4, !tbaa !11
  %96 = zext i16 %95 to i32
  %97 = icmp slt i32 %92, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %91
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %107

99:                                               ; preds = %91
  %100 = load i32, ptr %11, align 4, !tbaa !9
  %101 = load i32, ptr %11, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds %struct.Elf64_Shdr, ptr %58, i64 %102
  call void @printElf64_Shdr(i32 noundef %100, ptr noundef byval(%struct.Elf64_Shdr) align 8 %103, ptr noundef %81)
  br label %104

104:                                              ; preds = %99
  %105 = load i32, ptr %11, align 4, !tbaa !9
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %11, align 4, !tbaa !9
  br label %91, !llvm.loop !23

107:                                              ; preds = %98
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.Elf64_Ehdr, ptr %108, i32 0, i32 10
  %110 = load i16, ptr %109, align 8, !tbaa !25
  %111 = zext i16 %110 to i32
  %112 = call i32 (ptr, ...) @printf(ptr noundef @.str.279, i32 noundef %111)
  %113 = load ptr, ptr %3, align 8, !tbaa !5
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.Elf64_Ehdr, ptr %114, i32 0, i32 5
  %116 = load i64, ptr %115, align 8, !tbaa !26
  %117 = trunc i64 %116 to i32
  %118 = load ptr, ptr %6, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.Elf64_Ehdr, ptr %118, i32 0, i32 10
  %120 = load i16, ptr %119, align 8, !tbaa !25
  %121 = zext i16 %120 to i32
  call void @printfElf32_PhdrMessage(ptr noundef %113, i32 noundef %117, i32 noundef %121)
  %122 = load ptr, ptr %6, align 8, !tbaa !5
  call void @free(ptr noundef %122) #7
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 64, ptr %9) #7
  %123 = load ptr, ptr %7, align 8
  call void @llvm.stackrestore.p0(ptr %123)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %124

124:                                              ; preds = %107, %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  %125 = load i32, ptr %1, align 4
  ret i32 %125
}

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { "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) "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 "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 = { nocallback nofree nosync nounwind willreturn }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }
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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 60}
!12 = !{!"", !7, i64 0, !13, i64 16, !13, i64 18, !10, i64 20, !14, i64 24, !14, i64 32, !14, i64 40, !10, i64 48, !13, i64 52, !13, i64 54, !13, i64 56, !13, i64 58, !13, i64 60, !13, i64 62}
!13 = !{!"short", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!12, !14, i64 40}
!16 = !{!12, !13, i64 58}
!17 = !{!12, !13, i64 62}
!18 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 8, !19, i64 16, i64 8, !19, i64 24, i64 8, !19, i64 32, i64 8, !19, i64 40, i64 4, !9, i64 44, i64 4, !9, i64 48, i64 8, !19, i64 56, i64 8, !19}
!19 = !{!14, !14, i64 0}
!20 = !{!21, !14, i64 32}
!21 = !{!"", !10, i64 0, !10, i64 4, !14, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !10, i64 40, !10, i64 44, !14, i64 48, !14, i64 56}
!22 = !{!21, !14, i64 24}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!12, !13, i64 56}
!26 = !{!12, !14, i64 32}


; 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.Elf64_Shdr = type { i32, i32, i64, i64, i64, i64, i32, i32, i64, i64 }

@.str.273 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.274 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.275 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.276 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.277 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.278 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.279 = external hidden unnamed_addr constant [42 x i8], align 1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @printElf64_Shdr(i32 noundef, ptr noundef byval(%struct.Elf64_Shdr) align 8, ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(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 #1

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call noalias ptr @fopen(ptr noundef nonnull @.str.273, ptr noundef nonnull @.str.274)
  %2 = icmp eq ptr %1, null
  br i1 %2, label %3, label %5

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

5:                                                ; preds = %0
  %6 = tail call noalias dereferenceable_or_null(64) ptr @malloc(i64 noundef 64) #5
  %7 = tail call i64 @fread(ptr noundef %6, i64 noundef 64, i64 noundef 1, ptr noundef nonnull %1)
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.276)
  tail call void @printElfMagicNumber(ptr noundef %6)
  tail call void @printEI_CLASS(ptr noundef %6)
  tail call void @printEI_DATA(ptr noundef %6)
  tail call void @printEI_VERSION(ptr noundef %6)
  tail call void @printEI_OSABI(ptr noundef %6)
  tail call void @printEI_ABIVERSION(ptr noundef %6)
  tail call void @printEI_PAD(ptr noundef %6)
  tail call void @printE_type(ptr noundef %6)
  tail call void @printE_machine(ptr noundef %6)
  tail call void @printE_version(ptr noundef %6)
  tail call void @printE_entry(ptr noundef %6)
  tail call void @printE_phoff(ptr noundef %6)
  tail call void @printE_shoff(ptr noundef %6)
  tail call void @printE_flags(ptr noundef %6)
  tail call void @printE_ehsize(ptr noundef %6)
  tail call void @printE_phentsize(ptr noundef %6)
  tail call void @printE_phnum(ptr noundef %6)
  tail call void @printE_shentsize(ptr noundef %6)
  tail call void @printE_shnum(ptr noundef %6)
  tail call void @printE_shstrndx(ptr noundef %6)
  %9 = getelementptr inbounds i8, ptr %6, i64 60
  %10 = load i16, ptr %9, align 4, !tbaa !5
  %11 = zext i16 %10 to i32
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.277, i32 noundef %11)
  %13 = load i16, ptr %9, align 4, !tbaa !5
  %14 = zext i16 %13 to i64
  %15 = tail call ptr @llvm.stacksave.p0()
  %16 = alloca %struct.Elf64_Shdr, i64 %14, align 16
  %17 = getelementptr inbounds i8, ptr %6, i64 40
  %18 = load i64, ptr %17, align 8, !tbaa !12
  %19 = tail call i32 @fseek(ptr noundef nonnull %1, i64 noundef %18, i32 noundef 0)
  %20 = getelementptr inbounds i8, ptr %6, i64 58
  %21 = load i16, ptr %20, align 2, !tbaa !13
  %22 = zext i16 %21 to i64
  %23 = load i16, ptr %9, align 4, !tbaa !5
  %24 = zext i16 %23 to i64
  %25 = call i64 @fread(ptr noundef nonnull %16, i64 noundef %22, i64 noundef %24, ptr noundef nonnull %1)
  %26 = getelementptr inbounds i8, ptr %6, i64 62
  %27 = load i16, ptr %26, align 2, !tbaa !14
  %28 = zext i16 %27 to i64
  %29 = getelementptr inbounds %struct.Elf64_Shdr, ptr %16, i64 %28
  %.sroa.3.0..sroa_idx = getelementptr inbounds i8, ptr %29, i64 24
  %.sroa.3.0.copyload = load i64, ptr %.sroa.3.0..sroa_idx, align 8, !tbaa !15
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %29, i64 32
  %.sroa.4.0.copyload = load i64, ptr %.sroa.4.0..sroa_idx, align 16, !tbaa !15
  %30 = alloca i8, i64 %.sroa.4.0.copyload, align 16
  %31 = tail call i32 @fseek(ptr noundef nonnull %1, i64 noundef %.sroa.3.0.copyload, i32 noundef 0)
  %32 = call i64 @fread(ptr noundef nonnull %30, i64 noundef %.sroa.4.0.copyload, i64 noundef 1, ptr noundef nonnull %1)
  %33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.278)
  %34 = load i16, ptr %9, align 4, !tbaa !5
  %.not = icmp eq i16 %34, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %5
  %35 = getelementptr inbounds i8, ptr %6, i64 56
  %36 = load i16, ptr %35, align 8, !tbaa !16
  %37 = zext i16 %36 to i32
  %38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.279, i32 noundef %37)
  %39 = getelementptr inbounds i8, ptr %6, i64 32
  %40 = load i64, ptr %39, align 8, !tbaa !17
  %41 = trunc i64 %40 to i32
  %42 = load i16, ptr %35, align 8, !tbaa !16
  %43 = zext i16 %42 to i32
  call void @printfElf32_PhdrMessage(ptr noundef nonnull %1, i32 noundef %41, i32 noundef %43)
  call void @free(ptr noundef nonnull %6) #6
  call void @llvm.stackrestore.p0(ptr %15)
  br label %49

.lr.ph:                                           ; preds = %5, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %5 ]
  %44 = getelementptr inbounds %struct.Elf64_Shdr, ptr %16, i64 %indvars.iv
  %45 = trunc nuw nsw i64 %indvars.iv to i32
  call void @printElf64_Shdr(i32 noundef %45, ptr noundef nonnull byval(%struct.Elf64_Shdr) align 8 %44, ptr noundef nonnull %30)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %46 = load i16, ptr %9, align 4, !tbaa !5
  %47 = zext i16 %46 to i64
  %48 = icmp ult i64 %indvars.iv.next, %47
  br i1 %48, label %.lr.ph, label %._crit_edge, !llvm.loop !18

49:                                               ; preds = %._crit_edge, %3
  ret i32 0
}

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 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 #3 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nounwind allocsize(0) }
attributes #6 = { 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 60}
!6 = !{!"", !7, i64 0, !9, i64 16, !9, i64 18, !10, i64 20, !11, i64 24, !11, i64 32, !11, i64 40, !10, i64 48, !9, i64 52, !9, i64 54, !9, i64 56, !9, i64 58, !9, i64 60, !9, i64 62}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"short", !7, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = !{!6, !11, i64 40}
!13 = !{!6, !9, i64 58}
!14 = !{!6, !9, i64 62}
!15 = !{!11, !11, i64 0}
!16 = !{!6, !9, i64 56}
!17 = !{!6, !11, i64 32}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass