; LLVM IR from yettabaa/cub3D :: Mandatory/parsing (valid_map)

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

; Function Attrs: nounwind uwtable
define dso_local i32 @derection_name(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %6

6:                                                ; preds = %24, %1
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = load i32, ptr %4, align 4, !tbaa !9
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds i8, ptr %7, i64 %9
  %11 = load i8, ptr %10, align 1, !tbaa !11
  %12 = sext i8 %11 to i32
  %13 = icmp ne i32 %12, 0
  br i1 %13, label %14, label %22

14:                                               ; preds = %6
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = load i32, ptr %4, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds i8, ptr %15, i64 %17
  %19 = load i8, ptr %18, align 1, !tbaa !11
  %20 = sext i8 %19 to i32
  %21 = icmp eq i32 %20, 32
  br label %22

22:                                               ; preds = %14, %6
  %23 = phi i1 [ false, %6 ], [ %21, %14 ]
  br i1 %23, label %24, label %27

24:                                               ; preds = %22
  %25 = load i32, ptr %4, align 4, !tbaa !9
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %4, align 4, !tbaa !9
  br label %6, !llvm.loop !12

27:                                               ; preds = %22
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = load i32, ptr %4, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds i8, ptr %28, i64 %30
  %32 = call i32 @ft_strncmp(ptr noundef %31, ptr noundef @.str, i64 noundef 3)
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %35, label %34

34:                                               ; preds = %27
  store i32 15, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %76

35:                                               ; preds = %27
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = load i32, ptr %4, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds i8, ptr %36, i64 %38
  %40 = call i32 @ft_strncmp(ptr noundef %39, ptr noundef @.str.1, i64 noundef 3)
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %43, label %42

42:                                               ; preds = %35
  store i32 16, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %76

43:                                               ; preds = %35
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = load i32, ptr %4, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds i8, ptr %44, i64 %46
  %48 = call i32 @ft_strncmp(ptr noundef %47, ptr noundef @.str.2, i64 noundef 3)
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %51, label %50

50:                                               ; preds = %43
  store i32 17, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %76

51:                                               ; preds = %43
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = load i32, ptr %4, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i8, ptr %52, i64 %54
  %56 = call i32 @ft_strncmp(ptr noundef %55, ptr noundef @.str.3, i64 noundef 3)
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %59, label %58

58:                                               ; preds = %51
  store i32 18, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %76

59:                                               ; preds = %51
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = load i32, ptr %4, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds i8, ptr %60, i64 %62
  %64 = call i32 @ft_strncmp(ptr noundef %63, ptr noundef @.str.4, i64 noundef 2)
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %67, label %66

66:                                               ; preds = %59
  store i32 21, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %76

67:                                               ; preds = %59
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = load i32, ptr %4, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds i8, ptr %68, i64 %70
  %72 = call i32 @ft_strncmp(ptr noundef %71, ptr noundef @.str.5, i64 noundef 2)
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %75, label %74

74:                                               ; preds = %67
  store i32 20, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %76

75:                                               ; preds = %67
  store i32 0, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %76

76:                                               ; preds = %75, %74, %66, %58, %50, %42, %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  %77 = load i32, ptr %2, align 4
  ret i32 %77
}

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

declare i32 @ft_strncmp(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 }

!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 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 22) i32 @derection_name(ptr noundef %0) local_unnamed_addr #0 {
  br label %2

2:                                                ; preds = %2, %1
  %indvars.iv = phi i64 [ %indvars.iv.next, %2 ], [ 0, %1 ]
  %3 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv
  %4 = load i8, ptr %3, align 1, !tbaa !5
  %cond = icmp eq i8 %4, 32
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  br i1 %cond, label %2, label %.critedge, !llvm.loop !8

.critedge:                                        ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv
  %6 = tail call i32 @ft_strncmp(ptr noundef nonnull %5, ptr noundef nonnull @.str, i64 noundef 3) #2
  %.not19 = icmp eq i32 %6, 0
  br i1 %.not19, label %17, label %7

7:                                                ; preds = %.critedge
  %8 = tail call i32 @ft_strncmp(ptr noundef nonnull %5, ptr noundef nonnull @.str.1, i64 noundef 3) #2
  %.not20 = icmp eq i32 %8, 0
  br i1 %.not20, label %17, label %9

9:                                                ; preds = %7
  %10 = tail call i32 @ft_strncmp(ptr noundef nonnull %5, ptr noundef nonnull @.str.2, i64 noundef 3) #2
  %.not21 = icmp eq i32 %10, 0
  br i1 %.not21, label %17, label %11

11:                                               ; preds = %9
  %12 = tail call i32 @ft_strncmp(ptr noundef nonnull %5, ptr noundef nonnull @.str.3, i64 noundef 3) #2
  %.not22 = icmp eq i32 %12, 0
  br i1 %.not22, label %17, label %13

13:                                               ; preds = %11
  %14 = tail call i32 @ft_strncmp(ptr noundef nonnull %5, ptr noundef nonnull @.str.4, i64 noundef 2) #2
  %.not23 = icmp eq i32 %14, 0
  br i1 %.not23, label %17, label %15

15:                                               ; preds = %13
  %16 = tail call i32 @ft_strncmp(ptr noundef nonnull %5, ptr noundef nonnull @.str.5, i64 noundef 2) #2
  %.not24 = icmp eq i32 %16, 0
  %. = select i1 %.not24, i32 20, i32 0
  br label %17

17:                                               ; preds = %15, %13, %11, %9, %7, %.critedge
  %.017 = phi i32 [ 15, %.critedge ], [ 16, %7 ], [ 17, %9 ], [ 18, %11 ], [ 21, %13 ], [ %., %15 ]
  ret i32 %.017
}

declare i32 @ft_strncmp(ptr noundef, 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 = { nounwind }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


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