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

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

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

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

24:                                               ; preds = %22, %20
  %25 = phi i32 [ %21, %20 ], [ %23, %22 ]
  store i32 %25, ptr %11, align 4, !tbaa !9
  %26 = load i32, ptr %11, align 4, !tbaa !9
  %27 = add nsw i32 %26, 1
  %28 = sext i32 %27 to i64
  %29 = mul i64 %28, 8
  %30 = add i64 112, %29
  store i64 %30, ptr %13, align 8, !tbaa !11
  %31 = load i64, ptr %13, align 8, !tbaa !11
  %32 = call noalias ptr @malloc(i64 noundef %31) #4
  store ptr %32, ptr %14, align 8, !tbaa !5
  %33 = load ptr, ptr %14, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %35, label %102

35:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %36 = load ptr, ptr %14, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.arg_dbl, ptr %36, i32 0, i32 0
  %38 = getelementptr inbounds %struct.arg_hdr, ptr %37, i32 0, i32 0
  store i8 2, ptr %38, align 8, !tbaa !13
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = load ptr, ptr %14, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.arg_dbl, ptr %40, i32 0, i32 0
  %42 = getelementptr inbounds %struct.arg_hdr, ptr %41, i32 0, i32 1
  store ptr %39, ptr %42, align 8, !tbaa !16
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = load ptr, ptr %14, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.arg_dbl, ptr %44, i32 0, i32 0
  %46 = getelementptr inbounds %struct.arg_hdr, ptr %45, i32 0, i32 2
  store ptr %43, ptr %46, align 8, !tbaa !17
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %51

49:                                               ; preds = %35
  %50 = load ptr, ptr %9, align 8, !tbaa !5
  br label %52

51:                                               ; preds = %35
  br label %52

52:                                               ; preds = %51, %49
  %53 = phi ptr [ %50, %49 ], [ @.str.6, %51 ]
  %54 = load ptr, ptr %14, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.arg_dbl, ptr %54, i32 0, i32 0
  %56 = getelementptr inbounds %struct.arg_hdr, ptr %55, i32 0, i32 3
  store ptr %53, ptr %56, align 8, !tbaa !18
  %57 = load ptr, ptr %12, align 8, !tbaa !5
  %58 = load ptr, ptr %14, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.arg_dbl, ptr %58, i32 0, i32 0
  %60 = getelementptr inbounds %struct.arg_hdr, ptr %59, i32 0, i32 4
  store ptr %57, ptr %60, align 8, !tbaa !19
  %61 = load i32, ptr %10, align 4, !tbaa !9
  %62 = load ptr, ptr %14, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.arg_dbl, ptr %62, i32 0, i32 0
  %64 = getelementptr inbounds %struct.arg_hdr, ptr %63, i32 0, i32 5
  store i32 %61, ptr %64, align 8, !tbaa !20
  %65 = load i32, ptr %11, align 4, !tbaa !9
  %66 = load ptr, ptr %14, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.arg_dbl, ptr %66, i32 0, i32 0
  %68 = getelementptr inbounds %struct.arg_hdr, ptr %67, i32 0, i32 6
  store i32 %65, ptr %68, align 4, !tbaa !21
  %69 = load ptr, ptr %14, align 8, !tbaa !5
  %70 = load ptr, ptr %14, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.arg_dbl, ptr %70, i32 0, i32 0
  %72 = getelementptr inbounds %struct.arg_hdr, ptr %71, i32 0, i32 7
  store ptr %69, ptr %72, align 8, !tbaa !22
  %73 = load ptr, ptr %14, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.arg_dbl, ptr %73, i32 0, i32 0
  %75 = getelementptr inbounds %struct.arg_hdr, ptr %74, i32 0, i32 8
  store ptr @arg_dbl_resetfn, ptr %75, align 8, !tbaa !23
  %76 = load ptr, ptr %14, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.arg_dbl, ptr %76, i32 0, i32 0
  %78 = getelementptr inbounds %struct.arg_hdr, ptr %77, i32 0, i32 9
  store ptr @arg_dbl_scanfn, ptr %78, align 8, !tbaa !24
  %79 = load ptr, ptr %14, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.arg_dbl, ptr %79, i32 0, i32 0
  %81 = getelementptr inbounds %struct.arg_hdr, ptr %80, i32 0, i32 10
  store ptr @arg_dbl_checkfn, ptr %81, align 8, !tbaa !25
  %82 = load ptr, ptr %14, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.arg_dbl, ptr %82, i32 0, i32 0
  %84 = getelementptr inbounds %struct.arg_hdr, ptr %83, i32 0, i32 11
  store ptr @arg_dbl_errorfn, ptr %84, align 8, !tbaa !26
  %85 = load ptr, ptr %14, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.arg_dbl, ptr %85, i64 1
  %87 = ptrtoint ptr %86 to i64
  store i64 %87, ptr %15, align 8, !tbaa !11
  %88 = load i64, ptr %15, align 8, !tbaa !11
  %89 = urem i64 %88, 8
  store i64 %89, ptr %16, align 8, !tbaa !11
  %90 = load i64, ptr %15, align 8, !tbaa !11
  %91 = add i64 %90, 8
  %92 = load i64, ptr %16, align 8, !tbaa !11
  %93 = sub i64 %91, %92
  %94 = inttoptr i64 %93 to ptr
  %95 = load ptr, ptr %14, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.arg_dbl, ptr %95, i32 0, i32 2
  store ptr %94, ptr %96, align 8, !tbaa !27
  br label %97

97:                                               ; preds = %52
  br label %98

98:                                               ; preds = %97
  br label %99

99:                                               ; preds = %98
  %100 = load ptr, ptr %14, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.arg_dbl, ptr %100, i32 0, i32 1
  store i32 0, ptr %101, align 8, !tbaa !28
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  br label %102

102:                                              ; preds = %99, %24
  br label %103

103:                                              ; preds = %102
  br label %104

104:                                              ; preds = %103
  br label %105

105:                                              ; preds = %104
  %106 = load ptr, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  ret ptr %106
}

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @arg_dbl_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) "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) }

!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_dbl", !15, i64 0, !10, i64 96, !6, i64 104}
!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 104}
!28 = !{!14, !10, 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.6 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noundef ptr @arg_dbln(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4, ptr noundef %5) local_unnamed_addr #0 {
  %7 = tail call i32 @llvm.smax.i32(i32 %4, i32 %3)
  %8 = add nsw i32 %7, 1
  %9 = sext i32 %8 to i64
  %10 = shl nsw i64 %9, 3
  %11 = add nsw i64 %10, 112
  %12 = tail call noalias ptr @malloc(i64 noundef %11) #4
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %33, label %13

13:                                               ; preds = %6
  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
  %.not33 = icmp eq ptr %2, null
  %16 = select i1 %.not33, ptr @.str.6, ptr %2
  %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 %5, ptr %18, align 8, !tbaa !15
  %19 = getelementptr inbounds i8, ptr %12, i64 40
  store i32 %3, ptr %19, align 8, !tbaa !16
  %20 = getelementptr inbounds i8, ptr %12, i64 44
  store i32 %7, 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_dbl_resetfn, ptr %22, align 8, !tbaa !19
  %23 = getelementptr inbounds i8, ptr %12, i64 64
  store ptr @arg_dbl_scanfn, ptr %23, align 8, !tbaa !20
  %24 = getelementptr inbounds i8, ptr %12, i64 72
  store ptr @arg_dbl_checkfn, ptr %24, align 8, !tbaa !21
  %25 = getelementptr inbounds i8, ptr %12, i64 80
  store ptr @arg_dbl_errorfn, ptr %25, align 8, !tbaa !22
  %26 = getelementptr inbounds i8, ptr %12, i64 112
  %27 = ptrtoint ptr %26 to i64
  %28 = and i64 %27, -8
  %29 = add i64 %28, 8
  %30 = inttoptr i64 %29 to ptr
  %31 = getelementptr inbounds i8, ptr %12, i64 104
  store ptr %30, ptr %31, align 8, !tbaa !23
  %32 = getelementptr inbounds i8, ptr %12, i64 96
  store i32 0, ptr %32, align 8, !tbaa !24
  br label %33

33:                                               ; preds = %6, %13
  ret ptr %12
}

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @arg_dbl_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,uninitialized") allocsize(0) 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) }

!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_dbl", !7, i64 0, !11, i64 96, !10, i64 104}
!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 104}
!24 = !{!6, !11, i64 96}


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