; LLVM IR from ryanlayer/giggle :: src (file_read)

; 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.input_file = type { ptr, ptr, ptr, ptr, ptr, ptr, i64, i32, ptr, ptr, ptr }
%struct.BGZF = type { i32, i32, i32, i32, i32, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr }
%struct.__kstring_t = type { i64, i64, ptr }

@.str.14 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @scan_s(ptr noundef, i32 noundef, ptr noundef, ptr noundef, i8 noundef signext) #0

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @input_file_get_next_interval_bed(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) #0 {
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store ptr %3, ptr %12, align 8, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.input_file, ptr %21, i32 0, i32 6
  %23 = load i64, ptr %22, align 8, !tbaa !9
  %24 = load ptr, ptr %14, align 8, !tbaa !5
  store i64 %23, ptr %24, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.input_file, ptr %25, i32 0, i32 2
  %27 = load ptr, ptr %26, align 8, !tbaa !14
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.input_file, ptr %28, i32 0, i32 5
  %30 = load ptr, ptr %29, align 8, !tbaa !15
  %31 = call i32 @bgzf_getline(ptr noundef %27, i32 noundef 10, ptr noundef %30)
  store i32 %31, ptr %16, align 4, !tbaa !16
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.input_file, ptr %32, i32 0, i32 2
  %34 = load ptr, ptr %33, align 8, !tbaa !14
  %35 = getelementptr inbounds %struct.BGZF, ptr %34, i32 0, i32 5
  %36 = load i64, ptr %35, align 8, !tbaa !17
  %37 = shl i64 %36, 16
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.input_file, ptr %38, i32 0, i32 2
  %40 = load ptr, ptr %39, align 8, !tbaa !14
  %41 = getelementptr inbounds %struct.BGZF, ptr %40, i32 0, i32 4
  %42 = load i32, ptr %41, align 8, !tbaa !19
  %43 = and i32 %42, 65535
  %44 = sext i32 %43 to i64
  %45 = or i64 %37, %44
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.input_file, ptr %46, i32 0, i32 6
  store i64 %45, ptr %47, align 8, !tbaa !9
  %48 = load i32, ptr %16, align 4, !tbaa !16
  %49 = icmp slt i32 %48, 0
  br i1 %49, label %50, label %52

50:                                               ; preds = %7
  %51 = load i32, ptr %16, align 4, !tbaa !16
  store i32 %51, ptr %8, align 4
  store i32 1, ptr %17, align 4
  br label %204

52:                                               ; preds = %7
  %53 = load ptr, ptr %15, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.__kstring_t, ptr %53, i32 0, i32 0
  store i64 0, ptr %54, align 8, !tbaa !20
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.input_file, ptr %55, i32 0, i32 5
  %57 = load ptr, ptr %56, align 8, !tbaa !15
  %58 = getelementptr inbounds %struct.__kstring_t, ptr %57, i32 0, i32 2
  %59 = load ptr, ptr %58, align 8, !tbaa !22
  %60 = load ptr, ptr %15, align 8, !tbaa !5
  %61 = call i32 @kputs(ptr noundef %59, ptr noundef %60)
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #9
  store i32 0, ptr %18, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  store i32 0, ptr %19, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #9
  store i32 0, ptr %20, align 4, !tbaa !16
  br label %62

62:                                               ; preds = %199, %52
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.input_file, ptr %63, i32 0, i32 5
  %65 = load ptr, ptr %64, align 8, !tbaa !15
  %66 = getelementptr inbounds %struct.__kstring_t, ptr %65, i32 0, i32 2
  %67 = load ptr, ptr %66, align 8, !tbaa !22
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.input_file, ptr %68, i32 0, i32 5
  %70 = load ptr, ptr %69, align 8, !tbaa !15
  %71 = getelementptr inbounds %struct.__kstring_t, ptr %70, i32 0, i32 0
  %72 = load i64, ptr %71, align 8, !tbaa !20
  %73 = trunc i64 %72 to i32
  %74 = call i32 @scan_s(ptr noundef %67, i32 noundef %73, ptr noundef %18, ptr noundef %19, i8 noundef signext 9)
  %75 = icmp sge i32 %74, 0
  br i1 %75, label %76, label %202

76:                                               ; preds = %62
  %77 = load i32, ptr %20, align 4, !tbaa !16
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %20, align 4, !tbaa !16
  %79 = load i32, ptr %20, align 4, !tbaa !16
  %80 = icmp eq i32 %79, 1
  br i1 %80, label %81, label %166

81:                                               ; preds = %76
  %82 = load i32, ptr %19, align 4, !tbaa !16
  %83 = load i32, ptr %18, align 4, !tbaa !16
  %84 = sub nsw i32 %82, %83
  %85 = add nsw i32 %84, 1
  %86 = load ptr, ptr %11, align 8, !tbaa !5
  %87 = load i32, ptr %86, align 4, !tbaa !16
  %88 = icmp sgt i32 %85, %87
  br i1 %88, label %89, label %107

89:                                               ; preds = %81
  %90 = load ptr, ptr %11, align 8, !tbaa !5
  %91 = load i32, ptr %90, align 4, !tbaa !16
  %92 = mul nsw i32 %91, 2
  %93 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 %92, ptr %93, align 4, !tbaa !16
  %94 = load ptr, ptr %10, align 8, !tbaa !5
  %95 = load ptr, ptr %94, align 8, !tbaa !5
  %96 = load ptr, ptr %11, align 8, !tbaa !5
  %97 = load i32, ptr %96, align 4, !tbaa !16
  %98 = sext i32 %97 to i64
  %99 = mul i64 %98, 1
  %100 = call ptr @realloc(ptr noundef %95, i64 noundef %99) #10
  %101 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %100, ptr %101, align 8, !tbaa !5
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  %103 = load ptr, ptr %102, align 8, !tbaa !5
  %104 = icmp eq ptr %103, null
  br i1 %104, label %105, label %106

105:                                              ; preds = %89
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.14) #11
  unreachable

106:                                              ; preds = %89
  br label %107

107:                                              ; preds = %106, %81
  %108 = load ptr, ptr %9, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.input_file, ptr %108, i32 0, i32 5
  %110 = load ptr, ptr %109, align 8, !tbaa !15
  %111 = getelementptr inbounds %struct.__kstring_t, ptr %110, i32 0, i32 2
  %112 = load ptr, ptr %111, align 8, !tbaa !22
  %113 = load i32, ptr %18, align 4, !tbaa !16
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds i8, ptr %112, i64 %114
  %116 = call i32 @strncmp(ptr noundef @.str.15, ptr noundef %115, i64 noundef 3) #12
  %117 = icmp eq i32 %116, 0
  br i1 %117, label %118, label %143

118:                                              ; preds = %107
  %119 = load ptr, ptr %10, align 8, !tbaa !5
  %120 = load ptr, ptr %119, align 8, !tbaa !5
  %121 = load ptr, ptr %9, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.input_file, ptr %121, i32 0, i32 5
  %123 = load ptr, ptr %122, align 8, !tbaa !15
  %124 = getelementptr inbounds %struct.__kstring_t, ptr %123, i32 0, i32 2
  %125 = load ptr, ptr %124, align 8, !tbaa !22
  %126 = load i32, ptr %18, align 4, !tbaa !16
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds i8, ptr %125, i64 %127
  %129 = getelementptr inbounds i8, ptr %128, i64 3
  %130 = load i32, ptr %19, align 4, !tbaa !16
  %131 = load i32, ptr %18, align 4, !tbaa !16
  %132 = sub nsw i32 %130, %131
  %133 = sub nsw i32 %132, 3
  %134 = sext i32 %133 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %120, ptr align 1 %129, i64 %134, i1 false)
  %135 = load ptr, ptr %10, align 8, !tbaa !5
  %136 = load ptr, ptr %135, align 8, !tbaa !5
  %137 = load i32, ptr %19, align 4, !tbaa !16
  %138 = load i32, ptr %18, align 4, !tbaa !16
  %139 = sub nsw i32 %137, %138
  %140 = sub nsw i32 %139, 3
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds i8, ptr %136, i64 %141
  store i8 0, ptr %142, align 1, !tbaa !23
  br label %165

143:                                              ; preds = %107
  %144 = load ptr, ptr %10, align 8, !tbaa !5
  %145 = load ptr, ptr %144, align 8, !tbaa !5
  %146 = load ptr, ptr %9, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.input_file, ptr %146, i32 0, i32 5
  %148 = load ptr, ptr %147, align 8, !tbaa !15
  %149 = getelementptr inbounds %struct.__kstring_t, ptr %148, i32 0, i32 2
  %150 = load ptr, ptr %149, align 8, !tbaa !22
  %151 = load i32, ptr %18, align 4, !tbaa !16
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds i8, ptr %150, i64 %152
  %154 = load i32, ptr %19, align 4, !tbaa !16
  %155 = load i32, ptr %18, align 4, !tbaa !16
  %156 = sub nsw i32 %154, %155
  %157 = sext i32 %156 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %145, ptr align 1 %153, i64 %157, i1 false)
  %158 = load ptr, ptr %10, align 8, !tbaa !5
  %159 = load ptr, ptr %158, align 8, !tbaa !5
  %160 = load i32, ptr %19, align 4, !tbaa !16
  %161 = load i32, ptr %18, align 4, !tbaa !16
  %162 = sub nsw i32 %160, %161
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds i8, ptr %159, i64 %163
  store i8 0, ptr %164, align 1, !tbaa !23
  br label %165

165:                                              ; preds = %143, %118
  br label %199

166:                                              ; preds = %76
  %167 = load i32, ptr %20, align 4, !tbaa !16
  %168 = icmp eq i32 %167, 2
  br i1 %168, label %169, label %181

169:                                              ; preds = %166
  %170 = load ptr, ptr %9, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.input_file, ptr %170, i32 0, i32 5
  %172 = load ptr, ptr %171, align 8, !tbaa !15
  %173 = getelementptr inbounds %struct.__kstring_t, ptr %172, i32 0, i32 2
  %174 = load ptr, ptr %173, align 8, !tbaa !22
  %175 = load i32, ptr %18, align 4, !tbaa !16
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds i8, ptr %174, i64 %176
  %178 = call i64 @strtol(ptr noundef %177, ptr noundef null, i32 noundef 0) #9
  %179 = trunc i64 %178 to i32
  %180 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 %179, ptr %180, align 4, !tbaa !16
  br label %198

181:                                              ; preds = %166
  %182 = load i32, ptr %20, align 4, !tbaa !16
  %183 = icmp eq i32 %182, 3
  br i1 %183, label %184, label %196

184:                                              ; preds = %181
  %185 = load ptr, ptr %9, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.input_file, ptr %185, i32 0, i32 5
  %187 = load ptr, ptr %186, align 8, !tbaa !15
  %188 = getelementptr inbounds %struct.__kstring_t, ptr %187, i32 0, i32 2
  %189 = load ptr, ptr %188, align 8, !tbaa !22
  %190 = load i32, ptr %18, align 4, !tbaa !16
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds i8, ptr %189, i64 %191
  %193 = call i64 @strtol(ptr noundef %192, ptr noundef null, i32 noundef 0) #9
  %194 = trunc i64 %193 to i32
  %195 = load ptr, ptr %13, align 8, !tbaa !5
  store i32 %194, ptr %195, align 4, !tbaa !16
  br label %197

196:                                              ; preds = %181
  br label %202

197:                                              ; preds = %184
  br label %198

198:                                              ; preds = %197, %169
  br label %199

199:                                              ; preds = %198, %165
  %200 = load i32, ptr %19, align 4, !tbaa !16
  %201 = add nsw i32 %200, 1
  store i32 %201, ptr %18, align 4, !tbaa !16
  br label %62, !llvm.loop !24

202:                                              ; preds = %196, %62
  %203 = load i32, ptr %16, align 4, !tbaa !16
  store i32 %203, ptr %8, align 4
  store i32 1, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  br label %204

204:                                              ; preds = %202, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  %205 = load i32, ptr %8, align 4
  ret i32 %205
}

; 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) #3

declare i32 @bgzf_getline(ptr noundef, i32 noundef, ptr noundef) #4

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @kputs(ptr noundef, ptr noundef) #5

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #6

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

; Function Attrs: nounwind
declare i64 @strtol(ptr noundef, ptr noundef, i32 noundef) #8

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 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint 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 #6 = { nounwind allocsize(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 #7 = { 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 #8 = { 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 #9 = { nounwind }
attributes #10 = { nounwind allocsize(1) }
attributes #11 = { noreturn }
attributes #12 = { 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, !11, i64 48}
!10 = !{!"input_file", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48, !12, i64 56, !6, i64 64, !6, i64 72, !6, i64 80}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 40}
!16 = !{!12, !12, i64 0}
!17 = !{!18, !11, i64 24}
!18 = !{!"BGZF", !12, i64 0, !12, i64 2, !12, i64 2, !12, i64 2, !12, i64 2, !12, i64 2, !12, i64 3, !12, i64 3, !12, i64 3, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !11, i64 24, !11, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !12, i64 88, !6, i64 96}
!19 = !{!18, !12, i64 16}
!20 = !{!21, !11, i64 0}
!21 = !{!"__kstring_t", !11, i64 0, !11, i64 8, !6, i64 16}
!22 = !{!21, !6, i64 16}
!23 = !{!7, !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


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

@.str.14 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @scan_s(ptr noundef, i32 noundef, ptr noundef, ptr noundef, i8 noundef signext) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @input_file_get_next_interval_bed(ptr nocapture noundef %0, ptr nocapture noundef %1, ptr nocapture noundef %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4, ptr nocapture noundef writeonly %5, ptr noundef %6) local_unnamed_addr #0 {
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = getelementptr inbounds i8, ptr %0, i64 48
  %11 = load i64, ptr %10, align 8, !tbaa !5
  store i64 %11, ptr %5, align 8, !tbaa !12
  %12 = getelementptr inbounds i8, ptr %0, i64 16
  %13 = load ptr, ptr %12, align 8, !tbaa !13
  %14 = getelementptr inbounds i8, ptr %0, i64 40
  %15 = load ptr, ptr %14, align 8, !tbaa !14
  %16 = tail call i32 @bgzf_getline(ptr noundef %13, i32 noundef 10, ptr noundef %15) #9
  %17 = load ptr, ptr %12, align 8, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %17, i64 24
  %19 = load i64, ptr %18, align 8, !tbaa !15
  %20 = shl i64 %19, 16
  %21 = getelementptr inbounds i8, ptr %17, i64 16
  %22 = load i32, ptr %21, align 8, !tbaa !17
  %23 = and i32 %22, 65535
  %24 = zext nneg i32 %23 to i64
  %25 = or disjoint i64 %20, %24
  store i64 %25, ptr %10, align 8, !tbaa !5
  %26 = icmp slt i32 %16, 0
  br i1 %26, label %112, label %27

27:                                               ; preds = %7
  store i64 0, ptr %6, align 8, !tbaa !18
  %28 = load ptr, ptr %14, align 8, !tbaa !14
  %29 = getelementptr inbounds i8, ptr %28, i64 16
  %30 = load ptr, ptr %29, align 8, !tbaa !20
  %31 = tail call i32 @kputs(ptr noundef %30, ptr noundef nonnull %6)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #9
  store i32 0, ptr %8, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #9
  store i32 0, ptr %9, align 4, !tbaa !21
  %32 = load ptr, ptr %14, align 8, !tbaa !14
  %33 = getelementptr inbounds i8, ptr %32, i64 16
  %34 = load ptr, ptr %33, align 8, !tbaa !20
  %35 = load i64, ptr %32, align 8, !tbaa !18
  %36 = trunc i64 %35 to i32
  %37 = call i32 @scan_s(ptr noundef %34, i32 noundef %36, ptr noundef nonnull %8, ptr noundef nonnull %9, i8 noundef signext 9)
  %38 = icmp sgt i32 %37, -1
  br i1 %38, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %27, %102
  %.040 = phi i32 [ %39, %102 ], [ 0, %27 ]
  %39 = add nuw nsw i32 %.040, 1
  switch i32 %.040, label %._crit_edge [
    i32 0, label %40
    i32 1, label %84
    i32 2, label %93
  ]

40:                                               ; preds = %.lr.ph
  %41 = load i32, ptr %9, align 4, !tbaa !21
  %42 = load i32, ptr %8, align 4, !tbaa !21
  %43 = sub nsw i32 %41, %42
  %44 = load i32, ptr %2, align 4, !tbaa !21
  %.not = icmp slt i32 %43, %44
  br i1 %.not, label %52, label %45

45:                                               ; preds = %40
  %46 = shl nsw i32 %44, 1
  store i32 %46, ptr %2, align 4, !tbaa !21
  %47 = load ptr, ptr %1, align 8, !tbaa !22
  %48 = sext i32 %46 to i64
  %49 = call ptr @realloc(ptr noundef %47, i64 noundef %48) #10
  store ptr %49, ptr %1, align 8, !tbaa !22
  %50 = icmp eq ptr %49, null
  br i1 %50, label %51, label %._crit_edge42

._crit_edge42:                                    ; preds = %45
  %.pre = load i32, ptr %8, align 4, !tbaa !21
  br label %52

51:                                               ; preds = %45
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.14) #11
  unreachable

52:                                               ; preds = %._crit_edge42, %40
  %53 = phi i32 [ %.pre, %._crit_edge42 ], [ %42, %40 ]
  %54 = load ptr, ptr %14, align 8, !tbaa !14
  %55 = getelementptr inbounds i8, ptr %54, i64 16
  %56 = load ptr, ptr %55, align 8, !tbaa !20
  %57 = sext i32 %53 to i64
  %58 = getelementptr inbounds i8, ptr %56, i64 %57
  %59 = call i32 @strncmp(ptr noundef nonnull dereferenceable(1) @.str.15, ptr noundef nonnull dereferenceable(1) %58, i64 noundef 3) #12
  %60 = icmp eq i32 %59, 0
  %61 = load ptr, ptr %1, align 8, !tbaa !22
  br i1 %60, label %62, label %74

62:                                               ; preds = %52
  %63 = getelementptr inbounds i8, ptr %58, i64 3
  %64 = load i32, ptr %9, align 4, !tbaa !21
  %reass.sub = sub i32 %64, %53
  %65 = add i32 %reass.sub, -3
  %66 = sext i32 %65 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %61, ptr nonnull align 1 %63, i64 %66, i1 false)
  %67 = load ptr, ptr %1, align 8, !tbaa !22
  %68 = load i32, ptr %9, align 4, !tbaa !21
  %69 = load i32, ptr %8, align 4, !tbaa !21
  %70 = sub nsw i32 %68, %69
  %71 = sext i32 %70 to i64
  %72 = getelementptr i8, ptr %67, i64 %71
  %73 = getelementptr i8, ptr %72, i64 -3
  store i8 0, ptr %73, align 1, !tbaa !23
  br label %102

74:                                               ; preds = %52
  %75 = load i32, ptr %9, align 4, !tbaa !21
  %76 = sub nsw i32 %75, %53
  %77 = sext i32 %76 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %61, ptr align 1 %58, i64 %77, i1 false)
  %78 = load ptr, ptr %1, align 8, !tbaa !22
  %79 = load i32, ptr %9, align 4, !tbaa !21
  %80 = load i32, ptr %8, align 4, !tbaa !21
  %81 = sub nsw i32 %79, %80
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds i8, ptr %78, i64 %82
  store i8 0, ptr %83, align 1, !tbaa !23
  br label %102

84:                                               ; preds = %.lr.ph
  %85 = load ptr, ptr %14, align 8, !tbaa !14
  %86 = getelementptr inbounds i8, ptr %85, i64 16
  %87 = load ptr, ptr %86, align 8, !tbaa !20
  %88 = load i32, ptr %8, align 4, !tbaa !21
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds i8, ptr %87, i64 %89
  %91 = call i64 @strtol(ptr nocapture noundef %90, ptr noundef null, i32 noundef 0) #9
  %92 = trunc i64 %91 to i32
  store i32 %92, ptr %3, align 4, !tbaa !21
  br label %102

93:                                               ; preds = %.lr.ph
  %94 = load ptr, ptr %14, align 8, !tbaa !14
  %95 = getelementptr inbounds i8, ptr %94, i64 16
  %96 = load ptr, ptr %95, align 8, !tbaa !20
  %97 = load i32, ptr %8, align 4, !tbaa !21
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds i8, ptr %96, i64 %98
  %100 = call i64 @strtol(ptr nocapture noundef %99, ptr noundef null, i32 noundef 0) #9
  %101 = trunc i64 %100 to i32
  store i32 %101, ptr %4, align 4, !tbaa !21
  br label %102

102:                                              ; preds = %84, %93, %62, %74
  %103 = load i32, ptr %9, align 4, !tbaa !21
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %8, align 4, !tbaa !21
  %105 = load ptr, ptr %14, align 8, !tbaa !14
  %106 = getelementptr inbounds i8, ptr %105, i64 16
  %107 = load ptr, ptr %106, align 8, !tbaa !20
  %108 = load i64, ptr %105, align 8, !tbaa !18
  %109 = trunc i64 %108 to i32
  %110 = call i32 @scan_s(ptr noundef %107, i32 noundef %109, ptr noundef nonnull %8, ptr noundef nonnull %9, i8 noundef signext 9)
  %111 = icmp sgt i32 %110, -1
  br i1 %111, label %.lr.ph, label %._crit_edge, !llvm.loop !24

._crit_edge:                                      ; preds = %102, %.lr.ph, %27
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #9
  br label %112

112:                                              ; preds = %7, %._crit_edge
  ret i32 %16
}

; Function Attrs: mustprogress 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) #3

declare i32 @bgzf_getline(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @kputs(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #6

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

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

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 = { 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint 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 #6 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) 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 #7 = { 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 #8 = { 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 #9 = { nounwind }
attributes #10 = { nounwind allocsize(1) }
attributes #11 = { noreturn nounwind }
attributes #12 = { 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, !10, i64 48}
!6 = !{!"input_file", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !10, i64 48, !11, i64 56, !7, i64 64, !7, i64 72, !7, i64 80}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!10, !10, i64 0}
!13 = !{!6, !7, i64 16}
!14 = !{!6, !7, i64 40}
!15 = !{!16, !10, i64 24}
!16 = !{!"BGZF", !11, i64 0, !11, i64 2, !11, i64 2, !11, i64 2, !11, i64 2, !11, i64 2, !11, i64 3, !11, i64 3, !11, i64 3, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !10, i64 24, !10, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !11, i64 88, !7, i64 96}
!17 = !{!16, !11, i64 16}
!18 = !{!19, !10, i64 0}
!19 = !{!"__kstring_t", !10, i64 0, !10, i64 8, !7, i64 16}
!20 = !{!19, !7, i64 16}
!21 = !{!11, !11, i64 0}
!22 = !{!7, !7, i64 0}
!23 = !{!8, !8, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


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