#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 check_option(char **);
int /*<<< orphan*/ ft_print_tab(char **, int, int, int);
int /*<<< orphan*/ ft_putchar(char);
scalar_t__ ft_strncmp(char *, char *, int);
int ft_tablen(char **);
void ft_echo(char **tab) {
  int nb;
  int i;
  int opt;
  opt = check_option(tab);
  nb = ft_tablen(tab);
  i = 1;
  while (ft_strncmp(tab[i], "-", 1) == 0)
    i++;
  ft_print_tab(tab, i, nb, opt);
  i = 1;
  if (opt == 2 || opt == 3)
    return;
  ft_putchar('\n');
}


x86 assembly (clang, -O0):
<ft_echo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <check_option@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ft_tablen@plt>
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe72(%rip),%rsi
mov    $0x1,%edx
call   1070 <ft_strncmp@plt>
cmp    $0x0,%rax
jne    11b0 <ft_echo+0x60>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117b <ft_echo+0x2b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1050 <ft_print_tab@plt>
movl   $0x1,-0x10(%rbp)
cmpl   $0x2,-0x14(%rbp)
je     11dd <ft_echo+0x8d>
cmpl   $0x3,-0x14(%rbp)
jne    11e2 <ft_echo+0x92>
jmp    11ec <ft_echo+0x9c>
mov    $0xa,%edi
call   1060 <ft_putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_echo>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%rbx
call   1030 <check_option@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
call   1040 <ft_tablen@plt>
mov    %eax,%r14d
xor    %ebp,%ebp
lea    0xe89(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    0x8(%rbx,%rbp,8),%rdi
mov    %r12,%rsi
mov    $0x1,%edx
call   1070 <ft_strncmp@plt>
add    $0x1,%rbp
test   %rax,%rax
je     1180 <ft_echo+0x30>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %r15d,%ecx
call   1050 <ft_print_tab@plt>
and    $0xfffffffe,%r15d
cmp    $0x2,%r15d
jne    11be <ft_echo+0x6e>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <ft_putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
define void @ft_echo(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8** %0, i8*** %2
%6 = load i8**, i8*** %2
%7 = call i32 @check_option(i8** %6)
store i32 %7, i32* %5
%8 = load i8**, i8*** %2
%9 = call i32 @ft_tablen(i8** %8)
store i32 %9, i32* %3
store i32 1, i32* %4
br label %10
10: ; preds = %18, %1
%11 = load i8**, i8*** %2
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %11, i64 %13
%15 = load i8*, i8** %14
%16 = call i64 @ft_strncmp(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %10
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %10
21: ; preds = %10
%22 = load i8**, i8*** %2
%23 = load i32, i32* %4
%24 = load i32, i32* %3
%25 = load i32, i32* %5
%26 = call i32 @ft_print_tab(i8** %22, i32 %23, i32 %24, i32 %25)
store i32 1, i32* %4
%27 = load i32, i32* %5
%28 = icmp eq i32 %27, 2
br i1 %28, label %32, label %29
29: ; preds = %21
%30 = load i32, i32* %5
%31 = icmp eq i32 %30, 3
br i1 %31, label %32, label %33
32: ; preds = %29, %21
br label %35
33: ; preds = %29
%34 = call i32 @ft_putchar(i8 signext 10)
br label %35
35: ; preds = %33, %32
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
define void @ft_echo(i8** %0) {
%2 = tail call i32 @check_option(i8** %0)
%3 = tail call i32 @ft_tablen(i8** %0)
br label %4
4: ; preds = %4, %1
%5 = phi i64 [ %10, %4 ], [ 1, %1 ]
%6 = getelementptr inbounds i8*, i8** %0, i64 %5
%7 = load i8*, i8** %6
%8 = tail call i64 @ft_strncmp(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%9 = icmp eq i64 %8, 0
%10 = add nuw i64 %5, 1
br i1 %9, label %4, label %11
11: ; preds = %4
%12 = trunc i64 %5 to i32
%13 = tail call i32 @ft_print_tab(i8** %0, i32 %12, i32 %3, i32 %2)
%14 = and i32 %2, -2
%15 = icmp eq i32 %14, 2
br i1 %15, label %18, label %16
16: ; preds = %11
%17 = tail call i32 @ft_putchar(i8 signext 10)
br label %18
18: ; preds = %11, %16
ret void
}