#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 /*<<< orphan*/ ft_ech_check(char);
int /*<<< orphan*/ ft_ech_choice_select(char **, unsigned char *,
                                        unsigned char *, unsigned char *);
unsigned char ft_ech_choice(char *(**arg)) {
  char *option;
  unsigned char option_e;
  unsigned char option_E;
  unsigned char option_n;
  option_e = 0;
  option_E = 0;
  option_n = 0;
  while (*++(*arg) && **(*arg) == '-') {
    option = (1 + *(*arg));
    while (*option) {
      if (!(ft_ech_check(*option)))
        break;
      (void)ft_ech_choice_select(&option, &option_e, &option_E, &option_n);
    }
    if (*option)
      break;
  }
  return ((option_e - option_E) + option_n);
}


x86 assembly (clang, -O0):
<ft_ech_choice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x11(%rbp)
movb   $0x0,-0x12(%rbp)
movb   $0x0,-0x13(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
mov    %rcx,%rdx
add    $0x8,%rdx
mov    %rdx,(%rax)
xor    %eax,%eax
cmpq   $0x0,0x8(%rcx)
mov    %al,-0x14(%rbp)
je     116f <ft_ech_choice+0x4f>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
sete   %al
mov    %al,-0x14(%rbp)
mov    -0x14(%rbp),%al
test   $0x1,%al
jne    117f <ft_ech_choice+0x5f>
jmp    11e9 <ft_ech_choice+0xc9>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11d2 <ft_ech_choice+0xb2>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <ft_ech_check@plt>
cmp    $0x0,%eax
jne    11b8 <ft_ech_choice+0x98>
jmp    11d2 <ft_ech_choice+0xb2>
lea    -0x10(%rbp),%rdi
lea    -0x11(%rbp),%rsi
lea    -0x12(%rbp),%rdx
lea    -0x13(%rbp),%rcx
call   1040 <ft_ech_choice_select@plt>
jmp    1191 <ft_ech_choice+0x71>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11e4 <ft_ech_choice+0xc4>
jmp    11e9 <ft_ech_choice+0xc9>
jmp    1138 <ft_ech_choice+0x18>
movzbl -0x11(%rbp),%eax
movzbl -0x12(%rbp),%ecx
sub    %ecx,%eax
movzbl -0x13(%rbp),%ecx
add    %ecx,%eax
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_ech_choice>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
movb   $0x0,0x7(%rsp)
movb   $0x0,0x6(%rsp)
movb   $0x0,0x5(%rsp)
lea    0x8(%rsp),%r15
lea    0x7(%rsp),%r12
lea    0x6(%rsp),%r13
lea    0x5(%rsp),%rbx
jmp    1166 <ft_ech_choice+0x46>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
test   %al,%al
jne    11cb <ft_ech_choice+0xab>
mov    (%r14),%rax
lea    0x8(%rax),%rcx
mov    %rcx,(%r14)
mov    0x8(%rax),%rax
test   %rax,%rax
je     11cb <ft_ech_choice+0xab>
cmpb   $0x2d,(%rax)
jne    11cb <ft_ech_choice+0xab>
lea    0x1(%rax),%rcx
mov    %rcx,0x8(%rsp)
mov    0x1(%rax),%al
test   %al,%al
je     1160 <ft_ech_choice+0x40>
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <ft_ech_check@plt>
test   %eax,%eax
je     11c0 <ft_ech_choice+0xa0>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
call   1040 <ft_ech_choice_select@plt>
mov    0x8(%rsp),%rax
movzbl (%rax),%eax
test   %al,%al
jne    1190 <ft_ech_choice+0x70>
jmp    1160 <ft_ech_choice+0x40>
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rax
mov    (%rax),%al
test   %al,%al
je     1166 <ft_ech_choice+0x46>
mov    0x7(%rsp),%al
sub    0x6(%rsp),%al
add    0x5(%rsp),%al
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define zeroext i8 @ft_ech_choice(i8*** nocapture %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = bitcast i8** %2 to i8*
store i8 0, i8* %3
store i8 0, i8* %4
store i8 0, i8* %5
br label %7
7: ; preds = %31, %1
%8 = load i8**, i8*** %0
%9 = getelementptr inbounds i8*, i8** %8, i64 1
store i8** %9, i8*** %0
%10 = load i8*, i8** %9
%11 = icmp eq i8* %10, null
br i1 %11, label %34, label %12
12: ; preds = %7
%13 = load i8, i8* %10
%14 = icmp eq i8 %13, 45
br i1 %14, label %15, label %34
15: ; preds = %12
%16 = getelementptr inbounds i8, i8* %10, i64 1
store i8* %16, i8** %2
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %31, label %19
19: ; preds = %15, %26
%20 = phi i8 [ %29, %26 ], [ %17, %15 ]
%21 = call i32 @ft_ech_check(i8 signext %20)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i8*, i8** %2
%25 = load i8, i8* %24
br label %31
26: ; preds = %19
%27 = call i32 @ft_ech_choice_select(i8** %2, i8* %3, i8* %4, i8* %5)
%28 = load i8*, i8** %2
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 0
br i1 %30, label %31, label %19
31: ; preds = %26, %23, %15
%32 = phi i8 [ 0, %15 ], [ %25, %23 ], [ 0, %26 ]
%33 = icmp eq i8 %32, 0
br i1 %33, label %7, label %34
34: ; preds = %7, %31, %12
%35 = load i8, i8* %3
%36 = load i8, i8* %4
%37 = sub i8 %35, %36
%38 = load i8, i8* %5
%39 = add i8 %37, %38
ret i8 %39
}