#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*/ print_characters(unsigned char const *, size_t, size_t);
int /*<<< orphan*/ print_numbers(unsigned char const *, size_t, size_t);
int /*<<< orphan*/ write(int, char *, int);
void ft_print_memory(const void *addr, size_t size) {
  size_t i;
  i = 0;
  while (i < size) {
    print_numbers((const unsigned char *)addr, size, i);
    print_characters((const unsigned char *)addr, size, i);
    write(1, "\n", 1);
    i += 16;
  }
}


x86 assembly (clang, -O0):
<ft_print_memory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    119c <ft_print_memory+0x6c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <print_numbers@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <print_characters@plt>
mov    $0x1,%edx
lea    0xe7c(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
mov    -0x18(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x18(%rbp)
jmp    1148 <ft_print_memory+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_print_memory>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     1187 <ft_print_memory+0x57>
mov    %rsi,%r15
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xeb4(%rip),%r12
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <print_numbers@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <print_characters@plt>
mov    $0x1,%edi
mov    %r12,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0x10,%rbx
cmp    %r15,%rbx
jb     1150 <ft_print_memory+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @ft_print_memory(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %10, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %22
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i64, i64* %4
%13 = load i64, i64* %5
%14 = call i32 @print_numbers(i8* %11, i64 %12, i64 %13)
%15 = load i8*, i8** %3
%16 = load i64, i64* %4
%17 = load i64, i64* %5
%18 = call i32 @print_characters(i8* %15, i64 %16, i64 %17)
%19 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%20 = load i64, i64* %5
%21 = add i64 %20, 16
store i64 %21, i64* %5
br label %6
22: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @ft_print_memory(i8* %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %9, %4 ], [ 0, %2 ]
%6 = tail call i32 @print_numbers(i8* %0, i64 %1, i64 %5)
%7 = tail call i32 @print_characters(i8* %0, i64 %1, i64 %5)
%8 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%9 = add i64 %5, 16
%10 = icmp ult i64 %9, %1
br i1 %10, label %4, label %11
11: ; preds = %4, %2
ret void
}