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

@.str.9 = external hidden unnamed_addr constant [6 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 allocsize(0)
declare noalias ptr @malloc(i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @arg_intn(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4, ptr noundef %5) #2 {
  %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
  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
  %15 = load i32, ptr %11, align 4, !tbaa !9
  %16 = load i32, ptr %10, align 4, !tbaa !9
  %17 = icmp slt i32 %15, %16
  br i1 %17, label %18, label %20

18:                                               ; preds = %6
  %19 = load i32, ptr %10, align 4, !tbaa !9
  br label %22

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

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

32:                                               ; preds = %22
  %33 = load ptr, ptr %14, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.arg_int, ptr %33, i32 0, i32 0
  %35 = getelementptr inbounds %struct.arg_hdr, ptr %34, i32 0, i32 0
  store i8 2, ptr %35, align 8, !tbaa !13
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = load ptr, ptr %14, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.arg_int, ptr %37, i32 0, i32 0
  %39 = getelementptr inbounds %struct.arg_hdr, ptr %38, i32 0, i32 1
  store ptr %36, ptr %39, align 8, !tbaa !16
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = load ptr, ptr %14, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.arg_int, ptr %41, i32 0, i32 0
  %43 = getelementptr inbounds %struct.arg_hdr, ptr %42, i32 0, i32 2
  store ptr %40, ptr %43, align 8, !tbaa !17
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %48

46:                                               ; preds = %32
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  br label %49

48:                                               ; preds = %32
  br label %49

49:                                               ; preds = %48, %46
  %50 = phi ptr [ %47, %46 ], [ @.str.9, %48 ]
  %51 = load ptr, ptr %14, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.arg_int, ptr %51, i32 0, i32 0
  %53 = getelementptr inbounds %struct.arg_hdr, ptr %52, i32 0, i32 3
  store ptr %50, ptr %53, align 8, !tbaa !18
  %54 = load ptr, ptr %12, align 8, !tbaa !5
  %55 = load ptr, ptr %14, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.arg_int, ptr %55, i32 0, i32 0
  %57 = getelementptr inbounds %struct.arg_hdr, ptr %56, i32 0, i32 4
  store ptr %54, ptr %57, align 8, !tbaa !19
  %58 = load i32, ptr %10, align 4, !tbaa !9
  %59 = load ptr, ptr %14, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.arg_int, ptr %59, i32 0, i32 0
  %61 = getelementptr inbounds %struct.arg_hdr, ptr %60, i32 0, i32 5
  store i32 %58, ptr %61, align 8, !tbaa !20
  %62 = load i32, ptr %11, align 4, !tbaa !9
  %63 = load ptr, ptr %14, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.arg_int, ptr %63, i32 0, i32 0
  %65 = getelementptr inbounds %struct.arg_hdr, ptr %64, i32 0, i32 6
  store i32 %62, ptr %65, align 4, !tbaa !21
  %66 = load ptr, ptr %14, align 8, !tbaa !5
  %67 = load ptr, ptr %14, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.arg_int, ptr %67, i32 0, i32 0
  %69 = getelementptr inbounds %struct.arg_hdr, ptr %68, i32 0, i32 7
  store ptr %66, ptr %69, align 8, !tbaa !22
  %70 = load ptr, ptr %14, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.arg_int, ptr %70, i32 0, i32 0
  %72 = getelementptr inbounds %struct.arg_hdr, ptr %71, i32 0, i32 8
  store ptr @arg_int_resetfn, ptr %72, align 8, !tbaa !23
  %73 = load ptr, ptr %14, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.arg_int, ptr %73, i32 0, i32 0
  %75 = getelementptr inbounds %struct.arg_hdr, ptr %74, i32 0, i32 9
  store ptr @arg_int_scanfn, ptr %75, align 8, !tbaa !24
  %76 = load ptr, ptr %14, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.arg_int, ptr %76, i32 0, i32 0
  %78 = getelementptr inbounds %struct.arg_hdr, ptr %77, i32 0, i32 10
  store ptr @arg_int_checkfn, ptr %78, align 8, !tbaa !25
  %79 = load ptr, ptr %14, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.arg_int, ptr %79, i32 0, i32 0
  %81 = getelementptr inbounds %struct.arg_hdr, ptr %80, i32 0, i32 11
  store ptr @arg_int_errorfn, ptr %81, align 8, !tbaa !26
  %82 = load ptr, ptr %14, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.arg_int, ptr %82, i64 1
  %84 = load ptr, ptr %14, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.arg_int, ptr %84, i32 0, i32 2
  store ptr %83, ptr %85, align 8, !tbaa !27
  %86 = load ptr, ptr %14, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.arg_int, ptr %86, i32 0, i32 1
  store i32 0, ptr %87, align 8, !tbaa !28
  br label %88

88:                                               ; preds = %49, %22
  br label %89

89:                                               ; preds = %88
  br label %90

90:                                               ; preds = %89
  br label %91

91:                                               ; preds = %90
  %92 = 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 %92
}

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

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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_int", !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.9 = external hidden unnamed_addr constant [6 x i8], align 1

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

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

12:                                               ; preds = %6
  store i8 2, ptr %11, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %11, i64 8
  store ptr %0, ptr %13, align 8, !tbaa !12
  %14 = getelementptr inbounds i8, ptr %11, i64 16
  store ptr %1, ptr %14, align 8, !tbaa !13
  %.not30 = icmp eq ptr %2, null
  %15 = select i1 %.not30, ptr @.str.9, ptr %2
  %16 = getelementptr inbounds i8, ptr %11, i64 24
  store ptr %15, ptr %16, align 8, !tbaa !14
  %17 = getelementptr inbounds i8, ptr %11, i64 32
  store ptr %5, ptr %17, align 8, !tbaa !15
  %18 = getelementptr inbounds i8, ptr %11, i64 40
  store i32 %3, ptr %18, align 8, !tbaa !16
  %19 = getelementptr inbounds i8, ptr %11, i64 44
  store i32 %7, ptr %19, align 4, !tbaa !17
  %20 = getelementptr inbounds i8, ptr %11, i64 48
  store ptr %11, ptr %20, align 8, !tbaa !18
  %21 = getelementptr inbounds i8, ptr %11, i64 56
  store ptr @arg_int_resetfn, ptr %21, align 8, !tbaa !19
  %22 = getelementptr inbounds i8, ptr %11, i64 64
  store ptr @arg_int_scanfn, ptr %22, align 8, !tbaa !20
  %23 = getelementptr inbounds i8, ptr %11, i64 72
  store ptr @arg_int_checkfn, ptr %23, align 8, !tbaa !21
  %24 = getelementptr inbounds i8, ptr %11, i64 80
  store ptr @arg_int_errorfn, ptr %24, align 8, !tbaa !22
  %25 = getelementptr inbounds i8, ptr %11, i64 112
  %26 = getelementptr inbounds i8, ptr %11, i64 104
  store ptr %25, ptr %26, align 8, !tbaa !23
  %27 = getelementptr inbounds i8, ptr %11, i64 96
  store i32 0, ptr %27, align 8, !tbaa !24
  br label %28

28:                                               ; preds = %6, %12
  ret ptr %11
}

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @arg_int_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 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 #1 = { 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 #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_int", !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