#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(unsigned int, char *);
void print_hex_memory(unsigned int *it, unsigned char *src, unsigned int size) {
  int spc_it;
  if (*it < size) {
    ft_putnbr_base((unsigned int)src[*it], "0123456789abcdef");
    if (*it + 1 < size)
      ft_putnbr_base((unsigned int)src[*it + 1], "0123456789abcdef");
    else {
      ft_putchar(' ');
      ft_putchar(' ');
    }
    ft_putchar(' ');
  } else {
    spc_it = 0;
    while (spc_it++ < 5)
      ft_putchar(' ');
  }
  *it = *it + 2;
}


x86 assembly (clang, -O0):
<print_hex_memory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
jae    11b5 <print_hex_memory+0x95>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%ecx
movzbl (%rax,%rcx,1),%edi
lea    0xea9(%rip),%rsi
call   1040 <ft_putnbr_base@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
add    $0x1,%eax
cmp    -0x14(%rbp),%eax
jae    1192 <print_hex_memory+0x72>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%edi
lea    0xe78(%rip),%rsi
call   1040 <ft_putnbr_base@plt>
jmp    11a6 <print_hex_memory+0x86>
mov    $0x20,%edi
call   1030 <ft_putchar@plt>
mov    $0x20,%edi
call   1030 <ft_putchar@plt>
mov    $0x20,%edi
call   1030 <ft_putchar@plt>
jmp    11e4 <print_hex_memory+0xc4>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x18(%rbp)
cmp    $0x5,%eax
jge    11df <print_hex_memory+0xbf>
mov    $0x20,%edi
call   1030 <ft_putchar@plt>
jmp    11bc <print_hex_memory+0x9c>
jmp    11e4 <print_hex_memory+0xc4>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x2,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_hex_memory>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%eax
cmp    %edx,%eax
jae    1160 <print_hex_memory+0x40>
mov    %edx,%ebp
mov    %rsi,%r14
movzbl (%rsi,%rax,1),%edi
lea    0xec3(%rip),%rsi
call   1040 <ft_putnbr_base@plt>
mov    (%rbx),%eax
add    $0x1,%eax
cmp    %ebp,%eax
jae    1174 <print_hex_memory+0x54>
mov    %eax,%eax
movzbl (%r14,%rax,1),%edi
lea    0xea7(%rip),%rsi
call   1040 <ft_putnbr_base@plt>
jmp    1188 <print_hex_memory+0x68>
mov    $0x20,%edi
call   1030 <ft_putchar@plt>
mov    $0x20,%edi
call   1030 <ft_putchar@plt>
mov    $0x20,%edi
call   1030 <ft_putchar@plt>
mov    $0x20,%edi
call   1030 <ft_putchar@plt>
mov    $0x20,%edi
call   1030 <ft_putchar@plt>
addl   $0x2,(%rbx)
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"0123456789abcdef\00"
define void @print_hex_memory(i32* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = load i32, i32* %0
%5 = icmp ult i32 %4, %2
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = tail call i32 @ft_putchar(i8 signext 32)
%8 = tail call i32 @ft_putchar(i8 signext 32)
%9 = tail call i32 @ft_putchar(i8 signext 32)
%10 = tail call i32 @ft_putchar(i8 signext 32)
br label %29
11: ; preds = %3
%12 = zext i32 %4 to i64
%13 = getelementptr inbounds i8, i8* %1, i64 %12
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = tail call i32 @ft_putnbr_base(i32 %15, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* %0
%18 = add i32 %17, 1
%19 = icmp ult i32 %18, %2
br i1 %19, label %20, label %26
20: ; preds = %11
%21 = zext i32 %18 to i64
%22 = getelementptr inbounds i8, i8* %1, i64 %21
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = tail call i32 @ft_putnbr_base(i32 %24, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %29
26: ; preds = %11
%27 = tail call i32 @ft_putchar(i8 signext 32)
%28 = tail call i32 @ft_putchar(i8 signext 32)
br label %29
29: ; preds = %20, %26, %6
%30 = tail call i32 @ft_putchar(i8 signext 32)
%31 = load i32, i32* %0
%32 = add i32 %31, 2
store i32 %32, i32* %0
ret void
}