; LLVM IR from intel/qpl :: tools/utils/generators/deflate_generator (token)

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

%class.char_type_c = type { [256 x i32], [256 x i8] }
%class.token_parser_c = type { ptr, %class.token_c, i8, i32 }
%class.token_c = type { i8, i32 }

@_ZL7g_ctype = external hidden global %class.char_type_c, align 4
@stderr = external global ptr, align 8
@_ZTISt9exception = external constant ptr
@.str.9 = external hidden unnamed_addr constant [33 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: mustprogress uwtable
declare dso_local noundef i32 @_ZN14token_parser_c4getcEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN11char_type_c8get_typeEi(ptr noundef nonnull align 4 dereferenceable(1280), i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7token_c11set_m_valueEj(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) #2 align 2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

declare ptr @__cxa_allocate_exception(i64)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt9exceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

; Function Attrs: nounwind
declare void @_ZNSt9exceptionD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3

declare void @__cxa_throw(ptr, ptr, ptr)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN14token_parser_c6ungetcEi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i8 @_ZN14token_parser_c11parse_octalEP7token_ci(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1, i32 noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %9 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  %10 = load i32, ptr %6, align 4, !tbaa !9
  %11 = icmp sgt i32 %10, 55
  br i1 %11, label %12, label %18

12:                                               ; preds = %3
  %13 = load ptr, ptr @stderr, align 8, !tbaa !5
  %14 = getelementptr inbounds %class.token_parser_c, ptr %9, i32 0, i32 3
  %15 = load i32, ptr %14, align 4, !tbaa !11
  %16 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %13, ptr noundef @.str.9, i32 noundef %15) #4
  %17 = call ptr @__cxa_allocate_exception(i64 8) #4
  call void @_ZNSt9exceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %17) #4
  call void @__cxa_throw(ptr %17, ptr @_ZTISt9exception, ptr @_ZNSt9exceptionD1Ev) #5
  unreachable

18:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %19 = load i32, ptr %6, align 4, !tbaa !9
  %20 = sub nsw i32 %19, 48
  store i32 %20, ptr %8, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %38, %18
  br label %22

22:                                               ; preds = %21
  %23 = call noundef i32 @_ZN14token_parser_c4getcEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
  store i32 %23, ptr %6, align 4, !tbaa !9
  %24 = load i32, ptr %6, align 4, !tbaa !9
  %25 = call noundef i32 @_ZN11char_type_c8get_typeEi(ptr noundef nonnull align 4 dereferenceable(1280) @_ZL7g_ctype, i32 noundef %24)
  store i32 %25, ptr %7, align 4, !tbaa !9
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = and i32 %26, 16
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %44

29:                                               ; preds = %22
  %30 = load i32, ptr %6, align 4, !tbaa !9
  %31 = icmp sgt i32 %30, 55
  br i1 %31, label %32, label %38

32:                                               ; preds = %29
  %33 = load ptr, ptr @stderr, align 8, !tbaa !5
  %34 = getelementptr inbounds %class.token_parser_c, ptr %9, i32 0, i32 3
  %35 = load i32, ptr %34, align 4, !tbaa !11
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef @.str.9, i32 noundef %35) #4
  %37 = call ptr @__cxa_allocate_exception(i64 8) #4
  call void @_ZNSt9exceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %37) #4
  call void @__cxa_throw(ptr %37, ptr @_ZTISt9exception, ptr @_ZNSt9exceptionD1Ev) #5
  unreachable

38:                                               ; preds = %29
  %39 = load i32, ptr %8, align 4, !tbaa !9
  %40 = mul i32 %39, 8
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = add i32 %40, %41
  %43 = sub i32 %42, 48
  store i32 %43, ptr %8, align 4, !tbaa !9
  br label %21, !llvm.loop !16

44:                                               ; preds = %22
  %45 = load i32, ptr %6, align 4, !tbaa !9
  call void @_ZN14token_parser_c6ungetcEi(ptr noundef nonnull align 8 dereferenceable(24) %9, i32 noundef %45)
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = load i32, ptr %8, align 4, !tbaa !9
  call void @_ZN7token_c11set_m_valueEj(ptr noundef nonnull align 4 dereferenceable(8) %46, i32 noundef %47)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret i8 1
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 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 = { 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 #4 = { nounwind }
attributes #5 = { noreturn }

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 20}
!12 = !{!"_ZTS14token_parser_c", !6, i64 0, !13, i64 8, !15, i64 16, !10, i64 20}
!13 = !{!"_ZTS7token_c", !14, i64 0, !10, i64 4}
!14 = !{!"_ZTS12token_type_t", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"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"

%class.char_type_c = type { [256 x i32], [256 x i8] }

@_ZL7g_ctype = external hidden global %class.char_type_c, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@_ZTISt9exception = external constant ptr
@.str.9 = external hidden unnamed_addr constant [33 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN14token_parser_c4getcEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN11char_type_c8get_typeEi(ptr noundef nonnull align 4 dereferenceable(1280), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7token_c11set_m_valueEj(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) local_unnamed_addr #1 align 2

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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt9exceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: nounwind
declare void @_ZNSt9exceptionD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN14token_parser_c6ungetcEi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i8 @_ZN14token_parser_c11parse_octalEP7token_ci(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #0 align 2 {
  %4 = icmp sgt i32 %2, 55
  br i1 %4, label %8, label %.preheader

.preheader:                                       ; preds = %3
  %.014 = add i32 %2, -48
  %5 = tail call noundef i32 @_ZN14token_parser_c4getcEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %6 = tail call noundef i32 @_ZN11char_type_c8get_typeEi(ptr noundef nonnull align 4 dereferenceable(1280) @_ZL7g_ctype, i32 noundef %5)
  %7 = and i32 %6, 16
  %.not15 = icmp eq i32 %7, 0
  br i1 %.not15, label %._crit_edge, label %.lr.ph

8:                                                ; preds = %3
  %9 = load ptr, ptr @stderr, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 20
  %11 = load i32, ptr %10, align 4, !tbaa !9
  %12 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %9, ptr noundef nonnull @.str.9, i32 noundef %11) #4
  %13 = tail call ptr @__cxa_allocate_exception(i64 8) #5
  tail call void @_ZNSt9exceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #5
  tail call void @__cxa_throw(ptr nonnull %13, ptr nonnull @_ZTISt9exception, ptr nonnull @_ZNSt9exceptionD1Ev) #6
  unreachable

.lr.ph:                                           ; preds = %.preheader, %22
  %14 = phi i32 [ %25, %22 ], [ %5, %.preheader ]
  %.016 = phi i32 [ %.0, %22 ], [ %.014, %.preheader ]
  %15 = icmp sgt i32 %14, 55
  br i1 %15, label %16, label %22

16:                                               ; preds = %.lr.ph
  %17 = load ptr, ptr @stderr, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %0, i64 20
  %19 = load i32, ptr %18, align 4, !tbaa !9
  %20 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef nonnull @.str.9, i32 noundef %19) #4
  %21 = tail call ptr @__cxa_allocate_exception(i64 8) #5
  tail call void @_ZNSt9exceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %21) #5
  tail call void @__cxa_throw(ptr nonnull %21, ptr nonnull @_ZTISt9exception, ptr nonnull @_ZNSt9exceptionD1Ev) #6
  unreachable

22:                                               ; preds = %.lr.ph
  %23 = shl i32 %.016, 3
  %24 = add i32 %23, %14
  %.0 = add i32 %24, -48
  %25 = tail call noundef i32 @_ZN14token_parser_c4getcEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %26 = tail call noundef i32 @_ZN11char_type_c8get_typeEi(ptr noundef nonnull align 4 dereferenceable(1280) @_ZL7g_ctype, i32 noundef %25)
  %27 = and i32 %26, 16
  %.not = icmp eq i32 %27, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !15

._crit_edge:                                      ; preds = %22, %.preheader
  %.0.lcssa = phi i32 [ %.014, %.preheader ], [ %.0, %22 ]
  %.lcssa = phi i32 [ %5, %.preheader ], [ %25, %22 ]
  tail call void @_ZN14token_parser_c6ungetcEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %.lcssa)
  tail call void @_ZN7token_c11set_m_valueEj(ptr noundef nonnull align 4 dereferenceable(8) %1, i32 noundef %.0.lcssa)
  ret i8 1
}

attributes #0 = { mustprogress 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 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 = { 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 #3 = { 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 #4 = { cold nounwind }
attributes #5 = { nounwind }
attributes #6 = { noreturn }

!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++ TBAA"}
!9 = !{!10, !13, i64 20}
!10 = !{!"_ZTS14token_parser_c", !6, i64 0, !11, i64 8, !14, i64 16, !13, i64 20}
!11 = !{!"_ZTS7token_c", !12, i64 0, !13, i64 4}
!12 = !{!"_ZTS12token_type_t", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


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