#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);
int /*<<< orphan*/ print_string(unsigned char *, unsigned int);
void *ft_print_memory(void *addr, unsigned int size) {
  int intr_it;
  unsigned char *src;
  src = addr;
  intr_it = size / 16;
  while (intr_it >= 0 && (unsigned)intr_it < size) {
    ft_putnbr_base((unsigned int)&src[0]);
    ft_putchar(':');
    ft_putchar(' ');
    print_string(src, size);
    intr_it--;
    src += 16;
    size -= 16;
    ft_putchar('\n');
  }
  return (addr);
}


x86 assembly (clang, -O0):
<ft_print_memory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x4,%eax
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x19(%rbp)
jl     116b <ft_print_memory+0x3b>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
setb   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    117b <ft_print_memory+0x4b>
jmp    11d3 <ft_print_memory+0xa3>
mov    -0x18(%rbp),%rax
mov    %eax,%edi
call   1050 <ft_putnbr_base@plt>
mov    $0x3a,%edi
call   1040 <ft_putchar@plt>
mov    $0x20,%edi
call   1040 <ft_putchar@plt>
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <print_string@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x10,%eax
mov    %eax,-0xc(%rbp)
mov    $0xa,%edi
call   1040 <ft_putchar@plt>
jmp    1150 <ft_print_memory+0x20>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_print_memory>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
mov    %esi,%r12d
shr    $0x4,%r12d
cmp    %esi,%r12d
jae    11ae <ft_print_memory+0x7e>
mov    %esi,%r15d
add    $0xffffffff,%r12d
mov    %r14d,%ebx
mov    %r14,%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%edi
call   1050 <ft_putnbr_base@plt>
mov    $0x3a,%edi
call   1040 <ft_putchar@plt>
mov    $0x20,%edi
call   1040 <ft_putchar@plt>
mov    %rbp,%rdi
mov    %r15d,%esi
call   1030 <print_string@plt>
mov    $0xa,%edi
call   1040 <ft_putchar@plt>
cmp    $0xffffffff,%r12d
je     11ae <ft_print_memory+0x7e>
add    $0x10,%rbp
add    $0xfffffff0,%r15d
add    $0x10,%ebx
lea    -0x1(%r12),%eax
cmp    %r15d,%r12d
mov    %eax,%r12d
jb     1160 <ft_print_memory+0x30>
mov    %r14,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @ft_print_memory(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
store i8* %7, i8** %6
%8 = load i32, i32* %4
%9 = udiv i32 %8, 16
store i32 %9, i32* %5
br label %10
10: ; preds = %19, %2
%11 = load i32, i32* %5
%12 = icmp sge i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = icmp ult i32 %14, %15
br label %17
17: ; preds = %13, %10
%18 = phi i1 [ false, %10 ], [ %16, %13 ]
br i1 %18, label %19, label %36
19: ; preds = %17
%20 = load i8*, i8** %6
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = ptrtoint i8* %21 to i32
%23 = call i32 @ft_putnbr_base(i32 %22)
%24 = call i32 @ft_putchar(i8 signext 58)
%25 = call i32 @ft_putchar(i8 signext 32)
%26 = load i8*, i8** %6
%27 = load i32, i32* %4
%28 = call i32 @print_string(i8* %26, i32 %27)
%29 = load i32, i32* %5
%30 = add nsw i32 %29, -1
store i32 %30, i32* %5
%31 = load i8*, i8** %6
%32 = getelementptr inbounds i8, i8* %31, i64 16
store i8* %32, i8** %6
%33 = load i32, i32* %4
%34 = sub i32 %33, 16
store i32 %34, i32* %4
%35 = call i32 @ft_putchar(i8 signext 10)
br label %10
36: ; preds = %17
%37 = load i8*, i8** %3
ret i8* %37
}

LLVM IR (-O2):
define i8* @ft_print_memory(i8* returned %0, i32 %1) {
%3 = lshr i32 %1, 4
%4 = icmp ult i32 %3, %1
br i1 %4, label %5, label %22
5: ; preds = %2, %5
%6 = phi i8* [ %16, %5 ], [ %0, %2 ]
%7 = phi i32 [ %15, %5 ], [ %3, %2 ]
%8 = phi i32 [ %17, %5 ], [ %1, %2 ]
%9 = ptrtoint i8* %6 to i64
%10 = trunc i64 %9 to i32
%11 = tail call i32 @ft_putnbr_base(i32 %10)
%12 = tail call i32 @ft_putchar(i8 signext 58)
%13 = tail call i32 @ft_putchar(i8 signext 32)
%14 = tail call i32 @print_string(i8* %6, i32 %8)
%15 = add nsw i32 %7, -1
%16 = getelementptr inbounds i8, i8* %6, i64 16
%17 = add i32 %8, -16
%18 = tail call i32 @ft_putchar(i8 signext 10)
%19 = icmp ne i32 %7, 0
%20 = icmp ult i32 %15, %17
%21 = select i1 %19, i1 %20, i1 false
br i1 %21, label %5, label %22
22: ; preds = %5, %2
ret i8* %0
}