; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode/modules/juce_audio_formats/codecs/oggvorbis (pageseek)

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

@.str = external hidden unnamed_addr constant [5 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @ogg_page_checksum_set(ptr noundef) #2

; 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

; Function Attrs: nounwind uwtable
define dso_local i64 @ogg_sync_pageseek(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca [4 x i8], align 1
  %13 = alloca %struct.ogg_page, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.ogg_sync_state, ptr %16, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.ogg_sync_state, ptr %19, i32 0, i32 3
  %21 = load i32, ptr %20, align 8, !tbaa !12
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds i8, ptr %18, i64 %22
  store ptr %23, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.ogg_sync_state, ptr %24, i32 0, i32 2
  %26 = load i32, ptr %25, align 4, !tbaa !13
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ogg_sync_state, ptr %27, i32 0, i32 3
  %29 = load i32, ptr %28, align 8, !tbaa !12
  %30 = sub nsw i32 %26, %29
  %31 = sext i32 %30 to i64
  store i64 %31, ptr %8, align 8, !tbaa !14
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ogg_sync_state, ptr %32, i32 0, i32 5
  %34 = load i32, ptr %33, align 8, !tbaa !16
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %86

36:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %37 = load i64, ptr %8, align 8, !tbaa !14
  %38 = icmp slt i64 %37, 27
  br i1 %38, label %39, label %40

39:                                               ; preds = %36
  store i64 0, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %83

40:                                               ; preds = %36
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = call i32 @memcmp(ptr noundef %41, ptr noundef @.str, i64 noundef 4) #6
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %45

44:                                               ; preds = %40
  store i32 2, ptr %11, align 4
  br label %83

45:                                               ; preds = %40
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %46, i64 26
  %48 = load i8, ptr %47, align 1, !tbaa !17
  %49 = zext i8 %48 to i32
  %50 = add nsw i32 %49, 27
  store i32 %50, ptr %9, align 4, !tbaa !18
  %51 = load i64, ptr %8, align 8, !tbaa !14
  %52 = load i32, ptr %9, align 4, !tbaa !18
  %53 = sext i32 %52 to i64
  %54 = icmp slt i64 %51, %53
  br i1 %54, label %55, label %56

55:                                               ; preds = %45
  store i64 0, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %83

56:                                               ; preds = %45
  store i32 0, ptr %10, align 4, !tbaa !18
  br label %57

57:                                               ; preds = %76, %56
  %58 = load i32, ptr %10, align 4, !tbaa !18
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %59, i64 26
  %61 = load i8, ptr %60, align 1, !tbaa !17
  %62 = zext i8 %61 to i32
  %63 = icmp slt i32 %58, %62
  br i1 %63, label %64, label %79

64:                                               ; preds = %57
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = load i32, ptr %10, align 4, !tbaa !18
  %67 = add nsw i32 27, %66
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds i8, ptr %65, i64 %68
  %70 = load i8, ptr %69, align 1, !tbaa !17
  %71 = zext i8 %70 to i32
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.ogg_sync_state, ptr %72, i32 0, i32 6
  %74 = load i32, ptr %73, align 4, !tbaa !19
  %75 = add nsw i32 %74, %71
  store i32 %75, ptr %73, align 4, !tbaa !19
  br label %76

76:                                               ; preds = %64
  %77 = load i32, ptr %10, align 4, !tbaa !18
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %10, align 4, !tbaa !18
  br label %57, !llvm.loop !20

79:                                               ; preds = %57
  %80 = load i32, ptr %9, align 4, !tbaa !18
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.ogg_sync_state, ptr %81, i32 0, i32 5
  store i32 %80, ptr %82, align 8, !tbaa !16
  store i32 0, ptr %11, align 4
  br label %83

83:                                               ; preds = %79, %55, %44, %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  %84 = load i32, ptr %11, align 4
  switch i32 %84, label %230 [
    i32 0, label %85
    i32 2, label %192
  ]

85:                                               ; preds = %83
  br label %86

86:                                               ; preds = %85, %2
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.ogg_sync_state, ptr %87, i32 0, i32 6
  %89 = load i32, ptr %88, align 4, !tbaa !19
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.ogg_sync_state, ptr %90, i32 0, i32 5
  %92 = load i32, ptr %91, align 8, !tbaa !16
  %93 = add nsw i32 %89, %92
  %94 = sext i32 %93 to i64
  %95 = load i64, ptr %8, align 8, !tbaa !14
  %96 = icmp sgt i64 %94, %95
  br i1 %96, label %97, label %98

97:                                               ; preds = %86
  store i64 0, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %230

98:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #5
  %99 = getelementptr inbounds [4 x i8], ptr %12, i64 0, i64 0
  %100 = load ptr, ptr %6, align 8, !tbaa !5
  %101 = getelementptr inbounds i8, ptr %100, i64 22
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %99, ptr align 1 %101, i64 4, i1 false)
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = getelementptr inbounds i8, ptr %102, i64 22
  call void @llvm.memset.p0.i64(ptr align 1 %103, i8 0, i64 4, i1 false)
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.ogg_page, ptr %13, i32 0, i32 0
  store ptr %104, ptr %105, align 8, !tbaa !22
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.ogg_sync_state, ptr %106, i32 0, i32 5
  %108 = load i32, ptr %107, align 8, !tbaa !16
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds %struct.ogg_page, ptr %13, i32 0, i32 1
  store i64 %109, ptr %110, align 8, !tbaa !24
  %111 = load ptr, ptr %6, align 8, !tbaa !5
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.ogg_sync_state, ptr %112, i32 0, i32 5
  %114 = load i32, ptr %113, align 8, !tbaa !16
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds i8, ptr %111, i64 %115
  %117 = getelementptr inbounds %struct.ogg_page, ptr %13, i32 0, i32 2
  store ptr %116, ptr %117, align 8, !tbaa !25
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.ogg_sync_state, ptr %118, i32 0, i32 6
  %120 = load i32, ptr %119, align 4, !tbaa !19
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds %struct.ogg_page, ptr %13, i32 0, i32 3
  store i64 %121, ptr %122, align 8, !tbaa !26
  call void @ogg_page_checksum_set(ptr noundef %13)
  %123 = getelementptr inbounds [4 x i8], ptr %12, i64 0, i64 0
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = getelementptr inbounds i8, ptr %124, i64 22
  %126 = call i32 @memcmp(ptr noundef %123, ptr noundef %125, i64 noundef 4) #6
  %127 = icmp ne i32 %126, 0
  br i1 %127, label %128, label %132

128:                                              ; preds = %98
  %129 = load ptr, ptr %6, align 8, !tbaa !5
  %130 = getelementptr inbounds i8, ptr %129, i64 22
  %131 = getelementptr inbounds [4 x i8], ptr %12, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %130, ptr align 1 %131, i64 4, i1 false)
  store i32 2, ptr %11, align 4
  br label %133

132:                                              ; preds = %98
  store i32 0, ptr %11, align 4
  br label %133

133:                                              ; preds = %132, %128
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %134 = load i32, ptr %11, align 4
  switch i32 %134, label %230 [
    i32 0, label %135
    i32 2, label %192
  ]

135:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.ogg_sync_state, ptr %136, i32 0, i32 0
  %138 = load ptr, ptr %137, align 8, !tbaa !9
  %139 = load ptr, ptr %4, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.ogg_sync_state, ptr %139, i32 0, i32 3
  %141 = load i32, ptr %140, align 8, !tbaa !12
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds i8, ptr %138, i64 %142
  store ptr %143, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %144 = load ptr, ptr %5, align 8, !tbaa !5
  %145 = icmp ne ptr %144, null
  br i1 %145, label %146, label %170

146:                                              ; preds = %135
  %147 = load ptr, ptr %14, align 8, !tbaa !5
  %148 = load ptr, ptr %5, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.ogg_page, ptr %148, i32 0, i32 0
  store ptr %147, ptr %149, align 8, !tbaa !22
  %150 = load ptr, ptr %4, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.ogg_sync_state, ptr %150, i32 0, i32 5
  %152 = load i32, ptr %151, align 8, !tbaa !16
  %153 = sext i32 %152 to i64
  %154 = load ptr, ptr %5, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.ogg_page, ptr %154, i32 0, i32 1
  store i64 %153, ptr %155, align 8, !tbaa !24
  %156 = load ptr, ptr %14, align 8, !tbaa !5
  %157 = load ptr, ptr %4, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.ogg_sync_state, ptr %157, i32 0, i32 5
  %159 = load i32, ptr %158, align 8, !tbaa !16
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds i8, ptr %156, i64 %160
  %162 = load ptr, ptr %5, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.ogg_page, ptr %162, i32 0, i32 2
  store ptr %161, ptr %163, align 8, !tbaa !25
  %164 = load ptr, ptr %4, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.ogg_sync_state, ptr %164, i32 0, i32 6
  %166 = load i32, ptr %165, align 4, !tbaa !19
  %167 = sext i32 %166 to i64
  %168 = load ptr, ptr %5, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.ogg_page, ptr %168, i32 0, i32 3
  store i64 %167, ptr %169, align 8, !tbaa !26
  br label %170

170:                                              ; preds = %146, %135
  %171 = load ptr, ptr %4, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.ogg_sync_state, ptr %171, i32 0, i32 4
  store i32 0, ptr %172, align 4, !tbaa !27
  %173 = load ptr, ptr %4, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.ogg_sync_state, ptr %173, i32 0, i32 5
  %175 = load i32, ptr %174, align 8, !tbaa !16
  %176 = load ptr, ptr %4, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.ogg_sync_state, ptr %176, i32 0, i32 6
  %178 = load i32, ptr %177, align 4, !tbaa !19
  %179 = add nsw i32 %175, %178
  %180 = sext i32 %179 to i64
  store i64 %180, ptr %15, align 8, !tbaa !14
  %181 = load ptr, ptr %4, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.ogg_sync_state, ptr %181, i32 0, i32 3
  %183 = load i32, ptr %182, align 8, !tbaa !12
  %184 = sext i32 %183 to i64
  %185 = add nsw i64 %184, %180
  %186 = trunc i64 %185 to i32
  store i32 %186, ptr %182, align 8, !tbaa !12
  %187 = load ptr, ptr %4, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.ogg_sync_state, ptr %187, i32 0, i32 5
  store i32 0, ptr %188, align 8, !tbaa !16
  %189 = load ptr, ptr %4, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.ogg_sync_state, ptr %189, i32 0, i32 6
  store i32 0, ptr %190, align 4, !tbaa !19
  %191 = load i64, ptr %15, align 8, !tbaa !14
  store i64 %191, ptr %3, align 8
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %230

192:                                              ; preds = %133, %83
  %193 = load ptr, ptr %4, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.ogg_sync_state, ptr %193, i32 0, i32 5
  store i32 0, ptr %194, align 8, !tbaa !16
  %195 = load ptr, ptr %4, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.ogg_sync_state, ptr %195, i32 0, i32 6
  store i32 0, ptr %196, align 4, !tbaa !19
  %197 = load ptr, ptr %6, align 8, !tbaa !5
  %198 = getelementptr inbounds i8, ptr %197, i64 1
  %199 = load i64, ptr %8, align 8, !tbaa !14
  %200 = sub nsw i64 %199, 1
  %201 = call ptr @memchr(ptr noundef %198, i32 noundef 79, i64 noundef %200) #6
  store ptr %201, ptr %7, align 8, !tbaa !5
  %202 = load ptr, ptr %7, align 8, !tbaa !5
  %203 = icmp ne ptr %202, null
  br i1 %203, label %213, label %204

204:                                              ; preds = %192
  %205 = load ptr, ptr %4, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.ogg_sync_state, ptr %205, i32 0, i32 0
  %207 = load ptr, ptr %206, align 8, !tbaa !9
  %208 = load ptr, ptr %4, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.ogg_sync_state, ptr %208, i32 0, i32 2
  %210 = load i32, ptr %209, align 4, !tbaa !13
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds i8, ptr %207, i64 %211
  store ptr %212, ptr %7, align 8, !tbaa !5
  br label %213

213:                                              ; preds = %204, %192
  %214 = load ptr, ptr %7, align 8, !tbaa !5
  %215 = load ptr, ptr %4, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.ogg_sync_state, ptr %215, i32 0, i32 0
  %217 = load ptr, ptr %216, align 8, !tbaa !9
  %218 = ptrtoint ptr %214 to i64
  %219 = ptrtoint ptr %217 to i64
  %220 = sub i64 %218, %219
  %221 = trunc i64 %220 to i32
  %222 = load ptr, ptr %4, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.ogg_sync_state, ptr %222, i32 0, i32 3
  store i32 %221, ptr %223, align 8, !tbaa !12
  %224 = load ptr, ptr %7, align 8, !tbaa !5
  %225 = load ptr, ptr %6, align 8, !tbaa !5
  %226 = ptrtoint ptr %224 to i64
  %227 = ptrtoint ptr %225 to i64
  %228 = sub i64 %226, %227
  %229 = sub nsw i64 0, %228
  store i64 %229, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %230

230:                                              ; preds = %213, %170, %133, %97, %83
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %231 = load i64, ptr %3, align 8
  ret i64 %231
}

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { nounwind }
attributes #6 = { 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, !6, i64 0}
!10 = !{!"", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 16}
!13 = !{!10, !11, i64 12}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!10, !11, i64 24}
!17 = !{!7, !7, i64 0}
!18 = !{!11, !11, i64 0}
!19 = !{!10, !11, i64 28}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!23, !6, i64 0}
!23 = !{!"", !6, i64 0, !15, i64 8, !6, i64 16, !15, i64 24}
!24 = !{!23, !15, i64 8}
!25 = !{!23, !6, i64 16}
!26 = !{!23, !15, i64 24}
!27 = !{!10, !11, i64 20}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.ogg_page = type { ptr, i64, ptr, i64 }

@.str = external hidden unnamed_addr constant [5 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775807, -9223372036854775808) i64 @ogg_sync_pageseek(ptr nocapture noundef %0, ptr noundef writeonly %1) local_unnamed_addr #1 {
  %3 = alloca [4 x i8], align 4
  %4 = alloca %struct.ogg_page, align 8
  %5 = load ptr, ptr %0, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load i32, ptr %6, align 8, !tbaa !11
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds i8, ptr %5, i64 %8
  %10 = getelementptr inbounds i8, ptr %0, i64 12
  %11 = load i32, ptr %10, align 4, !tbaa !12
  %12 = sub nsw i32 %11, %7
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds i8, ptr %0, i64 24
  %15 = load i32, ptr %14, align 8, !tbaa !13
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %35

17:                                               ; preds = %2
  %18 = icmp slt i32 %12, 27
  br i1 %18, label %.thread, label %19

19:                                               ; preds = %17
  %bcmp = tail call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %9, ptr noundef nonnull dereferenceable(4) @.str, i64 4)
  %.not = icmp eq i32 %bcmp, 0
  br i1 %.not, label %20, label %69

20:                                               ; preds = %19
  %21 = getelementptr inbounds i8, ptr %9, i64 26
  %22 = load i8, ptr %21, align 1, !tbaa !14
  %23 = zext i8 %22 to i32
  %24 = add nuw nsw i32 %23, 27
  %25 = icmp ult i32 %12, %24
  br i1 %25, label %.thread, label %.preheader

.preheader:                                       ; preds = %20
  %invariant.gep = getelementptr inbounds i8, ptr %9, i64 27
  %.not81 = icmp eq i8 %22, 0
  br i1 %.not81, label %.thread75, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %26 = getelementptr inbounds i8, ptr %0, i64 28
  %.pre = load i32, ptr %26, align 4, !tbaa !15
  br label %27

27:                                               ; preds = %.lr.ph, %27
  %28 = phi i32 [ %.pre, %.lr.ph ], [ %31, %27 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %27 ]
  %gep = getelementptr inbounds i8, ptr %invariant.gep, i64 %indvars.iv
  %29 = load i8, ptr %gep, align 1, !tbaa !14
  %30 = zext i8 %29 to i32
  %31 = add nsw i32 %28, %30
  store i32 %31, ptr %26, align 4, !tbaa !15
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %32 = load i8, ptr %21, align 1, !tbaa !14
  %33 = zext i8 %32 to i64
  %34 = icmp ult i64 %indvars.iv.next, %33
  br i1 %34, label %27, label %.thread75, !llvm.loop !16

.thread75:                                        ; preds = %27, %.preheader
  store i32 %24, ptr %14, align 8, !tbaa !13
  br label %35

35:                                               ; preds = %.thread75, %2
  %36 = phi i32 [ %24, %.thread75 ], [ %15, %2 ]
  %37 = getelementptr inbounds i8, ptr %0, i64 28
  %38 = load i32, ptr %37, align 4, !tbaa !15
  %39 = add nsw i32 %36, %38
  %40 = icmp sgt i32 %39, %12
  br i1 %40, label %.thread, label %41

41:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #4
  %42 = getelementptr inbounds i8, ptr %9, i64 22
  %43 = load i32, ptr %42, align 1
  store i32 %43, ptr %3, align 4
  store i32 0, ptr %42, align 1
  store ptr %9, ptr %4, align 8, !tbaa !18
  %44 = load i32, ptr %14, align 8, !tbaa !13
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds i8, ptr %4, i64 8
  store i64 %45, ptr %46, align 8, !tbaa !21
  %47 = getelementptr inbounds i8, ptr %9, i64 %45
  %48 = getelementptr inbounds i8, ptr %4, i64 16
  store ptr %47, ptr %48, align 8, !tbaa !22
  %49 = load i32, ptr %37, align 4, !tbaa !15
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i8, ptr %4, i64 24
  store i64 %50, ptr %51, align 8, !tbaa !23
  call void @ogg_page_checksum_set(ptr noundef nonnull %4)
  %bcmp69 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %3, ptr noundef nonnull dereferenceable(4) %42, i64 4)
  %.not70 = icmp eq i32 %bcmp69, 0
  br i1 %.not70, label %53, label %52

52:                                               ; preds = %41
  store i32 %43, ptr %42, align 1
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  %.pre83.pre = load ptr, ptr %0, align 8, !tbaa !5
  br label %69

53:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  %.not72 = icmp eq ptr %1, null
  %.pre84 = load i32, ptr %14, align 8, !tbaa !13
  %.pre85 = load i32, ptr %37, align 4, !tbaa !15
  %.pre86 = load i32, ptr %6, align 8, !tbaa !11
  br i1 %.not72, label %64, label %54

54:                                               ; preds = %53
  %55 = load ptr, ptr %0, align 8, !tbaa !5
  %56 = sext i32 %.pre86 to i64
  %57 = getelementptr inbounds i8, ptr %55, i64 %56
  store ptr %57, ptr %1, align 8, !tbaa !18
  %58 = sext i32 %.pre84 to i64
  %59 = getelementptr inbounds i8, ptr %1, i64 8
  store i64 %58, ptr %59, align 8, !tbaa !21
  %60 = getelementptr inbounds i8, ptr %57, i64 %58
  %61 = getelementptr inbounds i8, ptr %1, i64 16
  store ptr %60, ptr %61, align 8, !tbaa !22
  %62 = sext i32 %.pre85 to i64
  %63 = getelementptr inbounds i8, ptr %1, i64 24
  store i64 %62, ptr %63, align 8, !tbaa !23
  br label %64

64:                                               ; preds = %54, %53
  %65 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 0, ptr %65, align 4, !tbaa !24
  %66 = add nsw i32 %.pre85, %.pre84
  %67 = sext i32 %66 to i64
  %68 = add i32 %.pre86, %66
  store i32 %68, ptr %6, align 8, !tbaa !11
  store i32 0, ptr %14, align 8, !tbaa !13
  store i32 0, ptr %37, align 4, !tbaa !15
  br label %.thread

69:                                               ; preds = %52, %19
  %.pre83 = phi ptr [ %.pre83.pre, %52 ], [ %5, %19 ]
  store i32 0, ptr %14, align 8, !tbaa !13
  %70 = getelementptr inbounds i8, ptr %0, i64 28
  store i32 0, ptr %70, align 4, !tbaa !15
  %71 = getelementptr inbounds i8, ptr %9, i64 1
  %72 = add nsw i64 %13, -1
  %73 = call ptr @memchr(ptr noundef nonnull %71, i32 noundef 79, i64 noundef %72) #5
  %.not71 = icmp eq ptr %73, null
  br i1 %.not71, label %74, label %78

74:                                               ; preds = %69
  %75 = load i32, ptr %10, align 4, !tbaa !12
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i8, ptr %.pre83, i64 %76
  br label %78

78:                                               ; preds = %74, %69
  %.063 = phi ptr [ %73, %69 ], [ %77, %74 ]
  %79 = ptrtoint ptr %.063 to i64
  %80 = ptrtoint ptr %.pre83 to i64
  %81 = sub i64 %79, %80
  %82 = trunc i64 %81 to i32
  store i32 %82, ptr %6, align 8, !tbaa !11
  %83 = ptrtoint ptr %9 to i64
  %.neg = sub i64 %83, %79
  br label %.thread

.thread:                                          ; preds = %20, %17, %35, %78, %64
  %.2 = phi i64 [ %.neg, %78 ], [ %67, %64 ], [ 0, %35 ], [ 0, %17 ], [ 0, %20 ]
  ret i64 %.2
}

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

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

attributes #0 = { mustprogress 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 = { 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 #3 = { nofree nounwind willreturn memory(argmem: read) }
attributes #4 = { nounwind }
attributes #5 = { 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, !7, i64 0}
!6 = !{!"", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 16}
!12 = !{!6, !10, i64 12}
!13 = !{!6, !10, i64 24}
!14 = !{!8, !8, i64 0}
!15 = !{!6, !10, i64 28}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!19, !7, i64 0}
!19 = !{!"", !7, i64 0, !20, i64 8, !7, i64 16, !20, i64 24}
!20 = !{!"long", !8, i64 0}
!21 = !{!19, !20, i64 8}
!22 = !{!19, !7, i64 16}
!23 = !{!19, !20, i64 24}
!24 = !{!6, !10, i64 20}


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