; LLVM IR from ebiggers/libdeflate :: programs (checksum)

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

@.str = external hidden unnamed_addr constant [9 x i8], align 1
@stdout = external global ptr, align 8
@toptarg = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [25 x i8], align 1
@stderr = external global ptr, align 8
@toptind = external global i32, align 4
@.str.3 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i8, align 1
  %8 = alloca i8, align 1
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca [1 x ptr], align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca %struct.file_stream, align 8
  %20 = alloca i32, align 4
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #5
  store i8 0, ptr %6, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #5
  store i8 0, ptr %7, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #5
  store i8 0, ptr %8, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store ptr null, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store i64 0, ptr %11, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store i64 131072, ptr %12, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.memset.p0.i64(ptr align 8 %13, i8 0, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %23 = load ptr, ptr %5, align 8, !tbaa !9
  call void @begin_program(ptr noundef %23)
  br label %24

24:                                               ; preds = %57, %2
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = load ptr, ptr %5, align 8, !tbaa !9
  %27 = call i32 @tgetopt(i32 noundef %25, ptr noundef %26, ptr noundef @.str)
  store i32 %27, ptr %15, align 4, !tbaa !5
  %28 = icmp ne i32 %27, -1
  br i1 %28, label %29, label %58

29:                                               ; preds = %24
  %30 = load i32, ptr %15, align 4, !tbaa !5
  switch i32 %30, label %55 [
    i32 65, label %31
    i32 104, label %32
    i32 109, label %34
    i32 115, label %42
    i32 116, label %53
    i32 90, label %54
  ]

31:                                               ; preds = %29
  store i8 1, ptr %6, align 1, !tbaa !11
  br label %57

32:                                               ; preds = %29
  %33 = load ptr, ptr @stdout, align 8, !tbaa !9
  call void @show_usage(ptr noundef %33)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %197

34:                                               ; preds = %29
  %35 = load ptr, ptr @toptarg, align 8, !tbaa !9
  %36 = call i64 @strtoul(ptr noundef %35, ptr noundef null, i32 noundef 10) #5
  store i64 %36, ptr %11, align 8, !tbaa !13
  %37 = load i64, ptr %11, align 8, !tbaa !13
  %38 = icmp uge i64 %37, 4096
  br i1 %38, label %39, label %41

39:                                               ; preds = %34
  %40 = load ptr, ptr @toptarg, align 8, !tbaa !9
  call void (ptr, ...) @msg(ptr noundef @.str.1, ptr noundef %40)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %197

41:                                               ; preds = %34
  br label %57

42:                                               ; preds = %29
  %43 = load ptr, ptr @toptarg, align 8, !tbaa !9
  %44 = call i64 @strtoul(ptr noundef %43, ptr noundef null, i32 noundef 10) #5
  store i64 %44, ptr %12, align 8, !tbaa !13
  %45 = load i64, ptr %12, align 8, !tbaa !13
  %46 = icmp eq i64 %45, 0
  br i1 %46, label %50, label %47

47:                                               ; preds = %42
  %48 = load i64, ptr %12, align 8, !tbaa !13
  %49 = icmp ugt i64 %48, 9223372036854775807
  br i1 %49, label %50, label %52

50:                                               ; preds = %47, %42
  %51 = load ptr, ptr @toptarg, align 8, !tbaa !9
  call void (ptr, ...) @msg(ptr noundef @.str.2, ptr noundef %51)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %197

52:                                               ; preds = %47
  br label %57

53:                                               ; preds = %29
  store i8 1, ptr %8, align 1, !tbaa !11
  br label %57

54:                                               ; preds = %29
  store i8 1, ptr %7, align 1, !tbaa !11
  br label %57

55:                                               ; preds = %29
  %56 = load ptr, ptr @stderr, align 8, !tbaa !9
  call void @show_usage(ptr noundef %56)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %197

57:                                               ; preds = %54, %53, %52, %41, %31
  br label %24, !llvm.loop !15

58:                                               ; preds = %24
  %59 = load i32, ptr @toptind, align 4, !tbaa !5
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sub nsw i32 %60, %59
  store i32 %61, ptr %4, align 4, !tbaa !5
  %62 = load i32, ptr @toptind, align 4, !tbaa !5
  %63 = load ptr, ptr %5, align 8, !tbaa !9
  %64 = sext i32 %62 to i64
  %65 = getelementptr inbounds ptr, ptr %63, i64 %64
  store ptr %65, ptr %5, align 8, !tbaa !9
  %66 = load i8, ptr %6, align 1, !tbaa !11, !range !17, !noundef !18
  %67 = trunc i8 %66 to i1
  br i1 %67, label %68, label %74

68:                                               ; preds = %58
  %69 = load i8, ptr %7, align 1, !tbaa !11, !range !17, !noundef !18
  %70 = trunc i8 %69 to i1
  br i1 %70, label %71, label %72

71:                                               ; preds = %68
  store ptr @adler32_zlib, ptr %14, align 8, !tbaa !9
  br label %73

72:                                               ; preds = %68
  store ptr @adler32_libdeflate, ptr %14, align 8, !tbaa !9
  br label %73

73:                                               ; preds = %72, %71
  br label %80

74:                                               ; preds = %58
  %75 = load i8, ptr %7, align 1, !tbaa !11, !range !17, !noundef !18
  %76 = trunc i8 %75 to i1
  br i1 %76, label %77, label %78

77:                                               ; preds = %74
  store ptr @crc32_zlib, ptr %14, align 8, !tbaa !9
  br label %79

78:                                               ; preds = %74
  store ptr @crc32_libdeflate, ptr %14, align 8, !tbaa !9
  br label %79

79:                                               ; preds = %78, %77
  br label %80

80:                                               ; preds = %79, %73
  %81 = load i64, ptr %12, align 8, !tbaa !13
  %82 = add i64 %81, 4096
  %83 = load i64, ptr %11, align 8, !tbaa !13
  %84 = add i64 %82, %83
  %85 = call ptr @xmalloc(i64 noundef %84)
  store ptr %85, ptr %9, align 8, !tbaa !9
  %86 = load ptr, ptr %9, align 8, !tbaa !9
  %87 = icmp eq ptr %86, null
  br i1 %87, label %88, label %89

88:                                               ; preds = %80
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %197

89:                                               ; preds = %80
  %90 = load ptr, ptr %9, align 8, !tbaa !9
  %91 = load ptr, ptr %9, align 8, !tbaa !9
  %92 = ptrtoint ptr %91 to i64
  %93 = sub i64 0, %92
  %94 = urem i64 %93, 4096
  %95 = getelementptr inbounds i8, ptr %90, i64 %94
  %96 = load i64, ptr %11, align 8, !tbaa !13
  %97 = getelementptr inbounds i8, ptr %95, i64 %96
  store ptr %97, ptr %10, align 8, !tbaa !9
  %98 = load i32, ptr %4, align 4, !tbaa !5
  %99 = icmp eq i32 %98, 0
  br i1 %99, label %100, label %102

100:                                              ; preds = %89
  %101 = getelementptr inbounds [1 x ptr], ptr %13, i64 0, i64 0
  store ptr %101, ptr %5, align 8, !tbaa !9
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %137

102:                                              ; preds = %89
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %133, %102
  %104 = load i32, ptr %16, align 4, !tbaa !5
  %105 = load i32, ptr %4, align 4, !tbaa !5
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %107, label %136

107:                                              ; preds = %103
  %108 = load ptr, ptr %5, align 8, !tbaa !9
  %109 = load i32, ptr %16, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds ptr, ptr %108, i64 %110
  %112 = load ptr, ptr %111, align 8, !tbaa !9
  %113 = getelementptr inbounds i8, ptr %112, i64 0
  %114 = load i8, ptr %113, align 1, !tbaa !19
  %115 = sext i8 %114 to i32
  %116 = icmp eq i32 %115, 45
  br i1 %116, label %117, label %132

117:                                              ; preds = %107
  %118 = load ptr, ptr %5, align 8, !tbaa !9
  %119 = load i32, ptr %16, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds ptr, ptr %118, i64 %120
  %122 = load ptr, ptr %121, align 8, !tbaa !9
  %123 = getelementptr inbounds i8, ptr %122, i64 1
  %124 = load i8, ptr %123, align 1, !tbaa !19
  %125 = sext i8 %124 to i32
  %126 = icmp eq i32 %125, 0
  br i1 %126, label %127, label %132

127:                                              ; preds = %117
  %128 = load ptr, ptr %5, align 8, !tbaa !9
  %129 = load i32, ptr %16, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds ptr, ptr %128, i64 %130
  store ptr null, ptr %131, align 8, !tbaa !9
  br label %132

132:                                              ; preds = %127, %117, %107
  br label %133

133:                                              ; preds = %132
  %134 = load i32, ptr %16, align 4, !tbaa !5
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %16, align 4, !tbaa !5
  br label %103, !llvm.loop !20

136:                                              ; preds = %103
  br label %137

137:                                              ; preds = %136, %100
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %138

138:                                              ; preds = %189, %137
  %139 = load i32, ptr %16, align 4, !tbaa !5
  %140 = load i32, ptr %4, align 4, !tbaa !5
  %141 = icmp slt i32 %139, %140
  br i1 %141, label %142, label %192

142:                                              ; preds = %138
  call void @llvm.lifetime.start.p0(i64 48, ptr %19) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  %143 = load ptr, ptr %14, align 8, !tbaa !9
  %144 = call i32 %143(i32 noundef 0, ptr noundef null, i64 noundef 0)
  store i32 %144, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  store i64 0, ptr %21, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  store i64 0, ptr %22, align 8, !tbaa !13
  %145 = load ptr, ptr %5, align 8, !tbaa !9
  %146 = load i32, ptr %16, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds ptr, ptr %145, i64 %147
  %149 = load ptr, ptr %148, align 8, !tbaa !9
  %150 = call i32 @xopen_for_read(ptr noundef %149, i1 noundef zeroext true, ptr noundef %19)
  store i32 %150, ptr %17, align 4, !tbaa !5
  %151 = load i32, ptr %17, align 4, !tbaa !5
  %152 = icmp ne i32 %151, 0
  br i1 %152, label %153, label %154

153:                                              ; preds = %142
  store i32 11, ptr %18, align 4
  br label %186

154:                                              ; preds = %142
  %155 = load ptr, ptr %14, align 8, !tbaa !9
  %156 = load ptr, ptr %10, align 8, !tbaa !9
  %157 = load i64, ptr %12, align 8, !tbaa !13
  %158 = call i32 @checksum_stream(ptr noundef %19, ptr noundef %155, ptr noundef %20, ptr noundef %156, i64 noundef %157, ptr noundef %21, ptr noundef %22)
  store i32 %158, ptr %17, align 4, !tbaa !5
  %159 = load i32, ptr %17, align 4, !tbaa !5
  %160 = icmp eq i32 %159, 0
  br i1 %160, label %161, label %180

161:                                              ; preds = %154
  %162 = load i8, ptr %8, align 1, !tbaa !11, !range !17, !noundef !18
  %163 = trunc i8 %162 to i1
  br i1 %163, label %164, label %174

164:                                              ; preds = %161
  %165 = load i32, ptr %20, align 4, !tbaa !5
  %166 = getelementptr inbounds %struct.file_stream, ptr %19, i32 0, i32 1
  %167 = load ptr, ptr %166, align 8, !tbaa !21
  %168 = load i64, ptr %22, align 8, !tbaa !13
  %169 = call i64 @timer_ticks_to_ms(i64 noundef %168)
  %170 = load i64, ptr %21, align 8, !tbaa !13
  %171 = load i64, ptr %22, align 8, !tbaa !13
  %172 = call i64 @timer_MB_per_s(i64 noundef %170, i64 noundef %171)
  %173 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %165, ptr noundef %167, i64 noundef %169, i64 noundef %172)
  br label %179

174:                                              ; preds = %161
  %175 = load i32, ptr %20, align 4, !tbaa !5
  %176 = getelementptr inbounds %struct.file_stream, ptr %19, i32 0, i32 1
  %177 = load ptr, ptr %176, align 8, !tbaa !21
  %178 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %175, ptr noundef %177)
  br label %179

179:                                              ; preds = %174, %164
  br label %180

180:                                              ; preds = %179, %154
  %181 = call i32 @xclose(ptr noundef %19)
  %182 = load i32, ptr %17, align 4, !tbaa !5
  %183 = icmp ne i32 %182, 0
  br i1 %183, label %184, label %185

184:                                              ; preds = %180
  store i32 11, ptr %18, align 4
  br label %186

185:                                              ; preds = %180
  store i32 0, ptr %18, align 4
  br label %186

186:                                              ; preds = %185, %184, %153
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %19) #5
  %187 = load i32, ptr %18, align 4
  switch i32 %187, label %197 [
    i32 0, label %188
    i32 11, label %193
  ]

188:                                              ; preds = %186
  br label %189

189:                                              ; preds = %188
  %190 = load i32, ptr %16, align 4, !tbaa !5
  %191 = add nsw i32 %190, 1
  store i32 %191, ptr %16, align 4, !tbaa !5
  br label %138, !llvm.loop !23

192:                                              ; preds = %138
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %193

193:                                              ; preds = %192, %186
  %194 = load ptr, ptr %9, align 8, !tbaa !9
  call void @free(ptr noundef %194) #5
  %195 = load i32, ptr %17, align 4, !tbaa !5
  %196 = sub nsw i32 0, %195
  store i32 %196, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %197

197:                                              ; preds = %193, %186, %88, %55, %50, %39, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  %198 = load i32, ptr %3, align 4
  ret i32 %198
}

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

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

declare void @begin_program(ptr noundef) #3

declare i32 @tgetopt(i32 noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @show_usage(ptr noundef) #0

; Function Attrs: nounwind
declare i64 @strtoul(ptr noundef, ptr noundef, i32 noundef) #4

declare void @msg(ptr noundef, ...) #3

; Function Attrs: nounwind uwtable
declare hidden i32 @adler32_zlib(i32 noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @adler32_libdeflate(i32 noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @crc32_zlib(i32 noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @crc32_libdeflate(i32 noundef, ptr noundef, i64 noundef) #0

declare ptr @xmalloc(i64 noundef) #3

declare i32 @xopen_for_read(ptr noundef, i1 noundef zeroext, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden i32 @checksum_stream(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #0

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

declare i64 @timer_ticks_to_ms(i64 noundef) #3

declare i64 @timer_MB_per_s(i64 noundef, i64 noundef) #3

declare i32 @xclose(ptr noundef) #3

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { "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 = { 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, !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 = !{!"_Bool", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !16}
!21 = !{!22, !10, i64 8}
!22 = !{!"file_stream", !6, i64 0, !10, i64 8, !12, i64 16, !10, i64 24, !10, i64 32, !14, i64 40}
!23 = distinct !{!23, !16}


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

@.str = external hidden unnamed_addr constant [9 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@toptarg = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [25 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@toptind = external local_unnamed_addr global i32, align 4
@.str.3 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -2147483647, -2147483648) i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca [1 x ptr], align 8
  %4 = alloca %struct.file_stream, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  store i64 0, ptr %3, align 8
  tail call void @begin_program(ptr noundef %1) #6
  br label %.outer

.outer:                                           ; preds = %8, %2
  %.059.ph = phi i1 [ false, %2 ], [ true, %8 ]
  %.057.ph = phi i1 [ false, %2 ], [ %.057.ph231, %8 ]
  %.055.ph = phi i1 [ false, %2 ], [ %.055.ph236, %8 ]
  %.052.ph = phi i64 [ 0, %2 ], [ %.052.ph240, %8 ]
  %.050.ph = phi i64 [ 131072, %2 ], [ %.050, %8 ]
  br label %.outer230

.outer230:                                        ; preds = %.outer, %24
  %.057.ph231 = phi i1 [ %.057.ph, %.outer ], [ true, %24 ]
  %.055.ph232 = phi i1 [ %.055.ph, %.outer ], [ %.055.ph236, %24 ]
  %.052.ph233 = phi i64 [ %.052.ph, %.outer ], [ %.052.ph240, %24 ]
  %.050.ph234 = phi i64 [ %.050.ph, %.outer ], [ %.050, %24 ]
  br label %.outer235

.outer235:                                        ; preds = %.outer230, %23
  %.055.ph236 = phi i1 [ %.055.ph232, %.outer230 ], [ true, %23 ]
  %.052.ph237 = phi i64 [ %.052.ph233, %.outer230 ], [ %.052.ph240, %23 ]
  %.050.ph238 = phi i64 [ %.050.ph234, %.outer230 ], [ %.050, %23 ]
  br label %.outer239

.outer239:                                        ; preds = %.outer235, %12
  %.052.ph240 = phi i64 [ %.052.ph237, %.outer235 ], [ %14, %12 ]
  %.050.ph241 = phi i64 [ %.050.ph238, %.outer235 ], [ %.050, %12 ]
  br label %8

8:                                                ; preds = %.outer239, %18
  %.050 = phi i64 [ %20, %18 ], [ %.050.ph241, %.outer239 ]
  %9 = tail call i32 @tgetopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str) #6
  switch i32 %9, label %25 [
    i32 -1, label %27
    i32 65, label %.outer
    i32 104, label %10
    i32 109, label %12
    i32 115, label %18
    i32 116, label %23
    i32 90, label %24
  ], !llvm.loop !5

10:                                               ; preds = %8
  %11 = load ptr, ptr @stdout, align 8, !tbaa !7
  tail call void @show_usage(ptr noundef %11)
  br label %106

12:                                               ; preds = %8
  %13 = load ptr, ptr @toptarg, align 8, !tbaa !7
  %14 = tail call i64 @strtoul(ptr nocapture noundef %13, ptr noundef null, i32 noundef 10) #6
  %15 = icmp ugt i64 %14, 4095
  br i1 %15, label %16, label %.outer239, !llvm.loop !5

16:                                               ; preds = %12
  %17 = load ptr, ptr @toptarg, align 8, !tbaa !7
  tail call void (ptr, ...) @msg(ptr noundef nonnull @.str.1, ptr noundef %17) #6
  br label %106

18:                                               ; preds = %8
  %19 = load ptr, ptr @toptarg, align 8, !tbaa !7
  %20 = tail call i64 @strtoul(ptr nocapture noundef %19, ptr noundef null, i32 noundef 10) #6
  %or.cond = icmp slt i64 %20, 1
  br i1 %or.cond, label %21, label %8, !llvm.loop !5

21:                                               ; preds = %18
  %22 = load ptr, ptr @toptarg, align 8, !tbaa !7
  tail call void (ptr, ...) @msg(ptr noundef nonnull @.str.2, ptr noundef %22) #6
  br label %106

23:                                               ; preds = %8
  br label %.outer235, !llvm.loop !5

24:                                               ; preds = %8
  br label %.outer230, !llvm.loop !5

25:                                               ; preds = %8
  %26 = load ptr, ptr @stderr, align 8, !tbaa !7
  tail call void @show_usage(ptr noundef %26)
  br label %106

27:                                               ; preds = %8
  %28 = load i32, ptr @toptind, align 4, !tbaa !11
  %29 = sub i32 %0, %28
  %30 = sext i32 %28 to i64
  %31 = getelementptr inbounds ptr, ptr %1, i64 %30
  %adler32_zlib.adler32_libdeflate = select i1 %.057.ph231, ptr @adler32_zlib, ptr @adler32_libdeflate
  %crc32_zlib.crc32_libdeflate = select i1 %.057.ph231, ptr @crc32_zlib, ptr @crc32_libdeflate
  %.049 = select i1 %.059.ph, ptr %adler32_zlib.adler32_libdeflate, ptr %crc32_zlib.crc32_libdeflate
  %32 = or disjoint i64 %.052.ph240, 4096
  %33 = add nuw i64 %32, %.050
  %34 = tail call ptr @xmalloc(i64 noundef %33) #6
  %35 = icmp eq ptr %34, null
  br i1 %35, label %106, label %36

36:                                               ; preds = %27
  %37 = ptrtoint ptr %34 to i64
  %38 = sub i64 0, %37
  %39 = and i64 %38, 4095
  %40 = getelementptr inbounds i8, ptr %34, i64 %39
  %41 = getelementptr inbounds i8, ptr %40, i64 %.052.ph240
  %42 = icmp eq i32 %28, %0
  br i1 %42, label %.lr.ph102, label %.preheader

.preheader:                                       ; preds = %36
  %43 = icmp sgt i32 %29, 0
  br i1 %43, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %.preheader
  %wide.trip.count = zext nneg i32 %29 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %44 = icmp eq i32 %29, 1
  br i1 %44, label %.loopexit77.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph

.lr.ph:                                           ; preds = %63, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next.1, %63 ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %63 ]
  %45 = getelementptr inbounds ptr, ptr %31, i64 %indvars.iv
  %46 = load ptr, ptr %45, align 8, !tbaa !7
  %47 = load i8, ptr %46, align 1, !tbaa !13
  %48 = icmp eq i8 %47, 45
  br i1 %48, label %49, label %.lr.ph.1

49:                                               ; preds = %.lr.ph
  %50 = getelementptr inbounds i8, ptr %46, i64 1
  %51 = load i8, ptr %50, align 1, !tbaa !13
  %52 = icmp eq i8 %51, 0
  br i1 %52, label %53, label %.lr.ph.1

53:                                               ; preds = %49
  store ptr null, ptr %45, align 8, !tbaa !7
  br label %.lr.ph.1

.lr.ph.1:                                         ; preds = %.lr.ph, %49, %53
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %54 = getelementptr inbounds ptr, ptr %31, i64 %indvars.iv.next
  %55 = load ptr, ptr %54, align 8, !tbaa !7
  %56 = load i8, ptr %55, align 1, !tbaa !13
  %57 = icmp eq i8 %56, 45
  br i1 %57, label %58, label %63

58:                                               ; preds = %.lr.ph.1
  %59 = getelementptr inbounds i8, ptr %55, i64 1
  %60 = load i8, ptr %59, align 1, !tbaa !13
  %61 = icmp eq i8 %60, 0
  br i1 %61, label %62, label %63

62:                                               ; preds = %58
  store ptr null, ptr %54, align 8, !tbaa !7
  br label %63

63:                                               ; preds = %62, %58, %.lr.ph.1
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.loopexit77.unr-lcssa, label %.lr.ph, !llvm.loop !14

.loopexit77.unr-lcssa:                            ; preds = %63, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.1, %63 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.loopexit77, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %.loopexit77.unr-lcssa
  %64 = getelementptr inbounds ptr, ptr %31, i64 %indvars.iv.unr
  %65 = load ptr, ptr %64, align 8, !tbaa !7
  %66 = load i8, ptr %65, align 1, !tbaa !13
  %67 = icmp eq i8 %66, 45
  br i1 %67, label %68, label %.loopexit77

68:                                               ; preds = %.lr.ph.epil
  %69 = getelementptr inbounds i8, ptr %65, i64 1
  %70 = load i8, ptr %69, align 1, !tbaa !13
  %71 = icmp eq i8 %70, 0
  br i1 %71, label %72, label %.loopexit77

72:                                               ; preds = %68
  store ptr null, ptr %64, align 8, !tbaa !7
  br label %.loopexit77

.loopexit77:                                      ; preds = %.lr.ph.epil, %68, %72, %.loopexit77.unr-lcssa
  %73 = zext nneg i32 %29 to i64
  br label %.lr.ph102

.lr.ph102:                                        ; preds = %.loopexit77, %36
  %.054150 = phi i64 [ %73, %.loopexit77 ], [ 1, %36 ]
  %.061149 = phi ptr [ %31, %.loopexit77 ], [ %3, %36 ]
  %74 = getelementptr inbounds i8, ptr %4, i64 8
  br i1 %.055.ph236, label %.lr.ph102.split.us, label %.lr.ph102.split

.lr.ph102.split.us:                               ; preds = %.lr.ph102, %82
  %indvars.iv142 = phi i64 [ %indvars.iv.next143, %82 ], [ 0, %.lr.ph102 ]
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %75 = call i32 %.049(i32 noundef 0, ptr noundef null, i64 noundef 0) #6, !callees !15
  store i32 %75, ptr %5, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  store i64 0, ptr %6, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  store i64 0, ptr %7, align 8, !tbaa !16
  %76 = getelementptr inbounds ptr, ptr %.061149, i64 %indvars.iv142
  %77 = load ptr, ptr %76, align 8, !tbaa !7
  %78 = call i32 @xopen_for_read(ptr noundef %77, i1 noundef zeroext true, ptr noundef nonnull %4) #6
  %.not70.us = icmp eq i32 %78, 0
  br i1 %.not70.us, label %79, label %.thread

79:                                               ; preds = %.lr.ph102.split.us
  %80 = call i32 @checksum_stream(ptr noundef nonnull %4, ptr noundef nonnull %.049, ptr noundef nonnull %5, ptr noundef nonnull %41, i64 noundef %.050, ptr noundef nonnull %6, ptr noundef nonnull %7)
  %81 = icmp eq i32 %80, 0
  br i1 %81, label %82, label %.split.us

82:                                               ; preds = %79
  %83 = load i32, ptr %5, align 4, !tbaa !11
  %84 = load ptr, ptr %74, align 8, !tbaa !18
  %85 = load i64, ptr %7, align 8, !tbaa !16
  %86 = call i64 @timer_ticks_to_ms(i64 noundef %85) #6
  %87 = load i64, ptr %6, align 8, !tbaa !16
  %88 = load i64, ptr %7, align 8, !tbaa !16
  %89 = call i64 @timer_MB_per_s(i64 noundef %87, i64 noundef %88) #6
  %90 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %83, ptr noundef %84, i64 noundef %86, i64 noundef %89)
  %91 = call i32 @xclose(ptr noundef nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #6
  %indvars.iv.next143 = add nuw nsw i64 %indvars.iv142, 1
  %exitcond146.not = icmp eq i64 %indvars.iv.next143, %.054150
  br i1 %exitcond146.not, label %.loopexit, label %.lr.ph102.split.us, !llvm.loop !21

.lr.ph102.split:                                  ; preds = %.lr.ph102, %99
  %indvars.iv137 = phi i64 [ %indvars.iv.next138, %99 ], [ 0, %.lr.ph102 ]
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %92 = call i32 %.049(i32 noundef 0, ptr noundef null, i64 noundef 0) #6, !callees !15
  store i32 %92, ptr %5, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  store i64 0, ptr %6, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  store i64 0, ptr %7, align 8, !tbaa !16
  %93 = getelementptr inbounds ptr, ptr %.061149, i64 %indvars.iv137
  %94 = load ptr, ptr %93, align 8, !tbaa !7
  %95 = call i32 @xopen_for_read(ptr noundef %94, i1 noundef zeroext true, ptr noundef nonnull %4) #6
  %.not70 = icmp eq i32 %95, 0
  br i1 %.not70, label %96, label %.thread

96:                                               ; preds = %.lr.ph102.split
  %97 = call i32 @checksum_stream(ptr noundef nonnull %4, ptr noundef nonnull %.049, ptr noundef nonnull %5, ptr noundef nonnull %41, i64 noundef %.050, ptr noundef nonnull %6, ptr noundef nonnull %7)
  %98 = icmp eq i32 %97, 0
  br i1 %98, label %99, label %.split.us

99:                                               ; preds = %96
  %100 = load i32, ptr %5, align 4, !tbaa !11
  %101 = load ptr, ptr %74, align 8, !tbaa !18
  %102 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %100, ptr noundef %101)
  %103 = call i32 @xclose(ptr noundef nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #6
  %indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1
  %exitcond141.not = icmp eq i64 %indvars.iv.next138, %.054150
  br i1 %exitcond141.not, label %.loopexit, label %.lr.ph102.split, !llvm.loop !21

.split.us:                                        ; preds = %96, %79
  %.us-phi103 = phi i32 [ %80, %79 ], [ %97, %96 ]
  %104 = call i32 @xclose(ptr noundef nonnull %4) #6
  br label %.thread

.thread:                                          ; preds = %.lr.ph102.split, %.lr.ph102.split.us, %.split.us
  %.045.ph = phi i32 [ %.us-phi103, %.split.us ], [ %78, %.lr.ph102.split.us ], [ %95, %.lr.ph102.split ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #6
  br label %.loopexit

.loopexit:                                        ; preds = %99, %82, %.preheader, %.thread
  %.1 = phi i32 [ %.045.ph, %.thread ], [ 0, %.preheader ], [ 0, %82 ], [ 0, %99 ]
  call void @free(ptr noundef %34) #6
  %105 = sub nsw i32 0, %.1
  br label %106

106:                                              ; preds = %27, %.loopexit, %25, %21, %16, %10
  %.048 = phi i32 [ 1, %25 ], [ 1, %21 ], [ 1, %16 ], [ 0, %10 ], [ %105, %.loopexit ], [ 1, %27 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  ret i32 %.048
}

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

declare void @begin_program(ptr noundef) local_unnamed_addr #2

declare i32 @tgetopt(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtoul(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3

declare void @msg(ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i32 @adler32_zlib(i32 noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @adler32_libdeflate(i32 noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @crc32_zlib(i32 noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @crc32_libdeflate(i32 noundef, ptr noundef, i64 noundef) #0

declare ptr @xmalloc(i64 noundef) local_unnamed_addr #2

declare i32 @xopen_for_read(ptr noundef, i1 noundef zeroext, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i32 @checksum_stream(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

declare i64 @timer_ticks_to_ms(i64 noundef) local_unnamed_addr #2

declare i64 @timer_MB_per_s(i64 noundef, i64 noundef) local_unnamed_addr #2

declare i32 @xclose(ptr noundef) local_unnamed_addr #2

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 "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 = { 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 #5 = { 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 #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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !9, i64 0}
!13 = !{!9, !9, i64 0}
!14 = distinct !{!14, !6}
!15 = !{ptr @adler32_libdeflate, ptr @adler32_zlib, ptr @crc32_libdeflate, ptr @crc32_zlib}
!16 = !{!17, !17, i64 0}
!17 = !{!"long", !9, i64 0}
!18 = !{!19, !8, i64 8}
!19 = !{!"file_stream", !12, i64 0, !8, i64 8, !20, i64 16, !8, i64 24, !8, i64 32, !17, i64 40}
!20 = !{!"_Bool", !9, i64 0}
!21 = distinct !{!21, !6}


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