; 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"

@.str.24 = external hidden unnamed_addr constant [4 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 willreturn memory(none)
declare ptr @__ctype_b_loc() #1

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local void @arg_print_formatted(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) #4 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %14 = load ptr, ptr %8, align 8, !tbaa !5
  %15 = call i64 @strlen(ptr noundef %14) #7
  %16 = trunc i64 %15 to i32
  store i32 %16, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %17 = load i32, ptr %9, align 4, !tbaa !9
  %18 = add i32 %17, 1
  store i32 %18, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %19 = load i32, ptr %7, align 4, !tbaa !9
  %20 = load i32, ptr %6, align 4, !tbaa !9
  %21 = sub i32 %19, %20
  %22 = add i32 %21, 1
  store i32 %22, ptr %12, align 4, !tbaa !9
  %23 = load i32, ptr %11, align 4, !tbaa !9
  %24 = load i32, ptr %10, align 4, !tbaa !9
  %25 = icmp ult i32 %23, %24
  br i1 %25, label %26, label %30

26:                                               ; preds = %4
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef @.str.24, ptr noundef %28) #6
  br label %30

30:                                               ; preds = %26, %4
  br label %31

31:                                               ; preds = %135, %30
  %32 = load i32, ptr %11, align 4, !tbaa !9
  %33 = sub i32 %32, 1
  %34 = load i32, ptr %10, align 4, !tbaa !9
  %35 = icmp ugt i32 %33, %34
  br i1 %35, label %36, label %138

36:                                               ; preds = %31
  br label %37

37:                                               ; preds = %52, %36
  %38 = call ptr @__ctype_b_loc() #8
  %39 = load ptr, ptr %38, align 8, !tbaa !5
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = load i32, ptr %10, align 4, !tbaa !9
  %42 = zext i32 %41 to i64
  %43 = getelementptr inbounds i8, ptr %40, i64 %42
  %44 = load i8, ptr %43, align 1, !tbaa !11
  %45 = sext i8 %44 to i32
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds i16, ptr %39, i64 %46
  %48 = load i16, ptr %47, align 2, !tbaa !12
  %49 = zext i16 %48 to i32
  %50 = and i32 %49, 8192
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %52, label %55

52:                                               ; preds = %37
  %53 = load i32, ptr %10, align 4, !tbaa !9
  %54 = add i32 %53, 1
  store i32 %54, ptr %10, align 4, !tbaa !9
  br label %37, !llvm.loop !14

55:                                               ; preds = %37
  %56 = load i32, ptr %11, align 4, !tbaa !9
  %57 = load i32, ptr %10, align 4, !tbaa !9
  %58 = sub i32 %56, %57
  %59 = load i32, ptr %12, align 4, !tbaa !9
  %60 = icmp ugt i32 %58, %59
  br i1 %60, label %61, label %65

61:                                               ; preds = %55
  %62 = load i32, ptr %10, align 4, !tbaa !9
  %63 = load i32, ptr %12, align 4, !tbaa !9
  %64 = add i32 %62, %63
  store i32 %64, ptr %11, align 4, !tbaa !9
  br label %65

65:                                               ; preds = %61, %55
  br label %66

66:                                               ; preds = %94, %65
  %67 = load i32, ptr %11, align 4, !tbaa !9
  %68 = load i32, ptr %10, align 4, !tbaa !9
  %69 = icmp ugt i32 %67, %68
  br i1 %69, label %70, label %92

70:                                               ; preds = %66
  %71 = load i32, ptr %11, align 4, !tbaa !9
  %72 = load i32, ptr %10, align 4, !tbaa !9
  %73 = sub i32 %71, %72
  %74 = load i32, ptr %12, align 4, !tbaa !9
  %75 = icmp ugt i32 %73, %74
  br i1 %75, label %76, label %92

76:                                               ; preds = %70
  %77 = call ptr @__ctype_b_loc() #8
  %78 = load ptr, ptr %77, align 8, !tbaa !5
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  %80 = load i32, ptr %11, align 4, !tbaa !9
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds i8, ptr %79, i64 %81
  %83 = load i8, ptr %82, align 1, !tbaa !11
  %84 = sext i8 %83 to i32
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds i16, ptr %78, i64 %85
  %87 = load i16, ptr %86, align 2, !tbaa !12
  %88 = zext i16 %87 to i32
  %89 = and i32 %88, 8192
  %90 = icmp ne i32 %89, 0
  %91 = xor i1 %90, true
  br label %92

92:                                               ; preds = %76, %70, %66
  %93 = phi i1 [ false, %70 ], [ false, %66 ], [ %91, %76 ]
  br i1 %93, label %94, label %97

94:                                               ; preds = %92
  %95 = load i32, ptr %11, align 4, !tbaa !9
  %96 = add i32 %95, -1
  store i32 %96, ptr %11, align 4, !tbaa !9
  br label %66, !llvm.loop !16

97:                                               ; preds = %92
  %98 = load i32, ptr %11, align 4, !tbaa !9
  %99 = add i32 %98, -1
  store i32 %99, ptr %11, align 4, !tbaa !9
  br label %100

100:                                              ; preds = %104, %97
  %101 = load i32, ptr %10, align 4, !tbaa !9
  %102 = load i32, ptr %11, align 4, !tbaa !9
  %103 = icmp ult i32 %101, %102
  br i1 %103, label %104, label %115

104:                                              ; preds = %100
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = load i32, ptr %10, align 4, !tbaa !9
  %107 = zext i32 %106 to i64
  %108 = getelementptr inbounds i8, ptr %105, i64 %107
  %109 = load i8, ptr %108, align 1, !tbaa !11
  %110 = sext i8 %109 to i32
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = call i32 @fputc(i32 noundef %110, ptr noundef %111)
  %113 = load i32, ptr %10, align 4, !tbaa !9
  %114 = add i32 %113, 1
  store i32 %114, ptr %10, align 4, !tbaa !9
  br label %100, !llvm.loop !17

115:                                              ; preds = %100
  %116 = load ptr, ptr %5, align 8, !tbaa !5
  %117 = call i32 @fputc(i32 noundef 10, ptr noundef %116)
  %118 = load i32, ptr %11, align 4, !tbaa !9
  %119 = add i32 %118, 1
  %120 = load i32, ptr %9, align 4, !tbaa !9
  %121 = icmp ult i32 %119, %120
  br i1 %121, label %122, label %135

122:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %123

123:                                              ; preds = %130, %122
  %124 = load i32, ptr %13, align 4, !tbaa !9
  %125 = load i32, ptr %6, align 4, !tbaa !9
  %126 = icmp ult i32 %124, %125
  br i1 %126, label %127, label %133

127:                                              ; preds = %123
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = call i32 @fputc(i32 noundef 32, ptr noundef %128)
  br label %130

130:                                              ; preds = %127
  %131 = load i32, ptr %13, align 4, !tbaa !9
  %132 = add i32 %131, 1
  store i32 %132, ptr %13, align 4, !tbaa !9
  br label %123, !llvm.loop !18

133:                                              ; preds = %123
  %134 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %134, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %135

135:                                              ; preds = %133, %115
  %136 = load i32, ptr %11, align 4, !tbaa !9
  %137 = add i32 %136, 1
  store i32 %137, ptr %11, align 4, !tbaa !9
  br label %31, !llvm.loop !19

138:                                              ; preds = %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  ret void
}

declare i32 @fputc(i32 noundef, ptr noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind willreturn memory(none) "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 willreturn memory(read) "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 = { 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 #5 = { "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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { nounwind willreturn memory(none) }

!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 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}
!19 = distinct !{!19, !15}


; 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"

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind uwtable
define dso_local void @arg_print_formatted(ptr nocapture noundef %0, i32 noundef %1, i32 noundef %2, ptr nocapture noundef readonly %3) local_unnamed_addr #2 {
  %5 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %3) #4
  %6 = trunc i64 %5 to i32
  %7 = sub i32 %2, %1
  %8 = add i32 %7, 1
  %.not66 = icmp eq i32 %6, 0
  br i1 %.not66, label %._crit_edge63, label %.preheader50.lr.ph

.preheader50.lr.ph:                               ; preds = %4
  %9 = tail call ptr @__ctype_b_loc() #5
  %.not67 = icmp eq i32 %1, 0
  br label %.preheader50

.preheader50:                                     ; preds = %.preheader50.lr.ph, %.loopexit
  %.04262.in = phi i32 [ %6, %.preheader50.lr.ph ], [ %.3, %.loopexit ]
  %.04161 = phi i32 [ 0, %.preheader50.lr.ph ], [ %.2.lcssa, %.loopexit ]
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %11, %.preheader50
  %.1 = phi i32 [ %19, %11 ], [ %.04161, %.preheader50 ]
  %12 = zext i32 %.1 to i64
  %13 = getelementptr inbounds i8, ptr %3, i64 %12
  %14 = load i8, ptr %13, align 1, !tbaa !9
  %15 = sext i8 %14 to i64
  %16 = getelementptr inbounds i16, ptr %10, i64 %15
  %17 = load i16, ptr %16, align 2, !tbaa !10
  %18 = and i16 %17, 8192
  %.not = icmp eq i16 %18, 0
  %19 = add i32 %.1, 1
  br i1 %.not, label %20, label %11, !llvm.loop !12

20:                                               ; preds = %11
  %.04262 = add i32 %.04262.in, 1
  %21 = sub i32 %.04262, %.1
  %22 = icmp ugt i32 %21, %8
  %23 = add i32 %.1, %8
  %spec.select = select i1 %22, i32 %23, i32 %.04262
  %24 = icmp ugt i32 %spec.select, %.1
  %25 = sub i32 %spec.select, %.1
  %26 = icmp ugt i32 %25, %8
  %or.cond51 = and i1 %24, %26
  br i1 %or.cond51, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %20, %34
  %.24452 = phi i32 [ %35, %34 ], [ %spec.select, %20 ]
  %27 = zext i32 %.24452 to i64
  %28 = getelementptr inbounds i8, ptr %3, i64 %27
  %29 = load i8, ptr %28, align 1, !tbaa !9
  %30 = sext i8 %29 to i64
  %31 = getelementptr inbounds i16, ptr %10, i64 %30
  %32 = load i16, ptr %31, align 2, !tbaa !10
  %33 = and i16 %32, 8192
  %.not48 = icmp eq i16 %33, 0
  br i1 %.not48, label %34, label %.critedge

34:                                               ; preds = %.lr.ph
  %35 = add i32 %.24452, -1
  %36 = icmp ugt i32 %35, %.1
  %37 = sub i32 %35, %.1
  %38 = icmp ugt i32 %37, %8
  %or.cond = and i1 %36, %38
  br i1 %or.cond, label %.lr.ph, label %.critedge, !llvm.loop !14

.critedge:                                        ; preds = %.lr.ph, %34, %20
  %.244.lcssa = phi i32 [ %spec.select, %20 ], [ %35, %34 ], [ %.24452, %.lr.ph ]
  %39 = add i32 %.244.lcssa, -1
  %40 = icmp ult i32 %.1, %39
  br i1 %40, label %.lr.ph56.preheader, label %._crit_edge

.lr.ph56.preheader:                               ; preds = %.critedge
  %41 = zext i32 %39 to i64
  br label %.lr.ph56

.lr.ph56:                                         ; preds = %.lr.ph56.preheader, %.lr.ph56
  %indvars.iv = phi i64 [ %12, %.lr.ph56.preheader ], [ %indvars.iv.next, %.lr.ph56 ]
  %42 = getelementptr inbounds i8, ptr %3, i64 %indvars.iv
  %43 = load i8, ptr %42, align 1, !tbaa !9
  %44 = sext i8 %43 to i32
  %45 = tail call i32 @fputc(i32 noundef %44, ptr noundef %0)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %46 = icmp ult i64 %indvars.iv.next, %41
  br i1 %46, label %.lr.ph56, label %._crit_edge.loopexit, !llvm.loop !15

._crit_edge.loopexit:                             ; preds = %.lr.ph56
  %47 = trunc nuw i64 %indvars.iv.next to i32
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.critedge
  %.2.lcssa = phi i32 [ %.1, %.critedge ], [ %47, %._crit_edge.loopexit ]
  %48 = tail call i32 @fputc(i32 noundef 10, ptr noundef %0)
  %49 = icmp uge i32 %.244.lcssa, %6
  %brmerge = or i1 %49, %.not67
  %.mux = select i1 %49, i32 %39, i32 %6
  br i1 %brmerge, label %.loopexit, label %.lr.ph59

.lr.ph59:                                         ; preds = %._crit_edge, %.lr.ph59
  %.058 = phi i32 [ %51, %.lr.ph59 ], [ 0, %._crit_edge ]
  %50 = tail call i32 @fputc(i32 noundef 32, ptr noundef %0)
  %51 = add nuw i32 %.058, 1
  %exitcond.not = icmp eq i32 %51, %1
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph59, !llvm.loop !16

.loopexit:                                        ; preds = %.lr.ph59, %._crit_edge
  %.3 = phi i32 [ %.mux, %._crit_edge ], [ %6, %.lr.ph59 ]
  %52 = icmp ugt i32 %.3, %.2.lcssa
  br i1 %52, label %.preheader50, label %._crit_edge63, !llvm.loop !17

._crit_edge63:                                    ; preds = %.loopexit, %4
  ret void
}

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

attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) "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(argmem: read) "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 = { nofree 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 willreturn memory(read) }
attributes #5 = { nounwind willreturn memory(none) }

!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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass