#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
char ft_find_ind(char *, int *);
char ft_find_label(char *, int *, char **);
char ft_find_dir(char *line, int *i, char **file) {
  if (line[*i] == ':') {
    if (ft_find_label(line, i, file) == '0')
      return ('1');
  } else {
    *i = *i + 1;
    if (line[*i] == ':')
      return (ft_find_label(line, i, file));
    else {
      if (ft_find_ind(line, i) == '1')
        return ('0');
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<ft_find_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3a,%eax
jne    1177 <ft_find_dir+0x57>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <ft_find_label@plt>
movsbl %al,%eax
cmp    $0x30,%eax
jne    1172 <ft_find_dir+0x52>
movb   $0x31,-0x1(%rbp)
jmp    11e7 <ft_find_dir+0xc7>
jmp    11e3 <ft_find_dir+0xc3>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3a,%eax
jne    11b7 <ft_find_dir+0x97>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <ft_find_label@plt>
mov    %al,-0x1(%rbp)
jmp    11e7 <ft_find_dir+0xc7>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <ft_find_ind@plt>
movsbl %al,%eax
cmp    $0x31,%eax
jne    11d9 <ft_find_dir+0xb9>
movb   $0x30,-0x1(%rbp)
jmp    11e7 <ft_find_dir+0xc7>
jmp    11de <ft_find_dir+0xbe>
jmp    11e3 <ft_find_dir+0xc3>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_find_dir>:
push   %rax
movslq (%rsi),%rax
cmpb   $0x3a,(%rdi,%rax,1)
jne    113c <ft_find_dir+0x1c>
call   1040 <ft_find_label@plt>
mov    %eax,%ecx
mov    $0x31,%al
cmp    $0x30,%cl
je     113a <ft_find_dir+0x1a>
xor    %eax,%eax
pop    %rcx
ret
lea    0x1(%rax),%rcx
mov    %ecx,(%rsi)
cmpb   $0x3a,0x1(%rdi,%rax,1)
jne    114f <ft_find_dir+0x2f>
pop    %rax
jmp    1040 <ft_find_label@plt>
call   1030 <ft_find_ind@plt>
mov    %eax,%ecx
mov    $0x30,%al
cmp    $0x31,%cl
jne    1138 <ft_find_dir+0x18>
jmp    113a <ft_find_dir+0x1a>

LLVM IR (-O0):
define signext i8 @ft_find_dir(i8* %0, i32* %1, i8** %2) {
%4 = alloca i8
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i8**
store i8* %0, i8** %5
store i32* %1, i32** %6
store i8** %2, i8*** %7
%8 = load i8*, i8** %5
%9 = load i32*, i32** %6
%10 = load i32, i32* %9
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %8, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 58
br i1 %15, label %16, label %25
16: ; preds = %3
%17 = load i8*, i8** %5
%18 = load i32*, i32** %6
%19 = load i8**, i8*** %7
%20 = call signext i8 @ft_find_label(i8* %17, i32* %18, i8** %19)
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 48
br i1 %22, label %23, label %24
23: ; preds = %16
store i8 49, i8* %4
br label %53
24: ; preds = %16
br label %52
25: ; preds = %3
%26 = load i32*, i32** %6
%27 = load i32, i32* %26
%28 = add nsw i32 %27, 1
%29 = load i32*, i32** %6
store i32 %28, i32* %29
%30 = load i8*, i8** %5
%31 = load i32*, i32** %6
%32 = load i32, i32* %31
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %30, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 58
br i1 %37, label %38, label %43
38: ; preds = %25
%39 = load i8*, i8** %5
%40 = load i32*, i32** %6
%41 = load i8**, i8*** %7
%42 = call signext i8 @ft_find_label(i8* %39, i32* %40, i8** %41)
store i8 %42, i8* %4
br label %53
43: ; preds = %25
%44 = load i8*, i8** %5
%45 = load i32*, i32** %6
%46 = call signext i8 @ft_find_ind(i8* %44, i32* %45)
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 49
br i1 %48, label %49, label %50
49: ; preds = %43
store i8 48, i8* %4
br label %53
50: ; preds = %43
br label %51
51: ; preds = %50
br label %52
52: ; preds = %51, %24
store i8 0, i8* %4
br label %53
53: ; preds = %52, %49, %38, %23
%54 = load i8, i8* %4
ret i8 %54
}

LLVM IR (-O2):
define signext i8 @ft_find_dir(i8* %0, i32* %1, i8** %2) {
%4 = load i32, i32* %1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 58
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = tail call signext i8 @ft_find_label(i8* %0, i32* %1, i8** %2)
%11 = icmp eq i8 %10, 48
br i1 %11, label %24, label %23
12: ; preds = %3
%13 = add nsw i32 %4, 1
store i32 %13, i32* %1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 58
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = tail call signext i8 @ft_find_label(i8* %0, i32* %1, i8** %2)
br label %24
20: ; preds = %12
%21 = tail call signext i8 @ft_find_ind(i8* %0, i32* %1)
%22 = icmp eq i8 %21, 49
br i1 %22, label %24, label %23
23: ; preds = %20, %9
br label %24
24: ; preds = %20, %9, %23, %18
%25 = phi i8 [ 0, %23 ], [ %19, %18 ], [ 49, %9 ], [ 48, %20 ]
ret i8 %25
}