; LLVM IR from libtcod/libtcod :: src/libtcod (lex_c)

; 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.TCOD_lex_t = type { i32, i32, i32, i32, float, ptr, i32, i8, ptr, ptr, ptr, ptr, i32, i32, i32, [100 x [5 x i8]], [100 x [20 x i8]], ptr, ptr, ptr, ptr, ptr, i8, i8, i8 }

@.str.1 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [42 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: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #1

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #2

; 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 ptr @TCOD_lex_new_intern() #3

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

declare i32 @TCOD_set_errorf(ptr noundef, ...) #5

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

26:                                               ; preds = %8
  store ptr null, ptr %9, align 8
  store i32 1, ptr %19, align 4
  br label %168

27:                                               ; preds = %8
  %28 = load i32, ptr %17, align 4, !tbaa !9
  %29 = load ptr, ptr %18, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.TCOD_lex_t, ptr %29, i32 0, i32 14
  store i32 %28, ptr %30, align 8, !tbaa !11
  %31 = call noalias ptr @calloc(i64 noundef 16384, i64 noundef 1) #8
  %32 = load ptr, ptr %18, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.TCOD_lex_t, ptr %32, i32 0, i32 11
  store ptr %31, ptr %33, align 8, !tbaa !15
  br label %34

34:                                               ; preds = %53, %27
  %35 = load ptr, ptr %10, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %41

37:                                               ; preds = %34
  %38 = load ptr, ptr %10, align 8, !tbaa !5
  %39 = load ptr, ptr %38, align 8, !tbaa !5
  %40 = icmp ne ptr %39, null
  br label %41

41:                                               ; preds = %37, %34
  %42 = phi i1 [ false, %34 ], [ %40, %37 ]
  br i1 %42, label %43, label %71

43:                                               ; preds = %41
  %44 = load ptr, ptr %10, align 8, !tbaa !5
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  %46 = call i64 @strlen(ptr noundef %45) #9
  %47 = icmp uge i64 %46, 5
  br i1 %47, label %48, label %53

48:                                               ; preds = %43
  %49 = load ptr, ptr %10, align 8, !tbaa !5
  %50 = load ptr, ptr %49, align 8, !tbaa !5
  %51 = call i32 (ptr, ...) @TCOD_set_errorf(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 96, ptr noundef %50, i32 noundef 5)
  %52 = load ptr, ptr %18, align 8, !tbaa !5
  call void @TCOD_lex_delete(ptr noundef %52)
  store ptr null, ptr %9, align 8
  store i32 1, ptr %19, align 4
  br label %168

53:                                               ; preds = %43
  %54 = load ptr, ptr %18, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.TCOD_lex_t, ptr %54, i32 0, i32 15
  %56 = load ptr, ptr %18, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.TCOD_lex_t, ptr %56, i32 0, i32 12
  %58 = load i32, ptr %57, align 8, !tbaa !16
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [100 x [5 x i8]], ptr %55, i64 0, i64 %59
  %61 = getelementptr inbounds [5 x i8], ptr %60, i64 0, i64 0
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = load ptr, ptr %62, align 8, !tbaa !5
  %64 = call ptr @strcpy(ptr noundef %61, ptr noundef %63) #7
  %65 = load ptr, ptr %18, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.TCOD_lex_t, ptr %65, i32 0, i32 12
  %67 = load i32, ptr %66, align 8, !tbaa !16
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %66, align 8, !tbaa !16
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  %70 = getelementptr inbounds ptr, ptr %69, i32 1
  store ptr %70, ptr %10, align 8, !tbaa !5
  br label %34, !llvm.loop !17

71:                                               ; preds = %41
  br label %72

72:                                               ; preds = %137, %71
  %73 = load ptr, ptr %11, align 8, !tbaa !5
  %74 = icmp ne ptr %73, null
  br i1 %74, label %75, label %79

75:                                               ; preds = %72
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  %77 = load ptr, ptr %76, align 8, !tbaa !5
  %78 = icmp ne ptr %77, null
  br label %79

79:                                               ; preds = %75, %72
  %80 = phi i1 [ false, %72 ], [ %78, %75 ]
  br i1 %80, label %81, label %144

81:                                               ; preds = %79
  %82 = load ptr, ptr %11, align 8, !tbaa !5
  %83 = load ptr, ptr %82, align 8, !tbaa !5
  %84 = call i64 @strlen(ptr noundef %83) #9
  %85 = icmp uge i64 %84, 20
  br i1 %85, label %86, label %91

86:                                               ; preds = %81
  %87 = load ptr, ptr %11, align 8, !tbaa !5
  %88 = load ptr, ptr %87, align 8, !tbaa !5
  %89 = call i32 (ptr, ...) @TCOD_set_errorf(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 106, ptr noundef %88, i32 noundef 20)
  %90 = load ptr, ptr %18, align 8, !tbaa !5
  call void @TCOD_lex_delete(ptr noundef %90)
  store ptr null, ptr %9, align 8
  store i32 1, ptr %19, align 4
  br label %168

91:                                               ; preds = %81
  %92 = load ptr, ptr %18, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.TCOD_lex_t, ptr %92, i32 0, i32 16
  %94 = load ptr, ptr %18, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.TCOD_lex_t, ptr %94, i32 0, i32 13
  %96 = load i32, ptr %95, align 4, !tbaa !19
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [100 x [20 x i8]], ptr %93, i64 0, i64 %97
  %99 = getelementptr inbounds [20 x i8], ptr %98, i64 0, i64 0
  %100 = load ptr, ptr %11, align 8, !tbaa !5
  %101 = load ptr, ptr %100, align 8, !tbaa !5
  %102 = call ptr @strcpy(ptr noundef %99, ptr noundef %101) #7
  %103 = load ptr, ptr %18, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.TCOD_lex_t, ptr %103, i32 0, i32 14
  %105 = load i32, ptr %104, align 8, !tbaa !11
  %106 = and i32 %105, 1
  %107 = icmp ne i32 %106, 0
  br i1 %107, label %108, label %137

108:                                              ; preds = %91
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %109 = load ptr, ptr %18, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.TCOD_lex_t, ptr %109, i32 0, i32 16
  %111 = load ptr, ptr %18, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.TCOD_lex_t, ptr %111, i32 0, i32 13
  %113 = load i32, ptr %112, align 4, !tbaa !19
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [100 x [20 x i8]], ptr %110, i64 0, i64 %114
  %116 = getelementptr inbounds [20 x i8], ptr %115, i64 0, i64 0
  store ptr %116, ptr %20, align 8, !tbaa !5
  br label %117

117:                                              ; preds = %121, %108
  %118 = load ptr, ptr %20, align 8, !tbaa !5
  %119 = load i8, ptr %118, align 1, !tbaa !20
  %120 = icmp ne i8 %119, 0
  br i1 %120, label %121, label %136

121:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %122 = call ptr @__ctype_toupper_loc() #10
  %123 = load ptr, ptr %122, align 8, !tbaa !5
  %124 = load ptr, ptr %20, align 8, !tbaa !5
  %125 = load i8, ptr %124, align 1, !tbaa !20
  %126 = sext i8 %125 to i32
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds i32, ptr %123, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !9
  store i32 %129, ptr %21, align 4, !tbaa !9
  %130 = load i32, ptr %21, align 4, !tbaa !9
  store i32 %130, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  %131 = load i32, ptr %22, align 4, !tbaa !9
  %132 = trunc i32 %131 to i8
  %133 = load ptr, ptr %20, align 8, !tbaa !5
  store i8 %132, ptr %133, align 1, !tbaa !20
  %134 = load ptr, ptr %20, align 8, !tbaa !5
  %135 = getelementptr inbounds i8, ptr %134, i32 1
  store ptr %135, ptr %20, align 8, !tbaa !5
  br label %117, !llvm.loop !21

136:                                              ; preds = %117
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %137

137:                                              ; preds = %136, %91
  %138 = load ptr, ptr %18, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.TCOD_lex_t, ptr %138, i32 0, i32 13
  %140 = load i32, ptr %139, align 4, !tbaa !19
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %139, align 4, !tbaa !19
  %142 = load ptr, ptr %11, align 8, !tbaa !5
  %143 = getelementptr inbounds ptr, ptr %142, i32 1
  store ptr %143, ptr %11, align 8, !tbaa !5
  br label %72, !llvm.loop !22

144:                                              ; preds = %79
  %145 = load ptr, ptr %12, align 8, !tbaa !5
  %146 = load ptr, ptr %18, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.TCOD_lex_t, ptr %146, i32 0, i32 17
  store ptr %145, ptr %147, align 8, !tbaa !23
  %148 = load ptr, ptr %13, align 8, !tbaa !5
  %149 = load ptr, ptr %18, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.TCOD_lex_t, ptr %149, i32 0, i32 18
  store ptr %148, ptr %150, align 8, !tbaa !24
  %151 = load ptr, ptr %14, align 8, !tbaa !5
  %152 = load ptr, ptr %18, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.TCOD_lex_t, ptr %152, i32 0, i32 19
  store ptr %151, ptr %153, align 8, !tbaa !25
  %154 = load ptr, ptr %15, align 8, !tbaa !5
  %155 = load ptr, ptr %18, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.TCOD_lex_t, ptr %155, i32 0, i32 20
  store ptr %154, ptr %156, align 8, !tbaa !26
  %157 = load ptr, ptr %16, align 8, !tbaa !5
  %158 = load ptr, ptr %18, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.TCOD_lex_t, ptr %158, i32 0, i32 21
  store ptr %157, ptr %159, align 8, !tbaa !27
  %160 = load ptr, ptr %18, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.TCOD_lex_t, ptr %160, i32 0, i32 7
  store i8 0, ptr %161, align 4, !tbaa !28
  %162 = call noalias ptr @calloc(i64 noundef 256, i64 noundef 1) #8
  %163 = load ptr, ptr %18, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.TCOD_lex_t, ptr %163, i32 0, i32 5
  store ptr %162, ptr %164, align 8, !tbaa !29
  %165 = load ptr, ptr %18, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.TCOD_lex_t, ptr %165, i32 0, i32 6
  store i32 256, ptr %166, align 8, !tbaa !30
  %167 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %167, ptr %9, align 8
  store i32 1, ptr %19, align 4
  br label %168

168:                                              ; preds = %144, %86, %48, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  %169 = load ptr, ptr %9, align 8
  ret ptr %169
}

; Function Attrs: nounwind uwtable
declare dso_local void @TCOD_lex_delete(ptr noundef) #3

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_toupper_loc() #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 #4 = { 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 #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 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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0,1) }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { 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 = !{!12, !10, i64 80}
!12 = !{!"TCOD_lex_t", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !13, i64 16, !6, i64 24, !10, i64 32, !7, i64 36, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !10, i64 72, !10, i64 76, !10, i64 80, !7, i64 84, !7, i64 584, !6, i64 2584, !6, i64 2592, !6, i64 2600, !6, i64 2608, !6, i64 2616, !14, i64 2624, !14, i64 2625, !14, i64 2626}
!13 = !{!"float", !7, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!12, !6, i64 64}
!16 = !{!12, !10, i64 72}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!12, !10, i64 76}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !18}
!23 = !{!12, !6, i64 2584}
!24 = !{!12, !6, i64 2592}
!25 = !{!12, !6, i64 2600}
!26 = !{!12, !6, i64 2608}
!27 = !{!12, !6, i64 2616}
!28 = !{!12, !7, i64 36}
!29 = !{!12, !6, i64 24}
!30 = !{!12, !10, i64 32}


; 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.1 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [42 x i8], align 1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @TCOD_lex_new_intern() local_unnamed_addr #2

; 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 #3

declare i32 @TCOD_set_errorf(ptr noundef, ...) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local ptr @TCOD_lex_new(ptr noundef readonly %0, ptr noundef readonly %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, i32 noundef %7) local_unnamed_addr #2 {
  %9 = tail call ptr @TCOD_lex_new_intern()
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %73, label %10

10:                                               ; preds = %8
  %11 = getelementptr inbounds i8, ptr %9, i64 80
  store i32 %7, ptr %11, align 8, !tbaa !5
  %12 = tail call noalias dereferenceable_or_null(16384) ptr @calloc(i64 noundef 16384, i64 noundef 1) #6
  %13 = getelementptr inbounds i8, ptr %9, i64 64
  store ptr %12, ptr %13, align 8, !tbaa !13
  %.not5663 = icmp eq ptr %0, null
  br i1 %.not5663, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %10
  %14 = getelementptr inbounds i8, ptr %9, i64 84
  %15 = getelementptr inbounds i8, ptr %9, i64 72
  %16 = load ptr, ptr %0, align 8, !tbaa !14
  %.not5780 = icmp eq ptr %16, null
  br i1 %.not5780, label %.critedge, label %.lr.ph82

.lr.ph82:                                         ; preds = %.lr.ph, %22
  %17 = phi ptr [ %30, %22 ], [ %16, %.lr.ph ]
  %.0496481 = phi ptr [ %29, %22 ], [ %0, %.lr.ph ]
  %18 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %17) #7
  %19 = icmp ugt i64 %18, 4
  br i1 %19, label %20, label %22

20:                                               ; preds = %.lr.ph82
  %21 = tail call i32 (ptr, ...) @TCOD_set_errorf(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 96, ptr noundef nonnull %17, i32 noundef 5) #8
  tail call void @TCOD_lex_delete(ptr noundef nonnull %9)
  br label %73

22:                                               ; preds = %.lr.ph82
  %23 = load i32, ptr %15, align 8, !tbaa !15
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [100 x [5 x i8]], ptr %14, i64 0, i64 %24
  %26 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %25, ptr noundef nonnull dereferenceable(1) %17) #8
  %27 = load i32, ptr %15, align 8, !tbaa !15
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %15, align 8, !tbaa !15
  %29 = getelementptr inbounds i8, ptr %.0496481, i64 8
  %30 = load ptr, ptr %29, align 8, !tbaa !14
  %.not57 = icmp eq ptr %30, null
  br i1 %.not57, label %.critedge, label %.lr.ph82

.critedge:                                        ; preds = %22, %.lr.ph, %10
  %.not5869 = icmp eq ptr %1, null
  br i1 %.not5869, label %.critedge2, label %.lr.ph71

.lr.ph71:                                         ; preds = %.critedge
  %31 = getelementptr inbounds i8, ptr %9, i64 584
  %32 = getelementptr inbounds i8, ptr %9, i64 76
  %33 = load ptr, ptr %1, align 8, !tbaa !14
  %.not5983 = icmp eq ptr %33, null
  br i1 %.not5983, label %.critedge2, label %.lr.ph85

.lr.ph85:                                         ; preds = %.lr.ph71, %.loopexit
  %34 = phi ptr [ %63, %.loopexit ], [ %33, %.lr.ph71 ]
  %.0517084 = phi ptr [ %62, %.loopexit ], [ %1, %.lr.ph71 ]
  %35 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %34) #7
  %36 = icmp ugt i64 %35, 19
  br i1 %36, label %37, label %39

37:                                               ; preds = %.lr.ph85
  %38 = tail call i32 (ptr, ...) @TCOD_set_errorf(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 106, ptr noundef nonnull %34, i32 noundef 20) #8
  tail call void @TCOD_lex_delete(ptr noundef nonnull %9)
  br label %73

39:                                               ; preds = %.lr.ph85
  %40 = load i32, ptr %32, align 4, !tbaa !16
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [100 x [20 x i8]], ptr %31, i64 0, i64 %41
  %43 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %42, ptr noundef nonnull dereferenceable(1) %34) #8
  %44 = load i32, ptr %11, align 8, !tbaa !5
  %45 = and i32 %44, 1
  %.not60 = icmp eq i32 %45, 0
  %.pre75 = load i32, ptr %32, align 4, !tbaa !16
  br i1 %.not60, label %.loopexit, label %46

46:                                               ; preds = %39
  %47 = sext i32 %.pre75 to i64
  %48 = getelementptr inbounds [100 x [20 x i8]], ptr %31, i64 0, i64 %47
  %49 = load i8, ptr %48, align 1, !tbaa !17
  %.not6166 = icmp eq i8 %49, 0
  br i1 %.not6166, label %.loopexit, label %.lr.ph68

.lr.ph68:                                         ; preds = %46
  %50 = tail call ptr @__ctype_toupper_loc() #9
  br label %51

51:                                               ; preds = %.lr.ph68, %51
  %52 = phi i8 [ %49, %.lr.ph68 ], [ %59, %51 ]
  %.05067 = phi ptr [ %48, %.lr.ph68 ], [ %58, %51 ]
  %53 = load ptr, ptr %50, align 8, !tbaa !14
  %54 = sext i8 %52 to i64
  %55 = getelementptr inbounds i32, ptr %53, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !18
  %57 = trunc i32 %56 to i8
  store i8 %57, ptr %.05067, align 1, !tbaa !17
  %58 = getelementptr inbounds i8, ptr %.05067, i64 1
  %59 = load i8, ptr %58, align 1, !tbaa !17
  %.not61 = icmp eq i8 %59, 0
  br i1 %.not61, label %.loopexit.loopexit, label %51, !llvm.loop !19

.loopexit.loopexit:                               ; preds = %51
  %.pre = load i32, ptr %32, align 4, !tbaa !16
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %46, %39
  %60 = phi i32 [ %.pre, %.loopexit.loopexit ], [ %.pre75, %46 ], [ %.pre75, %39 ]
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %32, align 4, !tbaa !16
  %62 = getelementptr inbounds i8, ptr %.0517084, i64 8
  %63 = load ptr, ptr %62, align 8, !tbaa !14
  %.not59 = icmp eq ptr %63, null
  br i1 %.not59, label %.critedge2, label %.lr.ph85

.critedge2:                                       ; preds = %.loopexit, %.lr.ph71, %.critedge
  %64 = getelementptr inbounds i8, ptr %9, i64 2584
  store ptr %2, ptr %64, align 8, !tbaa !21
  %65 = getelementptr inbounds i8, ptr %9, i64 2592
  store ptr %3, ptr %65, align 8, !tbaa !22
  %66 = getelementptr inbounds i8, ptr %9, i64 2600
  store ptr %4, ptr %66, align 8, !tbaa !23
  %67 = getelementptr inbounds i8, ptr %9, i64 2608
  store ptr %5, ptr %67, align 8, !tbaa !24
  %68 = getelementptr inbounds i8, ptr %9, i64 2616
  store ptr %6, ptr %68, align 8, !tbaa !25
  %69 = getelementptr inbounds i8, ptr %9, i64 36
  store i8 0, ptr %69, align 4, !tbaa !26
  %70 = tail call noalias dereferenceable_or_null(256) ptr @calloc(i64 noundef 256, i64 noundef 1) #6
  %71 = getelementptr inbounds i8, ptr %9, i64 24
  store ptr %70, ptr %71, align 8, !tbaa !27
  %72 = getelementptr inbounds i8, ptr %9, i64 32
  store i32 256, ptr %72, align 8, !tbaa !28
  br label %73

73:                                               ; preds = %8, %.critedge2, %37, %20
  %.0 = phi ptr [ null, %20 ], [ null, %37 ], [ %9, %.critedge2 ], [ null, %8 ]
  ret ptr %.0
}

; Function Attrs: nounwind uwtable
declare dso_local void @TCOD_lex_delete(ptr noundef) local_unnamed_addr #2

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

attributes #0 = { 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 #1 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 = { 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 #4 = { "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 = { 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 #6 = { nounwind allocsize(0,1) }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { nounwind }
attributes #9 = { 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, !7, i64 80}
!6 = !{!"TCOD_lex_t", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !11, i64 24, !7, i64 32, !8, i64 36, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !7, i64 72, !7, i64 76, !7, i64 80, !8, i64 84, !8, i64 584, !11, i64 2584, !11, i64 2592, !11, i64 2600, !11, i64 2608, !11, i64 2616, !12, i64 2624, !12, i64 2625, !12, i64 2626}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"_Bool", !8, i64 0}
!13 = !{!6, !11, i64 64}
!14 = !{!11, !11, i64 0}
!15 = !{!6, !7, i64 72}
!16 = !{!6, !7, i64 76}
!17 = !{!8, !8, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!6, !11, i64 2584}
!22 = !{!6, !11, i64 2592}
!23 = !{!6, !11, i64 2600}
!24 = !{!6, !11, i64 2608}
!25 = !{!6, !11, i64 2616}
!26 = !{!6, !8, i64 36}
!27 = !{!6, !11, i64 24}
!28 = !{!6, !7, i64 32}


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