; LLVM IR from holzschu/ios_system :: shell_cmds/hexdump (display)

; 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"

@vflag = external dso_local global i32, align 4
@address = external hidden global i64, align 8
@eaddress = external hidden global i64, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@get.ateof = external hidden global i32, align 4
@get.curp = external hidden global ptr, align 8
@get.savp = external hidden global ptr, align 8
@blocksize = external global i32, align 4
@length = external global i32, align 4
@odmode = external global i32, align 4
@skip = external global i64, align 8
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@stdin = external global ptr, align 8
@_argv = external hidden global ptr, align 8

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

; Function Attrs: nounwind uwtable
define dso_local ptr @get() #1 {
  %1 = alloca ptr, align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %8 = load ptr, ptr @get.curp, align 8, !tbaa !9
  %9 = icmp ne ptr %8, null
  br i1 %9, label %23, label %10

10:                                               ; preds = %0
  %11 = load i32, ptr @blocksize, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = call noalias ptr @calloc(i64 noundef 1, i64 noundef %12) #9
  store ptr %13, ptr @get.curp, align 8, !tbaa !9
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %16

15:                                               ; preds = %10
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef null) #10
  unreachable

16:                                               ; preds = %10
  %17 = load i32, ptr @blocksize, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = call noalias ptr @calloc(i64 noundef 1, i64 noundef %18) #9
  store ptr %19, ptr @get.savp, align 8, !tbaa !9
  %20 = icmp eq ptr %19, null
  br i1 %20, label %21, label %22

21:                                               ; preds = %16
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef null) #10
  unreachable

22:                                               ; preds = %16
  br label %31

23:                                               ; preds = %0
  %24 = load ptr, ptr @get.curp, align 8, !tbaa !9
  store ptr %24, ptr %6, align 8, !tbaa !9
  %25 = load ptr, ptr @get.savp, align 8, !tbaa !9
  store ptr %25, ptr @get.curp, align 8, !tbaa !9
  %26 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %26, ptr @get.savp, align 8, !tbaa !9
  %27 = load i32, ptr @blocksize, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = load i64, ptr @address, align 8, !tbaa !11
  %30 = add nsw i64 %29, %28
  store i64 %30, ptr @address, align 8, !tbaa !11
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %23, %22
  %32 = load i32, ptr @blocksize, align 4, !tbaa !5
  store i32 %32, ptr %3, align 4, !tbaa !5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %181, %128, %31
  %34 = load i32, ptr @length, align 4, !tbaa !5
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %36, label %42

36:                                               ; preds = %33
  %37 = load i32, ptr @get.ateof, align 4, !tbaa !5
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %93

39:                                               ; preds = %36
  %40 = call i32 @next(ptr noundef null)
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %93, label %42

42:                                               ; preds = %39, %33
  %43 = load i32, ptr @odmode, align 4, !tbaa !5
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %50

45:                                               ; preds = %42
  %46 = load i64, ptr @address, align 8, !tbaa !11
  %47 = load i64, ptr @skip, align 8, !tbaa !11
  %48 = icmp slt i64 %46, %47
  br i1 %48, label %49, label %50

49:                                               ; preds = %45
  call void (i32, ptr, ...) @errx(i32 noundef 1, ptr noundef @.str.2) #10
  unreachable

50:                                               ; preds = %45, %42
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = load i32, ptr @blocksize, align 4, !tbaa !5
  %53 = icmp eq i32 %51, %52
  br i1 %53, label %54, label %55

54:                                               ; preds = %50
  store ptr null, ptr %1, align 8
  store i32 1, ptr %7, align 4
  br label %182

55:                                               ; preds = %50
  %56 = load i32, ptr @vflag, align 4, !tbaa !5
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %74

58:                                               ; preds = %55
  %59 = load i32, ptr %5, align 4, !tbaa !5
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %61, label %74

61:                                               ; preds = %58
  %62 = load ptr, ptr @get.curp, align 8, !tbaa !9
  %63 = load ptr, ptr @get.savp, align 8, !tbaa !9
  %64 = load i32, ptr %4, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = call i32 @bcmp(ptr noundef %62, ptr noundef %63, i64 noundef %65) #11
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %68, label %74

68:                                               ; preds = %61
  %69 = load i32, ptr @vflag, align 4, !tbaa !5
  %70 = icmp ne i32 %69, 1
  br i1 %70, label %71, label %73

71:                                               ; preds = %68
  %72 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %73

73:                                               ; preds = %71, %68
  store ptr null, ptr %1, align 8
  store i32 1, ptr %7, align 4
  br label %182

74:                                               ; preds = %61, %58, %55
  %75 = load ptr, ptr @get.curp, align 8, !tbaa !9
  %76 = load i32, ptr %4, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds i8, ptr %75, i64 %77
  %79 = load i32, ptr %3, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %78, i8 0, i64 %80, i1 false)
  %81 = load i64, ptr @address, align 8, !tbaa !11
  %82 = load i32, ptr %4, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = add nsw i64 %81, %83
  store i64 %84, ptr @eaddress, align 8, !tbaa !11
  %85 = load i32, ptr @length, align 4, !tbaa !5
  %86 = icmp eq i32 %85, 0
  br i1 %86, label %87, label %91

87:                                               ; preds = %74
  %88 = load ptr, ptr @stdin, align 8, !tbaa !9
  %89 = call i64 @ftell(ptr noundef %88)
  %90 = call i64 @lseek(i32 noundef 0, i64 noundef %89, i32 noundef 0) #8
  br label %91

91:                                               ; preds = %87, %74
  %92 = load ptr, ptr @get.curp, align 8, !tbaa !9
  store ptr %92, ptr %1, align 8
  store i32 1, ptr %7, align 4
  br label %182

93:                                               ; preds = %39, %36
  %94 = load ptr, ptr @get.curp, align 8, !tbaa !9
  %95 = load i32, ptr %4, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds i8, ptr %94, i64 %96
  %98 = load i32, ptr @length, align 4, !tbaa !5
  %99 = icmp eq i32 %98, -1
  br i1 %99, label %100, label %102

100:                                              ; preds = %93
  %101 = load i32, ptr %3, align 4, !tbaa !5
  br label %112

102:                                              ; preds = %93
  %103 = load i32, ptr @length, align 4, !tbaa !5
  %104 = load i32, ptr %3, align 4, !tbaa !5
  %105 = icmp slt i32 %103, %104
  br i1 %105, label %106, label %108

106:                                              ; preds = %102
  %107 = load i32, ptr @length, align 4, !tbaa !5
  br label %110

108:                                              ; preds = %102
  %109 = load i32, ptr %3, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %108, %106
  %111 = phi i32 [ %107, %106 ], [ %109, %108 ]
  br label %112

112:                                              ; preds = %110, %100
  %113 = phi i32 [ %101, %100 ], [ %111, %110 ]
  %114 = sext i32 %113 to i64
  %115 = load ptr, ptr @stdin, align 8, !tbaa !9
  %116 = call i64 @fread(ptr noundef %97, i64 noundef 1, i64 noundef %114, ptr noundef %115)
  %117 = trunc i64 %116 to i32
  store i32 %117, ptr %2, align 4, !tbaa !5
  %118 = load i32, ptr %2, align 4, !tbaa !5
  %119 = icmp ne i32 %118, 0
  br i1 %119, label %129, label %120

120:                                              ; preds = %112
  %121 = load ptr, ptr @stdin, align 8, !tbaa !9
  %122 = call i32 @ferror(ptr noundef %121) #8
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %128

124:                                              ; preds = %120
  %125 = load ptr, ptr @_argv, align 8, !tbaa !9
  %126 = getelementptr inbounds ptr, ptr %125, i64 -1
  %127 = load ptr, ptr %126, align 8, !tbaa !9
  call void (ptr, ...) @warn(ptr noundef @.str, ptr noundef %127)
  br label %128

128:                                              ; preds = %124, %120
  store i32 1, ptr @get.ateof, align 4, !tbaa !5
  br label %33

129:                                              ; preds = %112
  store i32 0, ptr @get.ateof, align 4, !tbaa !5
  %130 = load i32, ptr @length, align 4, !tbaa !5
  %131 = icmp ne i32 %130, -1
  br i1 %131, label %132, label %136

132:                                              ; preds = %129
  %133 = load i32, ptr %2, align 4, !tbaa !5
  %134 = load i32, ptr @length, align 4, !tbaa !5
  %135 = sub nsw i32 %134, %133
  store i32 %135, ptr @length, align 4, !tbaa !5
  br label %136

136:                                              ; preds = %132, %129
  %137 = load i32, ptr %2, align 4, !tbaa !5
  %138 = load i32, ptr %3, align 4, !tbaa !5
  %139 = sub nsw i32 %138, %137
  store i32 %139, ptr %3, align 4, !tbaa !5
  %140 = icmp ne i32 %139, 0
  br i1 %140, label %177, label %141

141:                                              ; preds = %136
  %142 = load i32, ptr @vflag, align 4, !tbaa !5
  %143 = icmp eq i32 %142, 0
  br i1 %143, label %157, label %144

144:                                              ; preds = %141
  %145 = load i32, ptr @vflag, align 4, !tbaa !5
  %146 = icmp eq i32 %145, 2
  br i1 %146, label %157, label %147

147:                                              ; preds = %144
  %148 = load i32, ptr %5, align 4, !tbaa !5
  %149 = icmp eq i32 %148, 0
  br i1 %149, label %157, label %150

150:                                              ; preds = %147
  %151 = load ptr, ptr @get.curp, align 8, !tbaa !9
  %152 = load ptr, ptr @get.savp, align 8, !tbaa !9
  %153 = load i32, ptr @blocksize, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = call i32 @bcmp(ptr noundef %151, ptr noundef %152, i64 noundef %154) #11
  %156 = icmp ne i32 %155, 0
  br i1 %156, label %157, label %166

157:                                              ; preds = %150, %147, %144, %141
  %158 = load i32, ptr @vflag, align 4, !tbaa !5
  %159 = icmp eq i32 %158, 1
  br i1 %159, label %163, label %160

160:                                              ; preds = %157
  %161 = load i32, ptr @vflag, align 4, !tbaa !5
  %162 = icmp eq i32 %161, 2
  br i1 %162, label %163, label %164

163:                                              ; preds = %160, %157
  store i32 3, ptr @vflag, align 4, !tbaa !5
  br label %164

164:                                              ; preds = %163, %160
  %165 = load ptr, ptr @get.curp, align 8, !tbaa !9
  store ptr %165, ptr %1, align 8
  store i32 1, ptr %7, align 4
  br label %182

166:                                              ; preds = %150
  %167 = load i32, ptr @vflag, align 4, !tbaa !5
  %168 = icmp eq i32 %167, 3
  br i1 %168, label %169, label %171

169:                                              ; preds = %166
  %170 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %171

171:                                              ; preds = %169, %166
  store i32 1, ptr @vflag, align 4, !tbaa !5
  %172 = load i32, ptr @blocksize, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = load i64, ptr @address, align 8, !tbaa !11
  %175 = add nsw i64 %174, %173
  store i64 %175, ptr @address, align 8, !tbaa !11
  %176 = load i32, ptr @blocksize, align 4, !tbaa !5
  store i32 %176, ptr %3, align 4, !tbaa !5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %181

177:                                              ; preds = %136
  %178 = load i32, ptr %2, align 4, !tbaa !5
  %179 = load i32, ptr %4, align 4, !tbaa !5
  %180 = add nsw i32 %179, %178
  store i32 %180, ptr %4, align 4, !tbaa !5
  br label %181

181:                                              ; preds = %177, %171
  br label %33

182:                                              ; preds = %164, %91, %73, %54
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %183 = load ptr, ptr %1, align 8
  ret ptr %183
}

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

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

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

; Function Attrs: noreturn
declare void @err(i32 noundef, ptr noundef, ...) #4

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

; Function Attrs: noreturn
declare void @errx(i32 noundef, ptr noundef, ...) #4

; Function Attrs: nounwind willreturn memory(read)
declare i32 @bcmp(ptr noundef, ptr noundef, i64 noundef) #5

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

; Function Attrs: nounwind
declare i64 @lseek(i32 noundef, i64 noundef, i32 noundef) #7

declare i64 @ftell(ptr noundef) #2

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

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

declare void @warn(ptr noundef, ...) #2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!"long", !7, i64 0}


; 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"

@vflag = external dso_local local_unnamed_addr global i32, align 4
@address = external hidden local_unnamed_addr global i64, align 8
@eaddress = external hidden local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@get.ateof = external hidden local_unnamed_addr global i32, align 4
@get.curp = external hidden local_unnamed_addr global ptr, align 8
@get.savp = external hidden local_unnamed_addr global ptr, align 8
@blocksize = external local_unnamed_addr global i32, align 4
@length = external local_unnamed_addr global i32, align 4
@odmode = external local_unnamed_addr global i32, align 4
@skip = external local_unnamed_addr global i64, align 8
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@_argv = external hidden local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local ptr @get() local_unnamed_addr #0 {
  %1 = load ptr, ptr @get.curp, align 8, !tbaa !5
  %.not = icmp ne ptr %1, null
  br i1 %.not, label %12, label %2

2:                                                ; preds = %0
  %3 = load i32, ptr @blocksize, align 4, !tbaa !9
  %4 = sext i32 %3 to i64
  %5 = tail call noalias ptr @calloc(i64 noundef 1, i64 noundef %4) #10
  store ptr %5, ptr @get.curp, align 8, !tbaa !5
  %6 = icmp eq ptr %5, null
  br i1 %6, label %7, label %8

7:                                                ; preds = %2
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef null) #11
  unreachable

8:                                                ; preds = %2
  %9 = tail call noalias ptr @calloc(i64 noundef 1, i64 noundef %4) #10
  store ptr %9, ptr @get.savp, align 8, !tbaa !5
  %10 = icmp eq ptr %9, null
  br i1 %10, label %11, label %18

11:                                               ; preds = %8
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef null) #11
  unreachable

12:                                               ; preds = %0
  %13 = load ptr, ptr @get.savp, align 8, !tbaa !5
  store ptr %13, ptr @get.curp, align 8, !tbaa !5
  store ptr %1, ptr @get.savp, align 8, !tbaa !5
  %14 = load i32, ptr @blocksize, align 4, !tbaa !9
  %15 = sext i32 %14 to i64
  %16 = load i64, ptr @address, align 8, !tbaa !11
  %17 = add nsw i64 %16, %15
  store i64 %17, ptr @address, align 8, !tbaa !11
  br label %18

18:                                               ; preds = %8, %12
  %19 = phi i32 [ %3, %8 ], [ %14, %12 ]
  %20 = load i32, ptr @length, align 4
  %.not364956 = icmp eq i32 %20, 0
  br i1 %.not364956, label %.outer._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %18
  %.pre.pre71 = load i32, ptr @get.ateof, align 4, !tbaa !9
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.outer
  %.pre = phi i32 [ %.pre73, %.outer ], [ %.pre.pre71, %.lr.ph.preheader ]
  %21 = phi i32 [ %126, %.outer ], [ %20, %.lr.ph.preheader ]
  %.026.ph58 = phi i32 [ %.1, %.outer ], [ 0, %.lr.ph.preheader ]
  %.027.ph57 = phi i32 [ %.128, %.outer ], [ %19, %.lr.ph.preheader ]
  %22 = sext i32 %.026.ph58 to i64
  %.not37.peel = icmp eq i32 %.pre, 0
  br i1 %.not37.peel, label %25, label %23

23:                                               ; preds = %.lr.ph
  %24 = tail call i32 @next(ptr noundef null)
  %.not38.peel = icmp eq i32 %24, 0
  br i1 %.not38.peel, label %.outer._crit_edge, label %._crit_edge.peel

._crit_edge.peel:                                 ; preds = %23
  %.pre67.peel = load i32, ptr @length, align 4
  br label %25

25:                                               ; preds = %._crit_edge.peel, %.lr.ph
  %26 = phi i32 [ %.pre67.peel, %._crit_edge.peel ], [ %21, %.lr.ph ]
  %27 = load ptr, ptr @get.curp, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %27, i64 %22
  %29 = icmp eq i32 %26, -1
  %30 = tail call i32 @llvm.smin.i32(i32 %26, i32 %.027.ph57)
  %31 = select i1 %29, i32 %.027.ph57, i32 %30
  %32 = sext i32 %31 to i64
  %33 = load ptr, ptr @stdin, align 8, !tbaa !5
  %34 = tail call i64 @fread(ptr noundef %28, i64 noundef 1, i64 noundef %32, ptr noundef %33)
  %35 = trunc i64 %34 to i32
  %.not41.peel = icmp eq i32 %35, 0
  br i1 %.not41.peel, label %36, label %.loopexit

36:                                               ; preds = %25
  %37 = load ptr, ptr @stdin, align 8, !tbaa !5
  %38 = tail call i32 @ferror(ptr noundef %37) #12
  %.not42.peel = icmp eq i32 %38, 0
  br i1 %.not42.peel, label %43, label %39

39:                                               ; preds = %36
  %40 = load ptr, ptr @_argv, align 8, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %40, i64 -8
  %42 = load ptr, ptr %41, align 8, !tbaa !5
  tail call void (ptr, ...) @warn(ptr noundef nonnull @.str, ptr noundef %42) #12
  br label %43

43:                                               ; preds = %39, %36
  store i32 1, ptr @get.ateof, align 4, !tbaa !9
  %44 = load i32, ptr @length, align 4
  %.not36.peel = icmp eq i32 %44, 0
  br i1 %.not36.peel, label %.outer._crit_edge, label %.lr.ph.peel.newph

.lr.ph.peel.newph:                                ; preds = %43, %95
  %45 = tail call i32 @next(ptr noundef null)
  %.not38 = icmp eq i32 %45, 0
  br i1 %.not38, label %.outer._crit_edge, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.peel.newph
  %.pre67 = load i32, ptr @length, align 4
  %46 = load ptr, ptr @get.curp, align 8, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %46, i64 %22
  %48 = icmp eq i32 %.pre67, -1
  %49 = tail call i32 @llvm.smin.i32(i32 %.pre67, i32 %.027.ph57)
  %50 = select i1 %48, i32 %.027.ph57, i32 %49
  %51 = sext i32 %50 to i64
  %52 = load ptr, ptr @stdin, align 8, !tbaa !5
  %53 = tail call i64 @fread(ptr noundef %47, i64 noundef 1, i64 noundef %51, ptr noundef %52)
  %54 = trunc i64 %53 to i32
  %.not41 = icmp eq i32 %54, 0
  br i1 %.not41, label %88, label %.loopexit

.outer._crit_edge:                                ; preds = %.outer, %95, %.lr.ph.peel.newph, %23, %43, %18
  %.027.ph.lcssa = phi i32 [ %19, %18 ], [ %.027.ph57, %43 ], [ %.027.ph57, %23 ], [ %.027.ph57, %.lr.ph.peel.newph ], [ %.027.ph57, %95 ], [ %.128, %.outer ]
  %.026.ph.lcssa = phi i32 [ 0, %18 ], [ %.026.ph58, %43 ], [ %.026.ph58, %23 ], [ %.026.ph58, %.lr.ph.peel.newph ], [ %.026.ph58, %95 ], [ %.1, %.outer ]
  %55 = load i32, ptr @odmode, align 4, !tbaa !9
  %.not39 = icmp eq i32 %55, 0
  br i1 %.not39, label %61, label %56

56:                                               ; preds = %.outer._crit_edge
  %57 = load i64, ptr @address, align 8, !tbaa !11
  %58 = load i64, ptr @skip, align 8, !tbaa !11
  %59 = icmp slt i64 %57, %58
  br i1 %59, label %60, label %61

60:                                               ; preds = %56
  tail call void (i32, ptr, ...) @errx(i32 noundef 1, ptr noundef nonnull @.str.2) #11
  unreachable

61:                                               ; preds = %56, %.outer._crit_edge
  %62 = load i32, ptr @blocksize, align 4, !tbaa !9
  %63 = icmp eq i32 %.027.ph.lcssa, %62
  br i1 %63, label %127, label %64

64:                                               ; preds = %61
  %65 = load i32, ptr @vflag, align 4, !tbaa !9
  %66 = icmp ne i32 %65, 0
  %or.cond = and i1 %.not, %66
  %.pre70 = load ptr, ptr @get.curp, align 8, !tbaa !5
  br i1 %or.cond, label %67, label %._crit_edge78

._crit_edge78:                                    ; preds = %64
  %.pre79 = sext i32 %.026.ph.lcssa to i64
  br label %75

67:                                               ; preds = %64
  %68 = load ptr, ptr @get.savp, align 8, !tbaa !5
  %69 = sext i32 %.026.ph.lcssa to i64
  %70 = tail call i32 @bcmp(ptr noundef %.pre70, ptr noundef %68, i64 noundef %69) #13
  %71 = icmp eq i32 %70, 0
  br i1 %71, label %72, label %75

72:                                               ; preds = %67
  %.not40 = icmp eq i32 %65, 1
  br i1 %.not40, label %127, label %73

73:                                               ; preds = %72
  %74 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %127

75:                                               ; preds = %._crit_edge78, %67
  %.pre-phi80 = phi i64 [ %.pre79, %._crit_edge78 ], [ %69, %67 ]
  %76 = getelementptr inbounds i8, ptr %.pre70, i64 %.pre-phi80
  %77 = sext i32 %.027.ph.lcssa to i64
  tail call void @llvm.memset.p0.i64(ptr align 1 %76, i8 0, i64 %77, i1 false)
  %78 = load i64, ptr @address, align 8, !tbaa !11
  %79 = add nsw i64 %78, %.pre-phi80
  store i64 %79, ptr @eaddress, align 8, !tbaa !11
  %80 = load i32, ptr @length, align 4, !tbaa !9
  %81 = icmp eq i32 %80, 0
  br i1 %81, label %82, label %86

82:                                               ; preds = %75
  %83 = load ptr, ptr @stdin, align 8, !tbaa !5
  %84 = tail call i64 @ftell(ptr noundef %83)
  %85 = tail call i64 @lseek(i32 noundef 0, i64 noundef %84, i32 noundef 0) #12
  br label %86

86:                                               ; preds = %82, %75
  %87 = load ptr, ptr @get.curp, align 8, !tbaa !5
  br label %127

88:                                               ; preds = %._crit_edge
  %89 = load ptr, ptr @stdin, align 8, !tbaa !5
  %90 = tail call i32 @ferror(ptr noundef %89) #12
  %.not42 = icmp eq i32 %90, 0
  br i1 %.not42, label %95, label %91

91:                                               ; preds = %88
  %92 = load ptr, ptr @_argv, align 8, !tbaa !5
  %93 = getelementptr inbounds i8, ptr %92, i64 -8
  %94 = load ptr, ptr %93, align 8, !tbaa !5
  tail call void (ptr, ...) @warn(ptr noundef nonnull @.str, ptr noundef %94) #12
  br label %95

95:                                               ; preds = %91, %88
  store i32 1, ptr @get.ateof, align 4, !tbaa !9
  %96 = load i32, ptr @length, align 4
  %.not36 = icmp eq i32 %96, 0
  br i1 %.not36, label %.outer._crit_edge, label %.lr.ph.peel.newph, !llvm.loop !13

.loopexit:                                        ; preds = %._crit_edge, %25
  %.lcssa = phi i32 [ %35, %25 ], [ %54, %._crit_edge ]
  store i32 0, ptr @get.ateof, align 4, !tbaa !9
  %97 = load i32, ptr @length, align 4
  %.not43 = icmp eq i32 %97, -1
  br i1 %.not43, label %100, label %98

98:                                               ; preds = %.loopexit
  %99 = sub nsw i32 %97, %.lcssa
  store i32 %99, ptr @length, align 4, !tbaa !9
  br label %100

100:                                              ; preds = %98, %.loopexit
  %.pre6976 = phi i32 [ %99, %98 ], [ -1, %.loopexit ]
  %101 = sub nsw i32 %.027.ph57, %.lcssa
  %.not44 = icmp eq i32 %101, 0
  br i1 %.not44, label %102, label %124

102:                                              ; preds = %100
  %103 = load i32, ptr @vflag, align 4
  %104 = and i32 %103, -3
  %or.cond3 = icmp ne i32 %104, 0
  %or.cond5.not = and i1 %.not, %or.cond3
  br i1 %or.cond5.not, label %105, label %111

105:                                              ; preds = %102
  %106 = load ptr, ptr @get.curp, align 8, !tbaa !5
  %107 = load ptr, ptr @get.savp, align 8, !tbaa !5
  %108 = load i32, ptr @blocksize, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = tail call i32 @bcmp(ptr noundef %106, ptr noundef %107, i64 noundef %109) #13
  %.not45 = icmp eq i32 %110, 0
  br i1 %.not45, label %116, label %111

111:                                              ; preds = %105, %102
  %112 = add i32 %103, -1
  %or.cond7 = icmp ult i32 %112, 2
  br i1 %or.cond7, label %113, label %114

113:                                              ; preds = %111
  store i32 3, ptr @vflag, align 4, !tbaa !9
  br label %114

114:                                              ; preds = %111, %113
  %115 = load ptr, ptr @get.curp, align 8, !tbaa !5
  br label %127

116:                                              ; preds = %105
  %117 = icmp eq i32 %103, 3
  br i1 %117, label %118, label %120

118:                                              ; preds = %116
  %119 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %.pre68 = load i32, ptr @blocksize, align 4, !tbaa !9
  %.pre.pre = load i32, ptr @get.ateof, align 4, !tbaa !9
  %.pre69.pre = load i32, ptr @length, align 4
  %.pre77 = sext i32 %.pre68 to i64
  br label %120

120:                                              ; preds = %118, %116
  %.pre-phi = phi i64 [ %.pre77, %118 ], [ %109, %116 ]
  %.pre69 = phi i32 [ %.pre69.pre, %118 ], [ %.pre6976, %116 ]
  %.pre74 = phi i32 [ %.pre.pre, %118 ], [ 0, %116 ]
  %121 = phi i32 [ %.pre68, %118 ], [ %108, %116 ]
  store i32 1, ptr @vflag, align 4, !tbaa !9
  %122 = load i64, ptr @address, align 8, !tbaa !11
  %123 = add nsw i64 %122, %.pre-phi
  store i64 %123, ptr @address, align 8, !tbaa !11
  br label %.outer

124:                                              ; preds = %100
  %125 = add nsw i32 %.026.ph58, %.lcssa
  br label %.outer

.outer:                                           ; preds = %124, %120
  %.pre73 = phi i32 [ 0, %124 ], [ %.pre74, %120 ]
  %126 = phi i32 [ %.pre6976, %124 ], [ %.pre69, %120 ]
  %.128 = phi i32 [ %101, %124 ], [ %121, %120 ]
  %.1 = phi i32 [ %125, %124 ], [ 0, %120 ]
  %.not3649 = icmp eq i32 %126, 0
  br i1 %.not3649, label %.outer._crit_edge, label %.lr.ph

127:                                              ; preds = %72, %73, %61, %114, %86
  %.0 = phi ptr [ %115, %114 ], [ %87, %86 ], [ null, %61 ], [ null, %73 ], [ null, %72 ]
  ret ptr %.0
}

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

; 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: noreturn
declare void @err(i32 noundef, ptr noundef, ...) local_unnamed_addr #3

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

; Function Attrs: noreturn
declare void @errx(i32 noundef, ptr noundef, ...) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; Function Attrs: nounwind
declare i64 @lseek(i32 noundef, i64 noundef, i32 noundef) local_unnamed_addr #6

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

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

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

declare void @warn(ptr noundef, ...) local_unnamed_addr #8

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #9

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,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 = { noreturn "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 nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { 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 #8 = { "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 #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { nounwind allocsize(0,1) }
attributes #11 = { noreturn nounwind }
attributes #12 = { nounwind }
attributes #13 = { nounwind willreturn memory(read) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.peeled.count", i32 1}


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