; LLVM IR from drohmer/cgp :: library/cgp/20_format_parser/mesh_loader/obj (obj)

; 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.cgp::numarray_stack.43" = type { i32, i32, i32 }

@.str.19 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [9 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
define dso_local { i64, i32 } @_ZN3cgp6loader18extract_face_indexERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS0_8obj_typeE(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %1) #1 {
  %3 = alloca %"struct.cgp::numarray_stack.43", align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca { i64, i32 }, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !11
  call void @_ZN3cgp14numarray_stackIiLi3EEC2ERKiS3_S3_(ptr noundef nonnull align 4 dereferenceable(12) %3, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %11 = load i32, ptr %5, align 4, !tbaa !9
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %13, label %18

13:                                               ; preds = %2
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %14) #5
  %16 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 0)
  %17 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %15, ptr noundef @.str.19, ptr noundef %16) #5
  br label %49

18:                                               ; preds = %2
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = icmp eq i32 %19, 1
  br i1 %20, label %21, label %27

21:                                               ; preds = %18
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %22) #5
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 0)
  %25 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 1)
  %26 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %23, ptr noundef @.str.20, ptr noundef %24, ptr noundef %25) #5
  br label %48

27:                                               ; preds = %18
  %28 = load i32, ptr %5, align 4, !tbaa !9
  %29 = icmp eq i32 %28, 3
  br i1 %29, label %30, label %36

30:                                               ; preds = %27
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %31) #5
  %33 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 0)
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 2)
  %35 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %32, ptr noundef @.str.21, ptr noundef %33, ptr noundef %34) #5
  br label %47

36:                                               ; preds = %27
  %37 = load i32, ptr %5, align 4, !tbaa !9
  %38 = icmp eq i32 %37, 2
  br i1 %38, label %39, label %46

39:                                               ; preds = %36
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %40) #5
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 0)
  %43 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 1)
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 2)
  %45 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %41, ptr noundef @.str.22, ptr noundef %42, ptr noundef %43, ptr noundef %44) #5
  br label %46

46:                                               ; preds = %39, %36
  br label %47

47:                                               ; preds = %46, %30
  br label %48

48:                                               ; preds = %47, %21
  br label %49

49:                                               ; preds = %48, %13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !11
  br label %50

50:                                               ; preds = %59, %49
  %51 = load i32, ptr %9, align 4, !tbaa !11
  %52 = icmp slt i32 %51, 3
  br i1 %52, label %54, label %53

53:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %62

54:                                               ; preds = %50
  %55 = load i32, ptr %9, align 4, !tbaa !11
  %56 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef %55)
  %57 = load i32, ptr %56, align 4, !tbaa !11
  %58 = add nsw i32 %57, -1
  store i32 %58, ptr %56, align 4, !tbaa !11
  br label %59

59:                                               ; preds = %54
  %60 = load i32, ptr %9, align 4, !tbaa !11
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %9, align 4, !tbaa !11
  br label %50, !llvm.loop !13

62:                                               ; preds = %53
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 4 %3, i64 12, i1 false)
  %63 = load { i64, i32 }, ptr %10, align 8
  ret { i64, i32 } %63
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3cgp14numarray_stackIiLi3EEC2ERKiS3_S3_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12), i32 noundef) #1 align 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) #4

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"_ZTSN3cgp6loader8obj_typeE", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

%"struct.cgp::numarray_stack.43" = type { i32, i32, i32 }

@.str.19 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [9 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: mustprogress uwtable
define dso_local { i64, i32 } @_ZN3cgp6loader18extract_face_indexERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS0_8obj_typeE(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %1) local_unnamed_addr #1 {
  %3 = alloca %"struct.cgp::numarray_stack.43", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @_ZN3cgp14numarray_stackIiLi3EEC2ERKiS3_S3_(ptr noundef nonnull align 4 dereferenceable(12) %3, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  switch i32 %1, label %27 [
    i32 0, label %7
    i32 1, label %11
    i32 3, label %16
    i32 2, label %21
  ]

7:                                                ; preds = %2
  %8 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  %9 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 0)
  %10 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %8, ptr noundef nonnull @.str.19, ptr noundef nonnull %9) #4
  br label %27

11:                                               ; preds = %2
  %12 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  %13 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 0)
  %14 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 1)
  %15 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %12, ptr noundef nonnull @.str.20, ptr noundef nonnull %13, ptr noundef nonnull %14) #4
  br label %27

16:                                               ; preds = %2
  %17 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  %18 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 0)
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 2)
  %20 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %17, ptr noundef nonnull @.str.21, ptr noundef nonnull %18, ptr noundef nonnull %19) #4
  br label %27

21:                                               ; preds = %2
  %22 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  %23 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 0)
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 1)
  %25 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 2)
  %26 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %22, ptr noundef nonnull @.str.22, ptr noundef nonnull %23, ptr noundef nonnull %24, ptr noundef nonnull %25) #4
  br label %27

27:                                               ; preds = %2, %11, %21, %16, %7
  %28 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 0)
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = add nsw i32 %29, -1
  store i32 %30, ptr %28, align 4, !tbaa !5
  %31 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 1)
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = add nsw i32 %32, -1
  store i32 %33, ptr %31, align 4, !tbaa !5
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3cgp14numarray_stackIiLi3EEixEi(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef 2)
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = add nsw i32 %35, -1
  store i32 %36, ptr %34, align 4, !tbaa !5
  %.sroa.0.0.copyload = load i64, ptr %3, align 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  %.sroa.2.0.copyload = load i32, ptr %.sroa.2.0..sroa_idx, align 8
  %.fca.0.insert = insertvalue { i64, i32 } poison, i64 %.sroa.0.0.copyload, 0
  %.fca.1.insert = insertvalue { i64, i32 } %.fca.0.insert, i32 %.sroa.2.0.copyload, 1
  ret { i64, i32 } %.fca.1.insert
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3cgp14numarray_stackIiLi3EEC2ERKiS3_S3_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

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

attributes #0 = { mustprogress 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 = { 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 #4 = { 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++ TBAA"}


; Effective O3 passes: GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass