; LLVM IR from joltwallet/jolt_wallet :: components/console/argtable3 (argtable3)

; 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.arg_date = type { %struct.arg_hdr, ptr, i32, ptr }
%struct.arg_hdr = type { i8, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [3 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: nounwind uwtable
define dso_local ptr @arg_daten(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef %6) #1 {
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store i32 %4, ptr %12, align 4, !tbaa !9
  store i32 %5, ptr %13, align 4, !tbaa !9
  store ptr %6, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %17 = load i32, ptr %13, align 4, !tbaa !9
  %18 = load i32, ptr %12, align 4, !tbaa !9
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %20, label %22

20:                                               ; preds = %7
  %21 = load i32, ptr %12, align 4, !tbaa !9
  br label %24

22:                                               ; preds = %7
  %23 = load i32, ptr %13, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %22, %20
  %25 = phi i32 [ %21, %20 ], [ %23, %22 ]
  store i32 %25, ptr %13, align 4, !tbaa !9
  %26 = load ptr, ptr %10, align 8, !tbaa !5
  %27 = icmp ne ptr %26, null
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  store ptr @.str, ptr %10, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %28, %24
  %30 = load i32, ptr %13, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = mul i64 %31, 56
  %33 = add i64 120, %32
  store i64 %33, ptr %15, align 8, !tbaa !11
  %34 = load i64, ptr %15, align 8, !tbaa !11
  %35 = call noalias ptr @calloc(i64 noundef 1, i64 noundef %34) #4
  store ptr %35, ptr %16, align 8, !tbaa !5
  %36 = load ptr, ptr %16, align 8, !tbaa !5
  %37 = icmp ne ptr %36, null
  br i1 %37, label %38, label %98

38:                                               ; preds = %29
  %39 = load ptr, ptr %16, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.arg_date, ptr %39, i32 0, i32 0
  %41 = getelementptr inbounds %struct.arg_hdr, ptr %40, i32 0, i32 0
  store i8 2, ptr %41, align 8, !tbaa !13
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = load ptr, ptr %16, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.arg_date, ptr %43, i32 0, i32 0
  %45 = getelementptr inbounds %struct.arg_hdr, ptr %44, i32 0, i32 1
  store ptr %42, ptr %45, align 8, !tbaa !16
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = load ptr, ptr %16, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.arg_date, ptr %47, i32 0, i32 0
  %49 = getelementptr inbounds %struct.arg_hdr, ptr %48, i32 0, i32 2
  store ptr %46, ptr %49, align 8, !tbaa !17
  %50 = load ptr, ptr %11, align 8, !tbaa !5
  %51 = icmp ne ptr %50, null
  br i1 %51, label %52, label %54

52:                                               ; preds = %38
  %53 = load ptr, ptr %11, align 8, !tbaa !5
  br label %56

54:                                               ; preds = %38
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  br label %56

56:                                               ; preds = %54, %52
  %57 = phi ptr [ %53, %52 ], [ %55, %54 ]
  %58 = load ptr, ptr %16, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.arg_date, ptr %58, i32 0, i32 0
  %60 = getelementptr inbounds %struct.arg_hdr, ptr %59, i32 0, i32 3
  store ptr %57, ptr %60, align 8, !tbaa !18
  %61 = load ptr, ptr %14, align 8, !tbaa !5
  %62 = load ptr, ptr %16, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.arg_date, ptr %62, i32 0, i32 0
  %64 = getelementptr inbounds %struct.arg_hdr, ptr %63, i32 0, i32 4
  store ptr %61, ptr %64, align 8, !tbaa !19
  %65 = load i32, ptr %12, align 4, !tbaa !9
  %66 = load ptr, ptr %16, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.arg_date, ptr %66, i32 0, i32 0
  %68 = getelementptr inbounds %struct.arg_hdr, ptr %67, i32 0, i32 5
  store i32 %65, ptr %68, align 8, !tbaa !20
  %69 = load i32, ptr %13, align 4, !tbaa !9
  %70 = load ptr, ptr %16, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.arg_date, ptr %70, i32 0, i32 0
  %72 = getelementptr inbounds %struct.arg_hdr, ptr %71, i32 0, i32 6
  store i32 %69, ptr %72, align 4, !tbaa !21
  %73 = load ptr, ptr %16, align 8, !tbaa !5
  %74 = load ptr, ptr %16, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.arg_date, ptr %74, i32 0, i32 0
  %76 = getelementptr inbounds %struct.arg_hdr, ptr %75, i32 0, i32 7
  store ptr %73, ptr %76, align 8, !tbaa !22
  %77 = load ptr, ptr %16, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.arg_date, ptr %77, i32 0, i32 0
  %79 = getelementptr inbounds %struct.arg_hdr, ptr %78, i32 0, i32 8
  store ptr @arg_date_resetfn, ptr %79, align 8, !tbaa !23
  %80 = load ptr, ptr %16, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.arg_date, ptr %80, i32 0, i32 0
  %82 = getelementptr inbounds %struct.arg_hdr, ptr %81, i32 0, i32 9
  store ptr @arg_date_scanfn, ptr %82, align 8, !tbaa !24
  %83 = load ptr, ptr %16, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.arg_date, ptr %83, i32 0, i32 0
  %85 = getelementptr inbounds %struct.arg_hdr, ptr %84, i32 0, i32 10
  store ptr @arg_date_checkfn, ptr %85, align 8, !tbaa !25
  %86 = load ptr, ptr %16, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.arg_date, ptr %86, i32 0, i32 0
  %88 = getelementptr inbounds %struct.arg_hdr, ptr %87, i32 0, i32 11
  store ptr @arg_date_errorfn, ptr %88, align 8, !tbaa !26
  %89 = load ptr, ptr %16, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.arg_date, ptr %89, i64 1
  %91 = load ptr, ptr %16, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.arg_date, ptr %91, i32 0, i32 3
  store ptr %90, ptr %92, align 8, !tbaa !27
  %93 = load ptr, ptr %16, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.arg_date, ptr %93, i32 0, i32 2
  store i32 0, ptr %94, align 8, !tbaa !28
  %95 = load ptr, ptr %10, align 8, !tbaa !5
  %96 = load ptr, ptr %16, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.arg_date, ptr %96, i32 0, i32 1
  store ptr %95, ptr %97, align 8, !tbaa !29
  br label %98

98:                                               ; preds = %56, %29
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100
  %102 = load ptr, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  ret ptr %102
}

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @arg_date_resetfn(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @arg_date_scanfn(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @arg_date_checkfn(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @arg_date_errorfn(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) #1

attributes #0 = { 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 = { nounwind allocsize(0,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 #3 = { nounwind }
attributes #4 = { nounwind allocsize(0,1) }

!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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !7, i64 0}
!14 = !{!"arg_date", !15, i64 0, !6, i64 96, !10, i64 104, !6, i64 112}
!15 = !{!"arg_hdr", !7, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !10, i64 40, !10, i64 44, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88}
!16 = !{!14, !6, i64 8}
!17 = !{!14, !6, i64 16}
!18 = !{!14, !6, i64 24}
!19 = !{!14, !6, i64 32}
!20 = !{!14, !10, i64 40}
!21 = !{!14, !10, i64 44}
!22 = !{!14, !6, i64 48}
!23 = !{!14, !6, i64 56}
!24 = !{!14, !6, i64 64}
!25 = !{!14, !6, i64 72}
!26 = !{!14, !6, i64 80}
!27 = !{!14, !6, i64 112}
!28 = !{!14, !10, i64 104}
!29 = !{!14, !6, i64 96}


; 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 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noundef ptr @arg_daten(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef %6) local_unnamed_addr #0 {
  %8 = tail call i32 @llvm.smax.i32(i32 %5, i32 %4)
  %9 = sext i32 %8 to i64
  %10 = mul nsw i64 %9, 56
  %11 = add nsw i64 %10, 120
  %12 = tail call noalias ptr @calloc(i64 noundef 1, i64 noundef %11) #4
  %.not34 = icmp eq ptr %12, null
  br i1 %.not34, label %29, label %13

13:                                               ; preds = %7
  %.not = icmp eq ptr %2, null
  %spec.store.select = select i1 %.not, ptr @.str, ptr %2
  store i8 2, ptr %12, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %12, i64 8
  store ptr %0, ptr %14, align 8, !tbaa !12
  %15 = getelementptr inbounds i8, ptr %12, i64 16
  store ptr %1, ptr %15, align 8, !tbaa !13
  %.not35 = icmp eq ptr %3, null
  %16 = select i1 %.not35, ptr %spec.store.select, ptr %3
  %17 = getelementptr inbounds i8, ptr %12, i64 24
  store ptr %16, ptr %17, align 8, !tbaa !14
  %18 = getelementptr inbounds i8, ptr %12, i64 32
  store ptr %6, ptr %18, align 8, !tbaa !15
  %19 = getelementptr inbounds i8, ptr %12, i64 40
  store i32 %4, ptr %19, align 8, !tbaa !16
  %20 = getelementptr inbounds i8, ptr %12, i64 44
  store i32 %8, ptr %20, align 4, !tbaa !17
  %21 = getelementptr inbounds i8, ptr %12, i64 48
  store ptr %12, ptr %21, align 8, !tbaa !18
  %22 = getelementptr inbounds i8, ptr %12, i64 56
  store ptr @arg_date_resetfn, ptr %22, align 8, !tbaa !19
  %23 = getelementptr inbounds i8, ptr %12, i64 64
  store ptr @arg_date_scanfn, ptr %23, align 8, !tbaa !20
  %24 = getelementptr inbounds i8, ptr %12, i64 72
  store ptr @arg_date_checkfn, ptr %24, align 8, !tbaa !21
  %25 = getelementptr inbounds i8, ptr %12, i64 80
  store ptr @arg_date_errorfn, ptr %25, align 8, !tbaa !22
  %26 = getelementptr inbounds i8, ptr %12, i64 120
  %27 = getelementptr inbounds i8, ptr %12, i64 112
  store ptr %26, ptr %27, align 8, !tbaa !23
  %28 = getelementptr inbounds i8, ptr %12, i64 96
  store ptr %spec.store.select, ptr %28, align 8, !tbaa !24
  br label %29

29:                                               ; preds = %7, %13
  ret ptr %12
}

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @arg_date_resetfn(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @arg_date_scanfn(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @arg_date_checkfn(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @arg_date_errorfn(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3

attributes #0 = { mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) 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 nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(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 #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 nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind allocsize(0,1) }

!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, !8, i64 0}
!6 = !{!"arg_date", !7, i64 0, !10, i64 96, !11, i64 104, !10, i64 112}
!7 = !{!"arg_hdr", !8, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !11, i64 40, !11, i64 44, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!6, !10, i64 8}
!13 = !{!6, !10, i64 16}
!14 = !{!6, !10, i64 24}
!15 = !{!6, !10, i64 32}
!16 = !{!6, !11, i64 40}
!17 = !{!6, !11, i64 44}
!18 = !{!6, !10, i64 48}
!19 = !{!6, !10, i64 56}
!20 = !{!6, !10, i64 64}
!21 = !{!6, !10, i64 72}
!22 = !{!6, !10, i64 80}
!23 = !{!6, !10, i64 112}
!24 = !{!6, !10, i64 96}


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