#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_putchar(char);
int /*<<< orphan*/ ft_putnbr_base(char, char *);
int ft_strlen(char *);
void hexa_trad_two(char *buf) {
  int i;
  i = 0;
  ft_putchar(' ');
  while (buf && buf[i]) {
    if (buf[i] >= 0 && buf[i] <= 15)
      ft_putchar('0');
    ft_putnbr_base(buf[i], "0123456789abcdef");
    if (i < 15)
      ft_putchar(' ');
    i++;
  }
  if (ft_strlen(buf) < 16) {
    i = ft_strlen(buf) * 3;
    while (++i < 48)
      ft_putchar(' ');
  }
  ft_putchar('\n');
}


x86 assembly (clang, -O0):
<hexa_trad_two>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x20,%edi
call   1040 <ft_putchar@plt>
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     1172 <hexa_trad_two+0x42>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1182 <hexa_trad_two+0x52>
jmp    11f0 <hexa_trad_two+0xc0>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jl     11b6 <hexa_trad_two+0x86>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xf,%eax
jg     11b6 <hexa_trad_two+0x86>
mov    $0x30,%edi
call   1040 <ft_putchar@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
lea    0xe3b(%rip),%rsi
movsbl (%rax,%rcx,1),%edi
call   1050 <ft_putnbr_base@plt>
cmpl   $0xf,-0xc(%rbp)
jge    11e2 <hexa_trad_two+0xb2>
mov    $0x20,%edi
call   1040 <ft_putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114d <hexa_trad_two+0x1d>
mov    -0x8(%rbp),%rdi
call   1030 <ft_strlen@plt>
cmp    $0x10,%eax
jge    1237 <hexa_trad_two+0x107>
mov    -0x8(%rbp),%rdi
call   1030 <ft_strlen@plt>
imul   $0x3,%eax,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmp    $0x30,%eax
jge    1232 <hexa_trad_two+0x102>
mov    $0x20,%edi
call   1040 <ft_putchar@plt>
jmp    1211 <hexa_trad_two+0xe1>
jmp    1237 <hexa_trad_two+0x107>
mov    $0xa,%edi
call   1040 <ft_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexa_trad_two>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    $0x20,%edi
call   1040 <ft_putchar@plt>
test   %r15,%r15
je     119e <hexa_trad_two+0x6e>
mov    (%r15),%al
test   %al,%al
je     119e <hexa_trad_two+0x6e>
xor    %ebx,%ebx
lea    0xea9(%rip),%r14
jmp    116e <hexa_trad_two+0x3e>
nopl   0x0(%rax)
movzbl 0x1(%r15,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
je     119e <hexa_trad_two+0x6e>
cmp    $0xf,%al
ja     1181 <hexa_trad_two+0x51>
mov    $0x30,%edi
call   1040 <ft_putchar@plt>
movzbl (%r15,%rbx,1),%eax
movsbl %al,%edi
mov    %r14,%rsi
call   1050 <ft_putnbr_base@plt>
cmp    $0xe,%rbx
ja     1160 <hexa_trad_two+0x30>
mov    $0x20,%edi
call   1040 <ft_putchar@plt>
jmp    1160 <hexa_trad_two+0x30>
mov    %r15,%rdi
call   1030 <ft_strlen@plt>
cmp    $0xf,%eax
jg     11df <hexa_trad_two+0xaf>
mov    %r15,%rdi
call   1030 <ft_strlen@plt>
lea    (%rax,%rax,2),%eax
cmp    $0x2e,%eax
jg     11df <hexa_trad_two+0xaf>
mov    $0x2f,%ebx
sub    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x20,%edi
call   1040 <ft_putchar@plt>
add    $0xffffffff,%ebx
jne    11d0 <hexa_trad_two+0xa0>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <ft_putchar@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"0123456789abcdef\00"
define void @hexa_trad_two(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = call i32 @ft_putchar(i8 signext 32)
br label %5
5: ; preds = %47, %1
%6 = load i8*, i8** %2
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %16
8: ; preds = %5
%9 = load i8*, i8** %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br label %16
16: ; preds = %8, %5
%17 = phi i1 [ false, %5 ], [ %15, %8 ]
br i1 %17, label %18, label %50
18: ; preds = %16
%19 = load i8*, i8** %2
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp sge i32 %24, 0
br i1 %25, label %26, label %36
26: ; preds = %18
%27 = load i8*, i8** %2
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp sle i32 %32, 15
br i1 %33, label %34, label %36
34: ; preds = %26
%35 = call i32 @ft_putchar(i8 signext 48)
br label %36
36: ; preds = %34, %26, %18
%37 = load i8*, i8** %2
%38 = load i32, i32* %3
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
%41 = load i8, i8* %40
%42 = call i32 @ft_putnbr_base(i8 signext %41, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%43 = load i32, i32* %3
%44 = icmp slt i32 %43, 15
br i1 %44, label %45, label %47
45: ; preds = %36
%46 = call i32 @ft_putchar(i8 signext 32)
br label %47
47: ; preds = %45, %36
%48 = load i32, i32* %3
%49 = add nsw i32 %48, 1
store i32 %49, i32* %3
br label %5
50: ; preds = %16
%51 = load i8*, i8** %2
%52 = call i32 @ft_strlen(i8* %51)
%53 = icmp slt i32 %52, 16
br i1 %53, label %54, label %65
54: ; preds = %50
%55 = load i8*, i8** %2
%56 = call i32 @ft_strlen(i8* %55)
%57 = mul nsw i32 %56, 3
store i32 %57, i32* %3
br label %58
58: ; preds = %62, %54
%59 = load i32, i32* %3
%60 = add nsw i32 %59, 1
store i32 %60, i32* %3
%61 = icmp slt i32 %60, 48
br i1 %61, label %62, label %64
62: ; preds = %58
%63 = call i32 @ft_putchar(i8 signext 32)
br label %58
64: ; preds = %58
br label %65
65: ; preds = %64, %50
%66 = call i32 @ft_putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"0123456789abcdef\00"
define void @hexa_trad_two(i8* %0) {
%2 = tail call i32 @ft_putchar(i8 signext 32)
%3 = icmp eq i8* %0, null
br i1 %3, label %26, label %4
4: ; preds = %1
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %26, label %7
7: ; preds = %4, %21
%8 = phi i8 [ %24, %21 ], [ %5, %4 ]
%9 = phi i8* [ %23, %21 ], [ %0, %4 ]
%10 = phi i64 [ %22, %21 ], [ 0, %4 ]
%11 = icmp ult i8 %8, 16
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = tail call i32 @ft_putchar(i8 signext 48)
%14 = load i8, i8* %9
br label %15
15: ; preds = %12, %7
%16 = phi i8 [ %14, %12 ], [ %8, %7 ]
%17 = tail call i32 @ft_putnbr_base(i8 signext %16, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%18 = icmp ult i64 %10, 15
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = tail call i32 @ft_putchar(i8 signext 32)
br label %21
21: ; preds = %19, %15
%22 = add nuw i64 %10, 1
%23 = getelementptr inbounds i8, i8* %0, i64 %22
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %7
26: ; preds = %21, %4, %1
%27 = tail call i32 @ft_strlen(i8* %0)
%28 = icmp slt i32 %27, 16
br i1 %28, label %29, label %38
29: ; preds = %26
%30 = tail call i32 @ft_strlen(i8* %0)
%31 = mul nsw i32 %30, 3
%32 = icmp slt i32 %31, 47
br i1 %32, label %33, label %38
33: ; preds = %29, %33
%34 = phi i32 [ %35, %33 ], [ %31, %29 ]
%35 = add i32 %34, 1
%36 = tail call i32 @ft_putchar(i8 signext 32)
%37 = icmp eq i32 %35, 47
br i1 %37, label %38, label %33
38: ; preds = %33, %29, %26
%39 = tail call i32 @ft_putchar(i8 signext 10)
ret void
}