; LLVM IR from kala13x/libxutils :: src/data (jwt)

; 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.6 = external hidden unnamed_addr constant [2 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
declare dso_local void @XJWT_Init(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @XJWT_AddPayload(ptr noundef, ptr noundef, i64 noundef, i8 noundef zeroext) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @XJWT_GetPayload(ptr noundef, i8 noundef zeroext, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @XJWT_AddHeader(ptr noundef, ptr noundef, i64 noundef, i8 noundef zeroext) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @XJWT_GetHeader(ptr noundef, i8 noundef zeroext, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @XJWT_GetAlgorithm(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @XJWT_Verify(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @XJWT_Parse(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, i64 noundef %4) #1 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i64 %2, ptr %9, align 8, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i64 %4, ptr %11, align 8, !tbaa !9
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %22, label %21

21:                                               ; preds = %5
  store i32 -2, ptr %6, align 4
  br label %141

22:                                               ; preds = %5
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  call void @XJWT_Init(ptr noundef %23, i32 noundef 0)
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %26, label %29

26:                                               ; preds = %22
  %27 = load i64, ptr %9, align 8, !tbaa !9
  %28 = icmp ne i64 %27, 0
  br i1 %28, label %30, label %29

29:                                               ; preds = %26, %22
  store i32 -2, ptr %6, align 4
  br label %141

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = call ptr @xstrsplit(ptr noundef %31, ptr noundef @.str.6)
  store ptr %32, ptr %12, align 8, !tbaa !5
  %33 = load ptr, ptr %12, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %36, label %35

35:                                               ; preds = %30
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %140

36:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %37 = load ptr, ptr %12, align 8, !tbaa !5
  %38 = call ptr @XArray_GetData(ptr noundef %37, i64 noundef 0)
  store ptr %38, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %39 = load ptr, ptr %12, align 8, !tbaa !5
  %40 = call ptr @XArray_GetData(ptr noundef %39, i64 noundef 1)
  store ptr %40, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %41 = load ptr, ptr %12, align 8, !tbaa !5
  %42 = call ptr @XArray_GetData(ptr noundef %41, i64 noundef 2)
  store ptr %42, ptr %16, align 8, !tbaa !5
  br label %43

43:                                               ; preds = %36
  %44 = load ptr, ptr %14, align 8, !tbaa !5
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %52

46:                                               ; preds = %43
  %47 = load ptr, ptr %15, align 8, !tbaa !5
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %52

49:                                               ; preds = %46
  %50 = load ptr, ptr %16, align 8, !tbaa !5
  %51 = icmp ne ptr %50, null
  br i1 %51, label %54, label %52

52:                                               ; preds = %49, %46, %43
  %53 = load ptr, ptr %12, align 8, !tbaa !5
  call void @XArray_Destroy(ptr noundef %53)
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %139

54:                                               ; preds = %49
  br label %55

55:                                               ; preds = %54
  br label %56

56:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = load ptr, ptr %14, align 8, !tbaa !5
  %59 = load ptr, ptr %14, align 8, !tbaa !5
  %60 = call i64 @strlen(ptr noundef %59) #5
  %61 = call i32 @XJWT_AddHeader(ptr noundef %57, ptr noundef %58, i64 noundef %60, i8 noundef zeroext 1)
  store i32 %61, ptr %17, align 4, !tbaa !11
  br label %62

62:                                               ; preds = %56
  %63 = load i32, ptr %17, align 4, !tbaa !11
  %64 = icmp eq i32 %63, 1
  br i1 %64, label %67, label %65

65:                                               ; preds = %62
  %66 = load ptr, ptr %12, align 8, !tbaa !5
  call void @XArray_Destroy(ptr noundef %66)
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %138

67:                                               ; preds = %62
  br label %68

68:                                               ; preds = %67
  br label %69

69:                                               ; preds = %68
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = load ptr, ptr %15, align 8, !tbaa !5
  %72 = load ptr, ptr %15, align 8, !tbaa !5
  %73 = call i64 @strlen(ptr noundef %72) #5
  %74 = call i32 @XJWT_AddPayload(ptr noundef %70, ptr noundef %71, i64 noundef %73, i8 noundef zeroext 1)
  store i32 %74, ptr %17, align 4, !tbaa !11
  br label %75

75:                                               ; preds = %69
  %76 = load i32, ptr %17, align 4, !tbaa !11
  %77 = icmp eq i32 %76, 1
  br i1 %77, label %80, label %78

78:                                               ; preds = %75
  %79 = load ptr, ptr %12, align 8, !tbaa !5
  call void @XArray_Destroy(ptr noundef %79)
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %138

80:                                               ; preds = %75
  br label %81

81:                                               ; preds = %80
  br label %82

82:                                               ; preds = %81
  br label %83

83:                                               ; preds = %82
  %84 = load ptr, ptr %7, align 8, !tbaa !5
  %85 = call ptr @XJWT_GetHeader(ptr noundef %84, i8 noundef zeroext 0, ptr noundef null)
  %86 = icmp ne ptr %85, null
  br i1 %86, label %89, label %87

87:                                               ; preds = %83
  %88 = load ptr, ptr %12, align 8, !tbaa !5
  call void @XArray_Destroy(ptr noundef %88)
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %138

89:                                               ; preds = %83
  br label %90

90:                                               ; preds = %89
  br label %91

91:                                               ; preds = %90
  br label %92

92:                                               ; preds = %91
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  %94 = call ptr @XJWT_GetPayload(ptr noundef %93, i8 noundef zeroext 0, ptr noundef null)
  %95 = icmp ne ptr %94, null
  br i1 %95, label %98, label %96

96:                                               ; preds = %92
  %97 = load ptr, ptr %12, align 8, !tbaa !5
  call void @XArray_Destroy(ptr noundef %97)
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %138

98:                                               ; preds = %92
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100
  %102 = load ptr, ptr %7, align 8, !tbaa !5
  %103 = call i32 @XJWT_GetAlgorithm(ptr noundef %102)
  %104 = icmp ne i32 %103, 0
  br i1 %104, label %107, label %105

105:                                              ; preds = %101
  %106 = load ptr, ptr %12, align 8, !tbaa !5
  call void @XArray_Destroy(ptr noundef %106)
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %138

107:                                              ; preds = %101
  br label %108

108:                                              ; preds = %107
  br label %109

109:                                              ; preds = %108
  %110 = load ptr, ptr %10, align 8, !tbaa !5
  %111 = icmp ne ptr %110, null
  br i1 %111, label %112, label %135

112:                                              ; preds = %109
  %113 = load i64, ptr %11, align 8, !tbaa !9
  %114 = icmp ugt i64 %113, 0
  br i1 %114, label %115, label %135

115:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %116 = load ptr, ptr %12, align 8, !tbaa !5
  %117 = call i64 @XArray_GetSize(ptr noundef %116, i64 noundef 2)
  store i64 %117, ptr %18, align 8, !tbaa !9
  br label %118

118:                                              ; preds = %115
  %119 = load i64, ptr %18, align 8, !tbaa !9
  %120 = icmp ne i64 %119, 0
  br i1 %120, label %123, label %121

121:                                              ; preds = %118
  %122 = load ptr, ptr %12, align 8, !tbaa !5
  call void @XArray_Destroy(ptr noundef %122)
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %132

123:                                              ; preds = %118
  br label %124

124:                                              ; preds = %123
  br label %125

125:                                              ; preds = %124
  %126 = load ptr, ptr %7, align 8, !tbaa !5
  %127 = load ptr, ptr %16, align 8, !tbaa !5
  %128 = load i64, ptr %18, align 8, !tbaa !9
  %129 = load ptr, ptr %10, align 8, !tbaa !5
  %130 = load i64, ptr %11, align 8, !tbaa !9
  %131 = call i32 @XJWT_Verify(ptr noundef %126, ptr noundef %127, i64 noundef %128, ptr noundef %129, i64 noundef %130)
  store i32 %131, ptr %17, align 4, !tbaa !11
  store i32 0, ptr %13, align 4
  br label %132

132:                                              ; preds = %125, %121
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  %133 = load i32, ptr %13, align 4
  switch i32 %133, label %138 [
    i32 0, label %134
  ]

134:                                              ; preds = %132
  br label %135

135:                                              ; preds = %134, %112, %109
  %136 = load ptr, ptr %12, align 8, !tbaa !5
  call void @XArray_Destroy(ptr noundef %136)
  %137 = load i32, ptr %17, align 4, !tbaa !11
  store i32 %137, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %138

138:                                              ; preds = %135, %132, %105, %96, %87, %78, %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %139

139:                                              ; preds = %138, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %140

140:                                              ; preds = %139, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %141

141:                                              ; preds = %140, %29, %21
  %142 = load i32, ptr %6, align 4
  ret i32 %142
}

declare ptr @xstrsplit(ptr noundef, ptr noundef) #2

declare ptr @XArray_GetData(ptr noundef, i64 noundef) #2

declare void @XArray_Destroy(ptr noundef) #2

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

declare i64 @XArray_GetSize(ptr noundef, i64 noundef) #2

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 = { "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 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 #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}


; 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 [2 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @XJWT_Init(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @XJWT_AddPayload(ptr noundef, ptr noundef, i64 noundef, i8 noundef zeroext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @XJWT_GetPayload(ptr noundef, i8 noundef zeroext, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @XJWT_AddHeader(ptr noundef, ptr noundef, i64 noundef, i8 noundef zeroext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @XJWT_GetHeader(ptr noundef, i8 noundef zeroext, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @XJWT_GetAlgorithm(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @XJWT_Verify(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @XJWT_Parse(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, i64 noundef %4) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %39, label %6

6:                                                ; preds = %5
  tail call void @XJWT_Init(ptr noundef nonnull %0, i32 noundef 0)
  %7 = icmp ne ptr %1, null
  %8 = icmp ne i64 %2, 0
  %or.cond = and i1 %7, %8
  br i1 %or.cond, label %9, label %39

9:                                                ; preds = %6
  %10 = tail call ptr @xstrsplit(ptr noundef nonnull %1, ptr noundef nonnull @.str.6) #3
  %.not61 = icmp eq ptr %10, null
  br i1 %.not61, label %39, label %11

11:                                               ; preds = %9
  %12 = tail call ptr @XArray_GetData(ptr noundef nonnull %10, i64 noundef 0) #3
  %13 = tail call ptr @XArray_GetData(ptr noundef nonnull %10, i64 noundef 1) #3
  %14 = tail call ptr @XArray_GetData(ptr noundef nonnull %10, i64 noundef 2) #3
  %15 = icmp ne ptr %12, null
  %16 = icmp ne ptr %13, null
  %or.cond3 = select i1 %15, i1 %16, i1 false
  %17 = icmp ne ptr %14, null
  %or.cond5 = select i1 %or.cond3, i1 %17, i1 false
  br i1 %or.cond5, label %18, label %.sink.split

18:                                               ; preds = %11
  %19 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %12) #4
  %20 = tail call i32 @XJWT_AddHeader(ptr noundef nonnull %0, ptr noundef nonnull %12, i64 noundef %19, i8 noundef zeroext 1)
  %21 = icmp eq i32 %20, 1
  br i1 %21, label %22, label %.sink.split

22:                                               ; preds = %18
  %23 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %13) #4
  %24 = tail call i32 @XJWT_AddPayload(ptr noundef nonnull %0, ptr noundef nonnull %13, i64 noundef %23, i8 noundef zeroext 1)
  %25 = icmp eq i32 %24, 1
  br i1 %25, label %26, label %.sink.split

26:                                               ; preds = %22
  %27 = tail call ptr @XJWT_GetHeader(ptr noundef nonnull %0, i8 noundef zeroext 0, ptr noundef null)
  %.not62 = icmp eq ptr %27, null
  br i1 %.not62, label %.sink.split, label %28

28:                                               ; preds = %26
  %29 = tail call ptr @XJWT_GetPayload(ptr noundef nonnull %0, i8 noundef zeroext 0, ptr noundef null)
  %.not63 = icmp eq ptr %29, null
  br i1 %.not63, label %.sink.split, label %30

30:                                               ; preds = %28
  %31 = tail call i32 @XJWT_GetAlgorithm(ptr noundef nonnull %0)
  %.not64 = icmp eq i32 %31, 0
  br i1 %.not64, label %.sink.split, label %32

32:                                               ; preds = %30
  %33 = icmp ne ptr %3, null
  %34 = icmp ne i64 %4, 0
  %or.cond7 = and i1 %33, %34
  br i1 %or.cond7, label %35, label %.sink.split

35:                                               ; preds = %32
  %36 = tail call i64 @XArray_GetSize(ptr noundef nonnull %10, i64 noundef 2) #3
  %.not65.not = icmp eq i64 %36, 0
  br i1 %.not65.not, label %.sink.split, label %37

37:                                               ; preds = %35
  %38 = tail call i32 @XJWT_Verify(ptr noundef nonnull %0, ptr noundef nonnull %14, i64 noundef %36, ptr noundef nonnull %3, i64 noundef %4)
  br label %.sink.split

.sink.split:                                      ; preds = %32, %37, %35, %30, %28, %26, %22, %18, %11
  %.4.ph = phi i32 [ -1, %11 ], [ -1, %18 ], [ -1, %22 ], [ -1, %26 ], [ -1, %28 ], [ -1, %30 ], [ -1, %35 ], [ %38, %37 ], [ 1, %32 ]
  tail call void @XArray_Destroy(ptr noundef nonnull %10) #3
  br label %39

39:                                               ; preds = %.sink.split, %9, %6, %5
  %.4 = phi i32 [ -2, %5 ], [ -2, %6 ], [ -1, %9 ], [ %.4.ph, %.sink.split ]
  ret i32 %.4
}

declare ptr @xstrsplit(ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @XArray_GetData(ptr noundef, i64 noundef) local_unnamed_addr #1

declare void @XArray_Destroy(ptr noundef) local_unnamed_addr #1

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

declare i64 @XArray_GetSize(ptr noundef, i64 noundef) local_unnamed_addr #1

attributes #0 = { 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 #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 #2 = { 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 #3 = { nounwind }
attributes #4 = { nounwind willreturn memory(read) }

!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)"}


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