; LLVM IR from libtcod/libtcod :: src/libtcod (parser_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_ColorRGB = type { i8, i8, i8 }
%union.TCOD_value_t = type { ptr, [8 x i8] }
%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 }

@lex = external hidden global ptr, align 8
@__const.TCOD_parse_color_value.ret = external hidden unnamed_addr constant { %struct.TCOD_ColorRGB, [13 x i8] }, align 8
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [74 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @TCOD_parser_error(ptr noundef, ...) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

declare i32 @TCOD_lex_parse(ptr noundef) #3

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

; Function Attrs: nounwind
declare ptr @strcat(ptr noundef, ptr noundef) #5

; Function Attrs: nounwind uwtable
define dso_local { ptr, double } @TCOD_parse_color_value() #0 {
  %1 = alloca %union.TCOD_value_t, align 8
  %2 = alloca [128 x i8], align 16
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %1, ptr align 8 @__const.TCOD_parse_color_value.ret, i64 16, i1 false)
  %10 = load ptr, ptr @lex, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.TCOD_lex_t, ptr %10, i32 0, i32 1
  %12 = load i32, ptr %11, align 4, !tbaa !9
  %13 = icmp eq i32 %12, 1
  br i1 %13, label %14, label %72

14:                                               ; preds = %0
  %15 = load ptr, ptr @lex, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.TCOD_lex_t, ptr %15, i32 0, i32 5
  %17 = load ptr, ptr %16, align 8, !tbaa !14
  %18 = getelementptr inbounds i8, ptr %17, i64 0
  %19 = load i8, ptr %18, align 1, !tbaa !15
  %20 = sext i8 %19 to i32
  %21 = icmp eq i32 %20, 35
  br i1 %21, label %22, label %72

22:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 128, ptr %2) #8
  call void @llvm.memset.p0.i64(ptr align 16 %2, i8 0, i64 128, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  %23 = load ptr, ptr @lex, align 8, !tbaa !5
  %24 = call i32 @TCOD_lex_parse(ptr noundef %23)
  store i32 %24, ptr %3, align 4, !tbaa !16
  %25 = getelementptr inbounds [128 x i8], ptr %2, i64 0, i64 0
  %26 = call ptr @strcat(ptr noundef %25, ptr noundef @.str.9) #8
  %27 = load i32, ptr %3, align 4, !tbaa !16
  %28 = icmp eq i32 %27, 3
  br i1 %28, label %32, label %29

29:                                               ; preds = %22
  %30 = load i32, ptr %3, align 4, !tbaa !16
  %31 = icmp eq i32 %30, 5
  br i1 %31, label %32, label %71

32:                                               ; preds = %29, %22
  %33 = getelementptr inbounds [128 x i8], ptr %2, i64 0, i64 0
  %34 = load ptr, ptr @lex, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.TCOD_lex_t, ptr %34, i32 0, i32 5
  %36 = load ptr, ptr %35, align 8, !tbaa !14
  %37 = call ptr @strcat(ptr noundef %33, ptr noundef %36) #8
  %38 = load ptr, ptr @lex, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.TCOD_lex_t, ptr %38, i32 0, i32 5
  %40 = load ptr, ptr %39, align 8, !tbaa !14
  %41 = getelementptr inbounds [128 x i8], ptr %2, i64 0, i64 0
  %42 = call ptr @strcpy(ptr noundef %40, ptr noundef %41) #8
  %43 = load ptr, ptr @lex, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.TCOD_lex_t, ptr %43, i32 0, i32 5
  %45 = load ptr, ptr %44, align 8, !tbaa !14
  %46 = call i64 @strlen(ptr noundef %45) #9
  %47 = icmp ult i64 %46, 7
  br i1 %47, label %48, label %68

48:                                               ; preds = %32
  %49 = load i32, ptr %3, align 4, !tbaa !16
  %50 = icmp eq i32 %49, 5
  br i1 %50, label %51, label %68

51:                                               ; preds = %48
  %52 = load ptr, ptr @lex, align 8, !tbaa !5
  %53 = call i32 @TCOD_lex_parse(ptr noundef %52)
  store i32 %53, ptr %3, align 4, !tbaa !16
  %54 = load i32, ptr %3, align 4, !tbaa !16
  %55 = icmp eq i32 %54, 3
  br i1 %55, label %56, label %67

56:                                               ; preds = %51
  %57 = getelementptr inbounds [128 x i8], ptr %2, i64 0, i64 0
  %58 = load ptr, ptr @lex, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.TCOD_lex_t, ptr %58, i32 0, i32 5
  %60 = load ptr, ptr %59, align 8, !tbaa !14
  %61 = call ptr @strcat(ptr noundef %57, ptr noundef %60) #8
  %62 = load ptr, ptr @lex, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.TCOD_lex_t, ptr %62, i32 0, i32 5
  %64 = load ptr, ptr %63, align 8, !tbaa !14
  %65 = getelementptr inbounds [128 x i8], ptr %2, i64 0, i64 0
  %66 = call ptr @strcpy(ptr noundef %64, ptr noundef %65) #8
  br label %67

67:                                               ; preds = %56, %51
  br label %68

68:                                               ; preds = %67, %48, %32
  %69 = load ptr, ptr @lex, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.TCOD_lex_t, ptr %69, i32 0, i32 1
  store i32 4, ptr %70, align 4, !tbaa !9
  br label %71

71:                                               ; preds = %68, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 128, ptr %2) #8
  br label %72

72:                                               ; preds = %71, %14, %0
  %73 = load ptr, ptr @lex, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.TCOD_lex_t, ptr %73, i32 0, i32 1
  %75 = load i32, ptr %74, align 4, !tbaa !9
  %76 = icmp ne i32 %75, 4
  br i1 %76, label %77, label %81

77:                                               ; preds = %72
  %78 = load ptr, ptr @lex, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.TCOD_lex_t, ptr %78, i32 0, i32 5
  %80 = load ptr, ptr %79, align 8, !tbaa !14
  call void (ptr, ...) @TCOD_parser_error(ptr noundef @.str.10, ptr noundef %80)
  br label %81

81:                                               ; preds = %77, %72
  %82 = load ptr, ptr @lex, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.TCOD_lex_t, ptr %82, i32 0, i32 5
  %84 = load ptr, ptr %83, align 8, !tbaa !14
  %85 = getelementptr inbounds i8, ptr %84, i64 0
  %86 = load i8, ptr %85, align 1, !tbaa !15
  %87 = sext i8 %86 to i32
  %88 = icmp eq i32 %87, 35
  br i1 %88, label %89, label %151

89:                                               ; preds = %81
  %90 = load ptr, ptr @lex, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.TCOD_lex_t, ptr %90, i32 0, i32 5
  %92 = load ptr, ptr %91, align 8, !tbaa !14
  %93 = call i64 @strlen(ptr noundef %92) #9
  %94 = icmp ne i64 %93, 7
  br i1 %94, label %95, label %99

95:                                               ; preds = %89
  %96 = load ptr, ptr @lex, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.TCOD_lex_t, ptr %96, i32 0, i32 5
  %98 = load ptr, ptr %97, align 8, !tbaa !14
  call void (ptr, ...) @TCOD_parser_error(ptr noundef @.str.11, ptr noundef %98)
  br label %99

99:                                               ; preds = %95, %89
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  %100 = load ptr, ptr @lex, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.TCOD_lex_t, ptr %100, i32 0, i32 5
  %102 = load ptr, ptr %101, align 8, !tbaa !14
  %103 = getelementptr inbounds i8, ptr %102, i64 1
  %104 = load i8, ptr %103, align 1, !tbaa !15
  %105 = call i32 @TCOD_lex_hextoint(i8 noundef signext %104)
  %106 = shl i32 %105, 4
  %107 = load ptr, ptr @lex, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.TCOD_lex_t, ptr %107, i32 0, i32 5
  %109 = load ptr, ptr %108, align 8, !tbaa !14
  %110 = getelementptr inbounds i8, ptr %109, i64 2
  %111 = load i8, ptr %110, align 1, !tbaa !15
  %112 = call i32 @TCOD_lex_hextoint(i8 noundef signext %111)
  %113 = add nsw i32 %106, %112
  store i32 %113, ptr %4, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  %114 = load ptr, ptr @lex, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.TCOD_lex_t, ptr %114, i32 0, i32 5
  %116 = load ptr, ptr %115, align 8, !tbaa !14
  %117 = getelementptr inbounds i8, ptr %116, i64 3
  %118 = load i8, ptr %117, align 1, !tbaa !15
  %119 = call i32 @TCOD_lex_hextoint(i8 noundef signext %118)
  %120 = shl i32 %119, 4
  %121 = load ptr, ptr @lex, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.TCOD_lex_t, ptr %121, i32 0, i32 5
  %123 = load ptr, ptr %122, align 8, !tbaa !14
  %124 = getelementptr inbounds i8, ptr %123, i64 4
  %125 = load i8, ptr %124, align 1, !tbaa !15
  %126 = call i32 @TCOD_lex_hextoint(i8 noundef signext %125)
  %127 = add nsw i32 %120, %126
  store i32 %127, ptr %5, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  %128 = load ptr, ptr @lex, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.TCOD_lex_t, ptr %128, i32 0, i32 5
  %130 = load ptr, ptr %129, align 8, !tbaa !14
  %131 = getelementptr inbounds i8, ptr %130, i64 5
  %132 = load i8, ptr %131, align 1, !tbaa !15
  %133 = call i32 @TCOD_lex_hextoint(i8 noundef signext %132)
  %134 = shl i32 %133, 4
  %135 = load ptr, ptr @lex, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.TCOD_lex_t, ptr %135, i32 0, i32 5
  %137 = load ptr, ptr %136, align 8, !tbaa !14
  %138 = getelementptr inbounds i8, ptr %137, i64 6
  %139 = load i8, ptr %138, align 1, !tbaa !15
  %140 = call i32 @TCOD_lex_hextoint(i8 noundef signext %139)
  %141 = add nsw i32 %134, %140
  store i32 %141, ptr %6, align 4, !tbaa !16
  %142 = load i32, ptr %4, align 4, !tbaa !16
  %143 = trunc i32 %142 to i8
  %144 = getelementptr inbounds %struct.TCOD_ColorRGB, ptr %1, i32 0, i32 0
  store i8 %143, ptr %144, align 8, !tbaa !15
  %145 = load i32, ptr %5, align 4, !tbaa !16
  %146 = trunc i32 %145 to i8
  %147 = getelementptr inbounds %struct.TCOD_ColorRGB, ptr %1, i32 0, i32 1
  store i8 %146, ptr %147, align 1, !tbaa !15
  %148 = load i32, ptr %6, align 4, !tbaa !16
  %149 = trunc i32 %148 to i8
  %150 = getelementptr inbounds %struct.TCOD_ColorRGB, ptr %1, i32 0, i32 2
  store i8 %149, ptr %150, align 2, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %193

151:                                              ; preds = %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %152 = load ptr, ptr @lex, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.TCOD_lex_t, ptr %152, i32 0, i32 5
  %154 = load ptr, ptr %153, align 8, !tbaa !14
  store ptr %154, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %155 = load ptr, ptr %7, align 8, !tbaa !5
  %156 = call ptr @strchr(ptr noundef %155, i32 noundef 44) #9
  store ptr %156, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #8
  store i8 1, ptr %9, align 1, !tbaa !17
  %157 = load ptr, ptr %8, align 8, !tbaa !5
  %158 = icmp ne ptr %157, null
  br i1 %158, label %160, label %159

159:                                              ; preds = %151
  store i8 0, ptr %9, align 1, !tbaa !17
  br label %185

160:                                              ; preds = %151
  %161 = load ptr, ptr %8, align 8, !tbaa !5
  store i8 0, ptr %161, align 1, !tbaa !15
  %162 = load ptr, ptr %7, align 8, !tbaa !5
  %163 = call i32 @atoi(ptr noundef %162) #9
  %164 = trunc i32 %163 to i8
  %165 = getelementptr inbounds %struct.TCOD_ColorRGB, ptr %1, i32 0, i32 0
  store i8 %164, ptr %165, align 8, !tbaa !15
  %166 = load ptr, ptr %8, align 8, !tbaa !5
  %167 = getelementptr inbounds i8, ptr %166, i64 1
  store ptr %167, ptr %7, align 8, !tbaa !5
  %168 = load ptr, ptr %7, align 8, !tbaa !5
  %169 = call ptr @strchr(ptr noundef %168, i32 noundef 44) #9
  store ptr %169, ptr %8, align 8, !tbaa !5
  %170 = load ptr, ptr %8, align 8, !tbaa !5
  %171 = icmp ne ptr %170, null
  br i1 %171, label %173, label %172

172:                                              ; preds = %160
  store i8 0, ptr %9, align 1, !tbaa !17
  br label %184

173:                                              ; preds = %160
  %174 = load ptr, ptr %7, align 8, !tbaa !5
  %175 = call i32 @atoi(ptr noundef %174) #9
  %176 = trunc i32 %175 to i8
  %177 = getelementptr inbounds %struct.TCOD_ColorRGB, ptr %1, i32 0, i32 1
  store i8 %176, ptr %177, align 1, !tbaa !15
  %178 = load ptr, ptr %8, align 8, !tbaa !5
  %179 = getelementptr inbounds i8, ptr %178, i64 1
  store ptr %179, ptr %7, align 8, !tbaa !5
  %180 = load ptr, ptr %7, align 8, !tbaa !5
  %181 = call i32 @atoi(ptr noundef %180) #9
  %182 = trunc i32 %181 to i8
  %183 = getelementptr inbounds %struct.TCOD_ColorRGB, ptr %1, i32 0, i32 2
  store i8 %182, ptr %183, align 2, !tbaa !15
  br label %184

184:                                              ; preds = %173, %172
  br label %185

185:                                              ; preds = %184, %159
  %186 = load i8, ptr %9, align 1, !tbaa !17, !range !18, !noundef !19
  %187 = trunc i8 %186 to i1
  br i1 %187, label %192, label %188

188:                                              ; preds = %185
  %189 = load ptr, ptr @lex, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.TCOD_lex_t, ptr %189, i32 0, i32 5
  %191 = load ptr, ptr %190, align 8, !tbaa !14
  call void (ptr, ...) @TCOD_parser_error(ptr noundef @.str.12, ptr noundef %191)
  br label %192

192:                                              ; preds = %188, %185
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  br label %193

193:                                              ; preds = %192, %99
  %194 = load { ptr, double }, ptr %1, align 8
  ret { ptr, double } %194
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

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

declare i32 @TCOD_lex_hextoint(i8 noundef signext) #3

; Function Attrs: nounwind willreturn memory(read)
declare ptr @strchr(ptr noundef, i32 noundef) #4

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #7

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { "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) "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 = { 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { inlinehint nounwind willreturn memory(read) 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 #8 = { nounwind }
attributes #9 = { 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, !11, i64 4}
!10 = !{!"TCOD_lex_t", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !12, i64 16, !6, i64 24, !11, i64 32, !7, i64 36, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !11, i64 72, !11, i64 76, !11, i64 80, !7, i64 84, !7, i64 584, !6, i64 2584, !6, i64 2592, !6, i64 2600, !6, i64 2608, !6, i64 2616, !13, i64 2624, !13, i64 2625, !13, i64 2626}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!10, !6, i64 24}
!15 = !{!7, !7, i64 0}
!16 = !{!11, !11, i64 0}
!17 = !{!13, !13, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}


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

%struct.TCOD_ColorRGB = type { i8, i8, i8 }

@lex = external hidden local_unnamed_addr global ptr, align 8
@__const.TCOD_parse_color_value.ret = external hidden unnamed_addr constant { %struct.TCOD_ColorRGB, [13 x i8] }, align 8
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [74 x i8], align 1

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

declare i32 @TCOD_lex_parse(ptr noundef) local_unnamed_addr #3

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

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

; Function Attrs: nounwind uwtable
define dso_local { ptr, double } @TCOD_parse_color_value() local_unnamed_addr #0 {
  %1 = alloca [128 x i8], align 16
  %.sroa.0.0.copyload = load ptr, ptr @__const.TCOD_parse_color_value.ret, align 8
  %.sroa.8.0.copyload = load double, ptr getelementptr inbounds (i8, ptr @__const.TCOD_parse_color_value.ret, i64 8), align 8
  %2 = load ptr, ptr @lex, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %2, i64 4
  %4 = load i32, ptr %3, align 4, !tbaa !9
  %5 = icmp eq i32 %4, 1
  br i1 %5, label %6, label %40

6:                                                ; preds = %0
  %7 = getelementptr inbounds i8, ptr %2, i64 24
  %8 = load ptr, ptr %7, align 8, !tbaa !14
  %9 = load i8, ptr %8, align 1, !tbaa !15
  %10 = icmp eq i8 %9, 35
  br i1 %10, label %11, label %.thread

11:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %1) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(128) %1, i8 0, i64 128, i1 false)
  %12 = tail call i32 @TCOD_lex_parse(ptr noundef nonnull %2) #7
  %13 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @.str.9) #7
  switch i32 %12, label %._crit_edge [
    i32 5, label %14
    i32 3, label %14
  ]

._crit_edge:                                      ; preds = %11
  %.pre45.pre = load ptr, ptr @lex, align 8, !tbaa !5
  br label %39

14:                                               ; preds = %11, %11
  %15 = icmp eq i32 %12, 5
  %16 = load ptr, ptr @lex, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %16, i64 24
  %18 = load ptr, ptr %17, align 8, !tbaa !14
  %19 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %18) #7
  %20 = load ptr, ptr %17, align 8, !tbaa !14
  %21 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %20, ptr noundef nonnull dereferenceable(1) %1) #7
  %22 = load ptr, ptr @lex, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %22, i64 24
  %24 = load ptr, ptr %23, align 8, !tbaa !14
  %25 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %24) #8
  %26 = icmp ult i64 %25, 7
  %or.cond3 = and i1 %15, %26
  br i1 %or.cond3, label %27, label %36

27:                                               ; preds = %14
  %28 = call i32 @TCOD_lex_parse(ptr noundef nonnull %22) #7
  %29 = icmp eq i32 %28, 3
  %.pre44 = load ptr, ptr @lex, align 8, !tbaa !5
  br i1 %29, label %30, label %36

30:                                               ; preds = %27
  %31 = getelementptr inbounds i8, ptr %.pre44, i64 24
  %32 = load ptr, ptr %31, align 8, !tbaa !14
  %33 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %32) #7
  %34 = load ptr, ptr %31, align 8, !tbaa !14
  %35 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %34, ptr noundef nonnull dereferenceable(1) %1) #7
  %.pre = load ptr, ptr @lex, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %27, %30, %14
  %37 = phi ptr [ %.pre44, %27 ], [ %.pre, %30 ], [ %22, %14 ]
  %38 = getelementptr inbounds i8, ptr %37, i64 4
  store i32 4, ptr %38, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %._crit_edge, %36
  %.pre45 = phi ptr [ %.pre45.pre, %._crit_edge ], [ %37, %36 ]
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %1) #7
  %.phi.trans.insert = getelementptr inbounds i8, ptr %.pre45, i64 4
  %.pre46 = load i32, ptr %.phi.trans.insert, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %39, %0
  %41 = phi i32 [ %.pre46, %39 ], [ %4, %0 ]
  %42 = phi ptr [ %.pre45, %39 ], [ %2, %0 ]
  %.not = icmp eq i32 %41, 4
  br i1 %.not, label %46, label %.thread

.thread:                                          ; preds = %6, %40
  %43 = phi ptr [ %42, %40 ], [ %2, %6 ]
  %44 = getelementptr inbounds i8, ptr %43, i64 24
  %45 = load ptr, ptr %44, align 8, !tbaa !14
  call void (ptr, ...) @TCOD_parser_error(ptr noundef nonnull @.str.10, ptr noundef %45)
  %.pre47 = load ptr, ptr @lex, align 8, !tbaa !5
  br label %46

46:                                               ; preds = %.thread, %40
  %47 = phi ptr [ %.pre47, %.thread ], [ %42, %40 ]
  %48 = getelementptr inbounds i8, ptr %47, i64 24
  %49 = load ptr, ptr %48, align 8, !tbaa !14
  %50 = load i8, ptr %49, align 1, !tbaa !15
  %51 = icmp eq i8 %50, 35
  br i1 %51, label %52, label %103

52:                                               ; preds = %46
  %53 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %49) #8
  %.not40 = icmp eq i64 %53, 7
  br i1 %.not40, label %55, label %54

54:                                               ; preds = %52
  call void (ptr, ...) @TCOD_parser_error(ptr noundef nonnull @.str.11, ptr noundef nonnull %49)
  %.pre51 = load ptr, ptr @lex, align 8, !tbaa !5
  %.phi.trans.insert52 = getelementptr inbounds i8, ptr %.pre51, i64 24
  %.pre53 = load ptr, ptr %.phi.trans.insert52, align 8, !tbaa !14
  br label %55

55:                                               ; preds = %54, %52
  %56 = phi ptr [ %.pre53, %54 ], [ %49, %52 ]
  %57 = getelementptr inbounds i8, ptr %56, i64 1
  %58 = load i8, ptr %57, align 1, !tbaa !15
  %59 = call i32 @TCOD_lex_hextoint(i8 noundef signext %58) #7
  %60 = shl i32 %59, 4
  %61 = load ptr, ptr @lex, align 8, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %61, i64 24
  %63 = load ptr, ptr %62, align 8, !tbaa !14
  %64 = getelementptr inbounds i8, ptr %63, i64 2
  %65 = load i8, ptr %64, align 1, !tbaa !15
  %66 = call i32 @TCOD_lex_hextoint(i8 noundef signext %65) #7
  %67 = add nsw i32 %66, %60
  %68 = load ptr, ptr @lex, align 8, !tbaa !5
  %69 = getelementptr inbounds i8, ptr %68, i64 24
  %70 = load ptr, ptr %69, align 8, !tbaa !14
  %71 = getelementptr inbounds i8, ptr %70, i64 3
  %72 = load i8, ptr %71, align 1, !tbaa !15
  %73 = call i32 @TCOD_lex_hextoint(i8 noundef signext %72) #7
  %74 = load ptr, ptr @lex, align 8, !tbaa !5
  %75 = getelementptr inbounds i8, ptr %74, i64 24
  %76 = load ptr, ptr %75, align 8, !tbaa !14
  %77 = getelementptr inbounds i8, ptr %76, i64 4
  %78 = load i8, ptr %77, align 1, !tbaa !15
  %79 = call i32 @TCOD_lex_hextoint(i8 noundef signext %78) #7
  %80 = load ptr, ptr @lex, align 8, !tbaa !5
  %81 = getelementptr inbounds i8, ptr %80, i64 24
  %82 = load ptr, ptr %81, align 8, !tbaa !14
  %83 = getelementptr inbounds i8, ptr %82, i64 5
  %84 = load i8, ptr %83, align 1, !tbaa !15
  %85 = call i32 @TCOD_lex_hextoint(i8 noundef signext %84) #7
  %86 = load ptr, ptr @lex, align 8, !tbaa !5
  %87 = getelementptr inbounds i8, ptr %86, i64 24
  %88 = load ptr, ptr %87, align 8, !tbaa !14
  %89 = getelementptr inbounds i8, ptr %88, i64 6
  %90 = load i8, ptr %89, align 1, !tbaa !15
  %91 = call i32 @TCOD_lex_hextoint(i8 noundef signext %90) #7
  %92 = ptrtoint ptr %.sroa.0.0.copyload to i64
  %93 = and i32 %67, 255
  %.sroa.0.0.insert.ext = zext nneg i32 %93 to i64
  %.sroa.0.0.insert.mask = and i64 %92, -16777216
  %.sroa.0.0.insert.insert = or disjoint i64 %.sroa.0.0.insert.mask, %.sroa.0.0.insert.ext
  %94 = shl i32 %73, 12
  %95 = shl i32 %79, 8
  %96 = add i32 %95, %94
  %97 = and i32 %96, 65280
  %.sroa.0.1.insert.shift = zext nneg i32 %97 to i64
  %.sroa.0.1.insert.insert = or disjoint i64 %.sroa.0.0.insert.insert, %.sroa.0.1.insert.shift
  %98 = shl i32 %85, 20
  %99 = shl i32 %91, 16
  %100 = add i32 %99, %98
  %101 = and i32 %100, 16711680
  %.sroa.0.2.insert.shift = zext nneg i32 %101 to i64
  %.sroa.0.2.insert.insert = or disjoint i64 %.sroa.0.1.insert.insert, %.sroa.0.2.insert.shift
  %102 = inttoptr i64 %.sroa.0.2.insert.insert to ptr
  br label %124

103:                                              ; preds = %46
  %104 = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %49, i32 noundef 44) #8
  %.not38 = icmp eq ptr %104, null
  br i1 %.not38, label %122, label %105

105:                                              ; preds = %103
  store i8 0, ptr %104, align 1, !tbaa !15
  %106 = call i32 @atoi(ptr nocapture noundef %49) #8
  %107 = ptrtoint ptr %.sroa.0.0.copyload to i64
  %108 = and i32 %106, 255
  %.sroa.0.0.insert.ext23 = zext nneg i32 %108 to i64
  %.sroa.0.0.insert.mask24 = and i64 %107, -256
  %.sroa.0.0.insert.insert25 = or disjoint i64 %.sroa.0.0.insert.mask24, %.sroa.0.0.insert.ext23
  %109 = getelementptr inbounds i8, ptr %104, i64 1
  %110 = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %109, i32 noundef 44) #8
  %.not39 = icmp eq ptr %110, null
  br i1 %.not39, label %111, label %113

111:                                              ; preds = %105
  %112 = inttoptr i64 %.sroa.0.0.insert.insert25 to ptr
  %.pre48 = load ptr, ptr @lex, align 8, !tbaa !5
  %.phi.trans.insert49 = getelementptr inbounds i8, ptr %.pre48, i64 24
  %.pre50 = load ptr, ptr %.phi.trans.insert49, align 8, !tbaa !14
  br label %122

113:                                              ; preds = %105
  %114 = call i32 @atoi(ptr nocapture noundef %109) #8
  %115 = shl i32 %114, 8
  %116 = and i32 %115, 65280
  %.sroa.0.1.insert.shift28 = zext nneg i32 %116 to i64
  %.sroa.0.1.insert.mask29 = and i64 %.sroa.0.0.insert.insert25, -16776961
  %.sroa.0.1.insert.insert30 = or disjoint i64 %.sroa.0.1.insert.mask29, %.sroa.0.1.insert.shift28
  %117 = getelementptr inbounds i8, ptr %110, i64 1
  %118 = call i32 @atoi(ptr nocapture noundef %117) #8
  %119 = shl i32 %118, 16
  %120 = and i32 %119, 16711680
  %.sroa.0.2.insert.shift33 = zext nneg i32 %120 to i64
  %.sroa.0.2.insert.insert35 = or disjoint i64 %.sroa.0.1.insert.insert30, %.sroa.0.2.insert.shift33
  %121 = inttoptr i64 %.sroa.0.2.insert.insert35 to ptr
  br label %124

122:                                              ; preds = %111, %103
  %123 = phi ptr [ %49, %103 ], [ %.pre50, %111 ]
  %.sroa.0.0.ph = phi ptr [ %.sroa.0.0.copyload, %103 ], [ %112, %111 ]
  call void (ptr, ...) @TCOD_parser_error(ptr noundef nonnull @.str.12, ptr noundef %123)
  br label %124

124:                                              ; preds = %113, %122, %55
  %.sroa.0.1 = phi ptr [ %102, %55 ], [ %.sroa.0.0.ph, %122 ], [ %121, %113 ]
  %.fca.0.insert = insertvalue { ptr, double } poison, ptr %.sroa.0.1, 0
  %.fca.1.insert = insertvalue { ptr, double } %.fca.0.insert, double %.sroa.8.0.copyload, 1
  ret { ptr, double } %.fca.1.insert
}

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

declare i32 @TCOD_lex_hextoint(i8 noundef signext) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strchr(ptr noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #6

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { "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 = { 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 #5 = { 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 #6 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 #7 = { nounwind }
attributes #8 = { 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, !11, i64 4}
!10 = !{!"TCOD_lex_t", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !12, i64 16, !6, i64 24, !11, i64 32, !7, i64 36, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !11, i64 72, !11, i64 76, !11, i64 80, !7, i64 84, !7, i64 584, !6, i64 2584, !6, i64 2592, !6, i64 2600, !6, i64 2608, !6, i64 2616, !13, i64 2624, !13, i64 2625, !13, i64 2626}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!10, !6, i64 24}
!15 = !{!7, !7, i64 0}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass