#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 */
int arrow(int, char, int /*<<< orphan*/, char **);
int /*<<< orphan*/ ft_strlen(char *);
int distrib_arrow(int i, char **result, char *buffer, int *v) {
  if (*result)
    i = arrow(i, buffer[2], ft_strlen(*result), result);
  else
    i = arrow(i, buffer[2], 0, result);
  if (buffer[2] != 65 && buffer[2] != 66)
    *v = 1;
  return (i);
}


x86 assembly (clang, -O0):
<distrib_arrow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     117d <distrib_arrow+0x5d>
mov    -0x4(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    0x2(%rax),%al
mov    %al,-0x21(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <ft_strlen@plt>
mov    -0x28(%rbp),%edi
mov    %eax,%edx
mov    -0x21(%rbp),%al
mov    -0x10(%rbp),%rcx
movsbl %al,%esi
call   1040 <arrow@plt>
mov    %eax,-0x4(%rbp)
jmp    1198 <distrib_arrow+0x78>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rax
mov    0x2(%rax),%al
mov    -0x10(%rbp),%rcx
xor    %edx,%edx
movsbl %al,%esi
call   1040 <arrow@plt>
mov    %eax,-0x4(%rbp)
mov    -0x18(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x41,%eax
je     11c4 <distrib_arrow+0xa4>
mov    -0x18(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x42,%eax
je     11c4 <distrib_arrow+0xa4>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<distrib_arrow>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %edi,%ebp
mov    (%rsi),%rdi
mov    0x2(%rdx),%r12b
test   %rdi,%rdi
je     1148 <distrib_arrow+0x28>
call   1030 <ft_strlen@plt>
mov    %eax,%edx
jmp    114a <distrib_arrow+0x2a>
xor    %edx,%edx
movsbl %r12b,%esi
mov    %ebp,%edi
mov    %rbx,%rcx
call   1040 <arrow@plt>
mov    0x2(%r15),%cl
add    $0xbf,%cl
cmp    $0x2,%cl
jb     116b <distrib_arrow+0x4b>
movl   $0x1,(%r14)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @distrib_arrow(i32 %0, i8** %1, i8* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i32*
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8* %2, i8** %7
store i32* %3, i32** %8
%9 = load i8**, i8*** %6
%10 = load i8*, i8** %9
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %22
12: ; preds = %4
%13 = load i32, i32* %5
%14 = load i8*, i8** %7
%15 = getelementptr inbounds i8, i8* %14, i64 2
%16 = load i8, i8* %15
%17 = load i8**, i8*** %6
%18 = load i8*, i8** %17
%19 = call i32 @ft_strlen(i8* %18)
%20 = load i8**, i8*** %6
%21 = call i32 @arrow(i32 %13, i8 signext %16, i32 %19, i8** %20)
store i32 %21, i32* %5
br label %29
22: ; preds = %4
%23 = load i32, i32* %5
%24 = load i8*, i8** %7
%25 = getelementptr inbounds i8, i8* %24, i64 2
%26 = load i8, i8* %25
%27 = load i8**, i8*** %6
%28 = call i32 @arrow(i32 %23, i8 signext %26, i32 0, i8** %27)
store i32 %28, i32* %5
br label %29
29: ; preds = %22, %12
%30 = load i8*, i8** %7
%31 = getelementptr inbounds i8, i8* %30, i64 2
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp ne i32 %33, 65
br i1 %34, label %35, label %43
35: ; preds = %29
%36 = load i8*, i8** %7
%37 = getelementptr inbounds i8, i8* %36, i64 2
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp ne i32 %39, 66
br i1 %40, label %41, label %43
41: ; preds = %35
%42 = load i32*, i32** %8
store i32 1, i32* %42
br label %43
43: ; preds = %41, %35, %29
%44 = load i32, i32* %5
ret i32 %44
}

LLVM IR (-O2):
define i32 @distrib_arrow(i32 %0, i8** %1, i8* nocapture %2, i32* nocapture writeonly %3) {
%5 = load i8*, i8** %1
%6 = icmp eq i8* %5, null
%7 = getelementptr inbounds i8, i8* %2, i64 2
%8 = load i8, i8* %7
br i1 %6, label %11, label %9
9: ; preds = %4
%10 = tail call i32 @ft_strlen(i8* %5)
br label %11
11: ; preds = %4, %9
%12 = phi i32 [ %10, %9 ], [ 0, %4 ]
%13 = tail call i32 @arrow(i32 %0, i8 signext %8, i32 %12, i8** %1)
%14 = getelementptr inbounds i8, i8* %2, i64 2
%15 = load i8, i8* %14
%16 = add i8 %15, -65
%17 = icmp ult i8 %16, 2
br i1 %17, label %19, label %18
18: ; preds = %11
store i32 1, i32* %3
br label %19
19: ; preds = %11, %18
ret i32 %13
}