#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 const ft_atoi(char *);
char const ft_evalhex(char *);
scalar_t__ ft_isdigit(char const);
scalar_t__ ft_ishex(char const);
int /*<<< orphan*/ ft_putchar(char const);
void ft_ech_expr(const char *str) {
  char argatoi[4];
  *(3 + argatoi) = 0;
  if ((*str == 'x' || ft_isdigit(*str)) && ft_ishex(*(1 + str)) &&
      ft_ishex(*(2 + str))) {
    *(argatoi) = (*str == 'x') ? '0' : *str;
    *(1 + argatoi) = *(1 + str);
    *(2 + argatoi) = *(2 + str);
    if (*str == 'x')
      (void)ft_putchar(ft_evalhex(argatoi));
    else
      (void)ft_putchar(ft_atoi(argatoi));
  } else {
    (void)ft_putchar('\\');
    (void)ft_putchar(*(str));
    (void)ft_putchar(*(1 + str));
    (void)ft_putchar(*(2 + str));
  }
  return;
}


x86 assembly (clang, -O0):
<ft_ech_expr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x78,%eax
je     1186 <ft_ech_expr+0x36>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <ft_isdigit@plt>
cmp    $0x0,%rax
je     1231 <ft_ech_expr+0xe1>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <ft_ishex@plt>
cmp    $0x0,%rax
je     1231 <ft_ech_expr+0xe1>
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%edi
call   1030 <ft_ishex@plt>
cmp    $0x0,%rax
je     1231 <ft_ech_expr+0xe1>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x78,%eax
jne    11d1 <ft_ech_expr+0x81>
mov    $0x30,%eax
mov    %eax,-0x10(%rbp)
jmp    11db <ft_ech_expr+0x8b>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%al
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x78,%eax
jne    121b <ft_ech_expr+0xcb>
lea    -0xc(%rbp),%rdi
call   1050 <ft_evalhex@plt>
movsbl %al,%edi
call   1060 <ft_putchar@plt>
jmp    122c <ft_ech_expr+0xdc>
lea    -0xc(%rbp),%rdi
call   1070 <ft_atoi@plt>
movsbl %al,%edi
call   1060 <ft_putchar@plt>
jmp    1261 <ft_ech_expr+0x111>
mov    $0x5c,%edi
call   1060 <ft_putchar@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1060 <ft_putchar@plt>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1060 <ft_putchar@plt>
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%edi
call   1060 <ft_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_ech_expr>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movb   $0x0,0xf(%rsp)
mov    (%rdi),%al
cmp    $0x78,%al
je     1170 <ft_ech_expr+0x20>
movsbl %al,%edi
call   1040 <ft_isdigit@plt>
test   %rax,%rax
je     11b9 <ft_ech_expr+0x69>
movsbl 0x1(%rbx),%edi
call   1030 <ft_ishex@plt>
test   %rax,%rax
je     11b9 <ft_ech_expr+0x69>
movsbl 0x2(%rbx),%edi
call   1030 <ft_ishex@plt>
test   %rax,%rax
je     11b9 <ft_ech_expr+0x69>
movzbl (%rbx),%eax
mov    $0x30,%ecx
cmp    $0x78,%al
cmovne %eax,%ecx
mov    %cl,0xc(%rsp)
mov    0x1(%rbx),%al
mov    %al,0xd(%rsp)
mov    0x2(%rbx),%al
mov    %al,0xe(%rsp)
lea    0xc(%rsp),%rdi
jne    11e2 <ft_ech_expr+0x92>
call   1050 <ft_evalhex@plt>
jmp    11e7 <ft_ech_expr+0x97>
mov    $0x5c,%edi
call   1060 <ft_putchar@plt>
movsbl (%rbx),%edi
call   1060 <ft_putchar@plt>
movsbl 0x1(%rbx),%edi
call   1060 <ft_putchar@plt>
movsbl 0x2(%rbx),%edi
add    $0x10,%rsp
pop    %rbx
jmp    1060 <ft_putchar@plt>
call   1070 <ft_atoi@plt>
movsbl %al,%edi
call   1060 <ft_putchar@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @ft_ech_expr(i8* %0) {
%2 = alloca i8*
%3 = alloca [4 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds i8, i8* %4, i64 3
store i8 0, i8* %5
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 120
br i1 %9, label %15, label %10
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = load i8, i8* %11
%13 = call i64 @ft_isdigit(i8 signext %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %64
15: ; preds = %10, %1
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = load i8, i8* %17
%19 = call i64 @ft_ishex(i8 signext %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %64
21: ; preds = %15
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i64 2
%24 = load i8, i8* %23
%25 = call i64 @ft_ishex(i8 signext %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %64
27: ; preds = %21
%28 = load i8*, i8** %2
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 120
br i1 %31, label %32, label %33
32: ; preds = %27
br label %37
33: ; preds = %27
%34 = load i8*, i8** %2
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
br label %37
37: ; preds = %33, %32
%38 = phi i32 [ 48, %32 ], [ %36, %33 ]
%39 = trunc i32 %38 to i8
%40 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
store i8 %39, i8* %40
%41 = load i8*, i8** %2
%42 = getelementptr inbounds i8, i8* %41, i64 1
%43 = load i8, i8* %42
%44 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%45 = getelementptr inbounds i8, i8* %44, i64 1
store i8 %43, i8* %45
%46 = load i8*, i8** %2
%47 = getelementptr inbounds i8, i8* %46, i64 2
%48 = load i8, i8* %47
%49 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%50 = getelementptr inbounds i8, i8* %49, i64 2
store i8 %48, i8* %50
%51 = load i8*, i8** %2
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = icmp eq i32 %53, 120
br i1 %54, label %55, label %59
55: ; preds = %37
%56 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%57 = call signext i8 @ft_evalhex(i8* %56)
%58 = call i32 @ft_putchar(i8 signext %57)
br label %63
59: ; preds = %37
%60 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%61 = call signext i8 @ft_atoi(i8* %60)
%62 = call i32 @ft_putchar(i8 signext %61)
br label %63
63: ; preds = %59, %55
br label %77
64: ; preds = %21, %15, %10
%65 = call i32 @ft_putchar(i8 signext 92)
%66 = load i8*, i8** %2
%67 = load i8, i8* %66
%68 = call i32 @ft_putchar(i8 signext %67)
%69 = load i8*, i8** %2
%70 = getelementptr inbounds i8, i8* %69, i64 1
%71 = load i8, i8* %70
%72 = call i32 @ft_putchar(i8 signext %71)
%73 = load i8*, i8** %2
%74 = getelementptr inbounds i8, i8* %73, i64 2
%75 = load i8, i8* %74
%76 = call i32 @ft_putchar(i8 signext %75)
br label %77
77: ; preds = %64, %63
ret void
}

LLVM IR (-O2):
define void @ft_ech_expr(i8* nocapture %0) {
%2 = alloca [4 x i8]
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
store i8 0, i8* %4
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 120
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = tail call i64 @ft_isdigit(i8 signext %5)
%9 = icmp eq i64 %8, 0
br i1 %9, label %34, label %10
10: ; preds = %7, %1
%11 = getelementptr inbounds i8, i8* %0, i64 1
%12 = load i8, i8* %11
%13 = tail call i64 @ft_ishex(i8 signext %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %34, label %15
15: ; preds = %10
%16 = getelementptr inbounds i8, i8* %0, i64 2
%17 = load i8, i8* %16
%18 = tail call i64 @ft_ishex(i8 signext %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %34, label %20
20: ; preds = %15
%21 = load i8, i8* %0
%22 = icmp eq i8 %21, 120
%23 = select i1 %22, i8 48, i8 %21
store i8 %23, i8* %3
%24 = load i8, i8* %11
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
store i8 %24, i8* %25
%26 = load i8, i8* %16
%27 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
store i8 %26, i8* %27
br i1 %22, label %28, label %31
28: ; preds = %20
%29 = call signext i8 @ft_evalhex(i8* %3)
%30 = call i32 @ft_putchar(i8 signext %29)
br label %44
31: ; preds = %20
%32 = call signext i8 @ft_atoi(i8* %3)
%33 = call i32 @ft_putchar(i8 signext %32)
br label %44
34: ; preds = %15, %10, %7
%35 = tail call i32 @ft_putchar(i8 signext 92)
%36 = load i8, i8* %0
%37 = tail call i32 @ft_putchar(i8 signext %36)
%38 = getelementptr inbounds i8, i8* %0, i64 1
%39 = load i8, i8* %38
%40 = tail call i32 @ft_putchar(i8 signext %39)
%41 = getelementptr inbounds i8, i8* %0, i64 2
%42 = load i8, i8* %41
%43 = tail call i32 @ft_putchar(i8 signext %42)
br label %44
44: ; preds = %28, %31, %34
ret void
}