; LLVM IR from justinxu9905/bustub-2022-fall :: third_party/fmt/test/fuzzing (two-args)

; 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.anon = type <{ ptr, i64, i32, [4 x i8] }>

@_ZTISt9exception = external constant ptr

; Function Attrs: mustprogress uwtable
define dso_local i32 @LLVMFuzzerTestOneInput(ptr noundef %0, i64 noundef %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %class.anon, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  %12 = load i64, ptr %5, align 8, !tbaa !9
  %13 = icmp ule i64 %12, 3
  br i1 %13, label %14, label %15

14:                                               ; preds = %2
  store i32 0, ptr %3, align 4
  br label %52

15:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %16, i64 0
  %18 = load i8, ptr %17, align 1, !tbaa !11
  %19 = zext i8 %18 to i32
  %20 = and i32 %19, 15
  store i32 %20, ptr %6, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %21, i64 0
  %23 = load i8, ptr %22, align 1, !tbaa !11
  %24 = zext i8 %23 to i32
  %25 = and i32 %24, 240
  %26 = ashr i32 %25, 4
  store i32 %26, ptr %7, align 4, !tbaa !12
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %27, i32 1
  store ptr %28, ptr %4, align 8, !tbaa !5
  %29 = load i64, ptr %5, align 8, !tbaa !9
  %30 = add i64 %29, -1
  store i64 %30, ptr %5, align 8, !tbaa !9
  %31 = load i32, ptr %6, align 4, !tbaa !12
  %32 = getelementptr inbounds %class.anon, ptr %8, i32 0, i32 0
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %33, ptr %32, align 8, !tbaa !14
  %34 = getelementptr inbounds %class.anon, ptr %8, i32 0, i32 1
  %35 = load i64, ptr %5, align 8, !tbaa !9
  store i64 %35, ptr %34, align 8, !tbaa !16
  %36 = getelementptr inbounds %class.anon, ptr %8, i32 0, i32 2
  %37 = load i32, ptr %7, align 4, !tbaa !12
  store i32 %37, ptr %36, align 8, !tbaa !17
  invoke void @"_Z6invokeIZ22LLVMFuzzerTestOneInputE3$_0EviT_"(i32 noundef %31, ptr noundef byval(%class.anon) align 8 %8)
          to label %38 unwind label %39

38:                                               ; preds = %15
  br label %50

39:                                               ; preds = %15
  %40 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %9, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %10, align 4
  br label %43

43:                                               ; preds = %39
  %44 = load i32, ptr %10, align 4
  %45 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt9exception) #3
  %46 = icmp eq i32 %44, %45
  br i1 %46, label %47, label %51

47:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %48 = load ptr, ptr %9, align 8
  %49 = call ptr @__cxa_begin_catch(ptr %48) #3
  store ptr %49, ptr %11, align 8
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br label %50

50:                                               ; preds = %47, %38
  store i32 0, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %52

51:                                               ; preds = %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %54

52:                                               ; preds = %50, %14
  %53 = load i32, ptr %3, align 4
  ret i32 %53

54:                                               ; preds = %51
  %55 = load ptr, ptr %9, align 8
  %56 = load i32, ptr %10, align 4
  %57 = insertvalue { ptr, i32 } poison, ptr %55, 0
  %58 = insertvalue { ptr, i32 } %57, i32 %56, 1
  resume { ptr, i32 } %58
}

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

; Function Attrs: mustprogress uwtable
declare hidden void @"_Z6invokeIZ22LLVMFuzzerTestOneInputE3$_0EviT_"(i32 noundef, ptr noundef byval(%class.anon) align 8) #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #2

declare ptr @__cxa_begin_catch(ptr)

declare void @__cxa_end_catch()

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind memory(none) }
attributes #3 = { 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 = !{!"long", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTSZ22LLVMFuzzerTestOneInputE3$_0", !6, i64 0, !10, i64 8, !13, i64 16}
!16 = !{!15, !10, i64 8}
!17 = !{!15, !13, i64 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"

%class.anon = type <{ ptr, i64, i32, [4 x i8] }>

@_ZTISt9exception = external constant ptr

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @LLVMFuzzerTestOneInput(ptr noundef %0, i64 noundef %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca %class.anon, align 8
  %4 = icmp ult i64 %1, 4
  br i1 %4, label %23, label %5

5:                                                ; preds = %2
  %6 = load i8, ptr %0, align 1, !tbaa !5
  %7 = zext i8 %6 to i32
  %8 = and i32 %7, 15
  %9 = lshr i32 %7, 4
  %10 = getelementptr inbounds i8, ptr %0, i64 1
  %11 = add i64 %1, -1
  store ptr %10, ptr %3, align 8, !tbaa !8
  %12 = getelementptr inbounds i8, ptr %3, i64 8
  store i64 %11, ptr %12, align 8, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %3, i64 16
  store i32 %9, ptr %13, align 8, !tbaa !14
  invoke void @"_Z6invokeIZ22LLVMFuzzerTestOneInputE3$_0EviT_"(i32 noundef %8, ptr noundef nonnull byval(%class.anon) align 8 %3)
          to label %23 unwind label %14

14:                                               ; preds = %5
  %15 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %16 = extractvalue { ptr, i32 } %15, 1
  %17 = tail call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt9exception) #2
  %18 = icmp eq i32 %16, %17
  br i1 %18, label %19, label %22

19:                                               ; preds = %14
  %20 = extractvalue { ptr, i32 } %15, 0
  %21 = tail call ptr @__cxa_begin_catch(ptr %20) #2
  tail call void @__cxa_end_catch()
  br label %23

22:                                               ; preds = %14
  resume { ptr, i32 } %15

23:                                               ; preds = %19, %5, %2
  ret i32 0
}

; Function Attrs: mustprogress uwtable
declare hidden void @"_Z6invokeIZ22LLVMFuzzerTestOneInputE3$_0EviT_"(i32 noundef, ptr noundef byval(%class.anon) align 8) local_unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nofree nosync nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #1

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

declare void @__cxa_end_catch() local_unnamed_addr

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 = { nofree nosync nounwind memory(none) }
attributes #2 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 0}
!9 = !{!"_ZTSZ22LLVMFuzzerTestOneInputE3$_0", !10, i64 0, !11, i64 8, !12, i64 16}
!10 = !{!"any pointer", !6, i64 0}
!11 = !{!"long", !6, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{!9, !11, i64 8}
!14 = !{!9, !12, i64 16}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass